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