• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
13
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
24
25; Make sure that TLS symbols are emitted in expected order.
26
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
30
31define i32* @get_external_x() {
32entry:
33  ret i32* @external_x
34}
35
36define i8* @get_external_y() {
37entry:
38  ret i8* @external_y
39}
40
41define i64* @get_internal_y() {
42entry:
43  ret i64* @internal_y
44}
45
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:
57; ARM_32:        .data{{$}}
58; ARM_32:        .globl __emutls_v.external_y
59; ARM_32:        .p2align 2
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
68; ARM_32:        .data{{$}}
69; ARM_32-NOT:    .globl
70; ARM_32:        .p2align 2
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
79
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
83; WIN:        ldr  r0, [r0]
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:
95; WIN:        .data{{$}}
96; WIN:        .globl __emutls_v.external_y
97; WIN:        .p2align 2
98; WIN-LABEL:  __emutls_v.external_y:
99; WIN-NEXT:   .long 1
100; WIN-NEXT:   .long 2
101; WIN-NEXT:   .long 0
102; WIN-NEXT:   .long __emutls_t.external_y
103; WIN:        .section .rdata,
104; WIN-LABEL:  __emutls_t.external_y:
105; WIN-NEXT:   .byte 7
106; WIN:        .data{{$}}
107; WIN-NOT:    .globl
108; WIN:        .p2align 2
109; WIN-LABEL:  __emutls_v.internal_y:
110; WIN-NEXT:   .long 8
111; WIN-NEXT:   .long 16
112; WIN-NEXT:   .long 0
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
116; WIN-NEXT:   .quad 9
117
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
131; DARWIN:        .p2align 2
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
141; DARWIN-NOT:    .globl
142; DARWIN:        .p2align 2
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
151