public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [0/10] Vectoriser testsuite tweaks
@ 2017-11-03 16:14 Richard Sandiford
  2017-11-03 16:16 ` [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests Richard Sandiford
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:14 UTC (permalink / raw)
  To: gcc-patches

This series of patches generalises the vector testsuite and makes
it cope better with arbitrary vector lengths.  It also adds some
target selectors needed for SVE.

Tested on aarch64-linux-gnu without SVE, with various fixed-length
SVE modes, and with the default variable-length SVE mode.  Also tested
on x86_64-linux-gnu and powerpc64-linux-gnu.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
@ 2017-11-03 16:16 ` Richard Sandiford
  2017-11-08 19:10   ` Jeff Law
  2017-11-03 16:17 ` [2/10] Add VECTOR_BITS to tree-vect.h Richard Sandiford
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:16 UTC (permalink / raw)
  To: gcc-patches

The vectoriser tests used a combination of:

1) if (impossible condition) abort ();
2) volatile int x; ... *x = ...;
3) asm volatile ("" ::: "memory");

to prevent vectorisation of a set-up loop.  The problem with 1) is that
the compiler can often tell that the condition is false and optimise
it away before vectorisation.

This was already happening in slp-perm-9.c, which is why the test was
expecting one loop to be vectorised even when the required permutes
weren't supported.  It becomes a bigger problem with SVE, which is
able to vectorise more set-up loops.

The point of this patch is therefore to replace 1) with something else.
2) should work most of the time, but we don't usually treat non-volatile
accesses as aliasing unrelated volatile accesses, so I think in principle
we could split the loop into one that does the set-up and one that does
the volatile accesses.  3) seems more robust because it's also a wild
read and write.

The patch therefore tries to replace all instances of 1) and 2) with 3).


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/testsuite/
	* gcc.dg/vect/bb-slp-cond-1.c (main): Add an asm volatile
	to the set-up loop.
	* gcc.dg/vect/slp-perm-7.c (main): Prevent vectorisation with
	asm volatile ("" ::: "memory") instead of a conditional abort.
	Update the expected vector loop count accordingly.
	* gcc.dg/vect/slp-perm-9.c (main): Likewise.
	* gcc.dg/vect/bb-slp-1.c (main1): Prevent vectorisation with
	asm volatile ("" ::: "memory") instead of a conditional abort.
	* gcc.dg/vect/slp-23.c (main): Likewise,
	* gcc.dg/vect/slp-35.c (main): Likewise,
	* gcc.dg/vect/slp-37.c (main): Likewise,
	* gcc.dg/vect/slp-perm-4.c (main): Likewise.
	* gcc.dg/vect/bb-slp-24.c (foo): Likewise.  Remove dummy argument.
	(main): Update call accordingly.
	* gcc.dg/vect/bb-slp-25.c (foo, main): As for bb-slp-24.c.
	* gcc.dg/vect/bb-slp-26.c (foo, main): Likewise.
	* gcc.dg/vect/bb-slp-29.c (foo, main): Likewise.
	* gcc.dg/vect/no-vfa-vect-102.c (foo): Delete.
	(main): Don't initialize it.
	(main1): Prevent vectorisation with asm volatile ("" ::: "memory")
	instead of a conditional abort.
	* gcc.dg/vect/no-vfa-vect-102a.c (foo, main1, main): As for
	no-vfa-vect-102.c
	* gcc.dg/vect/vect-103.c (foo, main1, main): Likewise.
	* gcc.dg/vect/vect-104.c (foo, main1, main): Likewise.
	* gcc.dg/vect/pr42709.c (main1): Remove dummy argument.
	Prevent vectorisation with asm volatile ("" ::: "memory")
	instead of a conditional abort.
	* gcc.dg/vect/slp-13-big-array.c (y): Delete.
	(main1): Prevent vectorisation with asm volatile ("" ::: "memory")
	instead of a conditional abort.
	* gcc.dg/vect/slp-3-big-array.c (y, main1): As for slp-13-big-array.c.
	* gcc.dg/vect/slp-34-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/slp-4-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/slp-multitypes-11-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-105.c (y, main1): Likewise.
	* gcc.dg/vect/vect-105-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-112-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-15-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-2-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-34-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-6-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-73-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-74-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-75-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-76-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-80-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-97-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-all-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-reduc-1char-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-reduc-2char-big-array.c (y, main1): Likewise.
	* gcc.dg/vect/vect-strided-a-mult.c (y, main1): Likewise.
	* gcc.dg/vect/vect-strided-a-u16-i2.c (y, main1): Likewise.
	* gcc.dg/vect/vect-strided-a-u16-i4.c (y, main1): Likewise.
	* gcc.dg/vect/vect-strided-a-u16-mult.c (y, main1): Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i2-gap.c (y, main1): Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c (y, main1):
	Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c (y, main1): Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c (y, main1):
	Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c (y, main1): Likewise.
	* gcc.dg/vect/slp-24.c (y): Delete.
	(main): Prevent vectorisation with asm volatile ("" ::: "memory")
	instead of a conditional abort.
	* gcc.dg/vect/slp-24-big-array.c (y, main): As for slp-24.c.
	* gcc.dg/vect/vect-98-big-array.c (y, main): Likewise.
	* gcc.dg/vect/vect-bswap16.c (y, main): Likewise.
	* gcc.dg/vect/vect-bswap32.c (y, main): Likewise.
	* gcc.dg/vect/vect-bswap64.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-mult-char-ls.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-mult.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-same-dr.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u16-i2.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u16-i4.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u32-i4.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u32-i8.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i2-gap.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i2.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap2.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap7.c (y, main): Likewise.
	* gcc.dg/vect/vect-strided-u8-i8.c (y, main): Likewise.
	* gcc.dg/vect/vect-10-big-array.c (y): Delete.
	(foo): Prevent vectorisation with asm volatile ("" ::: "memory")
	instead of a conditional abort.
	* gcc.dg/vect/vect-double-reduc-6-big-array.c (y, foo): As for
	vect-10-big-array.c.
	* gcc.dg/vect/vect-reduc-pattern-1b-big-array.c (y, foo): Likewise.
	* gcc.dg/vect/vect-reduc-pattern-1c-big-array.c (y, foo): Likewise.
	* gcc.dg/vect/vect-reduc-pattern-2b-big-array.c (y, foo): Likewise.
	* gcc.dg/vect/vect-117.c (foo): Delete.
	(main): Don't initalize it.

Index: gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c	2017-02-23 19:54:09.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c	2017-11-03 16:06:03.052282173 +0000
@@ -28,7 +28,10 @@ int main ()
   check_vect ();
 
   for (i = 0; i < N; i++)
-    a[i] = i;
+    {
+      a[i] = i;
+      asm volatile ("" ::: "memory");
+    }
 
   foo (a, 4);
 
Index: gcc/testsuite/gcc.dg/vect/slp-perm-7.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-7.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-7.c	2017-11-03 16:06:03.053282336 +0000
@@ -57,8 +57,7 @@ int main (int argc, const char* argv[])
       input2[i] = i%256;
       output[i] = 0;
       output2[i] = 0;
-      if (input[i] > 200)
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   foo (input, output, input2, output2);
@@ -70,7 +69,7 @@ int main (int argc, const char* argv[])
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect"  { target vect_perm } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm && vect_load_lanes } } } } */
Index: gcc/testsuite/gcc.dg/vect/slp-perm-9.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-9.c	2017-10-09 11:50:52.047711098 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-perm-9.c	2017-11-03 16:06:03.054282499 +0000
@@ -33,8 +33,7 @@ int main (int argc, const char* argv[])
     {
       input[i] = i;
       output[i] = 0;
-      if (input[i] > 256)
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N / 3; i++)
@@ -54,8 +53,8 @@ int main (int argc, const char* argv[])
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target { {! vect_perm } || {! vect_sizes_16B_8B } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect"  { target { { vect_perm } && { vect_sizes_16B_8B } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect"  { target { {! vect_perm } || {! vect_sizes_16B_8B } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target { { vect_perm } && { vect_sizes_16B_8B } } } } } */
 /* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target vect_perm_short } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { {! vect_perm } || {! vect_sizes_32B_16B } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { { vect_perm } && { vect_sizes_32B_16B } } } } } */
Index: gcc/testsuite/gcc.dg/vect/bb-slp-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-1.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/bb-slp-1.c	2017-11-03 16:06:03.051282010 +0000
@@ -25,9 +25,7 @@ main1 (int dummy)
       *pout++ = *pin++;
       *pout++ = *pin++;
       *pout++ = *pin++;
-      /* Avoid loop vectorization.  */
-      if (dummy == 32)
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* check results: */ 
Index: gcc/testsuite/gcc.dg/vect/slp-23.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-23.c	2015-06-13 10:48:20.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-23.c	2017-11-03 16:06:03.052282173 +0000
@@ -97,8 +97,7 @@ int main (void)
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (arr[i].a == 178)
-         abort(); 
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/slp-35.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-35.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-35.c	2017-11-03 16:06:03.053282336 +0000
@@ -58,8 +58,7 @@ int main (void)
       arr[i].c = 17;
       arr[i].d = i+34;
       arr[i].e = i * 3 + 5;
-      if (arr[i].a == 178)
-         abort(); 
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/slp-37.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-37.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-37.c	2017-11-03 16:06:03.053282336 +0000
@@ -49,9 +49,7 @@ int main (void)
       arr1[i].a = i;
       arr1[i].b = i * 2;
       arr1[i].c = (void *)arr1;
-
-      if (arr1[i].a == 178)
-         abort(); 
+      asm volatile ("" ::: "memory");
     } 
 
 
Index: gcc/testsuite/gcc.dg/vect/slp-perm-4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-4.c	2015-12-18 10:17:16.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-4.c	2017-11-03 16:06:03.053282336 +0000
@@ -68,10 +68,8 @@ int main (int argc, const char* argv[])
   for (i = 0; i < N; i++)
     {
       input[i] = i%256;
-      if (input[i] > 200)
-        abort();
       output[i] = 0;
-      __asm__ volatile ("");
+      asm volatile ("" ::: "memory");
     }
 
   foo (input, output);
Index: gcc/testsuite/gcc.dg/vect/bb-slp-24.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-24.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/bb-slp-24.c	2017-11-03 16:06:03.051282010 +0000
@@ -9,7 +9,7 @@ #define N 256
 short src[N], dst[N];
 
 void foo (short * __restrict__ dst, short * __restrict__ src, int h,
-          int stride, int dummy)
+          int stride)
 {
   int i;
   h /= 8;
@@ -25,8 +25,7 @@ void foo (short * __restrict__ dst, shor
       dst[7] += A*src[7];
       dst += stride;
       src += stride;
-      if (dummy == 32)
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 }
 
@@ -43,7 +42,7 @@ int main (void)
       src[i] = i;
     }
 
-  foo (dst, src, N, 8, 0);
+  foo (dst, src, N, 8);
 
   for (i = 0; i < N; i++)
     {
Index: gcc/testsuite/gcc.dg/vect/bb-slp-25.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-25.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/bb-slp-25.c	2017-11-03 16:06:03.051282010 +0000
@@ -9,7 +9,8 @@ #define N 256
 
 short src[N], dst[N];
 
-void foo (short * __restrict__ dst, short * __restrict__ src, int h, int stride, int dummy)
+void foo (short * __restrict__ dst, short * __restrict__ src, int h,
+	  int stride)
 {
   int i;
   h /= 16;
@@ -25,8 +26,7 @@ void foo (short * __restrict__ dst, shor
       dst[7] += A*src[7] + src[7+stride];
       dst += 8;
       src += 8;
-      if (dummy == 32)
-        abort ();
+      asm volatile ("" ::: "memory");
    }
 }
 
@@ -43,7 +43,7 @@ int main (void)
        src[i] = i;
     }
 
-  foo (dst, src, N, 8, 0);
+  foo (dst, src, N, 8);
 
   for (i = 0; i < N/2; i++)
     {
Index: gcc/testsuite/gcc.dg/vect/bb-slp-26.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-26.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/bb-slp-26.c	2017-11-03 16:06:03.052282173 +0000
@@ -10,8 +10,7 @@ #define N 256
 char src[N], dst[N];
 
 void __attribute__((noinline,noclone))
-foo (char * __restrict__ dst, char * __restrict__ src, int h,
-     int stride, int dummy)
+foo (char * __restrict__ dst, char * __restrict__ src, int h, int stride)
 {
   int i;
   h /= 16;
@@ -27,8 +26,7 @@ foo (char * __restrict__ dst, char * __r
       dst[7] += A*src[7] + src[7+stride];
       dst += 8;
       src += 8;
-      if (dummy == 32)
-        abort ();
+      asm volatile ("" ::: "memory");
    }
 }
 
@@ -45,7 +43,7 @@ int main (void)
        src[i] = i/8;
     }
 
-  foo (dst, src, N, 8, 0);
+  foo (dst, src, N, 8);
 
   for (i = 0; i < N/2; i++)
     {
Index: gcc/testsuite/gcc.dg/vect/bb-slp-29.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-29.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/bb-slp-29.c	2017-11-03 16:06:03.052282173 +0000
@@ -9,7 +9,8 @@ #define N 256
 
 short src[N], dst[N];
 
-void foo (short * __restrict__ dst, short * __restrict__ src, int h, int stride, int dummy)
+void foo (short * __restrict__ dst, short * __restrict__ src, int h,
+	  int stride)
 {
   int i;
   h /= 16;
@@ -25,8 +26,7 @@ void foo (short * __restrict__ dst, shor
       dst[7] = A*src[7] + B*src[8];
       dst += stride;
       src += stride;
-      if (dummy == 32)
-        abort ();
+      asm volatile ("" ::: "memory");
    }
 }
 
@@ -43,7 +43,7 @@ int main (void)
        src[i] = i;
     }
 
-  foo (dst, src, N, 8, 0);
+  foo (dst, src, N, 8);
 
   for (i = 0; i < N/2; i++)
     {
Index: gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c	2017-11-03 16:06:03.052282173 +0000
@@ -14,7 +14,6 @@ struct extraction
 
 static int a[N] = {1,2,3,4,5,6,7,8,9};
 static int b[N] = {2,3,4,5,6,7,8,9,9};
-volatile int foo;
 
 __attribute__ ((noinline))
 int main1 (int x, int y) {
@@ -24,9 +23,8 @@ int main1 (int x, int y) {
 
   for (i = 0; i < N; i++)
     {
-       p->a[i] = a[i];
-       if (foo == 135)
-	 abort (); /* to avoid vectorization  */
+      p->a[i] = a[i];
+      asm volatile ("" ::: "memory");
     }
 
   /* Not vectorizable: distance 1.  */
@@ -48,7 +46,6 @@ int main (void)
 { 
   check_vect ();
 
-  foo = 0;
   return main1 (0, N);
 }
 
Index: gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c	2017-11-03 16:06:03.052282173 +0000
@@ -14,7 +14,6 @@ struct extraction
 
 static int a[N] = {1,2,3,4,5,6,7,8,9};
 static int b[N] = {2,3,4,5,6,7,8,9,9};
-volatile int foo;
 
 __attribute__ ((noinline))
 int main1 (int x, int y) {
@@ -24,9 +23,8 @@ int main1 (int x, int y) {
 
   for (i = 0; i < N; i++)
     {
-       p->a[i] = a[i];
-       if (foo == 135)
-	 abort (); /* to avoid vectorization  */
+      p->a[i] = a[i];
+      asm volatile ("" ::: "memory");
     }
 
   /* Not vectorizable: distance 1.  */
@@ -48,7 +46,6 @@ int main (void)
 { 
   check_vect ();
 
-  foo = 0;
   return main1 (0, N);
 }
 
Index: gcc/testsuite/gcc.dg/vect/vect-103.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-103.c	2017-05-31 13:03:54.441152727 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-103.c	2017-11-03 16:06:03.054282499 +0000
@@ -15,7 +15,6 @@ struct extraction
 static int a[N] = {1,2,3,4,5,6,7,8,9};
 static int b[N] = {17,24,7,0,2,3,4,31,82};
 static int c[N] = {9,17,24,7,0,2,3,4,31};
-volatile int foo;
 
 __attribute__ ((noinline))
 int main1 (int x, int y) {
@@ -25,10 +24,9 @@ int main1 (int x, int y) {
 
   for (i = 0; i < N; i++)
     {
-       p->a[i] = a[i];
-       p->b[i] = b[i];
-       if (foo == 135)
-	 abort (); /* to avoid vectorization  */
+      p->a[i] = a[i];
+      p->b[i] = b[i];
+      asm volatile ("" ::: "memory");
     }
 
   /* Vectorizable: distance > VF.  */
@@ -50,7 +48,6 @@ int main (void)
 { 
   check_vect ();
 
-  foo = 0;
   return main1 (0, N);
 }
 
Index: gcc/testsuite/gcc.dg/vect/vect-104.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-104.c	2017-05-03 08:46:27.807861752 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-104.c	2017-11-03 16:06:03.054282499 +0000
@@ -16,7 +16,6 @@ struct extraction
 static int a[N][N] = {{1,2,3},{4,5,6},{7,8,9}};
 static int b[N][N] = {{17,24,7},{0,2,3},{4,31,82}};
 static int c[N][N] = {{1,2,3},{4,5,5},{5,5,5}};
-volatile int foo;
 
 __attribute__ ((noinline))
 int main1 (int x) {
@@ -30,8 +29,7 @@ int main1 (int x) {
      {
        p->a[i][j] = a[i][j];
        p->b[i][j] = b[i][j];
-       if (foo == 135)
-	 abort (); /* to avoid vectorization  */
+       asm volatile ("" ::: "memory");
      }
    }
 
@@ -60,7 +58,6 @@ int main (void)
 { 
   check_vect ();
 
-  foo = 0;
   return main1 (N);
 }
 
Index: gcc/testsuite/gcc.dg/vect/pr42709.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr42709.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/pr42709.c	2017-11-03 16:06:03.052282173 +0000
@@ -9,7 +9,7 @@ #define N 128
 int *res[N];
 
 int
-main1 (int *a, int *b, int *c, int *d, int dummy)
+main1 (int *a, int *b, int *c, int *d)
 {
   int i;
 
@@ -19,8 +19,7 @@ main1 (int *a, int *b, int *c, int *d, i
       res[i+1] = b + 16;
       res[i+2] = c + 16;
       res[i+3] = d + 16;
-      if (dummy == 32)
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 }
 
Index: gcc/testsuite/gcc.dg/vect/slp-13-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-13-big-array.c	2017-06-08 08:51:43.124296047 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-13-big-array.c	2017-11-03 16:06:03.052282173 +0000
@@ -4,7 +4,6 @@
 #include "tree-vect.h"
 
 #define N 64
-volatile int y = 0;
 
 int
 main1 ()
@@ -18,8 +17,7 @@ main1 ()
   for (i = 0; i < N*8; i++)
     {
       in[i] = in2[i] = i;
-      if (y) /* Avoid vectorization.  */
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* Induction is SLPable.  */
Index: gcc/testsuite/gcc.dg/vect/slp-3-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-3-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-3-big-array.c	2017-11-03 16:06:03.053282336 +0000
@@ -6,7 +6,6 @@
 #define N 96
 
 unsigned short in[N*8];
-volatile int y = 0;
 
 int
 main1 ()
@@ -17,8 +16,7 @@ main1 ()
   for (i = 0; i < N*8; i++)
     {
       in[i] = i&63;
-      if (y) /* Avoid vectorization.  */
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-34-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-34-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-34-big-array.c	2017-11-03 16:06:03.053282336 +0000
@@ -7,7 +7,6 @@ #define N 64
 
 unsigned short in[N*8];
 unsigned short in2[N*8];
-volatile int y = 0;
 
 int
 main1 ()
@@ -19,8 +18,7 @@ main1 ()
   for (i = 0; i < N*8; i++)
     {
       in[i] = in2[i] = i;
-      if (y) /* Avoid vectorization.  */
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* SLP with unrolling by 8.  */
Index: gcc/testsuite/gcc.dg/vect/slp-4-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-4-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-4-big-array.c	2017-11-03 16:06:03.053282336 +0000
@@ -4,7 +4,6 @@
 #include "tree-vect.h"
 
 #define N 128
-volatile int y = 0;
 
 int
 main1 ()
@@ -17,8 +16,7 @@ main1 ()
   for (i = 0; i < N*8; i++)
     {
       in[i] = i;
-      if (y) /* Avoid vectorization.  */
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c	2017-11-03 16:06:03.053282336 +0000
@@ -13,7 +13,6 @@ struct s
 };
 
 char in[N*3];
-volatile int y = 0;
 
 __attribute__ ((noinline)) int
 main1 ()
@@ -24,8 +23,7 @@ main1 ()
   for (i = 0; i < N; i++)
     {
       in[i] = i&127;
-      if (y) /* Avoid vectorization.  */
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-105.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-105.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-105.c	2017-11-03 16:06:03.054282499 +0000
@@ -16,8 +16,6 @@ static int a[N][N] = {{1,2,3,11},{4,5,6,
 static int b[N][N] = {{17,28,15,23},{0,2,3,24},{4,31,82,25},{29,31,432,256}};
 static int c[N][N] = {{1,2,3,11},{4,9,13,34},{45,67,83,13},{34,45,67,83}};
 
-volatile int y;
-
 __attribute__ ((noinline))
 int main1 (int x) {
   int i,j;
@@ -30,10 +28,7 @@ int main1 (int x) {
      {
        p->a[i][j] = a[i][j];
        p->b[i][j] = b[i][j];
-       /* Because Y is volatile, the compiler cannot move this check out
-	  of the loop.  */
-       if (y)
-	 abort (); /* to avoid vectorization  */
+       asm volatile ("" ::: "memory");
      }
    }
 
Index: gcc/testsuite/gcc.dg/vect/vect-105-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-105-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-105-big-array.c	2017-11-03 16:06:03.054282499 +0000
@@ -16,8 +16,6 @@ struct extraction
 static int b[N][N];
 static int c[N][N];
 
-volatile int y;
-
 __attribute__ ((noinline))
 int main1 (int x) {
   int i,j, off;
@@ -29,8 +27,7 @@ int main1 (int x) {
      {
        a[i][j] = (i*7 + j*17)%53;
        b[i][j] = (i*11+ j*13)%41;
-       if (y)
-	 abort (); /* to avoid vectorization.  */
+       asm volatile ("" ::: "memory");
      }
    }
   for (i = 0; i < N; i++)
@@ -38,8 +35,7 @@ int main1 (int x) {
     for (j = 0; j < N; j++)
      {
        c[i][j] = a[i][j];
-       if (y)
-	 abort (); /* to avoid vectorization.  */
+       asm volatile ("" ::: "memory");
      }
    }
   for (i = 1; i < N; i++)
@@ -53,8 +49,7 @@ int main1 (int x) {
 	*(&c[0][0]+x+i+j) = *(&b[0][0] + off - N*N);
       else
 	*(&c[0][0]+x+i+j) = *(&a[0][0] + off);
-       if (y)
-	 abort (); /* to avoid vectorization.  */
+      asm volatile ("" ::: "memory");
     }
   }
 
@@ -64,10 +59,7 @@ int main1 (int x) {
      {
        p->a[i][j] = a[i][j];
        p->b[i][j] = b[i][j];
-       /* Because Y is volatile, the compiler cannot move this check out
-	  of the loop.  */
-       if (y)
-	 abort (); /* to avoid vectorization.  */
+       asm volatile ("" ::: "memory");
      }
    }
 
Index: gcc/testsuite/gcc.dg/vect/vect-112-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-112-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-112-big-array.c	2017-11-03 16:06:03.054282499 +0000
@@ -8,8 +8,6 @@ #define N 128
 char cb[N];
 char cc[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (void)
 {
@@ -20,9 +18,7 @@ main1 (void)
     cb[i] = i + 2;
     cc[i] = i + 1;
     check_diff += (cb[i] - cc[i]);
-    /* Avoid vectorization.  */
-    if (y)
-      abort ();
+    asm volatile ("" ::: "memory");
   }
 
   /* Cross-iteration cycle.  */
Index: gcc/testsuite/gcc.dg/vect/vect-15-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-15-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-15-big-array.c	2017-11-03 16:06:03.054282499 +0000
@@ -5,8 +5,6 @@
 
 #define N 128
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 ()
 {
@@ -17,8 +15,7 @@ int main1 ()
   for (i = 0; i <N; i++)
     {
       b[i] = i*3;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* Not vectorizable yet (reverse access and forward access).  */
Index: gcc/testsuite/gcc.dg/vect/vect-2-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-2-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-2-big-array.c	2017-11-03 16:06:03.054282499 +0000
@@ -9,8 +9,6 @@ #define N 128
 char cb[N];
 char ca[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 ()
 {
@@ -19,9 +17,7 @@ int main1 ()
   for (i = 0; i < N; i++)
     {
       cb[i] = i*3;
-      /* To avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-34-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-34-big-array.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-34-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -10,8 +10,6 @@ struct {
 } s;
 char cb[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 ()
 {
@@ -20,9 +18,7 @@ int main1 ()
   for (i = 0; i < N; i++)
     {
       cb[i] = i*3;
-      /* To avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
   for (i = 0; i < N; i++)
     {
Index: gcc/testsuite/gcc.dg/vect/vect-6-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-6-big-array.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-6-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -12,8 +12,6 @@ float e[N] = {0};
 float b[N];
 float c[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 ()
 {
@@ -25,17 +23,13 @@ int main1 ()
       c[i] = i;
       results1[i] = 0;
       results2[i] = 0;
-      /* Avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
   for (i=0; i<N/2; i++)
     {
       results1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
       results2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
-      /* Avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N/2; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-73-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-73-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-73-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -11,8 +11,6 @@ #define N 128
 
 #define ia (ic+N)
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 ()
 {
@@ -21,8 +19,7 @@ int main1 ()
   for (i = 0; i < N; i++)
     {
       ib[i] = i*3;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-74-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-74-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-74-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -13,8 +13,6 @@ float a[N] __attribute__ ((__aligned__(_
 float b[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
 float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (float *__restrict__  pa, float * __restrict__ pb, float * __restrict__ pc)
 {
@@ -25,14 +23,12 @@ main1 (float *__restrict__  pa, float *
     {
       b[i] = i;
       c[i] = 0.5 + i;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
   for (; i < N+4; i++)
     {
       b[i] = i;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-75-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-75-big-array.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-75-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -12,8 +12,6 @@ #define OFF 8
 
 int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 (int *ib)
 {
@@ -23,8 +21,7 @@ int main1 (int *ib)
   for (i = OFF; i < N+OFF; i++)
     {
       ib[i] = ib[i%OFF]*(i/OFF);
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
   for (i = 0; i < N; i++)
     {
Index: gcc/testsuite/gcc.dg/vect/vect-76-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-76-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-76-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -13,8 +13,6 @@ #define OFF 4
 int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
 int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17};
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 (int *pib)
 {
@@ -24,8 +22,7 @@ int main1 (int *pib)
     {
       ib[i] = ib[i%8]*(i/8);
       ic[i] = ic[i%8]*(i/8);
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = OFF; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-80-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-80-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-80-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -13,8 +13,6 @@ float fc[N] __attribute__ ((__aligned__(
    the expression that represents the first location accessed - is
    more involved than just an ssa_name.  */
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (float * __restrict__ pa, float * __restrict__ pb, float *__restrict__ pc)
 {
@@ -24,14 +22,12 @@ main1 (float * __restrict__ pa, float *
     {
       fb[i] = i;
       fc[i] = 0.5+i;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
   for (; i < N+4; i++)
     {
       fb[i] = i;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-97-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-97-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-97-big-array.c	2017-11-03 16:06:03.055282663 +0000
@@ -8,8 +8,6 @@ #define N 128
 char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
 char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 ()
 {
@@ -21,8 +19,7 @@ int main1 ()
   for (i = 0; i < N; i++)
     {
       cb[i] = i*3;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* Check that datarefs analysis can determine that the access via pointer
Index: gcc/testsuite/gcc.dg/vect/vect-all-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-all-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-all-big-array.c	2017-11-03 16:06:03.056282826 +0000
@@ -78,8 +78,6 @@ char cb[N] = {0,3,6,9,12,15,18,21,24,27,
 char ca[N];
 short sa[N];
 
-volatile int y = 0;
-
 /* All of the loops below are currently vectorizable, except
    initialization ones.  */
 
@@ -101,8 +99,7 @@ main1 ()
       fmul_results[i] = b[i] * c[i];
       fresults1[i] = 0;
       fresults2[i] = 0;
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* Test 1: copy chars.  */
@@ -142,15 +139,13 @@ main1 ()
     {
       fresults1[i] = a[i];
       fresults2[i] = e[i];
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
   for (i = 0; i < N/2; i++)
     {
       fresults1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
       fresults2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
   /* Test 4: access with offset.  */
   for (i = 0; i < N/2; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c	2015-09-07 18:51:04.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c	2017-11-03 16:06:03.056282826 +0000
@@ -9,8 +9,6 @@ #define N 256
 unsigned char uc[N];
 unsigned char diff;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) void
 main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
 {
@@ -33,9 +31,7 @@ main1 (unsigned char x, unsigned char ma
     if (uc[i] < min_result)
       min_result = uc[i];
 
-    /* Avoid vectorization.  */
-    if (y)
-      abort ();
+    asm volatile ("" ::: "memory");
   }
   for (i = 0; i < N; i++) {
     udiff += (unsigned char) (ub[i] - uc[i]);
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c	2017-11-03 16:06:03.056282826 +0000
@@ -4,7 +4,6 @@
 #include "tree-vect.h"
 
 #define N 256
-volatile int y = 0;
 
 __attribute__ ((noinline))
 void main1 (signed char x, signed char max_result, signed char min_result)
@@ -30,9 +29,7 @@ void main1 (signed char x, signed char m
       max_result = c[i];
     if (c[i] < min_result)
       min_result = c[i];
-    /* Avoid vectorization.  */
-    if (y)
-      abort ();
+    asm volatile ("" ::: "memory");
   }
 
   for (i = 0; i < N; i++) {
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-mult.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-mult.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-mult.c	2017-11-03 16:06:03.057282989 +0000
@@ -15,8 +15,6 @@ typedef struct {
    unsigned int b;
 } ii;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -34,8 +32,7 @@ main1 ()
       arr[i].b = i * 2;
       iarr[i].a = i;
       iarr[i].b = i * 3;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i2.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i2.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i2.c	2017-11-03 16:06:03.057282989 +0000
@@ -10,8 +10,6 @@ typedef struct {
    unsigned short b;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -24,8 +22,7 @@ main1 ()
     {
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i4.c	2015-07-02 18:26:18.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i4.c	2017-11-03 16:06:03.057282989 +0000
@@ -12,8 +12,6 @@ typedef struct {
    unsigned short d;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -28,8 +26,7 @@ main1 ()
       arr[i].b = i * 2;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-mult.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-mult.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-mult.c	2017-11-03 16:06:03.057282989 +0000
@@ -10,8 +10,6 @@ typedef struct {
    unsigned short b;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -28,8 +26,7 @@ main1 ()
       arr[i].a = i;
       arr[i].b = i * 2;
       iarr[i] = i * 3;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i2-gap.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i2-gap.c	2017-02-23 19:54:09.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i2-gap.c	2017-11-03 16:06:03.057282989 +0000
@@ -10,8 +10,6 @@ typedef struct {
    unsigned char b;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -24,8 +22,7 @@ main1 ()
     {
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c	2017-11-03 16:06:03.057282989 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -47,8 +45,7 @@ main1 ()
       check_res[i].h = arr[i].f;
       check_res[i].g = arr[i].f - arr[i].a;
 
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c	2017-11-03 16:06:03.057282989 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -36,8 +34,7 @@ main1 ()
       arr[i].f = i * 2 + 2;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c	2015-12-18 10:17:16.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c	2017-11-03 16:06:03.058283152 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -52,8 +50,7 @@ main1 ()
       check_res[i].h = arr[i].d;
       check_res[i].g = u + t;
 
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c	2015-12-18 10:17:16.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c	2017-11-03 16:06:03.058283152 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -37,8 +35,7 @@ main1 ()
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 67;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-24.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-24.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-24.c	2017-11-03 16:06:03.053282336 +0000
@@ -16,8 +16,6 @@ typedef struct {
 unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
 unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
 
-volatile int y = 0;
-
 void
 main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr)
 {
@@ -69,8 +67,7 @@ int main (void)
       arr[i].b = i * 2 + 10;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
   check_vect ();
   
Index: gcc/testsuite/gcc.dg/vect/slp-24-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-24-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-24-big-array.c	2017-11-03 16:06:03.052282173 +0000
@@ -15,7 +15,6 @@ typedef struct {
 unsigned char ub[N*2];
 unsigned char uc[N];
 
-volatile int y = 0;
 unsigned char check_diff = 2;
 
 void
@@ -69,13 +68,11 @@ int main (void)
     ub[i] = (i%5 == 0)?i*3:i;
     uc[i] = i;
     check_diff += (unsigned char) (ub[i] - uc[i]);
-    if (y) /* Avoid vectorization.  */
-      abort ();
+    asm volatile ("" ::: "memory");
   }
   for (; i < 2*N; i++) {
     ub[i] = 0;
-    if (y) /* Avoid vectorization.  */
-      abort ();
+    asm volatile ("" ::: "memory");
   }
 
   for (i = 0; i < N; i++)
@@ -84,8 +81,7 @@ int main (void)
       arr[i].b = i * 2 + 10;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
   check_vect ();
 
Index: gcc/testsuite/gcc.dg/vect/vect-98-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-98-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-98-big-array.c	2017-11-03 16:06:03.056282826 +0000
@@ -9,8 +9,6 @@ #define DOT16( a, b)   ( a[0]*b[0]   + a
 			 a[8]*b[8]   + a[9]*b[9]   + a[10]*b[10] + a[11]*b[11] + \
 			 a[12]*b[12] + a[13]*b[13] + a[14]*b[14] + a[15]*b[15])
 
-volatile int y = 0;
-
 __attribute__ ((noinline))
 int main1 (int ia[][N])
 {
@@ -41,9 +39,7 @@ int main (void)
     for (j = 0; j < N; j++)
       {
         ia[i][j] = i + j + 1;
-	/* Avoid vectorization.  */
-	if (y)
-	  abort ();
+	asm volatile ("" ::: "memory");
       }
 
   check_vect ();
Index: gcc/testsuite/gcc.dg/vect/vect-bswap16.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-bswap16.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-bswap16.c	2017-11-03 16:06:03.056282826 +0000
@@ -4,8 +4,6 @@
 
 #define N 128
 
-volatile int y = 0;
-
 static inline void
 vfoo16 (unsigned short int* a)
 {
@@ -27,8 +25,7 @@ main (void)
     {
       arr[i] = i;
       expect[i] = __builtin_bswap16 (i);
-      if (y) /* Avoid vectorisation.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   vfoo16 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-bswap32.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-bswap32.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-bswap32.c	2017-11-03 16:06:03.056282826 +0000
@@ -4,8 +4,6 @@
 
 #define N 128
 
-volatile int y = 0;
-
 static inline void
 vfoo32 (unsigned int* a)
 {
@@ -27,8 +25,7 @@ main (void)
     {
       arr[i] = i;
       expect[i] = __builtin_bswap32 (i);
-      if (y) /* Avoid vectorisation.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   vfoo32 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-bswap64.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-bswap64.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-bswap64.c	2017-11-03 16:06:03.056282826 +0000
@@ -4,8 +4,6 @@
 
 #define N 128
 
-volatile int y = 0;
-
 static inline void
 vfoo64 (unsigned long long* a)
 {
@@ -27,8 +25,7 @@ main (void)
     {
       arr[i] = i;
       expect[i] = __builtin_bswap64 (i);
-      if (y) /* Avoid vectorisation.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   vfoo64 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-mult-char-ls.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-mult-char-ls.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-mult-char-ls.c	2017-11-03 16:06:03.058283152 +0000
@@ -15,8 +15,6 @@ typedef struct {
    unsigned int b;
 } ii;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr, ii *iarr)
 {
@@ -64,8 +62,7 @@ int main (void)
       arr[i].b = i * 2;
       iarr[i].a = i;
       iarr[i].b = i * 3;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   main1 (arr, iarr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-mult.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-mult.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-mult.c	2017-11-03 16:06:03.058283152 +0000
@@ -15,8 +15,6 @@ typedef struct {
    unsigned int b;
 } ii;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr, ii *iarr)
 {
@@ -64,8 +62,7 @@ int main (void)
       arr[i].b = i * 2;
       iarr[i].a = i;
       iarr[i].b = i * 3;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   main1 (arr, iarr); 
Index: gcc/testsuite/gcc.dg/vect/vect-strided-same-dr.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-same-dr.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-same-dr.c	2017-11-03 16:06:03.058283152 +0000
@@ -12,8 +12,6 @@ typedef struct {
 
 s buffer1[N], buffer2[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s * __restrict__  pIn, s* __restrict__ pOut)
 {
@@ -63,8 +61,7 @@ int main (void)
       buffer1[i].b = i + 8;
       buffer2[i].a = i * 3;
       buffer2[i].b = i * 2;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   check_vect ();
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u16-i2.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u16-i2.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u16-i2.c	2017-11-03 16:06:03.058283152 +0000
@@ -10,8 +10,6 @@ typedef struct {
    unsigned short b;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -48,8 +46,7 @@ int main (void)
     { 
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u16-i4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u16-i4.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u16-i4.c	2017-11-03 16:06:03.058283152 +0000
@@ -12,8 +12,6 @@ typedef struct {
    unsigned short d;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -61,8 +59,7 @@ int main (void)
       arr[i].b = i * 2;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u32-i4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u32-i4.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u32-i4.c	2017-11-03 16:06:03.058283152 +0000
@@ -12,8 +12,6 @@ typedef struct {
    int d;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -56,8 +54,7 @@ int main (void)
       arr[i].b = i * 2;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u32-i8.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u32-i8.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u32-i8.c	2017-11-03 16:06:03.058283152 +0000
@@ -16,8 +16,6 @@ typedef struct {
    int h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -70,8 +68,7 @@ int main (void)
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2-gap.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2-gap.c	2015-11-11 15:40:09.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2-gap.c	2017-11-03 16:06:03.058283152 +0000
@@ -10,8 +10,6 @@ typedef struct {
    unsigned char b;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -64,8 +62,7 @@ int main (void)
     { 
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2.c	2017-11-03 16:06:03.059283316 +0000
@@ -10,8 +10,6 @@ typedef struct {
    unsigned char b;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -47,8 +45,7 @@ int main (void)
     { 
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c	2017-11-03 16:06:03.059283316 +0000
@@ -18,8 +18,6 @@ typedef struct {
 
 s check_res[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -83,8 +81,7 @@ int main (void)
       check_res[i].h = arr[i].f;
       check_res[i].g = arr[i].f - arr[i].b;
 
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c	2017-11-03 16:06:03.059283316 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -71,8 +69,7 @@ int main (void)
       arr[i].f = i * 2 + 2;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c	2017-11-03 16:06:03.059283316 +0000
@@ -18,8 +18,6 @@ typedef struct {
 
 s check_res[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -105,8 +103,7 @@ int main (void)
       check_res[i].h = arr[i].c;
       check_res[i].g = arr[i].b + arr[i].c;
 
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
   main1 (arr);
 
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c	2017-11-03 16:06:03.059283316 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr, int n)
 {
@@ -103,8 +101,7 @@ int main (void)
       arr[i].f = 16;
       arr[i].g = 3;
       arr[i].h = 56;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr, N-2);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c	2017-11-03 16:06:03.059283316 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -91,8 +89,7 @@ int main (void)
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c	2015-12-18 10:17:16.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c	2017-11-03 16:06:03.059283316 +0000
@@ -18,8 +18,6 @@ typedef struct {
 
 s check_res[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -93,8 +91,7 @@ int main (void)
       check_res[i].h = arr[i].d;
       check_res[i].g = u + t;
 
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     }
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c	2017-11-03 16:06:03.059283316 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -76,8 +74,7 @@ int main (void)
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 67;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8.c	2017-11-03 16:06:03.059283316 +0000
@@ -16,8 +16,6 @@ typedef struct {
    unsigned char h;
 } s;
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -78,8 +76,7 @@ int main (void)
       arr[i].f = i + 5;
       arr[i].g = i + 3;
       arr[i].h = 67;
-      if (y) /* Avoid vectorization.  */
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 
   main1 (arr);
Index: gcc/testsuite/gcc.dg/vect/vect-10-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-10-big-array.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-10-big-array.c	2017-11-03 16:06:03.054282499 +0000
@@ -8,8 +8,6 @@ #define N 128
 short a[N];
 short d[N];
 
-volatile int y = 0;
-
 int foo ()
 {
   int i;
@@ -19,10 +17,7 @@ int foo ()
     {
       b[i] = i*3;
       c[i] = i;
-
-      /* Avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* Strided access pattern.  */
Index: gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c	2017-11-03 16:06:03.056282826 +0000
@@ -9,8 +9,6 @@ int in[2*K][K] __attribute__ ((__aligned
 int out[K];
 int check_result[K];
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) void
 foo ()
 {
@@ -24,9 +22,7 @@ foo ()
         for (i = 0; i < K; i++)
 	{
           sum *= in[i+k][j];
-	  /* Avoid vectorization.  */
-	  if (y)
-	    abort ();
+	  asm volatile ("" ::: "memory");
 	}
       check_result[k] = sum;
     }
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c	2017-11-03 16:06:03.057282989 +0000
@@ -7,8 +7,6 @@ #define N 128
 unsigned char udata_ch[N];
 #define SUM N*(N-1)
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 foo ()
 {
@@ -18,9 +16,7 @@ foo ()
   for (i = 0; i < N; i++)
     {
       udata_ch[i] = i*2;
-      /* Avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* widenning sum: sum chars into int.  */
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c	2017-11-03 16:06:03.057282989 +0000
@@ -7,8 +7,6 @@ #define N 128
 unsigned char udata_ch[N];
 #define SUM N*(N-1)
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 foo ()
 {
@@ -18,9 +16,7 @@ foo ()
   for (i = 0; i < N; i++)
     {
       udata_ch[i] = i*2;
-      /* Avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* widenning sum: sum chars into short.  */
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c	2017-08-17 13:18:10.887424067 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c	2017-11-03 16:06:03.057282989 +0000
@@ -6,8 +6,6 @@
 #define N 128
 signed char data_ch[N];
 
-volatile int y = 0;
-
 __attribute__ ((noinline)) int
 foo ()
 {
@@ -19,9 +17,7 @@ foo ()
     {
       data_ch[i] = i*2;
       check_intsum += data_ch[i];
-      /* Avoid vectorization.  */
-      if (y)
-	abort ();
+      asm volatile ("" ::: "memory");
     }
 
   /* widenning sum: sum chars into int.  */
Index: gcc/testsuite/gcc.dg/vect/vect-117.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-117.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-117.c	2017-11-03 16:06:03.054282499 +0000
@@ -17,8 +17,6 @@ static  int c[N][N] = {{ 1, 2, 3, 4, 5},
 		       {34,38,42,46,50},
 		       {55,60,65,70,75}};
 
-volatile int foo;
-
 __attribute__ ((noinline))
 int main1 (int A[N][N], int n) 
 {
@@ -43,7 +41,6 @@ int main (void)
 
   check_vect ();
 
-  foo = 0;
   main1 (a, N);
 
   /* check results: */

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [2/10] Add VECTOR_BITS to tree-vect.h
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
  2017-11-03 16:16 ` [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests Richard Sandiford
@ 2017-11-03 16:17 ` Richard Sandiford
  2017-11-08 19:13   ` Jeff Law
  2017-11-03 16:18 ` [3/10] Add available_vector_sizes to target-supports.exp Richard Sandiford
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:17 UTC (permalink / raw)
  To: gcc-patches

Several vector tests are sensitive to the vector size.  This patch adds
a VECTOR_BITS macro to tree-vect.h to select the expected vector size
and uses it to influence iteration counts and array sizes.  The tests
keep the original values if the vector size is small enough.

For now VECTOR_BITS is always 128, but the SVE patches add other values.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/testsuite/
	* gcc.dg/vect/tree-vect.h (VECTOR_BITS): Define.
	* gcc.dg/vect/bb-slp-pr69907.c: Include tree-vect.h.
	(N): New macro.
	(foo): Use it instead of hard-coded 320.
	* gcc.dg/vect/no-scevccp-outer-7.c (N): Redefine if the default
	value is too small for VECTOR_BITS.
	* gcc.dg/vect/no-scevccp-vect-iv-3.c (N): Likewise.
	* gcc.dg/vect/no-section-anchors-vect-31.c (N): Likewise.
	* gcc.dg/vect/no-section-anchors-vect-36.c (N): Likewise.
	* gcc.dg/vect/slp-perm-9.c (N): Likewise.
	* gcc.dg/vect/vect-32.c (N): Likewise.
	* gcc.dg/vect/vect-75.c (N, OFF): Likewise.
	* gcc.dg/vect/vect-77-alignchecks.c (N, OFF): Likewise.
	* gcc.dg/vect/vect-78-alignchecks.c (N, OFF): Likewise.
	* gcc.dg/vect/vect-89.c (N): Likewise.
	* gcc.dg/vect/vect-96.c (N): Likewise.
	* gcc.dg/vect/vect-multitypes-3.c (N): Likewise.
	* gcc.dg/vect/vect-multitypes-6.c (N): Likewise.
	* gcc.dg/vect/vect-over-widen-1.c (N): Likewise.
	* gcc.dg/vect/vect-over-widen-4.c (N): Likewise.
	* gcc.dg/vect/vect-reduc-pattern-1a.c (N): Likewise.
	* gcc.dg/vect/vect-reduc-pattern-1b.c (N): Likewise.
	* gcc.dg/vect/vect-reduc-pattern-2a.c (N): Likewise.
	* gcc.dg/vect/no-section-anchors-vect-64.c (NINTS): New macro.
	(N): Redefine in terms of NINTS.
	(ia, ib, ic): Use NINTS instead of hard-coded constants in the
	array bounds.
	* gcc.dg/vect/no-section-anchors-vect-69.c (NINTS): New macro.
	(N): Redefine in terms of NINTS.
	(test1): Replace a and b fields with NINTS - 2 ints of padding.
	(main1): Use NINTS instead of hard-coded constants.
	* gcc.dg/vect/section-anchors-vect-69.c (NINTS): New macro.
	(N): Redefine in terms of NINTS.
	(test1): Replace a and b fields with NINTS - 2 ints of padding.
	(test2): Remove incorrect comments about alignment.
	(main1): Use NINTS instead of hard-coded constants.
	* gcc.dg/vect/pr45752.c (N): Redefine if the default value is
	too small for VECTOR_BITS.
	(main): Continue to use canned results for the default value of N,
	but compute the expected results from scratch for other values.
	* gcc.dg/vect/slp-perm-1.c (N, main): As for pr45752.c.
	* gcc.dg/vect/slp-perm-4.c (N, main): Likewise.
	* gcc.dg/vect/slp-perm-5.c (N, main): Likewise.
	* gcc.dg/vect/slp-perm-6.c (N, main): Likewise.
	* gcc.dg/vect/slp-perm-7.c (N, main): Likewise.
	* gcc.dg/vect/pr65518.c (NINTS, N, RESULT): New macros.
	(giga): Use NINTS as the array bound.
	(main): Use NINTS, N and RESULT.
	* gcc.dg/vect/pr65947-5.c (N): Redefine if the default value is
	too small for VECTOR_BITS.
	(main): Fill in any remaining elements of A programmatically.
	* gcc.dg/vect/pr81136.c: Include tree-vect.h.
	(a): Use VECTOR_BITS to set the alignment of the target structure.
	* gcc.dg/vect/slp-19c.c (N): Redefine if the default value is
	too small for VECTOR_BITS.
	(main1): Continue to use the canned input for the default value of N,
	but compute the input from scratch for other values.
	* gcc.dg/vect/slp-28.c (N): Redefine if the default value is
	too small for VECTOR_BITS.
	(in1, in2, in3): Remove initialization.
	(check1, check2): Delete.
	(main1): Initialize in1, in2 and in3 here.  Check every element
	of the vectors and compute the expected values directly instead
	of using an array.
	* gcc.dg/vect/slp-perm-8.c (N): Redefine if the default value is
	too small for VECTOR_BITS.
	(foo, main): Change type of "i" to int.
	* gcc.dg/vect/vect-103.c (NINTS): New macro.
	(N): Redefine in terms of N.
	(c): Delete.
	(main1): Use NINTS.  Check the result from a and b directly.
	* gcc.dg/vect/vect-67.c (NINTS): New macro.
	(N): Redefine in terms of N.
	(main1): Use NINTS for the inner array bounds.
	* gcc.dg/vect/vect-70.c (NINTS, OUTERN): New macros.
	(N): Redefine in terms of NINTS.
	(s): Keep the outer dimensions as 4 even if N is larger than 24.
	(tmp1): New variable.
	(main1): Only define a local tmp1 if NINTS is relatively small.
	Use OUTERN for the outer loops and NINTS for the inner loops.
	* gcc.dg/vect/vect-91.c (OFF): New macro.
	(a, main3): Use it.
	* gcc.dg/vect/vect-92.c (NITER): New macro.
	(main1, main2): Use it.
	* gcc.dg/vect/vect-93.c (N): Rename to...
	(N1): ...this.
	(main): Update accordingly.
	(N2): New macro.
	(main1): Use N1 instead of 3001 and N2 insteaed of 10.
	* gcc.dg/vect/vect-multitypes-1.c (NSHORTS, NINTS): New macros.
	(N): Redefine in terms of NSHORTS.
	(main1): Use NINTS - 1 instead of 3 and NSHORTS - 1 instead of 7.
	(main): Likewise.
	* gcc.dg/vect/vect-over-widen-3-big-array.c (N): Define to VECTOR_BITS.
	(foo): Truncate the expected value to the type of *d.
	* gcc.dg/vect/vect-peel-3.c (NINTS, EXTRA): New macros.
	(ia, ib, ic, main): Use EXTRA.
	(main): Use NINTS.
	(RES_A, RES_B, REC_C): New macros.
	(RES): Redefine as their sum.
	* gcc.dg/vect/vect-reduc-or_1.c (N): New macro.
	(in): Change number of elements to N.
	(main): Update accordingly.  Calculate the expected result.
	* gcc.dg/vect/vect-reduc-or_2.c (N, in, main): As for
	vect-reduc-or-1.c.

Index: gcc/testsuite/gcc.dg/vect/tree-vect.h
===================================================================
--- gcc/testsuite/gcc.dg/vect/tree-vect.h	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/tree-vect.h	2017-11-03 16:06:08.012090077 +0000
@@ -75,3 +75,5 @@ check_vect (void)
 #endif
   signal (SIGILL, SIG_DFL);
 }
+
+#define VECTOR_BITS 128
Index: gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c	2016-05-02 10:44:34.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c	2017-11-03 16:06:08.010089752 +0000
@@ -2,10 +2,18 @@
 /* { dg-additional-options "-O3" } */
 /* { dg-require-effective-target vect_unpack } */
 
+#include "tree-vect.h"
+
+#if VECTOR_BITS > 512
+#define N (VECTOR_BITS * 10 / 16)
+#else
+#define N 320
+#endif
+
 void foo(unsigned *p1, unsigned short *p2)
 {
   int n;
-  for (n = 0; n < 320; n++)
+  for (n = 0; n < N; n++)
     p1[n] = p2[n * 2];
 }
 
Index: gcc/testsuite/gcc.dg/vect/no-scevccp-outer-7.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-scevccp-outer-7.c	2017-05-03 08:46:27.807861752 +0100
+++ gcc/testsuite/gcc.dg/vect/no-scevccp-outer-7.c	2017-11-03 16:06:08.010089752 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 256
+#define N (VECTOR_BITS / 16)
+#else
 #define N 16
+#endif
 
 unsigned short in[N];
 unsigned short coef[N];
Index: gcc/testsuite/gcc.dg/vect/no-scevccp-vect-iv-3.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-scevccp-vect-iv-3.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-scevccp-vect-iv-3.c	2017-11-03 16:06:08.010089752 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 256
+#define N (VECTOR_BITS / 16 + 10)
+#else
 #define N 26
+#endif
  
 __attribute__ ((noinline))
 unsigned int main1 ()
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c	2017-11-03 16:06:08.010089752 +0000
@@ -4,7 +4,12 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+/* N / 2 bytes has to be worth vectorizing even with peeling.  */
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 4 / 8)
+#else
 #define N 64
+#endif
 
 struct t{
   int k[N];
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c	2017-11-03 16:06:08.010089752 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 8)
+#else
 #define N 32
+#endif
  
 struct {
   char ca[N];
Index: gcc/testsuite/gcc.dg/vect/slp-perm-9.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-9.c	2017-11-03 16:06:03.054282499 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-9.c	2017-11-03 16:06:08.012090077 +0000
@@ -3,7 +3,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 512
+#define N (VECTOR_BITS * 6 / 16)
+#else
 #define N 200
+#endif
 
 void __attribute__((noinline))
 foo (unsigned short *__restrict__ pInput, unsigned short *__restrict__ pOutput)
Index: gcc/testsuite/gcc.dg/vect/vect-32.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-32.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-32.c	2017-11-03 16:06:08.012090077 +0000
@@ -3,8 +3,12 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS / 8)
+#else
 #define N 16
- 
+#endif
+
 __attribute__ ((noinline))
 int main1 ()
 {  
Index: gcc/testsuite/gcc.dg/vect/vect-75.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-75.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-75.c	2017-11-03 16:06:08.013090240 +0000
@@ -3,8 +3,13 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 32)
+#define OFF (VECTOR_BITS / 32)
+#else
 #define N 8
 #define OFF 8
+#endif
 
 /* Check handling of accesses for which the "initial condition" -
    the expression that represents the first location accessed - is
Index: gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c	2017-11-03 16:06:08.013090240 +0000
@@ -3,8 +3,13 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 32)
+#define OFF (VECTOR_BITS / 32)
+#else
 #define N 8
 #define OFF 8
+#endif
 
 /* Check handling of accesses for which the "initial condition" -
    the expression that represents the first location accessed - is
Index: gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c	2017-07-29 16:32:10.909577688 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c	2017-11-03 16:06:08.013090240 +0000
@@ -3,8 +3,13 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 32)
+#define OFF (VECTOR_BITS / 32)
+#else
 #define N 8
 #define OFF 8
+#endif
 
 /* Check handling of accesses for which the "initial condition" -
    the expression that represents the first location accessed - is
Index: gcc/testsuite/gcc.dg/vect/vect-89.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-89.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-89.c	2017-11-03 16:06:08.013090240 +0000
@@ -3,7 +3,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 256
+#define N (VECTOR_BITS * 2 / 32)
+#else
 #define N 16
+#endif
 
 struct tmp_struct
 {
Index: gcc/testsuite/gcc.dg/vect/vect-96.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-96.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-96.c	2017-11-03 16:06:08.013090240 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 256
+#define N (VECTOR_BITS * 2 / 32)
+#else
 #define N 16
+#endif
 
 struct tmp
 {
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 8)
+#else
 #define N 32
+#endif
 
 int ib[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = 
 	{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 8)
+#else
 #define N 32
+#endif
 
 unsigned int ic[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = 
 	{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
Index: gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 8 / 16)
+#else
 #define N 64
+#endif
 
 /* Modified rgb to rgb conversion from FFmpeg.  */
 __attribute__ ((noinline)) void
Index: gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,7 +4,11 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 8 / 16)
+#else
 #define N 64
+#endif
 
 /* Modified rgb to rgb conversion from FFmpeg.  */
 __attribute__ ((noinline)) int
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c	2017-11-03 16:06:08.014090402 +0000
@@ -3,7 +3,12 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 16)
+#else
 #define N 16
+#endif
+
 unsigned short udata_sh[N] =
   { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
 #define SUM 210
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c	2017-11-03 16:06:08.015090565 +0000
@@ -3,7 +3,12 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 16)
+#else
 #define N 16
+#endif
+
 unsigned char udata_ch[N] =
   { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
 #define SUM 210
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c	2017-11-03 16:06:08.015090565 +0000
@@ -3,7 +3,12 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 16)
+#else
 #define N 16
+#endif
+
 signed short data_sh[N] =
   { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
 #define SUM 210
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c	2017-11-03 16:06:08.010089752 +0000
@@ -4,12 +4,18 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 16
+#if VECTOR_BITS > 128
+#define NINTS (VECTOR_BITS / 32)
+#else
+#define NINTS 4
+#endif
+
+#define N (NINTS * 4)
 
 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-int ia[N][4][N+1];
-int ic[N][N][3][2*N+2];
-int id[N][N][N+4];
+int ia[N][NINTS][N + 1];
+int ic[N][N][NINTS - 1][2 * N + 2];
+int id[N][N][N + NINTS];
 
 __attribute__ ((noinline))
 int main1 ()
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c	2017-08-03 10:40:54.012104085 +0100
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c	2017-11-03 16:06:08.011089914 +0000
@@ -5,7 +5,13 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 24
+#if VECTOR_BITS > 128
+#define NINTS (VECTOR_BITS / 32)
+#else
+#define NINTS 4
+#endif
+
+#define N (NINTS * 6)
 
 struct s{
   int m;
@@ -19,8 +25,7 @@ struct s2{
 
 struct test1{
   struct s a; /* array a.n is unaligned */
-  int b;
-  int c;
+  int pad[NINTS - 2];
   struct s e; /* array e.n is aligned */
 };
 
@@ -54,13 +59,13 @@ int main1 ()
     }
 
   /* 2. aligned */
-  for (i = 3; i < N-1; i++)
+  for (i = NINTS - 1; i < N - 1; i++)
     {
       tmp1[2].a.n[1][2][i] = 6;
     }
 
   /* check results:  */
-  for (i = 3; i < N-1; i++)
+  for (i = NINTS; i < N - 1; i++)
     {
       if (tmp1[2].a.n[1][2][i] != 6)
         abort ();
@@ -86,18 +91,18 @@ int main1 ()
     }
 
   /* 4. unaligned (unknown misalignment) */
-  for (i = 0; i < N-4; i++)
+  for (i = 0; i < N - NINTS; i++)
     {
-      for (j = 0; j < N-4; j++)
+      for (j = 0; j < N - NINTS; j++)
 	{
           tmp2[2].e.n[1][i][j] = 8;
 	}
     }
 
   /* check results:  */
-  for (i = 0; i < N-4; i++)
+  for (i = 0; i < N - NINTS; i++)
     {
-      for (j = 0; j < N-4; j++)
+      for (j = 0; j < N - NINTS; j++)
 	{
           if (tmp2[2].e.n[1][i][j] != 8)
 	    abort ();
Index: gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c	2017-08-03 10:40:54.013104709 +0100
+++ gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c	2017-11-03 16:06:08.011089914 +0000
@@ -4,7 +4,13 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 32
+#if VECTOR_BITS > 128
+#define NINTS (VECTOR_BITS / 32)
+#else
+#define NINTS 4
+#endif
+
+#define N (NINTS * 8)
 
 struct s{
   int m;
@@ -18,16 +24,15 @@ struct s2{
 
 struct test1{
   struct s a; /* array a.n is unaligned */
-  int b;
-  int c;
+  int pad[NINTS - 2];
   struct s e; /* array e.n is aligned */
 };
 
 struct test2{
-  struct s2 a; /* array a.n is unaligned */
+  struct s2 a;
   int b;
   int c;
-  struct s2 e; /* array e.n is aligned */
+  struct s2 e;
 };
 
 
@@ -52,13 +57,13 @@ int main1 ()
     }
 
   /* 2. aligned */
-  for (i = 3; i < N-1; i++)
+  for (i = NINTS - 1; i < N - 1; i++)
     {
       tmp1[2].a.n[1][2][i] = 6;
     }
 
   /* check results:  */
-  for (i = 3; i < N-1; i++)
+  for (i = NINTS - 1; i < N - 1; i++)
     {
       if (tmp1[2].a.n[1][2][i] != 6)
         abort ();
@@ -84,18 +89,18 @@ int main1 ()
     }
 
   /* 4. unaligned */
-  for (i = 0; i < N-4; i++)
+  for (i = 0; i < N - NINTS; i++)
     {
-      for (j = 0; j < N-4; j++)
+      for (j = 0; j < N - NINTS; j++)
 	{
           tmp2[2].e.n[1][i][j] = 8;
 	}
     }
 
   /* check results:  */
-  for (i = 0; i < N-4; i++)
+  for (i = 0; i < N - NINTS; i++)
     {
-      for (j = 0; j < N-4; j++)
+      for (j = 0; j < N - NINTS; j++)
 	{
           if (tmp2[2].e.n[1][i][j] != 8)
 	    abort ();
Index: gcc/testsuite/gcc.dg/vect/pr45752.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr45752.c	2015-12-18 10:17:16.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/pr45752.c	2017-11-03 16:06:08.011089914 +0000
@@ -35,7 +35,11 @@ #define M24 115
 #define M34 7716
 #define M44 16
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 5 / 32)
+#else
 #define N 20
+#endif
 
 void foo (unsigned int *__restrict__ pInput,
           unsigned int *__restrict__ pOutput,
@@ -77,12 +81,6 @@ void foo (unsigned int *__restrict__ pIn
 int main (int argc, const char* argv[])
 {
   unsigned int input[N], output[N], i, input2[N], output2[N];
-  unsigned int check_results[N]
-    = {3208, 1334, 28764, 35679, 2789, 13028, 4754, 168364, 91254, 12399, 
-    22848, 8174, 307964, 146829, 22009, 32668, 11594, 447564, 202404, 31619 };
-  unsigned int check_results2[N]
-    = {7136, 2702, 84604, 57909, 6633, 16956, 6122, 224204, 113484, 16243, 
-    26776, 9542, 363804, 169059, 25853, 36596, 12962, 503404, 224634, 35463 };
 
   check_vect ();
 
@@ -95,6 +93,57 @@ int main (int argc, const char* argv[])
       __asm__ volatile ("");
     }
 
+#if N == 20
+  unsigned int check_results[N]
+    = { 3208, 1334, 28764, 35679, 2789, 13028, 4754, 168364, 91254, 12399, 
+	22848, 8174, 307964, 146829, 22009, 32668, 11594, 447564, 202404,
+	31619 };
+  unsigned int check_results2[N]
+    = { 7136, 2702, 84604, 57909, 6633, 16956, 6122, 224204, 113484, 16243, 
+	26776, 9542, 363804, 169059, 25853, 36596, 12962, 503404, 224634,
+	35463 };
+#else
+  volatile unsigned int check_results[N];
+  volatile unsigned int check_results2[N];
+
+  for (i = 0; i < N / 5; i++)
+    {
+      unsigned int a = input[i * 5];
+      unsigned int b = input[i * 5 + 1];
+      unsigned int c = input[i * 5 + 2];
+      unsigned int d = input[i * 5 + 3];
+      unsigned int e = input[i * 5 + 4];
+
+      check_results[i * 5] = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e;
+      check_results[i * 5 + 1] = (M10 * a + M11 * b + M12 * c
+				  + M13 * d + M14 * e);
+      check_results[i * 5 + 2] = (M20 * a + M21 * b + M22 * c
+				  + M23 * d + M24 * e);
+      check_results[i * 5 + 3] = (M30 * a + M31 * b + M32 * c
+				  + M33 * d + M34 * e);
+      check_results[i * 5 + 4] = (M40 * a + M41 * b + M42 * c
+				  + M43 * d + M44 * e);
+
+      a = input2[i * 5];
+      b = input2[i * 5 + 1];
+      c = input2[i * 5 + 2];
+      d = input2[i * 5 + 3];
+      e = input2[i * 5 + 4];
+
+      check_results2[i * 5] = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e;
+      check_results2[i * 5 + 1]	= (M10 * a + M11 * b + M12 * c
+				   + M13 * d + M14 * e);
+      check_results2[i * 5 + 2]	= (M20 * a + M21 * b + M22 * c
+				   + M23 * d + M24 * e);
+      check_results2[i * 5 + 3]	= (M30 * a + M31 * b + M32 * c
+				   + M33 * d + M34 * e);
+      check_results2[i * 5 + 4] = (M40 * a + M41 * b + M42 * c
+				   + M43 * d + M44 * e);
+
+      asm volatile ("" ::: "memory");
+    }
+#endif
+
   foo (input, output, input2, output2);
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-perm-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-1.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-1.c	2017-11-03 16:06:08.011089914 +0000
@@ -13,7 +13,11 @@ #define M02 74
 #define M12 191
 #define M22 500
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 3 / 32 + 4)
+#else
 #define N 16
+#endif
 
 void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput)
 {
@@ -34,7 +38,6 @@ void foo (unsigned int *__restrict__ pIn
 int main (int argc, const char* argv[])
 {
   unsigned int input[N], output[N], i;
-  unsigned int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
 
   check_vect ();
 
@@ -45,6 +48,25 @@ int main (int argc, const char* argv[])
       __asm__ volatile ("");
     }
 
+#if N == 16
+  unsigned int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
+#else
+  volatile unsigned int check_results[N] = {};
+
+  for (unsigned int i = 0; i < N / 3; i++)
+    {
+      unsigned int a = input[i * 3];
+      unsigned int b = input[i * 3 + 1];
+      unsigned int c = input[i * 3 + 2];
+
+      check_results[i * 3] = M00 * a + M01 * b + M02 * c;
+      check_results[i * 3 + 1] = M10 * a + M11 * b + M12 * c;
+      check_results[i * 3 + 2] = M20 * a + M21 * b + M22 * c;
+
+      asm volatile ("" ::: "memory");
+    }
+#endif
+
   foo (input, output);
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-perm-4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-4.c	2017-11-03 16:06:03.053282336 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-4.c	2017-11-03 16:06:08.012090077 +0000
@@ -34,7 +34,11 @@ #define M24 115
 #define M34 7716
 #define M44 16
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 5 / 32)
+#else
 #define N 20
+#endif
 
 void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput)
 {
@@ -59,9 +63,6 @@ void foo (unsigned int *__restrict__ pIn
 int main (int argc, const char* argv[])
 {
   unsigned int input[N], output[N], i;
-  unsigned int check_results[N]
-    = {3208, 1334, 28764, 35679, 2789, 13028, 4754, 168364, 91254, 12399, 
-    22848, 8174, 307964, 146829, 22009, 32668, 11594, 447564, 202404, 31619};
 
   check_vect ();
 
@@ -72,6 +73,34 @@ int main (int argc, const char* argv[])
       asm volatile ("" ::: "memory");
     }
 
+#if N == 20
+  unsigned int check_results[N]
+    = {3208, 1334, 28764, 35679, 2789, 13028, 4754, 168364, 91254, 12399,
+    22848, 8174, 307964, 146829, 22009, 32668, 11594, 447564, 202404, 31619};
+#else
+  volatile unsigned int check_results[N];
+
+  for (i = 0; i < N / 5; i++)
+    {
+      unsigned int a = input[i * 5];
+      unsigned int b = input[i * 5 + 1];
+      unsigned int c = input[i * 5 + 2];
+      unsigned int d = input[i * 5 + 3];
+      unsigned int e = input[i * 5 + 4];
+
+      check_results[i * 5] = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e;
+      check_results[i * 5 + 1] = (M10 * a + M11 * b + M12 * c
+				  + M13 * d + M14 * e);
+      check_results[i * 5 + 2] = (M20 * a + M21 * b + M22 * c
+				  + M23 * d + M24 * e);
+      check_results[i * 5 + 3] = (M30 * a + M31 * b + M32 * c
+				  + M33 * d + M34 * e);
+      check_results[i * 5 + 4] = (M40 * a + M41 * b + M42 * c
+				  + M43 * d + M44 * e);
+      asm volatile ("");
+    }
+#endif
+
   foo (input, output);
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-perm-5.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-5.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-5.c	2017-11-03 16:06:08.012090077 +0000
@@ -18,7 +18,11 @@ #define K10 112
 #define K01 4322
 #define K11 135
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 3 / 32 + 4)
+#else
 #define N 16
+#endif
 
 void foo (int *__restrict__ pInput, int *__restrict__ pOutput,
           int *__restrict__ pInput2, int *__restrict__ pOutput2)
@@ -46,9 +50,7 @@ void foo (int *__restrict__ pInput, int
 int main (int argc, const char* argv[])
 {
   int input[N], output[N], i;
-  int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
   int input2[N], output2[N];
-  int check_results2[N] = {4322, 135, 13776, 629, 23230, 1123, 32684, 1617, 42138, 2111, 0, 0, 0, 0, 0, 0};
 
   check_vect ();
 
@@ -63,6 +65,35 @@ int main (int argc, const char* argv[])
       __asm__ volatile ("");
     }
 
+#if N == 16
+  int check_results[N] = { 1470, 395, 28271, 5958, 1655, 111653, 10446, 2915,
+			   195035, 14934, 4175, 278417, 19422, 5435, 361799,
+			   0 };
+  int check_results2[N] = { 4322, 135, 13776, 629, 23230, 1123, 32684, 1617,
+			    42138, 2111, 0, 0, 0, 0, 0, 0 };
+#else
+  volatile int check_results[N] = {};
+  volatile int check_results2[N] = {};
+
+  for (int i = 0; i < N / 3; i++)
+    {
+      int a = input[i * 3];
+      int b = input[i * 3 + 1];
+      int c = input[i * 3 + 2];
+      int d = input2[i * 2];
+      int e = input2[i * 2 + 1];
+
+      check_results[i * 3] = M00 * a + M01 * b + M02 * c;
+      check_results[i * 3 + 1] = M10 * a + M11 * b + M12 * c;
+      check_results[i * 3 + 2] = M20 * a + M21 * b + M22 * c;
+
+      check_results2[i * 2] = K00 * d + K01 * e;
+      check_results2[i * 2 + 1] = K10 * d + K11 * e;
+
+      asm volatile ("" ::: "memory");
+    }
+#endif
+
   foo (input, output, input2, output2);
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-perm-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-6.c	2016-01-13 13:48:42.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-6.c	2017-11-03 16:06:08.012090077 +0000
@@ -18,7 +18,11 @@ #define K10 112
 #define K01 4322
 #define K11 135
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 3 / 32 + 4)
+#else
 #define N 16
+#endif
 
 void foo (int *__restrict__ pInput, int *__restrict__ pOutput,
           int *__restrict__ pInput2, int *__restrict__ pOutput2)
@@ -47,9 +51,7 @@ void foo (int *__restrict__ pInput, int
 int main (int argc, const char* argv[])
 {
   int input[N], output[N], i;
-  int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
   int input2[N], output2[N];
-  int check_results2[N] = {0, 112, 810, 336, 1620, 560, 2430, 784, 3240, 1008, 0, 0, 0, 0, 0, 0};
 
   check_vect ();
 
@@ -62,6 +64,35 @@ int main (int argc, const char* argv[])
       __asm__ volatile ("");
     }
 
+#if N == 16
+  int check_results[N] = { 1470, 395, 28271, 5958, 1655, 111653, 10446, 2915,
+			   195035, 14934, 4175, 278417, 19422, 5435, 361799,
+			   0 };
+  int check_results2[N] = { 0, 112, 810, 336, 1620, 560, 2430, 784, 3240, 1008,
+			    0, 0, 0, 0, 0, 0 };
+#else
+  volatile int check_results[N] = {};
+  volatile int check_results2[N] = {};
+
+  for (int i = 0; i < N / 3; i++)
+    {
+      int a = input[i * 3];
+      int b = input[i * 3 + 1];
+      int c = input[i * 3 + 2];
+      int d = input2[i * 2];
+      int e = input2[i * 2 + 1];
+
+      check_results[i * 3] = M00 * a + M01 * b + M02 * c;
+      check_results[i * 3 + 1] = M10 * a + M11 * b + M12 * c;
+      check_results[i * 3 + 2] = M20 * a + M21 * b + M22 * c;
+
+      check_results2[i * 2] = K00 * d;
+      check_results2[i * 2 + 1] = K10 * e;
+
+      asm volatile ("" ::: "memory");
+    }
+#endif
+
   foo (input, output, input2, output2);
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-perm-7.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-7.c	2017-11-03 16:06:03.053282336 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-7.c	2017-11-03 16:06:08.012090077 +0000
@@ -18,7 +18,11 @@ #define K10 112
 #define K01 4322
 #define K11 135
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 3 / 32 + 4)
+#else
 #define N 16
+#endif
 
 /* SLP with load permutation and loop-based vectorization.  */
 void foo (int *__restrict__ pInput, int *__restrict__ pOutput,
@@ -45,9 +49,7 @@ void foo (int *__restrict__ pInput, int
 int main (int argc, const char* argv[])
 {
   int input[N], output[N], i;
-  int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
   int input2[N], output2[N];
-  int check_results2[N] = {0, 405, 810, 1215, 1620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 
   check_vect ();
 
@@ -60,6 +62,30 @@ int main (int argc, const char* argv[])
       asm volatile ("" ::: "memory");
     }
 
+#if N == 16
+  int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
+  int check_results2[N] = {0, 405, 810, 1215, 1620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+#else
+  volatile int check_results[N] = {};
+  volatile int check_results2[N] = {};
+
+  for (int i = 0; i < N / 3; i++)
+    {
+      int a = input[i * 3];
+      int b = input[i * 3 + 1];
+      int c = input[i * 3 + 2];
+      int d = input2[i];
+
+      check_results[i * 3] = M00 * a + M01 * b + M02 * c;
+      check_results[i * 3 + 1] = M10 * a + M11 * b + M12 * c;
+      check_results[i * 3 + 2] = M20 * a + M21 * b + M22 * c;
+
+      check_results2[i] = K00 * d;
+
+      asm volatile ("" ::: "memory");
+    }
+#endif
+
   foo (input, output, input2, output2);
 
   for (i = 0; i < N; i++)
Index: gcc/testsuite/gcc.dg/vect/pr65518.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr65518.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/pr65518.c	2017-11-03 16:06:08.011089914 +0000
@@ -1,10 +1,19 @@
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 256
+#define NINTS (VECTOR_BITS / 32)
+#else
+#define NINTS 8
+#endif
+
+#define N (NINTS * 2)
+#define RESULT (NINTS * (NINTS - 1) / 2 * N + NINTS)
+
 extern void abort (void);
 
 typedef struct giga
 {
-  unsigned int g[16];
+  unsigned int g[N];
 } giga;
 
 unsigned long __attribute__((noinline,noclone))
@@ -19,17 +28,17 @@ addfst(giga const *gptr, int num)
 
 int main ()
 {
-  struct giga g[8];
+  struct giga g[NINTS];
   unsigned int n = 1;
   int i, j;
   check_vect ();
-  for (i = 0; i < 8; ++i)
-    for (j = 0; j < 16; ++j)
+  for (i = 0; i < NINTS; ++i)
+    for (j = 0; j < N; ++j)
       {
 	g[i].g[j] = n++;
 	__asm__ volatile ("");
       }
-  if (addfst (g, 8) != 456)
+  if (addfst (g, NINTS) != RESULT)
     abort ();
   return 0;
 }
Index: gcc/testsuite/gcc.dg/vect/pr65947-5.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr65947-5.c	2017-06-30 12:50:37.704687511 +0100
+++ gcc/testsuite/gcc.dg/vect/pr65947-5.c	2017-11-03 16:06:08.011089914 +0000
@@ -4,7 +4,11 @@
 
 extern void abort (void) __attribute__ ((noreturn));
 
+#if VECTOR_BITS > 256
+#define N (VECTOR_BITS / 8)
+#else
 #define N 32
+#endif
 
 /* Condition reduction where loop size is not known at compile time.  Will fail
    to vectorize.  Version inlined into main loop will vectorize.  */
@@ -30,6 +34,11 @@ main (void)
   21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
   31, 32
   };
+  for (int i = 32; i < N; ++i)
+    {
+      a[i] = 70 + (i & 3);
+      asm volatile ("" ::: "memory");
+    }
 
   check_vect ();
 
Index: gcc/testsuite/gcc.dg/vect/pr81136.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr81136.c	2017-08-04 11:42:45.937164489 +0100
+++ gcc/testsuite/gcc.dg/vect/pr81136.c	2017-11-03 16:06:08.011089914 +0000
@@ -1,6 +1,8 @@
 /* { dg-do compile } */
 
-struct __attribute__((aligned (32)))
+#include "tree-vect.h"
+
+struct __attribute__((aligned (VECTOR_BITS / 8)))
 {
   char misaligner;
   int foo[100];
Index: gcc/testsuite/gcc.dg/vect/slp-19c.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-19c.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-19c.c	2017-11-03 16:06:08.011089914 +0000
@@ -3,14 +3,27 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 2 / 32)
+#else
 #define N 16
+#endif
 
 int
 main1 ()
 {
   unsigned int i;
   unsigned int out[N*8];
+#if N == 16
   unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
+#else
+  unsigned int in[N * 8];
+  for (unsigned int i = 0; i < N * 8; ++i)
+    {
+      in[i] = i & 63;
+      asm volatile ("" ::: "memory");
+    }
+#endif
   unsigned int ia[N*2], a0, a1, a2, a3;
 
   /* The last stmt requires interleaving of not power of 2 size - not
Index: gcc/testsuite/gcc.dg/vect/slp-28.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-28.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-28.c	2017-11-03 16:06:08.011089914 +0000
@@ -3,19 +3,27 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 32 
-
-unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
-unsigned short in2[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
-unsigned short in3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
-unsigned short check[N] = {0,1,2,3,5,6,7,8,10,11,12,13,15,16,17,18,20,21,22,23,25,26,27,28,30,31,32,33,35,36,37,38};
-unsigned short check3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,5,6,7,8,9,10,11,12,13,14,15,16,10,11,12,13,14,15,16,17};
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS * 4 / 16)
+#else
+#define N 32
+#endif
+
+unsigned short in[N] = {};
+unsigned short in2[N] = {};
+unsigned short in3[N] = {};
 
 int
 main1 ()
 {
   int i;
 
+  for (i = 0; i < N; i++)
+    {
+      in[i] = in2[i] = in3[i] = i;
+      asm volatile ("" ::: "memory");
+    }
+
   for (i = 0; i < N/4; i++)
     {
       in[i*4] = in[i*4] + 5;
@@ -43,9 +51,9 @@ main1 ()
     }
 
   /* check results:  */
-  for (i = 4; i < N; i++)
+  for (i = 0; i < N; i++)
     {
-      if (in2[i] != check[i])
+      if (in2[i] != (i % 4) + (i / 4) * 5)
         abort ();
     }
   
@@ -61,9 +69,9 @@ main1 ()
     }
 
   /* check results:  */
-  for (i = 12; i < N; i++)
+  for (i = 0; i < N; i++)
     {
-      if (in3[i] != check3[i])
+      if (in3[i] != (i % 12) + (i / 12) * 5)
         abort ();
     }
 
Index: gcc/testsuite/gcc.dg/vect/slp-perm-8.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-8.c	2017-06-08 08:51:43.123296190 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-perm-8.c	2017-11-03 16:06:08.012090077 +0000
@@ -3,12 +3,17 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 512
+#define N (VECTOR_BITS * 6 / 16)
+#else
 #define N 200
+#endif
 
 void __attribute__((noinline))
 foo (unsigned char *__restrict__ pInput, unsigned char *__restrict__ pOutput)
 {
-  unsigned char i, a, b, c;
+  unsigned char a, b, c;
+  unsigned int i;
 
   for (i = 0; i < N / 3; i++)
     {
@@ -24,8 +29,9 @@ foo (unsigned char *__restrict__ pInput,
 
 int main (int argc, const char* argv[])
 {
-  unsigned char input[N], output[N], i;
+  unsigned char input[N], output[N];
   unsigned char check_results[N];
+  unsigned int i;
 
   check_vect ();
 
Index: gcc/testsuite/gcc.dg/vect/vect-103.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-103.c	2017-11-03 16:06:03.054282499 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-103.c	2017-11-03 16:06:08.012090077 +0000
@@ -4,7 +4,13 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 9
+#if VECTOR_BITS > 256
+#define NINTS (VECTOR_BITS / 32)
+#else
+#define NINTS 8
+#endif
+
+#define N (NINTS + 1)
 
 struct extraction
 {
@@ -14,7 +20,6 @@ struct extraction
 
 static int a[N] = {1,2,3,4,5,6,7,8,9};
 static int b[N] = {17,24,7,0,2,3,4,31,82};
-static int c[N] = {9,17,24,7,0,2,3,4,31};
 
 __attribute__ ((noinline))
 int main1 (int x, int y) {
@@ -31,16 +36,15 @@ int main1 (int x, int y) {
 
   /* Vectorizable: distance > VF.  */
   for (i = 0; i < N; i++)
-    {
-       *((int *)p + x + i) = *((int *)p + x + i + 8);
-    }
+    *((int *)p + x + i) = *((int *)p + x + i + NINTS);
 
   /* check results: */
-  for (i = 0; i < N; i++)
-    {
-       if (p->a[i] != c[i])
-         abort();
-    }
+  if (p->a[0] != a[N - 1])
+    abort ();
+  for (i = 1; i < N; i++)
+    if (p->a[i] != b[i - 1])
+      abort ();
+
   return 0;
 }
 
Index: gcc/testsuite/gcc.dg/vect/vect-67.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-67.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-67.c	2017-11-03 16:06:08.013090240 +0000
@@ -3,13 +3,19 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 16
+#if VECTOR_BITS > 256
+#define NINTS (VECTOR_BITS / 32)
+#else
+#define NINTS 8
+#endif
+
+#define N (NINTS * 2)
 
 __attribute__ ((noinline))
 int main1 (int a, int b)
 {
   int i, j;
-  int ia[N][4][N+8];
+  int ia[N][4][N + NINTS];
 
   /* Multidimensional array. Aligned. The "inner" dimensions
      are invariant in the inner loop. Store. 
@@ -18,7 +24,7 @@ int main1 (int a, int b)
     {
       for (j = 0; j < N; j++)
         {
-           ia[i][1][j+8] = (a == b);
+           ia[i][1][j + NINTS] = (a == b);
         }
     }
 
@@ -27,7 +33,7 @@ int main1 (int a, int b)
     {
       for (j = 0; j < N; j++)
         {
-           if (ia[i][1][j+8] != (a == b))
+           if (ia[i][1][j + NINTS] != (a == b))
               abort();
         }
     }
Index: gcc/testsuite/gcc.dg/vect/vect-70.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-70.c	2017-08-03 10:40:54.012104085 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-70.c	2017-11-03 16:06:08.013090240 +0000
@@ -4,11 +4,24 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 24
+#if VECTOR_BITS > 128
+#define NINTS (VECTOR_BITS / 32)
+#else
+#define NINTS 4
+#endif
+
+#define N (NINTS * 6)
+
+/* Keep execution time down.  */
+#if N <= 24
+#define OUTERN N
+#else
+#define OUTERN NINTS
+#endif
 
 struct s{
   int m;
-  int n[N/6][N/6][N];
+  int n[4][4][N];
 };
 
 struct test1{
@@ -18,36 +31,43 @@ struct test1{
   struct s e[N]; /* array e.n is aligned */
 };
 
+/* Avoid big local temporaries.  */
+#if NINTS > 8
+struct test1 tmp1;
+#endif
+
 __attribute__ ((noinline))
 int main1 ()
 {
   int i,j;
+#if NINTS <= 8
   struct test1 tmp1;
+#endif
 
-  for (i = 0; i < N; i++)
-    for (j = 3; j < N-3; j++)
+  for (i = 0; i < OUTERN; i++)
+    for (j = NINTS - 1; j < N - NINTS + 1; j++)
       {
         tmp1.e[i].n[1][2][j] = 8;
       }
 
   /* check results:  */
-  for (i = 0; i < N; i++)
-    for (j = 3; j < N-3; j++)
+  for (i = 0; i < OUTERN; i++)
+    for (j = NINTS - 1; j < N - NINTS + 1; j++)
     {
       if (tmp1.e[i].n[1][2][j] != 8)
           abort ();
     }
   
   /* not consecutive, will use strided stores */
-  for (i = 0; i < N; i++)
-    for (j = 3; j < N-3; j++)
+  for (i = 0; i < OUTERN; i++)
+    for (j = NINTS - 1; j < N - NINTS + 1; j++)
       { 
         tmp1.e[j].n[1][2][j] = 8;
       }
   
   /* check results:  */
-  for (i = 0; i < N; i++)
-    for (j = 3; j < N-3; j++)
+  for (i = 0; i < OUTERN; i++)
+    for (j = NINTS - 1; j < N - NINTS + 1; j++)
     {
       if (tmp1.e[j].n[1][2][j] != 8)
           abort ();
Index: gcc/testsuite/gcc.dg/vect/vect-91.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-91.c	2017-08-03 10:40:54.013104709 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-91.c	2017-11-03 16:06:08.013090240 +0000
@@ -7,7 +7,14 @@
 
 #define N 256
 
-extern int a[N+20];
+/* Pick a value greater than the vector length.  */
+#if VECTOR_BITS > 128
+#define OFF (VECTOR_BITS * 5 / 32)
+#else
+#define OFF 20
+#endif
+
+extern int a[N + OFF];
 
 /* The alignment of 'pa' is unknown. 
    Yet we do know that both the read access and write access have 
@@ -52,7 +59,7 @@ main3 ()
 
   for (i = 0; i < N; i++)
     {
-      a[i] = a[i+20];
+      a[i] = a[i + OFF];
     }
 
   return 0;
Index: gcc/testsuite/gcc.dg/vect/vect-92.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-92.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-92.c	2017-11-03 16:06:08.013090240 +0000
@@ -17,12 +17,18 @@ float pc[N] __attribute__ ((__aligned__(
    can use this information (generate prolog and epilog loops
    with known number of iterations, and only if needed).  */
 
+#if VECTOR_BITS > 128
+#define NITER (VECTOR_BITS * 3 / 32)
+#else
+#define NITER 12
+#endif
+
 __attribute__ ((noinline)) int
 main1 ()
 {
   int i;
 
-  for (i = 0; i < 10; i++)
+  for (i = 0; i < NITER - 2; i++)
     {
       pa[i+1] = pb[i+1] * pc[i+1];
     }
@@ -42,7 +48,7 @@ main2 ()
 {
   int i;
 
-  for (i = 0; i < 12; i++)
+  for (i = 0; i < NITER; i++)
     {
       pa[i+1] = pb[i+1] * pc[i+1];
     }
Index: gcc/testsuite/gcc.dg/vect/vect-93.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-93.c	2017-08-03 10:40:54.013104709 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-93.c	2017-11-03 16:06:08.013090240 +0000
@@ -4,33 +4,38 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 3001
+#define N1 3001
 
+#if VECTOR_BITS > 256
+#define N2 (VECTOR_BITS / 32 + 2)
+#else
+#define N2 10
+#endif
 
 __attribute__ ((noinline)) int
 main1 (float *pa)
 {
   int i;
 
-  for (i = 0; i < 3001; i++)
+  for (i = 0; i < N1; i++)
     {
       pa[i] = 2.0;
     }
 
   /* check results:  */
-  for (i = 0; i < 3001; i++)
+  for (i = 0; i < N1; i++)
     {
       if (pa[i] != 2.0)
 	abort ();
     }
 
-  for (i = 1; i <= 10; i++)
+  for (i = 1; i <= N2; i++)
     {
       pa[i] = 3.0;
     }
 
   /* check results:  */
-  for (i = 1; i <= 10; i++)
+  for (i = 1; i <= N2; i++)
     {
       if (pa[i] != 3.0)
 	abort ();
@@ -42,13 +47,14 @@ main1 (float *pa)
 int main (void)
 {
   int i;
-  float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
-  float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+  float a[N1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+  float b[N1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
 
   check_vect ();
 
   /* from bzip2: */
-  for (i=0; i<N; i++) b[i] = i;
+  for (i = 0; i < N1; i++)
+    b[i] = i;
   a[0] = 0;
   for (i = 1; i <= 256; i++) a[i] = b[i-1];
 
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c	2017-10-26 10:02:00.659481648 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,7 +4,14 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 32
+#if VECTOR_BITS > 128
+#define NSHORTS (VECTOR_BITS / 16)
+#else
+#define NSHORTS 8
+#endif
+
+#define NINTS (NSHORTS / 2)
+#define N (NSHORTS * 4)
 
 short sa[N];
 short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
@@ -27,14 +34,14 @@ __attribute__ ((noinline)) int main1 (in
      copmutations. Vectorizable.  */
   for (i = 0; i < n; i++)
     {
-      sa[i+7] = sb[i];
-      ia[i+3] = ib[i+1];
+      sa[i + NSHORTS - 1] = sb[i];
+      ia[i + NINTS - 1] = ib[i + 1];
     }
 
   /* check results:  */
   for (i = 0; i < n; i++)
     {
-      if (sa[i+7] != sb[i] || ia[i+3] != ib[i+1])
+      if (sa[i + NSHORTS - 1] != sb[i] || ia[i + NINTS - 1] != ib[i + 1])
 	abort ();
     }
 
@@ -57,14 +64,14 @@ __attribute__ ((noinline)) int main2 (in
      copmutations.  */
   for (i = 0; i < n; i++)
     {
-      ia[i+3] = ib[i];
-      sa[i+3] = sb[i+1];
+      ia[i + NINTS - 1] = ib[i];
+      sa[i + NINTS - 1] = sb[i + 1];
     }
 
   /* check results:  */
   for (i = 0; i < n; i++)
     {
-      if (sa[i+3] != sb[i+1] || ia[i+3] != ib[i])
+      if (sa[i + NINTS - 1] != sb[i + 1] || ia[i + NINTS - 1] != ib[i])
         abort ();
     }
 
@@ -75,8 +82,8 @@ int main (void)
 { 
   check_vect ();
   
-  main1 (N-7);
-  main2 (N-3);
+  main1 (N - NSHORTS + 1);
+  main2 (N - NINTS + 1);
 
   return 0;
 }
Index: gcc/testsuite/gcc.dg/vect/vect-over-widen-3-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-over-widen-3-big-array.c	2016-01-30 10:07:34.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-over-widen-3-big-array.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,7 +4,7 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
-#define N 128
+#define N VECTOR_BITS
 
 /* Modified rgb to rgb conversion from FFmpeg.  */
 __attribute__ ((noinline)) void
@@ -32,7 +32,9 @@ foo (unsigned char *src, unsigned char *
       const int g = *s++;
       const int r = *s++;
       const int a = *s++;
-      if (*d != ((b>>3) | ((g&0xFFC)<<3) | ((r+0xF8)>>8) | (a<<9)))
+      unsigned short expected
+	= ((b>>3) | ((g&0xFFC)<<3) | ((r+0xF8)>>8) | (a<<9));
+      if (*d != expected)
         abort ();
       d++;
     }
Index: gcc/testsuite/gcc.dg/vect/vect-peel-3.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-peel-3.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-peel-3.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,12 +4,24 @@
 #include <stdarg.h>
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define NINTS (VECTOR_BITS / 32)
+#define EXTRA (NINTS * 2)
+#else
+#define NINTS 4
+#define EXTRA 10
+#endif
+
 #define N 128
-#define RES 21640 
 
-int ib[N+10];
-int ia[N+10];
-int ic[N+10];
+#define RES_A (N * N / 4)
+#define RES_B (N * (N + 1) / 2 + (NINTS + 3) * (N + 1))
+#define RES_C (N * (N + 1) / 2 + (N + 1))
+#define RES (RES_A + RES_B + RES_C)
+
+int ib[N + EXTRA];
+int ia[N + EXTRA];
+int ic[N + EXTRA];
 
 __attribute__ ((noinline))
 int main1 ()
@@ -20,8 +32,8 @@ int main1 ()
   for (i = 0; i <= N; i++)
     {
       suma += ia[i];
-      sumb += ib[i+5];
-      sumc += ic[i+1];
+      sumb += ib[i + NINTS + 1];
+      sumc += ic[i + 1];
     }
 
   /* check results:  */
@@ -37,7 +49,7 @@ int main (void)
 
   check_vect ();
 
-  for (i = 0; i < N+10; i++)
+  for (i = 0; i < N + EXTRA; i++)
     {
       asm volatile ("" : "+r" (i));
       ib[i] = i;
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-or_1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-or_1.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-or_1.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,28 +4,41 @@
 
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS / 8)
+#else
+#define N 16
+#endif
+
 extern void abort(void);
 
-unsigned char in[16] __attribute__((__aligned__(16)));
+unsigned char in[N] __attribute__((__aligned__(16)));
 
 int
 main (unsigned char argc, char **argv)
 {
   unsigned char i = 0;
   unsigned char sum = 1;
+  unsigned char expected = 1;
 
   check_vect ();
 
-  for (i = 0; i < 16; i++)
+  for (i = 0; i < N; i++)
     in[i] = (i + i + 1) & 0xfd;
 
+  for (i = 0; i < N; i++)
+    {
+      expected |= in[i];
+      asm volatile ("");
+    }
+
   /* Prevent constant propagation of the entire loop below.  */
   asm volatile ("" : : : "memory");
 
-  for (i = 0; i < 16; i++)
+  for (i = 0; i < N; i++)
     sum |= in[i];
 
-  if (sum != 29)
+  if (sum != expected)
     {
       __builtin_printf("Failed %d\n", sum);
       abort();
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-or_2.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-or_2.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-or_2.c	2017-11-03 16:06:08.014090402 +0000
@@ -4,24 +4,37 @@
 
 #include "tree-vect.h"
 
+#if VECTOR_BITS > 128
+#define N (VECTOR_BITS / 8)
+#else
+#define N 16
+#endif
+
 extern void abort(void);
 
 int
 main (unsigned char argc, char **argv)
 {
-  unsigned char in[16] __attribute__((aligned(16)));
+  unsigned char in[N] __attribute__((aligned(16)));
   unsigned char i = 0;
   unsigned char sum = 1;
+  unsigned char expected = 1;
 
   check_vect ();
 
-  for (i = 0; i < 16; i++)
+  for (i = 0; i < N; i++)
     in[i] = (i + i + 1) & 0xfd;
 
-  for (i = 0; i < 16; i++)
+  for (i = 0; i < N; i++)
+    {
+      expected |= in[i];
+      asm volatile ("");
+    }
+
+  for (i = 0; i < N; i++)
     sum |= in[i];
 
-  if (sum != 29)
+  if (sum != expected)
     {
       __builtin_printf("Failed %d\n", sum);
       abort();

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [4/10] Don't assume vect_multiple_sizes means 2 sizes
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
                   ` (2 preceding siblings ...)
  2017-11-03 16:18 ` [3/10] Add available_vector_sizes to target-supports.exp Richard Sandiford
@ 2017-11-03 16:18 ` Richard Sandiford
  2017-11-08 19:21   ` Jeff Law
  2017-11-03 16:19 ` [5/10] Add vect_perm3_* target selectors Richard Sandiford
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:18 UTC (permalink / raw)
  To: gcc-patches

Some tests assumed that there would only be 2 vector sizes if
vect_multiple_sizes, whereas for SVE there are three (SVE, 128-bit
and 64-bit).  This patch replaces scan-tree-dump-times with
scan-tree-dump for vect_multiple_sizes but keeps it for
!vect_multiple_sizes.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/testsuite/
	* gcc.dg/vect/no-vfa-vect-101.c: Use scan-tree-dump rather than
	scan-tree-dump-times for vect_multiple_sizes.
	* gcc.dg/vect/no-vfa-vect-102.c: Likewise.
	* gcc.dg/vect/no-vfa-vect-102a.c: Likewise.
	* gcc.dg/vect/no-vfa-vect-37.c: Likewise.
	* gcc.dg/vect/no-vfa-vect-79.c: Likewise.
	* gcc.dg/vect/vect-104.c: Likewise.

Index: gcc/testsuite/gcc.dg/vect/no-vfa-vect-101.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-vfa-vect-101.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-vfa-vect-101.c	2017-11-03 16:06:16.141037152 +0000
@@ -46,5 +46,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "can't determine dependence" 1 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "can't determine dependence" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump "can't determine dependence" "vect" { target vect_multiple_sizes } } } */
 
Index: gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c	2017-11-03 16:06:03.052282173 +0000
+++ gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c	2017-11-03 16:06:16.141037152 +0000
@@ -51,5 +51,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump "possible dependence between data-refs" "vect" { target vect_multiple_sizes } } } */
 
Index: gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c	2017-11-03 16:06:03.052282173 +0000
+++ gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c	2017-11-03 16:06:16.141037152 +0000
@@ -51,5 +51,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump "possible dependence between data-refs" "vect" { target vect_multiple_sizes } } } */
 
Index: gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c	2017-11-03 16:06:16.141037152 +0000
@@ -59,4 +59,4 @@ int main (void)
    prevent vectorization on some targets.  */
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail *-*-* } } } */
 /* { dg-final { scan-tree-dump-times "can't determine dependence" 2 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "can't determine dependence" 4 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump "can't determine dependence" "vect" { target vect_multiple_sizes } } } */
Index: gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c	2017-11-03 16:06:16.141037152 +0000
@@ -47,4 +47,4 @@ int main (void)
   prevent vectorization on some targets.  */
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { xfail *-*-* } } } */
 /* { dg-final { scan-tree-dump-times "can't determine dependence" 1 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "can't determine dependence" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump "can't determine dependence" "vect" { target vect_multiple_sizes } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-104.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-104.c	2017-11-03 16:06:03.054282499 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-104.c	2017-11-03 16:06:16.142036841 +0000
@@ -63,5 +63,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump "possible dependence between data-refs" "vect" { target vect_multiple_sizes } } } */
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [3/10] Add available_vector_sizes to target-supports.exp
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
  2017-11-03 16:16 ` [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests Richard Sandiford
  2017-11-03 16:17 ` [2/10] Add VECTOR_BITS to tree-vect.h Richard Sandiford
@ 2017-11-03 16:18 ` Richard Sandiford
  2017-11-08 19:13   ` Jeff Law
  2017-11-03 16:18 ` [4/10] Don't assume vect_multiple_sizes means 2 sizes Richard Sandiford
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:18 UTC (permalink / raw)
  To: gcc-patches

This patch adds a routine that lists the available vector sizes
for a target and uses it for some existing target conditions.
Later patches add more uses.

The cases are taken from multiple_sizes.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/testsuite/
	* lib/target-supports.exp (available_vector_sizes): New proc.
	(check_effective_target_vect_multiple_sizes): Use it.
	(check_effective_target_vect64): Likewise.
	(check_effective_target_vect_sizes_32B_16B): Likewise.

Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 12:16:58.605777011 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:12.625838683 +0000
@@ -6581,46 +6581,38 @@ foreach N {2 3 4 8} {
     }]
 }
 
-# Return 1 if the target supports multiple vector sizes
+# Return the list of vector sizes (in bits) that each target supports.
+# A vector length of "0" indicates variable-length vectors.
 
-proc check_effective_target_vect_multiple_sizes { } {
-    global et_vect_multiple_sizes_saved
-    global et_index
-
-    set et_vect_multiple_sizes_saved($et_index) 0
-    if { [istarget aarch64*-*-*]
-	 || [is-effective-target arm_neon]
-	 || (([istarget i?86-*-*] || [istarget x86_64-*-*])
-	     && ([check_avx_available] && ![check_prefer_avx128])) } {
-	set et_vect_multiple_sizes_saved($et_index) 1
+proc available_vector_sizes { } {
+    set result {}
+    if { [istarget aarch64*-*-*] } {
+	lappend result 128 64
+    } elseif { [istarget arm*-*-*]
+		&& [check_effective_target_arm_neon_ok] } {
+	lappend result 128 64
+    } elseif { (([istarget i?86-*-*] || [istarget x86_64-*-*])
+		 && ([check_avx_available] && ![check_prefer_avx128])) } {
+	lappend result 256 128
+    } elseif { [istarget sparc*-*-*] } {
+	lappend result 64
+    } else {
+	# The traditional default asumption.
+	lappend result 128
     }
+    return $result
+}
+
+# Return 1 if the target supports multiple vector sizes
 
-    verbose "check_effective_target_vect_multiple_sizes:\
-	     returning $et_vect_multiple_sizes_saved($et_index)" 2
-    return $et_vect_multiple_sizes_saved($et_index)
+proc check_effective_target_vect_multiple_sizes { } {
+    return [expr { [llength [available_vector_sizes]] > 1 }]
 }
 
 # Return 1 if the target supports vectors of 64 bits.
 
 proc check_effective_target_vect64 { } {
-    global et_vect64_saved
-    global et_index
-
-    if [info exists et_vect64_saved($et_index)] {
-        verbose "check_effective_target_vect64: using cached result" 2
-    } else {
-	set et_vect64_saved($et_index) 0
-        if { ([is-effective-target arm_neon]
-	      && [check_effective_target_arm_little_endian])
-	     || [istarget aarch64*-*-*]
-             || [istarget sparc*-*-*] } {
-	   set et_vect64_saved($et_index) 1
-        }
-    }
-
-    verbose "check_effective_target_vect64:\
-	     returning $et_vect64_saved($et_index)" 2
-    return $et_vect64_saved($et_index)
+    return [expr { [lsearch -exact [available_vector_sizes] 64] >= 0 }]
 }
 
 # Return 1 if the target supports vector copysignf calls.
@@ -7747,11 +7739,7 @@ proc check_avx_available { } {
 # Return true if 32- and 16-bytes vectors are available.
 
 proc check_effective_target_vect_sizes_32B_16B { } {
-  if { [check_avx_available] && ![check_prefer_avx128] } {
-     return 1;
-  } else {
-    return 0;
-  }
+    return [expr { [available_vector_sizes] == [list 256 128] }]
 }
 
 # Return true if 16- and 8-bytes vectors are available.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [5/10] Add vect_perm3_* target selectors
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
                   ` (3 preceding siblings ...)
  2017-11-03 16:18 ` [4/10] Don't assume vect_multiple_sizes means 2 sizes Richard Sandiford
@ 2017-11-03 16:19 ` Richard Sandiford
  2017-11-08 19:49   ` Jeff Law
  2017-11-03 16:20 ` [6/10] Add a vect_element_align_preferred target selector Richard Sandiford
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:19 UTC (permalink / raw)
  To: gcc-patches

SLP load permutation fails if any individual permutation requires more
than two vector inputs.  For 128-bit vectors, it's possible to permute
3 contiguous loads of 32-bit and 8-bit elements, but not 16-bit elements
or 64-bit elements.  The results are reversed for 256-bit vectors,
and so on for wider vectors.

This patch adds a routine that tests whether a permute will require
three vectors for a given vector count and element size, then adds
vect_perm3_* target selectors for the cases that we currently use.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* doc/sourcebuild.texi (vect_perm_short, vect_perm_byte): Document
	previously undocumented selectors.
	(vect_perm3_byte, vect_perm3_short, vect_perm3_int): Document.

gcc/testsuite/
	* lib/target-supports.exp (vect_perm_supported): New proc.
	(check_effective_target_vect_perm3_int): Likewise.
	(check_effective_target_vect_perm3_short): Likewise.
	(check_effective_target_vect_perm3_byte): Likewise.
	* gcc.dg/vect/slp-perm-1.c: Expect SLP load permutation to
	succeed if vect_perm3_int.
	* gcc.dg/vect/slp-perm-5.c: Likewise.
	* gcc.dg/vect/slp-perm-6.c: Likewise.
	* gcc.dg/vect/slp-perm-7.c: Likewise.
	* gcc.dg/vect/slp-perm-8.c: Likewise vect_perm3_byte.
	* gcc.dg/vect/slp-perm-9.c: Likewise vect_perm3_short.
	Use vect_perm_short instead of vect_perm.  Add a scan-tree-dump-not
	test for vect_perm3_short targets.

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2017-10-26 12:27:58.124235242 +0100
+++ gcc/doc/sourcebuild.texi	2017-11-03 16:06:19.377029536 +0000
@@ -1448,6 +1448,32 @@ element types.
 @item vect_perm
 Target supports vector permutation.
 
+@item vect_perm_byte
+Target supports permutation of vectors with 8-bit elements.
+
+@item vect_perm_short
+Target supports permutation of vectors with 16-bit elements.
+
+@item vect_perm3_byte
+Target supports permutation of vectors with 8-bit elements, and for the
+default vector length it is possible to permute:
+@example
+@{ a0, a1, a2, b0, b1, b2, @dots{} @}
+@end example
+to:
+@example
+@{ a0, a0, a0, b0, b0, b0, @dots{} @}
+@{ a1, a1, a1, b1, b1, b1, @dots{} @}
+@{ a2, a2, a2, b2, b2, b2, @dots{} @}
+@end example
+using only two-vector permutes, regardless of how long the sequence is.
+
+@item vect_perm3_int
+Like @code{vect_perm3_byte}, but for 32-bit elements.
+
+@item vect_perm3_short
+Like @code{vect_perm3_byte}, but for 16-bit elements.
+
 @item vect_shift
 Target supports a hardware vector shift operation.
 
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:12.625838683 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:19.378029224 +0000
@@ -5547,6 +5547,78 @@ proc check_effective_target_vect_perm {
     return $et_vect_perm_saved($et_index)
 }
 
+# Return 1 if, for some VF:
+#
+# - the target's default vector size is VF * ELEMENT_BITS bits
+#
+# - it is possible to implement the equivalent of:
+#
+#      int<ELEMENT_BITS>_t s1[COUNT][COUNT * VF], s2[COUNT * VF];
+#      for (int i = 0; i < COUNT; ++i)
+#        for (int j = 0; j < COUNT * VF; ++j)
+#          s1[i][j] = s2[j - j % COUNT + i]
+#
+#   using only a single 2-vector permute for each vector in s1.
+#
+# E.g. for COUNT == 3 and vector length 4, the two arrays would be:
+#
+#    s2    | a0 a1 a2 a3 | b0 b1 b2 b3 | c0 c1 c2 c3
+#    ------+-------------+-------------+------------
+#    s1[0] | a0 a0 a0 a3 | a3 a3 b2 b2 | b2 c1 c1 c1
+#    s1[1] | a1 a1 a1 b0 | b0 b0 b3 b3 | b3 c2 c2 c2
+#    s1[2] | a2 a2 a2 b1 | b1 b1 c0 c0 | c0 c3 c3 c3
+#
+# Each s1 permute requires only two of a, b and c.
+#
+# The distance between the start of vector n in s1[0] and the start
+# of vector n in s2 is:
+#
+#    A = (n * VF) % COUNT
+#
+# The corresponding value for the end of vector n is:
+#
+#    B = (n * VF + VF - 1) % COUNT
+#
+# Subtracting i from each value gives the corresponding difference
+# for s1[i].  The condition being tested by this function is false
+# iff A - i > 0 and B - i < 0 for some i and n, such that the first
+# element for s1[i] comes from vector n - 1 of s2 and the last element
+# comes from vector n + 1 of s2.  The condition is therefore true iff
+# A <= B for all n.  This is turn means the condition is true iff:
+#
+#    (n * VF) % COUNT + (VF - 1) % COUNT < COUNT
+#
+# for all n.  COUNT - (n * VF) % COUNT is bounded by gcd (VF, COUNT),
+# and will be that value for at least one n in [0, COUNT), so we want:
+#
+#    (VF - 1) % COUNT < gcd (VF, COUNT)
+
+proc vect_perm_supported { count element_bits } {
+    set vector_bits [lindex [available_vector_sizes] 0]
+    if { $vector_bits <= 0 } {
+	return 0
+    }
+    set vf [expr { $vector_bits / $element_bits }]
+
+    # Compute gcd (VF, COUNT).
+    set gcd $vf
+    set temp1 $count
+    while { $temp1 > 0 } {
+	set temp2 [expr { $gcd % $temp1 }]
+	set gcd $temp1
+	set temp1 $temp2
+    }
+    return [expr { ($vf - 1) % $count < $gcd }]
+}
+
+# Return 1 if the target supports SLP permutation of 3 vectors when each
+# element has 32 bits.
+
+proc check_effective_target_vect_perm3_int { } {
+    return [expr { [check_effective_target_vect_perm]
+		   && [vect_perm_supported 3 32] }]
+}
+
 # Return 1 if the target plus current options supports vector permutation
 # on byte-sized elements, 0 otherwise.
 #
@@ -5578,6 +5650,14 @@ proc check_effective_target_vect_perm_by
     return $et_vect_perm_byte_saved($et_index)
 }
 
+# Return 1 if the target supports SLP permutation of 3 vectors when each
+# element has 8 bits.
+
+proc check_effective_target_vect_perm3_byte { } {
+    return [expr { [check_effective_target_vect_perm_byte]
+		   && [vect_perm_supported 3 8] }]
+}
+
 # Return 1 if the target plus current options supports vector permutation
 # on short-sized elements, 0 otherwise.
 #
@@ -5609,6 +5689,14 @@ proc check_effective_target_vect_perm_sh
     return $et_vect_perm_short_saved($et_index)
 }
 
+# Return 1 if the target supports SLP permutation of 3 vectors when each
+# element has 16 bits.
+
+proc check_effective_target_vect_perm3_short { } {
+    return [expr { [check_effective_target_vect_perm_short]
+		   && [vect_perm_supported 3 16] }]
+}
+
 # Return 1 if the target plus current options supports folding of
 # copysign into XORSIGN.
 #
Index: gcc/testsuite/gcc.dg/vect/slp-perm-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-1.c	2017-11-03 16:06:08.011089914 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-1.c	2017-11-03 16:06:19.377029536 +0000
@@ -80,9 +80,9 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_int && {! vect_load_lanes } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
 
Index: gcc/testsuite/gcc.dg/vect/slp-perm-5.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-5.c	2017-11-03 16:06:08.012090077 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-5.c	2017-11-03 16:06:19.377029536 +0000
@@ -104,9 +104,9 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && {! vect_load_lanes } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
 
Index: gcc/testsuite/gcc.dg/vect/slp-perm-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-6.c	2017-11-03 16:06:08.012090077 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-6.c	2017-11-03 16:06:19.377029536 +0000
@@ -103,8 +103,8 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && {! vect_load_lanes } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
Index: gcc/testsuite/gcc.dg/vect/slp-perm-7.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-7.c	2017-11-03 16:06:08.012090077 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-7.c	2017-11-03 16:06:19.377029536 +0000
@@ -96,8 +96,8 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_perm } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_int && { ! vect_load_lanes } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
Index: gcc/testsuite/gcc.dg/vect/slp-perm-8.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-8.c	2017-11-03 16:06:08.012090077 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-8.c	2017-11-03 16:06:19.377029536 +0000
@@ -60,8 +60,8 @@ int main (int argc, const char* argv[])
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_byte } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm_byte && {! vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_byte && { ! vect_load_lanes } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm_byte && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_byte && vect_load_lanes } } } } */
 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
Index: gcc/testsuite/gcc.dg/vect/slp-perm-9.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-perm-9.c	2017-11-03 16:06:08.012090077 +0000
+++ gcc/testsuite/gcc.dg/vect/slp-perm-9.c	2017-11-03 16:06:19.378029224 +0000
@@ -57,9 +57,10 @@ int main (int argc, const char* argv[])
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect"  { target { {! vect_perm } || {! vect_sizes_16B_8B } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target { { vect_perm } && { vect_sizes_16B_8B } } } } } */
-/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target vect_perm_short } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { {! vect_perm } || {! vect_sizes_32B_16B } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { { vect_perm } && { vect_sizes_32B_16B } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { target { ! { vect_perm_short || vect_load_lanes } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_short || vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { ! vect_perm3_short } } } } } */
+/* { dg-final { scan-tree-dump-not "permutation requires at least three vectors" "vect" { target vect_perm3_short } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { { ! vect_perm3_short } || vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_short && { ! vect_load_lanes } } } } } */
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [6/10] Add a vect_element_align_preferred target selector
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
                   ` (4 preceding siblings ...)
  2017-11-03 16:19 ` [5/10] Add vect_perm3_* target selectors Richard Sandiford
@ 2017-11-03 16:20 ` Richard Sandiford
  2017-11-08 22:31   ` Jeff Law
  2017-11-03 16:21 ` [7/10] Add a vect_unaligned_possible " Richard Sandiford
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:20 UTC (permalink / raw)
  To: gcc-patches

This patch adds a target selector for targets whose
preferred_vector_alignment is the alignment of one element.  We'll never
peel in that case, and the step of a loop that operates on normal (as
opposed to packed) elements will always divide the preferred alignment.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* doc/sourcebuild.texi (vect_element_align_preferred): Document.

gcc/testsuite/
	* lib/target-supports.exp
	(check_effective_target_vect_element_align_preferred): New proc.
	(check_effective_target_vect_peeling_profitable): Test it.
	* gcc.dg/vect/no-section-anchors-vect-31.c: Don't expect peeling
	if vect_element_align_preferred.
	* gcc.dg/vect/no-section-anchors-vect-64.c: Likewise.
	* gcc.dg/vect/pr65310.c: Likewise.
	* gcc.dg/vect/vect-26.c: Likewise.
	* gcc.dg/vect/vect-54.c: Likewise.
	* gcc.dg/vect/vect-56.c: Likewise.
	* gcc.dg/vect/vect-58.c: Likewise.
	* gcc.dg/vect/vect-60.c: Likewise.
	* gcc.dg/vect/vect-89-big-array.c: Likewise.
	* gcc.dg/vect/vect-89.c: Likewise.
	* gcc.dg/vect/vect-92.c: Likewise.
	* gcc.dg/vect/vect-peel-1.c: Likewise.
	* gcc.dg/vect/vect-outer-3a-big-array.c: Expect the step to
	divide the alignment if vect_element_align_preferred.
	* gcc.dg/vect/vect-outer-3a.c: Likewise.

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2017-11-03 16:06:19.377029536 +0000
+++ gcc/doc/sourcebuild.texi	2017-11-03 16:06:22.561036988 +0000
@@ -1383,6 +1383,10 @@ have different type from the value opera
 @item vect_double
 Target supports hardware vectors of @code{double}.
 
+@item vect_element_align_preferred
+The target's preferred vector alignment is the same as the element
+alignment.
+
 @item vect_float
 Target supports hardware vectors of @code{float}.
 
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:19.378029224 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:22.564036053 +0000
@@ -3290,7 +3290,8 @@ proc check_effective_target_vect_peeling
     } else {
 	set et_vect_peeling_profitable_saved($et_index) 1
         if { ([istarget s390*-*-*]
-	      && [check_effective_target_s390_vx]) } {
+	      && [check_effective_target_s390_vx])
+	     || [check_effective_target_vect_element_align_preferred] } {
 	    set et_vect_peeling_profitable_saved($et_index) 0
         }
     }
@@ -6342,6 +6343,13 @@ proc check_effective_target_vect_natural
     return $et_vect_natural_alignment
 }
 
+# Return 1 if the target doesn't prefer any alignment beyond element
+# alignment during vectorization.
+
+proc check_effective_target_vect_element_align_preferred { } {
+    return [check_effective_target_vect_variable_length]
+}
+
 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
 
 proc check_effective_target_vector_alignment_reachable { } {
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c	2017-11-03 16:06:08.010089752 +0000
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c	2017-11-03 16:06:22.561036988 +0000
@@ -94,4 +94,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c	2017-11-03 16:06:08.010089752 +0000
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c	2017-11-03 16:06:22.562036677 +0000
@@ -91,4 +91,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/pr65310.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr65310.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/pr65310.c	2017-11-03 16:06:22.562036677 +0000
@@ -18,5 +18,5 @@ int t(b *a)
 /* The memory access is through a pointer of type c which means
    *ptr is not aligned.  */
 
-/* { dg-final { scan-tree-dump "can't force alignment" "vect" } } */
-/* { dg-final { scan-tree-dump-not "misalign = 0" "vect" } } */
+/* { dg-final { scan-tree-dump "can't force alignment" "vect" { xfail vect_element_align_preferred } } } */
+/* { dg-final { scan-tree-dump-not "misalign = 0" "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-26.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-26.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-26.c	2017-11-03 16:06:22.562036677 +0000
@@ -37,4 +37,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-54.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-54.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-54.c	2017-11-03 16:06:22.562036677 +0000
@@ -61,4 +61,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-56.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-56.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-56.c	2017-11-03 16:06:22.562036677 +0000
@@ -70,5 +70,5 @@ int main (void)
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { { ! vect_element_align } || vect_element_align_preferred} } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align && { ! vect_element_align_preferred } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-58.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-58.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-58.c	2017-11-03 16:06:22.562036677 +0000
@@ -59,4 +59,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-60.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-60.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-60.c	2017-11-03 16:06:22.562036677 +0000
@@ -71,5 +71,5 @@ int main (void)
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { { ! vect_element_align } || vect_element_align_preferred } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align && { ! vect_element_align_preferred } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-89-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-89-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-89-big-array.c	2017-11-03 16:06:22.562036677 +0000
@@ -46,4 +46,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-89.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-89.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-89.c	2017-11-03 16:06:22.562036677 +0000
@@ -50,4 +50,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-92.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-92.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-92.c	2017-11-03 16:06:22.563036365 +0000
@@ -98,4 +98,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-peel-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-peel-1.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-peel-1.c	2017-11-03 16:06:22.563036365 +0000
@@ -49,4 +49,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c	2017-09-22 17:44:23.043135080 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c	2017-11-03 16:06:22.563036365 +0000
@@ -49,4 +49,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-outer-3a.c	2017-09-22 17:44:23.043135080 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-outer-3a.c	2017-11-03 16:06:22.563036365 +0000
@@ -49,4 +49,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" { xfail vect_element_align_preferred } } } */

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [7/10] Add a vect_unaligned_possible target selector
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
                   ` (5 preceding siblings ...)
  2017-11-03 16:20 ` [6/10] Add a vect_element_align_preferred target selector Richard Sandiford
@ 2017-11-03 16:21 ` Richard Sandiford
  2017-11-08 22:32   ` Jeff Law
  2017-11-03 16:21 ` [8/10] Add a vect_variable_length " Richard Sandiford
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:21 UTC (permalink / raw)
  To: gcc-patches

This patch adds a target selector that says whether we can ever
generate an "unaligned" accesses, where "unaligned" is relative
to the target's preferred vector alignment.  This is already true if:

   vect_no_align && { ! vect_hw_misalign }

i.e. if the target doesn't have any alignment mechanism and also
doesn't allow unaligned accesses.  It is also true (for the things
tested by gcc.dg/vect) if the target only wants things to be aligned
to an element; in that case every normal scalar access is "vector aligned".


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* doc/sourcebuild.texi (vect_unaligned_possible): Document.

gcc/testsuite/
	* lib/target-supports.exp
	(check_effective_target_vect_unaligned_possible): New proc.
	* gcc.dg/vect/slp-25.c: Extend XFAIL of peeling for alignment from
	vect_no_align && { ! vect_hw_misalign } to ! vect_unaligned_possible.
	* gcc.dg/vect/vect-multitypes-1.c: Likewise.
	* gcc.dg/vect/vect-109.c: XFAIL vectorisation of an unaligned
	access to ! vect_unaligned_possible.
	* gcc.dg/vect/vect-33.c: Likewise.
	* gcc.dg/vect/vect-42.c: Likewise.
	* gcc.dg/vect/vect-56.c: Likewise.
	* gcc.dg/vect/vect-60.c: Likewise.
	* gcc.dg/vect/vect-96.c: Likewise.
	* gcc.dg/vect/vect-peel-1.c: Likewise.
	* gcc.dg/vect/vect-27.c: Extend XFAIL of unaligned vectorization from
	vect_no_align && { ! vect_hw_misalign } to ! vect_unaligned_possible.
	* gcc.dg/vect/vect-29.c: Likewise.
	* gcc.dg/vect/vect-44.c: Likewise.
	* gcc.dg/vect/vect-48.c: Likewise.
	* gcc.dg/vect/vect-50.c: Likewise.
	* gcc.dg/vect/vect-52.c: Likewise.
	* gcc.dg/vect/vect-72.c: Likewise.
	* gcc.dg/vect/vect-75-big-array.c: Likewise.
	* gcc.dg/vect/vect-75.c: Likewise.
	* gcc.dg/vect/vect-77-alignchecks.c: Likewise.
	* gcc.dg/vect/vect-77-global.c: Likewise.
	* gcc.dg/vect/vect-78-alignchecks.c: Likewise.
	* gcc.dg/vect/vect-78-global.c: Likewise.
	* gcc.dg/vect/vect-multitypes-3.c: Likewise.
	* gcc.dg/vect/vect-multitypes-4.c: Likewise.
	* gcc.dg/vect/vect-multitypes-6.c: Likewise.
	* gcc.dg/vect/vect-peel-4.c: Likewise.
	* gcc.dg/vect/vect-peel-3.c: Likewise, and also for peeling
	for alignment.

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2017-11-03 16:06:22.561036988 +0000
+++ gcc/doc/sourcebuild.texi	2017-11-03 16:06:26.237889385 +0000
@@ -1481,6 +1481,11 @@ Like @code{vect_perm3_byte}, but for 16-
 @item vect_shift
 Target supports a hardware vector shift operation.
 
+@item vect_unaligned_possible
+Target prefers vectors to have an alignment greater than element
+alignment, but also allows unaligned vector accesses in some
+circumstances.
+
 @item vect_widen_sum_hi_to_si
 Target supports a vector widening summation of @code{short} operands
 into @code{int} results, or can promote (unpack) from @code{short}
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:22.564036053 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:26.241888136 +0000
@@ -6399,6 +6399,15 @@ proc check_effective_target_vect_element
     return $et_vect_element_align($et_index)
 }
 
+# Return 1 if we expect to see unaligned accesses in at least some
+# vector dumps.
+
+proc check_effective_target_vect_unaligned_possible { } {
+    return [expr { ![check_effective_target_vect_element_align_preferred]
+		   && (![check_effective_target_vect_no_align]
+		       || [check_effective_target_vect_hw_misalign]) }]
+}
+
 # Return 1 if the target supports vector LOAD_LANES operations, 0 otherwise.
 
 proc check_effective_target_vect_load_lanes { } {
Index: gcc/testsuite/gcc.dg/vect/slp-25.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-25.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-25.c	2017-11-03 16:06:26.237889385 +0000
@@ -57,4 +57,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect"  } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { { vect_no_align && { ! vect_hw_misalign } } || { ! vect_natural_alignment } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { { ! vect_unaligned_possible } || { ! vect_natural_alignment } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c	2017-11-03 16:06:08.014090402 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c	2017-11-03 16:06:26.239888760 +0000
@@ -89,6 +89,6 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail {{ vect_no_align && { ! vect_hw_misalign } } || {vect_sizes_32B_16B }}} } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { { ! vect_unaligned_possible } || vect_sizes_32B_16B } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { target { vect_no_align && { { ! vect_hw_misalign } && vect_sizes_32B_16B } } }} } */
 
Index: gcc/testsuite/gcc.dg/vect/vect-109.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-109.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-109.c	2017-11-03 16:06:26.237889385 +0000
@@ -76,5 +76,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_element_align } } } */
 /* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" { xfail vect_element_align } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align xfail { ! vect_unaligned_possible } } } } */
 
Index: gcc/testsuite/gcc.dg/vect/vect-33.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-33.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-33.c	2017-11-03 16:06:26.237889385 +0000
@@ -37,6 +37,6 @@ int main (void)
 } 
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  } } */
-/* { dg-final { scan-tree-dump "Vectorizing an unaligned access" "vect" { target { { { ! powerpc*-*-* } && vect_hw_misalign } && { { ! vect64 } || vect_multiple_sizes } } } } }  */
+/* { dg-final { scan-tree-dump "Vectorizing an unaligned access" "vect" { target { { { ! powerpc*-*-* } && vect_hw_misalign } && { { ! vect64 } || vect_multiple_sizes } } xfail { ! vect_unaligned_possible } } } }  */
 /* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" { target { vector_alignment_reachable && { vect64 && {! vect_multiple_sizes} } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { { {! vector_alignment_reachable} || {! vect64} } && {! vect_hw_misalign} } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-42.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-42.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-42.c	2017-11-03 16:06:26.237889385 +0000
@@ -67,5 +67,5 @@ int main (void)
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { { ! vector_alignment_reachable } && { ! vect_element_align } } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { vect_no_align || { { !  vector_alignment_reachable } || vect_element_align  } } } } }  */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { vect_no_align || { { ! vector_alignment_reachable } || vect_element_align } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-56.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-56.c	2017-11-03 16:06:22.562036677 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-56.c	2017-11-03 16:06:26.238889073 +0000
@@ -68,7 +68,7 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target { ! vect_element_align } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { { ! vect_element_align } || vect_element_align_preferred} } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align && { ! vect_element_align_preferred } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-60.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-60.c	2017-11-03 16:06:22.562036677 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-60.c	2017-11-03 16:06:26.238889073 +0000
@@ -69,7 +69,7 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target { ! vect_element_align } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { { ! vect_element_align } || vect_element_align_preferred } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align && { ! vect_element_align_preferred } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-96.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-96.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-96.c	2017-11-03 16:06:26.239888760 +0000
@@ -48,6 +48,6 @@ int main (void)
    For targets that don't support unaligned loads, version for the store.  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_no_align} && vector_alignment_reachable } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_no_align} && vector_alignment_reachable } xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_element_align } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { vect_no_align && { ! vect_hw_misalign } } || { {! vector_alignment_reachable} && {! vect_element_align} } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-peel-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-peel-1.c	2017-11-03 16:06:22.563036365 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-peel-1.c	2017-11-03 16:06:26.240888448 +0000
@@ -48,5 +48,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-27.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-27.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-27.c	2017-11-03 16:06:26.237889385 +0000
@@ -46,5 +46,5 @@ int main (void)
 /* The initialization induction loop (with aligned access) is also vectorized.  */
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
Index: gcc/testsuite/gcc.dg/vect/vect-29.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-29.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-29.c	2017-11-03 16:06:26.237889385 +0000
@@ -51,6 +51,6 @@ int main (void)
 
 /* The initialization induction loop (with aligned access) is also vectorized.  */
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" {target { vect_no_align && { ! vect_hw_misalign } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-44.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-44.c	2017-05-18 07:51:07.308258294 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-44.c	2017-11-03 16:06:26.238889073 +0000
@@ -65,7 +65,7 @@ int main (void)
    two loads to be aligned).  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { { vect_no_align && { ! vect_hw_misalign } } || {! vector_alignment_reachable} } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { {! vector_alignment_reachable} && {{! vect_no_align} && {! vect_hw_misalign} } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-48.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-48.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-48.c	2017-11-03 16:06:26.238889073 +0000
@@ -55,6 +55,6 @@ int main (void)
    (The store is aligned).  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-50.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-50.c	2017-05-18 07:51:07.308258294 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-50.c	2017-11-03 16:06:26.238889073 +0000
@@ -61,8 +61,7 @@ int main (void)
    align the store will not force the two loads to be aligned).  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { { vect_no_align && { ! vect_hw_misalign } } || {! vector_alignment_reachable} } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { {! vector_alignment_reachable} && { {! vect_no_align } && {! vect_hw_misalign } } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-52.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-52.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-52.c	2017-11-03 16:06:26.238889073 +0000
@@ -56,6 +56,6 @@ int main (void)
    (The store is aligned).  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-72.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-72.c	2015-12-18 10:17:16.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-72.c	2017-11-03 16:06:26.238889073 +0000
@@ -48,5 +48,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
Index: gcc/testsuite/gcc.dg/vect/vect-75-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-75-big-array.c	2017-11-03 16:06:03.055282663 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-75-big-array.c	2017-11-03 16:06:26.238889073 +0000
@@ -50,4 +50,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /*  { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-75.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-75.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-75.c	2017-11-03 16:06:26.239888760 +0000
@@ -50,4 +50,4 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c	2017-11-03 16:06:26.239888760 +0000
@@ -54,7 +54,7 @@ int main (void)
    both for the load and the store.  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vect_no_align} && { unaligned_stack && vector_alignment_reachable } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { {! unaligned_stack} && { vect_no_align && { ! vect_hw_misalign } } } || {unaligned_stack && { {! vector_alignment_reachable} && {! vect_no_align } } } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { { unaligned_stack && { vector_alignment_reachable && vect_no_align } } || {unaligned_stack && { {! vector_alignment_reachable} && vect_no_align } } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-77-global.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-77-global.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-77-global.c	2017-11-03 16:06:26.239888760 +0000
@@ -48,6 +48,6 @@ int main (void)
 /* Requires versioning for aliasing.  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c	2017-11-03 16:06:26.239888760 +0000
@@ -55,7 +55,7 @@ int main (void)
    both for the load and the store.  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */ 
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vect_no_align} && { unaligned_stack && vector_alignment_reachable } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { {! unaligned_stack} && { vect_no_align && { ! vect_hw_misalign } } } || {unaligned_stack && { {! vector_alignment_reachable} && { ! vect_no_align } } } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { { unaligned_stack && { vector_alignment_reachable && vect_no_align } } || {unaligned_stack && { {! vector_alignment_reachable} && vect_no_align } } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-78-global.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-78-global.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-78-global.c	2017-11-03 16:06:26.239888760 +0000
@@ -48,6 +48,6 @@ int main (void)
    (The store is aligned).  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c	2017-11-03 16:06:08.014090402 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c	2017-11-03 16:06:26.239888760 +0000
@@ -59,5 +59,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" {xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { ! vect_unaligned_possible } } } } */
 
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-4.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-4.c	2017-11-03 16:06:26.239888760 +0000
@@ -95,6 +95,6 @@ int main (void)
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { vect_element_align}  } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 8 "vect" { xfail { vect_no_align || vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { target { vect_element_align  } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 8 "vect" { target { ! vect_element_align } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { target { vect_element_align } xfail { ! vect_unaligned_possible } } } } */
 
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c	2017-11-03 16:06:08.014090402 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c	2017-11-03 16:06:26.240888448 +0000
@@ -66,5 +66,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { sparc*-*-* && ilp32 } }} } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 6 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 6 "vect" {xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 6 "vect" { xfail { ! vect_unaligned_possible } } } } */
 
Index: gcc/testsuite/gcc.dg/vect/vect-peel-4.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-peel-4.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-peel-4.c	2017-11-03 16:06:26.240888448 +0000
@@ -46,5 +46,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect"  { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect"  { xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
Index: gcc/testsuite/gcc.dg/vect/vect-peel-3.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-peel-3.c	2017-11-03 16:06:08.014090402 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-peel-3.c	2017-11-03 16:06:26.240888448 +0000
@@ -61,5 +61,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect"  { xfail { { vect_no_align && { ! vect_hw_misalign } } || {vect_sizes_32B_16B } } } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align && { ! vect_hw_misalign } } || {vect_sizes_32B_16B } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect"  { xfail { { ! vect_unaligned_possible } || vect_sizes_32B_16B } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { ! vect_unaligned_possible } || vect_sizes_32B_16B } } } } */

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [8/10] Add a vect_variable_length target selector
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
                   ` (6 preceding siblings ...)
  2017-11-03 16:21 ` [7/10] Add a vect_unaligned_possible " Richard Sandiford
@ 2017-11-03 16:21 ` Richard Sandiford
  2017-11-08 22:33   ` Jeff Law
  2017-11-03 16:22 ` [9/10] Add a vect_align_stack_vars " Richard Sandiford
  2017-11-03 16:23 ` [10/10] Add a vect_masked_store " Richard Sandiford
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:21 UTC (permalink / raw)
  To: gcc-patches

This patch adds a target selector for variable-length vectors.
Initially it's always false, but the SVE patch provides a case
in which it's true.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* doc/sourcebuild.texi (vect_variable_length): Document.

gcc/testsuite/
	* lib/target-supports.exp
	(check_effective_target_vect_variable_length): New proc.
	* gcc.dg/vect/pr60482.c: XFAIL test for no epilog loop if
	vect_variable_length.
	* gcc.dg/vect/slp-reduc-6.c: XFAIL two-operation SLP if
	vect_variable_length.
	* gcc.dg/vect/vect-alias-check-5.c: XFAIL alias optimization if
	vect_variable_length.
	* gfortran.dg/vect/fast-math-mgrid-resid.f: XFAIL predictive
	commoning optimization if vect_variable_length.

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2017-11-03 16:06:26.237889385 +0000
+++ gcc/doc/sourcebuild.texi	2017-11-03 16:06:52.929591350 +0000
@@ -1486,6 +1486,9 @@ Target prefers vectors to have an alignm
 alignment, but also allows unaligned vector accesses in some
 circumstances.
 
+@item vect_variable_length
+Target has variable-length vectors.
+
 @item vect_widen_sum_hi_to_si
 Target supports a vector widening summation of @code{short} operands
 into @code{int} results, or can promote (unpack) from @code{short}
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:26.241888136 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:52.930591737 +0000
@@ -6714,6 +6714,12 @@ proc check_effective_target_vect_multipl
     return [expr { [llength [available_vector_sizes]] > 1 }]
 }
 
+# Return true if variable-length vectors are supported.
+
+proc check_effective_target_vect_variable_length { } {
+    return [expr { [lindex [available_vector_sizes] 0] == 0 }]
+}
+
 # Return 1 if the target supports vectors of 64 bits.
 
 proc check_effective_target_vect64 { } {
Index: gcc/testsuite/gcc.dg/vect/pr60482.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr60482.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/pr60482.c	2017-11-03 16:06:52.929591350 +0000
@@ -16,4 +16,6 @@ foo (double *x, int n)
   return p;
 }
 
-/* { dg-final { scan-tree-dump-not "epilog loop required" "vect" } } */
+/* Until fully-masked loops are supported, we always need an epilog
+   loop for variable-length vectors.  */
+/* { dg-final { scan-tree-dump-not "epilog loop required" "vect" { xfail vect_variable_length } } } */
Index: gcc/testsuite/gcc.dg/vect/slp-reduc-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-reduc-6.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/slp-reduc-6.c	2017-11-03 16:06:52.929591350 +0000
@@ -44,5 +44,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail { vect_no_int_add || { ! { vect_unpack || vect_strided2 } } } } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "different interleaving chains in one node" 1 "vect" { target { ! vect_no_int_add } } } } */
+/* { dg-final { scan-tree-dump-times "different interleaving chains in one node" 1 "vect" { target { ! vect_no_int_add } xfail vect_variable_length } } } */
 
Index: gcc/testsuite/gcc.dg/vect/vect-alias-check-5.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-alias-check-5.c	2017-08-04 11:39:37.910284386 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-alias-check-5.c	2017-11-03 16:06:52.929591350 +0000
@@ -15,5 +15,5 @@ f1 (struct s *a, struct s *b)
 }
 
 /* { dg-final { scan-tree-dump-times "consider run-time aliasing" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "improved number of alias checks from 1 to 0" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "improved number of alias checks from 1 to 0" 1 "vect" { xfail vect_variable_length } } } */
 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" } } */
Index: gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f
===================================================================
--- gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f	2017-10-04 16:25:39.620051123 +0100
+++ gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f	2017-11-03 16:06:52.929591350 +0000
@@ -42,5 +42,5 @@ C
 ! vectorized loop.  If vector factor is 2, the vectorized loop can
 ! be predictive commoned, we check if predictive commoning PHI node
 ! is created with vector(2) type.
-! { dg-final { scan-tree-dump "Executing predictive commoning without unrolling" "pcom" } }
-! { dg-final { scan-tree-dump "vectp_u.*__lsm.* = PHI <.*vectp_u.*__lsm" "pcom" } }
+! { dg-final { scan-tree-dump "Executing predictive commoning without unrolling" "pcom" { xfail vect_variable_length } } }
+! { dg-final { scan-tree-dump "vectp_u.*__lsm.* = PHI <.*vectp_u.*__lsm" "pcom" { xfail vect_variable_length } } }

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [9/10] Add a vect_align_stack_vars target selector
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
                   ` (7 preceding siblings ...)
  2017-11-03 16:21 ` [8/10] Add a vect_variable_length " Richard Sandiford
@ 2017-11-03 16:22 ` Richard Sandiford
  2017-11-08 22:40   ` Jeff Law
  2017-11-03 16:23 ` [10/10] Add a vect_masked_store " Richard Sandiford
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:22 UTC (permalink / raw)
  To: gcc-patches

This patch adds a target selector to say whether it's possible to
align a local variable to the target's preferred vector alignment.
This can be false for large vectors if the alignment is only
a preference and not a hard requirement (and thus if there is no
need to support a stack realignment mechanism).


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* doc/sourcebuild.texi (vect_align_stack_vars): Document.

gcc/testsuite/
	* lib/target-supports.exp
	(check_effective_target_vect_align_stack_vars): New proc.
	* gcc.dg/vect/vect-23.c: Only expect the array to be aligned if
	vect_align_stack_vars.
	* gcc.dg/vect/vect-24.c: Likewise.
	* gcc.dg/vect/vect-25.c: Likewise.
	* gcc.dg/vect/vect-26.c: Likewise.
	* gcc.dg/vect/vect-32-big-array.c: Likewise.
	* gcc.dg/vect/vect-32.c: Likewise.
	* gcc.dg/vect/vect-40.c: Likewise.
	* gcc.dg/vect/vect-42.c: Likewise.
	* gcc.dg/vect/vect-46.c: Likewise.
	* gcc.dg/vect/vect-48.c: Likewise.
	* gcc.dg/vect/vect-52.c: Likewise.
	* gcc.dg/vect/vect-54.c: Likewise.
	* gcc.dg/vect/vect-62.c: Likewise.
	* gcc.dg/vect/vect-67.c: Likewise.
	* gcc.dg/vect/vect-75-big-array.c: Likewise.
	* gcc.dg/vect/vect-75.c: Likewise.
	* gcc.dg/vect/vect-77-alignchecks.c: Likewise.
	* gcc.dg/vect/vect-78-alignchecks.c: Likewise.
	* gcc.dg/vect/vect-89-big-array.c: Likewise.
	* gcc.dg/vect/vect-89.c: Likewise.
	* gcc.dg/vect/vect-96.c: Likewise.
	* gcc.dg/vect/vect-multitypes-3.c: Likewise.
	* gcc.dg/vect/vect-multitypes-6.c: Likewise.

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2017-11-03 16:06:52.929591350 +0000
+++ gcc/doc/sourcebuild.texi	2017-11-03 16:06:56.516976666 +0000
@@ -1373,6 +1373,10 @@ Target supports Fortran @code{real} kind
 @subsubsection Vector-specific attributes
 
 @table @code
+@item vect_align_stack_vars
+The target's ABI allows stack variables to be aligned to the preferred
+vector alignment.
+
 @item vect_condition
 Target supports vector conditional operations.
 
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:52.930591737 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:56.519977825 +0000
@@ -6350,6 +6350,12 @@ proc check_effective_target_vect_element
     return [check_effective_target_vect_variable_length]
 }
 
+# Return 1 if we can align stack data to the preferred vector alignment.
+
+proc check_effective_target_vect_align_stack_vars { } {
+    return 1
+}
+
 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
 
 proc check_effective_target_vector_alignment_reachable { } {
Index: gcc/testsuite/gcc.dg/vect/vect-23.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-23.c	2016-11-22 21:16:10.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-23.c	2017-11-03 16:06:56.516976666 +0000
@@ -125,4 +125,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-24.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-24.c	2017-02-23 19:54:09.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-24.c	2017-11-03 16:06:56.516976666 +0000
@@ -123,4 +123,4 @@ int main (void)
   return main1 ();
 }
 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail { { ! aarch64*-*-* } && { ! arm-*-* } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-25.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-25.c	2015-06-02 23:53:35.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-25.c	2017-11-03 16:06:56.516976666 +0000
@@ -51,4 +51,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-26.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-26.c	2017-11-03 16:06:22.562036677 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-26.c	2017-11-03 16:06:56.516976666 +0000
@@ -36,5 +36,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { vect_element_align_preferred || { ! vect_align_stack_vars } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-32-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-32-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-32-big-array.c	2017-11-03 16:06:56.516976666 +0000
@@ -36,4 +36,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-32.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-32.c	2017-11-03 16:06:08.012090077 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-32.c	2017-11-03 16:06:56.516976666 +0000
@@ -40,4 +40,4 @@ int main (void)
 } 
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-40.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-40.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-40.c	2017-11-03 16:06:56.516976666 +0000
@@ -59,4 +59,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-42.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-42.c	2017-11-03 16:06:26.237889385 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-42.c	2017-11-03 16:06:56.516976666 +0000
@@ -67,5 +67,5 @@ int main (void)
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { { ! vector_alignment_reachable } && { ! vect_element_align } } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { vect_no_align || { { !  vector_alignment_reachable } || vect_element_align  } } } } }  */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align xfail { ! { vect_unaligned_possible && vect_align_stack_vars } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { vect_no_align || { { ! vector_alignment_reachable } || vect_element_align } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-46.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-46.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-46.c	2017-11-03 16:06:56.517977052 +0000
@@ -61,4 +61,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-48.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-48.c	2017-11-03 16:06:26.238889073 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-48.c	2017-11-03 16:06:56.517977052 +0000
@@ -55,6 +55,7 @@ int main (void)
    (The store is aligned).  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target { ! vect_align_stack_vars } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target vect_align_stack_vars xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-52.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-52.c	2017-11-03 16:06:26.238889073 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-52.c	2017-11-03 16:06:56.517977052 +0000
@@ -56,6 +56,7 @@ int main (void)
    (The store is aligned).  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target { ! vect_align_stack_vars } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target vect_align_stack_vars xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-54.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-54.c	2017-11-03 16:06:22.562036677 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-54.c	2017-11-03 16:06:56.517977052 +0000
@@ -60,5 +60,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-62.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-62.c	2015-11-11 15:40:09.000000000 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-62.c	2017-11-03 16:06:56.517977052 +0000
@@ -65,4 +65,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-67.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-67.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-67.c	2017-11-03 16:06:56.517977052 +0000
@@ -49,4 +49,4 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-75-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-75-big-array.c	2017-11-03 16:06:26.238889073 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-75-big-array.c	2017-11-03 16:06:56.517977052 +0000
@@ -50,4 +50,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /*  { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target { ! vect_align_stack_vars } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_align_stack_vars xfail { ! vect_unaligned_possible } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-75.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-75.c	2017-11-03 16:06:26.239888760 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-75.c	2017-11-03 16:06:56.517977052 +0000
@@ -50,4 +50,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target { ! vect_align_stack_vars } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_align_stack_vars xfail { ! vect_unaligned_possible } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c	2017-11-03 16:06:26.239888760 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c	2017-11-03 16:06:56.518977438 +0000
@@ -54,7 +54,8 @@ int main (void)
    both for the load and the store.  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target { ! vect_align_stack_vars } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_align_stack_vars xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vect_no_align} && { unaligned_stack && vector_alignment_reachable } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { {! unaligned_stack} && { vect_no_align && { ! vect_hw_misalign } } } || {unaligned_stack && { {! vector_alignment_reachable} && {! vect_no_align } } } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { { unaligned_stack && { vector_alignment_reachable && vect_no_align } } || {unaligned_stack && { {! vector_alignment_reachable} && vect_no_align } } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c	2017-11-03 16:06:26.239888760 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c	2017-11-03 16:06:56.518977438 +0000
@@ -55,7 +55,8 @@ int main (void)
    both for the load and the store.  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_align_stack_vars xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target { ! vect_align_stack_vars } xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vect_no_align} && { unaligned_stack && vector_alignment_reachable } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { {! unaligned_stack} && { vect_no_align && { ! vect_hw_misalign } } } || {unaligned_stack && { {! vector_alignment_reachable} && { ! vect_no_align } } } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 2 "vect" { target { { unaligned_stack && { vector_alignment_reachable && vect_no_align } } || {unaligned_stack && { {! vector_alignment_reachable} && vect_no_align } } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-89-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-89-big-array.c	2017-11-03 16:06:22.562036677 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-89-big-array.c	2017-11-03 16:06:56.518977438 +0000
@@ -45,5 +45,5 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { vect_element_align_preferred || { ! vect_align_stack_vars } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-89.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-89.c	2017-11-03 16:06:22.562036677 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-89.c	2017-11-03 16:06:56.518977438 +0000
@@ -49,5 +49,5 @@ int main (void)
 } 
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { vect_element_align_preferred || { ! vect_align_stack_vars } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-96.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-96.c	2017-11-03 16:06:26.239888760 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-96.c	2017-11-03 16:06:56.518977438 +0000
@@ -48,6 +48,7 @@ int main (void)
    For targets that don't support unaligned loads, version for the store.  */
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_no_align} && vector_alignment_reachable } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { target { { {! vect_no_align} && vector_alignment_reachable } && { ! vect_align_stack_vars } } xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { {! vect_no_align} && vector_alignment_reachable } && vect_align_stack_vars } xfail { ! vect_unaligned_possible } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_element_align } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { { vect_no_align && { ! vect_hw_misalign } } || { {! vector_alignment_reachable} && {! vect_element_align} } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c	2017-11-03 16:06:26.239888760 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c	2017-11-03 16:06:56.518977438 +0000
@@ -59,5 +59,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { xfail { ! { vect_unaligned_possible && vect_align_stack_vars } } } } } */
 
Index: gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c	2017-11-03 16:06:26.240888448 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c	2017-11-03 16:06:56.518977438 +0000
@@ -66,5 +66,5 @@ int main (void)
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { sparc*-*-* && ilp32 } }} } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 6 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 6 "vect" { xfail { ! vect_unaligned_possible } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 6 "vect" { xfail { ! { vect_unaligned_possible && vect_align_stack_vars } } } } } */
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [10/10] Add a vect_masked_store target selector
  2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
                   ` (8 preceding siblings ...)
  2017-11-03 16:22 ` [9/10] Add a vect_align_stack_vars " Richard Sandiford
@ 2017-11-03 16:23 ` Richard Sandiford
  2017-11-08 22:44   ` Jeff Law
  9 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2017-11-03 16:23 UTC (permalink / raw)
  To: gcc-patches

This patch adds a target selector that says whether the target
supports IFN_MASK_STORE.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* doc/sourcebuild.texi (vect_masked_store): Document.

gcc/testsuite/
	* lib/target-supports.exp (check_effective_target_vect_masked_store):
	New proc.
	* gcc.dg/vect/vect-cselim-1.c (foo): Mention that the second loop
	is vectorizable with masked stores.  Update scan-tree-dump-times
	accordingly.

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2017-11-03 16:06:56.516976666 +0000
+++ gcc/doc/sourcebuild.texi	2017-11-03 16:07:00.028331940 +0000
@@ -1403,6 +1403,9 @@ Target supports hardware vectors of @cod
 @item vect_long_long
 Target supports hardware vectors of @code{long long}.
 
+@item vect_masked_store
+Target supports vector masked stores.
+
 @item vect_aligned_arrays
 Target aligns arrays to vector alignment boundary.
 
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:56.519977825 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:07:00.029332326 +0000
@@ -6433,6 +6433,12 @@ proc check_effective_target_vect_load_la
     return $et_vect_load_lanes
 }
 
+# Return 1 if the target supports vector masked stores.
+
+proc check_effective_target_vect_masked_store { } {
+    return 0
+}
+
 # Return 1 if the target supports vector conditional operations, 0 otherwise.
 
 proc check_effective_target_vect_condition { } {
Index: gcc/testsuite/gcc.dg/vect/vect-cselim-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-cselim-1.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-cselim-1.c	2017-11-03 16:07:00.028331940 +0000
@@ -38,7 +38,7 @@ foo ()
         }
     }
 
-  /* Not vectorizable.  */
+  /* Only vectorizable with masked stores.  */
   for (i = 0; i < N; i++)
     {
       c = in1[i].b;
@@ -82,4 +82,5 @@ main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { xfail { { vect_no_align && { ! vect_hw_misalign } } || { ! vect_strided2 } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! vect_masked_store } xfail { { vect_no_align && { ! vect_hw_misalign } } || { ! vect_strided2 } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_masked_store } } } } */

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests
  2017-11-03 16:16 ` [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests Richard Sandiford
@ 2017-11-08 19:10   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 19:10 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:15 AM, Richard Sandiford wrote:
> The vectoriser tests used a combination of:
> 
> 1) if (impossible condition) abort ();
> 2) volatile int x; ... *x = ...;
> 3) asm volatile ("" ::: "memory");
> 
> to prevent vectorisation of a set-up loop.  The problem with 1) is that
> the compiler can often tell that the condition is false and optimise
> it away before vectorisation.
> 
> This was already happening in slp-perm-9.c, which is why the test was
> expecting one loop to be vectorised even when the required permutes
> weren't supported.  It becomes a bigger problem with SVE, which is
> able to vectorise more set-up loops.
> 
> The point of this patch is therefore to replace 1) with something else.
> 2) should work most of the time, but we don't usually treat non-volatile
> accesses as aliasing unrelated volatile accesses, so I think in principle
> we could split the loop into one that does the set-up and one that does
> the volatile accesses.  3) seems more robust because it's also a wild
> read and write.
> 
> The patch therefore tries to replace all instances of 1) and 2) with 3).
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/testsuite/
> 	* gcc.dg/vect/bb-slp-cond-1.c (main): Add an asm volatile
> 	to the set-up loop.
> 	* gcc.dg/vect/slp-perm-7.c (main): Prevent vectorisation with
> 	asm volatile ("" ::: "memory") instead of a conditional abort.
> 	Update the expected vector loop count accordingly.
> 	* gcc.dg/vect/slp-perm-9.c (main): Likewise.
> 	* gcc.dg/vect/bb-slp-1.c (main1): Prevent vectorisation with
> 	asm volatile ("" ::: "memory") instead of a conditional abort.
> 	* gcc.dg/vect/slp-23.c (main): Likewise,
> 	* gcc.dg/vect/slp-35.c (main): Likewise,
> 	* gcc.dg/vect/slp-37.c (main): Likewise,
> 	* gcc.dg/vect/slp-perm-4.c (main): Likewise.
> 	* gcc.dg/vect/bb-slp-24.c (foo): Likewise.  Remove dummy argument.
> 	(main): Update call accordingly.
> 	* gcc.dg/vect/bb-slp-25.c (foo, main): As for bb-slp-24.c.
> 	* gcc.dg/vect/bb-slp-26.c (foo, main): Likewise.
> 	* gcc.dg/vect/bb-slp-29.c (foo, main): Likewise.
> 	* gcc.dg/vect/no-vfa-vect-102.c (foo): Delete.
> 	(main): Don't initialize it.
> 	(main1): Prevent vectorisation with asm volatile ("" ::: "memory")
> 	instead of a conditional abort.
> 	* gcc.dg/vect/no-vfa-vect-102a.c (foo, main1, main): As for
> 	no-vfa-vect-102.c
> 	* gcc.dg/vect/vect-103.c (foo, main1, main): Likewise.
> 	* gcc.dg/vect/vect-104.c (foo, main1, main): Likewise.
> 	* gcc.dg/vect/pr42709.c (main1): Remove dummy argument.
> 	Prevent vectorisation with asm volatile ("" ::: "memory")
> 	instead of a conditional abort.
> 	* gcc.dg/vect/slp-13-big-array.c (y): Delete.
> 	(main1): Prevent vectorisation with asm volatile ("" ::: "memory")
> 	instead of a conditional abort.
> 	* gcc.dg/vect/slp-3-big-array.c (y, main1): As for slp-13-big-array.c.
> 	* gcc.dg/vect/slp-34-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/slp-4-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/slp-multitypes-11-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-105.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-105-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-112-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-15-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-2-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-34-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-6-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-73-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-74-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-75-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-76-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-80-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-97-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-all-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-reduc-1char-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-reduc-2char-big-array.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-strided-a-mult.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-strided-a-u16-i2.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-strided-a-u16-i4.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-strided-a-u16-mult.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-strided-a-u8-i2-gap.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c (y, main1):
> 	Likewise.
> 	* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c (y, main1): Likewise.
> 	* gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c (y, main1):
> 	Likewise.
> 	* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c (y, main1): Likewise.
> 	* gcc.dg/vect/slp-24.c (y): Delete.
> 	(main): Prevent vectorisation with asm volatile ("" ::: "memory")
> 	instead of a conditional abort.
> 	* gcc.dg/vect/slp-24-big-array.c (y, main): As for slp-24.c.
> 	* gcc.dg/vect/vect-98-big-array.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-bswap16.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-bswap32.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-bswap64.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-mult-char-ls.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-mult.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-same-dr.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u16-i2.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u16-i4.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u32-i4.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u32-i8.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i2-gap.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i2.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8-gap2.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8-gap4.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8-gap7.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-strided-u8-i8.c (y, main): Likewise.
> 	* gcc.dg/vect/vect-10-big-array.c (y): Delete.
> 	(foo): Prevent vectorisation with asm volatile ("" ::: "memory")
> 	instead of a conditional abort.
> 	* gcc.dg/vect/vect-double-reduc-6-big-array.c (y, foo): As for
> 	vect-10-big-array.c.
> 	* gcc.dg/vect/vect-reduc-pattern-1b-big-array.c (y, foo): Likewise.
> 	* gcc.dg/vect/vect-reduc-pattern-1c-big-array.c (y, foo): Likewise.
> 	* gcc.dg/vect/vect-reduc-pattern-2b-big-array.c (y, foo): Likewise.
> 	* gcc.dg/vect/vect-117.c (foo): Delete.
> 	(main): Don't initalize it.
OK.
jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [3/10] Add available_vector_sizes to target-supports.exp
  2017-11-03 16:18 ` [3/10] Add available_vector_sizes to target-supports.exp Richard Sandiford
@ 2017-11-08 19:13   ` Jeff Law
  2017-11-17 13:23     ` Christophe Lyon
  0 siblings, 1 reply; 22+ messages in thread
From: Jeff Law @ 2017-11-08 19:13 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:18 AM, Richard Sandiford wrote:
> This patch adds a routine that lists the available vector sizes
> for a target and uses it for some existing target conditions.
> Later patches add more uses.
> 
> The cases are taken from multiple_sizes.
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/testsuite/
> 	* lib/target-supports.exp (available_vector_sizes): New proc.
> 	(check_effective_target_vect_multiple_sizes): Use it.
> 	(check_effective_target_vect64): Likewise.
> 	(check_effective_target_vect_sizes_32B_16B): Likewise.
OK.
jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [2/10] Add VECTOR_BITS to tree-vect.h
  2017-11-03 16:17 ` [2/10] Add VECTOR_BITS to tree-vect.h Richard Sandiford
@ 2017-11-08 19:13   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 19:13 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:17 AM, Richard Sandiford wrote:
> Several vector tests are sensitive to the vector size.  This patch adds
> a VECTOR_BITS macro to tree-vect.h to select the expected vector size
> and uses it to influence iteration counts and array sizes.  The tests
> keep the original values if the vector size is small enough.
> 
> For now VECTOR_BITS is always 128, but the SVE patches add other values.
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/testsuite/
> 	* gcc.dg/vect/tree-vect.h (VECTOR_BITS): Define.
> 	* gcc.dg/vect/bb-slp-pr69907.c: Include tree-vect.h.
> 	(N): New macro.
> 	(foo): Use it instead of hard-coded 320.
> 	* gcc.dg/vect/no-scevccp-outer-7.c (N): Redefine if the default
> 	value is too small for VECTOR_BITS.
> 	* gcc.dg/vect/no-scevccp-vect-iv-3.c (N): Likewise.
> 	* gcc.dg/vect/no-section-anchors-vect-31.c (N): Likewise.
> 	* gcc.dg/vect/no-section-anchors-vect-36.c (N): Likewise.
> 	* gcc.dg/vect/slp-perm-9.c (N): Likewise.
> 	* gcc.dg/vect/vect-32.c (N): Likewise.
> 	* gcc.dg/vect/vect-75.c (N, OFF): Likewise.
> 	* gcc.dg/vect/vect-77-alignchecks.c (N, OFF): Likewise.
> 	* gcc.dg/vect/vect-78-alignchecks.c (N, OFF): Likewise.
> 	* gcc.dg/vect/vect-89.c (N): Likewise.
> 	* gcc.dg/vect/vect-96.c (N): Likewise.
> 	* gcc.dg/vect/vect-multitypes-3.c (N): Likewise.
> 	* gcc.dg/vect/vect-multitypes-6.c (N): Likewise.
> 	* gcc.dg/vect/vect-over-widen-1.c (N): Likewise.
> 	* gcc.dg/vect/vect-over-widen-4.c (N): Likewise.
> 	* gcc.dg/vect/vect-reduc-pattern-1a.c (N): Likewise.
> 	* gcc.dg/vect/vect-reduc-pattern-1b.c (N): Likewise.
> 	* gcc.dg/vect/vect-reduc-pattern-2a.c (N): Likewise.
> 	* gcc.dg/vect/no-section-anchors-vect-64.c (NINTS): New macro.
> 	(N): Redefine in terms of NINTS.
> 	(ia, ib, ic): Use NINTS instead of hard-coded constants in the
> 	array bounds.
> 	* gcc.dg/vect/no-section-anchors-vect-69.c (NINTS): New macro.
> 	(N): Redefine in terms of NINTS.
> 	(test1): Replace a and b fields with NINTS - 2 ints of padding.
> 	(main1): Use NINTS instead of hard-coded constants.
> 	* gcc.dg/vect/section-anchors-vect-69.c (NINTS): New macro.
> 	(N): Redefine in terms of NINTS.
> 	(test1): Replace a and b fields with NINTS - 2 ints of padding.
> 	(test2): Remove incorrect comments about alignment.
> 	(main1): Use NINTS instead of hard-coded constants.
> 	* gcc.dg/vect/pr45752.c (N): Redefine if the default value is
> 	too small for VECTOR_BITS.
> 	(main): Continue to use canned results for the default value of N,
> 	but compute the expected results from scratch for other values.
> 	* gcc.dg/vect/slp-perm-1.c (N, main): As for pr45752.c.
> 	* gcc.dg/vect/slp-perm-4.c (N, main): Likewise.
> 	* gcc.dg/vect/slp-perm-5.c (N, main): Likewise.
> 	* gcc.dg/vect/slp-perm-6.c (N, main): Likewise.
> 	* gcc.dg/vect/slp-perm-7.c (N, main): Likewise.
> 	* gcc.dg/vect/pr65518.c (NINTS, N, RESULT): New macros.
> 	(giga): Use NINTS as the array bound.
> 	(main): Use NINTS, N and RESULT.
> 	* gcc.dg/vect/pr65947-5.c (N): Redefine if the default value is
> 	too small for VECTOR_BITS.
> 	(main): Fill in any remaining elements of A programmatically.
> 	* gcc.dg/vect/pr81136.c: Include tree-vect.h.
> 	(a): Use VECTOR_BITS to set the alignment of the target structure.
> 	* gcc.dg/vect/slp-19c.c (N): Redefine if the default value is
> 	too small for VECTOR_BITS.
> 	(main1): Continue to use the canned input for the default value of N,
> 	but compute the input from scratch for other values.
> 	* gcc.dg/vect/slp-28.c (N): Redefine if the default value is
> 	too small for VECTOR_BITS.
> 	(in1, in2, in3): Remove initialization.
> 	(check1, check2): Delete.
> 	(main1): Initialize in1, in2 and in3 here.  Check every element
> 	of the vectors and compute the expected values directly instead
> 	of using an array.
> 	* gcc.dg/vect/slp-perm-8.c (N): Redefine if the default value is
> 	too small for VECTOR_BITS.
> 	(foo, main): Change type of "i" to int.
> 	* gcc.dg/vect/vect-103.c (NINTS): New macro.
> 	(N): Redefine in terms of N.
> 	(c): Delete.
> 	(main1): Use NINTS.  Check the result from a and b directly.
> 	* gcc.dg/vect/vect-67.c (NINTS): New macro.
> 	(N): Redefine in terms of N.
> 	(main1): Use NINTS for the inner array bounds.
> 	* gcc.dg/vect/vect-70.c (NINTS, OUTERN): New macros.
> 	(N): Redefine in terms of NINTS.
> 	(s): Keep the outer dimensions as 4 even if N is larger than 24.
> 	(tmp1): New variable.
> 	(main1): Only define a local tmp1 if NINTS is relatively small.
> 	Use OUTERN for the outer loops and NINTS for the inner loops.
> 	* gcc.dg/vect/vect-91.c (OFF): New macro.
> 	(a, main3): Use it.
> 	* gcc.dg/vect/vect-92.c (NITER): New macro.
> 	(main1, main2): Use it.
> 	* gcc.dg/vect/vect-93.c (N): Rename to...
> 	(N1): ...this.
> 	(main): Update accordingly.
> 	(N2): New macro.
> 	(main1): Use N1 instead of 3001 and N2 insteaed of 10.
> 	* gcc.dg/vect/vect-multitypes-1.c (NSHORTS, NINTS): New macros.
> 	(N): Redefine in terms of NSHORTS.
> 	(main1): Use NINTS - 1 instead of 3 and NSHORTS - 1 instead of 7.
> 	(main): Likewise.
> 	* gcc.dg/vect/vect-over-widen-3-big-array.c (N): Define to VECTOR_BITS.
> 	(foo): Truncate the expected value to the type of *d.
> 	* gcc.dg/vect/vect-peel-3.c (NINTS, EXTRA): New macros.
> 	(ia, ib, ic, main): Use EXTRA.
> 	(main): Use NINTS.
> 	(RES_A, RES_B, REC_C): New macros.
> 	(RES): Redefine as their sum.
> 	* gcc.dg/vect/vect-reduc-or_1.c (N): New macro.
> 	(in): Change number of elements to N.
> 	(main): Update accordingly.  Calculate the expected result.
> 	* gcc.dg/vect/vect-reduc-or_2.c (N, in, main): As for
> 	vect-reduc-or-1.c.
I did some spot checking on this, but didn't look at each conversion.
I'm willing to assume you got 'em right.

jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [4/10] Don't assume vect_multiple_sizes means 2 sizes
  2017-11-03 16:18 ` [4/10] Don't assume vect_multiple_sizes means 2 sizes Richard Sandiford
@ 2017-11-08 19:21   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 19:21 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:18 AM, Richard Sandiford wrote:
> Some tests assumed that there would only be 2 vector sizes if
> vect_multiple_sizes, whereas for SVE there are three (SVE, 128-bit
> and 64-bit).  This patch replaces scan-tree-dump-times with
> scan-tree-dump for vect_multiple_sizes but keeps it for
> !vect_multiple_sizes.
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/testsuite/
> 	* gcc.dg/vect/no-vfa-vect-101.c: Use scan-tree-dump rather than
> 	scan-tree-dump-times for vect_multiple_sizes.
> 	* gcc.dg/vect/no-vfa-vect-102.c: Likewise.
> 	* gcc.dg/vect/no-vfa-vect-102a.c: Likewise.
> 	* gcc.dg/vect/no-vfa-vect-37.c: Likewise.
> 	* gcc.dg/vect/no-vfa-vect-79.c: Likewise.
> 	* gcc.dg/vect/vect-104.c: Likewise.
OK.
jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [5/10] Add vect_perm3_* target selectors
  2017-11-03 16:19 ` [5/10] Add vect_perm3_* target selectors Richard Sandiford
@ 2017-11-08 19:49   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 19:49 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:19 AM, Richard Sandiford wrote:
> SLP load permutation fails if any individual permutation requires more
> than two vector inputs.  For 128-bit vectors, it's possible to permute
> 3 contiguous loads of 32-bit and 8-bit elements, but not 16-bit elements
> or 64-bit elements.  The results are reversed for 256-bit vectors,
> and so on for wider vectors.
> 
> This patch adds a routine that tests whether a permute will require
> three vectors for a given vector count and element size, then adds
> vect_perm3_* target selectors for the cases that we currently use.
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* doc/sourcebuild.texi (vect_perm_short, vect_perm_byte): Document
> 	previously undocumented selectors.
> 	(vect_perm3_byte, vect_perm3_short, vect_perm3_int): Document.
> 
> gcc/testsuite/
> 	* lib/target-supports.exp (vect_perm_supported): New proc.
> 	(check_effective_target_vect_perm3_int): Likewise.
> 	(check_effective_target_vect_perm3_short): Likewise.
> 	(check_effective_target_vect_perm3_byte): Likewise.
> 	* gcc.dg/vect/slp-perm-1.c: Expect SLP load permutation to
> 	succeed if vect_perm3_int.
> 	* gcc.dg/vect/slp-perm-5.c: Likewise.
> 	* gcc.dg/vect/slp-perm-6.c: Likewise.
> 	* gcc.dg/vect/slp-perm-7.c: Likewise.
> 	* gcc.dg/vect/slp-perm-8.c: Likewise vect_perm3_byte.
> 	* gcc.dg/vect/slp-perm-9.c: Likewise vect_perm3_short.
> 	Use vect_perm_short instead of vect_perm.  Add a scan-tree-dump-not
> 	test for vect_perm3_short targets.
Going to take your word on the correctness of vect_perm_supported. :-)

OK for the trunk.

jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [6/10] Add a vect_element_align_preferred target selector
  2017-11-03 16:20 ` [6/10] Add a vect_element_align_preferred target selector Richard Sandiford
@ 2017-11-08 22:31   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 22:31 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:20 AM, Richard Sandiford wrote:
> This patch adds a target selector for targets whose
> preferred_vector_alignment is the alignment of one element.  We'll never
> peel in that case, and the step of a loop that operates on normal (as
> opposed to packed) elements will always divide the preferred alignment.
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* doc/sourcebuild.texi (vect_element_align_preferred): Document.
> 
> gcc/testsuite/
> 	* lib/target-supports.exp
> 	(check_effective_target_vect_element_align_preferred): New proc.
> 	(check_effective_target_vect_peeling_profitable): Test it.
> 	* gcc.dg/vect/no-section-anchors-vect-31.c: Don't expect peeling
> 	if vect_element_align_preferred.
> 	* gcc.dg/vect/no-section-anchors-vect-64.c: Likewise.
> 	* gcc.dg/vect/pr65310.c: Likewise.
> 	* gcc.dg/vect/vect-26.c: Likewise.
> 	* gcc.dg/vect/vect-54.c: Likewise.
> 	* gcc.dg/vect/vect-56.c: Likewise.
> 	* gcc.dg/vect/vect-58.c: Likewise.
> 	* gcc.dg/vect/vect-60.c: Likewise.
> 	* gcc.dg/vect/vect-89-big-array.c: Likewise.
> 	* gcc.dg/vect/vect-89.c: Likewise.
> 	* gcc.dg/vect/vect-92.c: Likewise.
> 	* gcc.dg/vect/vect-peel-1.c: Likewise.
> 	* gcc.dg/vect/vect-outer-3a-big-array.c: Expect the step to
> 	divide the alignment if vect_element_align_preferred.
> 	* gcc.dg/vect/vect-outer-3a.c: Likewise.
OK.
jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [7/10] Add a vect_unaligned_possible target selector
  2017-11-03 16:21 ` [7/10] Add a vect_unaligned_possible " Richard Sandiford
@ 2017-11-08 22:32   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 22:32 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:20 AM, Richard Sandiford wrote:
> This patch adds a target selector that says whether we can ever
> generate an "unaligned" accesses, where "unaligned" is relative
> to the target's preferred vector alignment.  This is already true if:
> 
>    vect_no_align && { ! vect_hw_misalign }
> 
> i.e. if the target doesn't have any alignment mechanism and also
> doesn't allow unaligned accesses.  It is also true (for the things
> tested by gcc.dg/vect) if the target only wants things to be aligned
> to an element; in that case every normal scalar access is "vector aligned".
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* doc/sourcebuild.texi (vect_unaligned_possible): Document.
> 
> gcc/testsuite/
> 	* lib/target-supports.exp
> 	(check_effective_target_vect_unaligned_possible): New proc.
> 	* gcc.dg/vect/slp-25.c: Extend XFAIL of peeling for alignment from
> 	vect_no_align && { ! vect_hw_misalign } to ! vect_unaligned_possible.
> 	* gcc.dg/vect/vect-multitypes-1.c: Likewise.
> 	* gcc.dg/vect/vect-109.c: XFAIL vectorisation of an unaligned
> 	access to ! vect_unaligned_possible.
> 	* gcc.dg/vect/vect-33.c: Likewise.
> 	* gcc.dg/vect/vect-42.c: Likewise.
> 	* gcc.dg/vect/vect-56.c: Likewise.
> 	* gcc.dg/vect/vect-60.c: Likewise.
> 	* gcc.dg/vect/vect-96.c: Likewise.
> 	* gcc.dg/vect/vect-peel-1.c: Likewise.
> 	* gcc.dg/vect/vect-27.c: Extend XFAIL of unaligned vectorization from
> 	vect_no_align && { ! vect_hw_misalign } to ! vect_unaligned_possible.
> 	* gcc.dg/vect/vect-29.c: Likewise.
> 	* gcc.dg/vect/vect-44.c: Likewise.
> 	* gcc.dg/vect/vect-48.c: Likewise.
> 	* gcc.dg/vect/vect-50.c: Likewise.
> 	* gcc.dg/vect/vect-52.c: Likewise.
> 	* gcc.dg/vect/vect-72.c: Likewise.
> 	* gcc.dg/vect/vect-75-big-array.c: Likewise.
> 	* gcc.dg/vect/vect-75.c: Likewise.
> 	* gcc.dg/vect/vect-77-alignchecks.c: Likewise.
> 	* gcc.dg/vect/vect-77-global.c: Likewise.
> 	* gcc.dg/vect/vect-78-alignchecks.c: Likewise.
> 	* gcc.dg/vect/vect-78-global.c: Likewise.
> 	* gcc.dg/vect/vect-multitypes-3.c: Likewise.
> 	* gcc.dg/vect/vect-multitypes-4.c: Likewise.
> 	* gcc.dg/vect/vect-multitypes-6.c: Likewise.
> 	* gcc.dg/vect/vect-peel-4.c: Likewise.
> 	* gcc.dg/vect/vect-peel-3.c: Likewise, and also for peeling
> 	for alignment.
OK.  Though I could see a need to one day provide a more concrete test
than "in some circumstances".

jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [8/10] Add a vect_variable_length target selector
  2017-11-03 16:21 ` [8/10] Add a vect_variable_length " Richard Sandiford
@ 2017-11-08 22:33   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 22:33 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:21 AM, Richard Sandiford wrote:
> This patch adds a target selector for variable-length vectors.
> Initially it's always false, but the SVE patch provides a case
> in which it's true.
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* doc/sourcebuild.texi (vect_variable_length): Document.
> 
> gcc/testsuite/
> 	* lib/target-supports.exp
> 	(check_effective_target_vect_variable_length): New proc.
> 	* gcc.dg/vect/pr60482.c: XFAIL test for no epilog loop if
> 	vect_variable_length.
> 	* gcc.dg/vect/slp-reduc-6.c: XFAIL two-operation SLP if
> 	vect_variable_length.
> 	* gcc.dg/vect/vect-alias-check-5.c: XFAIL alias optimization if
> 	vect_variable_length.
> 	* gfortran.dg/vect/fast-math-mgrid-resid.f: XFAIL predictive
> 	commoning optimization if vect_variable_length.
OK.
jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [9/10] Add a vect_align_stack_vars target selector
  2017-11-03 16:22 ` [9/10] Add a vect_align_stack_vars " Richard Sandiford
@ 2017-11-08 22:40   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 22:40 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:22 AM, Richard Sandiford wrote:
> This patch adds a target selector to say whether it's possible to
> align a local variable to the target's preferred vector alignment.
> This can be false for large vectors if the alignment is only
> a preference and not a hard requirement (and thus if there is no
> need to support a stack realignment mechanism).
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* doc/sourcebuild.texi (vect_align_stack_vars): Document.
> 
> gcc/testsuite/
> 	* lib/target-supports.exp
> 	(check_effective_target_vect_align_stack_vars): New proc.
> 	* gcc.dg/vect/vect-23.c: Only expect the array to be aligned if
> 	vect_align_stack_vars.
> 	* gcc.dg/vect/vect-24.c: Likewise.
> 	* gcc.dg/vect/vect-25.c: Likewise.
> 	* gcc.dg/vect/vect-26.c: Likewise.
> 	* gcc.dg/vect/vect-32-big-array.c: Likewise.
> 	* gcc.dg/vect/vect-32.c: Likewise.
> 	* gcc.dg/vect/vect-40.c: Likewise.
> 	* gcc.dg/vect/vect-42.c: Likewise.
> 	* gcc.dg/vect/vect-46.c: Likewise.
> 	* gcc.dg/vect/vect-48.c: Likewise.
> 	* gcc.dg/vect/vect-52.c: Likewise.
> 	* gcc.dg/vect/vect-54.c: Likewise.
> 	* gcc.dg/vect/vect-62.c: Likewise.
> 	* gcc.dg/vect/vect-67.c: Likewise.
> 	* gcc.dg/vect/vect-75-big-array.c: Likewise.
> 	* gcc.dg/vect/vect-75.c: Likewise.
> 	* gcc.dg/vect/vect-77-alignchecks.c: Likewise.
> 	* gcc.dg/vect/vect-78-alignchecks.c: Likewise.
> 	* gcc.dg/vect/vect-89-big-array.c: Likewise.
> 	* gcc.dg/vect/vect-89.c: Likewise.
> 	* gcc.dg/vect/vect-96.c: Likewise.
> 	* gcc.dg/vect/vect-multitypes-3.c: Likewise.
> 	* gcc.dg/vect/vect-multitypes-6.c: Likewise.
OK.
jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [10/10] Add a vect_masked_store target selector
  2017-11-03 16:23 ` [10/10] Add a vect_masked_store " Richard Sandiford
@ 2017-11-08 22:44   ` Jeff Law
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Law @ 2017-11-08 22:44 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/03/2017 10:23 AM, Richard Sandiford wrote:
> This patch adds a target selector that says whether the target
> supports IFN_MASK_STORE.
> 
> 
> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* doc/sourcebuild.texi (vect_masked_store): Document.
> 
> gcc/testsuite/
> 	* lib/target-supports.exp (check_effective_target_vect_masked_store):
> 	New proc.
> 	* gcc.dg/vect/vect-cselim-1.c (foo): Mention that the second loop
> 	is vectorizable with masked stores.  Update scan-tree-dump-times
> 	accordingly.
> 
OK.
jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [3/10] Add available_vector_sizes to target-supports.exp
  2017-11-08 19:13   ` Jeff Law
@ 2017-11-17 13:23     ` Christophe Lyon
  0 siblings, 0 replies; 22+ messages in thread
From: Christophe Lyon @ 2017-11-17 13:23 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: gcc-patches

Hi Richard,


On 8 November 2017 at 20:11, Jeff Law <law@redhat.com> wrote:
> On 11/03/2017 10:18 AM, Richard Sandiford wrote:
>> This patch adds a routine that lists the available vector sizes
>> for a target and uses it for some existing target conditions.
>> Later patches add more uses.
>>
>> The cases are taken from multiple_sizes.
>>
>>
>> 2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
>>           Alan Hayward  <alan.hayward@arm.com>
>>           David Sherwood  <david.sherwood@arm.com>
>>
>> gcc/testsuite/
>>       * lib/target-supports.exp (available_vector_sizes): New proc.
>>       (check_effective_target_vect_multiple_sizes): Use it.
>>       (check_effective_target_vect64): Likewise.
>>       (check_effective_target_vect_sizes_32B_16B): Likewise.

This patch (r254590) means that we now skip:
    gcc.dg/vect/vect-33.c -flto -ffat-lto-objects
scan-tree-dump-times vect "Alignment of access forced using
versioning" 1
    gcc.dg/vect/vect-33.c scan-tree-dump-times vect "Alignment of
access forced using versioning" 1
on armeb-none-linux-gnueabihf --with-fpu=neon-fp16

This is because of the change in vect64, which used to give a
different result on arm depending on the endianness.

I think that's not a big deal, but I thought I should mention it.

Christophe


> OK.
> jeff

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-11-17 13:17 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
2017-11-03 16:16 ` [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests Richard Sandiford
2017-11-08 19:10   ` Jeff Law
2017-11-03 16:17 ` [2/10] Add VECTOR_BITS to tree-vect.h Richard Sandiford
2017-11-08 19:13   ` Jeff Law
2017-11-03 16:18 ` [3/10] Add available_vector_sizes to target-supports.exp Richard Sandiford
2017-11-08 19:13   ` Jeff Law
2017-11-17 13:23     ` Christophe Lyon
2017-11-03 16:18 ` [4/10] Don't assume vect_multiple_sizes means 2 sizes Richard Sandiford
2017-11-08 19:21   ` Jeff Law
2017-11-03 16:19 ` [5/10] Add vect_perm3_* target selectors Richard Sandiford
2017-11-08 19:49   ` Jeff Law
2017-11-03 16:20 ` [6/10] Add a vect_element_align_preferred target selector Richard Sandiford
2017-11-08 22:31   ` Jeff Law
2017-11-03 16:21 ` [7/10] Add a vect_unaligned_possible " Richard Sandiford
2017-11-08 22:32   ` Jeff Law
2017-11-03 16:21 ` [8/10] Add a vect_variable_length " Richard Sandiford
2017-11-08 22:33   ` Jeff Law
2017-11-03 16:22 ` [9/10] Add a vect_align_stack_vars " Richard Sandiford
2017-11-08 22:40   ` Jeff Law
2017-11-03 16:23 ` [10/10] Add a vect_masked_store " Richard Sandiford
2017-11-08 22:44   ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).