* [Bug rtl-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
@ 2021-04-23 21:24 ` jakub at gcc dot gnu.org
2021-04-26 12:55 ` [Bug tree-optimization/100239] " jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-23 21:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Last reconfirmed| |2021-04-23
CC| |jakub at gcc dot gnu.org
Priority|P3 |P2
Target Milestone|--- |10.4
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with my r10-1201-g2e83f583c27ef7a9d3b0fb0b5ed372439d6222a8
I'll have a look.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
2021-04-23 21:24 ` [Bug rtl-optimization/100239] " jakub at gcc dot gnu.org
@ 2021-04-26 12:55 ` jakub at gcc dot gnu.org
2021-04-27 13:43 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-26 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50678
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50678&action=edit
gcc11-pr100239.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
2021-04-23 21:24 ` [Bug rtl-optimization/100239] " jakub at gcc dot gnu.org
2021-04-26 12:55 ` [Bug tree-optimization/100239] " jakub at gcc dot gnu.org
@ 2021-04-27 13:43 ` cvs-commit at gcc dot gnu.org
2021-04-27 13:56 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-27 13:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:83d26d0e1b3625ab6c2d83610a13976b52f63e0a
commit r12-159-g83d26d0e1b3625ab6c2d83610a13976b52f63e0a
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 27 15:42:47 2021 +0200
veclower: Fix up vec_shl matching of VEC_PERM_EXPR [PR100239]
The following testcase ICEs at -O0, because lower_vec_perm sees the
_1 = { 0, 0, 0, 0, 0, 0, 0, 0 };
_2 = VEC_COND_EXPR <_1, { -1, -1, -1, -1, -1, -1, -1, -1 }, { 0, 0, 0, 0,
0, 0, 0, 0 }>;
_3 = { 6, 0, 0, 0, 0, 0, 0, 0 };
_4 = VEC_PERM_EXPR <{ 0, 0, 0, 0, 0, 0, 0, 0 }, _2, _3>;
and as the ISA is SSE2, there is no support for the particular permutation
nor for variable mask permutation. But, the code to match vec_shl matches
it, because the permutation has the first operand a zero vector and the
mask picks all elements randomly from that vector.
So, in the end that isn't a vec_shl, but the permutation could be in theory
optimized into the first argument. As we keep it as is, it will fail
during expansion though, because that for vec_shl correctly requires that
it actually is a shift:
unsigned firstidx = 0;
for (unsigned int i = 0; i < nelt; i++)
{
if (known_eq (sel[i], nelt))
{
if (i == 0 || firstidx)
return NULL_RTX;
firstidx = i;
}
else if (firstidx
? maybe_ne (sel[i], nelt + i - firstidx)
: maybe_ge (sel[i], nelt))
return NULL_RTX;
}
if (firstidx == 0)
return NULL_RTX;
first = firstidx;
The if (firstidx == 0) return NULL; is what is missing a counterpart
on the lower_vec_perm side.
As with optimize != 0 we fold it in other spots, I think it is not needed
to optimize this cornercase in lower_vec_perm (which would mean we'd need
to recurse on the newly created _4 = { 0, 0, 0, 0, 0, 0, 0, 0 };
whether it is supported or not).
2021-04-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/100239
* tree-vect-generic.c (lower_vec_perm): Don't accept constant
permutations with all indices from the first zero element as
vec_shl.
* gcc.dg/pr100239.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (2 preceding siblings ...)
2021-04-27 13:43 ` cvs-commit at gcc dot gnu.org
@ 2021-04-27 13:56 ` cvs-commit at gcc dot gnu.org
2021-04-27 13:58 ` [Bug tree-optimization/100239] [10 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-27 13:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:80dc24f813a9d8951d75eea7324f6d713b872bca
commit r11-8300-g80dc24f813a9d8951d75eea7324f6d713b872bca
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 27 15:42:47 2021 +0200
veclower: Fix up vec_shl matching of VEC_PERM_EXPR [PR100239]
The following testcase ICEs at -O0, because lower_vec_perm sees the
_1 = { 0, 0, 0, 0, 0, 0, 0, 0 };
_2 = VEC_COND_EXPR <_1, { -1, -1, -1, -1, -1, -1, -1, -1 }, { 0, 0, 0, 0,
0, 0, 0, 0 }>;
_3 = { 6, 0, 0, 0, 0, 0, 0, 0 };
_4 = VEC_PERM_EXPR <{ 0, 0, 0, 0, 0, 0, 0, 0 }, _2, _3>;
and as the ISA is SSE2, there is no support for the particular permutation
nor for variable mask permutation. But, the code to match vec_shl matches
it, because the permutation has the first operand a zero vector and the
mask picks all elements randomly from that vector.
So, in the end that isn't a vec_shl, but the permutation could be in theory
optimized into the first argument. As we keep it as is, it will fail
during expansion though, because that for vec_shl correctly requires that
it actually is a shift:
unsigned firstidx = 0;
for (unsigned int i = 0; i < nelt; i++)
{
if (known_eq (sel[i], nelt))
{
if (i == 0 || firstidx)
return NULL_RTX;
firstidx = i;
}
else if (firstidx
? maybe_ne (sel[i], nelt + i - firstidx)
: maybe_ge (sel[i], nelt))
return NULL_RTX;
}
if (firstidx == 0)
return NULL_RTX;
first = firstidx;
The if (firstidx == 0) return NULL; is what is missing a counterpart
on the lower_vec_perm side.
As with optimize != 0 we fold it in other spots, I think it is not needed
to optimize this cornercase in lower_vec_perm (which would mean we'd need
to recurse on the newly created _4 = { 0, 0, 0, 0, 0, 0, 0, 0 };
whether it is supported or not).
2021-04-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/100239
* tree-vect-generic.c (lower_vec_perm): Don't accept constant
permutations with all indices from the first zero element as
vec_shl.
* gcc.dg/pr100239.c: New test.
(cherry picked from commit 83d26d0e1b3625ab6c2d83610a13976b52f63e0a)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (3 preceding siblings ...)
2021-04-27 13:56 ` cvs-commit at gcc dot gnu.org
@ 2021-04-27 13:58 ` jakub at gcc dot gnu.org
2022-06-28 10:44 ` jakub at gcc dot gnu.org
2023-07-07 9:37 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 13:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12 Regression] ICE: |[10 Regression] ICE: in
|in expand_expr_real_2, at |expand_expr_real_2, at
|expr.c:9865 with |expr.c:9865 with
|__builtin_shuffle() |__builtin_shuffle()
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk and for 11.2 so far.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (4 preceding siblings ...)
2021-04-27 13:58 ` [Bug tree-optimization/100239] [10 " jakub at gcc dot gnu.org
@ 2022-06-28 10:44 ` jakub at gcc dot gnu.org
2023-07-07 9:37 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (5 preceding siblings ...)
2022-06-28 10:44 ` jakub at gcc dot gnu.org
@ 2023-07-07 9:37 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 9:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |11.2.0
Known to fail| |10.5.0
Status|ASSIGNED |RESOLVED
Target Milestone|10.5 |11.2
Resolution|--- |FIXED
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 11.2.
^ permalink raw reply [flat|nested] 8+ messages in thread