• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple riscv32 -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -triple riscv64 -emit-llvm -o - %s | FileCheck %s
4 
5 // CHECK: @b = external thread_local global
6 // CHECK: @d.e = internal thread_local global
7 // CHECK: @d.f = internal thread_local global
8 // CHECK: @f.a = internal thread_local(initialexec) global
9 // CHECK: @a = thread_local global
10 // CHECK: @g = thread_local global
11 // CHECK: @h = thread_local(localdynamic) global
12 // CHECK: @i = thread_local(initialexec) global
13 // CHECK: @j = thread_local(localexec) global
14 
15 // CHECK-NOT: @_ZTW
16 // CHECK-NOT: @_ZTH
17 
18 __thread int a;
19 extern __thread int b;
c()20 int c() { return *&b; }
d()21 int d() {
22   __thread static int e;
23   __thread static union {float a; int b;} f = {.b = 1};
24   return 0;
25 }
26 
27 __thread int g __attribute__((tls_model("global-dynamic")));
28 __thread int h __attribute__((tls_model("local-dynamic")));
29 __thread int i __attribute__((tls_model("initial-exec")));
30 __thread int j __attribute__((tls_model("local-exec")));
31 
f()32 int f() {
33   __thread static int a __attribute__((tls_model("initial-exec")));
34   return a++;
35 }
36