aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sparc/tls-ld-int64.c
blob: c1925df084fb2a0cd6702ab82a658d4b3a0f5c20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do compile } */
/* { dg-options "-O2" }
/* { dg-add-options tls } */
/* { dg-require-effective-target lp64 } */

#include <stdint.h>

__thread int64_t var1 __attribute__((tls_model("local-dynamic")));
__thread int64_t var2 __attribute__((tls_model("local-dynamic")));

int64_t sum (void)
{
  return var1 + var2;
}

void set (int64_t i)
{
  var1 = i;
  var2 = i;
}

/* { dg-final { scan-assembler-times "__tls_get_addr" 2 } } */
/* { dg-final { scan-assembler-times "ldx\t\[^\n\]*tldo_add" 2 } } */
/* { dg-final { scan-assembler-times "stx\t\[^\n\]*tldo_add" 2 } } */