xref: /llvm-project/llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll (revision b1acb7a315e903ee340a33dbc9b2b61b0450bb67)
1; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
2; RUN:     -data-sections -xcoff-traceback-table=false < %s | \
3; RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
4; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff -data-sections < %s | \
5; RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
6; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
7; RUN:     -filetype=obj -data-sections -xcoff-traceback-table=false -o %t.o < %s
8; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=CHECKOBJ %s
9; RUN: llvm-readobj -s %t.o | FileCheck --check-prefix=CHECKSYM %s
10
11;; Test to see if the default is correct for -data-sections on AIX.
12; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
13; RUN:     -xcoff-traceback-table=false < %s | \
14; RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
15; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff < %s | \
16; RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
17; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
18; RUN:     -xcoff-traceback-table=false -filetype=obj -o %t.o < %s
19; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=CHECKOBJ %s
20; RUN: llvm-readobj -s %t.o | FileCheck --check-prefix=CHECKSYM %s
21
22;; Test to see if the default is correct for -data-sections on AIX.
23; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
24; RUN:     -xcoff-traceback-table=false < %s | \
25; RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
26; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff \
27; RUN:     -xcoff-traceback-table=false < %s | \
28; RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
29; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
30; RUN:     -xcoff-traceback-table=false -filetype=obj -o %t.o < %s
31; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefix=CHECKOBJ %s
32; RUN: llvm-readobj -s %t.o | FileCheck --check-prefix=CHECKSYM %s
33
34@ivar = local_unnamed_addr global i32 35, align 4
35@const_ivar = constant i32 35, align 4
36
37@a = common global i32 0, align 4
38@f = common local_unnamed_addr global i32 0, align 4
39
40@.str = private unnamed_addr constant [9 x i8] c"abcdefgh\00", align 1
41@p = global ptr @.str, align 4
42
43define i8 @foo() {
44entry:
45  %0 = load ptr, ptr @p, align 4
46  %1 = load i8, ptr %0, align 1
47  ret i8 %1
48}
49
50define i32 @bar() {
51entry:
52  %0 = load i32, ptr @ivar, align 4
53  %1 = load i32, ptr @const_ivar, align 4
54  %add = add nsw i32 %0, %1
55  %2 = load i32, ptr @a, align 4
56  %add1 = add nsw i32 %add, %2
57  %3 = load i32, ptr @f, align 4
58  %add2 = add nsw i32 %add1, %3
59  ret i32 %add2
60}
61
62
63; CHECK:              .csect ivar[RW],2
64; CHECK-NEXT:         .globl  ivar[RW]
65; CHECK-NEXT:         .align  2
66; CHECK-NEXT:         .vbyte  4, 35                           # 0x23
67; CHECK-NEXT:         .csect const_ivar[RO],2
68; CHECK-NEXT:         .globl  const_ivar[RO]
69; CHECK-NEXT:         .align  2
70; CHECK-NEXT:         .vbyte  4, 35                           # 0x23
71; CHECK-NEXT:         .comm   a[RW],4,2
72; CHECK-NEXT:         .comm   f[RW],4,2
73; CHECK-NEXT:         .csect L...str[RO],2
74; CHECK-NEXT:         .string "abcdefgh"
75; CHECK32:            .csect p[RW],2
76; CHECK32-NEXT:       .globl  p[RW]
77; CHECK32-NEXT:       .align  2
78; CHECK32-NEXT:       .vbyte  4, L...str[RO]
79; CHECK64:            .csect p[RW],3
80; CHECK64-NEXT:       .globl  p[RW]
81; CHECK64-NEXT:       .align  3
82; CHECK64-NEXT:       .vbyte  8, L...str[RO]
83; CHECK:              .toc
84; CHECK-NEXT: L..C0:
85; CHECK-NEXT:         .tc p[TC],p[RW]
86; CHECK-NEXT: L..C1:
87; CHECK-NEXT:         .tc ivar[TC],ivar[RW]
88; CHECK-NEXT: L..C2:
89; CHECK-NEXT:         .tc a[TC],a[RW]
90; CHECK-NEXT: L..C3:
91; CHECK-NEXT:         .tc f[TC],f[RW]
92
93; CHECKOBJ:        00000038 (idx: [[#NFA+7]]) const_ivar[RO]:
94; CHECKOBJ-NEXT:         38: 00 00 00 23   <unknown>
95; CHECKOBJ-EMPTY:
96; CHECKOBJ-NEXT:   0000003c (idx: [[#NFA+9]]) L...str[RO]:
97; CHECKOBJ-NEXT:         3c: 61 62 63 64
98; CHECKOBJ-NEXT:         40: 65 66 67 68
99; CHECKOBJ-NEXT:         44: 00 00 00 00   <unknown>
100; CHECKOBJ-EMPTY:
101; CHECKOBJ-NEXT:   Disassembly of section .data:
102; CHECKOBJ-EMPTY:
103; CHECKOBJ-NEXT:   00000048 (idx: [[#NFA+11]]) ivar[RW]:
104; CHECKOBJ-NEXT:         48: 00 00 00 23   <unknown>
105; CHECKOBJ-EMPTY:
106; CHECKOBJ-NEXT:   0000004c (idx: [[#NFA+13]]) p[RW]:
107; CHECKOBJ-NEXT:         4c: 00 00 00 3c   <unknown>
108; CHECKOBJ-EMPTY:
109; CHECKOBJ-NEXT:   00000050 (idx: [[#NFA+15]]) foo[DS]:
110; CHECKOBJ-NEXT:         50: 00 00 00 00   <unknown>
111; CHECKOBJ-NEXT:         54: 00 00 00 68   <unknown>
112; CHECKOBJ-NEXT:         58: 00 00 00 00   <unknown>
113; CHECKOBJ-EMPTY:
114; CHECKOBJ-NEXT:   0000005c (idx: [[#NFA+17]]) bar[DS]:
115; CHECKOBJ-NEXT:         5c: 00 00 00 10   <unknown>
116; CHECKOBJ-NEXT:         60: 00 00 00 68   <unknown>
117; CHECKOBJ-NEXT:         64: 00 00 00 00   <unknown>
118; CHECKOBJ-EMPTY:
119; CHECKOBJ-NEXT:   00000068 (idx: [[#NFA+21]]) p[TC]:
120; CHECKOBJ-NEXT:         68: 00 00 00 4c   <unknown>
121; CHECKOBJ-EMPTY:
122; CHECKOBJ-NEXT:   0000006c (idx: [[#NFA+23]]) ivar[TC]:
123; CHECKOBJ-NEXT:         6c: 00 00 00 48   <unknown>
124; CHECKOBJ-EMPTY:
125; CHECKOBJ-NEXT:   00000070 (idx: [[#NFA+25]]) a[TC]:
126; CHECKOBJ-NEXT:         70: 00 00 00 78   <unknown>
127; CHECKOBJ-EMPTY:
128; CHECKOBJ-NEXT:   00000074 (idx: [[#NFA+27]]) f[TC]:
129; CHECKOBJ-NEXT:         74: 00 00 00 7c   <unknown>
130; CHECKOBJ-EMPTY:
131; CHECKOBJ-NEXT:   Disassembly of section .bss:
132; CHECKOBJ-EMPTY:
133; CHECKOBJ-NEXT:   00000078 (idx: [[#NFA+29]]) a[RW]:
134; CHECKOBJ-NEXT:   ...
135; CHECKOBJ-EMPTY:
136; CHECKOBJ-NEXT:   0000007c (idx: [[#NFA+31]]) f[RW]:
137; CHECKOBJ-NEXT:   ...
138
139
140; CHECKSYM:    Symbol {
141; CHECKSYM:      Name: const_ivar
142; CHECKSYM:      Value (RelocatableAddress): 0x38
143; CHECKSYM:      Section: .text
144; CHECKSYM:      Type: 0x0
145; CHECKSYM:      StorageClass: C_EXT (0x2)
146; CHECKSYM:      NumberOfAuxEntries: 1
147; CHECKSYM:      CSECT Auxiliary Entry {
148; CHECKSYM:        SectionLen: 4
149; CHECKSYM:        ParameterHashIndex: 0x0
150; CHECKSYM:        TypeChkSectNum: 0x0
151; CHECKSYM:        SymbolAlignmentLog2: 2
152; CHECKSYM:        SymbolType: XTY_SD (0x1)
153; CHECKSYM:        StorageMappingClass: XMC_RO (0x1)
154; CHECKSYM:        StabInfoIndex: 0x0
155; CHECKSYM:        StabSectNum: 0x0
156; CHECKSYM:      }
157; CHECKSYM:    }
158; CHECKSYM:    Symbol {
159; CHECKSYM:      Name: L...str
160; CHECKSYM:      Value (RelocatableAddress): 0x3C
161; CHECKSYM:      Section: .text
162; CHECKSYM:      Type: 0x0
163; CHECKSYM:      StorageClass: C_HIDEXT (0x6B)
164; CHECKSYM:      NumberOfAuxEntries: 1
165; CHECKSYM:      CSECT Auxiliary Entry {
166; CHECKSYM:        SectionLen: 9
167; CHECKSYM:        ParameterHashIndex: 0x0
168; CHECKSYM:        TypeChkSectNum: 0x0
169; CHECKSYM:        SymbolAlignmentLog2: 2
170; CHECKSYM:        SymbolType: XTY_SD (0x1)
171; CHECKSYM:        StorageMappingClass: XMC_RO (0x1)
172; CHECKSYM:        StabInfoIndex: 0x0
173; CHECKSYM:        StabSectNum: 0x0
174; CHECKSYM:      }
175; CHECKSYM:    }
176; CHECKSYM:    Symbol {
177; CHECKSYM:      Name: ivar
178; CHECKSYM:      Value (RelocatableAddress): 0x48
179; CHECKSYM:      Section: .data
180; CHECKSYM:      Type: 0x0
181; CHECKSYM:      StorageClass: C_EXT (0x2)
182; CHECKSYM:      NumberOfAuxEntries: 1
183; CHECKSYM:      CSECT Auxiliary Entry {
184; CHECKSYM:        SectionLen: 4
185; CHECKSYM:        ParameterHashIndex: 0x0
186; CHECKSYM:        TypeChkSectNum: 0x0
187; CHECKSYM:        SymbolAlignmentLog2: 2
188; CHECKSYM:        SymbolType: XTY_SD (0x1)
189; CHECKSYM:        StorageMappingClass: XMC_RW (0x5)
190; CHECKSYM:        StabInfoIndex: 0x0
191; CHECKSYM:        StabSectNum: 0x0
192; CHECKSYM:      }
193; CHECKSYM:    }
194; CHECKSYM:    Symbol {
195; CHECKSYM:      Name: p
196; CHECKSYM:      Value (RelocatableAddress): 0x4C
197; CHECKSYM:      Section: .data
198; CHECKSYM:      Type: 0x0
199; CHECKSYM:      StorageClass: C_EXT (0x2)
200; CHECKSYM:      NumberOfAuxEntries: 1
201; CHECKSYM:      CSECT Auxiliary Entry {
202; CHECKSYM:        SectionLen: 4
203; CHECKSYM:        ParameterHashIndex: 0x0
204; CHECKSYM:        TypeChkSectNum: 0x0
205; CHECKSYM:        SymbolAlignmentLog2: 2
206; CHECKSYM:        SymbolType: XTY_SD (0x1)
207; CHECKSYM:        StorageMappingClass: XMC_RW (0x5)
208; CHECKSYM:        StabInfoIndex: 0x0
209; CHECKSYM:        StabSectNum: 0x0
210; CHECKSYM:      }
211; CHECKSYM:    }
212; CHECKSYM:    Symbol {
213; CHECKSYM:      Name: TOC
214; CHECKSYM:      Value (RelocatableAddress): 0x68
215; CHECKSYM:      Section: .data
216; CHECKSYM:      Type: 0x0
217; CHECKSYM:      StorageClass: C_HIDEXT (0x6B)
218; CHECKSYM:      NumberOfAuxEntries: 1
219; CHECKSYM:      CSECT Auxiliary Entry {
220; CHECKSYM:        SectionLen: 0
221; CHECKSYM:        ParameterHashIndex: 0x0
222; CHECKSYM:        TypeChkSectNum: 0x0
223; CHECKSYM:        SymbolAlignmentLog2: 2
224; CHECKSYM:        SymbolType: XTY_SD (0x1)
225; CHECKSYM:        StorageMappingClass: XMC_TC0 (0xF)
226; CHECKSYM:        StabInfoIndex: 0x0
227; CHECKSYM:        StabSectNum: 0x0
228; CHECKSYM:      }
229; CHECKSYM:    }
230; CHECKSYM:    Symbol {
231; CHECKSYM:      Name: p
232; CHECKSYM:      Value (RelocatableAddress): 0x68
233; CHECKSYM:      Section: .data
234; CHECKSYM:      Type: 0x0
235; CHECKSYM:      StorageClass: C_HIDEXT (0x6B)
236; CHECKSYM:      NumberOfAuxEntries: 1
237; CHECKSYM:      CSECT Auxiliary Entry {
238; CHECKSYM:        SectionLen: 4
239; CHECKSYM:        ParameterHashIndex: 0x0
240; CHECKSYM:        TypeChkSectNum: 0x0
241; CHECKSYM:        SymbolAlignmentLog2: 2
242; CHECKSYM:        SymbolType: XTY_SD (0x1)
243; CHECKSYM:        StorageMappingClass: XMC_TC (0x3)
244; CHECKSYM:        StabInfoIndex: 0x0
245; CHECKSYM:        StabSectNum: 0x0
246; CHECKSYM:      }
247; CHECKSYM:    }
248; CHECKSYM:    Symbol {
249; CHECKSYM:      Name: ivar
250; CHECKSYM:      Value (RelocatableAddress): 0x6C
251; CHECKSYM:      Section: .data
252; CHECKSYM:      Type: 0x0
253; CHECKSYM:      StorageClass: C_HIDEXT (0x6B)
254; CHECKSYM:      NumberOfAuxEntries: 1
255; CHECKSYM:      CSECT Auxiliary Entry {
256; CHECKSYM:        SectionLen: 4
257; CHECKSYM:        ParameterHashIndex: 0x0
258; CHECKSYM:        TypeChkSectNum: 0x0
259; CHECKSYM:        SymbolAlignmentLog2: 2
260; CHECKSYM:        SymbolType: XTY_SD (0x1)
261; CHECKSYM:        StorageMappingClass: XMC_TC (0x3)
262; CHECKSYM:        StabInfoIndex: 0x0
263; CHECKSYM:        StabSectNum: 0x0
264; CHECKSYM:      }
265; CHECKSYM:    }
266; CHECKSYM:    Symbol {
267; CHECKSYM:      Name: a
268; CHECKSYM:      Value (RelocatableAddress): 0x70
269; CHECKSYM:      Section: .data
270; CHECKSYM:      Type: 0x0
271; CHECKSYM:      StorageClass: C_HIDEXT (0x6B)
272; CHECKSYM:      NumberOfAuxEntries: 1
273; CHECKSYM:      CSECT Auxiliary Entry {
274; CHECKSYM:        SectionLen: 4
275; CHECKSYM:        ParameterHashIndex: 0x0
276; CHECKSYM:        TypeChkSectNum: 0x0
277; CHECKSYM:        SymbolAlignmentLog2: 2
278; CHECKSYM:        SymbolType: XTY_SD (0x1)
279; CHECKSYM:        StorageMappingClass: XMC_TC (0x3)
280; CHECKSYM:        StabInfoIndex: 0x0
281; CHECKSYM:        StabSectNum: 0x0
282; CHECKSYM:      }
283; CHECKSYM:    }
284; CHECKSYM:    Symbol {
285; CHECKSYM:      Name: f
286; CHECKSYM:      Value (RelocatableAddress): 0x74
287; CHECKSYM:      Section: .data
288; CHECKSYM:      Type: 0x0
289; CHECKSYM:      StorageClass: C_HIDEXT (0x6B)
290; CHECKSYM:      NumberOfAuxEntries: 1
291; CHECKSYM:      CSECT Auxiliary Entry {
292; CHECKSYM:        SectionLen: 4
293; CHECKSYM:        ParameterHashIndex: 0x0
294; CHECKSYM:        TypeChkSectNum: 0x0
295; CHECKSYM:        SymbolAlignmentLog2: 2
296; CHECKSYM:        SymbolType: XTY_SD (0x1)
297; CHECKSYM:        StorageMappingClass: XMC_TC (0x3)
298; CHECKSYM:        StabInfoIndex: 0x0
299; CHECKSYM:        StabSectNum: 0x0
300; CHECKSYM:      }
301; CHECKSYM:    }
302; CHECKSYM:    Symbol {
303; CHECKSYM:      Name: a
304; CHECKSYM:      Value (RelocatableAddress): 0x78
305; CHECKSYM:      Section: .bss
306; CHECKSYM:      Type: 0x0
307; CHECKSYM:      StorageClass: C_EXT (0x2)
308; CHECKSYM:      NumberOfAuxEntries: 1
309; CHECKSYM:      CSECT Auxiliary Entry {
310; CHECKSYM:        SectionLen: 4
311; CHECKSYM:        ParameterHashIndex: 0x0
312; CHECKSYM:        TypeChkSectNum: 0x0
313; CHECKSYM:        SymbolAlignmentLog2: 2
314; CHECKSYM:        SymbolType: XTY_CM (0x3)
315; CHECKSYM:        StorageMappingClass: XMC_RW (0x5)
316; CHECKSYM:        StabInfoIndex: 0x0
317; CHECKSYM:        StabSectNum: 0x0
318; CHECKSYM:      }
319; CHECKSYM:    }
320; CHECKSYM:    Symbol {
321; CHECKSYM:      Name: f
322; CHECKSYM:      Value (RelocatableAddress): 0x7C
323; CHECKSYM:      Section: .bss
324; CHECKSYM:      Type: 0x0
325; CHECKSYM:      StorageClass: C_EXT (0x2)
326; CHECKSYM:      NumberOfAuxEntries: 1
327; CHECKSYM:      CSECT Auxiliary Entry {
328; CHECKSYM:        SectionLen: 4
329; CHECKSYM:        ParameterHashIndex: 0x0
330; CHECKSYM:        TypeChkSectNum: 0x0
331; CHECKSYM:        SymbolAlignmentLog2: 2
332; CHECKSYM:        SymbolType: XTY_CM (0x3)
333; CHECKSYM:        StorageMappingClass: XMC_RW (0x5)
334; CHECKSYM:        StabInfoIndex: 0x0
335; CHECKSYM:        StabSectNum: 0x0
336; CHECKSYM:      }
337; CHECKSYM:    }
338