| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target tls } */ |
| 3 |
/* { dg-skip-if "" { arc*-*-elf* } } */ |
| 4 |
/* { dg-options "-O3 -std=gnu99" } */ |
| 5 |
|
| 6 |
/* Check if addressing the `pos` member of struct is done via tls |
| 7 |
mechanism. */ |
| 8 |
|
| 9 |
struct callchain_cursor |
| 10 |
{ |
| 11 |
int last; |
| 12 |
long long pos; |
| 13 |
} __thread a; |
| 14 |
|
| 15 |
void fn1 (struct callchain_cursor *p1) |
| 16 |
{ |
| 17 |
p1->pos++; |
| 18 |
} |
| 19 |
|
| 20 |
extern void fn3 (void); |
| 21 |
|
| 22 |
void fn2 (void) |
| 23 |
{ |
| 24 |
struct callchain_cursor *b = &a; |
| 25 |
while (1) |
| 26 |
{ |
| 27 |
fn3 (); |
| 28 |
fn1 (b); |
| 29 |
} |
| 30 |
} |
| 31 |
/* { dg-final { scan-assembler "r25,@a@tpoff" } } */ |