re PR tree-optimization/92558 (Miscompare of 554.roms_r with -Ofast -march=znver2...
authorRichard Biener <rguenther@suse.de>
Mon, 18 Nov 2019 12:41:11 +0000 (12:41 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 18 Nov 2019 12:41:11 +0000 (12:41 +0000)
2019-11-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92558
* tree-vect-loop.c (vect_create_epilog_for_reduction): When
reducting the width of a reduction vector def update new_phis.

* gcc.dg/vect/pr92558.c: New testcase.

From-SVN: r278400

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

index 3d19783afd0f090e5835311df49bb67045d15df0..b2408021a0b1fdbe7bf4f8880861c5522bc4230a 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-18  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/92558
+       * tree-vect-loop.c (vect_create_epilog_for_reduction): When
+       reducting the width of a reduction vector def update new_phis.
+
 2019-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
        * configure.ac (gcc_cv_target_ldbl128): Set for powerpc*-*-linux-musl*
index 8773d5073e8a345cb2a492c8df081f2f6e47ced9..b6330cb57afa7dd7e37e6e536c0b865d6f0b24a1 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-18  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/92558
+       * gcc.dg/vect/pr92558.c: New testcase.
+
 2019-11-18  Martin Liska  <mliska@suse.cz>
 
        PR ipa/92529
diff --git a/gcc/testsuite/gcc.dg/vect/pr92558.c b/gcc/testsuite/gcc.dg/vect/pr92558.c
new file mode 100644 (file)
index 0000000..1d24fa0
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-additional-options "-mavx2" { target avx2_runtime } } */
+
+void __attribute__((noipa))
+foo (int * __restrict wsum, int * __restrict cff, int * __restrict weight)
+{
+  for (int i = 0; i < 16; ++i)
+    {
+      *wsum += weight[2*i+0];
+      *cff += weight[2*i+1];
+    }
+}
+
+int main()
+{
+  int weight[32];
+  for (int i = 0; i < 32; ++i)
+    weight[i] = i;
+  int wsum = 0, cff = 0;
+  foo (&wsum, &cff, weight);
+  if (wsum != 240 || cff != 256)
+    __builtin_abort ();
+  return 0;
+}
index 7a58dfc323a051fe21cfac7e780c85f4f520e20d..02e6bfb9e5d5cbe2ea1cbc65feba4a381717daf5 100644 (file)
@@ -5198,6 +5198,7 @@ vect_create_epilog_for_reduction (stmt_vec_info stmt_info,
          new_temp = make_ssa_name (vectype1);
          epilog_stmt = gimple_build_assign (new_temp, code, dst1, dst2);
          gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
+         new_phis[0] = epilog_stmt;
        }
 
       if (reduce_with_shift && !slp_reduc)