Fix gcc.target/aarch64/vec_zeroextend.c for big-endian
diff mbox series

Message ID 1579952212-27102-1-git-send-email-apinski@marvell.com
State New
Headers show
Series
  • Fix gcc.target/aarch64/vec_zeroextend.c for big-endian
Related show

Commit Message

Andrew Pinski Jan. 25, 2020, 11:36 a.m. UTC
From: Andrew Pinski <apinski@marvell.com>

vec_zeroextend.c fails on big-endian as it assumes
0 index is the lower part but it is not for
big-endian case.  This fixes the problem by
using the correct index for the lower part
for big-endian.

Committed as obvious after a test on aarch64_be-linux-gnu.

Thanks,
Andrew Pinski

ChangeLog:
* gcc.target/aarch64/vec_zeroextend.c: Fix for big-endian.
---
 gcc/testsuite/gcc.target/aarch64/vec_zeroextend.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/gcc/testsuite/gcc.target/aarch64/vec_zeroextend.c b/gcc/testsuite/gcc.target/aarch64/vec_zeroextend.c
index 9c3971f036a..5a74cbc5aba 100644
--- a/gcc/testsuite/gcc.target/aarch64/vec_zeroextend.c
+++ b/gcc/testsuite/gcc.target/aarch64/vec_zeroextend.c
@@ -3,17 +3,21 @@ 
 
 #define vector __attribute__((vector_size(16) ))
 
+#define lowull (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? 1 : 0)
+#define lowui (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? 3 : 0)
+
+
 vector unsigned long long
 f1(vector unsigned long long b, vector unsigned int a)
 {
-  b[0] = a[0];
+  b[lowull] = a[lowui];
   return b;
 }
 
 unsigned long long
 f2(vector unsigned int a)
 {
-  return a[0];
+  return a[lowui];
 }
 
 /* { dg-final { scan-assembler-times {fmov} 2 } } */