Hi,

This patch updates a number of aapcs64 tests to make them big-endian friendly. Changes are mainly:

* checking the W regs instead of X regs for integral arguments less than 8 bytes
* correcting the corresponding stack location checks in big-endian mode

With this patch, make check-gcc RUNTESTFLAGS="aapcs64.exp" gives a clean result on aarch64_be-none-elf.

OK for trunk?

Thanks,
Yufeng

gcc/testsuite/

        Make the tests big-endian friendly.
        * gcc.target/aarch64/aapcs64/test_25.c: Update.
        * gcc.target/aarch64/aapcs64/va_arg-1.c: Ditto.
        * gcc.target/aarch64/aapcs64/va_arg-12.c: Ditto.
        * gcc.target/aarch64/aapcs64/va_arg-2.c: Ditto.
        * gcc.target/aarch64/aapcs64/va_arg-3.c: Ditto.
        * gcc.target/aarch64/aapcs64/va_arg-4.c: Ditto.
        * gcc.target/aarch64/aapcs64/va_arg-5.c: Ditto.
        * gcc.target/aarch64/aapcs64/va_arg-6.c: Ditto.
        * gcc.target/aarch64/aapcs64/va_arg-7.c: Ditto.
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_25.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_25.c
index 2f942ff..2febb79 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_25.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_25.c
@@ -42,20 +42,20 @@ void init_data ()
   s2.df[0] = 123.456;
   s2.df[1] = 234.567;
   s2.df[2] = 345.678;
-  s3.v[0] = (vf2_t){ 19.f, 20.f, 21.f, 22.f };
-  s3.v[1] = (vf2_t){ 23.f, 24.f, 25.f, 26.f };
-  s4.v[0] = (vf2_t){ 27.f, 28.f, 29.f, 30.f };
-  s4.v[1] = (vf2_t){ 31.f, 32.f, 33.f, 34.f };
-  s4.v[2] = (vf2_t){ 35.f, 36.f, 37.f, 38.f };
+  s3.v[0] = (vf2_t){ 19.f, 20.f };
+  s3.v[1] = (vf2_t){ 23.f, 24.f };
+  s4.v[0] = (vf2_t){ 27.f, 28.f };
+  s4.v[1] = (vf2_t){ 31.f, 32.f };
+  s4.v[2] = (vf2_t){ 35.f, 36.f };
 }
 
 #include "abitest.h"
 #else
-ARG_NONFLAT (struct x0, s0, Q0, f32in64)
+ARG (struct x0, s0, D0)
 ARG (struct x2, s2, D1)
 ARG (struct x1, s1, Q4)
 ARG (struct x3, s3, D5)
 ARG (struct x4, s4, STACK)
-ARG_NONFLAT (int, 0xdeadbeef, X0, i32in64)
+ARG (int, 0xdeadbeef, W0)
 LAST_ARG (double, 456.789, STACK+24)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-1.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-1.c
index 4eb569e..4fb9a03 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-1.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-1.c
@@ -30,14 +30,14 @@ void init_data ()
 
 #include "abitest.h"
 #else
-  ARG          (         int      , 0xff  ,                            X0, 
LAST_NAMED_ARG_ID)
+  ARG          (         int      , 0xff  ,                            W0, 
LAST_NAMED_ARG_ID)
   DOTS
-  ANON_PROMOTED(unsigned char     , 0xfe  , unsigned int, 0xfe       , X1,     
  1)
-  ANON_PROMOTED(  signed char     , sc    ,   signed int, sc_promoted, X2,     
  2)
-  ANON_PROMOTED(unsigned short    , 0xdcba, unsigned int, 0xdcba     , X3,     
  3)
-  ANON_PROMOTED(  signed short    , ss    ,   signed int, ss_promoted, X4,     
  4)
-  ANON         (unsigned int      , 0xdeadbeef,                        X5,     
  5)
-  ANON         (  signed int      , 0xcafebabe,                        X6,     
  6)
+  ANON_PROMOTED(unsigned char     , 0xfe  , unsigned int, 0xfe       , W1,     
  1)
+  ANON_PROMOTED(  signed char     , sc    ,   signed int, sc_promoted, W2,     
  2)
+  ANON_PROMOTED(unsigned short    , 0xdcba, unsigned int, 0xdcba     , W3,     
  3)
+  ANON_PROMOTED(  signed short    , ss    ,   signed int, ss_promoted, W4,     
  4)
+  ANON         (unsigned int      , 0xdeadbeef,                        W5,     
  5)
+  ANON         (  signed int      , 0xcafebabe,                        W6,     
  6)
   ANON         (unsigned long long, 0xba98765432101234ULL,             X7,     
  7)
   ANON         (  signed long long, 0xa987654321012345LL ,             STACK,  
  8)
   ANON         (          __int128, qword.i              ,             
STACK+16, 9)
@@ -46,5 +46,9 @@ void init_data ()
   ANON         (    long double   , 98765432123456789.987654321L,      Q2,     
 12)
   ANON         (             vf2_t, vf2   ,                            D3,     
 13)
   ANON         (             vi4_t, vi4   ,                            Q4,     
 14)
+#ifndef __AAPCS64_BIG_ENDIAN__
   LAST_ANON    (         int      , 0xeeee,                            
STACK+32,15)
+#else
+  LAST_ANON    (         int      , 0xeeee,                            
STACK+36,15)
+#endif
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-12.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-12.c
index a12ccfd..3eddaa2 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-12.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-12.c
@@ -45,16 +45,20 @@ void init_data ()
 #include "abitest.h"
 #else
   PTR(struct z, a, X0, 0)
-  ARG(int, 0xdeadbeef, X1, 1)
-  ARG(int, 0xcafebabe, X2, 2)
-  ARG(int, 0xdeadbabe, X3, 3)
-  ARG(int, 0xcafebeef, X4, 4)
-  ARG(int, 0xbeefdead, X5, 5)
-  ARG(int, 0xbabecafe, X6, LAST_NAMED_ARG_ID)
+  ARG(int, 0xdeadbeef, W1, 1)
+  ARG(int, 0xcafebabe, W2, 2)
+  ARG(int, 0xdeadbabe, W3, 3)
+  ARG(int, 0xcafebeef, W4, 4)
+  ARG(int, 0xbeefdead, W5, 5)
+  ARG(int, 0xbabecafe, W6, LAST_NAMED_ARG_ID)
   DOTS
   PTR_ANON(struct z, b, X7, 7)
   PTR_ANON(struct z, c, STACK, 8)
+#ifndef __AAPCS64_BIG_ENDIAN__
   ANON(int, 0xbabedead, STACK+8, 9)
+#else
+  ANON(int, 0xbabedead, STACK+12, 9)
+#endif
   LAST_ANON(double, 123.45, D0, 10)
 
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-2.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-2.c
index b6da677..e972691 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-2.c
@@ -30,7 +30,7 @@ void init_data ()
 
 #include "abitest.h"
 #else
-  ARG          (         int      , 0xff  ,                            X0,     
   0)
+  ARG          (         int      , 0xff  ,                            W0,     
   0)
   ARG          (         float    , 1.0f  ,                            S0,     
   1)
   ARG          (         float    , 1.0f  ,                            S1,     
   2)
   ARG          (         float    , 1.0f  ,                            S2,     
   3)
@@ -43,17 +43,30 @@ void init_data ()
   ANON         (          __int128, qword.i              ,             X2,     
   8)
   ANON         (  signed long long, 0xa987654321012345LL ,             X4,     
   9)
   ANON         (          __int128, qword.i              ,             X6,     
  10)
+#ifndef __AAPCS64_BIG_ENDIAN__
   ANON_PROMOTED(unsigned char     , 0xfe  , unsigned int, 0xfe       , STACK,  
  11)
   ANON_PROMOTED(  signed char     , sc    ,   signed int, sc_promoted, 
STACK+8,  12)
   ANON_PROMOTED(unsigned short    , 0xdcba, unsigned int, 0xdcba     , 
STACK+16, 13)
   ANON_PROMOTED(  signed short    , ss    ,   signed int, ss_promoted, 
STACK+24, 14)
   ANON         (unsigned int      , 0xdeadbeef,                        
STACK+32, 15)
   ANON         (  signed int      , 0xcafebabe,                        
STACK+40, 16)
+#else
+  ANON_PROMOTED(unsigned char     , 0xfe  , unsigned int, 0xfe       , 
STACK+4,  11)
+  ANON_PROMOTED(  signed char     , sc    ,   signed int, sc_promoted, 
STACK+12, 12)
+  ANON_PROMOTED(unsigned short    , 0xdcba, unsigned int, 0xdcba     , 
STACK+20, 13)
+  ANON_PROMOTED(  signed short    , ss    ,   signed int, ss_promoted, 
STACK+28, 14)
+  ANON         (unsigned int      , 0xdeadbeef,                        
STACK+36, 15)
+  ANON         (  signed int      , 0xcafebabe,                        
STACK+44, 16)
+#endif
   ANON         (unsigned long long, 0xba98765432101234ULL,             
STACK+48, 17)
   ANON_PROMOTED(         float    , fp    ,       double, fp_promoted, 
STACK+56, 18)
   ANON         (         double   , 9876543.212345,                    
STACK+64, 19)
   ANON         (    long double   , 98765432123456789.987654321L,      
STACK+80, 20)
   ANON         (             vf2_t, vf2   ,                            
STACK+96, 21)
   ANON         (             vi4_t, vi4   ,                            
STACK+112,22)
+#ifndef __AAPCS64_BIG_ENDIAN__
   LAST_ANON    (         int      , 0xeeee,                            
STACK+128,23)
+#else
+  LAST_ANON    (         int      , 0xeeee,                            
STACK+132,23)
+#endif
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-3.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-3.c
index 34978c7..8199a8c 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-3.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-3.c
@@ -80,7 +80,15 @@ void init_data ()
   PTR_ANON (struct x2, y2, STACK+24,  9)
   ANON     (union  x3, y3, STACK+32, 10)
   PTR_ANON (union  x4, y4, STACK+40, 11)
+#ifndef __AAPCS64_BIG_ENDIAN__
   ANON     (int      ,  1, STACK+48, 12)
+#else
+  ANON     (int      ,  1, STACK+52, 12)
+#endif
   ANON     (struct x5, y5, STACK+64, 13)
+#ifndef __AAPCS64_BIG_ENDIAN__
   LAST_ANON(int      ,  2, STACK+80, 14)
+#else
+  LAST_ANON(int      ,  2, STACK+84, 14)
+#endif
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-4.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-4.c
index d0e18db..fab3575 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-4.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-4.c
@@ -67,7 +67,7 @@ void init_data ()
 
 #include "abitest.h"
 #else
-  ARG      (int   , 1, X0, LAST_NAMED_ARG_ID)
+  ARG      (int   , 1, W0, LAST_NAMED_ARG_ID)
   DOTS
   /* HFA or HVA passed in fp/simd registers or on stack.  */
   ANON     (struct hfa_fx1_t  , hfa_fx1 ,  S0      , 0)
@@ -89,5 +89,9 @@ void init_data ()
   PTR_ANON (struct non_hfa_ffs_t  , non_hfa_ffs  , STACK+120, 18)
   ANON     (struct non_hfa_ffs_2_t, non_hfa_ffs_2, STACK+128, 19)
   ANON     (union  non_hfa_union_t, non_hfa_union, STACK+144, 20)
+#ifndef __AAPCS64_BIG_ENDIAN__
   LAST_ANON(int                   , 2            , STACK+152, 30)
+#else
+  LAST_ANON(int                   , 2            , STACK+156, 30)
+#endif
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-5.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-5.c
index 6b99a6f..4853f92 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-5.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-5.c
@@ -33,7 +33,7 @@ void init_data ()
 
 #include "abitest.h"
 #else
-  ARG      (int, 1, X0, LAST_NAMED_ARG_ID)
+  ARG      (int, 1, W0, LAST_NAMED_ARG_ID)
   DOTS
   /* HFA passed in fp/simd registers or on stack.  */
   ANON     (struct hfa_dx4_t  , hfa_dx4  , D0      , 0)
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-6.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-6.c
index f94a54a..248915b 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-6.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-6.c
@@ -30,7 +30,7 @@ void init_data ()
 
 #include "abitest.h"
 #else
-  ARG      (int, 1, X0, LAST_NAMED_ARG_ID)
+  ARG      (int, 1, W0, LAST_NAMED_ARG_ID)
   DOTS
   ANON     (struct hfa_ffs_t  , hfa_ffs  , S0     , 0)
   ANON     (union  hfa_union_t, hfa_union, S4     , 1)
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-7.c 
b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-7.c
index b82e7a7..e6a8185 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-7.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-7.c
@@ -15,7 +15,7 @@ _Complex __int128 complex_qword = 567890 + 678901i;
 
 #include "abitest.h"
 #else
-  ARG      (int, 1, X0, LAST_NAMED_ARG_ID)
+  ARG      (int, 1, W0, LAST_NAMED_ARG_ID)
   DOTS
   /* Complex floating-point types are passed in fp/simd registers.  */
   ANON     (_Complex float      , 12.3f + 23.4fi              , S0,  0)
@@ -23,9 +23,9 @@ _Complex __int128 complex_qword = 567890 + 678901i;
   ANON     (_Complex long double, 56789.01234L + 67890.12345Li, Q4,  2)
 
   /* Complex integral types are passed in general registers or via reference.  
*/
-  ANON     (_Complex short      , (short)12345 + (short)23456i, X1, 10)
+  ANON     (_Complex short      , (_Complex short) (12345 + 23456i), X1, 10)
   ANON     (_Complex int        , 34567 + 45678i              , X2, 11)
   PTR_ANON (_Complex __int128   , complex_qword               , X3, 12)
 
-  LAST_ANON(int                 , 1                           , X4, 20)
+  LAST_ANON(int                 , 1                           , W4, 20)
 #endif

Reply via email to