| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target tls_native } */ |
| 3 |
/* { dg-options "-mtls-direct-seg-refs -O2 -masm=att" } */ |
| 4 |
|
| 5 |
int* |
| 6 |
foo1 () |
| 7 |
{ |
| 8 |
return (int*) __builtin_thread_pointer (); |
| 9 |
} |
| 10 |
|
| 11 |
/* { dg-final { scan-assembler "mov\[lq\]\[ \t\]*%\[fg\]s:0, %\[re\]ax" } } */ |
| 12 |
|
| 13 |
int |
| 14 |
foo2 () |
| 15 |
{ |
| 16 |
int* p = (int*) __builtin_thread_pointer (); |
| 17 |
return p[4]; |
| 18 |
} |
| 19 |
|
| 20 |
/* { dg-final { scan-assembler "movl\[ \t\]*%\[fg\]s:16, %eax" } } */ |
| 21 |
|
| 22 |
int |
| 23 |
foo3 (int i) |
| 24 |
{ |
| 25 |
int* p = (int*) __builtin_thread_pointer (); |
| 26 |
return p[i]; |
| 27 |
} |
| 28 |
|
| 29 |
/* { dg-final { scan-assembler "movl\[ \t\]*%\[fg\]s:0\\(,%\[a-z0-9\]*,4\\), %eax" { target { ! x32 } } } } */ |
| 30 |
/* { dg-final { scan-assembler-not "movl\[ \t\]*%fs:0\\(,%\[a-z0-9\]*,4\\), %eax" { target x32 } } } */ |
| 31 |
/* { dg-final { scan-assembler "movl\[ \t\]*\\(%eax,%edi,4\\), %eax" { target x32 } } } */ |