1 ; RUN: llc -emulated-tls -mtriple=arm-linux-android \
2 ; RUN: -relocation-model=pic < %s | FileCheck -check-prefix=ARM32 %s
4 ; Copied from X86/emutls.ll
6 ; Use my_emutls_get_address like __emutls_get_address.
7 @my_emutls_v_xyz = external global i8*, align 4
8 declare i8* @my_emutls_get_address(i8*)
10 define i32 @my_get_xyz() {
11 ; ARM32-LABEL: my_get_xyz:
14 ; ARM32: add r0, pc, r0
15 ; ARM32-NEXT: ldr r0, [r1, r0]
16 ; ARM32-NEXT: bl my_emutls_get_address(PLT)
17 ; ARM32-NEXT: ldr r0, [r0]
20 %call = call i8* @my_emutls_get_address(i8* bitcast (i8** @my_emutls_v_xyz to i8*))
21 %0 = bitcast i8* %call to i32*
22 %1 = load i32, i32* %0, 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
38 ; ARM32: add r0, pc, r0
39 ; ARM32-NEXT: ldr r0, [r1, r0]
40 ; ARM32-NEXT: bl __emutls_get_address(PLT)
41 ; ARM32-NEXT: ldr r0, [r0]
44 %tmp1 = load i32, i32* @i1
52 ; ARM32: add r0, pc, r0
53 ; ARM32-NEXT: ldr r0, [r1, r0]
54 ; ARM32-NEXT: bl __emutls_get_address(PLT)
61 define i32 @f3() nounwind {
65 ; ARM32: add r0, pc, r0
66 ; ARM32-NEXT: ldr r0, [r1, r0]
67 ; ARM32-NEXT: bl __emutls_get_address(PLT)
68 ; ARM32-NEXT: ldr r0, [r0]
71 %tmp1 = load i32, i32* @i2
79 ; ARM32: add r0, pc, r0
80 ; ARM32-NEXT: ldr r0, [r1, r0]
81 ; ARM32-NEXT: bl __emutls_get_address(PLT)
88 define i32 @f5() nounwind {
92 ; ARM32: add r0, pc, r0
93 ; ARM32-NEXT: ldr r0, [r1, r0]
94 ; ARM32-NEXT: bl __emutls_get_address(PLT)
95 ; ARM32-NEXT: ldr r0, [r0]
98 %tmp1 = load i32, i32* @i3
105 ; ARM32-NEXT: ldr r1,
106 ; ARM32: add r0, pc, r0
107 ; ARM32-NEXT: ldr r0, [r1, r0]
108 ; ARM32-NEXT: bl __emutls_get_address(PLT)
118 ; ARM32-NEXT: ldr r1,
119 ; ARM32: add r0, pc, r0
120 ; ARM32-NEXT: ldr r0, [r1, r0]
121 ; ARM32-NEXT: bl __emutls_get_address(PLT)
122 ; ARM32-NEXT: ldr r0, [r0]
125 %tmp1 = load i32, i32* @i4
132 ; ARM32-NEXT: ldr r1,
133 ; ARM32: add r0, pc, r0
134 ; ARM32-NEXT: ldr r0, [r1, r0]
135 ; ARM32-NEXT: bl __emutls_get_address(PLT)
145 ; ARM32-NEXT: ldr r1,
146 ; ARM32: add r0, pc, r0
147 ; ARM32-NEXT: ldr r0, [r1, r0]
148 ; ARM32-NEXT: bl __emutls_get_address(PLT)
149 ; ARM32-NEXT: ldr r0, [r0]
152 %tmp1 = load i32, i32* @i5
159 ; ARM32-NEXT: ldr r1,
160 ; ARM32: add r0, pc, r0
161 ; ARM32-NEXT: ldr r0, [r1, r0]
162 ; ARM32-NEXT: bl __emutls_get_address(PLT)
172 ; ARM32-NEXT: ldr r1,
173 ; ARM32: add r0, pc, r0
174 ; ARM32-NEXT: ldr r0, [r1, r0]
175 ; ARM32-NEXT: bl __emutls_get_address(PLT)
176 ; ARM32-NEXT: ldrh r0, [r0]
179 %tmp1 = load i16, i16* @s1
186 ; ARM32-NEXT: ldr r1,
187 ; ARM32: add r0, pc, r0
188 ; ARM32-NEXT: ldr r0, [r1, r0]
189 ; ARM32-NEXT: bl __emutls_get_address(PLT)
190 ; ARM32-NEXT: ldrsh r0, [r0]
193 %tmp1 = load i16, i16* @s1
194 %tmp2 = sext i16 %tmp1 to i32
201 ; ARM32-NEXT: ldr r1,
202 ; ARM32: add r0, pc, r0
203 ; ARM32-NEXT: ldr r0, [r1, r0]
204 ; ARM32-NEXT: bl __emutls_get_address(PLT)
205 ; ARM32-NEXT: ldrb r0, [r0]
209 %tmp1 = load i8, i8* @b1
216 ; ARM32-NEXT: ldr r1,
217 ; ARM32: add r0, pc, r0
218 ; ARM32-NEXT: ldr r0, [r1, r0]
219 ; ARM32-NEXT: bl __emutls_get_address(PLT)
220 ; ARM32-NEXT: ldrsb r0, [r0]
224 %tmp1 = load i8, i8* @b1
225 %tmp2 = sext i8 %tmp1 to i32
229 ;;;;;;;;;;;;;; 32-bit __emutls_v. and __emutls_t.
231 ; ARM32 .section .data.rel.local,
232 ; ARM32-LABEL: __emutls_v.i1:
233 ; ARM32-NEXT: .long 4
234 ; ARM32-NEXT: .long 4
235 ; ARM32-NEXT: .long 0
236 ; ARM32-NEXT: .long __emutls_t.i1
238 ; ARM32 .section .rodata,
239 ; ARM32-LABEL: __emutls_t.i1:
240 ; ARM32-NEXT: .long 15
242 ; ARM32-NOT: __emutls_v.i2
244 ; ARM32 .section .data.rel.local,
245 ; ARM32-LABEL: __emutls_v.i3:
246 ; ARM32-NEXT: .long 4
247 ; ARM32-NEXT: .long 4
248 ; ARM32-NEXT: .long 0
249 ; ARM32-NEXT: .long __emutls_t.i3
251 ; ARM32 .section .rodata,
252 ; ARM32-LABEL: __emutls_t.i3:
253 ; ARM32-NEXT: .long 15
255 ; ARM32 .section .data.rel.local,
256 ; ARM32-LABEL: __emutls_v.i4:
257 ; ARM32-NEXT: .long 4
258 ; ARM32-NEXT: .long 4
259 ; ARM32-NEXT: .long 0
260 ; ARM32-NEXT: .long __emutls_t.i4
262 ; ARM32 .section .rodata,
263 ; ARM32-LABEL: __emutls_t.i4:
264 ; ARM32-NEXT: .long 15
266 ; ARM32-NOT: __emutls_v.i5:
267 ; ARM32 .hidden __emutls_v.i5
268 ; ARM32-NOT: __emutls_v.i5:
270 ; ARM32 .section .data.rel.local,
271 ; ARM32-LABEL: __emutls_v.s1:
272 ; ARM32-NEXT: .long 2
273 ; ARM32-NEXT: .long 2
274 ; ARM32-NEXT: .long 0
275 ; ARM32-NEXT: .long __emutls_t.s1
277 ; ARM32 .section .rodata,
278 ; ARM32-LABEL: __emutls_t.s1:
279 ; ARM32-NEXT: .short 15
281 ; ARM32 .section .data.rel.local,
282 ; ARM32-LABEL: __emutls_v.b1:
283 ; ARM32-NEXT: .long 1
284 ; ARM32-NEXT: .long 1
285 ; ARM32-NEXT: .long 0
286 ; ARM32-NEXT: .long 0
288 ; ARM32-NOT: __emutls_t.b1