1 ; RUN: llc < %s -emulated-tls -mtriple=i686-linux-android -relocation-model=pic \ 2 ; RUN: | FileCheck -check-prefix=X86_32 %s 3 ; RUN: llc < %s -emulated-tls -mtriple=x86_64-linux-android -march=x86 -relocation-model=pic \ 4 ; RUN: | FileCheck -check-prefix=X86_32 %s 5 ; RUN: llc < %s -emulated-tls -mtriple=x86_64-linux-android -relocation-model=pic \ 6 ; RUN: | FileCheck -check-prefix=X86_64 %s 7 ; RUN: llc < %s -emulated-tls -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic \ 8 ; RUN: | FileCheck %s 9 10 ; Make sure that TLS symbols are emitted in expected order. 11 12 @external_x = external thread_local global i32, align 8 13 @external_y = thread_local global i8 7, align 2 14 @internal_y = internal thread_local global i64 9, align 16 15 16 define i32* @get_external_x() { 17 entry: 18 ret i32* @external_x 19 } 20 21 define i8* @get_external_y() { 22 entry: 23 ret i8* @external_y 24 } 25 26 define i64* @get_internal_y() { 27 entry: 28 ret i64* @internal_y 29 } 30 31 ; CHECK-LABEL: get_external_x: 32 ; CHECK-NOT: _tls_get_address 33 ; CHECK: __emutls_get_address 34 ; CHECK-LABEL: get_external_y: 35 ; CHECK: __emutls_get_address 36 ; CHECK-NOT: _tls_get_address 37 ; CHECK-LABEL: get_internal_y: 38 ; CHECK-NOT: __emutls_t.external_x: 39 ; CHECK-NOT: __emutls_v.external_x: 40 ; CHECK-LABEL: __emutls_v.external_y: 41 ; CHECK-LABEL: __emutls_t.external_y: 42 ; CHECK: __emutls_t.external_y 43 ; CHECK-LABEL: __emutls_v.internal_y: 44 ; CHECK-LABEL: __emutls_t.internal_y: 45 ; CHECK: __emutls_t.internal_y 46 47 ; X86_32-LABEL: get_external_x: 48 ; X86_32: movl __emutls_v.external_x@GOT(%ebx) 49 ; X86_32: calll __emutls_get_address 50 ; X86_32-LABEL: get_external_y: 51 ; X86_32: movl __emutls_v.external_y@GOT(%ebx) 52 ; X86_32: calll __emutls_get_address 53 ; X86_32-LABEL: get_internal_y: 54 ; X86_32: leal __emutls_v.internal_y@GOTOFF(%ebx) 55 ; X86_32: calll __emutls_get_address 56 ; X86_32-NOT: __emutls_t.external_x 57 ; X86_32-NOT: __emutls_v.external_x: 58 ; X86_32: .data{{$}} 59 ; X86_32: .globl __emutls_v.external_y 60 ; X86_32: .p2align 2 61 ; X86_32-LABEL: __emutls_v.external_y: 62 ; X86_32-NEXT: .long 1 63 ; X86_32-NEXT: .long 2 64 ; X86_32-NEXT: .long 0 65 ; X86_32-NEXT: .long __emutls_t.external_y 66 ; X86_32: .section .rodata, 67 ; X86_32-LABEL: __emutls_t.external_y: 68 ; X86_32-NEXT: .byte 7 69 ; X86_32: .data{{$}} 70 ; X86_32-NOT: .globl 71 ; X86_32: .p2align 2 72 ; X86_32-LABEL: __emutls_v.internal_y: 73 ; X86_32-NEXT: .long 8 74 ; X86_32-NEXT: .long 16 75 ; X86_32-NEXT: .long 0 76 ; X86_32-NEXT: .long __emutls_t.internal_y 77 ; X86_32-LABEL: __emutls_t.internal_y: 78 ; X86_32-NEXT: .quad 9 79 ; X86_64-LABEL: get_external_x: 80 ; X86_64: __emutls_v.external_x@GOTPCREL(%rip) 81 ; X86_64: __emutls_get_address 82 ; X86_64-LABEL: get_external_y: 83 ; X86_64: __emutls_v.external_y@GOTPCREL(%rip) 84 ; X86_64: __emutls_get_address 85 ; X86_64-LABEL: get_internal_y: 86 ; X86_64: __emutls_v.internal_y(%rip) 87 ; X86_64: __emutls_get_address 88 ; X86_64-NOT: __emutls_t.external_x 89 ; X86_64-NOT: __emutls_v.external_x: 90 ; X86_64: .globl __emutls_v.external_y 91 ; X86_64: .p2align 3 92 ; X86_64-LABEL: __emutls_v.external_y: 93 ; X86_64-NEXT: .quad 1 94 ; X86_64-NEXT: .quad 2 95 ; X86_64-NEXT: .quad 0 96 ; X86_64-NEXT: .quad __emutls_t.external_y 97 ; X86_64-NOT: __emutls_v.external_x: 98 ; X86_64: .section .rodata, 99 ; X86_64-LABEL: __emutls_t.external_y: 100 ; X86_64-NEXT: .byte 7 101 ; X86_64: .data{{$}} 102 ; X86_64-NOT: .globl 103 ; X86_64: .p2align 3 104 ; X86_64-LABEL: __emutls_v.internal_y: 105 ; X86_64-NEXT: .quad 8 106 ; X86_64-NEXT: .quad 16 107 ; X86_64-NEXT: .quad 0 108 ; X86_64-NEXT: .quad __emutls_t.internal_y 109 ; X86_64: .section .rodata, 110 ; X86_64-LABEL: __emutls_t.internal_y: 111 ; X86_64-NEXT: .quad 9 112