From: Richard Sandiford Date: Thu, 9 Nov 2017 15:15:25 +0000 (+0000) Subject: Consistently use asm volatile ("" ::: "memory") in vect tests X-Git-Tag: upstream/12.2.0~35693 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9680369c3b870031120cda2a92511393e936538;p=platform%2Fupstream%2Fgcc.git Consistently use asm volatile ("" ::: "memory") in vect tests 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 Alan Hayward David Sherwood 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 Co-Authored-By: David Sherwood From-SVN: r254588 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7741f7f..c9a3fba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,105 @@ +2017-11-09 Richard Sandiford + Alan Hayward + David Sherwood + + * 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 * gcc.c-torture/compile/pr82879.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-1.c index 8baba4d..f64514e 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-1.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-1.c @@ -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: */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-24.c b/gcc/testsuite/gcc.dg/vect/bb-slp-24.c index d0c1242..d5b6bfb 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-24.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-24.c @@ -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++) { diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-25.c b/gcc/testsuite/gcc.dg/vect/bb-slp-25.c index 14314c2..ec31329 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-25.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-25.c @@ -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++) { diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-26.c b/gcc/testsuite/gcc.dg/vect/bb-slp-26.c index 071c253..91b6cac 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-26.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-26.c @@ -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++) { diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-29.c b/gcc/testsuite/gcc.dg/vect/bb-slp-29.c index 7a622ae..747896b 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-29.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-29.c @@ -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++) { diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c index ddad853..2c4c36f 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c index 53a427d..230b93f 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102.c @@ -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); } diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c index c81a93b..a8450a4 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-102a.c @@ -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); } diff --git a/gcc/testsuite/gcc.dg/vect/pr42709.c b/gcc/testsuite/gcc.dg/vect/pr42709.c index 22c5419..77818c4 100644 --- a/gcc/testsuite/gcc.dg/vect/pr42709.c +++ b/gcc/testsuite/gcc.dg/vect/pr42709.c @@ -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"); } } diff --git a/gcc/testsuite/gcc.dg/vect/slp-13-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-13-big-array.c index 5540387..5978138 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-13-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/slp-13-big-array.c @@ -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. */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-23.c b/gcc/testsuite/gcc.dg/vect/slp-23.c index b1fe6e4..0acb37e 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-23.c +++ b/gcc/testsuite/gcc.dg/vect/slp-23.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/vect/slp-24-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-24-big-array.c index e2ecbbe..abd3a87 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-24-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/slp-24-big-array.c @@ -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 (); diff --git a/gcc/testsuite/gcc.dg/vect/slp-24.c b/gcc/testsuite/gcc.dg/vect/slp-24.c index 29448bc..a45ce7d 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-24.c +++ b/gcc/testsuite/gcc.dg/vect/slp-24.c @@ -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 (); diff --git a/gcc/testsuite/gcc.dg/vect/slp-3-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-3-big-array.c index ca6c44e..4cf0e7a 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-3-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/slp-3-big-array.c @@ -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++) diff --git a/gcc/testsuite/gcc.dg/vect/slp-34-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-34-big-array.c index 6f79408..9e9c820 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-34-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/slp-34-big-array.c @@ -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. */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-35.c b/gcc/testsuite/gcc.dg/vect/slp-35.c index 1e4aaea..76dd745 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-35.c +++ b/gcc/testsuite/gcc.dg/vect/slp-35.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/vect/slp-37.c b/gcc/testsuite/gcc.dg/vect/slp-37.c index 9b1d275..b6a044d 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-37.c +++ b/gcc/testsuite/gcc.dg/vect/slp-37.c @@ -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"); } diff --git a/gcc/testsuite/gcc.dg/vect/slp-4-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-4-big-array.c index 940134e..98ac3f1 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-4-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/slp-4-big-array.c @@ -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++) diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c index 44ed1c8..7793862 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c @@ -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++) diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-4.c b/gcc/testsuite/gcc.dg/vect/slp-perm-4.c index 6074892..c4e27f4 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-4.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-4.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-7.c b/gcc/testsuite/gcc.dg/vect/slp-perm-7.c index a2881f9..307d823 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-7.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-7.c @@ -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 } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c index b9b5a3b..bbf9cae 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c @@ -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 } } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-10-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-10-big-array.c index 71ec0b8..f266ac8 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-10-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-10-big-array.c @@ -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. */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-103.c b/gcc/testsuite/gcc.dg/vect/vect-103.c index e0fd1b6..6ebb4e1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-103.c +++ b/gcc/testsuite/gcc.dg/vect/vect-103.c @@ -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); } diff --git a/gcc/testsuite/gcc.dg/vect/vect-104.c b/gcc/testsuite/gcc.dg/vect/vect-104.c index c747838..48c45d1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-104.c +++ b/gcc/testsuite/gcc.dg/vect/vect-104.c @@ -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); } diff --git a/gcc/testsuite/gcc.dg/vect/vect-105-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-105-big-array.c index 8b483e0..433565b 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-105-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-105-big-array.c @@ -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"); } } diff --git a/gcc/testsuite/gcc.dg/vect/vect-105.c b/gcc/testsuite/gcc.dg/vect/vect-105.c index e5483b3..0024457 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-105.c +++ b/gcc/testsuite/gcc.dg/vect/vect-105.c @@ -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"); } } diff --git a/gcc/testsuite/gcc.dg/vect/vect-112-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-112-big-array.c index 54aef69..a99a590 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-112-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-112-big-array.c @@ -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. */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-117.c b/gcc/testsuite/gcc.dg/vect/vect-117.c index bb1aebc..22f8e01 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-117.c +++ b/gcc/testsuite/gcc.dg/vect/vect-117.c @@ -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: */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-15-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-15-big-array.c index d9457c3..5313eae 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-15-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-15-big-array.c @@ -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