rs6000: Use pointers in bswap testcases
authorSegher Boessenkool <segher@kernel.crashing.org>
Mon, 18 Mar 2019 17:44:56 +0000 (18:44 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Mon, 18 Mar 2019 17:44:56 +0000 (18:44 +0100)
Currently these bswap testcases use global variables, which causes
problems with -m32: the memory access is a D-form access, and when
combine tries to combine that with the bswap it tries a D-form store
with byte reverse.  That instruction does not exist, and since combine
started with only two insns here it will not try splitting this.

This should be improved, but it is not what this test is testing, and
the "load" case already uses a pointer, so let's do that for the store
case as well.

* gcc.target/powerpc/bswap16.c: Use a pointer instead of a global for
the "store" test as well.
* gcc.target/powerpc/bswap32.c: Ditto.

From-SVN: r269771

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/bswap16.c
gcc/testsuite/gcc.target/powerpc/bswap32.c

index 7bb8cb7..ba77fc5 100644 (file)
@@ -1,5 +1,11 @@
 2019-03-18  Segher Boessenkool  <segher@kernel.crashing.org>
 
+       * gcc.target/powerpc/bswap16.c: Use a pointer instead of a global for
+       the "store" test as well.
+       * gcc.target/powerpc/bswap32.c: Ditto.
+
+2019-03-18  Segher Boessenkool  <segher@kernel.crashing.org>
+
        * gcc.target/powerpc/pr18096-1.c: Allow an error message that says
        "exceeds" instead of just one that talks about "too large".
 
index 5eea4f7..89efc81 100644 (file)
@@ -3,6 +3,5 @@
 /* { dg-final { scan-assembler "lhbrx" } } */
 /* { dg-final { scan-assembler "sthbrx" } } */
 
-unsigned short us;
 unsigned int load_bswap16 (unsigned short *p) { return __builtin_bswap16 (*p); }
-void store_bswap16 (unsigned int a) { us = __builtin_bswap16 (a); }
+void store_bswap16 (unsigned short *p, unsigned int a) { *p = __builtin_bswap16 (a); }
index 1b1e189..0d1788f 100644 (file)
@@ -3,6 +3,5 @@
 /* { dg-final { scan-assembler "lwbrx" } } */
 /* { dg-final { scan-assembler "stwbrx" } } */
 
-unsigned int ui;
 unsigned int load_bswap32 (unsigned int *p) { return __builtin_bswap32 (*p); }
-void store_bswap32 (unsigned int a) { ui = __builtin_bswap32 (a); }
+void store_bswap32 (unsigned int *p, unsigned int a) { *p = __builtin_bswap32 (a); }