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 3 4 @i = thread_local global i32 15 5 6 define i32 @f1() { 7 entry: 8 %tmp1 = load i32* @i 9 ret i32 %tmp1 10 } 11 12 ; X32: f1: 13 ; X32: leal i@TLSGD(,%ebx), %eax 14 ; X32: calll ___tls_get_addr@PLT 15 16 ; X64: f1: 17 ; X64: leaq i@TLSGD(%rip), %rdi 18 ; X64: callq __tls_get_addr@PLT 19 20 21 @i2 = external thread_local global i32 22 23 define i32* @f2() { 24 entry: 25 ret i32* @i 26 } 27 28 ; X32: f2: 29 ; X32: leal i@TLSGD(,%ebx), %eax 30 ; X32: calll ___tls_get_addr@PLT 31 32 ; X64: f2: 33 ; X64: leaq i@TLSGD(%rip), %rdi 34 ; X64: callq __tls_get_addr@PLT 35 36 37 38 define i32 @f3() { 39 entry: 40 %tmp1 = load i32* @i ; <i32> [#uses=1] 41 ret i32 %tmp1 42 } 43 44 ; X32: f3: 45 ; X32: leal i@TLSGD(,%ebx), %eax 46 ; X32: calll ___tls_get_addr@PLT 47 48 ; X64: f3: 49 ; X64: leaq i@TLSGD(%rip), %rdi 50 ; X64: callq __tls_get_addr@PLT 51 52 53 define i32* @f4() nounwind { 54 entry: 55 ret i32* @i 56 } 57 58 ; X32: f4: 59 ; X32: leal i@TLSGD(,%ebx), %eax 60 ; X32: calll ___tls_get_addr@PLT 61 62 ; X64: f4: 63 ; X64: leaq i@TLSGD(%rip), %rdi 64 ; X64: callq __tls_get_addr@PLT 65 66 67 68