1 ; RUN: llc < %s -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X32 %s
2 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X64 %s
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 ; X32: leal i@TLSGD(,%ebx), %eax
16 ; X32: 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 ; X32: leal i@TLSGD(,%ebx), %eax
32 ; X32: 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 ; X32: leal i@TLSGD(,%ebx), %eax
48 ; X32: 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 ; X32: leal i@TLSGD(,%ebx), %eax
62 ; X32: 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 ; X32: leal {{[jk]}}@TLSLDM(%ebx)
79 ; X32: calll ___tls_get_addr@PLT
80 ; X32: movl {{[jk]}}@DTPOFF(%e
81 ; X32: 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