diff --git a/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/llvm/include/llvm/CodeGen/SelectionDAGISel.h --- a/llvm/include/llvm/CodeGen/SelectionDAGISel.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGISel.h @@ -128,6 +128,7 @@ OPC_CheckChild0Same, OPC_CheckChild1Same, OPC_CheckChild2Same, OPC_CheckChild3Same, OPC_CheckPatternPredicate, + OPC_CheckPatternPredicate2, OPC_CheckPredicate, OPC_CheckPredicateWithOperands, OPC_CheckOpcode, diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2639,8 +2639,11 @@ /// CheckPatternPredicate - Implements OP_CheckPatternPredicate. LLVM_ATTRIBUTE_ALWAYS_INLINE static bool CheckPatternPredicate(const unsigned char *MatcherTable, unsigned &MatcherIndex, - const SelectionDAGISel &SDISel) { - return SDISel.CheckPatternPredicate(MatcherTable[MatcherIndex++]); + const SelectionDAGISel &SDISel, bool TwoBytePredNo) { + unsigned PredNo = MatcherTable[MatcherIndex++]; + if (TwoBytePredNo) + PredNo |= MatcherTable[MatcherIndex++] << 8; + return SDISel.CheckPatternPredicate(PredNo); } /// CheckNodePredicate - Implements OP_CheckNodePredicate. @@ -2788,7 +2791,10 @@ Table[Index-1] - SelectionDAGISel::OPC_CheckChild0Same); return Index; case SelectionDAGISel::OPC_CheckPatternPredicate: - Result = !::CheckPatternPredicate(Table, Index, SDISel); + case SelectionDAGISel::OPC_CheckPatternPredicate2: + Result = !::CheckPatternPredicate( + Table, Index, SDISel, + Table[Index - 1] == SelectionDAGISel::OPC_CheckPatternPredicate2); return Index; case SelectionDAGISel::OPC_CheckPredicate: Result = !::CheckNodePredicate(Table, Index, SDISel, N.getNode()); @@ -3198,7 +3204,10 @@ continue; case OPC_CheckPatternPredicate: - if (!::CheckPatternPredicate(MatcherTable, MatcherIndex, *this)) break; + case OPC_CheckPatternPredicate2: + if (!::CheckPatternPredicate(MatcherTable, MatcherIndex, *this, + Opcode == OPC_CheckPatternPredicate2)) + break; continue; case OPC_CheckPredicate: if (!::CheckNodePredicate(MatcherTable, MatcherIndex, *this, diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp --- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -472,12 +472,16 @@ return 2; case Matcher::CheckPatternPredicate: { - StringRef Pred =cast(N)->getPredicate(); - OS << "OPC_CheckPatternPredicate, " << getPatternPredicate(Pred) << ','; + StringRef Pred = cast(N)->getPredicate(); + unsigned PredNo = getPatternPredicate(Pred); + if (PredNo > 255) + OS << "OPC_CheckPatternPredicate2, TARGET_VAL(" << PredNo << "),"; + else + OS << "OPC_CheckPatternPredicate, " << PredNo << ','; if (!OmitComments) OS << " // " << Pred; OS << '\n'; - return 2; + return 2 + (PredNo > 255); } case Matcher::CheckPredicate: { TreePredicateFn Pred = cast(N)->getPredicate();