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
8 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -code-model=large | FileCheck -check-prefix=DARWIN %s
10 @external_gd = external thread_local global i32
11 @internal_gd = internal thread_local global i32 42
13 @external_ld = external thread_local(localdynamic) global i32
14 @internal_ld = internal thread_local(localdynamic) global i32 42
16 @external_ie = external thread_local(initialexec) global i32
17 @internal_ie = internal thread_local(initialexec) global i32 42
19 @external_le = external thread_local(localexec) global i32
20 @internal_le = internal thread_local(localexec) global i32 42
22 ; See test cases for emulated model in emutls.ll, emutls-pic.ll and emutls-pie.ll.
24 ; ----- no model specified -----
30 ; Non-PIC code can use initial-exec, PIC code has to use general dynamic.
32 ; X64: external_gd@GOTTPOFF
34 ; X32: external_gd@INDNTPOFF
36 ; X64_PIC: external_gd@TLSGD
38 ; X32_PIC: external_gd@TLSGD
40 ; DARWIN: _external_gd@TLVP
47 ; Non-PIC code can use local exec, PIC code can use local dynamic.
49 ; X64: internal_gd@TPOFF
51 ; X32: internal_gd@NTPOFF
53 ; X64_PIC: internal_gd@TLSLD
55 ; X32_PIC: internal_gd@TLSLDM
57 ; DARWIN: _internal_gd@TLVP
61 ; ----- localdynamic specified -----
67 ; Non-PIC code can use initial exec, PIC code use local dynamic as specified.
69 ; X64: external_ld@GOTTPOFF
71 ; X32: external_ld@INDNTPOFF
73 ; X64_PIC: external_ld@TLSLD
75 ; X32_PIC: external_ld@TLSLDM
77 ; DARWIN: _external_ld@TLVP
84 ; Non-PIC code can use local exec, PIC code can use local dynamic.
86 ; X64: internal_ld@TPOFF
88 ; X32: internal_ld@NTPOFF
90 ; X64_PIC: internal_ld@TLSLD
92 ; X32_PIC: internal_ld@TLSLDM
94 ; DARWIN: _internal_ld@TLVP
98 ; ----- initialexec specified -----
104 ; Non-PIC and PIC code will use initial exec as specified.
106 ; X64: external_ie@GOTTPOFF
108 ; X32: external_ie@INDNTPOFF
110 ; X64_PIC: external_ie@GOTTPOFF
112 ; X32_PIC: external_ie@GOTNTPOFF
114 ; DARWIN: _external_ie@TLVP
121 ; Non-PIC code can use local exec, PIC code use initial exec as specified.
123 ; X64: internal_ie@TPOFF
125 ; X32: internal_ie@NTPOFF
127 ; X64_PIC: internal_ie@GOTTPOFF
129 ; X32_PIC: internal_ie@GOTNTPOFF
131 ; DARWIN: _internal_ie@TLVP
134 define i32 @PR22083() {
136 ret i32 ptrtoint (ptr @external_ie to i32)
137 ; X64-LABEL: PR22083:
138 ; X64: movq external_ie@GOTTPOFF(%rip), %rax
139 ; X64_PIC-LABEL: PR22083:
140 ; X64_PIC: movq external_ie@GOTTPOFF(%rip), %rax
143 ; ----- localexec specified -----
149 ; Non-PIC and PIC code will use local exec as specified.
151 ; X64: external_le@TPOFF
153 ; X32: external_le@NTPOFF
155 ; X64_PIC: external_le@TPOFF
157 ; X32_PIC: external_le@NTPOFF
159 ; DARWIN: _external_le@TLVP
166 ; Non-PIC and PIC code will use local exec as specified.
168 ; X64: internal_le@TPOFF
170 ; X32: internal_le@NTPOFF
172 ; X64_PIC: internal_le@TPOFF
174 ; X32_PIC: internal_le@NTPOFF
176 ; DARWIN: _internal_le@TLVP