Skip to content

Commit 94c4499

Browse files
committed
[X86] combinePredicateReduction - pull out SETCC handling for all_of(icmp_eq) reductions. NFC.
Minor cleanup before we can handle any_of(icmp_ne) with the same code.
1 parent e6d972d commit 94c4499

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44283,17 +44283,21 @@ static SDValue combinePredicateReduction(SDNode *Extract, SelectionDAG &DAG,
4428344283
Movmsk = DAG.getBitcast(MovmskVT, Match);
4428444284
} else {
4428544285
// For all_of(setcc(x,y,eq)) - use PMOVMSKB(PCMPEQB()).
44286-
if (BinOp == ISD::AND && Match.getOpcode() == ISD::SETCC &&
44287-
cast<CondCodeSDNode>(Match.getOperand(2))->get() ==
44288-
ISD::CondCode::SETEQ) {
44289-
EVT VecSVT = Match.getOperand(0).getValueType().getScalarType();
44290-
if (VecSVT != MVT::i8 && (VecSVT.getSizeInBits() % 8) == 0) {
44291-
NumElts *= VecSVT.getSizeInBits() / 8;
44292-
EVT CmpVT = EVT::getVectorVT(*DAG.getContext(), MVT::i8, NumElts);
44293-
MatchVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1, NumElts);
44294-
Match = DAG.getSetCC(
44295-
DL, MatchVT, DAG.getBitcast(CmpVT, Match.getOperand(0)),
44296-
DAG.getBitcast(CmpVT, Match.getOperand(1)), ISD::CondCode::SETEQ);
44286+
// TODO: any_of(setcc(x,y,ne)) - use PMOVMSKB(NOT(PCMPEQB())).
44287+
if (Match.getOpcode() == ISD::SETCC) {
44288+
ISD::CondCode CC = cast<CondCodeSDNode>(Match.getOperand(2))->get();
44289+
if (BinOp == ISD::AND && CC == ISD::CondCode::SETEQ) {
44290+
EVT VecVT = Match.getOperand(0).getValueType();
44291+
EVT VecSVT = VecVT.getScalarType();
44292+
if (VecSVT != MVT::i8 && (VecSVT.getSizeInBits() % 8) == 0) {
44293+
NumElts *= VecSVT.getSizeInBits() / 8;
44294+
EVT CmpVT = EVT::getVectorVT(*DAG.getContext(), MVT::i8, NumElts);
44295+
MatchVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1, NumElts);
44296+
Match = DAG.getSetCC(DL, MatchVT,
44297+
DAG.getBitcast(CmpVT, Match.getOperand(0)),
44298+
DAG.getBitcast(CmpVT, Match.getOperand(1)),
44299+
ISD::CondCode::SETEQ);
44300+
}
4429744301
}
4429844302
}
4429944303

0 commit comments

Comments
 (0)