diff --git a/gcc/expr.cc b/gcc/expr.cc index 0bf80832fe50555a86b2406b4e2019bc992cb8df..34f5ff90a9f898483bb0a9938a53d248679c3d58 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -13621,6 +13621,8 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) if ((code == NE || code == EQ) && (integer_zerop (arg1) || integer_pow2p (arg1)) + /* vector types are not handled here. */ + && TREE_CODE (TREE_TYPE (arg1)) != VECTOR_TYPE && (TYPE_PRECISION (ops->type) != 1 || TYPE_UNSIGNED (ops->type))) { tree narg0 = arg0; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr113322-1.c b/gcc/testsuite/gcc.c-torture/compile/pr113322-1.c new file mode 100644 index 0000000000000000000000000000000000000000..efed9603dfd786ef7c8eb4a738cb0e7f2be5a7be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr113322-1.c @@ -0,0 +1,14 @@ +/* { dg-additional-options "-march=sapphirerapids" { target x86_64*-*-* i?86-*-* } } */ +/* PR middle-end/113322 */ + +float a[16]; +void +foo () +{ +int i; +for (i = 0; i < 16/2; i++) + { + if (a[2*i+((0 +1)%2)] != (3 * (2*i+((0 +1)%2)) + 2)) + __builtin_abort (); + } +}