[22/22] aarch64: Fix nonlocal goto tests incompatible with GCS
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
Commit Message
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/gcs-nonlocal-3.c: New test.
* gcc.target/aarch64/sme/nonlocal_goto_4.c: Update.
* gcc.target/aarch64/sme/nonlocal_goto_5.c: Update.
* gcc.target/aarch64/sme/nonlocal_goto_6.c: Update.
---
.../gcc.target/aarch64/gcs-nonlocal-3.c | 33 +++++++++++++++++++
.../gcc.target/aarch64/sme/nonlocal_goto_4.c | 2 +-
.../gcc.target/aarch64/sme/nonlocal_goto_5.c | 2 +-
.../gcc.target/aarch64/sme/nonlocal_goto_6.c | 2 +-
4 files changed, 36 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-3.c
Comments
Yury Khrustalev <yury.khrustalev@arm.com> writes:
> gcc/testsuite/ChangeLog:
> * gcc.target/aarch64/gcs-nonlocal-3.c: New test.
> * gcc.target/aarch64/sme/nonlocal_goto_4.c: Update.
> * gcc.target/aarch64/sme/nonlocal_goto_5.c: Update.
> * gcc.target/aarch64/sme/nonlocal_goto_6.c: Update.
> ---
> .../gcc.target/aarch64/gcs-nonlocal-3.c | 33 +++++++++++++++++++
> .../gcc.target/aarch64/sme/nonlocal_goto_4.c | 2 +-
> .../gcc.target/aarch64/sme/nonlocal_goto_5.c | 2 +-
> .../gcc.target/aarch64/sme/nonlocal_goto_6.c | 2 +-
> 4 files changed, 36 insertions(+), 3 deletions(-)
> create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-3.c
>
> diff --git a/gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-3.c b/gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-3.c
> new file mode 100644
> index 00000000000..8511f66f66e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-3.c
> @@ -0,0 +1,33 @@
> +/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=gcs" } */
> +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {\.L[0-9]+\:} } } */
> +
> +void run(void (*)());
> +
> +/*
> +** bar.0:
> +** ...
> +** hint 40 // chkfeat x16
> +** tbnz w16, 0, (\.L[0-9]+)
> +** ...
> +** mrs x1, s3_3_c2_c5_1 // gcspr_el0
> +** subs x1, x3, x1
It doesn't look like this choice of registers is guaranteed.
Probably safer as:
** mrs (x[0-9]+), s3_3_c2_c5_1 // gcspr_el0
** subs x[0-9]+, x[0-9]+, \1
(which will throw off the later captures, sorry!)
OK with that change, thanks.
Richard
> +** bne (\.L[0-9]+)\n\1\:
> +** ...
> +** br x[0-9]+\n\2\:
> +** ...
> +** sysl xzr, #3, c7, c7, #1 // gcspopm
> +** ...
> +** b \1
> +*/
> +int
> +foo (int *ptr)
> +{
> + __label__ failure;
> +
> + void bar () { *ptr += 1; goto failure; }
> + run (bar);
> + return 1;
> +
> +failure:
> + return 0;
> +}
> diff --git a/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_4.c b/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_4.c
> index 0446076286b..aed04bb495c 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_4.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_4.c
> @@ -1,4 +1,4 @@
> -/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */
> +/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=none" } */
> /* { dg-final { check-function-bodies "**" "" } } */
>
> void run(void (*)());
> diff --git a/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_5.c b/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_5.c
> index 4246aec8b2f..e4a31c5c600 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_5.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_5.c
> @@ -1,4 +1,4 @@
> -/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */
> +/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=none" } */
> /* { dg-final { check-function-bodies "**" "" } } */
>
> void run(void (*)() __arm_streaming);
> diff --git a/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_6.c b/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_6.c
> index 151e2f22dc7..38f6c139f6d 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_6.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sme/nonlocal_goto_6.c
> @@ -1,4 +1,4 @@
> -/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */
> +/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=none" } */
> /* { dg-final { check-function-bodies "**" "" } } */
>
> void run(void (*)() __arm_streaming_compatible);
new file mode 100644
@@ -0,0 +1,33 @@
+/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=gcs" } */
+/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {\.L[0-9]+\:} } } */
+
+void run(void (*)());
+
+/*
+** bar.0:
+** ...
+** hint 40 // chkfeat x16
+** tbnz w16, 0, (\.L[0-9]+)
+** ...
+** mrs x1, s3_3_c2_c5_1 // gcspr_el0
+** subs x1, x3, x1
+** bne (\.L[0-9]+)\n\1\:
+** ...
+** br x[0-9]+\n\2\:
+** ...
+** sysl xzr, #3, c7, c7, #1 // gcspopm
+** ...
+** b \1
+*/
+int
+foo (int *ptr)
+{
+ __label__ failure;
+
+ void bar () { *ptr += 1; goto failure; }
+ run (bar);
+ return 1;
+
+failure:
+ return 0;
+}
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=none" } */
/* { dg-final { check-function-bodies "**" "" } } */
void run(void (*)());
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=none" } */
/* { dg-final { check-function-bodies "**" "" } } */
void run(void (*)() __arm_streaming);
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2 -mbranch-protection=none" } */
/* { dg-final { check-function-bodies "**" "" } } */
void run(void (*)() __arm_streaming_compatible);