1 ; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck -check-prefix=X64 %s
2 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X64_PIC %s
3 ; RUN: llc < %s -mtriple=i386-linux-gnu | FileCheck -check-prefix=X32 %s
4 ; RUN: llc < %s -mtriple=i386-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X32_PIC %s
6 ; Darwin always uses the same model.
7 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck -check-prefix=DARWIN %s
9 @external_gd = external thread_local global i32
10 @internal_gd = internal thread_local global i32 42
12 @external_ld = external thread_local(localdynamic) global i32
13 @internal_ld = internal thread_local(localdynamic) global i32 42
15 @external_ie = external thread_local(initialexec) global i32
16 @internal_ie = internal thread_local(initialexec) global i32 42
18 @external_le = external thread_local(localexec) global i32
19 @internal_le = internal thread_local(localexec) global i32 42
21 ; See test cases for emulated model in emutls.ll, emutls-pic.ll and emutls-pie.ll.
23 ; ----- no model specified -----
29 ; Non-PIC code can use initial-exec, PIC code has to use general dynamic.
31 ; X64: external_gd@GOTTPOFF
33 ; X32: external_gd@INDNTPOFF
35 ; X64_PIC: external_gd@TLSGD
37 ; X32_PIC: external_gd@TLSGD
39 ; DARWIN: _external_gd@TLVP
46 ; Non-PIC code can use local exec, PIC code can use local dynamic.
48 ; X64: internal_gd@TPOFF
50 ; X32: internal_gd@NTPOFF
52 ; X64_PIC: internal_gd@TLSLD
54 ; X32_PIC: internal_gd@TLSLDM
56 ; DARWIN: _internal_gd@TLVP
60 ; ----- localdynamic specified -----
66 ; Non-PIC code can use initial exec, PIC code use local dynamic as specified.
68 ; X64: external_ld@GOTTPOFF
70 ; X32: external_ld@INDNTPOFF
72 ; X64_PIC: external_ld@TLSLD
74 ; X32_PIC: external_ld@TLSLDM
76 ; DARWIN: _external_ld@TLVP
83 ; Non-PIC code can use local exec, PIC code can use local dynamic.
85 ; X64: internal_ld@TPOFF
87 ; X32: internal_ld@NTPOFF
89 ; X64_PIC: internal_ld@TLSLD
91 ; X32_PIC: internal_ld@TLSLDM
93 ; DARWIN: _internal_ld@TLVP
97 ; ----- initialexec specified -----
101 ret i32* @external_ie
103 ; Non-PIC and PIC code will use initial exec as specified.
105 ; X64: external_ie@GOTTPOFF
107 ; X32: external_ie@INDNTPOFF
109 ; X64_PIC: external_ie@GOTTPOFF
111 ; X32_PIC: external_ie@GOTNTPOFF
113 ; DARWIN: _external_ie@TLVP
118 ret i32* @internal_ie
120 ; Non-PIC code can use local exec, PIC code use initial exec as specified.
122 ; X64: internal_ie@TPOFF
124 ; X32: internal_ie@NTPOFF
126 ; X64_PIC: internal_ie@GOTTPOFF
128 ; X32_PIC: internal_ie@GOTNTPOFF
130 ; DARWIN: _internal_ie@TLVP
133 define i32 @PR22083() {
135 ret i32 ptrtoint (i32* @external_ie to i32)
136 ; X64-LABEL: PR22083:
137 ; X64: movq external_ie@GOTTPOFF(%rip), %rax
138 ; X64_PIC-LABEL: PR22083:
139 ; X64_PIC: movq external_ie@GOTTPOFF(%rip), %rax
142 ; ----- localexec specified -----
146 ret i32* @external_le
148 ; Non-PIC and PIC code will use local exec as specified.
150 ; X64: external_le@TPOFF
152 ; X32: external_le@NTPOFF
154 ; X64_PIC: external_le@TPOFF
156 ; X32_PIC: external_le@NTPOFF
158 ; DARWIN: _external_le@TLVP
163 ret i32* @internal_le
165 ; Non-PIC and PIC code will use local exec as specified.
167 ; X64: internal_le@TPOFF
169 ; X32: internal_le@NTPOFF
171 ; X64_PIC: internal_le@TPOFF
173 ; X32_PIC: internal_le@NTPOFF
175 ; DARWIN: _internal_le@TLVP