1 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
2 ; RUN: -mattr=-altivec -xcoff-traceback-table=true < %s | \
3 ; RUN: FileCheck --check-prefixes=CHECK-ASM,COMMON %s
5 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -function-sections \
6 ; RUN: -mcpu=pwr4 -mattr=-altivec < %s | \
7 ; RUN: FileCheck --check-prefixes=CHECK-FUNC,COMMON %s
10 %struct.S = type { i32, i32 }
11 %struct.D = type { float, double }
12 %struct.SD = type { %struct.S*, %struct.D }
14 @__const.main.s = private unnamed_addr constant %struct.S { i32 10, i32 20 }, align 4
15 @__const.main.d = private unnamed_addr constant %struct.D { float 1.000000e+01, double 2.000000e+01 }, align 8
17 define double @_Z10add_structifd1SP2SD1Di(i32 %value, float %fvalue, double %dvalue, %struct.S* byval(%struct.S) align 4 %s, %struct.SD* %dp, %struct.D* byval(%struct.D) align 4 %0, i32 %v2) #0 {
19 %d = alloca %struct.D, align 8
20 %value.addr = alloca i32, align 4
21 %fvalue.addr = alloca float, align 4
22 %dvalue.addr = alloca double, align 8
23 %dp.addr = alloca %struct.SD*, align 4
24 %v2.addr = alloca i32, align 4
25 %1 = bitcast %struct.D* %d to i8*
26 %2 = bitcast %struct.D* %0 to i8*
27 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %1, i8* align 4 %2, i32 16, i1 false)
28 store i32 %value, i32* %value.addr, align 4
29 store float %fvalue, float* %fvalue.addr, align 4
30 store double %dvalue, double* %dvalue.addr, align 8
31 store %struct.SD* %dp, %struct.SD** %dp.addr, align 4
32 store i32 %v2, i32* %v2.addr, align 4
33 %3 = load double, double* %dvalue.addr, align 8
34 %4 = load float, float* %fvalue.addr, align 4
35 %conv = fpext float %4 to double
36 %add = fadd double %3, %conv
37 %5 = load i32, i32* %value.addr, align 4
38 %conv1 = sitofp i32 %5 to double
39 %add2 = fadd double %add, %conv1
40 %i1 = getelementptr inbounds %struct.S, %struct.S* %s, i32 0, i32 0
41 %6 = load i32, i32* %i1, align 4
42 %conv3 = sitofp i32 %6 to double
43 %add4 = fadd double %add2, %conv3
44 %7 = load %struct.SD*, %struct.SD** %dp.addr, align 4
45 %d5 = getelementptr inbounds %struct.SD, %struct.SD* %7, i32 0, i32 1
46 %d1 = getelementptr inbounds %struct.D, %struct.D* %d5, i32 0, i32 1
47 %8 = load double, double* %d1, align 8
48 %add6 = fadd double %add4, %8
49 %f1 = getelementptr inbounds %struct.D, %struct.D* %d, i32 0, i32 0
50 %9 = load float, float* %f1, align 8
51 %conv7 = fpext float %9 to double
52 %add8 = fadd double %add6, %conv7
53 %10 = load i32, i32* %v2.addr, align 4
54 %conv9 = sitofp i32 %10 to double
55 %add10 = fadd double %add8, %conv9
59 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1
63 %retval = alloca i32, align 4
64 %s = alloca %struct.S, align 4
65 %d = alloca %struct.D, align 8
66 %sd = alloca %struct.SD, align 8
67 %agg.tmp = alloca %struct.S, align 4
68 %agg.tmp4 = alloca %struct.D, align 8
69 store i32 0, i32* %retval, align 4
70 %0 = bitcast %struct.S* %s to i8*
71 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 bitcast (%struct.S* @__const.main.s to i8*), i32 8, i1 false)
72 %1 = bitcast %struct.D* %d to i8*
73 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %1, i8* align 8 bitcast (%struct.D* @__const.main.d to i8*), i32 16, i1 false)
74 %sp = getelementptr inbounds %struct.SD, %struct.SD* %sd, i32 0, i32 0
75 store %struct.S* %s, %struct.S** %sp, align 8
76 %d1 = getelementptr inbounds %struct.SD, %struct.SD* %sd, i32 0, i32 1
77 %f1 = getelementptr inbounds %struct.D, %struct.D* %d1, i32 0, i32 0
78 store float 1.000000e+02, float* %f1, align 8
79 %d2 = getelementptr inbounds %struct.SD, %struct.SD* %sd, i32 0, i32 1
80 %d13 = getelementptr inbounds %struct.D, %struct.D* %d2, i32 0, i32 1
81 store double 2.000000e+02, double* %d13, align 8
82 %2 = bitcast %struct.S* %agg.tmp to i8*
83 %3 = bitcast %struct.S* %s to i8*
84 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %2, i8* align 4 %3, i32 8, i1 false)
85 %4 = bitcast %struct.D* %agg.tmp4 to i8*
86 %5 = bitcast %struct.D* %d to i8*
87 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %4, i8* align 8 %5, i32 16, i1 false)
88 %call = call double @_Z10add_structifd1SP2SD1Di(i32 1, float 2.000000e+00, double 3.000000e+00, %struct.S* byval(%struct.S) align 4 %agg.tmp, %struct.SD* %sd, %struct.D* byval(%struct.D) align 4 %agg.tmp4, i32 7)
89 %add = fadd double %call, 1.000000e+00
90 %conv = fptosi double %add to i32
94 define double @_Z7add_bari1SfdP2SD1Di(i32 %value, %struct.S* byval(%struct.S) align 4 %s, float %fvalue, double %dvalue, %struct.SD* %dp, %struct.D* byval(%struct.D) align 4 %0, i32 %v2) #0 {
96 %d = alloca %struct.D, align 8
97 %value.addr = alloca i32, align 4
98 %fvalue.addr = alloca float, align 4
99 %dvalue.addr = alloca double, align 8
100 %dp.addr = alloca %struct.SD*, align 4
101 %v2.addr = alloca i32, align 4
102 %1 = bitcast %struct.D* %d to i8*
103 %2 = bitcast %struct.D* %0 to i8*
104 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %1, i8* align 4 %2, i32 16, i1 false)
105 store i32 %value, i32* %value.addr, align 4
106 store float %fvalue, float* %fvalue.addr, align 4
107 store double %dvalue, double* %dvalue.addr, align 8
108 store %struct.SD* %dp, %struct.SD** %dp.addr, align 4
109 store i32 %v2, i32* %v2.addr, align 4
110 %3 = load double, double* %dvalue.addr, align 8
111 %4 = load float, float* %fvalue.addr, align 4
112 %conv = fpext float %4 to double
113 %add = fadd double %3, %conv
114 %5 = load i32, i32* %value.addr, align 4
115 %conv1 = sitofp i32 %5 to double
116 %add2 = fadd double %add, %conv1
117 %i1 = getelementptr inbounds %struct.S, %struct.S* %s, i32 0, i32 0
118 %6 = load i32, i32* %i1, align 4
119 %conv3 = sitofp i32 %6 to double
120 %add4 = fadd double %add2, %conv3
121 %7 = load %struct.SD*, %struct.SD** %dp.addr, align 4
122 %d5 = getelementptr inbounds %struct.SD, %struct.SD* %7, i32 0, i32 1
123 %d1 = getelementptr inbounds %struct.D, %struct.D* %d5, i32 0, i32 1
124 %8 = load double, double* %d1, align 8
125 %add6 = fadd double %add4, %8
126 %f1 = getelementptr inbounds %struct.D, %struct.D* %d, i32 0, i32 0
127 %9 = load float, float* %f1, align 8
128 %conv7 = fpext float %9 to double
129 %add8 = fadd double %add6, %conv7
130 %10 = load i32, i32* %v2.addr, align 4
131 %conv9 = sitofp i32 %10 to double
132 %add10 = fadd double %add8, %conv9
136 define i32 @foo(i32 %i1, i32 %i2, i32 %i3, i32 %i4, i32 %i5, i32 %i6, i32 %i7, float %f1, float %f2, float %f3, float %f4, float %f5, float %f6, float %f7, float %f8, float %f9, float %f10, float %f11, float %f12, float %f13, float %f14, i32 %i8) {
138 %i1.addr = alloca i32, align 4
139 store i32 %i1, i32* %i1.addr, align 4
143 ; CHECK-ASM-LABEL: ._Z10add_structifd1SP2SD1Di:{{[[:space:]] *}}# %bb.0:
144 ; CHECK-FUNC-LABEL: csect ._Z10add_structifd1SP2SD1Di[PR],2{{[[:space:]] *}}# %bb.0:
145 ; COMMON-NEXT: lwz 4, L..C0(2)
146 ; COMMON-NEXT: stfs 1, -24(1)
147 ; COMMON-NEXT: lfs 0, 0(4)
148 ; COMMON-NEXT: lwz 4, 56(1)
149 ; COMMON: fsub 0, 2, 0
150 ; COMMON-NEXT: stw 9, -36(1)
151 ; COMMON-NEXT: fadd 1, 1, 0
153 ; COMMON-NEXT: L.._Z10add_structifd1SP2SD1Di0:
154 ; COMMON-NEXT: .vbyte 4, 0x00000000 # Traceback table begin
155 ; COMMON-NEXT: .byte 0x00 # Version = 0
156 ; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus
157 ; COMMON-NEXT: .byte 0x22 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
158 ; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure
159 ; COMMON-NEXT: # -HasControlledStorage, -IsTOCless
160 ; COMMON-NEXT: # +IsFloatingPointPresent
161 ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled
162 ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
163 ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved
164 ; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
165 ; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
166 ; COMMON-NEXT: .byte 0x05 # NumberOfFixedParms = 5
167 ; COMMON-NEXT: .byte 0x05 # NumberOfFPParms = 2, +HasParmsOnStack
168 ; COMMON-NEXT: .vbyte 4, 0x58000000 # Parameter type = i, f, d, i, i, i, i
169 ; CHECK-ASM-NEXT: .vbyte 4, L.._Z10add_structifd1SP2SD1Di0-._Z10add_structifd1SP2SD1Di # Function size
170 ; CHECK-FUNC-NEXT: .vbyte 4, L.._Z10add_structifd1SP2SD1Di0-._Z10add_structifd1SP2SD1Di[PR] # Function size
171 ; COMMON-NEXT: .vbyte 2, 0x001a # Function name len = 26
172 ; COMMON-NEXT: .byte "_Z10add_structifd1SP2SD1Di" # Function Name
173 ; COMMON-NEXT: # -- End function
176 ; CHECK-ASM-LABEL: .main:{{[[:space:]] *}}# %bb.0:
177 ; CHECK-FUNC-LABEL: .csect .main[PR],2{{[[:space:]] *}}# %bb.0
178 ; COMMON-NEXT: mflr 0
179 ; COMMON-NEXT: stw 0, 8(1)
182 ; COMMON-NEXT: L..main0:
183 ; COMMON-NEXT: .vbyte 4, 0x00000000 # Traceback table begin
184 ; COMMON-NEXT: .byte 0x00 # Version = 0
185 ; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus
186 ; COMMON-NEXT: .byte 0x22 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
187 ; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure
188 ; COMMON-NEXT: # -HasControlledStorage, -IsTOCless
189 ; COMMON-NEXT: # +IsFloatingPointPresent
190 ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled
191 ; COMMON-NEXT: .byte 0x41 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
192 ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, +IsLRSaved
193 ; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
194 ; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
195 ; COMMON-NEXT: .byte 0x00 # NumberOfFixedParms = 0
196 ; COMMON-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack
197 ; CHECK-ASM-NEXT: .vbyte 4, L..main0-.main # Function size
198 ; CHECK-FUNC-NEXT: .vbyte 4, L..main0-.main[PR] # Function size
199 ; COMMON-NEXT: .vbyte 2, 0x0004 # Function name len = 4
200 ; COMMON-NEXT: .byte "main" # Function Name
201 ; COMMON-NEXT: # -- End function
204 ; CHECK-ASM-LABEL: ._Z7add_bari1SfdP2SD1Di:{{[[:space:]] *}}# %bb.0:
205 ; CHECK-FUNC-LABEL: .csect ._Z7add_bari1SfdP2SD1Di[PR],2{{[[:space:]] *}}# %bb.0:
206 ; COMMON: .vbyte 4, 0x00000000 # Traceback table begin
207 ; COMMON-NEXT: .byte 0x00 # Version = 0
208 ; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus
209 ; COMMON-NEXT: .byte 0x22 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
210 ; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure
211 ; COMMON-NEXT: # -HasControlledStorage, -IsTOCless
212 ; COMMON-NEXT: # +IsFloatingPointPresent
213 ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled
214 ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
215 ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved
216 ; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
217 ; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
218 ; COMMON-NEXT: .byte 0x05 # NumberOfFixedParms = 5
219 ; COMMON-NEXT: .byte 0x05 # NumberOfFPParms = 2, +HasParmsOnStack
220 ; COMMON-NEXT: .vbyte 4, 0x16000000 # Parameter type = i, i, i, f, d, i, i
221 ; CHECK-ASM-NEXT: .vbyte 4, L.._Z7add_bari1SfdP2SD1Di0-._Z7add_bari1SfdP2SD1Di # Function size
222 ; CHECK-FUNC-NEXT: .vbyte 4, L.._Z7add_bari1SfdP2SD1Di0-._Z7add_bari1SfdP2SD1Di[PR] # Function size
223 ; COMMON-NEXT: .vbyte 2, 0x0016 # Function name len = 22
224 ; COMMON-NEXT: .byte "_Z7add_bari1SfdP2SD1Di" # Function Name
225 ; COMMON-NEXT: # -- End function
228 ; CHECK-ASM-LABEL: .foo:{{[[:space:]] *}}# %bb.0:
229 ; CHECK-FUNC-LABEL: .csect .foo[PR],2{{[[:space:]] *}}# %bb.0:
230 ; COMMON: stw 3, -4(1)
232 ; COMMON-NEXT:L..foo0:
233 ; COMMON-NEXT: .vbyte 4, 0x00000000 # Traceback table begin
234 ; COMMON-NEXT: .byte 0x00 # Version = 0
235 ; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus
236 ; COMMON-NEXT: .byte 0x20 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
237 ; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure
238 ; COMMON-NEXT: # -HasControlledStorage, -IsTOCless
239 ; COMMON-NEXT: # -IsFloatingPointPresent
240 ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled
241 ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
242 ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved
243 ; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
244 ; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
245 ; COMMON-NEXT: .byte 0x07 # NumberOfFixedParms = 7
246 ; COMMON-NEXT: .byte 0x1b # NumberOfFPParms = 13, +HasParmsOnStack
247 ; COMMON-NEXT: .vbyte 4, 0x01555554 # Parameter type = i, i, i, i, i, i, i, f, f, f, f, f, f, f, f, f, f, f, f, ...
248 ; CHECK-ASM-NEXT: .vbyte 4, L..foo0-.foo # Function size
249 ; CHECK-FUNC-NEXT: .vbyte 4, L..foo0-.foo[PR] # Function size
250 ; COMMON-NEXT: .vbyte 2, 0x0003 # Function name len = 3
251 ; COMMON-NEXT: .byte "foo" # Function Name
252 ; COMMON-NEXT: # -- End function