1 ; This file tests 32 bit TLS variable generation.
3 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple \
4 ; RUN: powerpc-ibm-aix-xcoff < %s | FileCheck %s
5 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple \
6 ; RUN: powerpc-ibm-aix-xcoff -data-sections=false < %s | FileCheck %s \
7 ; RUN: --check-prefix=NODATASEC
9 ; When data-sections is true (default), we emit data into separate sections.
10 ; When data-sections is false, we emit data into the .data / .tdata sections.
12 ; Int global variable, TLS/Non-TLS, local/external/weak/common linkage
13 ; CHECK: .csect global_int_external_val_initialized[RW],2
14 ; CHECK-NEXT: .globl global_int_external_val_initialized[RW]
15 ; CHECK-NEXT: .align 2
16 ; CHECK-NEXT: .vbyte 4, 1
18 ; NODATASEC: .csect .data[RW],3
19 ; NODATASEC-NEXT: .globl global_int_external_val_initialized
20 ; NODATASEC-NEXT: .align 2
21 ; NODATASEC-NEXT:global_int_external_val_initialized:
22 ; NODATASEC-NEXT: .vbyte 4, 1
23 @global_int_external_val_initialized = global i32 1, align 4
25 ; CHECK-NEXT: .csect global_int_external_zero_initialized[RW],2
26 ; CHECK-NEXT: .globl global_int_external_zero_initialized[RW]
27 ; CHECK-NEXT: .align 2
28 ; CHECK-NEXT: .vbyte 4, 0
30 ; NODATASEC-NEXT: .globl global_int_external_zero_initialized
31 ; NODATASEC-NEXT: .align 2
32 ; NODATASEC-NEXT:global_int_external_zero_initialized:
33 ; NODATASEC-NEXT: .vbyte 4, 0
34 @global_int_external_zero_initialized = global i32 0, align 4
36 ; CHECK-NEXT: .csect tls_global_int_external_val_initialized[TL],2
37 ; CHECK-NEXT: .globl tls_global_int_external_val_initialized[TL]
38 ; CHECK-NEXT: .align 2
39 ; CHECK-NEXT: .vbyte 4, 1
41 ; NODATASEC-NEXT: .csect .tdata[TL],3
42 ; NODATASEC-NEXT: .globl tls_global_int_external_val_initialized
43 ; NODATASEC-NEXT: .align 2
44 ; NODATASEC-NEXT:tls_global_int_external_val_initialized:
45 ; NODATASEC-NEXT: .vbyte 4, 1
46 @tls_global_int_external_val_initialized = thread_local global i32 1, align 4
48 ; CHECK-NEXT: .csect tls_global_int_external_zero_initialized[TL],2
49 ; CHECK-NEXT: .globl tls_global_int_external_zero_initialized[TL]
50 ; CHECK-NEXT: .align 2
51 ; CHECK-NEXT: .vbyte 4, 0
53 ; NODATASEC-NEXT: .globl tls_global_int_external_zero_initialized
54 ; NODATASEC-NEXT: .align 2
55 ; NODATASEC-NEXT:tls_global_int_external_zero_initialized:
56 ; NODATASEC-NEXT: .vbyte 4, 0
57 @tls_global_int_external_zero_initialized = thread_local global i32 0, align 4
59 ; CHECK-NEXT: .csect global_int_local_val_initialized[RW],2
60 ; CHECK-NEXT: .lglobl global_int_local_val_initialized[RW]
61 ; CHECK-NEXT: .align 2
62 ; CHECK-NEXT: .vbyte 4, 2
64 ; NODATASEC-NEXT: .csect .data[RW],3
65 ; NODATASEC-NEXT: .lglobl global_int_local_val_initialized
66 ; NODATASEC-NEXT: .align 2
67 ; NODATASEC-NEXT:global_int_local_val_initialized:
68 ; NODATASEC-NEXT: .vbyte 4, 2
69 @global_int_local_val_initialized = internal global i32 2, align 4
71 ; CHECK-NEXT: .csect tls_global_int_local_val_initialized[TL],2
72 ; CHECK-NEXT: .lglobl tls_global_int_local_val_initialized[TL]
73 ; CHECK-NEXT: .align 2
74 ; CHECK-NEXT: .vbyte 4, 2
76 ; NODATASEC-NEXT: .csect .tdata[TL],3
77 ; NODATASEC-NEXT: .lglobl tls_global_int_local_val_initialized
78 ; NODATASEC-NEXT: .align 2
79 ; NODATASEC-NEXT:tls_global_int_local_val_initialized:
80 ; NODATASEC-NEXT: .vbyte 4, 2
81 @tls_global_int_local_val_initialized = internal thread_local global i32 2, align 4
83 ; CHECK-NEXT: .lcomm global_int_local_zero_initialized,4,global_int_local_zero_initialized[BS],2
84 ; NODATASEC-NEXT: .lcomm global_int_local_zero_initialized,4,global_int_local_zero_initialized[BS],2
85 @global_int_local_zero_initialized = internal global i32 0, align 4
87 ; CHECK-NEXT: .lcomm tls_global_int_local_zero_initialized,4,tls_global_int_local_zero_initialized[UL],2
88 ; NODATASEC-NEXT: .lcomm tls_global_int_local_zero_initialized,4,tls_global_int_local_zero_initialized[UL],2
89 @tls_global_int_local_zero_initialized = internal thread_local global i32 0, align 4
91 ; CHECK-NEXT: .csect global_int_weak_zero_initialized[RW],2
92 ; CHECK-NEXT: .weak global_int_weak_zero_initialized[RW]
93 ; CHECK-NEXT: .align 2
94 ; CHECK-NEXT: .vbyte 4, 0
96 ; NODATASEC-NEXT: .csect .data[RW],3
97 ; NODATASEC-NEXT: .weak global_int_weak_zero_initialized
98 ; NODATASEC-NEXT: .align 2
99 ; NODATASEC-NEXT:global_int_weak_zero_initialized:
100 ; NODATASEC-NEXT: .vbyte 4, 0
101 @global_int_weak_zero_initialized = weak global i32 0, align 4
103 ; CHECK-NEXT: .csect tls_global_int_weak_zero_initialized[TL],2
104 ; CHECK-NEXT: .weak tls_global_int_weak_zero_initialized[TL]
105 ; CHECK-NEXT: .align 2
106 ; CHECK-NEXT: .vbyte 4, 0
108 ; NODATASEC-NEXT: .csect .tdata[TL],3
109 ; NODATASEC-NEXT: .weak tls_global_int_weak_zero_initialized
110 ; NODATASEC-NEXT: .align 2
111 ; NODATASEC-NEXT:tls_global_int_weak_zero_initialized:
112 ; NODATASEC-NEXT: .vbyte 4, 0
113 @tls_global_int_weak_zero_initialized = weak thread_local global i32 0, align 4
115 ; CHECK-NEXT: .comm global_int_common_zero_initialized[RW],4,2
116 ; NODATASEC-NEXT: .comm global_int_common_zero_initialized[RW],4,2
117 @global_int_common_zero_initialized = common global i32 0, align 4
119 ; CHECK-NEXT: .comm tls_global_int_common_zero_initialized[UL],4,2
120 ; NODATASEC-NEXT: .comm tls_global_int_common_zero_initialized[UL],4,2
121 @tls_global_int_common_zero_initialized = common thread_local global i32 0, align 4
123 ; CHECK-NEXT: .csect global_int_weak_val_initialized[RW],2
124 ; CHECK-NEXT: .weak global_int_weak_val_initialized[RW]
125 ; CHECK-NEXT: .align 2
126 ; CHECK-NEXT: .vbyte 4, 1
128 ; NODATASEC-NEXT: .csect .data[RW],3
129 ; NODATASEC-NEXT: .weak global_int_weak_val_initialized
130 ; NODATASEC-NEXT: .align 2
131 ; NODATASEC-NEXT:global_int_weak_val_initialized:
132 ; NODATASEC-NEXT: .vbyte 4, 1
133 @global_int_weak_val_initialized = weak global i32 1, align 4
135 ; CHECK-NEXT: .csect tls_global_int_weak_val_initialized[TL],2
136 ; CHECK-NEXT: .weak tls_global_int_weak_val_initialized[TL]
137 ; CHECK-NEXT: .align 2
138 ; CHECK-NEXT: .vbyte 4, 1
140 ; NODATASEC-NEXT: .csect .tdata[TL],3
141 ; NODATASEC-NEXT: .weak tls_global_int_weak_val_initialized
142 ; NODATASEC-NEXT: .align 2
143 ; NODATASEC-NEXT:tls_global_int_weak_val_initialized:
144 ; NODATASEC-NEXT: .vbyte 4, 1
145 @tls_global_int_weak_val_initialized = weak thread_local global i32 1, align 4
147 ; CHECK-NEXT: .extern global_int_external_uninitialized[UA]
148 ; NODATASEC-NEXT: .extern global_int_external_uninitialized[UA]
149 @global_int_external_uninitialized = external global i32, align 4
151 ; CHECK-NEXT: .extern tls_global_int_external_uninitialized[UL]
152 ; NODATASEC-NEXT: .extern tls_global_int_external_uninitialized[UL]
153 @tls_global_int_external_uninitialized = external thread_local global i32, align 4
156 ; double global variable, TLS/Non-TLS, common/external linkage
158 ; CHECK-NEXT: .comm global_double_common_zero_initialized[RW],8,3
159 ; NODATASEC-NEXT: .comm global_double_common_zero_initialized[RW],8,3
160 @global_double_common_zero_initialized = common global double 0.000000e+00, align 8
162 ; CHECK-NEXT: .comm tls_global_double_common_zero_initialized[UL],8,3
163 ; NODATASEC-NEXT: .comm tls_global_double_common_zero_initialized[UL],8,3
164 @tls_global_double_common_zero_initialized = common thread_local global double 0.000000e+00, align 8
166 ; CHECK-NEXT: .extern global_double_external_uninitialized[UA]
167 ; NODATASEC-NEXT: .extern global_double_external_uninitialized[UA]
168 @global_double_external_uninitialized = external global i64, align 8
170 ; CHECK-NEXT: .extern tls_global_double_external_uninitialized[UL]
171 ; NODATASEC-NEXT: .extern tls_global_double_external_uninitialized[UL]
172 @tls_global_double_external_uninitialized = external thread_local global i64, align 8
175 ; Long long global variable, TLS/Non-TLS, local/weak linkage
177 ; CHECK-NEXT: .csect global_long_long_internal_val_initialized[RW],3
178 ; CHECK-NEXT: .lglobl global_long_long_internal_val_initialized[RW]
179 ; CHECK-NEXT: .align 3
180 ; CHECK-NEXT: .vbyte 4, 0
181 ; CHECK-NEXT: .vbyte 4, 1
182 ; NODATASEC-NEXT: .csect .data[RW],3
183 ; NODATASEC-NEXT: .lglobl global_long_long_internal_val_initialized
184 ; NODATASEC-NEXT: .align 3
185 ; NODATASEC-NEXT:global_long_long_internal_val_initialized:
186 ; NODATASEC-NEXT: .vbyte 4, 0
187 ; NODATASEC-NEXT: .vbyte 4, 1
188 @global_long_long_internal_val_initialized = internal global i64 1, align 8
190 ; CHECK-NEXT: .csect tls_global_long_long_internal_val_initialized[TL],3
191 ; CHECK-NEXT: .lglobl tls_global_long_long_internal_val_initialized[TL]
192 ; CHECK-NEXT: .align 3
193 ; CHECK-NEXT: .vbyte 4, 0
194 ; CHECK-NEXT: .vbyte 4, 1
195 ; NODATASEC-NEXT: .csect .tdata[TL],3
196 ; NODATASEC-NEXT: .lglobl tls_global_long_long_internal_val_initialized
197 ; NODATASEC-NEXT: .align 3
198 ; NODATASEC-NEXT:tls_global_long_long_internal_val_initialized:
199 ; NODATASEC-NEXT: .vbyte 4, 0
200 ; NODATASEC-NEXT: .vbyte 4, 1
201 @tls_global_long_long_internal_val_initialized = internal thread_local global i64 1, align 8
203 ; CHECK-NEXT: .lcomm global_long_long_internal_zero_initialized,8,global_long_long_internal_zero_initialized[BS],3
204 ; NODATASEC-NEXT: .lcomm global_long_long_internal_zero_initialized,8,global_long_long_internal_zero_initialized[BS],3
205 @global_long_long_internal_zero_initialized = internal global i64 0, align 8
207 ; CHECK-NEXT: .lcomm tls_global_long_long_internal_zero_initialized,8,tls_global_long_long_internal_zero_initialized[UL],3
208 ; NODATASEC-NEXT: .lcomm tls_global_long_long_internal_zero_initialized,8,tls_global_long_long_internal_zero_initialized[UL],3
209 @tls_global_long_long_internal_zero_initialized = internal thread_local global i64 0, align 8
211 ; CHECK-NEXT: .csect global_long_long_weak_val_initialized[RW],3
212 ; CHECK-NEXT: .weak global_long_long_weak_val_initialized[RW]
213 ; CHECK-NEXT: .align 3
214 ; CHECK-NEXT: .vbyte 4, 0
215 ; CHECK-NEXT: .vbyte 4, 1
216 ; NODATASEC-NEXT: .csect .data[RW],3
217 ; NODATASEC-NEXT: .weak global_long_long_weak_val_initialized
218 ; NODATASEC-NEXT: .align 3
219 ; NODATASEC-NEXT:global_long_long_weak_val_initialized:
220 ; NODATASEC-NEXT: .vbyte 4, 0
221 ; NODATASEC-NEXT: .vbyte 4, 1
222 @global_long_long_weak_val_initialized = weak global i64 1, align 8
224 ; CHECK-NEXT: .csect tls_global_long_long_weak_val_initialized[TL],3
225 ; CHECK-NEXT: .weak tls_global_long_long_weak_val_initialized[TL]
226 ; CHECK-NEXT: .align 3
227 ; CHECK-NEXT: .vbyte 4, 0
228 ; CHECK-NEXT: .vbyte 4, 1
229 ; NODATASEC-NEXT: .csect .tdata[TL],3
230 ; NODATASEC-NEXT: .weak tls_global_long_long_weak_val_initialized
231 ; NODATASEC-NEXT: .align 3
232 ; NODATASEC-NEXT:tls_global_long_long_weak_val_initialized:
233 ; NODATASEC-NEXT: .vbyte 4, 0
234 ; NODATASEC-NEXT: .vbyte 4, 1
235 @tls_global_long_long_weak_val_initialized = weak thread_local global i64 1, align 8
237 ; CHECK-NEXT: .csect global_long_long_weak_zero_initialized[RW],3
238 ; CHECK-NEXT: .weak global_long_long_weak_zero_initialized[RW]
239 ; CHECK-NEXT: .align 3
240 ; CHECK-NEXT: .vbyte 4, 0
241 ; CHECK-NEXT: .vbyte 4, 0
242 ; NODATASEC-NEXT: .csect .data[RW],3
243 ; NODATASEC-NEXT: .weak global_long_long_weak_zero_initialized
244 ; NODATASEC-NEXT: .align 3
245 ; NODATASEC-NEXT:global_long_long_weak_zero_initialized:
246 ; NODATASEC-NEXT: .vbyte 4, 0
247 ; NODATASEC-NEXT: .vbyte 4, 0
248 @global_long_long_weak_zero_initialized = weak global i64 0, align 8
250 ; CHECK-NEXT: .csect tls_global_long_long_weak_zero_initialized[TL],3
251 ; CHECK-NEXT: .weak tls_global_long_long_weak_zero_initialized[TL]
252 ; CHECK-NEXT: .align 3
253 ; CHECK-NEXT: .vbyte 4, 0
254 ; CHECK-NEXT: .vbyte 4, 0
255 ; NODATASEC-NEXT: .csect .tdata[TL],3
256 ; NODATASEC-NEXT: .weak tls_global_long_long_weak_zero_initialized
257 ; NODATASEC-NEXT: .align 3
258 ; NODATASEC-NEXT:tls_global_long_long_weak_zero_initialized:
259 ; NODATASEC-NEXT: .vbyte 4, 0
260 ; NODATASEC-NEXT: .vbyte 4, 0
261 @tls_global_long_long_weak_zero_initialized = weak thread_local global i64 0, align 8