aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2020-04-09 14:01:22 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2020-04-09 14:17:48 +0000
commit8b5bc7d12de344707e89c5111649dcc1ae4cd1cd (patch)
tree3bfa41e5463aaac262f6f3e37a97eb1b7b3a6fdd /gcc
parent93674a72309f986c9ace2d6060916053a00da2a1 (diff)
downloadgcc-8b5bc7d12de344707e89c5111649dcc1ae4cd1cd.zip
gcc-8b5bc7d12de344707e89c5111649dcc1ae4cd1cd.tar.gz
gcc-8b5bc7d12de344707e89c5111649dcc1ae4cd1cd.tar.bz2
[testsuite][arm] Fix cmse-15.c expected output
The cmse-15.c testcase fails at -Os because ICF means that we generate nonsecure2: b nonsecure0 which is OK, but does not match the currently expected nonsecure2: ... bl __gnu_cmse_nonsecure_call (see https://gcc.gnu.org/pipermail/gcc-patches/2020-April/543190.html) The test has already different expectations for v8-M and v8.1-M. This patch uses check-function-bodies to account for the different possibilities: - v8-M vs v8.1-M via different target selectors where needed - code generation variants (-0?) via multiple regexps I've tested that the test now passes with --target-board=-march=armv8-m.main and --target-board=-march=armv8.1-m.main.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-15.c152
2 files changed, 150 insertions, 6 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e692a7f..5e56c38 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2020-04-09 Christophe Lyon <christophe.lyon@linaro.org>
+ * gcc.target/arm/cmse/cmse-15.c: Use check-function-bodies.
+
+2020-04-09 Christophe Lyon <christophe.lyon@linaro.org>
+
* lib/scanasm.exp (check-function-bodies): Use non-greedy regexp
when extracting the target selector.
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-15.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-15.c
index 0e37b50..b0fefe5 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/cmse-15.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-15.c
@@ -1,5 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-mcmse" } */
+/* ARMv8-M expectation with target { ! arm_cmse_clear_ok }. */
+/* ARMv8.1-M expectation with target arm_cmse_clear_ok. */
+/* { dg-final { check-function-bodies "**" "" "" } } */
int __attribute__ ((cmse_nonsecure_call)) (*ns_foo) (void);
int (*s_bar) (void);
@@ -11,67 +14,204 @@ typedef int s_bar_t (void);
typedef int __attribute__ ((cmse_nonsecure_call)) (* ns_foo_ptr) (void);
typedef int (*s_bar_ptr) (void);
+/*
+** nonsecure0: { target arm_cmse_clear_ok }
+** ...
+** blxns r[0-3]
+** ...
+*/
+/*
+** nonsecure0: { target { ! arm_cmse_clear_ok } }
+** ...
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
int nonsecure0 (ns_foo_t * ns_foo_p)
{
return ns_foo_p ();
}
+/*
+** nonsecure1: { target arm_cmse_clear_ok }
+** ...
+** blxns r[0-3]
+** ...
+*/
+/*
+** nonsecure1: { target { ! arm_cmse_clear_ok } }
+** ...
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
int nonsecure1 (ns_foo_t ** ns_foo_p)
{
return (*ns_foo_p) ();
}
+/*
+** nonsecure2: { target arm_cmse_clear_ok }
+** ...
+** (
+** blxns r[0-3]
+** |
+** b nonsecure0
+** )
+** ...
+*/
+/*
+** nonsecure2: { target { ! arm_cmse_clear_ok } }
+** ...
+** (
+** bl __gnu_cmse_nonsecure_call
+** |
+** b nonsecure0
+** )
+** ...
+*/
int nonsecure2 (ns_foo_ptr ns_foo_p)
{
return ns_foo_p ();
}
+
+/*
+** nonsecure3: { target arm_cmse_clear_ok }
+** ...
+** blxns r[0-3]
+** ...
+*/
+/*
+** nonsecure3: { target { ! arm_cmse_clear_ok } }
+** ...
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
int nonsecure3 (ns_foo_ptr * ns_foo_p)
{
return (*ns_foo_p) ();
}
+/*
+** secure0:
+** ...
+** (
+** bx r[0-3]
+** |
+** blx r[0-3]
+** )
+** ...
+*/
int secure0 (s_bar_t * s_bar_p)
{
return s_bar_p ();
}
+/*
+** secure1:
+** ...
+** (
+** bx r[0-3]
+** |
+** blx r[0-3]
+** )
+** ...
+*/
int secure1 (s_bar_t ** s_bar_p)
{
return (*s_bar_p) ();
}
+/*
+** secure2:
+** ...
+** (
+** bx r[0-3]
+** |
+** blx r[0-3]
+** |
+** b secure0
+** )
+** ...
+*/
int secure2 (s_bar_ptr s_bar_p)
{
return s_bar_p ();
}
+/*
+** secure3:
+** ...
+** (
+** bx r[0-3]
+** |
+** blx r[0-3]
+** )
+** ...
+*/
int secure3 (s_bar_ptr * s_bar_p)
{
return (*s_bar_p) ();
}
+/*
+** nonsecure4: { target arm_cmse_clear_ok }
+** ...
+** blxns r[0-3]
+** ...
+*/
+/*
+** nonsecure4: { target { ! arm_cmse_clear_ok } }
+** ...
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
int nonsecure4 (void)
{
return ns_foo ();
}
+/*
+** nonsecure5: { target arm_cmse_clear_ok }
+** ...
+** blxns r[0-3]
+** ...
+*/
+/*
+** nonsecure5: { target { ! arm_cmse_clear_ok } }
+** ...
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
int nonsecure5 (void)
{
return (*ns_foo2) ();
}
+/*
+** secure4:
+** ...
+** (
+** bx r[0-3]
+** |
+** blx r[0-3]
+** )
+** ...
+*/
int secure4 (void)
{
return s_bar ();
}
+/*
+** secure5:
+** ...
+** (
+** bx r[0-3]
+** |
+** blx r[0-3]
+** )
+** ...
+*/
int secure5 (void)
{
return (*s_bar2) ();
}
-
-/* ARMv8-M expectation. */
-/* { dg-final { scan-assembler-times "bl\\s+__gnu_cmse_nonsecure_call" 6 { target { ! arm_cmse_clear_ok } } } } */
-
-/* ARMv8.1-M expectation. */
-/* { dg-final { scan-assembler-times "blxns" 6 { target arm_cmse_clear_ok } } } */