public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] testsuite: Fix up aapcs64 tests for purecap
@ 2021-12-10 16:49 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-12-10 16:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:524cde796c0d4bf334959910e58e1af7aecde2c9

commit 524cde796c0d4bf334959910e58e1af7aecde2c9
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Tue Nov 23 16:14:55 2021 +0000

    testsuite: Fix up aapcs64 tests for purecap
    
    This change adjusts the aapcs64 tests to work on purecap Morello, i.e.
    with AAPCS64-cap.
    
    Some changes are made to generic framework code (e.g. the hand-written
    assembly in abitest.S), other changes are to the tests themselves. E.g.
    some tests were checking for indirected arguments in the outgoing
    arguments area instead of using the PTR macro to follow the indirection
    pointer found in a register / the stack.
    
    With this patch applied, there remain only three tests that fail on
    purecap in the aapcs64 testsuite. These are:
    
     - morello-func-ret-1.c: This test uses packed structs containing
       misaligned capabilities which causes GCC to generate misaligned
       capability loads/stores: we need to decide what to do about these.
     - morello-test_7.c: As with morello-func-ret-1.c, this test involves
       packed structs containing underaligned capabilities.
     - rec_align-8.c: A long-standing bug in the compiler, this needs fixing
       up on trunk properly and then backporting to the branch.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/aapcs64/abitest-common.h: Add new PTR<n>
            macros to give the appropraite register for a pointer.
            * gcc.target/aarch64/aapcs64/abitest.S (myfunc): Correct stack
            adjustments for capabilities in the purecap code, use GOT
            indirection when loading symbols.
            * gcc.target/aarch64/aapcs64/func-ret-1.c: X0 -> PTR0 for
            pointer.
            * gcc.target/aarch64/aapcs64/func-ret-4.c: Likewise, X8 -> PTR8.
            * gcc.target/aarch64/aapcs64/macro-def.h: Adjust ANON macros for
            AAPCS64-cap: add new parameter which is the expected offset into
            the AAMA for the parameter.
            * gcc.target/aarch64/aapcs64/morello-test_2.c: Fix up how test
            looks for indirected arguments.
            * gcc.target/aarch64/aapcs64/morello-test_3.c: Likewise.
            * gcc.target/aarch64/aapcs64/morello-test_4.c: Likewise.
            * gcc.target/aarch64/aapcs64/morello-test_5.c: Likewise.
            * gcc.target/aarch64/aapcs64/morello-test_6.c: Likewise.
            * gcc.target/aarch64/aapcs64/test_10.c: Adjust use of ANON
            macros following change to definition.
            * gcc.target/aarch64/aapcs64/test_11.c: Likewise.
            * gcc.target/aarch64/aapcs64/test_17.c: Likewise.
            * gcc.target/aarch64/aapcs64/test_18.c: Use new PTR<n> macro for
            indirect pointer register.
            * gcc.target/aarch64/aapcs64/test_19.c: Update ANON uses.
            * gcc.target/aarch64/aapcs64/test_20.c: Likewise.
            * gcc.target/aarch64/aapcs64/test_23.c: Use PTR<n> macros.
            * gcc.target/aarch64/aapcs64/test_align-8.c: Likewise.
            * gcc.target/aarch64/aapcs64/test_quad_double.c: Update ANON uses.
            * gcc.target/aarch64/aapcs64/va_arg-12.c: Likewise.
            * gcc.target/aarch64/aapcs64/va_arg-3.c: Likewise, adjust stack
            offsets for AAPCS64-cap.
            * gcc.target/aarch64/aapcs64/va_arg-4.c: Likewise.
            * gcc.target/aarch64/aapcs64/va_arg-7.c: Likewise.

Diff:
---
 .../gcc.target/aarch64/aapcs64/abitest-common.h    | 18 +++++++
 gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S | 28 +++++------
 .../gcc.target/aarch64/aapcs64/func-ret-1.c        |  2 +-
 .../gcc.target/aarch64/aapcs64/func-ret-4.c        |  2 +-
 .../gcc.target/aarch64/aapcs64/macro-def.h         | 55 ++++++++++++++++++----
 .../gcc.target/aarch64/aapcs64/morello-test_2.c    |  9 ++--
 .../gcc.target/aarch64/aapcs64/morello-test_3.c    |  6 +--
 .../gcc.target/aarch64/aapcs64/morello-test_4.c    |  8 ++--
 .../gcc.target/aarch64/aapcs64/morello-test_5.c    |  2 +-
 .../gcc.target/aarch64/aapcs64/morello-test_6.c    |  2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/test_10.c |  8 ++--
 gcc/testsuite/gcc.target/aarch64/aapcs64/test_11.c |  6 +--
 gcc/testsuite/gcc.target/aarch64/aapcs64/test_17.c | 10 ++--
 gcc/testsuite/gcc.target/aarch64/aapcs64/test_18.c |  2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/test_19.c | 10 ++--
 gcc/testsuite/gcc.target/aarch64/aapcs64/test_20.c |  4 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/test_23.c |  2 +-
 .../gcc.target/aarch64/aapcs64/test_align-8.c      |  2 +-
 .../gcc.target/aarch64/aapcs64/test_quad_double.c  |  4 +-
 .../gcc.target/aarch64/aapcs64/va_arg-12.c         |  6 +--
 .../gcc.target/aarch64/aapcs64/va_arg-3.c          | 14 +++++-
 .../gcc.target/aarch64/aapcs64/va_arg-4.c          | 13 ++++-
 .../gcc.target/aarch64/aapcs64/va_arg-7.c          |  2 +-
 23 files changed, 145 insertions(+), 70 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h
index ba84e19ba47..c9faedf4355 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h
@@ -80,8 +80,26 @@
 
 #ifdef __CHERI_PURE_CAPABILITY__
 #define STACK  512
+#define PTR0 C0
+#define PTR1 C1
+#define PTR2 C2
+#define PTR3 C3
+#define PTR4 C4
+#define PTR5 C5
+#define PTR6 C6
+#define PTR7 C7
+#define PTR8 C8
 #else
 #define STACK  352
+#define PTR0 X0
+#define PTR1 X1
+#define PTR2 X2
+#define PTR3 X3
+#define PTR4 X4
+#define PTR5 X5
+#define PTR6 X6
+#define PTR7 X7
+#define PTR8 X8
 #endif
 
 /* The type of test.  'myfunc' in abitest.S needs to know which kind of
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S
index 623ef9bacbe..050ecda0e07 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S
@@ -17,11 +17,11 @@ myfunc:
       mov	c17, csp
       sub	csp,  csp, 544 // 512 for registers and 32 for old csp and lr
 
-      stp	c8, c9, [c17, #-16]! // 480
-      stp	c6, c7, [c17, #-16]! // 448
-      stp	c4, c5, [c17, #-16]! // 416
-      stp	c2, c3, [c17, #-16]! // 384
-      stp	c0, c1, [c17, #-16]! // 352
+      stp	c8, c9, [c17, #-32]! // 480
+      stp	c6, c7, [c17, #-32]! // 448
+      stp	c4, c5, [c17, #-32]! // 416
+      stp	c2, c3, [c17, #-32]! // 384
+      stp	c0, c1, [c17, #-32]! // 352
 
       sub	c17, c17, 8
       st4	{ v4.h, v5.h, v6.h, v7.h }[0], [c17] //344
@@ -55,25 +55,25 @@ myfunc:
       stp	d2, d3, [c17, #-16]! // 16
       stp	d0, d1, [c17, #-16]! //  0
 
-      add	c0, csp,  #16
-      stp	c16, c30, [c17, #-16]!
+      add	c0, csp,  #32
+      stp	c16, c30, [c17, #-32]!
 
-      adrp	c9, which_kind_of_test		// determine the type of test
-      add	c9, c9, :lo12:which_kind_of_test
+      adrp	c9, :got:which_kind_of_test		// determine the type of test
+      ldr	c9, [c9, #:got_lo12:which_kind_of_test]
       ldr	w9, [c9, #0]
       cmp	w9, #1
       bgt	LABEL_TEST_FUNC_RETURN
       bl	testfunc			// parameter passing test or va_arg code gen test
       b		LABEL_RET
 LABEL_TEST_FUNC_RETURN:
-      adrp	c9, testfunc_ptr
-      add	c9, c9, :lo12:testfunc_ptr
+      adrp	c9, :got:testfunc_ptr
+      ldr	c9, [c9, #:got_lo12:testfunc_ptr]
       ldr	c9, [c9, #0]
       blr	c9				// function return value test
-      adrp	c9, saved_return_address
-      add	c9, c9, :lo12:saved_return_address
+      adrp	c9, :got:saved_return_address
+      ldr	c9, [c9, #:got_lo12:saved_return_address]
       ldr	c9, [c9, #0]
-      str	c9, [csp, #8]			// Update the copy of LR reg saved on stack
+      str	c9, [csp, #16]			// Update the copy of LR reg saved on stack
 LABEL_RET:
       ldp	c0, c30, [csp]
       mov	csp, c0
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c
index 29a1ca6d45b..cbd0cb9cb50 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c
@@ -42,7 +42,7 @@ FUNC_VAL_CHECK (10,        double, 9876543.212345, D0, flat)
 FUNC_VAL_CHECK (11,   long double, 98765432123456789.987654321L, Q0, flat)
 FUNC_VAL_CHECK (12,         vf2_t,        vf2, D0, f32in64)
 FUNC_VAL_CHECK (13,         vi4_t,        vi4, Q0, i32in128)
-FUNC_VAL_CHECK (14,         int *,    int_ptr, X0, flat)
+FUNC_VAL_CHECK (14,         int *,    int_ptr, PTR0, flat)
 FUNC_VAL_CHECK (15,         vlf1_t,    vlf1, Q0, flat)
 FUNC_VAL_CHECK (16,         __fp16,    0xabcd, H0, flat)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-4.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-4.c
index af05fbe9fdf..47e237f41cf 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-4.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-4.c
@@ -22,6 +22,6 @@ FUNC_VAL_CHECK ( 2, _Complex long double, 56789.01234 + 67890.12345i, Q0, flat)
      X8.  */
 FUNC_VAL_CHECK (10, _Complex short , 12345 + 23456i, X0, flat)
 FUNC_VAL_CHECK (11, _Complex int   , 34567 + 45678i, X0, flat)
-FUNC_VAL_CHECK (12, _Complex __int128, 567890 + 678901i, X8, flat)
+FUNC_VAL_CHECK (12, _Complex __int128, 567890 + 678901i, PTR8, flat)
 
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/macro-def.h b/gcc/testsuite/gcc.target/aarch64/aapcs64/macro-def.h
index 72a47067631..45819371923 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/macro-def.h
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/macro-def.h
@@ -58,8 +58,48 @@
 								  __VA_ARGS__)
 #define ARG(type,val,offset,...) LAST_ARG_NONFLAT(type, val, offset, \
 						  flat, __VA_ARGS__)
-#define ANON(type,val,offset,...) LAST_ARG(type, val, offset, __VA_ARGS__)
-#define LAST_ANON(type,val,offset,...) LAST_ARG(type, val, offset, __VA_ARGS__)
+
+/* For AAPCS64-cap, we specialise the anonymous argument macros to check that
+   the arguments are passed as expected. The user simply needs to provide the
+   offset into the Anonymous Argument Memory Area at which they expect to find
+   the given argument.
+
+   Note that we don't override the macros for AAPCS64_TEST_STDARG tests: for
+   those tests, the __builtin_va_{start,arg,end} functions are used to extract
+   the variadic arguments and pass them to a non-variadic function, where we
+   simply check that the arguments end up in the expected registers for such a
+   function. Hence, we don't need to extract the incoming variadic arguments
+   manually.  */
+#if defined(__CHERI_PURE_CAPABILITY__) && !defined(AAPCS64_TEST_STDARG)
+
+#define LAST_ANON(type,val,ignored,offset,...)	  \
+{						  \
+  type __x = val;				  \
+  void *ptr = *(void **)(stack + C9) + offset;	  \
+  if (sizeof (type) > 16 || _Alignof (type) > 16) \
+    ptr = *(void **)ptr;			  \
+  if (memcmp (&__x, ptr, sizeof (type)) != 0)	  \
+    abort ();					  \
+}
+
+/* For AAPCS64-cap, treat PTR_ANON as with any other anonymous argument: the
+   PTR-ness only matters for the base PCS. This is because LAST_ANON itself
+   handles any indirection required by AAPCS64-cap automatically, and any
+   arguments that would be indirected in the base PCS are also indirected in
+   AAPCS64-cap.  */
+#define PTR_ANON(type,val,a64_off,c64_off) \
+  LAST_ANON(type, val, a64_off, c64_off)
+
+#else
+
+#define LAST_ANON(type,val,offset,ignored,...) LAST_ARG(type, val, offset, __VA_ARGS__)
+#define PTR_ANON(type, val,offset,ignored,...) PTR(type, val, offset, __VA_ARGS__)
+
+#endif
+
+#define ANON(type,val,a64_off,c64_off,...) \
+  LAST_ANON(type, val, a64_off, c64_off, __VA_ARGS__)
+
 #define ANON_PROMOTED(type,val,type_promoted, val_promoted, offset,...)	\
   ANON(type_promoted, val_promoted, offset, __VA_ARGS__)
 /* Composite larger than 16 bytes is replaced by a pointer to a copy prepared
@@ -71,7 +111,6 @@
   ptr = *(type **)(stack + offset);					\
   if (memcmp (ptr, &val, sizeof (type)) != 0) abort ();			\
 }
-#define PTR_ANON(type, val, offset, ...) PTR(type, val, offset, __VA_ARGS__)
 #define LAST_ANONPTR(type, val, offset, ...) PTR(type, val, offset, __VA_ARGS__)
 #define DOTS
 
@@ -98,10 +137,10 @@
 #define ARG(type,val,offset) LAST_ARG(type, val, offset),
 #define ARG_NONFLAT(type, val, offset, layout) LAST_ARG (type, val, offset),
 #define DOTS ...
-#define ANON(type,val, offset)
-#define LAST_ANON(type,val, offset)
+#define ANON(type,val,a64_off,c64_off)
+#define LAST_ANON(type,val,a64_off,c64_off)
 #define PTR(type, val, offset) LAST_ARG(type, val, offset),
-#define PTR_ANON(type, val, offset)
+#define PTR_ANON(type, val, a64_off, c64_off)
 #define LAST_ANONPTR(type, val, offset)
 
 #endif /* AARCH64_MACRO_DEF_GEN_PARAM_TYPE_LIST */
@@ -130,8 +169,8 @@
 							     offset, \
 							     __VA_ARGS__),
 #define DOTS
-#define LAST_ANON(type,val,offset,...) LAST_ARG(type, val, offset, __VA_ARGS__)
-#define ANON(type,val,offset,...) LAST_ARG(type, val, offset, __VA_ARGS__),
+#define LAST_ANON(type,val,a64_off,c64_off,...) LAST_ARG(type, val, a64_off, __VA_ARGS__)
+#define ANON(type,val,a64_off,c64_off,...) LAST_ARG(type, val, a64_off, __VA_ARGS__),
 #define PTR(type, val,offset,...) LAST_ARG(type, val, offset, __VA_ARGS__),
 #define PTR_ANON(type, val,offset,...) LAST_ARG(type, val, offset, __VA_ARGS__),
 #define LAST_ANONPTR(type, val, offset,...) LAST_ARG(type, val, offset, __VA_ARGS__)
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_2.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_2.c
index 981ae3fbecc..264b99123e4 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_2.c
@@ -25,13 +25,10 @@ struct cap_overlap_cn_t    ocn1 = { 10, 11, 12 };
 #include "abitest.h"
 #else
   ARG(struct cap_no_overlap_nc_t, nc1, C0)
-  /* TODO Passed on stack, but given pointer as argument
-     Want to check both of these attributes, here only check that passed on
-     stack.  */
-  ARG(struct cap_overlap_nc_t, onc1, STACK)
+  PTR(struct cap_overlap_nc_t, onc1, C2)
   ARG(struct cap_no_overlap_cn_t, cn1, C3)
   ARG(struct cap_two_cap_t, tc1, C5)
-  ARG(struct cap_overlap_cn_t, ocn1, STACK+32)
-  LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, STACK+64)
+  PTR(struct cap_overlap_cn_t, ocn1, C7)
+  LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, STACK)
 #endif
 
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_3.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_3.c
index fc1ffc4349f..21f3ee95a2c 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_3.c
@@ -28,9 +28,9 @@ struct cap_large_struct_t  lc1 = { 13, 14, 15 };
   /* Main point of this test is to check passing cap_overlap_cn_t when NGRN has
      not been filled.  */
   ARG(struct cap_two_cap_t, tc1, C0)
-  ARG(struct cap_overlap_cn_t, ocn1, STACK)
+  PTR(struct cap_overlap_cn_t, ocn1, C2)
   ARG(struct cap_no_overlap_cn_t, cn1, C3)
-  ARG(struct cap_large_struct_t, lc1, STACK+32)
-  LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, X5)
+  PTR(struct cap_large_struct_t, lc1, C5)
+  LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, X6)
 #endif
 
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_4.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_4.c
index 972a591c6b7..e353e018838 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_4.c
@@ -35,9 +35,9 @@ struct cap_large_struct_t  lc1 = { 13, 14, 15 };
   ARG(struct cap_no_overlap_nc_t, nc1, STACK)
   ARG(struct cap_no_overlap_cn_t, cn1, STACK+32)
   ARG(struct cap_two_cap_t,       tc1, STACK+64)
-  ARG(struct cap_overlap_nc_t,    onc1, STACK+96)
-  ARG(struct cap_overlap_cn_t,    ocn1, STACK+128)
-  ARG(struct cap_large_struct_t,    lc1, STACK+160)
-  LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, STACK+208)
+  PTR(struct cap_overlap_nc_t,    onc1, STACK+96)
+  PTR(struct cap_overlap_cn_t,    ocn1, STACK+112)
+  PTR(struct cap_large_struct_t,    lc1, STACK+128)
+  LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, STACK+144)
 #endif
 
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_5.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_5.c
index da79667b361..d0affc54b13 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_5.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_5.c
@@ -19,7 +19,7 @@ union cap_overlap_union_t    n2 = { .uic = 2 };
 #include "abitest.h"
 #else
   ARG(union cap_no_overlap_union_t, n1, C0)
-  ARG(union cap_overlap_union_t, n2, STACK)
+  PTR(union cap_overlap_union_t, n2, C1)
   LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, X2)
 #endif
 
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_6.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_6.c
index ce9024c0d42..50beed1c2b1 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_6.c
@@ -28,7 +28,7 @@ union cap_overlap_union_t    n2 = { .uic = 2 };
   ARG(int, 6, X6)
   ARG(int, 7, X7)
   ARG(union cap_no_overlap_union_t, n1, STACK)
-  ARG(union cap_overlap_union_t, n2, STACK+16)
+  PTR(union cap_overlap_union_t, n2, STACK+16)
   ARG(union cap_no_overlap_union_t, n1, STACK+32)
   LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, STACK+48)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_10.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_10.c
index c2f48154a0a..01c08d2c63a 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_10.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_10.c
@@ -19,8 +19,8 @@ struct z b = { 9.0, 10.0, 11.0, 12.0 };
 
   ARG(int, 7, W0)
   DOTS
-  ANON(struct z, a, D0)
-  ANON(struct z, b, D4)
-  ANON(double, 0.5, STACK)
-  LAST_ANON(double, 1.5, STACK+8)
+  ANON(struct z, a, D0, 0)
+  ANON(struct z, b, D4, 16)
+  ANON(double, 0.5, STACK, 32)
+  LAST_ANON(double, 1.5, STACK+8, 48)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_11.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_11.c
index 34cbe0303b9..5990ba79704 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_11.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_11.c
@@ -28,7 +28,7 @@ struct z b = { 9.0, 10.0, 11.0, 12.0 };
 #else
   ARG(double, 11.0, D0)
   DOTS
-  ANON(struct z, a, D1)
-  ANON(struct z, b, STACK)
-  LAST_ANON(double, 0.5, STACK+32)
+  ANON(struct z, a, D1, 0)
+  ANON(struct z, b, STACK, 16)
+  LAST_ANON(double, 0.5, STACK+32, 32)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_17.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_17.c
index 348ea284760..4b64a003a82 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_17.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_17.c
@@ -29,9 +29,9 @@ struct z b = { 9.0, 10.0, 11.0, 12.0 };
 #else
   ARG(double, 11.0, D0)
   DOTS
-  ANON(struct z, a, D1)
-  ANON(struct z, b, STACK)
-  ANON(int , 5, W0)
-  ANON(double, f1, STACK+32)
-  LAST_ANON(double, 0.5, STACK+40)
+  ANON(struct z, a, D1, 0)
+  ANON(struct z, b, STACK, 16)
+  ANON(int , 5, W0, 32)
+  ANON(double, f1, STACK+32, 48)
+  LAST_ANON(double, 0.5, STACK+40, 64)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_18.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_18.c
index 2ebecee63e5..2c50475fac8 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_18.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_18.c
@@ -26,7 +26,7 @@ struct z b = { 9.0, 10.0, 11.0, 12.0 };
 #include "abitest.h"
 #else
   ARG(int, 7, W0)
-  PTR(struct y, v, X1)
+  PTR(struct y, v, PTR1)
   ARG(struct z, a, D0)
   ARG(double, 1.0, D4)
   ARG(struct z, b, STACK)
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_19.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_19.c
index 1a3f873b301..5df549dc867 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_19.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_19.c
@@ -27,9 +27,9 @@ struct z b = { 9.0, 10.0, 11.0, 12.0 };
 #else
   ARG(int, 7, W0)
   DOTS
-  ANON(double, 4.0, D0)
-  ANON(struct z, a, D1)
-  ANON(struct z, b, STACK)
-  PTR_ANON(struct y, v, X1)
-  LAST_ANON(int, 10, W2)
+  ANON(double, 4.0, D0, 0)
+  ANON(struct z, a, D1, 16)
+  ANON(struct z, b, STACK, 32)
+  PTR_ANON(struct y, v, X1, 48)
+  LAST_ANON(int, 10, W2, 64)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_20.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_20.c
index e4cc1a1b5dd..93891060914 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_20.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_20.c
@@ -17,6 +17,6 @@
   ARG(double, 6.0, D5)
   ARG(double, 7.0, D6)
   DOTS
-  ANON(_Complex double, 1234.0 + 567.0i, STACK)
-  LAST_ANON(double, -987.0, STACK+16)
+  ANON(_Complex double, 1234.0 + 567.0i, STACK, 0)
+  LAST_ANON(double, -987.0, STACK+16, 16)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_23.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_23.c
index fd45cc509e1..79f75b30a5d 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_23.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_23.c
@@ -37,6 +37,6 @@ void init_data ()
 #include "abitest.h"
 #else
 ARG (float, 123.0f, S0)
-PTR (A, u.a, X0)
+PTR (A, u.a, PTR0)
 LAST_ARG_NONFLAT (int, 0xdeadbeef, X1, i32in64)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c
index ad4dfe4b62c..1cc0fdf77d1 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align-8.c
@@ -28,6 +28,6 @@ overaligned a = { 2, 3 };
 #else
   ARG (int, 7, W0)
   /* Alignment should be 8.  */
-  PTR (overaligned, a, X1)
+  PTR (overaligned, a, PTR1)
   LAST_ARG (int, 9, W2)
 #endif
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double.c
index 109cea0b5c5..a77ecf6b736 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double.c
@@ -21,6 +21,6 @@ CTFtype cy = 5.0 + 6.0i;
   ARG       ( TFtype,  x, Q0)
   ARG       (CTFtype, cx, Q1)
   DOTS
-  ANON      (CTFtype, cy, Q3)
-  LAST_ANON ( TFtype,  y, Q5)
+  ANON      (CTFtype, cy, Q3, 0)
+  LAST_ANON ( TFtype,  y, Q5, 16)
 #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 3eddaa2c1d5..fe689ac0e4b 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-12.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-12.c
@@ -44,7 +44,7 @@ void init_data ()
 
 #include "abitest.h"
 #else
-  PTR(struct z, a, X0, 0)
+  PTR(struct z, a, PTR0, 0)
   ARG(int, 0xdeadbeef, W1, 1)
   ARG(int, 0xcafebabe, W2, 2)
   ARG(int, 0xdeadbabe, W3, 3)
@@ -52,10 +52,10 @@ void init_data ()
   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, b, PTR7, 7)
   PTR_ANON(struct z, c, STACK, 8)
 #ifndef __AAPCS64_BIG_ENDIAN__
-  ANON(int, 0xbabedead, STACK+8, 9)
+  ANON(int, 0xbabedead, STACK + sizeof (void*), 9)
 #else
   ANON(int, 0xbabedead, STACK+12, 9)
 #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 8199a8c3ec2..572a6e02aee 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-3.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-3.c
@@ -71,12 +71,21 @@ void init_data ()
   DOTS
   ANON     (struct x0, y0, X0,        1)
   ANON     (struct x1, y1, X1,        2)
-  PTR_ANON (struct x2, y2, X3,        3)
+  PTR_ANON (struct x2, y2, PTR3,      3)
   ANON     (union  x3, y3, X4,        4)
-  PTR_ANON (union  x4, y4, X5,        5)
+  PTR_ANON (union  x4, y4, PTR5,      5)
   ANON     (struct x5, y5, X6,        6)
   ANON     (struct x0, y0, STACK,     7)
   ANON     (struct x1, y1, STACK+8,   8)
+
+#ifdef __CHERI_PURE_CAPABILITY__
+  PTR_ANON (struct x2, y2, STACK+32,  9)
+  ANON	   (union  x3, y3, STACK+48,  10)
+  PTR_ANON (union  x4, y4, STACK+64,  11)
+  ANON	   (int	    ,   1, STACK+80,  12)
+  ANON	   (struct x5, y5, STACK+96,  13)
+  LAST_ANON (int    ,   2, STACK+112, 14)
+#else
   PTR_ANON (struct x2, y2, STACK+24,  9)
   ANON     (union  x3, y3, STACK+32, 10)
   PTR_ANON (union  x4, y4, STACK+40, 11)
@@ -92,3 +101,4 @@ void init_data ()
   LAST_ANON(int      ,  2, STACK+84, 14)
 #endif
 #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 010ad8b3f67..07275087d6a 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-4.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-4.c
@@ -82,12 +82,22 @@ void init_data ()
   ANON     (union  hfa_union_t, hfa_union, STACK+48, 5)
   ANON     (struct hfa_ldx3_t , hfa_ldx3 , STACK+64, 6)
   /* Non-H[FV]A passed in general registers or on stack or via reference.  */
-  PTR_ANON (struct non_hfa_fx5_t  , non_hfa_fx5  , X1       , 10)
+  PTR_ANON (struct non_hfa_fx5_t  , non_hfa_fx5  , PTR1       , 10)
   ANON     (struct non_hfa_ffd_t  , non_hfa_ffd  , X2       , 13)
   ANON     (struct non_hfa_ii_t   , non_hfa_ii   , X4       , 14)
   ANON     (struct non_hfa_c_t    , non_hfa_c    , X5       , 15)
   ANON     (struct non_hfa_ffvf2_t, non_hfa_ffvf2, X6       , 16)
   PTR_ANON (struct non_hfa_fffd_t , non_hfa_fffd , STACK+112, 17)
+
+#ifdef __CHERI_PURE_CAPABILITY__
+  PTR_ANON (struct non_hfa_ffs_t  , non_hfa_ffs  , STACK+128, 18)
+  ANON     (struct non_hfa_ffs_2_t, non_hfa_ffs_2, STACK+144, 19)
+  ANON     (union  non_hfa_union_t, non_hfa_union, STACK+160, 20)
+  /* HFA of __fp16 passed on stack, directed __fp16 test is va_arg-10.c.  */
+  ANON     (struct hfa_f16x2_t    , hfa_f16x2    , STACK+168, 21)
+  ANON     (struct hfa_f16x3_t    , hfa_f16x3    , STACK+176, 22)
+  LAST_ANON(int                   , 2            , STACK+184, 30)
+#else
   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)
@@ -100,3 +110,4 @@ void init_data ()
   LAST_ANON(int                   , 2            , STACK+172, 30)
 #endif
 #endif
+#endif
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 e6a8185e578..b2116b3c9a4 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-7.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-7.c
@@ -25,7 +25,7 @@ _Complex __int128 complex_qword = 567890 + 678901i;
   /* Complex integral types are passed in general registers or via reference.  */
   ANON     (_Complex short      , (_Complex short) (12345 + 23456i), X1, 10)
   ANON     (_Complex int        , 34567 + 45678i              , X2, 11)
-  PTR_ANON (_Complex __int128   , complex_qword               , X3, 12)
+  PTR_ANON (_Complex __int128   , complex_qword               , PTR3, 12)
 
   LAST_ANON(int                 , 1                           , W4, 20)
 #endif


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-10 16:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 16:49 [gcc(refs/vendors/ARM/heads/morello)] testsuite: Fix up aapcs64 tests for purecap Matthew Malcomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).