• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -emulated-tls -mtriple=aarch64-linux-android -relocation-model=pic \
2; RUN:     | FileCheck -check-prefix=ARM_64 %s
3; RUN: llc < %s -emulated-tls -mtriple=aarch64-linux-android -relocation-model=pic -O3 \
4; RUN:     | FileCheck -check-prefix=ARM_64 %s
5; RUN: llc < %s -emulated-tls -mtriple=aarch64-linux-android -O3 \
6; RUN:     | FileCheck -check-prefix=ARM_64 %s
7; RUN: llc < %s -emulated-tls -mtriple=aarch64-windows-gnu -O3 \
8; RUN:     | FileCheck -check-prefix=ARM_64 %s
9; RUN: llc < %s -emulated-tls -mtriple=aarch64-apple-darwin -O3 \
10; RUN:     | FileCheck -check-prefix=DARWIN %s
11
12; RUN: llc < %s -mtriple=aarch64-linux-android -relocation-model=pic \
13; RUN:     | FileCheck -check-prefix=ARM_64 %s
14; RUN: llc < %s -mtriple=aarch64-linux-android -relocation-model=pic -O3 \
15; RUN:     | FileCheck -check-prefix=ARM_64 %s
16; RUN: llc < %s -mtriple=aarch64-linux-android -O3 \
17; RUN:     | FileCheck -check-prefix=ARM_64 %s
18; aarch64-windows-gnu needs explicit -emulated-tls
19; RUN: llc < %s -mtriple=aarch64-apple-darwin -O3 \
20; RUN:     | FileCheck -check-prefix=NoEMU %s
21
22; NoEMU-NOT: __emutls
23
24; Make sure that TLS symbols are emitted in expected order.
25
26@external_x = external thread_local global i32, align 8
27@external_y = thread_local global i8 7, align 2
28@internal_y = internal thread_local global i64 9, align 16
29
30define i32* @get_external_x() {
31entry:
32  ret i32* @external_x
33}
34
35define i8* @get_external_y() {
36entry:
37  ret i8* @external_y
38}
39
40define i64* @get_internal_y() {
41entry:
42  ret i64* @internal_y
43}
44
45; ARM_64-LABEL:  get_external_x:
46; ARM_64:      __emutls_v.external_x
47; ARM_64:      __emutls_get_address
48; ARM_64-LABEL:  get_external_y:
49; ARM_64:      __emutls_v.external_y
50; ARM_64:      __emutls_get_address
51; ARM_64-LABEL:  get_internal_y:
52; ARM_64:      __emutls_v.internal_y
53; ARM_64:      __emutls_get_address
54; ARM_64-NOT:   __emutls_t.external_x
55; ARM_64-NOT:   __emutls_v.external_x:
56; ARM_64:        .data{{$}}
57; ARM_64:        .globl __emutls_v.external_y
58; ARM_64:        .p2align 3
59; ARM_64-LABEL:  __emutls_v.external_y:
60; ARM_64-NEXT:   .xword 1
61; ARM_64-NEXT:   .xword 2
62; ARM_64-NEXT:   .xword 0
63; ARM_64-NEXT:   .xword __emutls_t.external_y
64; ARM_64-NOT:    __emutls_v.external_x:
65; ARM_64:        .section .r{{o?}}data,
66; ARM_64-LABEL:  __emutls_t.external_y:
67; ARM_64-NEXT:   .byte 7
68; ARM_64:        .data{{$}}
69; ARM_64-NOT:    .globl __emutls_v
70; ARM_64:        .p2align 3
71; ARM_64-LABEL:  __emutls_v.internal_y:
72; ARM_64-NEXT:   .xword 8
73; ARM_64-NEXT:   .xword 16
74; ARM_64-NEXT:   .xword 0
75; ARM_64-NEXT:   .xword __emutls_t.internal_y
76; ARM_64:        .section .r{{o?}}data,
77; ARM_64-LABEL:  __emutls_t.internal_y:
78; ARM_64-NEXT:   .xword 9
79
80; DARWIN-LABEL:  _get_external_x:
81; DARWIN:        ___emutls_v.external_x
82; DARWIN:        ___emutls_get_address
83; DARWIN-LABEL:  _get_external_y:
84; DARWIN:        ___emutls_v.external_y
85; DARWIN:        ___emutls_get_address
86; DARWIN-LABEL:  _get_internal_y:
87; DARWIN:        ___emutls_v.internal_y
88; DARWIN:        ___emutls_get_address
89; DARWIN-NOT:    ___emutls_t.external_x
90; DARWIN-NOT:    ___emutls_v.external_x:
91; DARWIN:        .section __DATA,__data
92; DARWIN:        .globl ___emutls_v.external_y
93; DARWIN:        .p2align 3
94; DARWIN-LABEL:  ___emutls_v.external_y:
95; DARWIN-NEXT:   .quad 1
96; DARWIN-NEXT:   .quad 2
97; DARWIN-NEXT:   .quad 0
98; DARWIN-NEXT:   .quad ___emutls_t.external_y
99; DARWIN-NOT:    ___emutls_v.external_x:
100; DARWIN:        .section __TEXT,__const
101; DARWIN-LABEL:  ___emutls_t.external_y:
102; DARWIN-NEXT:   .byte 7
103; DARWIN:        .section __DATA,__data
104; DARWIN-NOT:    .globl ___emutls_v
105; DARWIN:        .p2align 3
106; DARWIN-LABEL:  ___emutls_v.internal_y:
107; DARWIN-NEXT:   .quad 8
108; DARWIN-NEXT:   .quad 16
109; DARWIN-NEXT:   .quad 0
110; DARWIN-NEXT:   .quad ___emutls_t.internal_y
111; DARWIN:        .section __TEXT,__const
112; DARWIN-LABEL:  ___emutls_t.internal_y:
113; DARWIN-NEXT:   .quad 9
114