* [Bug rtl-optimization/114070] [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
@ 2024-02-23 7:29 ` sjames at gcc dot gnu.org
2024-02-23 7:36 ` [Bug middle-end/114070] " rguenth at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-23 7:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
I'll reduce.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
2024-02-23 7:29 ` [Bug rtl-optimization/114070] " sjames at gcc dot gnu.org
@ 2024-02-23 7:36 ` rguenth at gcc dot gnu.org
2024-02-23 11:56 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-23 7:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
Target| |sparc
Target Milestone|--- |12.4
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
/* For vector typed comparisons emit code to generate the desired
all-ones or all-zeros mask. */
if (VECTOR_TYPE_P (ops->type))
{
tree ifexp = build2 (ops->code, ops->type, arg0, arg1);
if (VECTOR_BOOLEAN_TYPE_P (ops->type)
&& expand_vec_cmp_expr_p (TREE_TYPE (arg0), ops->type, ops->code))
return expand_vec_cmp_expr (ops->type, ifexp, target);
else
gcc_unreachable ();
that means we end up with a non-boolean vector "flag". Possibly a middle-end
issue indeed.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
2024-02-23 7:29 ` [Bug rtl-optimization/114070] " sjames at gcc dot gnu.org
2024-02-23 7:36 ` [Bug middle-end/114070] " rguenth at gcc dot gnu.org
@ 2024-02-23 11:56 ` rguenth at gcc dot gnu.org
2024-02-23 12:16 ` sjames at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-23 11:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2024-02-23
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, I can't reproduce with a cross configured like
../configure --target=sparc64-unknown-linux-gnu --enable-languages=c
also not when adding -fPIE. Is there any other magic happening? What's
the cc1 command-line?
Hmm, looks like there are assembler tests that disable CPU support features...
#define HAVE_AS_FMAF_HPC_VIS3
looks needed, then it reproduces.
We are expanding
_28 = .VCOND (vect__165.122_219, { 16384, 16384 }, { -1, -1 }, _112, 114);
and when expanding _112 we have
<ssa_name 0x7ffff5e07bd0
type <vector_type 0x7ffff5cdc9d8
type <boolean_type 0x7ffff5c91930 public SI
size <integer_cst 0x7ffff6a20060 constant 32>
unit-size <integer_cst 0x7ffff6a20078 constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff5c91930 precision:32 min <integer_cst 0x7ffff5d71210 -2147483648> max
<integer_cst 0x7ffff5d71258 2147483647>>
V2SI
size <integer_cst 0x7ffff6a0be10 constant 64>
unit-size <integer_cst 0x7ffff6a0be28 constant 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff5cdc9d8 nunits:2>
visited
def_stmt _112 = vect_cst__33 == { 0, 0 };
version:112>
so the issue is that we can't expand vect_cst__33 == { 0, 0 } and
this goes downhill after some match.pd stuff putting up VEC_CONDs for
masks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (2 preceding siblings ...)
2024-02-23 11:56 ` rguenth at gcc dot gnu.org
@ 2024-02-23 12:16 ` sjames at gcc dot gnu.org
2024-02-23 12:46 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-23 12:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
reduced:
```
struct name_entry {
int mode;
} traverse_trees(), *unresolved_n;
void unresolved(int i, unsigned dirmask, unsigned mask) {
for (; i; i++) {
mask |= 1;
if (!unresolved_n[i].mode || unresolved_n[i].mode & 70000)
dirmask |= i;
}
if (dirmask == mask)
traverse_trees();
}
```
and yeah, sorry Richard - I can't reproduce via cross either on my build. I
wasn't aware of that configure test..
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (3 preceding siblings ...)
2024-02-23 12:16 ` sjames at gcc dot gnu.org
@ 2024-02-23 12:46 ` rguenth at gcc dot gnu.org
2024-02-23 13:11 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-23 12:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Further reduced:
int unresolved(unsigned dirmask, unsigned mask, int *unresolved_n)
{
for (int i = 0; i < 1024; i++) {
mask |= 1;
if (!unresolved_n[i] || unresolved_n[i] & 70000)
dirmask |= 1;
}
return (dirmask == mask);
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (4 preceding siblings ...)
2024-02-23 12:46 ` rguenth at gcc dot gnu.org
@ 2024-02-23 13:11 ` rguenth at gcc dot gnu.org
2024-02-23 15:15 ` [Bug middle-end/114070] [12/13/14 " rguenth at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-23 13:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we vectorize this to
_97 = vect__4.15_91 == { 0, 0 };
vect_patt_8.17_98 = VEC_COND_EXPR <_97, { 1, 1 }, { 0, 0 }>;
_102 = vect__5.16_93 != { 0, 0 };
vect_patt_19.18_103 = VEC_COND_EXPR <_102, { 1, 1 }, { 0, 0 }>;
vect_patt_10.19_104 = vect_patt_8.17_98 | vect_patt_19.18_103;
_108 = vect_patt_10.19_104 != { 0, 0 };
vect_patt_7.20_109 = VEC_COND_EXPR <_108, { 1, 1 }, { 0, 0 }>;
where the _108/_109 defs are really redundant. VRP2 is then the first
pass folding every stmt I think and it transforms this to
_97 = vect__4.15_91 == { 0, 0 };
_102 = vect__5.16_93 != { 0, 0 };
_108 = VEC_COND_EXPR <_97, { -1, -1 }, _102>;
vect_patt_7.20_109 = VEC_COND_EXPR <_108, { 1, 1 }, { 0, 0 }>;
I think this is matching
(simplify
(op (vec_cond:s @0 @1 @2) @3)
(vec_cond @0 (op! @1 @3) (op! @2 @3)))
but since this changes the type of the vec_cond it has to verify it's
still supported.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13/14 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (5 preceding siblings ...)
2024-02-23 13:11 ` rguenth at gcc dot gnu.org
@ 2024-02-23 15:15 ` rguenth at gcc dot gnu.org
2024-02-26 7:43 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-23 15:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 57512
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57512&action=edit
patch I am testing
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13/14 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (6 preceding siblings ...)
2024-02-23 15:15 ` [Bug middle-end/114070] [12/13/14 " rguenth at gcc dot gnu.org
@ 2024-02-26 7:43 ` cvs-commit at gcc dot gnu.org
2024-02-26 7:44 ` [Bug middle-end/114070] [12/13 " rguenth at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-26 7:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #8 from GCC 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:af66ad89e8169f44db723813662917cf4cbb78fc
commit r14-9173-gaf66ad89e8169f44db723813662917cf4cbb78fc
Author: Richard Biener <rguenther@suse.de>
Date: Fri Feb 23 16:06:05 2024 +0100
middle-end/114070 - folding breaking VEC_COND expansion
The following properly guards the simplifications that move
operations into VEC_CONDs, in particular when that changes the
type constraints on this operation.
This needed a genmatch fix which was recording spurious implicit fors
when tcc_comparison is used in a C expression.
PR middle-end/114070
* genmatch.cc (parser::parse_c_expr): Do not record operand
lists but only mark operators used.
* match.pd ((c ? a : b) op (c ? d : e) --> c ? (a op d) : (b op
e)):
Properly guard the case of tcc_comparison changing the VEC_COND
value operand type.
* gcc.dg/torture/pr114070.c: New testcase.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (7 preceding siblings ...)
2024-02-26 7:43 ` cvs-commit at gcc dot gnu.org
@ 2024-02-26 7:44 ` rguenth at gcc dot gnu.org
2024-03-01 12:10 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-26 7:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Summary|[12/13/14 regression] ICE |[12/13 regression] ICE when
|when building git-2.43.2 |building git-2.43.2 with
|with -mcpu=niagara4 |-mcpu=niagara4
|-fno-vect-cost-model |-fno-vect-cost-model
Known to work| |14.0
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be fixed on trunk.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (8 preceding siblings ...)
2024-02-26 7:44 ` [Bug middle-end/114070] [12/13 " rguenth at gcc dot gnu.org
@ 2024-03-01 12:10 ` cvs-commit at gcc dot gnu.org
2024-03-21 11:49 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-01 12:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #10 from GCC 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:f9c30ea737b806caac917d8f501305151a2cbd57
commit r14-9252-gf9c30ea737b806caac917d8f501305151a2cbd57
Author: Richard Biener <rguenther@suse.de>
Date: Thu Feb 29 09:22:19 2024 +0100
middle-end/114070 - VEC_COND_EXPR folding
The following amends the PR114070 fix to optimistically allow
the folding when we cannot expand the current vec_cond using
vcond_mask and we're still before vector lowering. This leaves
a small window between vectorization and lowering where we could
break vec_conds that can be expanded via vcond{,u,eq}, most
susceptible is the loop unrolling pass which applies VN and thus
possibly folding to the unrolled body of a vectorized loop.
This gets back the folding for targets that cannot do vectorization.
It doesn't get back the folding for x86 with AVX512 for example
since that can handle the original IL but not the folded since
it misses some vcond_mask expanders.
PR middle-end/114070
* match.pd ((c ? a : b) op d --> c ? (a op d) : (b op d)):
Allow the folding if before lowering and the current IL
isn't supported with vcond_mask.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (9 preceding siblings ...)
2024-03-01 12:10 ` cvs-commit at gcc dot gnu.org
@ 2024-03-21 11:49 ` cvs-commit at gcc dot gnu.org
2024-03-21 11:49 ` cvs-commit at gcc dot gnu.org
2024-06-20 9:15 ` [Bug middle-end/114070] [12 " rguenth at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-21 11:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:a9a425df628ab80374cc6a132d39e470bc78c8bc
commit r13-8480-ga9a425df628ab80374cc6a132d39e470bc78c8bc
Author: Richard Biener <rguenther@suse.de>
Date: Fri Feb 23 16:06:05 2024 +0100
middle-end/114070 - folding breaking VEC_COND expansion
The following properly guards the simplifications that move
operations into VEC_CONDs, in particular when that changes the
type constraints on this operation.
This needed a genmatch fix which was recording spurious implicit fors
when tcc_comparison is used in a C expression.
PR middle-end/114070
* genmatch.cc (parser::parse_c_expr): Do not record operand
lists but only mark operators used.
* match.pd ((c ? a : b) op (c ? d : e) --> c ? (a op d) : (b op
e)):
Properly guard the case of tcc_comparison changing the VEC_COND
value operand type.
* gcc.dg/torture/pr114070.c: New testcase.
(cherry picked from commit af66ad89e8169f44db723813662917cf4cbb78fc)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (10 preceding siblings ...)
2024-03-21 11:49 ` cvs-commit at gcc dot gnu.org
@ 2024-03-21 11:49 ` cvs-commit at gcc dot gnu.org
2024-06-20 9:15 ` [Bug middle-end/114070] [12 " rguenth at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-21 11:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:a3ff14ac4804be400a52dcf630f0de2d57cae835
commit r13-8481-ga3ff14ac4804be400a52dcf630f0de2d57cae835
Author: Richard Biener <rguenther@suse.de>
Date: Thu Feb 29 09:22:19 2024 +0100
middle-end/114070 - VEC_COND_EXPR folding
The following amends the PR114070 fix to optimistically allow
the folding when we cannot expand the current vec_cond using
vcond_mask and we're still before vector lowering. This leaves
a small window between vectorization and lowering where we could
break vec_conds that can be expanded via vcond{,u,eq}, most
susceptible is the loop unrolling pass which applies VN and thus
possibly folding to the unrolled body of a vectorized loop.
This gets back the folding for targets that cannot do vectorization.
It doesn't get back the folding for x86 with AVX512 for example
since that can handle the original IL but not the folded since
it misses some vcond_mask expanders.
PR middle-end/114070
* match.pd ((c ? a : b) op d --> c ? (a op d) : (b op d)):
Allow the folding if before lowering and the current IL
isn't supported with vcond_mask.
(cherry picked from commit f9c30ea737b806caac917d8f501305151a2cbd57)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/114070] [12 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model
2024-02-23 7:28 [Bug rtl-optimization/114070] New: [12/13/13 regression] ICE when building git-2.43.2 with -mcpu=niagara4 -fno-vect-cost-model sjames at gcc dot gnu.org
` (11 preceding siblings ...)
2024-03-21 11:49 ` cvs-commit at gcc dot gnu.org
@ 2024-06-20 9:15 ` rguenth at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-20 9:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114070
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.4 |12.5
--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.4 is being released, retargeting bugs to GCC 12.5.
^ permalink raw reply [flat|nested] 14+ messages in thread