summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC/tls.ll
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2019-04-24 22:12:22 +0000
committerJoerg Sonnenberger <joerg@bec.de>2019-04-24 22:12:22 +0000
commit8372b467f18da0ff92ff59ba878365e8f4790212 (patch)
treeb74895bb57d09e2e6ac0073d9916915b6b6aac98 /llvm/test/CodeGen/PowerPC/tls.ll
parent2f496763215848f625becc540c097a37502e31fe (diff)
downloadbcm5719-llvm-8372b467f18da0ff92ff59ba878365e8f4790212.tar.gz
bcm5719-llvm-8372b467f18da0ff92ff59ba878365e8f4790212.zip
[PowerPC] Allow using initial-exec TLS with PIC
Using initial-exec TLS variables is a reasonable performance optimisation for system libraries. Use the correct PIC mechanism to get hold of the GOT to avoid text relocations. Differential Revision: https://reviews.llvm.org/D61026 llvm-svn: 359146
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/tls.ll')
-rw-r--r--llvm/test/CodeGen/PowerPC/tls.ll10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/PowerPC/tls.ll b/llvm/test/CodeGen/PowerPC/tls.ll
index 3ad93986bd4..6a0ab695642 100644
--- a/llvm/test/CodeGen/PowerPC/tls.ll
+++ b/llvm/test/CodeGen/PowerPC/tls.ll
@@ -1,6 +1,7 @@
; RUN: llc -relocation-model=static -verify-machineinstrs -O0 < %s -mcpu=ppc64 | FileCheck -check-prefix=OPT0 %s
; RUN: llc -relocation-model=static -verify-machineinstrs -O1 < %s -mcpu=ppc64 | FileCheck -check-prefix=OPT1 %s
; RUN: llc -verify-machineinstrs -O0 < %s -mtriple=ppc32-- -mcpu=ppc | FileCheck -check-prefix=OPT0-PPC32 %s
+; RUN: llc -relocation-model=pic -verify-machineinstrs -O0 < %s -mtriple=ppc32-- -mcpu=ppc | FileCheck -check-prefix=OPT0-PPC32-PIC %s
target triple = "powerpc64-unknown-linux-gnu"
@@ -24,7 +25,7 @@ entry:
; Test correct assembly code generation for thread-local storage
; using the initial-exec model.
-@a2 = external thread_local global i32
+@a2 = external thread_local(initialexec) global i32
define signext i32 @main2() nounwind {
entry:
@@ -44,3 +45,10 @@ entry:
;OPT0-PPC32: addis [[REG1]], [[REG1]], _GLOBAL_OFFSET_TABLE_@ha
;OPT0-PPC32: lwz [[REG2:[0-9]+]], a2@got@tprel@l([[REG1]])
;OPT0-PPC32: add 3, [[REG2]], a2@tls
+
+;OPT0-PPC32-PIC-LABEL: main2:
+;OPT0-PPC32-PIC: .long _GLOBAL_OFFSET_TABLE_-{{.*}}
+;OPT0-PPC32-PIC-NOT: li {{[0-9]+}}, _GLOBAL_OFFSET_TABLE_@l
+;OPT0-PPC32-PIC-NOT: addis {{[0-9]+}}, {{[0-9+]}}, _GLOBAL_OFFSET_TABLE_@ha
+;OPT0-PPC32-PIC-NOT: bl __tls_get_addr(a2@tlsgd)@PLT
+;OPT0-PPC32-PIC: lwz {{[0-9]+}}, a2@got@tprel@l({{[0-9]+}})
OpenPOWER on IntegriCloud