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 i8*, align 4
10 declare i8* @my_emutls_get_address(i8*)
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 i8* @my_emutls_get_address(i8* bitcast (i8** @my_emutls_v_xyz to i8*))
22 %0 = bitcast i8* %call to i32*
23 %1 = load i32, i32* %0, align 4
27 @i1 = thread_local global i32 15
28 @i2 = external thread_local global i32
29 @i3 = internal thread_local global i32 15
30 @i4 = hidden thread_local global i32 15
31 @i5 = external hidden thread_local global i32
32 @s1 = thread_local global i16 15
33 @b1 = thread_local global i8 0
38 ; ARM32: ldr r0, [pc, r0]
39 ; ARM32-NEXT: bl __emutls_get_address
40 ; ARM32-NEXT: ldr r0, [r0]
41 ; ARM32: .long __emutls_v.i1(GOT_PREL)
44 %tmp1 = load i32, i32* @i1
51 ; ARM32: ldr r0, [pc, r0]
52 ; ARM32-NEXT: bl __emutls_get_address
54 ; ARM32: .long __emutls_v.i1(GOT_PREL)
60 define i32 @f3() nounwind {
63 ; ARM32: ldr r0, [pc, r0]
64 ; ARM32-NEXT: bl __emutls_get_address
65 ; ARM32-NEXT: ldr r0, [r0]
66 ; ARM32: .long __emutls_v.i2(GOT_PREL)
69 %tmp1 = load i32, i32* @i2
76 ; ARM32: ldr r0, [pc, r0]
77 ; ARM32-NEXT: bl __emutls_get_address
79 ; ARM32: .long __emutls_v.i2(GOT_PREL)
85 define i32 @f5() nounwind {
88 ; ARM32: add r0, pc, r0
89 ; ARM32-NEXT: bl __emutls_get_address
90 ; ARM32-NEXT: ldr r0, [r0]
91 ; ARM32: .long __emutls_v.i3-
94 %tmp1 = load i32, i32* @i3
101 ; ARM32: add r0, pc, r0
102 ; ARM32-NEXT: bl __emutls_get_address
104 ; ARM32: .long __emutls_v.i3-
113 ; ARM32: add r0, pc, r0
114 ; ARM32-NEXT: bl __emutls_get_address
115 ; ARM32-NEXT: ldr r0, [r0]
116 ; ARM32: .long __emutls_v.i4-(.LPC
119 %tmp1 = load i32, i32* @i4
126 ; ARM32: add r0, pc, r0
127 ; ARM32-NEXT: bl __emutls_get_address
129 ; ARM32: .long __emutls_v.i4-(.LPC
138 ; ARM32: add r0, pc, r0
139 ; ARM32-NEXT: bl __emutls_get_address
140 ; ARM32-NEXT: ldr r0, [r0]
143 %tmp1 = load i32, i32* @i5
150 ; ARM32: add r0, pc, r0
151 ; ARM32-NEXT: bl __emutls_get_address
161 ; ARM32: ldr r0, [pc, r0]
162 ; ARM32-NEXT: bl __emutls_get_address
163 ; ARM32-NEXT: ldrh r0, [r0]
166 %tmp1 = load i16, i16* @s1
173 ; ARM32: ldr r0, [pc, r0]
174 ; ARM32-NEXT: bl __emutls_get_address
175 ; ARM32-NEXT: ldrsh r0, [r0]
178 %tmp1 = load i16, i16* @s1
179 %tmp2 = sext i16 %tmp1 to i32
186 ; ARM32: ldr r0, [pc, r0]
187 ; ARM32-NEXT: bl __emutls_get_address
188 ; ARM32-NEXT: ldrb r0, [r0]
192 %tmp1 = load i8, i8* @b1
199 ; ARM32: ldr r0, [pc, r0]
200 ; ARM32-NEXT: bl __emutls_get_address
201 ; ARM32-NEXT: ldrsb r0, [r0]
205 %tmp1 = load i8, i8* @b1
206 %tmp2 = sext i8 %tmp1 to i32
210 ;;;;;;;;;;;;;; 32-bit __emutls_v. and __emutls_t.
213 ; ARM32: .globl __emutls_v.i1
214 ; ARM32-LABEL: __emutls_v.i1:
215 ; ARM32-NEXT: .long 4
216 ; ARM32-NEXT: .long 4
217 ; ARM32-NEXT: .long 0
218 ; ARM32-NEXT: .long __emutls_t.i1
220 ; ARM32: .section .rodata,
221 ; ARM32-LABEL: __emutls_t.i1:
222 ; ARM32-NEXT: .long 15
224 ; ARM32-NOT: __emutls_v.i2
228 ; ARM32-LABEL: __emutls_v.i3:
229 ; ARM32-NEXT: .long 4
230 ; ARM32-NEXT: .long 4
231 ; ARM32-NEXT: .long 0
232 ; ARM32-NEXT: .long __emutls_t.i3
234 ; ARM32: .section .rodata,
235 ; ARM32-LABEL: __emutls_t.i3:
236 ; ARM32-NEXT: .long 15
239 ; ARM32: .globl __emutls_v.i4
240 ; ARM32-LABEL: __emutls_v.i4:
241 ; ARM32-NEXT: .long 4
242 ; ARM32-NEXT: .long 4
243 ; ARM32-NEXT: .long 0
244 ; ARM32-NEXT: .long __emutls_t.i4
246 ; ARM32: .section .rodata,
247 ; ARM32-LABEL: __emutls_t.i4:
248 ; ARM32-NEXT: .long 15
250 ; ARM32-NOT: __emutls_v.i5:
251 ; ARM32: .hidden __emutls_v.i5
252 ; ARM32-NOT: __emutls_v.i5:
255 ; ARM32: .globl __emutls_v.s1
256 ; ARM32-LABEL: __emutls_v.s1:
257 ; ARM32-NEXT: .long 2
258 ; ARM32-NEXT: .long 2
259 ; ARM32-NEXT: .long 0
260 ; ARM32-NEXT: .long __emutls_t.s1
262 ; ARM32 .section .rodata,
263 ; ARM32-LABEL: __emutls_t.s1:
264 ; ARM32-NEXT: .short 15
267 ; ARM32: .globl __emutls_v.b1
268 ; ARM32-LABEL: __emutls_v.b1:
269 ; ARM32-NEXT: .long 1
270 ; ARM32-NEXT: .long 1
271 ; ARM32-NEXT: .long 0
272 ; ARM32-NEXT: .long 0
274 ; ARM32-NOT: __emutls_t.b1