diff options
author | Nate Begeman <natebegeman@mac.com> | 2005-08-24 00:21:28 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2005-08-24 00:21:28 +0000 |
commit | 72eab5dd5cab9e086b12ba16b14f5bd9bf1ffeed (patch) | |
tree | 1a5f553cb639f8cfb2117d894ff2ca28e12dace0 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | eeacce5a60ddba5c6ef63008c20348f97507df24 (diff) | |
download | bcm5719-llvm-72eab5dd5cab9e086b12ba16b14f5bd9bf1ffeed.tar.gz bcm5719-llvm-72eab5dd5cab9e086b12ba16b14f5bd9bf1ffeed.zip |
Fix optimization of select_cc seteq X, 0, 1, 0 -> srl (ctlz X), log2 X size
llvm-svn: 22995
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3ebaaa465f6..c7687e3c618 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -854,9 +854,9 @@ SDOperand SelectionDAG::SimplifySelectCC(SDOperand N1, SDOperand N2, } // Check to see if this is the equivalent of seteq X, 0. - // select_cc seteq X, 0, 1, 0 -> setcc X, 0, seteq -> srl (ctlz X), size(X)-1 + // select_cc eq X, 0, 1, 0 -> setcc X, 0, eq -> srl (ctlz X), log2(size(X)) if (N2C && N2C->isNullValue() && N4C && N4C->isNullValue() && - N3C && (N3C->getValue() == 1)) { + N3C && (N3C->getValue() == 1ULL) && CC == ISD::SETEQ) { MVT::ValueType XType = N1.getValueType(); if (TLI.getOperationAction(ISD::SETCC, TLI.getSetCCResultTy()) == TargetLowering::Legal) { @@ -865,7 +865,7 @@ SDOperand SelectionDAG::SimplifySelectCC(SDOperand N1, SDOperand N2, if (TLI.getOperationAction(ISD::CTLZ, XType) == TargetLowering::Legal) { SDOperand Ctlz = getNode(ISD::CTLZ, XType, N1); return getNode(ISD::SRL, XType, Ctlz, - getConstant(MVT::getSizeInBits(XType)-1, + getConstant(Log2_32(MVT::getSizeInBits(XType)), TLI.getShiftAmountTy())); } } |