1 ; RUN: llc -emulated-tls -mtriple=arm-linux-android \
2 ; RUN: -relocation-model=pic < %s | FileCheck -check-prefix=ARM32 %s
3 ; RUN: llc -mtriple=arm-linux-android \
4 ; RUN: -relocation-model=pic < %s | FileCheck -check-prefix=ARM32 %s
6 ; Copied from X86/emutls.ll
8 ; Use my_emutls_get_address like __emutls_get_address.
9 @my_emutls_v_xyz = external global ptr, align 4
10 declare ptr @my_emutls_get_address(ptr)
12 define i32 @my_get_xyz() {
13 ; ARM32-LABEL: my_get_xyz:
15 ; ARM32: ldr r0, [pc, r0]
16 ; ARM32-NEXT: bl my_emutls_get_address
17 ; ARM32-NEXT: ldr r0, [r0]
18 ; ARM32: .long my_emutls_v_xyz(GOT_PREL)
21 %call = call ptr @my_emutls_get_address(ptr @my_emutls_v_xyz)
22 %0 = load i32, ptr %call, align 4
26 @i1 = thread_local global i32 15
27 @i2 = external thread_local global i32
28 @i3 = internal thread_local global i32 15
29 @i4 = hidden thread_local global i32 15
30 @i5 = external hidden thread_local global i32
31 @s1 = thread_local global i16 15
32 @b1 = thread_local global i8 0
37 ; ARM32: ldr r0, [pc, r0]
38 ; ARM32-NEXT: bl __emutls_get_address
39 ; ARM32-NEXT: ldr r0, [r0]
40 ; ARM32: .long __emutls_v.i1(GOT_PREL)
43 %tmp1 = load i32, ptr @i1
50 ; ARM32: ldr r0, [pc, r0]
51 ; ARM32-NEXT: bl __emutls_get_address
53 ; ARM32: .long __emutls_v.i1(GOT_PREL)
59 define i32 @f3() nounwind {
62 ; ARM32: ldr r0, [pc, r0]
63 ; ARM32-NEXT: bl __emutls_get_address
64 ; ARM32-NEXT: ldr r0, [r0]
65 ; ARM32: .long __emutls_v.i2(GOT_PREL)
68 %tmp1 = load i32, ptr @i2
75 ; ARM32: ldr r0, [pc, r0]
76 ; ARM32-NEXT: bl __emutls_get_address
78 ; ARM32: .long __emutls_v.i2(GOT_PREL)
84 define i32 @f5() nounwind {
87 ; ARM32: add r0, pc, r0
88 ; ARM32-NEXT: bl __emutls_get_address
89 ; ARM32-NEXT: ldr r0, [r0]
90 ; ARM32: .long __emutls_v.i3-
93 %tmp1 = load i32, ptr @i3
100 ; ARM32: add r0, pc, r0
101 ; ARM32-NEXT: bl __emutls_get_address
103 ; ARM32: .long __emutls_v.i3-
112 ; ARM32: add r0, pc, r0
113 ; ARM32-NEXT: bl __emutls_get_address
114 ; ARM32-NEXT: ldr r0, [r0]
115 ; ARM32: .long __emutls_v.i4-(.LPC
118 %tmp1 = load i32, ptr @i4
125 ; ARM32: add r0, pc, r0
126 ; ARM32-NEXT: bl __emutls_get_address
128 ; ARM32: .long __emutls_v.i4-(.LPC
137 ; ARM32: add r0, pc, r0
138 ; ARM32-NEXT: bl __emutls_get_address
139 ; ARM32-NEXT: ldr r0, [r0]
142 %tmp1 = load i32, ptr @i5
149 ; ARM32: add r0, pc, r0
150 ; ARM32-NEXT: bl __emutls_get_address
160 ; ARM32: ldr r0, [pc, r0]
161 ; ARM32-NEXT: bl __emutls_get_address
162 ; ARM32-NEXT: ldrh r0, [r0]
165 %tmp1 = load i16, ptr @s1
172 ; ARM32: ldr r0, [pc, r0]
173 ; ARM32-NEXT: bl __emutls_get_address
174 ; ARM32-NEXT: ldrsh r0, [r0]
177 %tmp1 = load i16, ptr @s1
178 %tmp2 = sext i16 %tmp1 to i32
185 ; ARM32: ldr r0, [pc, r0]
186 ; ARM32-NEXT: bl __emutls_get_address
187 ; ARM32-NEXT: ldrb r0, [r0]
191 %tmp1 = load i8, ptr @b1
198 ; ARM32: ldr r0, [pc, r0]
199 ; ARM32-NEXT: bl __emutls_get_address
200 ; ARM32-NEXT: ldrsb r0, [r0]
204 %tmp1 = load i8, ptr @b1
205 %tmp2 = sext i8 %tmp1 to i32
209 ;;;;;;;;;;;;;; 32-bit __emutls_v. and __emutls_t.
212 ; ARM32: .globl __emutls_v.i1
213 ; ARM32-LABEL: __emutls_v.i1:
214 ; ARM32-NEXT: .long 4
215 ; ARM32-NEXT: .long 4
216 ; ARM32-NEXT: .long 0
217 ; ARM32-NEXT: .long __emutls_t.i1
219 ; ARM32: .section .rodata,
220 ; ARM32-LABEL: __emutls_t.i1:
221 ; ARM32-NEXT: .long 15
223 ; ARM32-NOT: __emutls_v.i2
227 ; ARM32-LABEL: __emutls_v.i3:
228 ; ARM32-NEXT: .long 4
229 ; ARM32-NEXT: .long 4
230 ; ARM32-NEXT: .long 0
231 ; ARM32-NEXT: .long __emutls_t.i3
233 ; ARM32: .section .rodata,
234 ; ARM32-LABEL: __emutls_t.i3:
235 ; ARM32-NEXT: .long 15
238 ; ARM32: .globl __emutls_v.i4
239 ; ARM32-LABEL: __emutls_v.i4:
240 ; ARM32-NEXT: .long 4
241 ; ARM32-NEXT: .long 4
242 ; ARM32-NEXT: .long 0
243 ; ARM32-NEXT: .long __emutls_t.i4
245 ; ARM32: .section .rodata,
246 ; ARM32-LABEL: __emutls_t.i4:
247 ; ARM32-NEXT: .long 15
249 ; ARM32-NOT: __emutls_v.i5:
250 ; ARM32: .hidden __emutls_v.i5
251 ; ARM32-NOT: __emutls_v.i5:
254 ; ARM32: .globl __emutls_v.s1
255 ; ARM32-LABEL: __emutls_v.s1:
256 ; ARM32-NEXT: .long 2
257 ; ARM32-NEXT: .long 2
258 ; ARM32-NEXT: .long 0
259 ; ARM32-NEXT: .long __emutls_t.s1
261 ; ARM32: .section .rodata,
262 ; ARM32-LABEL: __emutls_t.s1:
263 ; ARM32-NEXT: .short 15
266 ; ARM32: .globl __emutls_v.b1
267 ; ARM32-LABEL: __emutls_v.b1:
268 ; ARM32-NEXT: .long 1
269 ; ARM32-NEXT: .long 1
270 ; ARM32-NEXT: .long 0
271 ; ARM32-NEXT: .long 0
273 ; ARM32-NOT: __emutls_t.b1