summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-06-28 08:01:44 +0000
committerHans Wennborg <hans@hanshq.net>2012-06-28 08:01:44 +0000
commitf60f6af9e84fe7752edb6fa42464778ac8a53e99 (patch)
tree0fc46d3b32bf750669cf8ad484e64d94c8b54447 /clang/test/CodeGen
parent608c0b65d78531d1713a02f34a9b876deefb4943 (diff)
downloadbcm5719-llvm-f60f6af9e84fe7752edb6fa42464778ac8a53e99.tar.gz
bcm5719-llvm-f60f6af9e84fe7752edb6fa42464778ac8a53e99.zip
Add -ftls-model command-line flag.
This allows for setting the default TLS model. (PR9788) llvm-svn: 159336
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/tls-model.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CodeGen/tls-model.c b/clang/test/CodeGen/tls-model.c
new file mode 100644
index 00000000000..b5bae77e97f
--- /dev/null
+++ b/clang/test/CodeGen/tls-model.c
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-GD
+// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=global-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-GD
+// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=local-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LD
+// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=initial-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-IE
+// RUN: %clang_cc1 %s -triple x86_64-pc-linux-gnu -ftls-model=local-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LE
+
+int __thread x;
+int f() {
+ static int __thread y;
+ return y++;
+}
+int __thread __attribute__((tls_model("initial-exec"))) z;
+
+// CHECK-GD: @f.y = internal thread_local global i32 0
+// CHECK-GD: @x = thread_local global i32 0
+// CHECK-GD: @z = thread_local(initialexec) global i32 0
+
+// CHECK-LD: @f.y = internal thread_local(localdynamic) global i32 0
+// CHECK-LD: @x = thread_local(localdynamic) global i32 0
+// CHECK-LD: @z = thread_local(initialexec) global i32 0
+
+// CHECK-IE: @f.y = internal thread_local(initialexec) global i32 0
+// CHECK-IE: @x = thread_local(initialexec) global i32 0
+// CHECK-IE: @z = thread_local(initialexec) global i32 0
+
+// CHECK-LE: @f.y = internal thread_local(localexec) global i32 0
+// CHECK-LE: @x = thread_local(localexec) global i32 0
+// CHECK-LE: @z = thread_local(initialexec) global i32 0
OpenPOWER on IntegriCloud