1 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -xcoff-traceback-table=false -mcpu=pwr4 \
2 ; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
4 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -xcoff-traceback-table=false -mcpu=pwr4 \
5 ; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
7 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -xcoff-traceback-table=false -mcpu=pwr4 \
8 ; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o < %s
9 ; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
11 ; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
12 ; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o 2>&1 < %s | \
13 ; RUN: FileCheck --check-prefix=XCOFF64 %s
14 ; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
16 @foo_weak_p = global void (...)* bitcast (void ()* @foo_ref_weak to void (...)*), align 4
17 @b = weak global i32 0, align 4
19 define weak void @foo_weak(i32* %p) {
21 %p.addr = alloca i32*, align 4
22 store i32* %p, i32** %p.addr, align 4
23 %0 = load i32*, i32** %p.addr, align 4
24 %1 = load i32, i32* %0, align 4
25 %inc = add nsw i32 %1, 1
26 store i32 %inc, i32* %0, align 4
30 define weak void @foo_ref_weak() {
37 %0 = load void (...)*, void (...)** @foo_weak_p, align 4
38 %callee.knr.cast = bitcast void (...)* %0 to void ()*
39 call void %callee.knr.cast()
40 call void @foo_weak(i32* @b)
41 call void @foo_ref_weak()
45 ; COMMON: .weak foo_weak[DS] # -- Begin function foo_weak
46 ; COMMON-NEXT: .weak .foo_weak
47 ; COMMON-NEXT: .align 4
48 ; COMMON-NEXT: .csect foo_weak[DS]
49 ; BIT32-NEXT: .vbyte 4, .foo_weak # @foo_weak
50 ; BIT32-NEXT: .vbyte 4, TOC[TC0]
51 ; BIT32-NEXT: .vbyte 4, 0
52 ; BIT64-NEXT: .vbyte 8, .foo_weak # @foo_weak
53 ; BIT64-NEXT: .vbyte 8, TOC[TC0]
54 ; BIT64-NEXT: .vbyte 8, 0
55 ; COMMON-NEXT: .csect .text[PR]
56 ; COMMON-NEXT: .foo_weak:
58 ; COMMON: .weak foo_ref_weak[DS] # -- Begin function foo_ref_weak
59 ; COMMON-NEXT: .weak .foo_ref_weak
60 ; COMMON-NEXT: .align 4
61 ; COMMON-NEXT: .csect foo_ref_weak[DS]
62 ; BIT32-NEXT: .vbyte 4, .foo_ref_weak # @foo_ref_weak
63 ; BIT32-NEXT: .vbyte 4, TOC[TC0]
64 ; BIT32-NEXT: .vbyte 4, 0
65 ; BIT64-NEXT: .vbyte 8, .foo_ref_weak # @foo_ref_weak
66 ; BIT64-NEXT: .vbyte 8, TOC[TC0]
67 ; BIT64-NEXT: .vbyte 8, 0
68 ; COMMON-NEXT: .csect .text[PR]
69 ; COMMON-NEXT: .foo_ref_weak:
71 ; COMMON: .globl main[DS] # -- Begin function main
72 ; COMMON-NEXT: .globl .main
73 ; COMMON-NEXT: .align 4
74 ; COMMON-NEXT: .csect main[DS]
75 ; BIT32-NEXT: .vbyte 4, .main # @main
76 ; BIT32-NEXT: .vbyte 4, TOC[TC0]
77 ; BIT32-NEXT: .vbyte 4, 0
78 ; BIT64-NEXT: .vbyte 8, .main # @main
79 ; BIT64-NEXT: .vbyte 8, TOC[TC0]
80 ; BIT64-NEXT: .vbyte 8, 0
81 ; COMMON-NEXT: .csect .text[PR]
84 ; COMMON: .csect .data[RW]
85 ; COMMON-NEXT: .globl foo_weak_p
86 ; BIT32-NEXT: .align 2
87 ; BIT64-NEXT: .align 3
88 ; COMMON-NEXT: foo_weak_p:
89 ; BIT32-NEXT: .vbyte 4, foo_ref_weak[DS]
90 ; BIT64-NEXT: .vbyte 8, foo_ref_weak[DS]
91 ; COMMON-NEXT: .weak b
92 ; COMMON-NEXT: .align 2
94 ; COMMON-NEXT: .vbyte 4, 0 # 0x0
97 ; COMMON-NEXT: .tc foo_weak_p[TC],foo_weak_p
99 ; COMMON-NEXT: .tc b[TC],b
102 ; CHECKSYM: Symbols [
103 ; CHECKSYM-NEXT: Symbol {
104 ; CHECKSYM-NEXT: Index: 0
105 ; CHECKSYM-NEXT: Name: .file
106 ; CHECKSYM-NEXT: Value (SymbolTableIndex): 0x0
107 ; CHECKSYM-NEXT: Section: N_DEBUG
108 ; CHECKSYM-NEXT: Source Language ID: TB_C (0x0)
109 ; CHECKSYM-NEXT: CPU Version ID: 0x0
110 ; CHECKSYM-NEXT: StorageClass: C_FILE (0x67)
111 ; CHECKSYM-NEXT: NumberOfAuxEntries: 0
113 ; CHECKSYM-NEXT: Symbol {
114 ; CHECKSYM-NEXT: Index: [[#Index:]]
115 ; CHECKSYM-NEXT: Name: .text
116 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x0
117 ; CHECKSYM-NEXT: Section: .text
118 ; CHECKSYM-NEXT: Type: 0x0
119 ; CHECKSYM-NEXT: StorageClass: C_HIDEXT (0x6B)
120 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
121 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
122 ; CHECKSYM-NEXT: Index: [[#Index+1]]
123 ; CHECKSYM-NEXT: SectionLen: 136
124 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
125 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
126 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 4
127 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
128 ; CHECKSYM-NEXT: StorageMappingClass: XMC_PR (0x0)
129 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
130 ; CHECKSYM-NEXT: StabSectNum: 0x0
133 ; CHECKSYM-NEXT: Symbol {
134 ; CHECKSYM-NEXT: Index: [[#Index+2]]
135 ; CHECKSYM-NEXT: Name: .foo_weak
136 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x0
137 ; CHECKSYM-NEXT: Section: .text
138 ; CHECKSYM-NEXT: Type: 0x0
139 ; CHECKSYM-NEXT: StorageClass: C_WEAKEXT (0x6F)
140 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
141 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
142 ; CHECKSYM-NEXT: Index: [[#Index+3]]
143 ; CHECKSYM-NEXT: ContainingCsectSymbolIndex: [[#Index]]
144 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
145 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
146 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 0
147 ; CHECKSYM-NEXT: SymbolType: XTY_LD (0x2)
148 ; CHECKSYM-NEXT: StorageMappingClass: XMC_PR (0x0)
149 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
150 ; CHECKSYM-NEXT: StabSectNum: 0x0
153 ; CHECKSYM-NEXT: Symbol {
154 ; CHECKSYM-NEXT: Index: [[#Index+4]]
155 ; CHECKSYM-NEXT: Name: .foo_ref_weak
156 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x20
157 ; CHECKSYM-NEXT: Section: .text
158 ; CHECKSYM-NEXT: Type: 0x0
159 ; CHECKSYM-NEXT: StorageClass: C_WEAKEXT (0x6F)
160 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
161 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
162 ; CHECKSYM-NEXT: Index: [[#Index+5]]
163 ; CHECKSYM-NEXT: ContainingCsectSymbolIndex: [[#Index]]
164 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
165 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
166 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 0
167 ; CHECKSYM-NEXT: SymbolType: XTY_LD (0x2)
168 ; CHECKSYM-NEXT: StorageMappingClass: XMC_PR (0x0)
169 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
170 ; CHECKSYM-NEXT: StabSectNum: 0x0
173 ; CHECKSYM-NEXT: Symbol {
174 ; CHECKSYM-NEXT: Index: [[#Index+6]]
175 ; CHECKSYM-NEXT: Name: .main
176 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x30
177 ; CHECKSYM-NEXT: Section: .text
178 ; CHECKSYM-NEXT: Type: 0x0
179 ; CHECKSYM-NEXT: StorageClass: C_EXT (0x2)
180 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
181 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
182 ; CHECKSYM-NEXT: Index: [[#Index+7]]
183 ; CHECKSYM-NEXT: ContainingCsectSymbolIndex: [[#Index]]
184 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
185 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
186 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 0
187 ; CHECKSYM-NEXT: SymbolType: XTY_LD (0x2)
188 ; CHECKSYM-NEXT: StorageMappingClass: XMC_PR (0x0)
189 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
190 ; CHECKSYM-NEXT: StabSectNum: 0x0
193 ; CHECKSYM-NEXT: Symbol {
194 ; CHECKSYM-NEXT: Index: [[#Index+8]]
195 ; CHECKSYM-NEXT: Name: .data
196 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x88
197 ; CHECKSYM-NEXT: Section: .data
198 ; CHECKSYM-NEXT: Type: 0x0
199 ; CHECKSYM-NEXT: StorageClass: C_HIDEXT (0x6B)
200 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
201 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
202 ; CHECKSYM-NEXT: Index: [[#Index+9]]
203 ; CHECKSYM-NEXT: SectionLen: 8
204 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
205 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
206 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 2
207 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
208 ; CHECKSYM-NEXT: StorageMappingClass: XMC_RW (0x5)
209 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
210 ; CHECKSYM-NEXT: StabSectNum: 0x0
213 ; CHECKSYM-NEXT: Symbol {
214 ; CHECKSYM-NEXT: Index: [[#Index+10]]
215 ; CHECKSYM-NEXT: Name: foo_weak_p
216 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x88
217 ; CHECKSYM-NEXT: Section: .data
218 ; CHECKSYM-NEXT: Type: 0x0
219 ; CHECKSYM-NEXT: StorageClass: C_EXT (0x2)
220 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
221 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
222 ; CHECKSYM-NEXT: Index: [[#Index+11]]
223 ; CHECKSYM-NEXT: ContainingCsectSymbolIndex: [[#Index+8]]
224 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
225 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
226 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 0
227 ; CHECKSYM-NEXT: SymbolType: XTY_LD (0x2)
228 ; CHECKSYM-NEXT: StorageMappingClass: XMC_RW (0x5)
229 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
230 ; CHECKSYM-NEXT: StabSectNum: 0x0
233 ; CHECKSYM-NEXT: Symbol {
234 ; CHECKSYM-NEXT: Index: [[#Index+12]]
235 ; CHECKSYM-NEXT: Name: b
236 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x8C
237 ; CHECKSYM-NEXT: Section: .data
238 ; CHECKSYM-NEXT: Type: 0x0
239 ; CHECKSYM-NEXT: StorageClass: C_WEAKEXT (0x6F)
240 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
241 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
242 ; CHECKSYM-NEXT: Index: [[#Index+13]]
243 ; CHECKSYM-NEXT: ContainingCsectSymbolIndex: [[#Index+8]]
244 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
245 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
246 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 0
247 ; CHECKSYM-NEXT: SymbolType: XTY_LD (0x2)
248 ; CHECKSYM-NEXT: StorageMappingClass: XMC_RW (0x5)
249 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
250 ; CHECKSYM-NEXT: StabSectNum: 0x0
253 ; CHECKSYM-NEXT: Symbol {
254 ; CHECKSYM-NEXT: Index: [[#Index+14]]
255 ; CHECKSYM-NEXT: Name: foo_weak
256 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x90
257 ; CHECKSYM-NEXT: Section: .data
258 ; CHECKSYM-NEXT: Type: 0x0
259 ; CHECKSYM-NEXT: StorageClass: C_WEAKEXT (0x6F)
260 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
261 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
262 ; CHECKSYM-NEXT: Index: [[#Index+15]]
263 ; CHECKSYM-NEXT: SectionLen: 12
264 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
265 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
266 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 2
267 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
268 ; CHECKSYM-NEXT: StorageMappingClass: XMC_DS (0xA)
269 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
270 ; CHECKSYM-NEXT: StabSectNum: 0x0
273 ; CHECKSYM-NEXT: Symbol {
274 ; CHECKSYM-NEXT: Index: [[#Index+16]]
275 ; CHECKSYM-NEXT: Name: foo_ref_weak
276 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0x9C
277 ; CHECKSYM-NEXT: Section: .data
278 ; CHECKSYM-NEXT: Type: 0x0
279 ; CHECKSYM-NEXT: StorageClass: C_WEAKEXT (0x6F)
280 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
281 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
282 ; CHECKSYM-NEXT: Index: [[#Index+17]]
283 ; CHECKSYM-NEXT: SectionLen: 12
284 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
285 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
286 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 2
287 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
288 ; CHECKSYM-NEXT: StorageMappingClass: XMC_DS (0xA)
289 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
290 ; CHECKSYM-NEXT: StabSectNum: 0x0
293 ; CHECKSYM-NEXT: Symbol {
294 ; CHECKSYM-NEXT: Index: [[#Index+18]]
295 ; CHECKSYM-NEXT: Name: main
296 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0xA8
297 ; CHECKSYM-NEXT: Section: .data
298 ; CHECKSYM-NEXT: Type: 0x0
299 ; CHECKSYM-NEXT: StorageClass: C_EXT (0x2)
300 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
301 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
302 ; CHECKSYM-NEXT: Index: [[#Index+19]]
303 ; CHECKSYM-NEXT: SectionLen: 12
304 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
305 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
306 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 2
307 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
308 ; CHECKSYM-NEXT: StorageMappingClass: XMC_DS (0xA)
309 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
310 ; CHECKSYM-NEXT: StabSectNum: 0x0
313 ; CHECKSYM-NEXT: Symbol {
314 ; CHECKSYM-NEXT: Index: [[#Index+20]]
315 ; CHECKSYM-NEXT: Name: TOC
316 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0xB4
317 ; CHECKSYM-NEXT: Section: .data
318 ; CHECKSYM-NEXT: Type: 0x0
319 ; CHECKSYM-NEXT: StorageClass: C_HIDEXT (0x6B)
320 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
321 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
322 ; CHECKSYM-NEXT: Index: [[#Index+21]]
323 ; CHECKSYM-NEXT: SectionLen: 0
324 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
325 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
326 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 2
327 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
328 ; CHECKSYM-NEXT: StorageMappingClass: XMC_TC0 (0xF)
329 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
330 ; CHECKSYM-NEXT: StabSectNum: 0x0
333 ; CHECKSYM-NEXT: Symbol {
334 ; CHECKSYM-NEXT: Index: [[#Index+22]]
335 ; CHECKSYM-NEXT: Name: foo_weak_p
336 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0xB4
337 ; CHECKSYM-NEXT: Section: .data
338 ; CHECKSYM-NEXT: Type: 0x0
339 ; CHECKSYM-NEXT: StorageClass: C_HIDEXT (0x6B)
340 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
341 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
342 ; CHECKSYM-NEXT: Index: [[#Index+23]]
343 ; CHECKSYM-NEXT: SectionLen: 4
344 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
345 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
346 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 2
347 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
348 ; CHECKSYM-NEXT: StorageMappingClass: XMC_TC (0x3)
349 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
350 ; CHECKSYM-NEXT: StabSectNum: 0x0
353 ; CHECKSYM-NEXT: Symbol {
354 ; CHECKSYM-NEXT: Index: [[#Index+24]]
355 ; CHECKSYM-NEXT: Name: b
356 ; CHECKSYM-NEXT: Value (RelocatableAddress): 0xB8
357 ; CHECKSYM-NEXT: Section: .data
358 ; CHECKSYM-NEXT: Type: 0x0
359 ; CHECKSYM-NEXT: StorageClass: C_HIDEXT (0x6B)
360 ; CHECKSYM-NEXT: NumberOfAuxEntries: 1
361 ; CHECKSYM-NEXT: CSECT Auxiliary Entry {
362 ; CHECKSYM-NEXT: Index: [[#Index+25]]
363 ; CHECKSYM-NEXT: SectionLen: 4
364 ; CHECKSYM-NEXT: ParameterHashIndex: 0x0
365 ; CHECKSYM-NEXT: TypeChkSectNum: 0x0
366 ; CHECKSYM-NEXT: SymbolAlignmentLog2: 2
367 ; CHECKSYM-NEXT: SymbolType: XTY_SD (0x1)
368 ; CHECKSYM-NEXT: StorageMappingClass: XMC_TC (0x3)
369 ; CHECKSYM-NEXT: StabInfoIndex: 0x0
370 ; CHECKSYM-NEXT: StabSectNum: 0x0