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)
commitb9680369c3b870031120cda2a92511393e936538
tree0e69384456b16ce1d3b4ece4dc808572d814aeab
parent67cc7a3007ec0ae7433bdb66bc9de5e306d2bdbe
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  <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