From 931dfb70abce3d979b8fa81e3b7c7dfcfecb0cd4 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Fri, 22 Jun 2018 06:35:42 +0300 Subject: [PATCH] testsuite: pru: Add clobber test gcc/testsuite/ChangeLog: 2020-05-05 Dimitar Dimitrov * gcc.target/pru/clobber-sp.c: New test. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/pru/clobber-sp.c | 24 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.target/pru/clobber-sp.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 092eab69144..97a1ad5078e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-05-05 Dimitar Dimitrov + + * gcc.target/pru/clobber-sp.c: New test. + 2020-05-05 Dimitar Dimitrov * gcc.target/pru/lra-framepointer-fragmentation-1.c: Update test to 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; +} -- 2.30.2