From 2ea0c66ae56b3254698c960f7b89b4eaed6bd83f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 30 Aug 2005 21:28:19 +0000 Subject: [PATCH] Fix type mismatches when passing f32 values to calls git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23159 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index 2cbf6a2f8bb..2d797d7d1bb 100644 --- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -1520,8 +1520,13 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) { } if (N->getOperand(i).getOpcode() != ISD::UNDEF) { - Chain = CurDAG->getCopyToReg(Chain, DestReg, - Select(N->getOperand(i)), InFlag); + SDOperand Val = Select(N->getOperand(i)); + if (Val.getValueType() != RegTy) { + // Use a register-register copy to handle f32 values in f64 registers. + assert(Val.getValueType() == MVT::f32 && RegTy == MVT::f64); + Val = CurDAG->getTargetNode(PPC::FMR, MVT::f64, Val); + } + Chain = CurDAG->getCopyToReg(Chain, DestReg, Val, InFlag); InFlag = Chain.getValue(1); CallOperands.push_back(CurDAG->getRegister(DestReg, RegTy)); }