summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c b/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c
new file mode 100644
index 00000000000..07f0821e573
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-vect-aggressive.c
@@ -0,0 +1,49 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx2 } */
+/* { dg-options "-mavx2 -O3 -fopenmp-simd -fdump-tree-vect-details" } */
+
+#include "avx2-check.h"
+#define N 64
+float a[N];
+int c[N];
+
+__attribute__ ((noinline)) int
+foo ()
+{
+ int i, res = 0;
+#pragma omp simd safelen(8)
+ for (i=0; i<N; i++)
+ {
+ float t = a[i];
+ if (t > 0.0f & t < 1.0e+2f)
+ if (c[i] != 0)
+ res += 1;
+ }
+ return res;
+}
+
+__attribute__ ((noinline)) float
+hundred ()
+{
+ return 100.0f;
+}
+
+static void
+avx2_test (void)
+{
+ int i, res;
+ for (i=0; i<N; i++)
+ {
+ c[i] = i % 4;
+ if (i < N / 2)
+ a[i] = (float) (i + 1);
+ else
+ a[i] = (float) i + hundred ();
+ }
+ if (foo () != 24)
+ abort ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+