1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-linux-gnu | FileCheck -check-prefix=X86_LINUX %s
3 ; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck -check-prefix=X64_LINUX %s
4 ; RUN: llc < %s -mtriple=i386-linux-gnu -fast-isel | FileCheck -check-prefix=X86_LINUX %s
5 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel | FileCheck -check-prefix=X64_LINUX %s
6 ; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck -check-prefix=X86_WIN %s
7 ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck -check-prefix=X64_WIN %s
8 ; RUN: llc < %s -mtriple=i686-pc-windows-gnu | FileCheck -check-prefix=MINGW32 %s
9 ; RUN: llc < %s -mtriple=x86_64-pc-windows-gnu | FileCheck -check-prefix=X64_WIN %s
11 @i1 = dso_local thread_local global i32 15
12 @i2 = external thread_local global i32
13 @i3 = internal thread_local global i32 15
14 @i4 = hidden thread_local global i32 15
15 @i5 = external hidden thread_local global i32
16 @i6 = external protected thread_local global i32
17 @s1 = dso_local thread_local global i16 15
18 @b1 = dso_local thread_local global i8 0
19 @b2 = dso_local thread_local(localexec) global i8 0
21 define dso_local i32 @f1() {
22 ; X86_LINUX-LABEL: f1:
23 ; X86_LINUX: # %bb.0: # %entry
24 ; X86_LINUX-NEXT: movl %gs:i1@NTPOFF, %eax
25 ; X86_LINUX-NEXT: retl
27 ; X64_LINUX-LABEL: f1:
28 ; X64_LINUX: # %bb.0: # %entry
29 ; X64_LINUX-NEXT: movl %fs:i1@TPOFF, %eax
30 ; X64_LINUX-NEXT: retq
33 ; X86_WIN: # %bb.0: # %entry
34 ; X86_WIN-NEXT: movl __tls_index, %eax
35 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
36 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
37 ; X86_WIN-NEXT: movl _i1@SECREL32(%eax), %eax
41 ; X64_WIN: # %bb.0: # %entry
42 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
43 ; X64_WIN-NEXT: movq %gs:88, %rcx
44 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
45 ; X64_WIN-NEXT: movl i1@SECREL32(%rax), %eax
49 ; MINGW32: # %bb.0: # %entry
50 ; MINGW32-NEXT: movl __tls_index, %eax
51 ; MINGW32-NEXT: movl %fs:44, %ecx
52 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
53 ; MINGW32-NEXT: movl _i1@SECREL32(%eax), %eax
57 %tmp1 = load i32, ptr @i1
61 define dso_local ptr @f2() {
62 ; X86_LINUX-LABEL: f2:
63 ; X86_LINUX: # %bb.0: # %entry
64 ; X86_LINUX-NEXT: movl %gs:0, %eax
65 ; X86_LINUX-NEXT: leal i1@NTPOFF(%eax), %eax
66 ; X86_LINUX-NEXT: retl
68 ; X64_LINUX-LABEL: f2:
69 ; X64_LINUX: # %bb.0: # %entry
70 ; X64_LINUX-NEXT: movq %fs:0, %rax
71 ; X64_LINUX-NEXT: leaq i1@TPOFF(%rax), %rax
72 ; X64_LINUX-NEXT: retq
75 ; X86_WIN: # %bb.0: # %entry
76 ; X86_WIN-NEXT: movl __tls_index, %eax
77 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
78 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
79 ; X86_WIN-NEXT: leal _i1@SECREL32(%eax), %eax
83 ; X64_WIN: # %bb.0: # %entry
84 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
85 ; X64_WIN-NEXT: movq %gs:88, %rcx
86 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
87 ; X64_WIN-NEXT: leaq i1@SECREL32(%rax), %rax
91 ; MINGW32: # %bb.0: # %entry
92 ; MINGW32-NEXT: movl __tls_index, %eax
93 ; MINGW32-NEXT: movl %fs:44, %ecx
94 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
95 ; MINGW32-NEXT: leal _i1@SECREL32(%eax), %eax
102 define dso_local i32 @f3() nounwind {
103 ; X86_LINUX-LABEL: f3:
104 ; X86_LINUX: # %bb.0: # %entry
105 ; X86_LINUX-NEXT: movl i2@INDNTPOFF, %eax
106 ; X86_LINUX-NEXT: movl %gs:(%eax), %eax
107 ; X86_LINUX-NEXT: retl
109 ; X64_LINUX-LABEL: f3:
110 ; X64_LINUX: # %bb.0: # %entry
111 ; X64_LINUX-NEXT: movq i2@GOTTPOFF(%rip), %rax
112 ; X64_LINUX-NEXT: movl %fs:(%rax), %eax
113 ; X64_LINUX-NEXT: retq
116 ; X86_WIN: # %bb.0: # %entry
117 ; X86_WIN-NEXT: movl __tls_index, %eax
118 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
119 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
120 ; X86_WIN-NEXT: movl _i2@SECREL32(%eax), %eax
124 ; X64_WIN: # %bb.0: # %entry
125 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
126 ; X64_WIN-NEXT: movq %gs:88, %rcx
127 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
128 ; X64_WIN-NEXT: movl i2@SECREL32(%rax), %eax
132 ; MINGW32: # %bb.0: # %entry
133 ; MINGW32-NEXT: movl __tls_index, %eax
134 ; MINGW32-NEXT: movl %fs:44, %ecx
135 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
136 ; MINGW32-NEXT: movl _i2@SECREL32(%eax), %eax
140 %tmp1 = load i32, ptr @i2
144 define dso_local ptr @f4() {
145 ; X86_LINUX-LABEL: f4:
146 ; X86_LINUX: # %bb.0: # %entry
147 ; X86_LINUX-NEXT: movl %gs:0, %eax
148 ; X86_LINUX-NEXT: addl i2@INDNTPOFF, %eax
149 ; X86_LINUX-NEXT: retl
151 ; X64_LINUX-LABEL: f4:
152 ; X64_LINUX: # %bb.0: # %entry
153 ; X64_LINUX-NEXT: movq %fs:0, %rax
154 ; X64_LINUX-NEXT: addq i2@GOTTPOFF(%rip), %rax
155 ; X64_LINUX-NEXT: retq
158 ; X86_WIN: # %bb.0: # %entry
159 ; X86_WIN-NEXT: movl __tls_index, %eax
160 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
161 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
162 ; X86_WIN-NEXT: leal _i2@SECREL32(%eax), %eax
166 ; X64_WIN: # %bb.0: # %entry
167 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
168 ; X64_WIN-NEXT: movq %gs:88, %rcx
169 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
170 ; X64_WIN-NEXT: leaq i2@SECREL32(%rax), %rax
174 ; MINGW32: # %bb.0: # %entry
175 ; MINGW32-NEXT: movl __tls_index, %eax
176 ; MINGW32-NEXT: movl %fs:44, %ecx
177 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
178 ; MINGW32-NEXT: leal _i2@SECREL32(%eax), %eax
185 define dso_local i32 @f5() nounwind {
186 ; X86_LINUX-LABEL: f5:
187 ; X86_LINUX: # %bb.0: # %entry
188 ; X86_LINUX-NEXT: movl %gs:i3@NTPOFF, %eax
189 ; X86_LINUX-NEXT: retl
191 ; X64_LINUX-LABEL: f5:
192 ; X64_LINUX: # %bb.0: # %entry
193 ; X64_LINUX-NEXT: movl %fs:i3@TPOFF, %eax
194 ; X64_LINUX-NEXT: retq
197 ; X86_WIN: # %bb.0: # %entry
198 ; X86_WIN-NEXT: movl __tls_index, %eax
199 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
200 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
201 ; X86_WIN-NEXT: movl _i3@SECREL32(%eax), %eax
205 ; X64_WIN: # %bb.0: # %entry
206 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
207 ; X64_WIN-NEXT: movq %gs:88, %rcx
208 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
209 ; X64_WIN-NEXT: movl i3@SECREL32(%rax), %eax
213 ; MINGW32: # %bb.0: # %entry
214 ; MINGW32-NEXT: movl __tls_index, %eax
215 ; MINGW32-NEXT: movl %fs:44, %ecx
216 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
217 ; MINGW32-NEXT: movl _i3@SECREL32(%eax), %eax
221 %tmp1 = load i32, ptr @i3
225 define dso_local ptr @f6() {
226 ; X86_LINUX-LABEL: f6:
227 ; X86_LINUX: # %bb.0: # %entry
228 ; X86_LINUX-NEXT: movl %gs:0, %eax
229 ; X86_LINUX-NEXT: leal i3@NTPOFF(%eax), %eax
230 ; X86_LINUX-NEXT: retl
232 ; X64_LINUX-LABEL: f6:
233 ; X64_LINUX: # %bb.0: # %entry
234 ; X64_LINUX-NEXT: movq %fs:0, %rax
235 ; X64_LINUX-NEXT: leaq i3@TPOFF(%rax), %rax
236 ; X64_LINUX-NEXT: retq
239 ; X86_WIN: # %bb.0: # %entry
240 ; X86_WIN-NEXT: movl __tls_index, %eax
241 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
242 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
243 ; X86_WIN-NEXT: leal _i3@SECREL32(%eax), %eax
247 ; X64_WIN: # %bb.0: # %entry
248 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
249 ; X64_WIN-NEXT: movq %gs:88, %rcx
250 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
251 ; X64_WIN-NEXT: leaq i3@SECREL32(%rax), %rax
255 ; MINGW32: # %bb.0: # %entry
256 ; MINGW32-NEXT: movl __tls_index, %eax
257 ; MINGW32-NEXT: movl %fs:44, %ecx
258 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
259 ; MINGW32-NEXT: leal _i3@SECREL32(%eax), %eax
266 define dso_local i32 @f7() {
267 ; X86_LINUX-LABEL: f7:
268 ; X86_LINUX: # %bb.0: # %entry
269 ; X86_LINUX-NEXT: movl %gs:i4@NTPOFF, %eax
270 ; X86_LINUX-NEXT: retl
272 ; X64_LINUX-LABEL: f7:
273 ; X64_LINUX: # %bb.0: # %entry
274 ; X64_LINUX-NEXT: movl %fs:i4@TPOFF, %eax
275 ; X64_LINUX-NEXT: retq
278 ; X86_WIN: # %bb.0: # %entry
279 ; X86_WIN-NEXT: movl __tls_index, %eax
280 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
281 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
282 ; X86_WIN-NEXT: movl _i4@SECREL32(%eax), %eax
286 ; X64_WIN: # %bb.0: # %entry
287 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
288 ; X64_WIN-NEXT: movq %gs:88, %rcx
289 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
290 ; X64_WIN-NEXT: movl i4@SECREL32(%rax), %eax
294 ; MINGW32: # %bb.0: # %entry
295 ; MINGW32-NEXT: movl __tls_index, %eax
296 ; MINGW32-NEXT: movl %fs:44, %ecx
297 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
298 ; MINGW32-NEXT: movl _i4@SECREL32(%eax), %eax
302 %tmp1 = load i32, ptr @i4
306 define dso_local ptr @f8() {
307 ; X86_LINUX-LABEL: f8:
308 ; X86_LINUX: # %bb.0: # %entry
309 ; X86_LINUX-NEXT: movl %gs:0, %eax
310 ; X86_LINUX-NEXT: leal i4@NTPOFF(%eax), %eax
311 ; X86_LINUX-NEXT: retl
313 ; X64_LINUX-LABEL: f8:
314 ; X64_LINUX: # %bb.0: # %entry
315 ; X64_LINUX-NEXT: movq %fs:0, %rax
316 ; X64_LINUX-NEXT: leaq i4@TPOFF(%rax), %rax
317 ; X64_LINUX-NEXT: retq
320 ; X86_WIN: # %bb.0: # %entry
321 ; X86_WIN-NEXT: movl __tls_index, %eax
322 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
323 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
324 ; X86_WIN-NEXT: leal _i4@SECREL32(%eax), %eax
328 ; X64_WIN: # %bb.0: # %entry
329 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
330 ; X64_WIN-NEXT: movq %gs:88, %rcx
331 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
332 ; X64_WIN-NEXT: leaq i4@SECREL32(%rax), %rax
336 ; MINGW32: # %bb.0: # %entry
337 ; MINGW32-NEXT: movl __tls_index, %eax
338 ; MINGW32-NEXT: movl %fs:44, %ecx
339 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
340 ; MINGW32-NEXT: leal _i4@SECREL32(%eax), %eax
347 define dso_local i32 @f9() {
348 ; X86_LINUX-LABEL: f9:
349 ; X86_LINUX: # %bb.0: # %entry
350 ; X86_LINUX-NEXT: movl %gs:i5@NTPOFF, %eax
351 ; X86_LINUX-NEXT: retl
353 ; X64_LINUX-LABEL: f9:
354 ; X64_LINUX: # %bb.0: # %entry
355 ; X64_LINUX-NEXT: movl %fs:i5@TPOFF, %eax
356 ; X64_LINUX-NEXT: retq
359 ; X86_WIN: # %bb.0: # %entry
360 ; X86_WIN-NEXT: movl __tls_index, %eax
361 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
362 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
363 ; X86_WIN-NEXT: movl _i5@SECREL32(%eax), %eax
367 ; X64_WIN: # %bb.0: # %entry
368 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
369 ; X64_WIN-NEXT: movq %gs:88, %rcx
370 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
371 ; X64_WIN-NEXT: movl i5@SECREL32(%rax), %eax
375 ; MINGW32: # %bb.0: # %entry
376 ; MINGW32-NEXT: movl __tls_index, %eax
377 ; MINGW32-NEXT: movl %fs:44, %ecx
378 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
379 ; MINGW32-NEXT: movl _i5@SECREL32(%eax), %eax
383 %tmp1 = load i32, ptr @i5
387 define dso_local ptr @f10() {
388 ; X86_LINUX-LABEL: f10:
389 ; X86_LINUX: # %bb.0: # %entry
390 ; X86_LINUX-NEXT: movl %gs:0, %eax
391 ; X86_LINUX-NEXT: leal i5@NTPOFF(%eax), %eax
392 ; X86_LINUX-NEXT: retl
394 ; X64_LINUX-LABEL: f10:
395 ; X64_LINUX: # %bb.0: # %entry
396 ; X64_LINUX-NEXT: movq %fs:0, %rax
397 ; X64_LINUX-NEXT: leaq i5@TPOFF(%rax), %rax
398 ; X64_LINUX-NEXT: retq
400 ; X86_WIN-LABEL: f10:
401 ; X86_WIN: # %bb.0: # %entry
402 ; X86_WIN-NEXT: movl __tls_index, %eax
403 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
404 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
405 ; X86_WIN-NEXT: leal _i5@SECREL32(%eax), %eax
408 ; X64_WIN-LABEL: f10:
409 ; X64_WIN: # %bb.0: # %entry
410 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
411 ; X64_WIN-NEXT: movq %gs:88, %rcx
412 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
413 ; X64_WIN-NEXT: leaq i5@SECREL32(%rax), %rax
416 ; MINGW32-LABEL: f10:
417 ; MINGW32: # %bb.0: # %entry
418 ; MINGW32-NEXT: movl __tls_index, %eax
419 ; MINGW32-NEXT: movl %fs:44, %ecx
420 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
421 ; MINGW32-NEXT: leal _i5@SECREL32(%eax), %eax
429 ; X86_LINUX-LABEL: f11:
430 ; X86_LINUX: # %bb.0: # %entry
431 ; X86_LINUX-NEXT: movzwl %gs:s1@NTPOFF, %eax
432 ; X86_LINUX-NEXT: retl
434 ; X64_LINUX-LABEL: f11:
435 ; X64_LINUX: # %bb.0: # %entry
436 ; X64_LINUX-NEXT: movzwl %fs:s1@TPOFF, %eax
437 ; X64_LINUX-NEXT: retq
439 ; X86_WIN-LABEL: f11:
440 ; X86_WIN: # %bb.0: # %entry
441 ; X86_WIN-NEXT: movl __tls_index, %eax
442 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
443 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
444 ; X86_WIN-NEXT: movzwl _s1@SECREL32(%eax), %eax
447 ; X64_WIN-LABEL: f11:
448 ; X64_WIN: # %bb.0: # %entry
449 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
450 ; X64_WIN-NEXT: movq %gs:88, %rcx
451 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
452 ; X64_WIN-NEXT: movzwl s1@SECREL32(%rax), %eax
455 ; MINGW32-LABEL: f11:
456 ; MINGW32: # %bb.0: # %entry
457 ; MINGW32-NEXT: movl __tls_index, %eax
458 ; MINGW32-NEXT: movl %fs:44, %ecx
459 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
460 ; MINGW32-NEXT: movzwl _s1@SECREL32(%eax), %eax
464 %tmp1 = load i16, ptr @s1
468 define dso_local i32 @f12() {
469 ; X86_LINUX-LABEL: f12:
470 ; X86_LINUX: # %bb.0: # %entry
471 ; X86_LINUX-NEXT: movswl %gs:s1@NTPOFF, %eax
472 ; X86_LINUX-NEXT: retl
474 ; X64_LINUX-LABEL: f12:
475 ; X64_LINUX: # %bb.0: # %entry
476 ; X64_LINUX-NEXT: movswl %fs:s1@TPOFF, %eax
477 ; X64_LINUX-NEXT: retq
479 ; X86_WIN-LABEL: f12:
480 ; X86_WIN: # %bb.0: # %entry
481 ; X86_WIN-NEXT: movl __tls_index, %eax
482 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
483 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
484 ; X86_WIN-NEXT: movswl _s1@SECREL32(%eax), %eax
487 ; X64_WIN-LABEL: f12:
488 ; X64_WIN: # %bb.0: # %entry
489 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
490 ; X64_WIN-NEXT: movq %gs:88, %rcx
491 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
492 ; X64_WIN-NEXT: movswl s1@SECREL32(%rax), %eax
495 ; MINGW32-LABEL: f12:
496 ; MINGW32: # %bb.0: # %entry
497 ; MINGW32-NEXT: movl __tls_index, %eax
498 ; MINGW32-NEXT: movl %fs:44, %ecx
499 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
500 ; MINGW32-NEXT: movswl _s1@SECREL32(%eax), %eax
505 %tmp1 = load i16, ptr @s1
506 %tmp2 = sext i16 %tmp1 to i32
510 define dso_local i8 @f13() {
511 ; X86_LINUX-LABEL: f13:
512 ; X86_LINUX: # %bb.0: # %entry
513 ; X86_LINUX-NEXT: movzbl %gs:b1@NTPOFF, %eax
514 ; X86_LINUX-NEXT: retl
516 ; X64_LINUX-LABEL: f13:
517 ; X64_LINUX: # %bb.0: # %entry
518 ; X64_LINUX-NEXT: movzbl %fs:b1@TPOFF, %eax
519 ; X64_LINUX-NEXT: retq
521 ; X86_WIN-LABEL: f13:
522 ; X86_WIN: # %bb.0: # %entry
523 ; X86_WIN-NEXT: movl __tls_index, %eax
524 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
525 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
526 ; X86_WIN-NEXT: movzbl _b1@SECREL32(%eax), %eax
529 ; X64_WIN-LABEL: f13:
530 ; X64_WIN: # %bb.0: # %entry
531 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
532 ; X64_WIN-NEXT: movq %gs:88, %rcx
533 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
534 ; X64_WIN-NEXT: movzbl b1@SECREL32(%rax), %eax
537 ; MINGW32-LABEL: f13:
538 ; MINGW32: # %bb.0: # %entry
539 ; MINGW32-NEXT: movl __tls_index, %eax
540 ; MINGW32-NEXT: movl %fs:44, %ecx
541 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
542 ; MINGW32-NEXT: movzbl _b1@SECREL32(%eax), %eax
546 %tmp1 = load i8, ptr @b1
550 define dso_local i32 @f14() {
551 ; X86_LINUX-LABEL: f14:
552 ; X86_LINUX: # %bb.0: # %entry
553 ; X86_LINUX-NEXT: movsbl %gs:b1@NTPOFF, %eax
554 ; X86_LINUX-NEXT: retl
556 ; X64_LINUX-LABEL: f14:
557 ; X64_LINUX: # %bb.0: # %entry
558 ; X64_LINUX-NEXT: movsbl %fs:b1@TPOFF, %eax
559 ; X64_LINUX-NEXT: retq
561 ; X86_WIN-LABEL: f14:
562 ; X86_WIN: # %bb.0: # %entry
563 ; X86_WIN-NEXT: movl __tls_index, %eax
564 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
565 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
566 ; X86_WIN-NEXT: movsbl _b1@SECREL32(%eax), %eax
569 ; X64_WIN-LABEL: f14:
570 ; X64_WIN: # %bb.0: # %entry
571 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
572 ; X64_WIN-NEXT: movq %gs:88, %rcx
573 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
574 ; X64_WIN-NEXT: movsbl b1@SECREL32(%rax), %eax
577 ; MINGW32-LABEL: f14:
578 ; MINGW32: # %bb.0: # %entry
579 ; MINGW32-NEXT: movl __tls_index, %eax
580 ; MINGW32-NEXT: movl %fs:44, %ecx
581 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
582 ; MINGW32-NEXT: movsbl _b1@SECREL32(%eax), %eax
586 %tmp1 = load i8, ptr @b1
587 %tmp2 = sext i8 %tmp1 to i32
591 define dso_local ptr @f15() {
592 ; X86_LINUX-LABEL: f15:
593 ; X86_LINUX: # %bb.0: # %entry
594 ; X86_LINUX-NEXT: movl %gs:0, %eax
595 ; X86_LINUX-NEXT: leal b2@NTPOFF(%eax), %eax
596 ; X86_LINUX-NEXT: retl
598 ; X64_LINUX-LABEL: f15:
599 ; X64_LINUX: # %bb.0: # %entry
600 ; X64_LINUX-NEXT: movq %fs:0, %rax
601 ; X64_LINUX-NEXT: leaq b2@TPOFF(%rax), %rax
602 ; X64_LINUX-NEXT: retq
604 ; X86_WIN-LABEL: f15:
605 ; X86_WIN: # %bb.0: # %entry
606 ; X86_WIN-NEXT: movl %fs:__tls_array, %eax
607 ; X86_WIN-NEXT: movl (%eax), %eax
608 ; X86_WIN-NEXT: leal _b2@SECREL32(%eax), %eax
611 ; X64_WIN-LABEL: f15:
612 ; X64_WIN: # %bb.0: # %entry
613 ; X64_WIN-NEXT: movq %gs:88, %rax
614 ; X64_WIN-NEXT: movq (%rax), %rax
615 ; X64_WIN-NEXT: leaq b2@SECREL32(%rax), %rax
618 ; MINGW32-LABEL: f15:
619 ; MINGW32: # %bb.0: # %entry
620 ; MINGW32-NEXT: movl %fs:44, %eax
621 ; MINGW32-NEXT: movl (%eax), %eax
622 ; MINGW32-NEXT: leal _b2@SECREL32(%eax), %eax
629 define dso_local ptr @f16() {
630 ; X86_LINUX-LABEL: f16:
631 ; X86_LINUX: # %bb.0:
632 ; X86_LINUX-NEXT: movl %gs:0, %eax
633 ; X86_LINUX-NEXT: leal i6@NTPOFF(%eax), %eax
634 ; X86_LINUX-NEXT: retl
636 ; X64_LINUX-LABEL: f16:
637 ; X64_LINUX: # %bb.0:
638 ; X64_LINUX-NEXT: movq %fs:0, %rax
639 ; X64_LINUX-NEXT: leaq i6@TPOFF(%rax), %rax
640 ; X64_LINUX-NEXT: retq
642 ; X86_WIN-LABEL: f16:
644 ; X86_WIN-NEXT: movl __tls_index, %eax
645 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
646 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
647 ; X86_WIN-NEXT: leal _i6@SECREL32(%eax), %eax
650 ; X64_WIN-LABEL: f16:
652 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
653 ; X64_WIN-NEXT: movq %gs:88, %rcx
654 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
655 ; X64_WIN-NEXT: leaq i6@SECREL32(%rax), %rax
658 ; MINGW32-LABEL: f16:
660 ; MINGW32-NEXT: movl __tls_index, %eax
661 ; MINGW32-NEXT: movl %fs:44, %ecx
662 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
663 ; MINGW32-NEXT: leal _i6@SECREL32(%eax), %eax
670 ; NOTE: Similar to f1() but with direct TLS segment access disabled
671 define dso_local i32 @f17() #0 {
672 ; X86_LINUX-LABEL: f17:
673 ; X86_LINUX: # %bb.0: # %entry
674 ; X86_LINUX-NEXT: movl %gs:0, %eax
675 ; X86_LINUX-NEXT: movl i1@NTPOFF(%eax), %eax
676 ; X86_LINUX-NEXT: retl
678 ; X64_LINUX-LABEL: f17:
679 ; X64_LINUX: # %bb.0: # %entry
680 ; X64_LINUX-NEXT: movq %fs:0, %rax
681 ; X64_LINUX-NEXT: movl i1@TPOFF(%rax), %eax
682 ; X64_LINUX-NEXT: retq
684 ; X86_WIN-LABEL: f17:
685 ; X86_WIN: # %bb.0: # %entry
686 ; X86_WIN-NEXT: movl __tls_index, %eax
687 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
688 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
689 ; X86_WIN-NEXT: movl _i1@SECREL32(%eax), %eax
692 ; X64_WIN-LABEL: f17:
693 ; X64_WIN: # %bb.0: # %entry
694 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
695 ; X64_WIN-NEXT: movq %gs:88, %rcx
696 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
697 ; X64_WIN-NEXT: movl i1@SECREL32(%rax), %eax
700 ; MINGW32-LABEL: f17:
701 ; MINGW32: # %bb.0: # %entry
702 ; MINGW32-NEXT: movl __tls_index, %eax
703 ; MINGW32-NEXT: movl %fs:44, %ecx
704 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
705 ; MINGW32-NEXT: movl _i1@SECREL32(%eax), %eax
709 %tmp1 = load i32, ptr @i1
713 ; NOTE: Similar to f3() but with direct TLS segment access disabled
714 define dso_local i32 @f18() #1 {
715 ; X86_LINUX-LABEL: f18:
716 ; X86_LINUX: # %bb.0: # %entry
717 ; X86_LINUX-NEXT: movl i2@INDNTPOFF, %eax
718 ; X86_LINUX-NEXT: movl %gs:0, %ecx
719 ; X86_LINUX-NEXT: movl (%ecx,%eax), %eax
720 ; X86_LINUX-NEXT: retl
722 ; X64_LINUX-LABEL: f18:
723 ; X64_LINUX: # %bb.0: # %entry
724 ; X64_LINUX-NEXT: movq i2@GOTTPOFF(%rip), %rax
725 ; X64_LINUX-NEXT: movq %fs:0, %rcx
726 ; X64_LINUX-NEXT: movl (%rcx,%rax), %eax
727 ; X64_LINUX-NEXT: retq
729 ; X86_WIN-LABEL: f18:
730 ; X86_WIN: # %bb.0: # %entry
731 ; X86_WIN-NEXT: movl __tls_index, %eax
732 ; X86_WIN-NEXT: movl %fs:__tls_array, %ecx
733 ; X86_WIN-NEXT: movl (%ecx,%eax,4), %eax
734 ; X86_WIN-NEXT: movl _i2@SECREL32(%eax), %eax
737 ; X64_WIN-LABEL: f18:
738 ; X64_WIN: # %bb.0: # %entry
739 ; X64_WIN-NEXT: movl _tls_index(%rip), %eax
740 ; X64_WIN-NEXT: movq %gs:88, %rcx
741 ; X64_WIN-NEXT: movq (%rcx,%rax,8), %rax
742 ; X64_WIN-NEXT: movl i2@SECREL32(%rax), %eax
745 ; MINGW32-LABEL: f18:
746 ; MINGW32: # %bb.0: # %entry
747 ; MINGW32-NEXT: movl __tls_index, %eax
748 ; MINGW32-NEXT: movl %fs:44, %ecx
749 ; MINGW32-NEXT: movl (%ecx,%eax,4), %eax
750 ; MINGW32-NEXT: movl _i2@SECREL32(%eax), %eax
755 %tmp1 = load i32, ptr @i2
759 attributes #0 = { "indirect-tls-seg-refs" }
760 attributes #1 = { nounwind "indirect-tls-seg-refs" }