diff mbox series

[2/3] rs6000: Use pointers in bswap testcases

Message ID 133b175e62fb85c7977d66d42816ff88709ff4fb.1552930079.git.segher@kernel.crashing.org
State New
Headers show
Series rs6000: Fix some tests that fail on big-endian | expand

Commit Message

Segher Boessenkool March 18, 2019, 5:35 p.m. UTC
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.


2019-03-18  Segher Boessenkool  <segher@kernel.crashing.org>

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

---
 gcc/testsuite/gcc.target/powerpc/bswap16.c | 3 +--
 gcc/testsuite/gcc.target/powerpc/bswap32.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/bswap16.c b/gcc/testsuite/gcc.target/powerpc/bswap16.c
index 5eea4f7..89efc811 100644
--- a/gcc/testsuite/gcc.target/powerpc/bswap16.c
+++ b/gcc/testsuite/gcc.target/powerpc/bswap16.c
@@ -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); }
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap32.c b/gcc/testsuite/gcc.target/powerpc/bswap32.c
index 1b1e189..0d1788f 100644
--- a/gcc/testsuite/gcc.target/powerpc/bswap32.c
+++ b/gcc/testsuite/gcc.target/powerpc/bswap32.c
@@ -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); }