From 0a6d5a9e3eb03b97884b2b06f8239f8371b278cf Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Mon, 18 Mar 2019 18:44:56 +0100 Subject: [PATCH] rs6000: Use pointers in bswap testcases 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 | 6 ++++++ gcc/testsuite/gcc.target/powerpc/bswap16.c | 3 +-- gcc/testsuite/gcc.target/powerpc/bswap32.c | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7bb8cb7995a..ba77fc55201 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-18 Segher Boessenkool + + * 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 * gcc.target/powerpc/pr18096-1.c: Allow an error message that says diff --git a/gcc/testsuite/gcc.target/powerpc/bswap16.c b/gcc/testsuite/gcc.target/powerpc/bswap16.c index 5eea4f77491..89efc811844 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 1b1e189aafa..0d1788ff666 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); } -- 2.30.2