aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-26 18:46:49 +0000
committerChris Lattner <sabre@nondot.org>2005-08-26 18:46:49 +0000
commit13794f5d01317d76ec698b43bdf1c35eea57eae5 (patch)
tree53985d8d39596998a82d4c9b01bd4888026f5382
parent52987f4f6531ffcfcc61b1319f5219f3704d426b (diff)
implement the fold for:
bool %test(int %X, int %Y) { %C = setne int %X, 0 ret bool %C } to: _test: addic r2, r3, -1 subfe r3, r2, r3 blr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23089 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PPCISelDAGToDAG.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index a0f55adb51..8c0d6d00be 100644
--- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -1376,6 +1376,27 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
break;
}
+ case ISD::SELECT_CC: {
+ ISD::CondCode CC = cast<CondCodeSDNode>(N->getOperand(4))->get();
+
+ // handle the setcc cases here. select_cc lhs, 0, 1, 0, cc
+ if (ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N->getOperand(1)))
+ if (ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N->getOperand(2)))
+ if (ConstantSDNode *N3C = dyn_cast<ConstantSDNode>(N->getOperand(3)))
+ if (N1C->isNullValue() && N3C->isNullValue() &&
+ N2C->getValue() == 1ULL && CC == ISD::SETNE) {
+ SDOperand LHS = Select(N->getOperand(0));
+ SDOperand Tmp =
+ CurDAG->getTargetNode(PPC::ADDIC, MVT::i32, MVT::Flag,
+ LHS, getI32Imm(~0U));
+ CurDAG->SelectNodeTo(N, PPC::SUBFE, MVT::i32, Tmp, LHS,
+ Tmp.getValue(1));
+ break;
+ }
+
+ assert(0 && "Select_cc not implemented yet!");
+ }
+
case ISD::CALLSEQ_START:
case ISD::CALLSEQ_END: {
unsigned Amt = cast<ConstantSDNode>(N->getOperand(1))->getValue();