2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr59401-1.c
blob408a270335151e82bc7e0dee7f90987ed748a4d5
1 /* Check that the GBR address optimization does not produce wrong memory
2 accesses. In this case the GBR value must be stored to a normal register
3 and a GBR memory access must not be done. */
4 /* { dg-do compile } */
5 /* { dg-options "-O1" } */
6 /* { dg-final { scan-assembler "stc\tgbr" } } */
7 /* { dg-final { scan-assembler "bf|bt" } } */
9 typedef struct
11 int x, y, z, w;
12 } tcb_t;
14 int
15 test_00 (int a, tcb_t* b)
17 tcb_t* tcb = (a & 5) ? (tcb_t*)__builtin_thread_pointer () : b;
18 return tcb->w + tcb->x;