summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Hexagon
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-02-18 15:42:57 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-02-18 15:42:57 +0000
commit7a737d1abb55e3f8962ebdc71f2d2a125f2d2872 (patch)
tree6169a7409d5920c2d5e67702a3800eb6e51296a5 /llvm/test/CodeGen/Hexagon
parent72dae62b8ad99c2cde043f0a220c37d104c82950 (diff)
downloadbcm5719-llvm-7a737d1abb55e3f8962ebdc71f2d2a125f2d2872.tar.gz
bcm5719-llvm-7a737d1abb55e3f8962ebdc71f2d2a125f2d2872.zip
[Hexagon] Implement TLS support
Patch by Anand Kodnani. llvm-svn: 261218
Diffstat (limited to 'llvm/test/CodeGen/Hexagon')
-rw-r--r--llvm/test/CodeGen/Hexagon/tls_pic.ll37
-rw-r--r--llvm/test/CodeGen/Hexagon/tls_static.ll28
2 files changed, 65 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Hexagon/tls_pic.ll b/llvm/test/CodeGen/Hexagon/tls_pic.ll
new file mode 100644
index 00000000000..87f7813cf0b
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/tls_pic.ll
@@ -0,0 +1,37 @@
+; RUN: llc -O2 -march=hexagon -relocation-model=pic < %s | FileCheck %s
+
+@dst_ie = thread_local(initialexec) global i32 0, align 4
+@src_ie = thread_local(initialexec) global i32 0, align 4
+
+; CHECK-LABEL: test_initial_exec
+; CHECK: = add(pc, ##_GLOBAL_OFFSET_TABLE_@PCREL)
+; CHECK-DAG: = ##src_ie@IEGOT
+; CHECK-DAG: = ##dst_ie@IEGOT
+; CHECK-DAG-NOT: call
+define i32 @test_initial_exec() nounwind {
+entry:
+ %0 = load i32, i32* @src_ie, align 4
+ store i32 %0, i32* @dst_ie, align 4
+ ret i32 0
+}
+
+@dst_gd = external thread_local global i32
+@src_gd = external thread_local global i32
+
+; At the moment, the local-dynamic model uses the same code as the
+; general-dynamic model.
+
+; CHECK-LABEL: test_dynamic
+; CHECK: = add(pc, ##_GLOBAL_OFFSET_TABLE_@PCREL)
+; CHECK-DAG: = ##src_gd@GDGOT
+; CHECK-DAG: = ##dst_gd@GDGOT
+; CHECK-DAG: call src_gd@GDPLT
+; CHECK-DAG: call dst_gd@GDPLT
+
+define i32 @test_dynamic() nounwind {
+entry:
+ %0 = load i32, i32* @src_gd, align 4
+ store i32 %0, i32* @dst_gd, align 4
+ ret i32 0
+}
+
diff --git a/llvm/test/CodeGen/Hexagon/tls_static.ll b/llvm/test/CodeGen/Hexagon/tls_static.ll
new file mode 100644
index 00000000000..de35373fbd9
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/tls_static.ll
@@ -0,0 +1,28 @@
+; RUN: llc -O2 -march=hexagon -relocation-model=static < %s | FileCheck %s
+
+@dst_le = thread_local global i32 0, align 4
+@src_le = thread_local global i32 0, align 4
+
+; CHECK-LABEL: test_local_exec
+; CHECK-DAG: = ##src_le@TPREL
+; CHECK-DAG: = ##dst_le@TPREL
+define i32 @test_local_exec() nounwind {
+entry:
+ %0 = load i32, i32* @src_le, align 4
+ store i32 %0, i32* @dst_le, align 4
+ ret i32 0
+}
+
+@dst_ie = external thread_local global i32
+@src_ie = external thread_local global i32
+
+; CHECK-LABEL: test_initial_exec:
+; CHECK-DAG: = memw(##src_ie@IE)
+; CHECK-DAG: = memw(##dst_ie@IE)
+define i32 @test_initial_exec() nounwind {
+entry:
+ %0 = load i32, i32* @src_ie, align 4
+ store i32 %0, i32* @dst_ie, align 4
+ ret i32 0
+}
+
OpenPOWER on IntegriCloud