1 ; RUN: llc < %s -emulated-tls -mtriple=arm-linux-android -relocation-model=pic \
2 ; RUN: | FileCheck -check-prefix=ARM_32 %s
3 ; RUN: llc < %s -emulated-tls -mtriple=arm-linux-androidabi -relocation-model=pic \
4 ; RUN: | FileCheck -check-prefix=ARM_32 %s
5 ; RUN: llc < %s -emulated-tls -mtriple=arm-linux-androidabi -relocation-model=pic -O3 \
6 ; RUN: | FileCheck -check-prefix=ARM_32 %s
7 ; RUN: llc < %s -emulated-tls -mtriple=arm-linux-androidabi -O3 \
8 ; RUN: | FileCheck -check-prefix=ARM_32 %s
9 ; RUN: llc < %s -emulated-tls -mtriple=arm-apple-darwin -O3 \
10 ; RUN: | FileCheck -check-prefix=DARWIN %s
11 ; RUN: llc < %s -emulated-tls -mtriple=thumbv7-windows-gnu -O3 \
12 ; RUN: | FileCheck -check-prefix=WIN %s
14 ; RUN: llc < %s -mtriple=arm-linux-android -relocation-model=pic \
15 ; RUN: | FileCheck -check-prefix=ARM_32 %s
16 ; RUN: llc < %s -mtriple=arm-linux-androidabi -relocation-model=pic \
17 ; RUN: | FileCheck -check-prefix=ARM_32 %s
18 ; RUN: llc < %s -mtriple=arm-linux-androidabi -relocation-model=pic -O3 \
19 ; RUN: | FileCheck -check-prefix=ARM_32 %s
20 ; RUN: llc < %s -mtriple=arm-linux-androidabi -O3 \
21 ; RUN: | FileCheck -check-prefix=ARM_32 %s
22 ; arm-apple-darwin must use -emulated-tls
23 ; windows must use -emulated-tls
25 ; Make sure that TLS symbols are emitted in expected order.
27 @external_x = external thread_local global i32, align 8
28 @external_y = thread_local global i8 7, align 2
29 @internal_y = internal thread_local global i64 9, align 16
31 define i32* @get_external_x() {
36 define i8* @get_external_y() {
41 define i64* @get_internal_y() {
46 ; ARM_32-LABEL: get_external_x:
47 ; ARM_32: bl __emutls_get_address
48 ; ARM_32: .long __emutls_v.external_x
49 ; ARM_32-LABEL: get_external_y:
50 ; ARM_32: bl __emutls_get_address
51 ; ARM_32: .long __emutls_v.external_y
52 ; ARM_32-LABEL: get_internal_y:
53 ; ARM_32: bl __emutls_get_address
54 ; ARM_32: .long __emutls_v.internal_y
55 ; ARM_32-NOT: __emutls_t.external_x
56 ; ARM_32-NOT: __emutls_v.external_x:
58 ; ARM_32: .globl __emutls_v.external_y
60 ; ARM_32-LABEL: __emutls_v.external_y:
61 ; ARM_32-NEXT: .long 1
62 ; ARM_32-NEXT: .long 2
63 ; ARM_32-NEXT: .long 0
64 ; ARM_32-NEXT: .long __emutls_t.external_y
65 ; ARM_32: .section .rodata,
66 ; ARM_32-LABEL: __emutls_t.external_y:
67 ; ARM_32-NEXT: .byte 7
71 ; ARM_32-LABEL: __emutls_v.internal_y:
72 ; ARM_32-NEXT: .long 8
73 ; ARM_32-NEXT: .long 16
74 ; ARM_32-NEXT: .long 0
75 ; ARM_32-NEXT: .long __emutls_t.internal_y
76 ; ARM_32-LABEL: __emutls_t.internal_y:
77 ; ARM_32-NEXT: .long 9
78 ; ARM_32-NEXT: .long 0
80 ; WIN-LABEL: get_external_x:
81 ; WIN: movw r0, :lower16:.refptr.__emutls_v.external_x
82 ; WIN: movt r0, :upper16:.refptr.__emutls_v.external_x
84 ; WIN: bl __emutls_get_address
85 ; WIN-LABEL: get_external_y:
86 ; WIN: movw r0, :lower16:__emutls_v.external_y
87 ; WIN: movt r0, :upper16:__emutls_v.external_y
88 ; WIN: bl __emutls_get_address
89 ; WIN-LABEL: get_internal_y:
90 ; WIN: movw r0, :lower16:__emutls_v.internal_y
91 ; WIN: movt r0, :upper16:__emutls_v.internal_y
92 ; WIN: bl __emutls_get_address
93 ; WIN-NOT: __emutls_t.external_x
94 ; WIN-NOT: __emutls_v.external_x:
96 ; WIN: .globl __emutls_v.external_y
98 ; WIN-LABEL: __emutls_v.external_y:
102 ; WIN-NEXT: .long __emutls_t.external_y
103 ; WIN: .section .rdata,
104 ; WIN-LABEL: __emutls_t.external_y:
109 ; WIN-LABEL: __emutls_v.internal_y:
113 ; WIN-NEXT: .long __emutls_t.internal_y
114 ; WIN-LABEL: __emutls_t.internal_y:
115 ; .quad 9 is equivalent to .long 9 .long 0
118 ; DARWIN-LABEL: _get_external_x:
119 ; DARWIN: bl ___emutls_get_address
120 ; DARWIN: .long L___emutls_v.external_x$non_lazy_ptr-(LPC0_0+8)
121 ; DARWIN-LABEL: _get_external_y:
122 ; DARWIN: bl ___emutls_get_address
123 ; DARWIN: .long ___emutls_v.external_y-(LPC1_0+8)
124 ; DARWIN-LABEL: _get_internal_y:
125 ; DARWIN: bl ___emutls_get_address
126 ; DARWIN: .long ___emutls_v.internal_y-(LPC2_0+8)
127 ; DARWIN-NOT: ___emutls_t.external_x
128 ; DARWIN-NOT: ___emutls_v.external_x:
129 ; DARWIN: .section __DATA,__data
130 ; DARWIN: .globl ___emutls_v.external_y
132 ; DARWIN-LABEL: ___emutls_v.external_y:
133 ; DARWIN-NEXT: .long 1
134 ; DARWIN-NEXT: .long 2
135 ; DARWIN-NEXT: .long 0
136 ; DARWIN-NEXT: .long ___emutls_t.external_y
137 ; DARWIN: .section __TEXT,__const
138 ; DARWIN-LABEL: ___emutls_t.external_y:
139 ; DARWIN-NEXT: .byte 7
140 ; DARWIN: .section __DATA,__data
143 ; DARWIN-LABEL: ___emutls_v.internal_y:
144 ; DARWIN-NEXT: .long 8
145 ; DARWIN-NEXT: .long 16
146 ; DARWIN-NEXT: .long 0
147 ; DARWIN-NEXT: .long ___emutls_t.internal_y
148 ; DARWIN-LABEL: ___emutls_t.internal_y:
149 ; DARWIN-NEXT: .long 9
150 ; DARWIN-NEXT: .long 0