1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mcpu=generic -mtriple=i386-linux-gnu -relocation-model=pic | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnux32 -relocation-model=pic | FileCheck %s --check-prefix=X32
4 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck %s --check-prefix=X64
6 @i = dso_local thread_local global i32 15
7 @i2 = external thread_local global i32
9 define dso_local i32 @f1() {
11 ; X86: # %bb.0: # %entry
12 ; X86-NEXT: movl %gs:i@NTPOFF, %eax
16 ; X32: # %bb.0: # %entry
17 ; X32-NEXT: movl %fs:i@TPOFF, %eax
21 ; X64: # %bb.0: # %entry
22 ; X64-NEXT: movl %fs:i@TPOFF, %eax
25 %tmp1 = load i32, ptr @i
29 define dso_local ptr @f2() {
31 ; X86: # %bb.0: # %entry
32 ; X86-NEXT: movl %gs:0, %eax
33 ; X86-NEXT: leal i@NTPOFF(%eax), %eax
37 ; X32: # %bb.0: # %entry
38 ; X32-NEXT: movl %fs:0, %eax
39 ; X32-NEXT: leal i@TPOFF(%rax), %eax
43 ; X64: # %bb.0: # %entry
44 ; X64-NEXT: movq %fs:0, %rax
45 ; X64-NEXT: leaq i@TPOFF(%rax), %rax
51 define dso_local i32 @f3() {
53 ; X86: # %bb.0: # %entry
54 ; X86-NEXT: calll .L2$pb
55 ; X86-NEXT: .cfi_adjust_cfa_offset 4
58 ; X86-NEXT: .cfi_adjust_cfa_offset -4
60 ; X86-NEXT: addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L2$pb), %eax
61 ; X86-NEXT: movl i2@GOTNTPOFF(%eax), %eax
62 ; X86-NEXT: movl %gs:(%eax), %eax
66 ; X32: # %bb.0: # %entry
67 ; X32-NEXT: movl i2@GOTTPOFF(%rip), %eax
68 ; X32-NEXT: movl %fs:0, %ecx
69 ; X32-NEXT: movl (%ecx,%eax), %eax
73 ; X64: # %bb.0: # %entry
74 ; X64-NEXT: movq i2@GOTTPOFF(%rip), %rax
75 ; X64-NEXT: movl %fs:(%rax), %eax
78 %tmp1 = load i32, ptr @i2
82 define dso_local ptr @f4() {
84 ; X86: # %bb.0: # %entry
85 ; X86-NEXT: calll .L3$pb
86 ; X86-NEXT: .cfi_adjust_cfa_offset 4
89 ; X86-NEXT: .cfi_adjust_cfa_offset -4
91 ; X86-NEXT: addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp1-.L3$pb), %ecx
92 ; X86-NEXT: movl %gs:0, %eax
93 ; X86-NEXT: addl i2@GOTNTPOFF(%ecx), %eax
97 ; X32: # %bb.0: # %entry
98 ; X32-NEXT: movl %fs:0, %eax
99 ; X32-NEXT: addl i2@GOTTPOFF(%rip), %eax
103 ; X64: # %bb.0: # %entry
104 ; X64-NEXT: movq %fs:0, %rax
105 ; X64-NEXT: addq i2@GOTTPOFF(%rip), %rax
111 !llvm.module.flags = !{!0, !1}
112 !0 = !{i32 1, !"PIC Level", i32 1}
113 !1 = !{i32 1, !"PIE Level", i32 1}