From: Richard Biener Date: Thu, 13 Feb 2020 08:10:28 +0000 (+0100) Subject: testsuite/93717 fix up gcc.dg/optimize-bswapsi-2.c for BE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ea884b85e338d09b14e6a54043c53ae0c1b1fe9;p=gcc.git testsuite/93717 fix up gcc.dg/optimize-bswapsi-2.c for BE 2020-02-13 Richard Biener PR testsuite/93717 * gcc.dg/optimize-bswapsi-2.c: Add BE case. --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9aa49fa2e45..63d3ff56996 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-02-13 Richard Biener + + PR testsuite/93717 + * gcc.dg/optimize-bswapsi-2.c: Add BE case. + 2020-02-13 Jakub Jelinek PR target/93673 diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c index f111553e1cf..330dfe99445 100644 --- a/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c @@ -45,15 +45,26 @@ uint32_t read_be32_3 (unsigned char *data) } static inline unsigned short -get_unaligned_16 (unsigned char *p) +get_unaligned_16_le (unsigned char *p) { return p[0] | (p[1] << 8); } unsigned int -get_unaligned_32 (unsigned char *p) +get_unaligned_32_le (unsigned char *p) { - return get_unaligned_16 (p) | (get_unaligned_16 (p + 2) << 16); + return get_unaligned_16_le (p) | (get_unaligned_16_le (p + 2) << 16); +} + +static inline unsigned short +get_unaligned_16_be (unsigned char *p) +{ + return p[1] | (p[0] << 8); +} +unsigned int +get_unaligned_32_be (unsigned char *p) +{ + return get_unaligned_16_be (p + 2) | (get_unaligned_16_be (p) << 16); } /* { dg-final { scan-tree-dump-times "32 bit load in target endianness found at" 4 "bswap" } } */ -/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 3 "bswap" } } */ +/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 4 "bswap" } } */