1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mcpu=ppc64 -O0 -disable-fp-elim -fast-isel=false < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workertarget datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64" 4*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64-unknown-linux-gnu" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker%struct.s1 = type { i8 } 7*9880d681SAndroid Build Coastguard Worker%struct.s2 = type { i16 } 8*9880d681SAndroid Build Coastguard Worker%struct.s4 = type { i32 } 9*9880d681SAndroid Build Coastguard Worker%struct.t1 = type { i8 } 10*9880d681SAndroid Build Coastguard Worker%struct.t3 = type <{ i16, i8 }> 11*9880d681SAndroid Build Coastguard Worker%struct.t5 = type <{ i32, i8 }> 12*9880d681SAndroid Build Coastguard Worker%struct.t6 = type <{ i32, i16 }> 13*9880d681SAndroid Build Coastguard Worker%struct.t7 = type <{ i32, i16, i8 }> 14*9880d681SAndroid Build Coastguard Worker%struct.s3 = type { i16, i8 } 15*9880d681SAndroid Build Coastguard Worker%struct.s5 = type { i32, i8 } 16*9880d681SAndroid Build Coastguard Worker%struct.s6 = type { i32, i16 } 17*9880d681SAndroid Build Coastguard Worker%struct.s7 = type { i32, i16, i8 } 18*9880d681SAndroid Build Coastguard Worker%struct.t2 = type <{ i16 }> 19*9880d681SAndroid Build Coastguard Worker%struct.t4 = type <{ i32 }> 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker@caller1.p1 = private unnamed_addr constant %struct.s1 { i8 1 }, align 1 22*9880d681SAndroid Build Coastguard Worker@caller1.p2 = private unnamed_addr constant %struct.s2 { i16 2 }, align 2 23*9880d681SAndroid Build Coastguard Worker@caller1.p3 = private unnamed_addr constant { i16, i8, i8 } { i16 4, i8 8, i8 undef }, align 2 24*9880d681SAndroid Build Coastguard Worker@caller1.p4 = private unnamed_addr constant %struct.s4 { i32 16 }, align 4 25*9880d681SAndroid Build Coastguard Worker@caller1.p5 = private unnamed_addr constant { i32, i8, [3 x i8] } { i32 32, i8 64, [3 x i8] undef }, align 4 26*9880d681SAndroid Build Coastguard Worker@caller1.p6 = private unnamed_addr constant { i32, i16, [2 x i8] } { i32 128, i16 256, [2 x i8] undef }, align 4 27*9880d681SAndroid Build Coastguard Worker@caller1.p7 = private unnamed_addr constant { i32, i16, i8, i8 } { i32 512, i16 1024, i8 -3, i8 undef }, align 4 28*9880d681SAndroid Build Coastguard Worker@caller2.p1 = private unnamed_addr constant %struct.t1 { i8 1 }, align 1 29*9880d681SAndroid Build Coastguard Worker@caller2.p2 = private unnamed_addr constant { i16 } { i16 2 }, align 1 30*9880d681SAndroid Build Coastguard Worker@caller2.p3 = private unnamed_addr constant %struct.t3 <{ i16 4, i8 8 }>, align 1 31*9880d681SAndroid Build Coastguard Worker@caller2.p4 = private unnamed_addr constant { i32 } { i32 16 }, align 1 32*9880d681SAndroid Build Coastguard Worker@caller2.p5 = private unnamed_addr constant %struct.t5 <{ i32 32, i8 64 }>, align 1 33*9880d681SAndroid Build Coastguard Worker@caller2.p6 = private unnamed_addr constant %struct.t6 <{ i32 128, i16 256 }>, align 1 34*9880d681SAndroid Build Coastguard Worker@caller2.p7 = private unnamed_addr constant %struct.t7 <{ i32 512, i16 1024, i8 -3 }>, align 1 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Workerdefine i32 @caller1() nounwind { 37*9880d681SAndroid Build Coastguard Workerentry: 38*9880d681SAndroid Build Coastguard Worker %p1 = alloca %struct.s1, align 1 39*9880d681SAndroid Build Coastguard Worker %p2 = alloca %struct.s2, align 2 40*9880d681SAndroid Build Coastguard Worker %p3 = alloca %struct.s3, align 2 41*9880d681SAndroid Build Coastguard Worker %p4 = alloca %struct.s4, align 4 42*9880d681SAndroid Build Coastguard Worker %p5 = alloca %struct.s5, align 4 43*9880d681SAndroid Build Coastguard Worker %p6 = alloca %struct.s6, align 4 44*9880d681SAndroid Build Coastguard Worker %p7 = alloca %struct.s7, align 4 45*9880d681SAndroid Build Coastguard Worker %0 = bitcast %struct.s1* %p1 to i8* 46*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* getelementptr inbounds (%struct.s1, %struct.s1* @caller1.p1, i32 0, i32 0), i64 1, i32 1, i1 false) 47*9880d681SAndroid Build Coastguard Worker %1 = bitcast %struct.s2* %p2 to i8* 48*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast (%struct.s2* @caller1.p2 to i8*), i64 2, i32 2, i1 false) 49*9880d681SAndroid Build Coastguard Worker %2 = bitcast %struct.s3* %p3 to i8* 50*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* bitcast ({ i16, i8, i8 }* @caller1.p3 to i8*), i64 4, i32 2, i1 false) 51*9880d681SAndroid Build Coastguard Worker %3 = bitcast %struct.s4* %p4 to i8* 52*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* bitcast (%struct.s4* @caller1.p4 to i8*), i64 4, i32 4, i1 false) 53*9880d681SAndroid Build Coastguard Worker %4 = bitcast %struct.s5* %p5 to i8* 54*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* bitcast ({ i32, i8, [3 x i8] }* @caller1.p5 to i8*), i64 8, i32 4, i1 false) 55*9880d681SAndroid Build Coastguard Worker %5 = bitcast %struct.s6* %p6 to i8* 56*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %5, i8* bitcast ({ i32, i16, [2 x i8] }* @caller1.p6 to i8*), i64 8, i32 4, i1 false) 57*9880d681SAndroid Build Coastguard Worker %6 = bitcast %struct.s7* %p7 to i8* 58*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %6, i8* bitcast ({ i32, i16, i8, i8 }* @caller1.p7 to i8*), i64 8, i32 4, i1 false) 59*9880d681SAndroid Build Coastguard Worker %call = call i32 @callee1(%struct.s1* byval %p1, %struct.s2* byval %p2, %struct.s3* byval %p3, %struct.s4* byval %p4, %struct.s5* byval %p5, %struct.s6* byval %p6, %struct.s7* byval %p7) 60*9880d681SAndroid Build Coastguard Worker ret i32 %call 61*9880d681SAndroid Build Coastguard Worker 62*9880d681SAndroid Build Coastguard Worker; CHECK: ld 9, 112(31) 63*9880d681SAndroid Build Coastguard Worker; CHECK: ld 8, 120(31) 64*9880d681SAndroid Build Coastguard Worker; CHECK: ld 7, 128(31) 65*9880d681SAndroid Build Coastguard Worker; CHECK: lwz 6, 136(31) 66*9880d681SAndroid Build Coastguard Worker; CHECK: lwz 5, 144(31) 67*9880d681SAndroid Build Coastguard Worker; CHECK: lhz 4, 152(31) 68*9880d681SAndroid Build Coastguard Worker; CHECK: lbz 3, 160(31) 69*9880d681SAndroid Build Coastguard Worker} 70*9880d681SAndroid Build Coastguard Worker 71*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Workerdefine internal i32 @callee1(%struct.s1* byval %v1, %struct.s2* byval %v2, %struct.s3* byval %v3, %struct.s4* byval %v4, %struct.s5* byval %v5, %struct.s6* byval %v6, %struct.s7* byval %v7) nounwind { 74*9880d681SAndroid Build Coastguard Workerentry: 75*9880d681SAndroid Build Coastguard Worker %a = getelementptr inbounds %struct.s1, %struct.s1* %v1, i32 0, i32 0 76*9880d681SAndroid Build Coastguard Worker %0 = load i8, i8* %a, align 1 77*9880d681SAndroid Build Coastguard Worker %conv = zext i8 %0 to i32 78*9880d681SAndroid Build Coastguard Worker %a1 = getelementptr inbounds %struct.s2, %struct.s2* %v2, i32 0, i32 0 79*9880d681SAndroid Build Coastguard Worker %1 = load i16, i16* %a1, align 2 80*9880d681SAndroid Build Coastguard Worker %conv2 = sext i16 %1 to i32 81*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %conv, %conv2 82*9880d681SAndroid Build Coastguard Worker %a3 = getelementptr inbounds %struct.s3, %struct.s3* %v3, i32 0, i32 0 83*9880d681SAndroid Build Coastguard Worker %2 = load i16, i16* %a3, align 2 84*9880d681SAndroid Build Coastguard Worker %conv4 = sext i16 %2 to i32 85*9880d681SAndroid Build Coastguard Worker %add5 = add nsw i32 %add, %conv4 86*9880d681SAndroid Build Coastguard Worker %a6 = getelementptr inbounds %struct.s4, %struct.s4* %v4, i32 0, i32 0 87*9880d681SAndroid Build Coastguard Worker %3 = load i32, i32* %a6, align 4 88*9880d681SAndroid Build Coastguard Worker %add7 = add nsw i32 %add5, %3 89*9880d681SAndroid Build Coastguard Worker %a8 = getelementptr inbounds %struct.s5, %struct.s5* %v5, i32 0, i32 0 90*9880d681SAndroid Build Coastguard Worker %4 = load i32, i32* %a8, align 4 91*9880d681SAndroid Build Coastguard Worker %add9 = add nsw i32 %add7, %4 92*9880d681SAndroid Build Coastguard Worker %a10 = getelementptr inbounds %struct.s6, %struct.s6* %v6, i32 0, i32 0 93*9880d681SAndroid Build Coastguard Worker %5 = load i32, i32* %a10, align 4 94*9880d681SAndroid Build Coastguard Worker %add11 = add nsw i32 %add9, %5 95*9880d681SAndroid Build Coastguard Worker %a12 = getelementptr inbounds %struct.s7, %struct.s7* %v7, i32 0, i32 0 96*9880d681SAndroid Build Coastguard Worker %6 = load i32, i32* %a12, align 4 97*9880d681SAndroid Build Coastguard Worker %add13 = add nsw i32 %add11, %6 98*9880d681SAndroid Build Coastguard Worker ret i32 %add13 99*9880d681SAndroid Build Coastguard Worker 100*9880d681SAndroid Build Coastguard Worker; CHECK: std 9, 96(1) 101*9880d681SAndroid Build Coastguard Worker; CHECK: std 8, 88(1) 102*9880d681SAndroid Build Coastguard Worker; CHECK: std 7, 80(1) 103*9880d681SAndroid Build Coastguard Worker; CHECK: stw 6, 76(1) 104*9880d681SAndroid Build Coastguard Worker; CHECK: stw 5, 68(1) 105*9880d681SAndroid Build Coastguard Worker; CHECK: sth 4, 62(1) 106*9880d681SAndroid Build Coastguard Worker; CHECK: stb 3, 55(1) 107*9880d681SAndroid Build Coastguard Worker; CHECK: lha {{[0-9]+}}, 62(1) 108*9880d681SAndroid Build Coastguard Worker; CHECK: lha {{[0-9]+}}, 68(1) 109*9880d681SAndroid Build Coastguard Worker; CHECK: lbz {{[0-9]+}}, 55(1) 110*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 76(1) 111*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 80(1) 112*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 88(1) 113*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 96(1) 114*9880d681SAndroid Build Coastguard Worker} 115*9880d681SAndroid Build Coastguard Worker 116*9880d681SAndroid Build Coastguard Workerdefine i32 @caller2() nounwind { 117*9880d681SAndroid Build Coastguard Workerentry: 118*9880d681SAndroid Build Coastguard Worker %p1 = alloca %struct.t1, align 1 119*9880d681SAndroid Build Coastguard Worker %p2 = alloca %struct.t2, align 1 120*9880d681SAndroid Build Coastguard Worker %p3 = alloca %struct.t3, align 1 121*9880d681SAndroid Build Coastguard Worker %p4 = alloca %struct.t4, align 1 122*9880d681SAndroid Build Coastguard Worker %p5 = alloca %struct.t5, align 1 123*9880d681SAndroid Build Coastguard Worker %p6 = alloca %struct.t6, align 1 124*9880d681SAndroid Build Coastguard Worker %p7 = alloca %struct.t7, align 1 125*9880d681SAndroid Build Coastguard Worker %0 = bitcast %struct.t1* %p1 to i8* 126*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* getelementptr inbounds (%struct.t1, %struct.t1* @caller2.p1, i32 0, i32 0), i64 1, i32 1, i1 false) 127*9880d681SAndroid Build Coastguard Worker %1 = bitcast %struct.t2* %p2 to i8* 128*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast ({ i16 }* @caller2.p2 to i8*), i64 2, i32 1, i1 false) 129*9880d681SAndroid Build Coastguard Worker %2 = bitcast %struct.t3* %p3 to i8* 130*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* bitcast (%struct.t3* @caller2.p3 to i8*), i64 3, i32 1, i1 false) 131*9880d681SAndroid Build Coastguard Worker %3 = bitcast %struct.t4* %p4 to i8* 132*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* bitcast ({ i32 }* @caller2.p4 to i8*), i64 4, i32 1, i1 false) 133*9880d681SAndroid Build Coastguard Worker %4 = bitcast %struct.t5* %p5 to i8* 134*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* bitcast (%struct.t5* @caller2.p5 to i8*), i64 5, i32 1, i1 false) 135*9880d681SAndroid Build Coastguard Worker %5 = bitcast %struct.t6* %p6 to i8* 136*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %5, i8* bitcast (%struct.t6* @caller2.p6 to i8*), i64 6, i32 1, i1 false) 137*9880d681SAndroid Build Coastguard Worker %6 = bitcast %struct.t7* %p7 to i8* 138*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %6, i8* bitcast (%struct.t7* @caller2.p7 to i8*), i64 7, i32 1, i1 false) 139*9880d681SAndroid Build Coastguard Worker %call = call i32 @callee2(%struct.t1* byval %p1, %struct.t2* byval %p2, %struct.t3* byval %p3, %struct.t4* byval %p4, %struct.t5* byval %p5, %struct.t6* byval %p6, %struct.t7* byval %p7) 140*9880d681SAndroid Build Coastguard Worker ret i32 %call 141*9880d681SAndroid Build Coastguard Worker 142*9880d681SAndroid Build Coastguard Worker; CHECK: stb {{[0-9]+}}, 71(1) 143*9880d681SAndroid Build Coastguard Worker; CHECK: sth {{[0-9]+}}, 69(1) 144*9880d681SAndroid Build Coastguard Worker; CHECK: stb {{[0-9]+}}, 87(1) 145*9880d681SAndroid Build Coastguard Worker; CHECK: stw {{[0-9]+}}, 83(1) 146*9880d681SAndroid Build Coastguard Worker; CHECK: sth {{[0-9]+}}, 94(1) 147*9880d681SAndroid Build Coastguard Worker; CHECK: stw {{[0-9]+}}, 90(1) 148*9880d681SAndroid Build Coastguard Worker; CHECK: stb {{[0-9]+}}, 103(1) 149*9880d681SAndroid Build Coastguard Worker; CHECK: sth {{[0-9]+}}, 101(1) 150*9880d681SAndroid Build Coastguard Worker; CHECK: stw {{[0-9]+}}, 97(1) 151*9880d681SAndroid Build Coastguard Worker; CHECK: ld 9, 96(1) 152*9880d681SAndroid Build Coastguard Worker; CHECK: ld 8, 88(1) 153*9880d681SAndroid Build Coastguard Worker; CHECK: ld 7, 80(1) 154*9880d681SAndroid Build Coastguard Worker; CHECK: lwz 6, 136(31) 155*9880d681SAndroid Build Coastguard Worker; CHECK: ld 5, 64(1) 156*9880d681SAndroid Build Coastguard Worker; CHECK: lhz 4, 152(31) 157*9880d681SAndroid Build Coastguard Worker; CHECK: lbz 3, 160(31) 158*9880d681SAndroid Build Coastguard Worker} 159*9880d681SAndroid Build Coastguard Worker 160*9880d681SAndroid Build Coastguard Workerdefine internal i32 @callee2(%struct.t1* byval %v1, %struct.t2* byval %v2, %struct.t3* byval %v3, %struct.t4* byval %v4, %struct.t5* byval %v5, %struct.t6* byval %v6, %struct.t7* byval %v7) nounwind { 161*9880d681SAndroid Build Coastguard Workerentry: 162*9880d681SAndroid Build Coastguard Worker %a = getelementptr inbounds %struct.t1, %struct.t1* %v1, i32 0, i32 0 163*9880d681SAndroid Build Coastguard Worker %0 = load i8, i8* %a, align 1 164*9880d681SAndroid Build Coastguard Worker %conv = zext i8 %0 to i32 165*9880d681SAndroid Build Coastguard Worker %a1 = getelementptr inbounds %struct.t2, %struct.t2* %v2, i32 0, i32 0 166*9880d681SAndroid Build Coastguard Worker %1 = load i16, i16* %a1, align 1 167*9880d681SAndroid Build Coastguard Worker %conv2 = sext i16 %1 to i32 168*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %conv, %conv2 169*9880d681SAndroid Build Coastguard Worker %a3 = getelementptr inbounds %struct.t3, %struct.t3* %v3, i32 0, i32 0 170*9880d681SAndroid Build Coastguard Worker %2 = load i16, i16* %a3, align 1 171*9880d681SAndroid Build Coastguard Worker %conv4 = sext i16 %2 to i32 172*9880d681SAndroid Build Coastguard Worker %add5 = add nsw i32 %add, %conv4 173*9880d681SAndroid Build Coastguard Worker %a6 = getelementptr inbounds %struct.t4, %struct.t4* %v4, i32 0, i32 0 174*9880d681SAndroid Build Coastguard Worker %3 = load i32, i32* %a6, align 1 175*9880d681SAndroid Build Coastguard Worker %add7 = add nsw i32 %add5, %3 176*9880d681SAndroid Build Coastguard Worker %a8 = getelementptr inbounds %struct.t5, %struct.t5* %v5, i32 0, i32 0 177*9880d681SAndroid Build Coastguard Worker %4 = load i32, i32* %a8, align 1 178*9880d681SAndroid Build Coastguard Worker %add9 = add nsw i32 %add7, %4 179*9880d681SAndroid Build Coastguard Worker %a10 = getelementptr inbounds %struct.t6, %struct.t6* %v6, i32 0, i32 0 180*9880d681SAndroid Build Coastguard Worker %5 = load i32, i32* %a10, align 1 181*9880d681SAndroid Build Coastguard Worker %add11 = add nsw i32 %add9, %5 182*9880d681SAndroid Build Coastguard Worker %a12 = getelementptr inbounds %struct.t7, %struct.t7* %v7, i32 0, i32 0 183*9880d681SAndroid Build Coastguard Worker %6 = load i32, i32* %a12, align 1 184*9880d681SAndroid Build Coastguard Worker %add13 = add nsw i32 %add11, %6 185*9880d681SAndroid Build Coastguard Worker ret i32 %add13 186*9880d681SAndroid Build Coastguard Worker 187*9880d681SAndroid Build Coastguard Worker; CHECK: std 9, 96(1) 188*9880d681SAndroid Build Coastguard Worker; CHECK: std 8, 88(1) 189*9880d681SAndroid Build Coastguard Worker; CHECK: std 7, 80(1) 190*9880d681SAndroid Build Coastguard Worker; CHECK: stw 6, 76(1) 191*9880d681SAndroid Build Coastguard Worker; CHECK: std 5, 64(1) 192*9880d681SAndroid Build Coastguard Worker; CHECK: sth 4, 62(1) 193*9880d681SAndroid Build Coastguard Worker; CHECK: stb 3, 55(1) 194*9880d681SAndroid Build Coastguard Worker; CHECK: lha {{[0-9]+}}, 62(1) 195*9880d681SAndroid Build Coastguard Worker; CHECK: lha {{[0-9]+}}, 69(1) 196*9880d681SAndroid Build Coastguard Worker; CHECK: lbz {{[0-9]+}}, 55(1) 197*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 76(1) 198*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 83(1) 199*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 90(1) 200*9880d681SAndroid Build Coastguard Worker; CHECK: lwz {{[0-9]+}}, 97(1) 201*9880d681SAndroid Build Coastguard Worker} 202