summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr54760-5.c
blob: 30dfd314e751deee5ddff1ba722478020f11231d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Check that the GBR address optimization works when there are multiple
   GBR register definitions and function calls, if the GBR is marked as a
   call saved register.  */
/* { dg-do compile }  */
/* { dg-options "-O1 -fcall-saved-gbr" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */
/* { dg-final { scan-assembler-not "stc\tgbr" } } */

typedef struct
{
  int x, y, z, w;
} tcb_t;

extern void test_00 (void);

int
test_01 (int x, volatile int* y, int a)
{
  if (a)
    test_00 ();

  y[0] = 1;

  tcb_t* tcb = (tcb_t*)__builtin_thread_pointer ();
  return (a & 5) ? tcb->x : tcb->w;
}