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 4 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 8 9 10%struct.S = type { i32, i32 } 11%struct.D = type { float, double } 12%struct.SD = type { ptr, %struct.D } 13 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 16 17define double @_Z10add_structifd1SP2SD1Di(i32 %value, float %fvalue, double %dvalue, ptr byval(%struct.S) align 4 %s, ptr %dp, ptr byval(%struct.D) align 4 %0, i32 %v2) #0 { 18entry: 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 ptr, align 4 24 %v2.addr = alloca i32, align 4 25 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %d, ptr align 4 %0, i32 16, i1 false) 26 store i32 %value, ptr %value.addr, align 4 27 store float %fvalue, ptr %fvalue.addr, align 4 28 store double %dvalue, ptr %dvalue.addr, align 8 29 store ptr %dp, ptr %dp.addr, align 4 30 store i32 %v2, ptr %v2.addr, align 4 31 %1 = load double, ptr %dvalue.addr, align 8 32 %2 = load float, ptr %fvalue.addr, align 4 33 %conv = fpext float %2 to double 34 %add = fadd double %1, %conv 35 %3 = load i32, ptr %value.addr, align 4 36 %conv1 = sitofp i32 %3 to double 37 %add2 = fadd double %add, %conv1 38 %4 = load i32, ptr %s, align 4 39 %conv3 = sitofp i32 %4 to double 40 %add4 = fadd double %add2, %conv3 41 %5 = load ptr, ptr %dp.addr, align 4 42 %d5 = getelementptr inbounds %struct.SD, ptr %5, i32 0, i32 1 43 %d1 = getelementptr inbounds %struct.D, ptr %d5, i32 0, i32 1 44 %6 = load double, ptr %d1, align 8 45 %add6 = fadd double %add4, %6 46 %7 = load float, ptr %d, align 8 47 %conv7 = fpext float %7 to double 48 %add8 = fadd double %add6, %conv7 49 %8 = load i32, ptr %v2.addr, align 4 50 %conv9 = sitofp i32 %8 to double 51 %add10 = fadd double %add8, %conv9 52 ret double %add10 53} 54 55declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #1 56 57define i32 @main() { 58entry: 59 %retval = alloca i32, align 4 60 %s = alloca %struct.S, align 4 61 %d = alloca %struct.D, align 8 62 %sd = alloca %struct.SD, align 8 63 %agg.tmp = alloca %struct.S, align 4 64 %agg.tmp4 = alloca %struct.D, align 8 65 store i32 0, ptr %retval, align 4 66 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %s, ptr align 4 @__const.main.s, i32 8, i1 false) 67 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %d, ptr align 8 @__const.main.d, i32 16, i1 false) 68 store ptr %s, ptr %sd, align 8 69 %d1 = getelementptr inbounds %struct.SD, ptr %sd, i32 0, i32 1 70 store float 1.000000e+02, ptr %d1, align 8 71 %d2 = getelementptr inbounds %struct.SD, ptr %sd, i32 0, i32 1 72 %d13 = getelementptr inbounds %struct.D, ptr %d2, i32 0, i32 1 73 store double 2.000000e+02, ptr %d13, align 8 74 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %agg.tmp, ptr align 4 %s, i32 8, i1 false) 75 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %agg.tmp4, ptr align 8 %d, i32 16, i1 false) 76 %call = call double @_Z10add_structifd1SP2SD1Di(i32 1, float 2.000000e+00, double 3.000000e+00, ptr byval(%struct.S) align 4 %agg.tmp, ptr %sd, ptr byval(%struct.D) align 4 %agg.tmp4, i32 7) 77 %add = fadd double %call, 1.000000e+00 78 %conv = fptosi double %add to i32 79 ret i32 %conv 80} 81 82define double @_Z7add_bari1SfdP2SD1Di(i32 %value, ptr byval(%struct.S) align 4 %s, float %fvalue, double %dvalue, ptr %dp, ptr byval(%struct.D) align 4 %0, i32 %v2) #0 { 83entry: 84 %d = alloca %struct.D, align 8 85 %value.addr = alloca i32, align 4 86 %fvalue.addr = alloca float, align 4 87 %dvalue.addr = alloca double, align 8 88 %dp.addr = alloca ptr, align 4 89 %v2.addr = alloca i32, align 4 90 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %d, ptr align 4 %0, i32 16, i1 false) 91 store i32 %value, ptr %value.addr, align 4 92 store float %fvalue, ptr %fvalue.addr, align 4 93 store double %dvalue, ptr %dvalue.addr, align 8 94 store ptr %dp, ptr %dp.addr, align 4 95 store i32 %v2, ptr %v2.addr, align 4 96 %1 = load double, ptr %dvalue.addr, align 8 97 %2 = load float, ptr %fvalue.addr, align 4 98 %conv = fpext float %2 to double 99 %add = fadd double %1, %conv 100 %3 = load i32, ptr %value.addr, align 4 101 %conv1 = sitofp i32 %3 to double 102 %add2 = fadd double %add, %conv1 103 %4 = load i32, ptr %s, align 4 104 %conv3 = sitofp i32 %4 to double 105 %add4 = fadd double %add2, %conv3 106 %5 = load ptr, ptr %dp.addr, align 4 107 %d5 = getelementptr inbounds %struct.SD, ptr %5, i32 0, i32 1 108 %d1 = getelementptr inbounds %struct.D, ptr %d5, i32 0, i32 1 109 %6 = load double, ptr %d1, align 8 110 %add6 = fadd double %add4, %6 111 %7 = load float, ptr %d, align 8 112 %conv7 = fpext float %7 to double 113 %add8 = fadd double %add6, %conv7 114 %8 = load i32, ptr %v2.addr, align 4 115 %conv9 = sitofp i32 %8 to double 116 %add10 = fadd double %add8, %conv9 117 ret double %add10 118} 119 120define 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) { 121entry: 122 %i1.addr = alloca i32, align 4 123 store i32 %i1, ptr %i1.addr, align 4 124 ret i32 %i1 125} 126 127; CHECK-ASM-LABEL: ._Z10add_structifd1SP2SD1Di:{{[[:space:]] *}}# %bb.0: 128; CHECK-FUNC-LABEL: csect ._Z10add_structifd1SP2SD1Di[PR],5{{[[:space:]] *}}# %bb.0: 129; COMMON-NEXT: lwz 4, L..C0(2) 130; COMMON-NEXT: stfs 1, -24(1) 131; COMMON-NEXT: lfs 0, 0(4) 132; COMMON-NEXT: lwz 4, 56(1) 133; COMMON: fsub 0, 2, 0 134; COMMON-NEXT: stw 9, -36(1) 135; COMMON-NEXT: fadd 1, 1, 0 136; COMMON-NEXT: blr 137; COMMON-NEXT: L.._Z10add_structifd1SP2SD1Di0: 138; COMMON-NEXT: .vbyte 4, 0x00000000 # Traceback table begin 139; COMMON-NEXT: .byte 0x00 # Version = 0 140; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus 141; COMMON-NEXT: .byte 0x22 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue 142; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure 143; COMMON-NEXT: # -HasControlledStorage, -IsTOCless 144; COMMON-NEXT: # +IsFloatingPointPresent 145; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled 146; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed 147; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved 148; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 149; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 150; COMMON-NEXT: .byte 0x05 # NumberOfFixedParms = 5 151; COMMON-NEXT: .byte 0x05 # NumberOfFPParms = 2, +HasParmsOnStack 152; COMMON-NEXT: .vbyte 4, 0x58000000 # Parameter type = i, f, d, i, i, i, i 153; CHECK-ASM-NEXT: .vbyte 4, L.._Z10add_structifd1SP2SD1Di0-._Z10add_structifd1SP2SD1Di # Function size 154; CHECK-FUNC-NEXT: .vbyte 4, L.._Z10add_structifd1SP2SD1Di0-._Z10add_structifd1SP2SD1Di[PR] # Function size 155; COMMON-NEXT: .vbyte 2, 0x001a # Function name len = 26 156; COMMON-NEXT: .byte "_Z10add_structifd1SP2SD1Di" # Function Name 157; COMMON-NEXT: # -- End function 158 159 160; CHECK-ASM-LABEL: .main:{{[[:space:]] *}}# %bb.0: 161; CHECK-FUNC-LABEL: .csect .main[PR],5{{[[:space:]] *}}# %bb.0 162; COMMON-NEXT: mflr 0 163; COMMON: stw 0, 168(1) 164; COMMON: mtlr 0 165; COMMON-NEXT: blr 166; COMMON-NEXT: L..main0: 167; COMMON-NEXT: .vbyte 4, 0x00000000 # Traceback table begin 168; COMMON-NEXT: .byte 0x00 # Version = 0 169; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus 170; COMMON-NEXT: .byte 0x22 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue 171; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure 172; COMMON-NEXT: # -HasControlledStorage, -IsTOCless 173; COMMON-NEXT: # +IsFloatingPointPresent 174; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled 175; COMMON-NEXT: .byte 0x41 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed 176; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, +IsLRSaved 177; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 178; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 179; COMMON-NEXT: .byte 0x00 # NumberOfFixedParms = 0 180; COMMON-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack 181; CHECK-ASM-NEXT: .vbyte 4, L..main0-.main # Function size 182; CHECK-FUNC-NEXT: .vbyte 4, L..main0-.main[PR] # Function size 183; COMMON-NEXT: .vbyte 2, 0x0004 # Function name len = 4 184; COMMON-NEXT: .byte "main" # Function Name 185; COMMON-NEXT: # -- End function 186 187 188; CHECK-ASM-LABEL: ._Z7add_bari1SfdP2SD1Di:{{[[:space:]] *}}# %bb.0: 189; CHECK-FUNC-LABEL: .csect ._Z7add_bari1SfdP2SD1Di[PR],5{{[[:space:]] *}}# %bb.0: 190; COMMON: .vbyte 4, 0x00000000 # Traceback table begin 191; COMMON-NEXT: .byte 0x00 # Version = 0 192; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus 193; COMMON-NEXT: .byte 0x22 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue 194; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure 195; COMMON-NEXT: # -HasControlledStorage, -IsTOCless 196; COMMON-NEXT: # +IsFloatingPointPresent 197; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled 198; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed 199; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved 200; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 201; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 202; COMMON-NEXT: .byte 0x05 # NumberOfFixedParms = 5 203; COMMON-NEXT: .byte 0x05 # NumberOfFPParms = 2, +HasParmsOnStack 204; COMMON-NEXT: .vbyte 4, 0x16000000 # Parameter type = i, i, i, f, d, i, i 205; CHECK-ASM-NEXT: .vbyte 4, L.._Z7add_bari1SfdP2SD1Di0-._Z7add_bari1SfdP2SD1Di # Function size 206; CHECK-FUNC-NEXT: .vbyte 4, L.._Z7add_bari1SfdP2SD1Di0-._Z7add_bari1SfdP2SD1Di[PR] # Function size 207; COMMON-NEXT: .vbyte 2, 0x0016 # Function name len = 22 208; COMMON-NEXT: .byte "_Z7add_bari1SfdP2SD1Di" # Function Name 209; COMMON-NEXT: # -- End function 210 211 212; CHECK-ASM-LABEL: .foo:{{[[:space:]] *}}# %bb.0: 213; CHECK-FUNC-LABEL: .csect .foo[PR],5{{[[:space:]] *}}# %bb.0: 214; COMMON: stw 3, -4(1) 215; COMMON-NEXT: blr 216; COMMON-NEXT:L..foo0: 217; COMMON-NEXT: .vbyte 4, 0x00000000 # Traceback table begin 218; COMMON-NEXT: .byte 0x00 # Version = 0 219; COMMON-NEXT: .byte 0x09 # Language = CPlusPlus 220; COMMON-NEXT: .byte 0x20 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue 221; COMMON-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure 222; COMMON-NEXT: # -HasControlledStorage, -IsTOCless 223; COMMON-NEXT: # -IsFloatingPointPresent 224; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled 225; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed 226; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved 227; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 228; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 229; COMMON-NEXT: .byte 0x07 # NumberOfFixedParms = 7 230; COMMON-NEXT: .byte 0x1b # NumberOfFPParms = 13, +HasParmsOnStack 231; 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, ... 232; CHECK-ASM-NEXT: .vbyte 4, L..foo0-.foo # Function size 233; CHECK-FUNC-NEXT: .vbyte 4, L..foo0-.foo[PR] # Function size 234; COMMON-NEXT: .vbyte 2, 0x0003 # Function name len = 3 235; COMMON-NEXT: .byte "foo" # Function Name 236; COMMON-NEXT: # -- End function 237