1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Fixup PPC Darwin i1 argument handling

Like on other targets, we need to zero_extend/truncate i1 args before copying
them to GPRs.

llvm-svn: 203045
This commit is contained in:
Hal Finkel 2014-03-06 00:45:19 +00:00
parent 6ced5a99d2
commit c04da1f4c7
2 changed files with 12 additions and 0 deletions

View File

@ -2777,6 +2777,10 @@ PPCTargetLowering::LowerFormalArguments_Darwin(
if (GPR_idx != Num_GPR_Regs) {
unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass);
ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32);
if (ObjectVT == MVT::i1)
ArgVal = DAG.getNode(ISD::TRUNCATE, dl, MVT::i1, ArgVal);
++GPR_idx;
} else {
needsLoad = true;
@ -4414,6 +4418,9 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
case MVT::i32:
case MVT::i64:
if (GPR_idx != NumGPRs) {
if (Arg.getValueType() == MVT::i1)
Arg = DAG.getNode(ISD::ZERO_EXTEND, dl, PtrVT, Arg);
RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Arg));
} else {
LowerMemOpCallTo(DAG, MF, Chain, Arg, PtrOff, SPDiff, ArgOffset,

View File

@ -1,4 +1,5 @@
; RUN: llc < %s -march=ppc32 -mcpu=ppc32 | FileCheck %s
; RUN: llc < %s -march=ppc32 -mcpu=ppc32 -mtriple=powerpc-darwin | FileCheck %s -check-prefix=CHECK-D
target triple = "powerpc-unknown-linux-gnu"
declare void @printf(i8*, ...)
@ -13,3 +14,7 @@ define void @main() {
; CHECK-DAG: crxor 6, 6, 6
; CHECK: bl printf
; CHECK-D-LABEL: @main
; CHECK-D: li r4, 0
; CHECK-D: bl L_printf$stub