Consistently use asm volatile ("" ::: "memory") in vect tests
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 9 Nov 2017 15:15:25 +0000 (15:15 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 9 Nov 2017 15:15:25 +0000 (15:15 +0000)
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-09  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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r254588

77 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/bb-slp-1.c
gcc/testsuite/gcc.dg/vect/bb-slp-24.c
gcc/testsuite/gcc.dg/vect/bb-slp-25.c
gcc/testsuite/gcc.dg/vect/bb-slp-26.c
gcc/testsuite/gcc.dg/vect/bb-slp-29.c
gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c
gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c
gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c
gcc/testsuite/gcc.dg/vect/pr42709.c
gcc/testsuite/gcc.dg/vect/slp-13-big-array.c
gcc/testsuite/gcc.dg/vect/slp-23.c
gcc/testsuite/gcc.dg/vect/slp-24-big-array.c
gcc/testsuite/gcc.dg/vect/slp-24.c
gcc/testsuite/gcc.dg/vect/slp-3-big-array.c
gcc/testsuite/gcc.dg/vect/slp-34-big-array.c
gcc/testsuite/gcc.dg/vect/slp-35.c
gcc/testsuite/gcc.dg/vect/slp-37.c
gcc/testsuite/gcc.dg/vect/slp-4-big-array.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c
gcc/testsuite/gcc.dg/vect/slp-perm-4.c
gcc/testsuite/gcc.dg/vect/slp-perm-7.c
gcc/testsuite/gcc.dg/vect/slp-perm-9.c
gcc/testsuite/gcc.dg/vect/vect-10-big-array.c
gcc/testsuite/gcc.dg/vect/vect-103.c
gcc/testsuite/gcc.dg/vect/vect-104.c
gcc/testsuite/gcc.dg/vect/vect-105-big-array.c
gcc/testsuite/gcc.dg/vect/vect-105.c
gcc/testsuite/gcc.dg/vect/vect-112-big-array.c
gcc/testsuite/gcc.dg/vect/vect-117.c
gcc/testsuite/gcc.dg/vect/vect-15-big-array.c
gcc/testsuite/gcc.dg/vect/vect-2-big-array.c
gcc/testsuite/gcc.dg/vect/vect-34-big-array.c
gcc/testsuite/gcc.dg/vect/vect-6-big-array.c
gcc/testsuite/gcc.dg/vect/vect-73-big-array.c
gcc/testsuite/gcc.dg/vect/vect-74-big-array.c
gcc/testsuite/gcc.dg/vect/vect-75-big-array.c
gcc/testsuite/gcc.dg/vect/vect-76-big-array.c
gcc/testsuite/gcc.dg/vect/vect-80-big-array.c
gcc/testsuite/gcc.dg/vect/vect-97-big-array.c
gcc/testsuite/gcc.dg/vect/vect-98-big-array.c
gcc/testsuite/gcc.dg/vect/vect-all-big-array.c
gcc/testsuite/gcc.dg/vect/vect-bswap16.c
gcc/testsuite/gcc.dg/vect/vect-bswap32.c
gcc/testsuite/gcc.dg/vect/vect-bswap64.c
gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c
gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c
gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c
gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c
gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c
gcc/testsuite/gcc.dg/vect/vect-strided-a-mult.c
gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i2.c
gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-i4.c
gcc/testsuite/gcc.dg/vect/vect-strided-a-u16-mult.c
gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i2-gap.c
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.c
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.c
gcc/testsuite/gcc.dg/vect/vect-strided-mult-char-ls.c
gcc/testsuite/gcc.dg/vect/vect-strided-mult.c
gcc/testsuite/gcc.dg/vect/vect-strided-same-dr.c
gcc/testsuite/gcc.dg/vect/vect-strided-u16-i2.c
gcc/testsuite/gcc.dg/vect/vect-strided-u16-i4.c
gcc/testsuite/gcc.dg/vect/vect-strided-u32-i4.c
gcc/testsuite/gcc.dg/vect/vect-strided-u32-i8.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2-gap.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i2.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c
gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8.c

index 7741f7f..c9a3fba 100644 (file)
@@ -1,3 +1,105 @@
+2017-11-09  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * 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.
+
 2017-11-09  Jan Hubicka  <hubicka@ucw.cz>
 
        * gcc.c-torture/compile/pr82879.c: New testcase.
index 8baba4d..f64514e 100644 (file)
@@ -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 d0c1242..d5b6bfb 100644 (file)
@@ -9,7 +9,7 @@
 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, short * __restrict__ src, int h,
       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 14314c2..ec31329 100644 (file)
@@ -9,7 +9,8 @@
 
 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, short * __restrict__ src, int h, int stride,
       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 071c253..91b6cac 100644 (file)
@@ -10,8 +10,7 @@
 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 * __restrict__ src, int h,
       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 7a622ae..747896b 100644 (file)
@@ -9,7 +9,8 @@
 
 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, short * __restrict__ src, int h, int stride,
       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 ddad853..2c4c36f 100644 (file)
@@ -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 53a427d..230b93f 100644 (file)
@@ -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 c81a93b..a8450a4 100644 (file)
@@ -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 22c5419..77818c4 100644 (file)
@@ -9,7 +9,7 @@
 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, int dummy)
       res[i+1] = b + 16;
       res[i+2] = c + 16;
       res[i+3] = d + 16;
-      if (dummy == 32)
-        abort ();
+      asm volatile ("" ::: "memory");
     } 
 }
 
index 5540387..5978138 100644 (file)
@@ -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 b1fe6e4..0acb37e 100644 (file)
@@ -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 e2ecbbe..abd3a87 100644 (file)
@@ -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 29448bc..a45ce7d 100644 (file)
@@ -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 ca6c44e..4cf0e7a 100644 (file)
@@ -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 6f79408..9e9c820 100644 (file)
@@ -7,7 +7,6 @@
 
 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 1e4aaea..76dd745 100644 (file)
@@ -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 9b1d275..b6a044d 100644 (file)
@@ -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 940134e..98ac3f1 100644 (file)
@@ -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 44ed1c8..7793862 100644 (file)
@@ -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 6074892..c4e27f4 100644 (file)
@@ -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 a2881f9..307d823 100644 (file)
@@ -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 b9b5a3b..bbf9cae 100644 (file)
@@ -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 71ec0b8..f266ac8 100644 (file)
@@ -8,8 +8,6 @@ extern void abort (void);
 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 e0fd1b6..6ebb4e1 100644 (file)
@@ -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 c747838..48c45d1 100644 (file)
@@ -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 8b483e0..433565b 100644 (file)
@@ -16,8 +16,6 @@ static int a[N][N];
 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 e5483b3..0024457 100644 (file)
@@ -16,8 +16,6 @@ static int a[N][N] = {{1,2,3,11},{4,5,6,12},{7,8,9,13},{34,45,67,83}};
 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 54aef69..a99a590 100644 (file)
@@ -8,8 +8,6 @@
 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 bb1aebc..22f8e01 100644 (file)
@@ -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: */
index d9457c3..5313eae 100644 (file)
@@ -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 04ba58d..162cb54 100644 (file)
@@ -9,8 +9,6 @@
 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 2991f76..0aa6d50 100644 (file)
@@ -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 2818b7e..c5de86b 100644 (file)
@@ -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 f5cc52e..1c9d1fd 100644 (file)
@@ -11,8 +11,6 @@ int ib[N];
 
 #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 44f22e5..ba1ae63 100644 (file)
@@ -13,8 +13,6 @@ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
 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 * __restrict__ pb, float * __restrict__ pc
     {
       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 8844e15..26e2796 100644 (file)
@@ -12,8 +12,6 @@
 
 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 c2a30ac..5825cfc 100644 (file)
@@ -13,8 +13,6 @@
 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 7ab9ada..0baf4d2 100644 (file)
@@ -13,8 +13,6 @@ float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
    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 * __restrict__ pb, float *__restrict__ pc)
     {
       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 3210086..977a9d5 100644 (file)
@@ -8,8 +8,6 @@
 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 17d11ba..61b749d 100644 (file)
@@ -9,8 +9,6 @@
                         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 4826cdb..6eb9533 100644 (file)
@@ -78,8 +78,6 @@ char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
 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 ce7c6b6..3c98b07 100644 (file)
@@ -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 7f3a915..88d88b5 100644 (file)
@@ -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 b9e421d..fd15d71 100644 (file)
@@ -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 ce134b0..1d9dcda 100644 (file)
@@ -9,8 +9,6 @@ int in[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
 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 660e0fd..e762f48 100644 (file)
@@ -9,8 +9,6 @@ unsigned char ub[N];
 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 max_result, unsigned char min_result)
     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 8692f42..e246ae7 100644 (file)
@@ -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 max_result, signed char min_result)
       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 1863403..be03c7d 100644 (file)
@@ -7,8 +7,6 @@
 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 91dace2..c30c85c 100644 (file)
@@ -7,8 +7,6 @@
 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 ce33397..570e56a 100644 (file)
@@ -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 e7a006a..da47a82 100644 (file)
@@ -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 f1ce49f..d53b766 100644 (file)
@@ -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 0be68b3..37ff3ab 100644 (file)
@@ -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 5f71bed..9237a90 100644 (file)
@@ -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 0be7f8b..f64a134 100644 (file)
@@ -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 dd144fe..2add5b4 100644 (file)
@@ -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 24c7cc3..2b7a1a4 100644 (file)
@@ -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 0132aaf..e487de8 100644 (file)
@@ -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 6eb04d8..0f3347e 100644 (file)
@@ -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 3673596..82727e5 100644 (file)
@@ -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 21477f3..0fac615 100644 (file)
@@ -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 b8bb878..8c56048 100644 (file)
@@ -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 5bc2369..7d264f3 100644 (file)
@@ -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 90e5816..ee8ea0d 100644 (file)
@@ -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 4ddded3..fe41dbd 100644 (file)
@@ -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 4c2e30a..a88c0f0 100644 (file)
@@ -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 8c541fe..ab84120 100644 (file)
@@ -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 55eddf5..0afd50d 100644 (file)
@@ -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 3dd5c06..ef53225 100644 (file)
@@ -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 23cea24..04f18fb 100644 (file)
@@ -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 450784b..28ba417 100644 (file)
@@ -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 b36ab73..69b970e 100644 (file)
@@ -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 1b36df5..901b1a9 100644 (file)
@@ -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 ac93099..b703e63 100644 (file)
@@ -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 dfd71b9..764f10d 100644 (file)
@@ -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 6cc3bde..35bab79 100644 (file)
@@ -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);