Fix 'ret long' to return the high and lo parts in the right registers. This

fixes crafty and probably others.

llvm-svn: 23167
This commit is contained in:
Chris Lattner 2005-08-31 01:34:29 +00:00
parent 539e7c892c
commit f4d594370b
1 changed files with 7 additions and 9 deletions

View File

@ -1569,7 +1569,7 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
case ISD::RET: {
SDOperand Chain = Select(N->getOperand(0)); // Token chain.
if (N->getNumOperands() > 1) {
if (N->getNumOperands() == 2) {
SDOperand Val = Select(N->getOperand(1));
if (N->getOperand(1).getValueType() == MVT::i32) {
Chain = CurDAG->getCopyToReg(Chain, PPC::R3, Val);
@ -1577,14 +1577,12 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
assert(MVT::isFloatingPoint(N->getOperand(1).getValueType()));
Chain = CurDAG->getCopyToReg(Chain, PPC::F1, Val);
}
if (N->getNumOperands() > 2) {
assert(N->getOperand(1).getValueType() == MVT::i32 &&
N->getOperand(2).getValueType() == MVT::i32 &&
N->getNumOperands() == 3 && "Unknown two-register ret value!");
Val = Select(N->getOperand(2));
Chain = CurDAG->getCopyToReg(Chain, PPC::R4, Val);
}
} else if (N->getNumOperands() > 1) {
assert(N->getOperand(1).getValueType() == MVT::i32 &&
N->getOperand(2).getValueType() == MVT::i32 &&
N->getNumOperands() == 3 && "Unknown two-register ret value!");
Chain = CurDAG->getCopyToReg(Chain, PPC::R4, Select(N->getOperand(1)));
Chain = CurDAG->getCopyToReg(Chain, PPC::R3, Select(N->getOperand(2)));
}
// Finally, select this to a blr (return) instruction.