Message ID | 20220211185829.GU2646553@tucnak |
---|---|
State | New |
Headers | show |
Series | match.pd: Fix up (X & Y) CMP 0 -> X CMP2 ~Y simplifications [PR104499] | expand |
> Am 11.02.2022 um 20:00 schrieb Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org>: > > Hi! > > The following testcase ICEs on x86_64-linux, because match.pd emits > there a NOP_EXPR cast from int*8 vector type with BLKmode to > unsigned*8 vector type with BLKmode and vec-lowering isn't prepared > to handle such casts. > > Fixed by using VIEW_CONVERT_EXPR instead. > > Bootstrapped/regtested on powerpc64le-linux, ok for trunk? Ok > 2022-02-11 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/104499 > * match.pd ((X & Y) CMP 0 -> X CMP2 ~Y): Use view_convert instead > of convert. > > * gcc.c-torture/compile/pr104499.c: New test. > > --- gcc/match.pd.jj 2022-02-11 11:20:24.272393155 +0100 > +++ gcc/match.pd 2022-02-11 13:45:02.612636452 +0100 > @@ -5778,7 +5778,7 @@ (define_operator_list SYNC_FETCH_AND_AND > (if (TYPE_UNSIGNED (TREE_TYPE (@1))) > (icmp @0 { csts; }) > (with { tree utype = unsigned_type_for (TREE_TYPE (@1)); } > - (icmp (convert:utype @0) { csts; })))))))) > + (icmp (view_convert:utype @0) { csts; })))))))) > > /* When one argument is a constant, overflow detection can be simplified. > Currently restricted to single use so as not to interfere too much with > --- gcc/testsuite/gcc.c-torture/compile/pr104499.c.jj 2022-02-11 13:47:03.819963924 +0100 > +++ gcc/testsuite/gcc.c-torture/compile/pr104499.c 2022-02-11 13:46:44.421231605 +0100 > @@ -0,0 +1,11 @@ > +/* PR tree-optimization/104499 */ > + > +typedef int __attribute__((__vector_size__ (8 * sizeof (int)))) V; > + > +V v; > + > +void > +foo (void) > +{ > + v = ((1 | v) != 1); > +} > > Jakub >
--- gcc/match.pd.jj 2022-02-11 11:20:24.272393155 +0100 +++ gcc/match.pd 2022-02-11 13:45:02.612636452 +0100 @@ -5778,7 +5778,7 @@ (define_operator_list SYNC_FETCH_AND_AND (if (TYPE_UNSIGNED (TREE_TYPE (@1))) (icmp @0 { csts; }) (with { tree utype = unsigned_type_for (TREE_TYPE (@1)); } - (icmp (convert:utype @0) { csts; })))))))) + (icmp (view_convert:utype @0) { csts; })))))))) /* When one argument is a constant, overflow detection can be simplified. Currently restricted to single use so as not to interfere too much with --- gcc/testsuite/gcc.c-torture/compile/pr104499.c.jj 2022-02-11 13:47:03.819963924 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr104499.c 2022-02-11 13:46:44.421231605 +0100 @@ -0,0 +1,11 @@ +/* PR tree-optimization/104499 */ + +typedef int __attribute__((__vector_size__ (8 * sizeof (int)))) V; + +V v; + +void +foo (void) +{ + v = ((1 | v) != 1); +}