Maintain consistency in negating things

llvm-svn: 22855
This commit is contained in:
Nate Begeman 2005-08-18 05:44:50 +00:00
parent 72d6f8800d
commit cfb9a74c2e
1 changed files with 8 additions and 9 deletions

View File

@ -352,19 +352,18 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
// 'not', then fold 'or' into 'nor', and so forth for the supported ops. // 'not', then fold 'or' into 'nor', and so forth for the supported ops.
if (isOprNot(N)) { if (isOprNot(N)) {
unsigned Opc; unsigned Opc;
switch(N->getOperand(0).getOpcode()) { SDOperand Val = Select(N->getOperand(0));
switch (Val.getTargetOpcode()) {
default: Opc = 0; break; default: Opc = 0; break;
case ISD::OR: Opc = PPC::NOR; break; case PPC::OR: Opc = PPC::NOR; break;
case ISD::AND: Opc = PPC::NAND; break; case PPC::AND: Opc = PPC::NAND; break;
case ISD::XOR: Opc = PPC::EQV; break; case PPC::XOR: Opc = PPC::EQV; break;
} }
if (Opc) if (Opc)
CurDAG->SelectNodeTo(N, MVT::i32, Opc, CurDAG->SelectNodeTo(N, MVT::i32, Opc, Val.getOperand(0),
Select(N->getOperand(0).getOperand(0)), Val.getOperand(1));
Select(N->getOperand(0).getOperand(1)));
else else
CurDAG->SelectNodeTo(N, MVT::i32, PPC::NOR, Select(N->getOperand(0)), CurDAG->SelectNodeTo(N, MVT::i32, PPC::NOR, Val, Val);
Select(N->getOperand(0)));
break; break;
} }
// If this is a xor with an immediate other than -1, then codegen it as high // If this is a xor with an immediate other than -1, then codegen it as high