• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple thumbv7--windows-itanium %s -o - | FileCheck %s
2
3@i = thread_local global i32 0
4@j = external thread_local global i32
5@k = internal thread_local global i32 0
6@l = hidden thread_local global i32 0
7@m = external hidden thread_local global i32
8@n = thread_local global i16 0
9@o = thread_local global i8 0
10
11define i32 @f() {
12  %1 = load i32, i32* @i
13  ret i32 %1
14}
15
16; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
17
18; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
19; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
20; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
21; CHECK-NEXT: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
22; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
23
24; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
25
26; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
27
28; CHECK: [[CPI]]:
29; CHECK-NEXT: .long i(SECREL32)
30
31define i32 @e() {
32  %1 = load i32, i32* @j
33  ret i32 %1
34}
35
36; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
37
38; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
39; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
40; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
41; CHECK-NEXT: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
42; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
43
44; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
45
46; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
47
48; CHECK: [[CPI]]:
49; CHECK-NEXT: .long j(SECREL32)
50
51define i32 @d() {
52  %1 = load i32, i32* @k
53  ret i32 %1
54}
55
56; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
57
58; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
59; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
60; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
61; CHECK-NEXT: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
62; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
63
64; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
65
66; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
67
68; CHECK: [[CPI]]:
69; CHECK-NEXT: .long k(SECREL32)
70
71define i32 @c() {
72  %1 = load i32, i32* @l
73  ret i32 %1
74}
75
76; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
77
78; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
79; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
80; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
81; CHECK-NEXT: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
82; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
83
84; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
85
86; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
87
88; CHECK: [[CPI]]:
89; CHECK-NEXT: .long l(SECREL32)
90
91define i32 @b() {
92  %1 = load i32, i32* @m
93  ret i32 %1
94}
95
96; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
97
98; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
99; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
100; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
101; CHECK-NEXT: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
102; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
103
104; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
105
106; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
107
108; CHECK: [[CPI]]:
109; CHECK: .long m(SECREL32)
110
111define i16 @a() {
112  %1 = load i16, i16* @n
113  ret i16 %1
114}
115
116; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
117
118; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
119; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
120; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
121; CHECK-NEXT: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
122; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
123
124; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
125
126; CHECK-NEXT: ldrh r0, {{\[}}[[TLS]], [[SLOT]]]
127
128; CHECK: [[CPI]]:
129; CHECK: .long n(SECREL32)
130
131define i8 @Z() {
132  %1 = load i8, i8* @o
133  ret i8 %1
134}
135
136; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
137
138; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
139; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
140; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
141; CHECK-NEXT: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
142; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
143
144; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
145
146; CHECK-NEXT: ldrb r0, {{\[}}[[TLS]], [[SLOT]]]
147
148; CHECK: [[CPI]]:
149; CHECK-NEXT: .long o(SECREL32)
150
151