summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr54760-6.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/sh/pr54760-6.c')
-rw-r--r--gcc/testsuite/gcc.target/sh/pr54760-6.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/pr54760-6.c b/gcc/testsuite/gcc.target/sh/pr54760-6.c
new file mode 100644
index 00000000000..4bf94c32ec6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr54760-6.c
@@ -0,0 +1,19 @@
+/* Check that the GBR address optimization works when the GBR register
+ definition is not in the same basic block where the GBR memory accesses
+ are. */
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
+/* { dg-final { scan-assembler-not "stc\tgbr" } } */
+
+typedef struct
+{
+ int x, y, z, w;
+} tcb_t;
+
+int
+test_00 (int a, tcb_t* b, int c)
+{
+ tcb_t* tcb = (tcb_t*)__builtin_thread_pointer ();
+ return (a & 5) ? tcb->x : tcb->w;
+}