| 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" } } */ |
| 7 |
|
| 8 |
extern int test00 (void); |
| 9 |
int |
| 10 |
test01 (int x) |
| 11 |
{ |
| 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; |
| 18 |
} |