diff --git a/gcc/match.pd b/gcc/match.pd index d41282cc11a6..ab5b51bacaf6 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -6854,10 +6854,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (eq @0 @1)) (simplify (bit_and:c (ne:c @0 @1) (eq (bit_ior @0 @1) integer_zerop)) - { build_zero_cst (type); }) + { constant_boolean_node (false, type); }) (simplify (bit_ior:c (eq:c @0 @1) (ne (bit_ior @0 @1) integer_zerop)) - { build_one_cst (type); }) + { constant_boolean_node (true, type); }) #endif /* These was part of minmax phiopt. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/int-bwise-opt-vect01.c b/gcc/testsuite/gcc.dg/tree-ssa/int-bwise-opt-vect01.c new file mode 100644 index 000000000000..bdcdbccbbc27 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/int-bwise-opt-vect01.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-forwprop1 -fdump-tree-optimized" } */ + +/* PR tree-optimization/122296 */ + +typedef unsigned type1 __attribute__((vector_size(sizeof(unsigned)))); + +type1 f(type1 a, type1 b) +{ + type1 c = a == b; + type1 d = (a|b) != 0; + return c | d; +} + +/* { dg-final { scan-tree-dump-not "VEC_COND_EXPR " "optimized" } } */ +/* { dg-final { scan-tree-dump-not "VEC_COND_EXPR " "forwprop1" } } */ +