]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vect: Restore optab_vector argument [PR106250]
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 11 Jul 2022 14:59:00 +0000 (15:59 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Mon, 11 Jul 2022 14:59:00 +0000 (15:59 +0100)
In g:76c3041b856cb0 I'd removed a "C ? optab_vector : optab_mixed_sign"
argument from a call to directly_supported_p, thinking that the argument
only existed because of the condition (which I was removing).  But the
difference between the scalar and vector forms matters for shifts,
so we do still need the argument.

gcc/
PR tree-optimization/106250
* tree-vect-loop.cc (vectorizable_reduction): Reinstate final
argument to directly_supported_p.

gcc/testsuite/gcc.dg/vect/pr106250.c [new file with mode: 0644]
gcc/tree-vect-loop.cc

diff --git a/gcc/testsuite/gcc.dg/vect/pr106250.c b/gcc/testsuite/gcc.dg/vect/pr106250.c
new file mode 100644 (file)
index 0000000..7f25f55
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+int
+foo (unsigned long int x, int y, int z)
+{
+  int ret = 0;
+
+  while (y < 1)
+    {
+      x *= 2;
+      ret = x == z;
+      z = y;
+      ++y;
+    }
+
+  return ret;
+}
index 3a70c15b59305ec3ddf84a7e349289b5f86f0037..2257b29a652699d03768704b047c0ec8a4d38eac 100644 (file)
@@ -7369,7 +7369,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
         dot-products.  */
       machine_mode vec_mode = TYPE_MODE (vectype_in);
       if (!lane_reduc_code_p
-         && !directly_supported_p (op.code, vectype_in))
+         && !directly_supported_p (op.code, vectype_in, optab_vector))
         {
           if (dump_enabled_p ())
             dump_printf (MSG_NOTE, "op not supported by target.\n");