[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 30 18:34:41 PDT 2005



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelDAGToDAG.cpp updated: 1.63 -> 1.64
---
Log message:

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


---
Diffs of the changes:  (+7 -9)

 PPC32ISelDAGToDAG.cpp |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)


Index: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.63 llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.64
--- llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.63	Tue Aug 30 17:59:48 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp	Tue Aug 30 20:34:29 2005
@@ -1569,7 +1569,7 @@
   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 @@
         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.






More information about the llvm-commits mailing list