blob: 8e21651cd8854e0c7ba818386e092dbf14e15f55 [file] [log] [blame]
Eric Christopher7b3982b2010-12-02 02:30:43 +00001// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
Eli Friedman56ebe502009-04-19 21:05:03 +00002
Eric Christopher7b3982b2010-12-02 02:30:43 +00003// CHECK: @b = external thread_local global
4// CHECK: @d.e = internal thread_local global
5// CHECK: @d.f = internal thread_local global
Hans Wennborg5e2d5de2012-06-23 11:51:46 +00006// CHECK: @f.a = internal thread_local(initialexec) global
Eric Christopher7b3982b2010-12-02 02:30:43 +00007// CHECK: @a = thread_local global
Hans Wennborg5e2d5de2012-06-23 11:51:46 +00008// CHECK: @g = thread_local global
9// CHECK: @h = thread_local(localdynamic) global
10// CHECK: @i = thread_local(initialexec) global
11// CHECK: @j = thread_local(localexec) global
12
Richard Smithdb4f61f2013-04-22 08:06:17 +000013// CHECK-NOT: @_ZTW
14// CHECK-NOT: @_ZTH
15
Eli Friedman56ebe502009-04-19 21:05:03 +000016__thread int a;
17extern __thread int b;
Eric Christopher7b3982b2010-12-02 02:30:43 +000018int c() { return *&b; }
Eli Friedman56ebe502009-04-19 21:05:03 +000019int d() {
20 __thread static int e;
21 __thread static union {float a; int b;} f = {.b = 1};
Eric Christopher7b3982b2010-12-02 02:30:43 +000022 return 0;
Eli Friedman56ebe502009-04-19 21:05:03 +000023}
24
Hans Wennborg5e2d5de2012-06-23 11:51:46 +000025__thread int g __attribute__((tls_model("global-dynamic")));
26__thread int h __attribute__((tls_model("local-dynamic")));
27__thread int i __attribute__((tls_model("initial-exec")));
28__thread int j __attribute__((tls_model("local-exec")));
29
30int f() {
31 __thread static int a __attribute__((tls_model("initial-exec")));
32 return a++;
33}