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

Nate Begeman natebegeman at mac.com
Thu Mar 31 23:21:40 PST 2005



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelPattern.cpp updated: 1.29 -> 1.30
---
Log message:

Also apply Chris's fix to FP select and SETCC


---
Diffs of the changes:  (+8 -6)

 PPC32ISelPattern.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.29 llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.30
--- llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.29	Fri Apr  1 01:10:02 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp	Fri Apr  1 01:21:30 2005
@@ -729,6 +729,9 @@
       return 0;
     }
     
+    unsigned TrueValue = SelectExpr(N.getOperand(1)); //Use if TRUE
+    unsigned FalseValue = SelectExpr(N.getOperand(2)); //Use if FALSE
+
     // Create an iterator with which to insert the MBB for copying the false 
     // value and the MBB to hold the PHI instruction for this SetCC.
     MachineBasicBlock *thisMBB = BB;
@@ -746,7 +749,6 @@
     BuildMI(BB, PPC::CMPLWI, 2, PPC::CR0).addReg(Tmp1).addImm(0);
     MachineBasicBlock *copy0MBB = new MachineBasicBlock(LLVM_BB);
     MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB);
-    unsigned TrueValue = SelectExpr(N.getOperand(1)); //Use if TRUE
     BuildMI(BB, PPC::BNE, 2).addReg(PPC::CR0).addMBB(sinkMBB);
     MachineFunction *F = BB->getParent();
     F->getBasicBlockList().insert(It, copy0MBB);
@@ -759,7 +761,6 @@
     //   %FalseValue = ...
     //   # fallthrough to sinkMBB
     BB = copy0MBB;
-    unsigned FalseValue = SelectExpr(N.getOperand(2)); //Use if FALSE
     // Update machine-CFG edges
     BB->addSuccessor(sinkMBB);
 
@@ -1318,6 +1319,11 @@
     if (SetCCSDNode *SetCC = dyn_cast<SetCCSDNode>(Node)) {
       Opc = SelectSetCR0(N);
       
+      unsigned TrueValue = MakeReg(MVT::i32);
+      BuildMI(BB, PPC::LI, 1, TrueValue).addSImm(1);
+      unsigned FalseValue = MakeReg(MVT::i32);
+      BuildMI(BB, PPC::LI, 1, FalseValue).addSImm(0);
+
       // Create an iterator with which to insert the MBB for copying the false 
       // value and the MBB to hold the PHI instruction for this SetCC.
       MachineBasicBlock *thisMBB = BB;
@@ -1330,8 +1336,6 @@
       //   cmpTY cr0, r1, r2
       //   %TrueValue = li 1
       //   bCC sinkMBB
-      unsigned TrueValue = MakeReg(MVT::i32);
-      BuildMI(BB, PPC::LI, 1, TrueValue).addSImm(1);
       MachineBasicBlock *copy0MBB = new MachineBasicBlock(LLVM_BB);
       MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB);
       BuildMI(BB, Opc, 2).addReg(PPC::CR0).addMBB(sinkMBB);
@@ -1346,8 +1350,6 @@
       //   %FalseValue = li 0
       //   fallthrough
       BB = copy0MBB;
-      unsigned FalseValue = MakeReg(MVT::i32);
-      BuildMI(BB, PPC::LI, 1, FalseValue).addSImm(0);
       // Update machine-CFG edges
       BB->addSuccessor(sinkMBB);
 






More information about the llvm-commits mailing list