public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] testsuite: Extend aapcs64 tests to hybrid
@ 2022-05-06 14:43 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-06 14:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7601a93bdaad20348719dd766a6523b1dcf1ee43

commit 7601a93bdaad20348719dd766a6523b1dcf1ee43
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Wed May 4 15:44:48 2022 +0100

    testsuite: Extend aapcs64 tests to hybrid
    
    This patch adjusts the aapcs64 tests to also run on hybrid. We don't add
    any new tests with this patch, this simply adjusts existing tests to
    also work on hybrid.
    
    We adjust the abitest* code to save the capability registers on hybrid
    (as we do for purecap) and add some __capability annotations to make
    existing purecap tests also valid for hybrid.
    
    There remain issues with the tests involving packed structures (these
    fail even on purecap) that this patch doesn't address.
    
    Note that we remove target selectors from the morello-* tests since (as
    aapcs64.exp already notes) these are ignored when using c-torture-execute, and
    aapcs64.exp already ensures these tests are run on the correct targets.
    
    It is left for follow-on patches to add any hybrid-specific tests (e.g.
    mixing capability and integer pointers, passing capability varargs
    parameters, etc.)

Diff:
---
 gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp          | 4 ++--
 gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h     | 8 ++++++--
 gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S            | 9 +++++++++
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-func-ret-1.c | 2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_1.c     | 4 ++--
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_2.c     | 7 +++----
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_3.c     | 2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_4.c     | 8 ++++----
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_5.c     | 2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_6.c     | 2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_7.c     | 2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_8.c     | 2 +-
 gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h           | 6 +++---
 13 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp
index 141213c1359..60020b4a934 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp
@@ -42,7 +42,7 @@ if { [check_weak_available] } {
     }
     # Using `c-torture-execute` means that target selectors in the files are
     # ignored.
-    if { [ check_effective_target_cheri_capability_pure ] } {
+    if { [ check_effective_target_cheri_capability_any ] } {
 	foreach src [lsort [glob -nocomplain $srcdir/$subdir/morello-test_*.c]] {
 	    if {[runtest_file_p $runtests $src]} {
 		c-torture-execute [list $src \
@@ -91,7 +91,7 @@ if { [check_weak_available] } {
     }
     # Using `c-torture-execute` means that target selectors in the files are
     # ignored.
-    if { [ check_effective_target_cheri_capability_pure ] } {
+    if { [ check_effective_target_cheri_capability_any ] } {
 	foreach src [lsort [glob -nocomplain $srcdir/$subdir/morello-func-ret-*.c]] {
 	    if {[runtest_file_p $runtests $src]} {
 		c-torture-execute [list $src \
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h
index c9faedf4355..d32e6fff3c6 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest-common.h
@@ -78,8 +78,13 @@
 #define C9     496
 
 
-#ifdef __CHERI_PURE_CAPABILITY__
+#ifdef __CHERI__
 #define STACK  512
+#else
+#define STACK  352
+#endif
+
+#ifdef __CHERI_PURE_CAPABILITY__
 #define PTR0 C0
 #define PTR1 C1
 #define PTR2 C2
@@ -90,7 +95,6 @@
 #define PTR7 C7
 #define PTR8 C8
 #else
-#define STACK  352
 #define PTR0 X0
 #define PTR1 X1
 #define PTR2 X2
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S
index 050ecda0e07..9887f9bd3b6 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.S
@@ -89,7 +89,16 @@ dumpregs:
 myfunc:
       mov	x16, sp
       mov	x17, sp
+#ifdef __CHERI__
+      sub	sp,  sp, 528 // 512 for registers and 16 for old sp and lr
+      stp	c8, c9, [x17, #-32]! // 496
+      stp	c6, c7, [x17, #-32]! // 464
+      stp	c4, c5, [x17, #-32]! // 432
+      stp	c2, c3, [x17, #-32]! // 400
+      stp	c0, c1, [x17, #-32]! // 368
+#else
       sub	sp,  sp, 368 // 352 for registers and 16 for old sp and lr
+#endif
 
       sub	x17, x17, 8
       st4	{ v4.h, v5.h, v6.h, v7.h }[0], [x17] //344
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-func-ret-1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-func-ret-1.c
index 8b93b9caedd..3b4ec4a9ddc 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-func-ret-1.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-func-ret-1.c
@@ -3,7 +3,7 @@
    This test covers homogeneous floating-point aggregate types as described
    in AAPCS64 \S 4.3.5.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 /* { dg-additional-sources "abitest.S" } */
 
 #ifndef IN_FRAMEWORK
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_1.c
index fff6dea473a..e1fe9f2ae32 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_1.c
@@ -8,7 +8,7 @@
    This file tests that plain capabilities (i.e. not as part of a composite
    type) are passed as expected.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_1.c"
@@ -20,6 +20,6 @@
   ARG(__uintcap_t, 100, C1)
   ARG(__intcap_t, 100, C2)
   ARG(int, 3, W3)
-  ARG(int *, 0, C4)
+  ARG(int * __capability, 0, C4)
   LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, X5)
 #endif
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 264b99123e4..ceca4f24a83 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_2.c
@@ -11,7 +11,7 @@
    This testcase is part of a set.  morello-test_{2,3,4}.c test passing the
    same structures in different orders to ensure the behaviour is correct.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_2.c"
@@ -25,10 +25,9 @@ struct cap_overlap_cn_t    ocn1 = { 10, 11, 12 };
 #include "abitest.h"
 #else
   ARG(struct cap_no_overlap_nc_t, nc1, C0)
-  PTR(struct cap_overlap_nc_t, onc1, C2)
+  PTR(struct cap_overlap_nc_t, onc1, PTR2)
   ARG(struct cap_no_overlap_cn_t, cn1, C3)
   ARG(struct cap_two_cap_t, tc1, C5)
-  PTR(struct cap_overlap_cn_t, ocn1, C7)
+  PTR(struct cap_overlap_cn_t, ocn1, PTR7)
   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 21f3ee95a2c..8f659838f8d 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_3.c
@@ -11,7 +11,7 @@
    This testcase is part of a set.  morello-test_{2,3,4}.c test passing the same
    structures in different orders to ensure the behaviour is correct.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_3.c"
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 e353e018838..3adae7a618f 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_4.c
@@ -11,7 +11,7 @@
    This testcase is part of a set.  morello-test_{2,3,4}.c test passing the same
    structures in different orders to ensure the behaviour is correct.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_4.c"
@@ -36,8 +36,8 @@ struct cap_large_struct_t  lc1 = { 13, 14, 15 };
   ARG(struct cap_no_overlap_cn_t, cn1, STACK+32)
   ARG(struct cap_two_cap_t,       tc1, STACK+64)
   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)
+  PTR(struct cap_overlap_cn_t,    ocn1, STACK + 96 + sizeof(void*))
+  PTR(struct cap_large_struct_t,    lc1, STACK + 96 + 2*sizeof(void*))
+  LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, STACK + 96 + 3*sizeof(void*))
 #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 d0affc54b13..af42f4a34d3 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_5.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_5.c
@@ -8,7 +8,7 @@
    This file tests that composite types containing capabilities are passed as
    expected.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_5.c"
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 50beed1c2b1..d25d3a4ce5e 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_6.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_6.c
@@ -8,7 +8,7 @@
    This file tests that composite types containing capabilities are passed as
    expected.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_6.c"
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_7.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_7.c
index 73b7b9b2bd1..c48d83d9ccc 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_7.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_7.c
@@ -8,7 +8,7 @@
    This file tests that composite types containing capabilities are passed as
    expected.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_7.c"
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_8.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_8.c
index 90e066b56b9..81779f16316 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_8.c
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/morello-test_8.c
@@ -8,7 +8,7 @@
    This file tests that composite types containing capabilities are passed as
    expected.  */
 
-/* { dg-do run { target { { aarch64*-*-* } && { cheri_capability_pure } } } */
+/* { dg-do run } */
 
 #ifndef IN_FRAMEWORK
 #define TESTFILE "morello-test_8.c"
diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h b/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h
index c147c0b9000..af8a49f904c 100644
--- a/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h
+++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h
@@ -184,19 +184,19 @@ union non_hfa_union_t
   float b;
 };
 
-#ifdef __CHERI_PURE_CAPABILITY__
+#ifdef __CHERI__
 /* Structures containing capabilities.  */
 union cap_no_overlap_union_t
 {
   __uintcap_t uic;
-  int *ip;
+  int * __capability ip;
   int i;
 };
 
 union cap_overlap_union_t
 {
   __uintcap_t uic;
-  int *ip;
+  int * __capability ip;
   struct {
       long long ll1;
       long long ll2;


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

only message in thread, other threads:[~2022-05-06 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 14:43 [gcc(refs/vendors/ARM/heads/morello)] testsuite: Extend aapcs64 tests to hybrid 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).