diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-01-22 17:39:32 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-01-22 17:39:32 +0000 |
commit | c58900504bd56fe25b953d49be491da249f0b76a (patch) | |
tree | 1ecb7dc560398fd374737c9c90d1c058fc3af4d1 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | b2e6ca7ff3633d99909da5268afeb76dd4212400 (diff) | |
download | bcm5719-llvm-c58900504bd56fe25b953d49be491da249f0b76a.tar.gz bcm5719-llvm-c58900504bd56fe25b953d49be491da249f0b76a.zip |
Add SelectionDAG::getNOT method to construct bitwise NOT operations,
corresponding to the "not" and "vnot" PatFrags. Use the new method
in some places where it seems appropriate.
llvm-svn: 62768
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 062b9d9a933..f7c1d061c6b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2759,15 +2759,15 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) { } // fold select C, 0, X -> ~C & X if (VT == VT0 && VT == MVT::i1 && N1C && N1C->isNullValue()) { - SDValue XORNode = DAG.getNode(ISD::XOR, VT, N0, DAG.getConstant(1, VT)); - AddToWorkList(XORNode.getNode()); - return DAG.getNode(ISD::AND, VT, XORNode, N2); + SDValue NOTNode = DAG.getNOT(N0, VT); + AddToWorkList(NOTNode.getNode()); + return DAG.getNode(ISD::AND, VT, NOTNode, N2); } // fold select C, X, 1 -> ~C | X if (VT == VT0 && VT == MVT::i1 && N2C && N2C->getAPIntValue() == 1) { - SDValue XORNode = DAG.getNode(ISD::XOR, VT, N0, DAG.getConstant(1, VT)); - AddToWorkList(XORNode.getNode()); - return DAG.getNode(ISD::OR, VT, XORNode, N1); + SDValue NOTNode = DAG.getNOT(N0, VT); + AddToWorkList(NOTNode.getNode()); + return DAG.getNode(ISD::OR, VT, NOTNode, N1); } // fold select C, X, 0 -> C & X // FIXME: this should check for C type == X type, not i1? @@ -5574,8 +5574,7 @@ SDValue DAGCombiner::SimplifySelectCC(SDValue N0, SDValue N1, if (N1C && N1C->isNullValue() && CC == ISD::SETGT) { SDValue NegN0 = DAG.getNode(ISD::SUB, XType, DAG.getConstant(0, XType), N0); - SDValue NotN0 = DAG.getNode(ISD::XOR, XType, N0, - DAG.getConstant(~0ULL, XType)); + SDValue NotN0 = DAG.getNOT(N0, XType); return DAG.getNode(ISD::SRL, XType, DAG.getNode(ISD::AND, XType, NegN0, NotN0), DAG.getConstant(XType.getSizeInBits()-1, |