forked from OSchip/llvm-project
[DAGCombine] Remove some old dead code for forming SETCC nodes
This code was dead when it was committed in r23665 (Oct 7, 2005), and before it reaches its 10th anniversary, it really should go. We can always bring it back if we'd like, but it forms more SETCC nodes, and the way we do legality checking on SETCC nodes is wrong in a number of places, and removing this means fewer places to fix. NFC. llvm-svn: 246466
This commit is contained in:
parent
bb11d62a5a
commit
a894266d28
|
@ -13762,51 +13762,6 @@ SDValue DAGCombiner::SimplifySelectCC(SDLoc DL, SDValue N0, SDValue N1,
|
|||
}
|
||||
}
|
||||
|
||||
// Check to see if this is the equivalent of setcc
|
||||
// FIXME: Turn all of these into setcc if setcc if setcc is legal
|
||||
// otherwise, go ahead with the folds.
|
||||
if (0 && isNullConstant(N3) && isOneConstant(N2)) {
|
||||
EVT XType = N0.getValueType();
|
||||
if (!LegalOperations ||
|
||||
TLI.isOperationLegal(ISD::SETCC, getSetCCResultType(XType))) {
|
||||
SDValue Res = DAG.getSetCC(DL, getSetCCResultType(XType), N0, N1, CC);
|
||||
if (Res.getValueType() != VT)
|
||||
Res = DAG.getNode(ISD::ZERO_EXTEND, DL, VT, Res);
|
||||
return Res;
|
||||
}
|
||||
|
||||
// fold (seteq X, 0) -> (srl (ctlz X, log2(size(X))))
|
||||
if (isNullConstant(N1) && CC == ISD::SETEQ &&
|
||||
(!LegalOperations ||
|
||||
TLI.isOperationLegal(ISD::CTLZ, XType))) {
|
||||
SDValue Ctlz = DAG.getNode(ISD::CTLZ, SDLoc(N0), XType, N0);
|
||||
return DAG.getNode(ISD::SRL, DL, XType, Ctlz,
|
||||
DAG.getConstant(Log2_32(XType.getSizeInBits()),
|
||||
SDLoc(Ctlz),
|
||||
getShiftAmountTy(Ctlz.getValueType())));
|
||||
}
|
||||
// fold (setgt X, 0) -> (srl (and (-X, ~X), size(X)-1))
|
||||
if (isNullConstant(N1) && CC == ISD::SETGT) {
|
||||
SDLoc DL(N0);
|
||||
SDValue NegN0 = DAG.getNode(ISD::SUB, DL,
|
||||
XType, DAG.getConstant(0, DL, XType), N0);
|
||||
SDValue NotN0 = DAG.getNOT(DL, N0, XType);
|
||||
return DAG.getNode(ISD::SRL, DL, XType,
|
||||
DAG.getNode(ISD::AND, DL, XType, NegN0, NotN0),
|
||||
DAG.getConstant(XType.getSizeInBits() - 1, DL,
|
||||
getShiftAmountTy(XType)));
|
||||
}
|
||||
// fold (setgt X, -1) -> (xor (srl (X, size(X)-1), 1))
|
||||
if (isAllOnesConstant(N1) && CC == ISD::SETGT) {
|
||||
SDLoc DL(N0);
|
||||
SDValue Sign = DAG.getNode(ISD::SRL, DL, XType, N0,
|
||||
DAG.getConstant(XType.getSizeInBits() - 1, DL,
|
||||
getShiftAmountTy(N0.getValueType())));
|
||||
return DAG.getNode(ISD::XOR, DL, XType, Sign, DAG.getConstant(1, DL,
|
||||
XType));
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if this is an integer abs.
|
||||
// select_cc setg[te] X, 0, X, -X ->
|
||||
// select_cc setgt X, -1, X, -X ->
|
||||
|
|
Loading…
Reference in New Issue