Fix gcc.target/aarch64/vec_zeroextend.c for big-endian
authorAndrew Pinski <apinski@marvell.com>
Sat, 25 Jan 2020 05:20:38 +0000 (05:20 +0000)
committerAndrew Pinski <apinski@marvell.com>
Sat, 25 Jan 2020 11:38:31 +0000 (03:38 -0800)
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.

ChangeLog:
* gcc.target/aarch64/vec_zeroextend.c: Fix for big-endian.

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/vec_zeroextend.c

index a8d517a..ecf0a66 100644 (file)
@@ -1,3 +1,7 @@
+2020-01-25  Andrew Pinski <apinski@marvell.com>
+
+       * gcc.target/aarch64/vec_zeroextend.c: Fix for big-endian.
+
 2020-01-24  Jeff Law  <law@redhat.com
 
        PR tree-optimization/92788
index 9c3971f..5a74cbc 100644 (file)
@@ -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 } } */