gcc/testsuite/ChangeLog:

        * gcc.dg/vect/vect-early-break_40.c: Fix.
        * gcc.dg/gomp/static-chunk-size-one.c: Likewise.
        * gcc.dg/vect/vect-uncounted-1.c: New.
        * gcc.dg/vect/vect-uncounted-2.c: Likewise.
        * gcc.dg/vect/vect-uncounted-3.c: Likewise.
        * gcc.dg/vect/vect-uncounted-4.c: Likewise.
        * gcc.dg/vect/vect-uncounted-run-1.c: Likewise.
        * gcc.dg/vect/vect-uncounted-prolog-peel-1.c: Likewise.
---
 .../gcc.dg/gomp/static-chunk-size-one.c       |  2 +-
 .../gcc.dg/vect/vect-early-break_40.c         |  3 +-
 gcc/testsuite/gcc.dg/vect/vect-uncounted-1.c  | 18 ++++++++
 gcc/testsuite/gcc.dg/vect/vect-uncounted-2.c  | 16 +++++++
 gcc/testsuite/gcc.dg/vect/vect-uncounted-3.c  | 26 ++++++++++++
 gcc/testsuite/gcc.dg/vect/vect-uncounted-4.c  | 17 ++++++++
 .../vect/vect-uncounted-prolog-peel-1.c       | 23 ++++++++++
 .../gcc.dg/vect/vect-uncounted-run-1.c        | 42 +++++++++++++++++++
 8 files changed, 144 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/vect/vect-uncounted-1.c
 create mode 100644 gcc/testsuite/gcc.dg/vect/vect-uncounted-2.c
 create mode 100644 gcc/testsuite/gcc.dg/vect/vect-uncounted-3.c
 create mode 100644 gcc/testsuite/gcc.dg/vect/vect-uncounted-4.c
create mode 100644 gcc/testsuite/gcc.dg/vect/vect-uncounted-prolog-peel-1.c
 create mode 100644 gcc/testsuite/gcc.dg/vect/vect-uncounted-run-1.c

diff --git a/gcc/testsuite/gcc.dg/gomp/static-chunk-size-one.c b/gcc/testsuite/gcc.dg/gomp/static-chunk-size-one.c
index e82de772deb..12b508657fa 100644
--- a/gcc/testsuite/gcc.dg/gomp/static-chunk-size-one.c
+++ b/gcc/testsuite/gcc.dg/gomp/static-chunk-size-one.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fopenmp -O2 -fdump-tree-optimized -fno-tree-pre" } */
+/* { dg-options "-fopenmp -O2 -fdump-tree-optimized -fno-tree-pre -fno-tree-vectorize" } */

 int
 bar ()
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_40.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_40.c
index 428f6249fa6..9c0e1fb1264 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-early-break_40.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_40.c
@@ -23,5 +23,4 @@ unsigned test4(unsigned x)
  return ret;
 }

-/* SCEV can't currently analyze this loop bounds.  */
-/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { xfail *-*-* } } } */
\ No newline at end of file
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-uncounted-1.c b/gcc/testsuite/gcc.dg/vect/vect-uncounted-1.c
new file mode 100644
index 00000000000..8b0b4a815c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-uncounted-1.c
@@ -0,0 +1,18 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+
+int
+foo (int *haystack, int needle)
+{
+  int i = 0;
+  while (1)
+    {
+      if (haystack[i] == needle)
+       return i;
+      i++;
+     }
+}
+
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-uncounted-2.c b/gcc/testsuite/gcc.dg/vect/vect-uncounted-2.c
new file mode 100644
index 00000000000..90882bad50d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-uncounted-2.c
@@ -0,0 +1,16 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+
+int
+foo (int *a0, int *aN, int *b0, int *bN)
+{
+  int *a = a0;
+  int *b = b0;
+
+  for (;a != aN && b != bN; a++, b++)
+    *a += *b;
+}
+
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-uncounted-3.c b/gcc/testsuite/gcc.dg/vect/vect-uncounted-3.c
new file mode 100644
index 00000000000..3e7d7f1e152
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-uncounted-3.c
@@ -0,0 +1,26 @@
+/* Test the correct resetting of live out values on epilog loop entry for IV
+   when it's incremented prior to exit taken.  */
+/* { dg-add-options vect_early_break } */
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+
+extern int N;
+
+int
+foo (int c[N], int d[N], int a)
+{
+  int i = 0;
+  while(c[i] != 0)
+    {
+      i += 1;
+      if (d[i] == a)
+       break;
+      if (d[i] == 7)
+       break;
+    }
+  return i;
+}
+
+/* { dg-final { scan-tree-dump "BIT_FIELD_REF <vect_vec_iv_.\[0-9_\]+, \[0-9\]+, 0>" "vect" } } */ +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-uncounted-4.c b/gcc/testsuite/gcc.dg/vect/vect-uncounted-4.c
new file mode 100644
index 00000000000..22af370d595
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-uncounted-4.c
@@ -0,0 +1,17 @@
+/* Check vectorization of uncounted reductions.  */
+/* { dg-do compile } */
+
+int
+foo (int *a0, int *aN, int accum)
+{
+  int i = 0;
+  while (1)
+    {
+      if (a0[i++] == *aN)
+       return accum;
+      accum += a0[i];
+     }
+}
+
+/* { dg-final { scan-tree-dump "Detected reduction." "vect" } } */
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-uncounted-prolog-peel-1.c b/gcc/testsuite/gcc.dg/vect/vect-uncounted-prolog-peel-1.c
new file mode 100644
index 00000000000..fab4ed0f569
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-uncounted-prolog-peel-1.c
@@ -0,0 +1,23 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+
+int
+foo (int *haystack, int needle)
+{
+  int i = 0;
+  while (1)
+    {
+      if (haystack[i] == needle)
+       return i;
+      i++;
+     }
+}
+
+/* { dg-final { scan-tree-dump {note:\s*Alignment of access forced using peeling.} "vect" } } */ +/* { dg-final { scan-tree-dump {if \(prolog_loop_niters.[0-9_]+ == 0\)\n\s*goto} "vect" } } */ +/* { dg-final { scan-tree-dump {ivtmp_[0-9_]+ = PHI <ivtmp_[0-9_]+\([0-9_]+\), 0\([0-9_]+\)>} "vect" } } */ +/* { dg-final { scan-tree-dump {ivtmp_[0-9_]+ = ivtmp_[0-9_]+ \+ 1;} "vect" } } */ +/* { dg-final { scan-tree-dump {if \(ivtmp_[0-9_]+ >= prolog_loop_niters.[0-9_]+\)\n\s*goto} "vect" } } */ +/* { dg-final { scan-tree-dump {vectorized 1 loops in function} "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-uncounted-run-1.c b/gcc/testsuite/gcc.dg/vect/vect-uncounted-run-1.c
new file mode 100644
index 00000000000..eb734e13ef0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-uncounted-run-1.c
@@ -0,0 +1,42 @@
+/* execution test for the correct resetting of live out values on epilog loop
+   entry.
+   Strategy:
+     1. Scan the vector dump ensuring we actually vectorized the loop.
+     2. If we have a vectorzied loop, ensure it executes as expected.
+*/
+/* { dg-add-options vect_early_break } */
+/* { dg-do run } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+
+#include <assert.h>
+#define N 9
+void
+test01 ()
+{
+    {
+      int x[N] = {2, 4, 6, 8, 10, 12, 14, 16, 18};
+      const int y[N] = {3, 5, 7, 9, 11, 13, 15, 17, 19};
+      int z[N] = {5, 9, 13, 17, 21, 25, 29, 33, 37};
+
+      int *x0 = x;
+      int *xN = x+N;
+      const int *y0 = y;
+      const int *yN = y+N;
+
+      int *res = x;
+
+      for (; x0 != xN && y0 != yN; ++x0, (void)++y0, ++res)
+       *res = *x0 + *y0;
+      assert (x0 == x+N && y0 == y+N && res == x+N);
+      assert (x[0] == z[0] && x[1] == z[1]);
+    }
+}
+
+int
+main ()
+{
+  test01 ();
+}
+
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */
--
2.43.0


Reply via email to