testsuite/93717 fix up gcc.dg/optimize-bswapsi-2.c for BE
diff mbox series

Message ID nycvar.YFH.7.76.2002130913040.18835@zhemvz.fhfr.qr
State New
Headers show
Series
  • testsuite/93717 fix up gcc.dg/optimize-bswapsi-2.c for BE
Related show

Commit Message

Richard Biener Feb. 13, 2020, 8:13 a.m. UTC
Pushed.

2020-02-13  Richard Biener  <rguenther@suse.de>

	PR testsuite/93717
	* gcc.dg/optimize-bswapsi-2.c: Add BE case.
---
 gcc/testsuite/gcc.dg/optimize-bswapsi-2.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Patch
diff mbox series

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" } } */