PR target/83368
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr54760-4.c
blobbc7cefda5a5e0fe99f399724d0e837a03047b1c6
1 /* Check that the GBR address optimization does not combine a gbr store
2 and its use when a function call is in between, when GBR is a call used
3 register, i.e. it is invalidated by function calls. */
4 /* { dg-do compile } */
5 /* { dg-options "-O1 -fcall-used-gbr" } */
6 /* { dg-final { scan-assembler "stc\tgbr" } } */
8 extern int test00 (void);
9 int
10 test01 (int x)
12 /* We must see a stc gbr,rn before the function call, because
13 a function call could modify the gbr. In this case the user requests
14 the old gbr value, before the function call. */
15 int* p = (int*)__builtin_thread_pointer ();
16 p[5] = test00 ();
17 return 0;