[v2,4/5] testsuite: pru: Add clobber test

Message ID 20200503161204.18245-5-dimitar@dinux.eu
State New
Headers show
Series
  • Updates for PRU backend
Related show

Commit Message

Dimitar Dimitrov May 3, 2020, 4:12 p.m.
gcc/testsuite/ChangeLog:

2020-05-03  Dimitar Dimitrov  <dimitar@dinux.eu>

	* gcc.target/pru/clobber-sp.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>

---
 gcc/testsuite/gcc.target/pru/clobber-sp.c | 24 +++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/pru/clobber-sp.c

-- 
2.20.1

Patch

diff --git a/gcc/testsuite/gcc.target/pru/clobber-sp.c b/gcc/testsuite/gcc.target/pru/clobber-sp.c
new file mode 100644
index 00000000000..3cc0a60bfc9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/pru/clobber-sp.c
@@ -0,0 +1,24 @@ 
+/* Test inline ASM clobber for SP register */
+
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+/* -O1 in the options is significant.  */
+
+extern void abort (void);
+
+int
+test1 (void)
+{
+  int res;
+
+  /* { dg-warning "listing the stack pointer register 'sp' in a clobber list is deprecated" "" { target pru-*-* } .+2 } */
+  /* { dg-message "note: the value of the stack pointer after an 'asm' statement must be the same as it was before the statement" "" { target pru-*-* } .+1 } */
+  asm volatile(
+	       "ldi	%[res], 101		\n\t"
+	       : [res] "=r" (res)
+	       :
+	       : "sp");
+
+  return res;
+}