1 ; RUN: llc < %s -mtriple=i386-linux-gnu -relocation-model=pic | FileCheck %s --check-prefix=X86
2 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck %s --check-prefix=X64
4 @i = thread_local global i32 15
5 @j = internal thread_local global i32 42
6 @k = internal thread_local global i32 42
10 %tmp1 = load i32, i32* @i
15 ; X86: leal i@TLSGD(,%ebx), %eax
16 ; X86: calll ___tls_get_addr@PLT
19 ; X64: leaq i@TLSGD(%rip), %rdi
20 ; X64: callq __tls_get_addr@PLT
23 @i2 = external thread_local global i32
31 ; X86: leal i@TLSGD(,%ebx), %eax
32 ; X86: calll ___tls_get_addr@PLT
35 ; X64: leaq i@TLSGD(%rip), %rdi
36 ; X64: callq __tls_get_addr@PLT
42 %tmp1 = load i32, i32* @i ; <i32> [#uses=1]
47 ; X86: leal i@TLSGD(,%ebx), %eax
48 ; X86: calll ___tls_get_addr@PLT
51 ; X64: leaq i@TLSGD(%rip), %rdi
52 ; X64: callq __tls_get_addr@PLT
55 define i32* @f4() nounwind {
61 ; X86: leal i@TLSGD(,%ebx), %eax
62 ; X86: calll ___tls_get_addr@PLT
65 ; X64: leaq i@TLSGD(%rip), %rdi
66 ; X64: callq __tls_get_addr@PLT
69 define i32 @f5() nounwind {
71 %0 = load i32, i32* @j, align 4
72 %1 = load i32, i32* @k, align 4
73 %add = add nsw i32 %0, %1
78 ; X86: leal {{[jk]}}@TLSLDM(%ebx)
79 ; X86: calll ___tls_get_addr@PLT
80 ; X86: movl {{[jk]}}@DTPOFF(%e
81 ; X86: addl {{[jk]}}@DTPOFF(%e
84 ; X64: leaq {{[jk]}}@TLSLD(%rip), %rdi
85 ; X64: callq __tls_get_addr@PLT
86 ; X64: movl {{[jk]}}@DTPOFF(%r
87 ; X64: addl {{[jk]}}@DTPOFF(%r