Eric Christopher | 7b3982b | 2010-12-02 02:30:43 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s |
Eli Friedman | 56ebe50 | 2009-04-19 21:05:03 +0000 | [diff] [blame] | 2 | |
Eric Christopher | 7b3982b | 2010-12-02 02:30:43 +0000 | [diff] [blame] | 3 | // CHECK: @b = external thread_local global |
| 4 | // CHECK: @d.e = internal thread_local global |
| 5 | // CHECK: @d.f = internal thread_local global |
Hans Wennborg | 5e2d5de | 2012-06-23 11:51:46 +0000 | [diff] [blame] | 6 | // CHECK: @f.a = internal thread_local(initialexec) global |
Eric Christopher | 7b3982b | 2010-12-02 02:30:43 +0000 | [diff] [blame] | 7 | // CHECK: @a = thread_local global |
Hans Wennborg | 5e2d5de | 2012-06-23 11:51:46 +0000 | [diff] [blame] | 8 | // 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 Smith | db4f61f | 2013-04-22 08:06:17 +0000 | [diff] [blame] | 13 | // CHECK-NOT: @_ZTW |
| 14 | // CHECK-NOT: @_ZTH |
| 15 | |
Eli Friedman | 56ebe50 | 2009-04-19 21:05:03 +0000 | [diff] [blame] | 16 | __thread int a; |
| 17 | extern __thread int b; |
Eric Christopher | 7b3982b | 2010-12-02 02:30:43 +0000 | [diff] [blame] | 18 | int c() { return *&b; } |
Eli Friedman | 56ebe50 | 2009-04-19 21:05:03 +0000 | [diff] [blame] | 19 | int d() { |
| 20 | __thread static int e; |
| 21 | __thread static union {float a; int b;} f = {.b = 1}; |
Eric Christopher | 7b3982b | 2010-12-02 02:30:43 +0000 | [diff] [blame] | 22 | return 0; |
Eli Friedman | 56ebe50 | 2009-04-19 21:05:03 +0000 | [diff] [blame] | 23 | } |
| 24 | |
Hans Wennborg | 5e2d5de | 2012-06-23 11:51:46 +0000 | [diff] [blame] | 25 | __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 | |
| 30 | int f() { |
| 31 | __thread static int a __attribute__((tls_model("initial-exec"))); |
| 32 | return a++; |
| 33 | } |