| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-skip-if "dg-require-effective-target loongarch_call36_support" { *-*-* } } */ |
| 3 |
/* { dg-options "-mabi=lp64d -O0 -fpic -fplt -mexplicit-relocs -mcmodel=medium" } */ |
| 4 |
/* { dg-final { scan-assembler "test:.*pcalau12i.*%pc_hi20\\(g\\)\n\tjirl.*pc_lo12\\(g\\)" } } */ |
| 5 |
/* { dg-final { scan-assembler "test1:.*pcalau12i.*%pc_hi20\\(f\\)\n\tjirl.*%pc_lo12\\(f\\)" } } */ |
| 6 |
/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20\\(l\\)\n\tjirl.*%pc_lo12\\(l\\)" } } */ |
| 7 |
/* { dg-final { scan-assembler "test3:.*pcalau12i.*%pc_hi20\\(__tls_get_addr\\)\n\t.*\n\tjirl.*%pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */ |
| 8 |
|
| 9 |
extern void g (void); |
| 10 |
|
| 11 |
void |
| 12 |
f (void) |
| 13 |
{} |
| 14 |
|
| 15 |
static void |
| 16 |
l (void) |
| 17 |
{} |
| 18 |
|
| 19 |
void |
| 20 |
test (void) |
| 21 |
{ |
| 22 |
g (); |
| 23 |
} |
| 24 |
|
| 25 |
void |
| 26 |
test1 (void) |
| 27 |
{ |
| 28 |
f (); |
| 29 |
} |
| 30 |
|
| 31 |
void |
| 32 |
test2 (void) |
| 33 |
{ |
| 34 |
l (); |
| 35 |
} |
| 36 |
|
| 37 |
__attribute__ ((tls_model ("global-dynamic"))) __thread int a; |
| 38 |
|
| 39 |
void |
| 40 |
test3 (void) |
| 41 |
{ |
| 42 |
a = 10; |
| 43 |
} |