re PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code)
authorJakub Jelinek <jakub@redhat.com>
Fri, 15 Dec 2017 17:51:36 +0000 (18:51 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 15 Dec 2017 17:51:36 +0000 (18:51 +0100)
PR tree-optimization/80631
* gcc.target/i386/avx2-pr80631.c: New test.

From-SVN: r255701

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx2-pr80631.c [new file with mode: 0644]

index 9ab04282c4e8da196851e6f66d586b9d1242d7e6..3d037b53d9d0f0a94e3d3917c45ea919baad531b 100644 (file)
@@ -1,5 +1,8 @@
 2017-12-15  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/80631
+       * gcc.target/i386/avx2-pr80631.c: New test.
+
        * g++.dg/plugin/attribute_plugin.c (user_attr): Swap
        affects_type_identity and handler fields, add NULL for exclude.
 
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr80631.c b/gcc/testsuite/gcc.target/i386/avx2-pr80631.c
new file mode 100644 (file)
index 0000000..5af1b0f
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR tree-optimization/80631 */
+/* { dg-do run } */
+/* { dg-options "-O2 -ftree-vectorize -mavx2 -fno-vect-cost-model" } */
+/* { dg-require-effective-target avx2 } */
+
+#include "avx2-check.h"
+
+#define N 8
+
+static void
+avx2_test (void)
+{
+  int v[N], k;
+  for(k = 0; k < N; k++)
+    v[k] = k;
+  v[0] = 77;
+  int found_index = -1;
+  for (k = 0; k < N; k++)
+    if (v[k] == 77)
+      found_index = k;
+  if (found_index != 0)
+    abort ();
+}