summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/thread-specifier.c
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-06-23 11:51:46 +0000
committerHans Wennborg <hans@hanshq.net>2012-06-23 11:51:46 +0000
commitd3b01bc7c6735a78ebdff0071647a15de5716bc7 (patch)
tree1bea08b4886b9dac974ae24ea644795b8b2fd0f6 /clang/test/CodeGen/thread-specifier.c
parentcbe34b4cc98148b386a0c96cd195e7f62f52a6e3 (diff)
downloadbcm5719-llvm-d3b01bc7c6735a78ebdff0071647a15de5716bc7.tar.gz
bcm5719-llvm-d3b01bc7c6735a78ebdff0071647a15de5716bc7.zip
Support the tls_model attribute (PR9788)
This adds support for the tls_model attribute. This allows the user to choose a TLS model that is better than what LLVM would select by default. For example, a variable might be declared as: __thread int x __attribute__((tls_model("initial-exec"))); if it will not be used in a shared library that is dlopen'ed. This depends on LLVM r159077. llvm-svn: 159078
Diffstat (limited to 'clang/test/CodeGen/thread-specifier.c')
-rw-r--r--clang/test/CodeGen/thread-specifier.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/CodeGen/thread-specifier.c b/clang/test/CodeGen/thread-specifier.c
index a1f3e168000..a2d3e62c8c5 100644
--- a/clang/test/CodeGen/thread-specifier.c
+++ b/clang/test/CodeGen/thread-specifier.c
@@ -3,7 +3,13 @@
// CHECK: @b = external thread_local global
// CHECK: @d.e = internal thread_local global
// CHECK: @d.f = internal thread_local global
+// CHECK: @f.a = internal thread_local(initialexec) global
// CHECK: @a = thread_local global
+// CHECK: @g = thread_local global
+// CHECK: @h = thread_local(localdynamic) global
+// CHECK: @i = thread_local(initialexec) global
+// CHECK: @j = thread_local(localexec) global
+
__thread int a;
extern __thread int b;
int c() { return *&b; }
@@ -13,3 +19,12 @@ int d() {
return 0;
}
+__thread int g __attribute__((tls_model("global-dynamic")));
+__thread int h __attribute__((tls_model("local-dynamic")));
+__thread int i __attribute__((tls_model("initial-exec")));
+__thread int j __attribute__((tls_model("local-exec")));
+
+int f() {
+ __thread static int a __attribute__((tls_model("initial-exec")));
+ return a++;
+}
OpenPOWER on IntegriCloud