summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr54760-4.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-19 17:43:20 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-19 17:43:20 +0000
commit37145d627f6c5d809ce70612c1d76770e87fae79 (patch)
tree66418851402566a0a427c03b24cfaa624256cfc4 /gcc/testsuite/gcc.target/sh/pr54760-4.c
parent039efeddc8cee7b04ec48b3362de97e756b6b7e2 (diff)
parent64a31469469fd2e323427ae6a4f4ad12997b0649 (diff)
downloadgcc-37145d627f6c5d809ce70612c1d76770e87fae79.tar.gz
Merge from trunk rev 192612.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/asan@192621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/sh/pr54760-4.c')
-rw-r--r--gcc/testsuite/gcc.target/sh/pr54760-4.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/pr54760-4.c b/gcc/testsuite/gcc.target/sh/pr54760-4.c
new file mode 100644
index 00000000000..3ee36a31389
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr54760-4.c
@@ -0,0 +1,19 @@
+/* Check that the GBR address optimization does not combine a gbr store
+ and its use when a function call is inbetween, when GBR is a call used
+ register, i.e. it is invalidated by function calls. */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O1 -fcall-used-gbr" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
+/* { dg-final { scan-assembler "stc\tgbr" } } */
+
+extern int test00 (void);
+int
+test01 (int x)
+{
+ /* We must see a stc gbr,rn before the function call, because
+ a function call could modify the gbr. In this case the user requests
+ the old gbr value, before the function call. */
+ int* p = (int*)__builtin_thread_pointer ();
+ p[5] = test00 ();
+ return 0;
+}