48 lines · plain
1; RUN: llc -verify-machineinstrs -mcpu=pwr7 -O0 -fast-isel=false < %s | FileCheck %s2 3; This tests correct handling of empty aggregate parameters and return values.4; An empty parameter passed by value does not consume a protocol register or5; a parameter save area doubleword. An empty parameter passed by reference6; is treated as any other pointer parameter. An empty aggregate return value7; is treated as any other aggregate return value, passed via address as a8; hidden parameter in GPR3. In this example, GPR3 contains the return value9; address, GPR4 contains the address of e2, and e1 and e3 are not passed or10; received.11 12target 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-f128:128:128-v128:128:128-n32:64"13target triple = "powerpc64-unknown-linux-gnu"14 15%struct.empty = type {}16 17define void @callee(ptr noalias sret(%struct.empty) %agg.result, ptr byval(%struct.empty) %a1, ptr %a2, ptr byval(%struct.empty) %a3) nounwind {18entry:19 %a2.addr = alloca ptr, align 820 store ptr %a2, ptr %a2.addr, align 821 %0 = load ptr, ptr %a2.addr, align 822 call void @llvm.memcpy.p0.p0.i64(ptr %agg.result, ptr %0, i64 0, i1 false)23 ret void24}25 26; CHECK-LABEL: callee:27; CHECK: std 4,28; CHECK-NOT: std 5,29; CHECK-NOT: std 6,30; CHECK: blr31 32declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind33 34define void @caller(ptr noalias sret(%struct.empty) %agg.result) nounwind {35entry:36 %e1 = alloca %struct.empty, align 137 %e2 = alloca %struct.empty, align 138 %e3 = alloca %struct.empty, align 139 call void @callee(ptr sret(%struct.empty) %agg.result, ptr byval(%struct.empty) %e1, ptr %e2, ptr byval(%struct.empty) %e3)40 ret void41}42 43; CHECK-LABEL: caller:44; CHECK: addi 4,45; CHECK-NOT: std 5,46; CHECK-NOT: std 6,47; CHECK: bl callee48