xref: /llvm-project/llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll (revision 935bbbbde4b2661ed7f8f2975a39bda360572572)
1; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc-ibm-aix-xcoff -data-sections=false < %s | \
2; RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
3; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc64-ibm-aix-xcoff -data-sections=false < %s | \
4; RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
5
6; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc-ibm-aix-xcoff -data-sections=false \
7; RUN:   -filetype=obj -o %t.o < %s
8; RUN: llvm-readobj --section-headers --file-header %t.o | \
9; RUN:   FileCheck --check-prefixes=OBJ,OBJ32 %s
10; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefixes=SYMS,SYMS32 %s
11; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=DIS %s
12
13; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc64-ibm-aix-xcoff -data-sections=false \
14; RUN:   -filetype=obj -o %t64.o < %s
15; RUN: llvm-readobj --section-headers --file-header %t64.o | \
16; RUN:   FileCheck --check-prefixes=OBJ,OBJ64 %s
17; RUN: llvm-readobj --syms %t64.o | FileCheck --check-prefixes=SYMS,SYMS64 %s
18
19@const_ivar = constant i32 35, align 4
20@const_llvar = constant i64 36, align 8
21@const_svar = constant i16 37, align 2
22@const_fvar = constant float 8.000000e+02, align 4
23@const_dvar = constant double 9.000000e+02, align 8
24@const_over_aligned = constant double 9.000000e+02, align 32
25@const_chrarray = constant [4 x i8] c"abcd", align 1
26@const_dblarr = constant [4 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00], align 8
27
28; CHECK:               .csect .rodata[RO],5
29; CHECK-NEXT:          .globl  const_ivar
30; CHECK-NEXT:          .align  2
31; CHECK-NEXT:  const_ivar:
32; CHECK-NEXT:          .vbyte	4, 35
33; CHECK-NEXT:          .globl  const_llvar
34; CHECK-NEXT:          .align  3
35; CHECK-NEXT:  const_llvar:
36; CHECK32-NEXT:        .vbyte	4, 0
37; CHECK32-NEXT:        .vbyte	4, 36
38; CHECK64-NEXT:        .vbyte	8, 36
39; CHECK-NEXT:          .globl  const_svar
40; CHECK-NEXT:          .align  1
41; CHECK-NEXT:  const_svar:
42; CHECK-NEXT:          .vbyte	2, 37
43; CHECK-NEXT:          .globl  const_fvar
44; CHECK-NEXT:          .align  2
45; CHECK-NEXT:  const_fvar:
46; CHECK-NEXT:          .vbyte	4, 0x44480000
47; CHECK-NEXT:          .globl  const_dvar
48; CHECK-NEXT:          .align  3
49; CHECK-NEXT:  const_dvar:
50; CHECK32-NEXT:        .vbyte	4, 1082925056
51; CHECK32-NEXT:        .vbyte	4, 0
52; CHECK64-NEXT:        .vbyte	8, 0x408c200000000000
53; CHECK-NEXT:          .globl  const_over_aligned
54; CHECK-NEXT:          .align  5
55; CHECK-NEXT:  const_over_aligned:
56; CHECK32-NEXT:        .vbyte	4, 1082925056
57; CHECK32-NEXT:        .vbyte	4, 0
58; CHECK64-NEXT:        .vbyte	8, 0x408c200000000000
59; CHECK-NEXT:          .globl  const_chrarray
60; CHECK-NEXT:  const_chrarray:
61; CHECK-NEXT:          .byte   "abcd"
62; CHECK-NEXT:          .globl  const_dblarr
63; CHECK-NEXT:          .align  3
64; CHECK-NEXT:  const_dblarr:
65; CHECK32-NEXT:        .vbyte	4, 1072693248
66; CHECK32-NEXT:        .vbyte	4, 0
67; CHECK64-NEXT:        .vbyte	8, 0x3ff0000000000000
68; CHECK32-NEXT:        .vbyte	4, 1073741824
69; CHECK32-NEXT:        .vbyte	4, 0
70; CHECK64-NEXT:        .vbyte	8, 0x4000000000000000
71; CHECK32-NEXT:        .vbyte	4, 1074266112
72; CHECK32-NEXT:        .vbyte	4, 0
73; CHECK64-NEXT:        .vbyte	8, 0x4008000000000000
74; CHECK32-NEXT:        .vbyte	4, 1074790400
75; CHECK32-NEXT:        .vbyte	4, 0
76; CHECK64-NEXT:        .vbyte	8, 0x4010000000000000
77
78; OBJ:      FileHeader {
79; OBJ32-NEXT: Magic: 0x1DF
80; OBJ64-NEXT: Magic: 0x1F7
81; OBJ-NEXT:   NumberOfSections: 1
82; OBJ-NEXT:   TimeStamp: None (0x0)
83; OBJ32-NEXT: SymbolTableOffset: 0x8C
84; OBJ64-NEXT: SymbolTableOffset: 0xB0
85; OBJ-NEXT:   SymbolTableEntries: 23
86; OBJ-NEXT:   OptionalHeaderSize: 0x0
87; OBJ-NEXT:   Flags: 0x0
88; OBJ-NEXT: }
89
90; OBJ:      Sections [
91; OBJ:        Section {
92; OBJ-NEXT:     Index: 1
93; OBJ-NEXT:     Name: .text
94; OBJ-NEXT:     PhysicalAddress: 0x0
95; OBJ-NEXT:     VirtualAddress: 0x0
96; OBJ32-NEXT:   Size: 0x50
97; OBJ32-NEXT:   RawDataOffset: 0x3C
98; OBJ64-NEXT:   Size: 0x50
99; OBJ64-NEXT:   RawDataOffset: 0x60
100; OBJ-NEXT:     RelocationPointer: 0x0
101; OBJ-NEXT:     LineNumberPointer: 0x0
102; OBJ-NEXT:     NumberOfRelocations: 0
103; OBJ-NEXT:     NumberOfLineNumbers: 0
104; OBJ-NEXT:     Type: STYP_TEXT (0x20)
105; OBJ-NEXT:   }
106; OBJ-NEXT: ]
107
108; SYMS:       Symbols [
109; SYMS:        Symbol {{[{][[:space:]] *}}Index: [[#INDX:]]{{[[:space:]] *}}Name: .rodata
110; SYMS-NEXT:     Value (RelocatableAddress): 0x0
111; SYMS-NEXT:     Section: .text
112; SYMS-NEXT:     Type: 0x0
113; SYMS-NEXT:     StorageClass: C_HIDEXT (0x6B)
114; SYMS-NEXT:     NumberOfAuxEntries: 1
115; SYMS-NEXT:     CSECT Auxiliary Entry {
116; SYMS-NEXT:       Index: [[#INDX+1]]
117; SYMS-NEXT:       SectionLen: 80
118; SYMS-NEXT:       ParameterHashIndex: 0x0
119; SYMS-NEXT:       TypeChkSectNum: 0x0
120; SYMS-NEXT:       SymbolAlignmentLog2: 5
121; SYMS-NEXT:       SymbolType: XTY_SD (0x1)
122; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
123; SYMS32-NEXT:     StabInfoIndex: 0x0
124; SYMS32-NEXT:     StabSectNum: 0x0
125; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
126; SYMS-NEXT:     }
127; SYMS-NEXT:   }
128
129; SYMS:        Symbol {
130; SYMS-NEXT:     Index: [[#INDX+2]]
131; SYMS-NEXT:     Name: const_ivar
132; SYMS-NEXT:     Value (RelocatableAddress): 0x0
133; SYMS-NEXT:     Section: .text
134; SYMS-NEXT:     Type: 0x0
135; SYMS-NEXT:     StorageClass: C_EXT (0x2)
136; SYMS-NEXT:     NumberOfAuxEntries: 1
137; SYMS-NEXT:     CSECT Auxiliary Entry {
138; SYMS-NEXT:       Index: [[#INDX+3]]
139; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
140; SYMS-NEXT:       ParameterHashIndex: 0x0
141; SYMS-NEXT:       TypeChkSectNum: 0x0
142; SYMS-NEXT:       SymbolAlignmentLog2: 0
143; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
144; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
145; SYMS32-NEXT:     StabInfoIndex: 0x0
146; SYMS32-NEXT:     StabSectNum: 0x0
147; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
148; SYMS-NEXT:     }
149; SYMS-NEXT:   }
150
151; SYMS:        Symbol {
152; SYMS-NEXT:     Index: [[#INDX+4]]
153; SYMS-NEXT:     Name: const_llvar
154; SYMS-NEXT:     Value (RelocatableAddress): 0x8
155; SYMS-NEXT:     Section: .text
156; SYMS-NEXT:     Type: 0x0
157; SYMS-NEXT:     StorageClass: C_EXT (0x2)
158; SYMS-NEXT:     NumberOfAuxEntries: 1
159; SYMS-NEXT:     CSECT Auxiliary Entry {
160; SYMS-NEXT:       Index: [[#INDX+5]]
161; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
162; SYMS-NEXT:       ParameterHashIndex: 0x0
163; SYMS-NEXT:       TypeChkSectNum: 0x0
164; SYMS-NEXT:       SymbolAlignmentLog2: 0
165; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
166; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
167; SYMS32-NEXT:     StabInfoIndex: 0x0
168; SYMS32-NEXT:     StabSectNum: 0x0
169; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
170; SYMS-NEXT:     }
171; SYMS-NEXT:   }
172
173; SYMS:        Symbol {
174; SYMS-NEXT:     Index: [[#INDX+6]]
175; SYMS-NEXT:     Name: const_svar
176; SYMS-NEXT:     Value (RelocatableAddress): 0x10
177; SYMS-NEXT:     Section: .text
178; SYMS-NEXT:     Type: 0x0
179; SYMS-NEXT:     StorageClass: C_EXT (0x2)
180; SYMS-NEXT:     NumberOfAuxEntries: 1
181; SYMS-NEXT:     CSECT Auxiliary Entry {
182; SYMS-NEXT:       Index: [[#INDX+7]]
183; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
184; SYMS-NEXT:       ParameterHashIndex: 0x0
185; SYMS-NEXT:       TypeChkSectNum: 0x0
186; SYMS-NEXT:       SymbolAlignmentLog2: 0
187; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
188; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
189; SYMS32-NEXT:     StabInfoIndex: 0x0
190; SYMS32-NEXT:     StabSectNum: 0x0
191; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
192; SYMS-NEXT:     }
193; SYMS-NEXT:   }
194
195; SYMS:        Symbol {
196; SYMS-NEXT:     Index: [[#INDX+8]]
197; SYMS-NEXT:     Name: const_fvar
198; SYMS-NEXT:     Value (RelocatableAddress): 0x14
199; SYMS-NEXT:     Section: .text
200; SYMS-NEXT:     Type: 0x0
201; SYMS-NEXT:     StorageClass: C_EXT (0x2)
202; SYMS-NEXT:     NumberOfAuxEntries: 1
203; SYMS-NEXT:     CSECT Auxiliary Entry {
204; SYMS-NEXT:       Index: [[#INDX+9]]
205; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
206; SYMS-NEXT:       ParameterHashIndex: 0x0
207; SYMS-NEXT:       TypeChkSectNum: 0x0
208; SYMS-NEXT:       SymbolAlignmentLog2: 0
209; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
210; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
211; SYMS32-NEXT:     StabInfoIndex: 0x0
212; SYMS32-NEXT:     StabSectNum: 0x0
213; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
214; SYMS-NEXT:     }
215; SYMS-NEXT:   }
216
217; SYMS:        Symbol {
218; SYMS-NEXT:     Index: [[#INDX+10]]
219; SYMS-NEXT:     Name: const_dvar
220; SYMS-NEXT:     Value (RelocatableAddress): 0x18
221; SYMS-NEXT:     Section: .text
222; SYMS-NEXT:     Type: 0x0
223; SYMS-NEXT:     StorageClass: C_EXT (0x2)
224; SYMS-NEXT:     NumberOfAuxEntries: 1
225; SYMS-NEXT:     CSECT Auxiliary Entry {
226; SYMS-NEXT:       Index: [[#INDX+11]]
227; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
228; SYMS-NEXT:       ParameterHashIndex: 0x0
229; SYMS-NEXT:       TypeChkSectNum: 0x0
230; SYMS-NEXT:       SymbolAlignmentLog2: 0
231; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
232; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
233; SYMS32-NEXT:     StabInfoIndex: 0x0
234; SYMS32-NEXT:     StabSectNum: 0x0
235; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
236; SYMS-NEXT:     }
237; SYMS-NEXT:   }
238
239; SYMS:        Symbol {
240; SYMS-NEXT:     Index: [[#INDX+12]]
241; SYMS-NEXT:     Name: const_over_aligned
242; SYMS-NEXT:     Value (RelocatableAddress): 0x20
243; SYMS-NEXT:     Section: .text
244; SYMS-NEXT:     Type: 0x0
245; SYMS-NEXT:     StorageClass: C_EXT (0x2)
246; SYMS-NEXT:     NumberOfAuxEntries: 1
247; SYMS-NEXT:     CSECT Auxiliary Entry {
248; SYMS-NEXT:       Index: [[#INDX+13]]
249; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
250; SYMS-NEXT:       ParameterHashIndex: 0x0
251; SYMS-NEXT:       TypeChkSectNum: 0x0
252; SYMS-NEXT:       SymbolAlignmentLog2: 0
253; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
254; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
255; SYMS32-NEXT:     StabInfoIndex: 0x0
256; SYMS32-NEXT:     StabSectNum: 0x0
257; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
258; SYMS-NEXT:     }
259; SYMS-NEXT:   }
260
261; SYMS:        Symbol {
262; SYMS-NEXT:     Index: [[#INDX+14]]
263; SYMS-NEXT:     Name: const_chrarray
264; SYMS-NEXT:     Value (RelocatableAddress): 0x28
265; SYMS-NEXT:     Section: .text
266; SYMS-NEXT:     Type: 0x0
267; SYMS-NEXT:     StorageClass: C_EXT (0x2)
268; SYMS-NEXT:     NumberOfAuxEntries: 1
269; SYMS-NEXT:     CSECT Auxiliary Entry {
270; SYMS-NEXT:       Index: [[#INDX+15]]
271; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
272; SYMS-NEXT:       ParameterHashIndex: 0x0
273; SYMS-NEXT:       TypeChkSectNum: 0x0
274; SYMS-NEXT:       SymbolAlignmentLog2: 0
275; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
276; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
277; SYMS32-NEXT:     StabInfoIndex: 0x0
278; SYMS32-NEXT:     StabSectNum: 0x0
279; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
280; SYMS-NEXT:     }
281; SYMS-NEXT:   }
282
283; SYMS:        Symbol {
284; SYMS-NEXT:     Index: [[#INDX+16]]
285; SYMS-NEXT:     Name: const_dblarr
286; SYMS-NEXT:     Value (RelocatableAddress): 0x30
287; SYMS-NEXT:     Section: .text
288; SYMS-NEXT:     Type: 0x0
289; SYMS-NEXT:     StorageClass: C_EXT (0x2)
290; SYMS-NEXT:     NumberOfAuxEntries: 1
291; SYMS-NEXT:     CSECT Auxiliary Entry {
292; SYMS-NEXT:       Index: [[#INDX+17]]
293; SYMS-NEXT:       ContainingCsectSymbolIndex: [[#INDX]]
294; SYMS-NEXT:       ParameterHashIndex: 0x0
295; SYMS-NEXT:       TypeChkSectNum: 0x0
296; SYMS-NEXT:       SymbolAlignmentLog2: 0
297; SYMS-NEXT:       SymbolType: XTY_LD (0x2)
298; SYMS-NEXT:       StorageMappingClass: XMC_RO (0x1)
299; SYMS32-NEXT:     StabInfoIndex: 0x0
300; SYMS32-NEXT:     StabSectNum: 0x0
301; SYMS64-NEXT:     Auxiliary Type: AUX_CSECT (0xFB)
302; SYMS-NEXT:     }
303; SYMS-NEXT:   }
304; SYMS:      ]
305
306; DIS: Disassembly of section .text:
307; DIS: 00000000 <const_ivar>:
308; DIS-NEXT:        0: 00 00 00 23
309; DIS-NEXT:        4: 00 00 00 00
310
311; DIS: 00000008 <const_llvar>:
312; DIS-NEXT:        8: 00 00 00 00
313; DIS-NEXT:        c: 00 00 00 24
314
315; DIS: 00000010 <const_svar>:
316; DIS-NEXT:       10: 00 25 00 00
317
318; DIS: 00000014 <const_fvar>:
319; DIS-NEXT:       14: 44 48 00 00
320
321; DIS: 00000018 <const_dvar>:
322; DIS-NEXT:       18: 40 8c 20 00
323; DIS-NEXT:       1c: 00 00 00 00
324
325; DIS: 00000020 <const_over_aligned>:
326; DIS-NEXT:       20: 40 8c 20 00
327; DIS-NEXT:       24: 00 00 00 00
328
329; DIS: 00000028 <const_chrarray>:
330; DIS-NEXT:       28: 61 62 63 64
331; DIS-NEXT:       2c: 00 00 00 00
332
333; DIS: 00000030 <const_dblarr>:
334; DIS-NEXT:       30: 3f f0 00 00
335; DIS-NEXT:       34: 00 00 00 00
336; DIS-NEXT:       38: 40 00 00 00
337; DIS-NEXT:       3c: 00 00 00 00
338; DIS-NEXT:       40: 40 08 00 00
339; DIS-NEXT:       44: 00 00 00 00
340; DIS-NEXT:       48: 40 10 00 00
341; DIS-NEXT:       4c: 00 00 00 00
342