From: Nate Begeman Date: Fri, 1 Apr 2005 07:21:30 +0000 (+0000) Subject: Also apply Chris's fix to FP select and SETCC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=31318e4b6c1cc3a3ae0426780b2d360915fae3c4;p=oota-llvm.git Also apply Chris's fix to FP select and SETCC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20979 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/PowerPC/PPCISelPattern.cpp b/lib/Target/PowerPC/PPCISelPattern.cpp index 26b1955b3a2..01d22e11d8b 100644 --- a/lib/Target/PowerPC/PPCISelPattern.cpp +++ b/lib/Target/PowerPC/PPCISelPattern.cpp @@ -729,6 +729,9 @@ unsigned ISel::SelectExprFP(SDOperand N, unsigned Result) 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 @@ unsigned ISel::SelectExprFP(SDOperand N, unsigned Result) 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 @@ unsigned ISel::SelectExprFP(SDOperand N, unsigned Result) // %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 @@ unsigned ISel::SelectExpr(SDOperand N) { if (SetCCSDNode *SetCC = dyn_cast(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 @@ unsigned ISel::SelectExpr(SDOperand N) { // 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 @@ unsigned ISel::SelectExpr(SDOperand N) { // %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);