public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110541] New: Invalid VEC_PERM_EXPR mask element size
@ 2023-07-04 11:33 kristerw at gcc dot gnu.org
2023-07-05 6:55 ` [Bug tree-optimization/110541] " rguenth at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: kristerw at gcc dot gnu.org @ 2023-07-04 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110541
Bug ID: 110541
Summary: Invalid VEC_PERM_EXPR mask element size
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kristerw at gcc dot gnu.org
Target Milestone: ---
tree.def says:
The number of MASK elements must be the same with the
number of elements in V0 and V1. The size of the inner type
of the MASK and of the V0 and V1 must be the same.
But tree-vectorizer creates permutations where the MASK element size is
different than for V0 and V1, such as
vector(8) unsigned short _79;
...
_79 = VEC_PERM_EXPR <_78, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 4, 5, 6, 7, 8, 9, 10,
11 }>;
where the MASK elements are of a 64-bit type.
This can be seen when compiling the following function (from
gcc.c-torture/compile/20000717-1.c) as "gcc -S -O3" for x86_64:
short
inner_product (short *a, short *b)
{
int i;
short sum = 0;
for (i = 9; i >= 0; i--)
sum += (*a++) * (*b++);
return sum;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/110541] Invalid VEC_PERM_EXPR mask element size
2023-07-04 11:33 [Bug tree-optimization/110541] New: Invalid VEC_PERM_EXPR mask element size kristerw at gcc dot gnu.org
@ 2023-07-05 6:55 ` rguenth at gcc dot gnu.org
2023-07-05 7:47 ` cvs-commit at gcc dot gnu.org
2023-07-05 8:11 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-05 6:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110541
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2023-07-05
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The restriction as documented in tree.def applies to non-constant MASKs only,
the case for constant MASKs was relaxed. Like
/* Vector permutation expression. A = VEC_PERM_EXPR<v0, v1, mask> means
N = length(mask)
foreach i in N:
M = mask[i] % (length(v0) + length(v1))
A[i] = M < length(v0) ? v0[M] : v1[M - length(v0)]
V0 and V1 are vectors of the same type.
When MASK is not constant:
MASK is an integer-typed vector. The number of MASK elements must
be the same with the number of elements in V0 and V1. The size of
the inner type of the MASK and of the V0 and V1 must be the same.
When MASK is constant:
MASK is an integer-typed vector. MASK elements outside of
[0, length(V0) + length(V1) - 1] invoke undefined behavior (the
modulo operation above doesn't apply).
*/
DEFTREECODE (VEC_PERM_EXPR, "vec_perm_expr", tcc_expression, 3)
I will submit this change.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/110541] Invalid VEC_PERM_EXPR mask element size
2023-07-04 11:33 [Bug tree-optimization/110541] New: Invalid VEC_PERM_EXPR mask element size kristerw at gcc dot gnu.org
2023-07-05 6:55 ` [Bug tree-optimization/110541] " rguenth at gcc dot gnu.org
@ 2023-07-05 7:47 ` cvs-commit at gcc dot gnu.org
2023-07-05 8:11 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-05 7:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110541
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:9fed1ec67f83f3c56c030fe2a501b01ceb6e243f
commit r14-2311-g9fed1ec67f83f3c56c030fe2a501b01ceb6e243f
Author: Richard Biener <rguenther@suse.de>
Date: Wed Jul 5 08:53:01 2023 +0200
middle-end/110541 - VEC_PERM_EXPR documentation is off
The following adjusts the tree.def documentation about VEC_PERM_EXPR
which wasn't adjusted when the restrictions of permutes with constant
mask were relaxed.
PR middle-end/110541
* tree.def (VEC_PERM_EXPR): Adjust documentation to reflect
reality.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/110541] Invalid VEC_PERM_EXPR mask element size
2023-07-04 11:33 [Bug tree-optimization/110541] New: Invalid VEC_PERM_EXPR mask element size kristerw at gcc dot gnu.org
2023-07-05 6:55 ` [Bug tree-optimization/110541] " rguenth at gcc dot gnu.org
2023-07-05 7:47 ` cvs-commit at gcc dot gnu.org
@ 2023-07-05 8:11 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-05 8:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110541
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Keywords| |documentation
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed as documentation issue. Note
"MASK elements outside of [0, length(V0) + length(V1) - 1] invoke undefined
behavior (the modulo operation above doesn't apply)."
isn't actually the case, it would be a missed canonicalization only.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-05 8:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04 11:33 [Bug tree-optimization/110541] New: Invalid VEC_PERM_EXPR mask element size kristerw at gcc dot gnu.org
2023-07-05 6:55 ` [Bug tree-optimization/110541] " rguenth at gcc dot gnu.org
2023-07-05 7:47 ` cvs-commit at gcc dot gnu.org
2023-07-05 8:11 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).