Skip to content

Commit e0b33c9

Browse files
authored
Revert "[X86] Fold (add X, (srl Y, 7)) -> (sub X, (ashr Y, 7)) on vXi8 vectors" (#143303)
Reverts #143106 as this is causing infinite loops in #143238
1 parent 55c86c5 commit e0b33c9

File tree

4 files changed

+448
-421
lines changed

4 files changed

+448
-421
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58110,14 +58110,13 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
5811058110
}
5811158111
}
5811258112

58113+
// If vectors of i1 are legal, turn (add (zext (vXi1 X)), Y) into
58114+
// (sub Y, (sext (vXi1 X))).
58115+
// FIXME: We have the (sub Y, (zext (vXi1 X))) -> (add (sext (vXi1 X)), Y) in
58116+
// generic DAG combine without a legal type check, but adding this there
58117+
// caused regressions.
5811358118
if (VT.isVector()) {
5811458119
SDValue X, Y;
58115-
58116-
// If vectors of i1 are legal, turn (add (zext (vXi1 X)), Y) into
58117-
// (sub Y, (sext (vXi1 X))).
58118-
// FIXME: We have the (sub Y, (zext (vXi1 X))) -> (add (sext (vXi1 X)), Y)
58119-
// in generic DAG combine without a legal type check, but adding this there
58120-
// caused regressions.
5812158120
EVT BoolVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1,
5812258121
VT.getVectorElementCount());
5812358122
if (DAG.getTargetLoweringInfo().isTypeLegal(BoolVT) &&
@@ -58126,15 +58125,6 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
5812658125
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, X);
5812758126
return DAG.getNode(ISD::SUB, DL, VT, Y, SExt);
5812858127
}
58129-
58130-
// Fold (add X, (srl Y, 7)) -> (sub X, (ashr Y, 7)) to undo instcombine
58131-
// canonicalisation as we don't have good vXi8 shifts.
58132-
if (VT.getScalarType() == MVT::i8 &&
58133-
sd_match(N, m_Add(m_Value(X), m_Srl(m_Value(Y), m_SpecificInt(7))))) {
58134-
SDValue AShr = DAG.getNode(ISD::SRA, DL, VT, Y,
58135-
DAG.getShiftAmountConstant(7, VT, DL));
58136-
return DAG.getNode(ISD::SUB, DL, VT, X, AShr);
58137-
}
5813858128
}
5813958129

5814058130
// Peephole for 512-bit VPDPBSSD on non-VLX targets.

0 commit comments

Comments
 (0)