51#define DEBUG_TYPE "legalizevectorops"
55class VectorLegalizer {
67 LegalizedNodes.
insert(std::make_pair(From, To));
70 LegalizedNodes.
insert(std::make_pair(To, To));
143 std::pair<SDValue, SDValue> ExpandLoad(
SDNode *
N);
158 bool tryExpandVecMathCall(
SDNode *
Node, RTLIB::Libcall LC,
160 bool tryExpandVecMathCall(
SDNode *
Node, RTLIB::Libcall Call_F32,
161 RTLIB::Libcall Call_F64, RTLIB::Libcall Call_F80,
162 RTLIB::Libcall Call_F128,
163 RTLIB::Libcall Call_PPCF128,
209bool VectorLegalizer::Run() {
211 bool HasVectors =
false;
216 HasVectors =
llvm::any_of(
I->values(), [](EVT
T) { return T.isVector(); });
240 assert(LegalizedNodes.count(OldRoot) &&
"Root didn't get legalized?");
241 DAG.
setRoot(LegalizedNodes[OldRoot]);
243 LegalizedNodes.clear();
251SDValue VectorLegalizer::TranslateLegalizeResults(
SDValue Op, SDNode *Result) {
253 "Unexpected number of results");
255 for (
unsigned i = 0, e =
Op->getNumValues(); i != e; ++i)
256 AddLegalizedOperand(
Op.getValue(i),
SDValue(Result, i));
261VectorLegalizer::RecursivelyLegalizeResults(
SDValue Op,
264 "Unexpected number of results");
266 for (
unsigned i = 0, e =
Results.
size(); i != e; ++i) {
268 AddLegalizedOperand(
Op.getValue(i),
Results[i]);
277 DenseMap<SDValue, SDValue>::iterator
I = LegalizedNodes.find(
Op);
278 if (
I != LegalizedNodes.end())
return I->second;
282 for (
const SDValue &Oper :
Op->op_values())
283 Ops.push_back(LegalizeOp(Oper));
287 bool HasVectorValueOrOp =
290 [](
SDValue O) { return O.getValueType().isVector(); });
291 if (!HasVectorValueOrOp)
292 return TranslateLegalizeResults(
Op, Node);
294 TargetLowering::LegalizeAction Action = TargetLowering::Legal;
296 switch (
Op.getOpcode()) {
298 return TranslateLegalizeResults(
Op, Node);
302 EVT LoadedVT =
LD->getMemoryVT();
309 EVT StVT =
ST->getMemoryVT();
310 MVT ValVT =
ST->getValue().getSimpleValueType();
311 if (StVT.
isVector() &&
ST->isTruncatingStore())
319 if (Action == TargetLowering::Legal)
320 Action = TargetLowering::Expand;
322#define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \
323 case ISD::STRICT_##DAGN:
324#include "llvm/IR/ConstrainedOps.def"
325 ValVT =
Node->getValueType(0);
328 ValVT =
Node->getOperand(1).getValueType();
331 MVT OpVT =
Node->getOperand(1).getSimpleValueType();
334 if (Action == TargetLowering::Legal)
346 TargetLowering::Legal) {
349 == TargetLowering::Expand &&
351 == TargetLowering::Legal)
352 Action = TargetLowering::Legal;
408 case ISD::FMINNUM_IEEE:
409 case ISD::FMAXNUM_IEEE:
412 case ISD::FMINIMUMNUM:
413 case ISD::FMAXIMUMNUM:
438 case ISD::FNEARBYINT:
440 case ISD::FROUNDEVEN:
491 unsigned Scale =
Node->getConstantOperandVal(2);
493 Node->getValueType(0), Scale);
502 case ISD::VECREDUCE_ADD:
503 case ISD::VECREDUCE_MUL:
504 case ISD::VECREDUCE_AND:
505 case ISD::VECREDUCE_OR:
506 case ISD::VECREDUCE_XOR:
507 case ISD::VECREDUCE_SMAX:
508 case ISD::VECREDUCE_SMIN:
509 case ISD::VECREDUCE_UMAX:
510 case ISD::VECREDUCE_UMIN:
511 case ISD::VECREDUCE_FADD:
512 case ISD::VECREDUCE_FMAX:
513 case ISD::VECREDUCE_FMAXIMUM:
514 case ISD::VECREDUCE_FMIN:
515 case ISD::VECREDUCE_FMINIMUM:
516 case ISD::VECREDUCE_FMUL:
517 case ISD::VECTOR_FIND_LAST_ACTIVE:
519 Node->getOperand(0).getValueType());
521 case ISD::VECREDUCE_SEQ_FADD:
522 case ISD::VECREDUCE_SEQ_FMUL:
524 Node->getOperand(1).getValueType());
527 MVT OpVT =
Node->getOperand(0).getSimpleValueType();
530 if (Action == TargetLowering::Legal)
534 case ISD::PARTIAL_REDUCE_UMLA:
535 case ISD::PARTIAL_REDUCE_SMLA:
536 case ISD::PARTIAL_REDUCE_SUMLA:
539 Node->getOperand(1).getValueType());
542#define BEGIN_REGISTER_VP_SDNODE(VPID, LEGALPOS, ...) \
544 EVT LegalizeVT = LEGALPOS < 0 ? Node->getValueType(-(1 + LEGALPOS)) \
545 : Node->getOperand(LEGALPOS).getValueType(); \
546 if (ISD::VPID == ISD::VP_SETCC) { \
547 ISD::CondCode CCCode = cast<CondCodeSDNode>(Node->getOperand(2))->get(); \
548 Action = TLI.getCondCodeAction(CCCode, LegalizeVT.getSimpleVT()); \
549 if (Action != TargetLowering::Legal) \
553 if (!Node->getValueType(0).isVector() && \
554 Node->getValueType(0) != MVT::Other) { \
555 Action = TargetLowering::Legal; \
558 Action = TLI.getOperationAction(Node->getOpcode(), LegalizeVT); \
560#include "llvm/IR/VPIntrinsics.def"
568 case TargetLowering::Promote:
569 assert((
Op.getOpcode() != ISD::LOAD &&
Op.getOpcode() != ISD::STORE) &&
570 "This action is not supported yet!");
572 Promote(Node, ResultVals);
573 assert(!ResultVals.
empty() &&
"No results for promotion?");
575 case TargetLowering::Legal:
578 case TargetLowering::Custom:
580 if (LowerOperationWrapper(Node, ResultVals))
584 case TargetLowering::Expand:
586 Expand(Node, ResultVals);
590 if (ResultVals.
empty())
591 return TranslateLegalizeResults(
Op, Node);
594 return RecursivelyLegalizeResults(
Op, ResultVals);
599bool VectorLegalizer::LowerOperationWrapper(SDNode *Node,
600 SmallVectorImpl<SDValue> &
Results) {
611 if (
Node->getNumValues() == 1) {
619 "Lowering returned the wrong number of results!");
622 for (
unsigned I = 0,
E =
Node->getNumValues();
I !=
E; ++
I)
628void VectorLegalizer::PromoteSETCC(SDNode *Node,
629 SmallVectorImpl<SDValue> &
Results) {
630 MVT VecVT =
Node->getOperand(0).getSimpleValueType();
642 if (
Node->getOpcode() == ISD::VP_SETCC) {
653void VectorLegalizer::PromoteSTRICT(SDNode *Node,
654 SmallVectorImpl<SDValue> &
Results) {
655 MVT VecVT =
Node->getOperand(1).getSimpleValueType();
664 for (
unsigned j = 1;
j !=
Node->getNumOperands(); ++
j)
665 if (
Node->getOperand(j).getValueType().isVector() &&
672 {
Node->getOperand(0),
Node->getOperand(j)});
678 SDVTList VTs = DAG.
getVTList(NewVecVT,
Node->getValueType(1));
694void VectorLegalizer::PromoteFloatVECREDUCE(SDNode *Node,
695 SmallVectorImpl<SDValue> &
Results,
696 bool NonArithmetic) {
697 MVT OpVT =
Node->getOperand(0).getSimpleValueType();
712void VectorLegalizer::Promote(SDNode *Node, SmallVectorImpl<SDValue> &
Results) {
715 switch (
Node->getOpcode()) {
721 PromoteINT_TO_FP(Node,
Results);
728 PromoteFP_TO_INT(Node,
Results);
743 case ISD::VECREDUCE_FADD:
744 PromoteFloatVECREDUCE(Node,
Results,
false);
746 case ISD::VECREDUCE_FMAX:
747 case ISD::VECREDUCE_FMAXIMUM:
748 case ISD::VECREDUCE_FMIN:
749 case ISD::VECREDUCE_FMINIMUM:
750 PromoteFloatVECREDUCE(Node,
Results,
true);
758 case ISD::VP_FCOPYSIGN:
770 "Can't promote a vector with multiple results!");
771 MVT VT =
Node->getSimpleValueType(0);
776 for (
unsigned j = 0;
j !=
Node->getNumOperands(); ++
j) {
780 if (
Node->getOperand(j).getValueType().isVector() && !SkipPromote)
781 if (
Node->getOperand(j)
783 .getVectorElementType()
784 .isFloatingPoint() &&
791 DAG.
getNode(ISD::VP_FP_EXTEND, dl, NVT,
Node->getOperand(j),
792 Node->getOperand(MaskIdx),
Node->getOperand(EVLIdx));
795 DAG.
getNode(ISD::FP_EXTEND, dl, NVT,
Node->getOperand(j));
812 Res = DAG.
getNode(ISD::VP_FP_ROUND, dl, VT, Res,
813 Node->getOperand(MaskIdx),
Node->getOperand(EVLIdx));
819 Res = DAG.
getNode(ISD::BITCAST, dl, VT, Res);
824void VectorLegalizer::PromoteINT_TO_FP(SDNode *Node,
825 SmallVectorImpl<SDValue> &
Results) {
828 bool IsStrict =
Node->isStrictFPOpcode();
829 MVT VT =
Node->getOperand(IsStrict ? 1 : 0).getSimpleValueType();
832 "Vectors have different number of elements!");
841 for (
unsigned j = 0;
j !=
Node->getNumOperands(); ++
j) {
842 if (
Node->getOperand(j).getValueType().isVector())
850 {Node->getValueType(0), MVT::Other},
Operands);
865void VectorLegalizer::PromoteFP_TO_INT(SDNode *Node,
866 SmallVectorImpl<SDValue> &
Results) {
867 MVT VT =
Node->getSimpleValueType(0);
869 bool IsStrict =
Node->isStrictFPOpcode();
871 "Vectors have different number of elements!");
873 unsigned NewOpc =
Node->getOpcode();
887 Promoted = DAG.
getNode(NewOpc, dl, {NVT, MVT::Other},
888 {
Node->getOperand(0),
Node->getOperand(1)});
891 Promoted = DAG.
getNode(NewOpc, dl, NVT,
Node->getOperand(0));
902 Promoted = DAG.
getNode(NewOpc, dl, NVT, Promoted,
910std::pair<SDValue, SDValue> VectorLegalizer::ExpandLoad(SDNode *
N) {
915SDValue VectorLegalizer::ExpandStore(SDNode *
N) {
921void VectorLegalizer::Expand(SDNode *Node, SmallVectorImpl<SDValue> &
Results) {
922 switch (
Node->getOpcode()) {
924 std::pair<SDValue, SDValue> Tmp = ExpandLoad(Node);
930 Results.push_back(ExpandStore(Node));
933 for (
unsigned i = 0, e =
Node->getNumValues(); i != e; ++i)
937 if (
SDValue Expanded = ExpandSEXTINREG(Node)) {
943 Results.push_back(ExpandANY_EXTEND_VECTOR_INREG(Node));
946 Results.push_back(ExpandSIGN_EXTEND_VECTOR_INREG(Node));
949 Results.push_back(ExpandZERO_EXTEND_VECTOR_INREG(Node));
952 if (
SDValue Expanded = ExpandBSWAP(Node)) {
961 if (
SDValue Expanded = ExpandVSELECT(Node)) {
967 if (
SDValue Expanded = ExpandVP_SELECT(Node)) {
974 if (
SDValue Expanded = ExpandVP_REM(Node)) {
980 if (
SDValue Expanded = ExpandVP_FNEG(Node)) {
986 if (
SDValue Expanded = ExpandVP_FABS(Node)) {
991 case ISD::VP_FCOPYSIGN:
992 if (
SDValue Expanded = ExpandVP_FCOPYSIGN(Node)) {
998 if (
SDValue Expanded = ExpandSELECT(Node)) {
1004 if (
Node->getValueType(0).isScalableVector()) {
1009 Node->getOperand(1),
Node->getOperand(4));
1011 Node->getOperand(2),
1012 Node->getOperand(3)));
1018 ExpandFP_TO_UINT(Node,
Results);
1021 ExpandUINT_TO_FLOAT(Node,
Results);
1024 if (
SDValue Expanded = ExpandFNEG(Node)) {
1030 if (
SDValue Expanded = ExpandFABS(Node)) {
1036 if (
SDValue Expanded = ExpandFCOPYSIGN(Node)) {
1071 if (
SDValue Expanded = ExpandBITREVERSE(Node)) {
1076 case ISD::VP_BITREVERSE:
1102 case ISD::VP_CTLZ_ZERO_UNDEF:
1116 case ISD::VP_CTTZ_ZERO_UNDEF:
1149 case ISD::FMINIMUMNUM:
1150 case ISD::FMAXIMUMNUM:
1164 ExpandUADDSUBO(Node,
Results);
1168 ExpandSADDSUBO(Node,
Results);
1193 if (
Node->getValueType(0).isScalableVector()) {
1216 ExpandFixedPointDiv(Node,
Results);
1221#define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \
1222 case ISD::STRICT_##DAGN:
1223#include "llvm/IR/ConstrainedOps.def"
1224 ExpandStrictFPOp(Node,
Results);
1226 case ISD::VECREDUCE_ADD:
1227 case ISD::VECREDUCE_MUL:
1228 case ISD::VECREDUCE_AND:
1229 case ISD::VECREDUCE_OR:
1230 case ISD::VECREDUCE_XOR:
1231 case ISD::VECREDUCE_SMAX:
1232 case ISD::VECREDUCE_SMIN:
1233 case ISD::VECREDUCE_UMAX:
1234 case ISD::VECREDUCE_UMIN:
1235 case ISD::VECREDUCE_FADD:
1236 case ISD::VECREDUCE_FMUL:
1237 case ISD::VECREDUCE_FMAX:
1238 case ISD::VECREDUCE_FMIN:
1239 case ISD::VECREDUCE_FMAXIMUM:
1240 case ISD::VECREDUCE_FMINIMUM:
1243 case ISD::PARTIAL_REDUCE_UMLA:
1244 case ISD::PARTIAL_REDUCE_SMLA:
1245 case ISD::PARTIAL_REDUCE_SUMLA:
1248 case ISD::VECREDUCE_SEQ_FADD:
1249 case ISD::VECREDUCE_SEQ_FMUL:
1257 if (
SDValue Expanded = ExpandVP_MERGE(Node)) {
1263 if (tryExpandVecMathCall(Node, RTLIB::REM_F32, RTLIB::REM_F64,
1264 RTLIB::REM_F80, RTLIB::REM_F128,
1270 case ISD::FSINCOSPI: {
1271 EVT VT =
Node->getValueType(0).getVectorElementType();
1272 RTLIB::Libcall LC =
Node->getOpcode() == ISD::FSINCOS
1290 case ISD::VECTOR_FIND_LAST_ACTIVE:
1299 Results.push_back(ExpandLOOP_DEPENDENCE_MASK(Node));
1308 case ISD::FNEARBYINT:
1311 case ISD::FROUNDEVEN:
1322 if (
Node->getNumValues() == 1) {
1326 "VectorLegalizer Expand returned wrong number of results!");
1332SDValue VectorLegalizer::ExpandSELECT(SDNode *Node) {
1336 EVT VT =
Node->getValueType(0);
1359 VT) == TargetLowering::Expand)
1377 Op1 = DAG.
getNode(ISD::BITCAST,
DL, MaskTy, Op1);
1378 Op2 = DAG.
getNode(ISD::BITCAST,
DL, MaskTy, Op2);
1385 return DAG.
getNode(ISD::BITCAST,
DL,
Node->getValueType(0), Val);
1388SDValue VectorLegalizer::ExpandSEXTINREG(SDNode *Node) {
1389 EVT VT =
Node->getValueType(0);
1409SDValue VectorLegalizer::ExpandANY_EXTEND_VECTOR_INREG(SDNode *Node) {
1411 EVT VT =
Node->getValueType(0);
1414 EVT SrcVT = Src.getValueType();
1421 "ANY_EXTEND_VECTOR_INREG vector size mismatch");
1429 SmallVector<int, 16> ShuffleMask;
1430 ShuffleMask.
resize(NumSrcElements, -1);
1433 int ExtLaneScale = NumSrcElements / NumElements;
1435 for (
int i = 0; i < NumElements; ++i)
1436 ShuffleMask[i * ExtLaneScale + EndianOffset] = i;
1439 ISD::BITCAST,
DL, VT,
1443SDValue VectorLegalizer::ExpandSIGN_EXTEND_VECTOR_INREG(SDNode *Node) {
1445 EVT VT =
Node->getValueType(0);
1447 EVT SrcVT = Src.getValueType();
1467SDValue VectorLegalizer::ExpandZERO_EXTEND_VECTOR_INREG(SDNode *Node) {
1469 EVT VT =
Node->getValueType(0);
1472 EVT SrcVT = Src.getValueType();
1479 "ZERO_EXTEND_VECTOR_INREG vector size mismatch");
1493 int ExtLaneScale = NumSrcElements / NumElements;
1495 for (
int i = 0; i < NumElements; ++i)
1496 ShuffleMask[i * ExtLaneScale + EndianOffset] = NumSrcElements + i;
1498 return DAG.
getNode(ISD::BITCAST,
DL, VT,
1505 for (
int J = ScalarSizeInBytes - 1; J >= 0; --J)
1506 ShuffleMask.push_back((
I * ScalarSizeInBytes) + J);
1509SDValue VectorLegalizer::ExpandBSWAP(SDNode *Node) {
1510 EVT VT =
Node->getValueType(0);
1517 SmallVector<int, 16> ShuffleMask;
1541SDValue VectorLegalizer::ExpandBITREVERSE(SDNode *Node) {
1542 EVT VT =
Node->getValueType(0);
1556 if (ScalarSizeInBits > 8 && (ScalarSizeInBits % 8) == 0) {
1557 SmallVector<int, 16> BSWAPMask;
1589SDValue VectorLegalizer::ExpandVSELECT(SDNode *Node) {
1598 EVT VT =
Mask.getValueType();
1614 if (BoolContents != TargetLowering::ZeroOrNegativeOneBooleanContent &&
1615 !(BoolContents == TargetLowering::ZeroOrOneBooleanContent &&
1628 Op1 = DAG.
getNode(ISD::BITCAST,
DL, VT, Op1);
1629 Op2 = DAG.
getNode(ISD::BITCAST,
DL, VT, Op2);
1636 return DAG.
getNode(ISD::BITCAST,
DL,
Node->getValueType(0), Val);
1639SDValue VectorLegalizer::ExpandVP_SELECT(SDNode *Node) {
1649 EVT VT =
Mask.getValueType();
1665 Op1 = DAG.
getNode(ISD::VP_AND,
DL, VT, Op1, Mask, Ones, EVL);
1666 Op2 = DAG.
getNode(ISD::VP_AND,
DL, VT, Op2, NotMask, Ones, EVL);
1667 return DAG.
getNode(ISD::VP_OR,
DL, VT, Op1, Op2, Ones, EVL);
1670SDValue VectorLegalizer::ExpandVP_MERGE(SDNode *Node) {
1682 EVT MaskVT =
Mask.getValueType();
1699 EVLVecVT) != MaskVT)
1705 DAG.
getSetCC(
DL, MaskVT, StepVec, SplatEVL, ISD::CondCode::SETULT);
1711SDValue VectorLegalizer::ExpandVP_REM(SDNode *Node) {
1713 EVT VT =
Node->getValueType(0);
1715 unsigned DivOpc =
Node->getOpcode() == ISD::VP_SREM ? ISD::VP_SDIV : ISD::VP_UDIV;
1732 return DAG.
getNode(ISD::VP_SUB,
DL, VT, Dividend,
Mul, Mask, EVL);
1735SDValue VectorLegalizer::ExpandVP_FNEG(SDNode *Node) {
1736 EVT VT =
Node->getValueType(0);
1753SDValue VectorLegalizer::ExpandVP_FABS(SDNode *Node) {
1754 EVT VT =
Node->getValueType(0);
1768 DAG.
getNode(ISD::VP_AND,
DL, IntVT, Cast, ClearSignMask, Mask, EVL);
1769 return DAG.
getNode(ISD::BITCAST,
DL, VT, ClearSign);
1772SDValue VectorLegalizer::ExpandVP_FCOPYSIGN(SDNode *Node) {
1773 EVT VT =
Node->getValueType(0);
1775 if (VT !=
Node->getOperand(1).getValueType())
1793 DAG.
getNode(ISD::VP_AND,
DL, IntVT, Sign, SignMask, Mask, EVL);
1798 DAG.
getNode(ISD::VP_AND,
DL, IntVT, Mag, ClearSignMask, Mask, EVL);
1800 SDValue CopiedSign = DAG.
getNode(ISD::VP_OR,
DL, IntVT, ClearedSign, SignBit,
1803 return DAG.
getNode(ISD::BITCAST,
DL, VT, CopiedSign);
1806SDValue VectorLegalizer::ExpandLOOP_DEPENDENCE_MASK(SDNode *
N) {
1808 SDValue SourceValue =
N->getOperand(0);
1809 SDValue SinkValue =
N->getOperand(1);
1810 SDValue EltSize =
N->getOperand(2);
1813 EVT VT =
N->getValueType(0);
1817 if (IsReadAfterWrite)
1835 DAG.
getSetCC(
DL, MaskVT, VectorStep, DiffSplat, ISD::CondCode::SETULT);
1850void VectorLegalizer::ExpandFP_TO_UINT(SDNode *Node,
1851 SmallVectorImpl<SDValue> &
Results) {
1856 if (
Node->isStrictFPOpcode())
1862 if (
Node->isStrictFPOpcode()) {
1863 UnrollStrictFPOp(Node,
Results);
1870void VectorLegalizer::ExpandUINT_TO_FLOAT(SDNode *Node,
1871 SmallVectorImpl<SDValue> &
Results) {
1872 bool IsStrict =
Node->isStrictFPOpcode();
1873 unsigned OpNo = IsStrict ? 1 : 0;
1875 EVT SrcVT = Src.getValueType();
1876 EVT DstVT =
Node->getValueType(0);
1891 TargetLowering::Expand) ||
1893 TargetLowering::Expand)) ||
1896 UnrollStrictFPOp(Node,
Results);
1905 assert((BW == 64 || BW == 32) &&
1906 "Elements in vector-UINT_TO_FP must be 32 or 64 bits wide");
1912 EVT FPVT = BW == 32 ? MVT::f32 : MVT::f64;
1919 {
Node->getOperand(0), Src});
1921 {
Node->getOperand(0), UIToFP, TargetZero});
1938 uint64_t HWMask = (BW == 64) ? 0x00000000FFFFFFFF : 0x0000FFFF;
1953 {
Node->getOperand(0),
HI});
1957 {
Node->getOperand(0),
LO});
1982SDValue VectorLegalizer::ExpandFNEG(SDNode *Node) {
1983 EVT VT =
Node->getValueType(0);
2002SDValue VectorLegalizer::ExpandFABS(SDNode *Node) {
2003 EVT VT =
Node->getValueType(0);
2019 return DAG.
getNode(ISD::BITCAST,
DL, VT, ClearedSign);
2022SDValue VectorLegalizer::ExpandFCOPYSIGN(SDNode *Node) {
2023 EVT VT =
Node->getValueType(0);
2026 if (VT !=
Node->getOperand(1).getValueType() ||
2051 return DAG.
getNode(ISD::BITCAST,
DL, VT, CopiedSign);
2054void VectorLegalizer::ExpandFSUB(SDNode *Node,
2055 SmallVectorImpl<SDValue> &
Results) {
2059 EVT VT =
Node->getValueType(0);
2073void VectorLegalizer::ExpandSETCC(SDNode *Node,
2074 SmallVectorImpl<SDValue> &
Results) {
2075 bool NeedInvert =
false;
2076 bool IsVP =
Node->getOpcode() == ISD::VP_SETCC;
2080 unsigned Offset = IsStrict ? 1 : 0;
2087 MVT OpVT =
LHS.getSimpleValueType();
2092 UnrollStrictFPOp(Node,
Results);
2095 Results.push_back(UnrollVSETCC(Node));
2108 EVL, NeedInvert, dl, Chain, IsSignaling);
2116 {Chain, LHS, RHS, CC},
Node->getFlags());
2117 Chain =
LHS.getValue(1);
2120 {LHS, RHS, CC, Mask, EVL},
Node->getFlags());
2136 assert(!IsStrict &&
"Don't know how to expand for strict nodes.");
2140 EVT VT =
Node->getValueType(0);
2144 CC,
Node->getFlags());
2152void VectorLegalizer::ExpandUADDSUBO(SDNode *Node,
2153 SmallVectorImpl<SDValue> &
Results) {
2160void VectorLegalizer::ExpandSADDSUBO(SDNode *Node,
2161 SmallVectorImpl<SDValue> &
Results) {
2168void VectorLegalizer::ExpandMULO(SDNode *Node,
2169 SmallVectorImpl<SDValue> &
Results) {
2171 if (!TLI.
expandMULO(Node, Result, Overflow, DAG))
2178void VectorLegalizer::ExpandFixedPointDiv(SDNode *Node,
2179 SmallVectorImpl<SDValue> &
Results) {
2182 N->getOperand(0),
N->getOperand(1),
N->getConstantOperandVal(2), DAG))
2186void VectorLegalizer::ExpandStrictFPOp(SDNode *Node,
2187 SmallVectorImpl<SDValue> &
Results) {
2189 ExpandUINT_TO_FLOAT(Node,
Results);
2193 ExpandFP_TO_UINT(Node,
Results);
2203 UnrollStrictFPOp(Node,
Results);
2206void VectorLegalizer::ExpandREM(SDNode *Node,
2207 SmallVectorImpl<SDValue> &
Results) {
2209 "Expected REM node");
2223bool VectorLegalizer::tryExpandVecMathCall(SDNode *Node, RTLIB::Libcall LC,
2224 SmallVectorImpl<SDValue> &
Results) {
2227 assert(!
Node->isStrictFPOpcode() &&
"Unexpected strict fp operation!");
2232 LLVM_DEBUG(
dbgs() <<
"Looking for vector variant of " << LCName <<
"\n");
2234 EVT VT =
Node->getValueType(0);
2239 const TargetLibraryInfo &TLibInfo = DAG.
getLibInfo();
2252 for (
unsigned i = 0; i <
Node->getNumOperands(); ++i) {
2253 assert(
Node->getOperand(i).getValueType() == VT &&
2254 "Expected matching vector types!");
2257 FunctionType *ScalarFTy = FunctionType::get(ScalarTy, ArgTys,
false);
2269 if (OptVFInfo->Shape.Parameters.size() !=
2276 TargetLowering::ArgListTy
Args;
2279 for (
auto &VFParam : OptVFInfo->Shape.Parameters) {
2280 if (VFParam.ParamKind == VFParamKind::GlobalPredicate) {
2288 if (VFParam.ParamKind != VFParamKind::Vector)
2291 Args.emplace_back(
Node->getOperand(OpNum++), Ty);
2297 TargetLowering::CallLoweringInfo CLI(DAG);
2300 .setLibCallee(CallingConv::C, Ty, Callee, std::move(Args));
2302 std::pair<SDValue, SDValue> CallResult = TLI.
LowerCallTo(CLI);
2303 Results.push_back(CallResult.first);
2308bool VectorLegalizer::tryExpandVecMathCall(
2309 SDNode *Node, RTLIB::Libcall Call_F32, RTLIB::Libcall Call_F64,
2310 RTLIB::Libcall Call_F80, RTLIB::Libcall Call_F128,
2311 RTLIB::Libcall Call_PPCF128, SmallVectorImpl<SDValue> &
Results) {
2313 Node->getValueType(0).getVectorElementType(), Call_F32, Call_F64,
2314 Call_F80, Call_F128, Call_PPCF128);
2316 if (LC == RTLIB::UNKNOWN_LIBCALL)
2319 return tryExpandVecMathCall(Node, LC,
Results);
2322void VectorLegalizer::UnrollStrictFPOp(SDNode *Node,
2323 SmallVectorImpl<SDValue> &
Results) {
2324 EVT VT =
Node->getValueType(0);
2327 unsigned NumOpers =
Node->getNumOperands();
2330 EVT TmpEltVT = EltVT;
2336 EVT ValueVTs[] = {TmpEltVT, MVT::Other};
2342 for (
unsigned i = 0; i < NumElems; ++i) {
2350 for (
unsigned j = 1;
j < NumOpers; ++
j) {
2367 ScalarResult = DAG.
getSelect(dl, EltVT, ScalarResult,
2382SDValue VectorLegalizer::UnrollVSETCC(SDNode *Node) {
2383 EVT VT =
Node->getValueType(0);
2389 EVT TmpEltVT =
LHS.getValueType().getVectorElementType();
2392 for (
unsigned i = 0; i < NumElems; ++i) {
2401 LHSElem, RHSElem, CC);
2410 return VectorLegalizer(*this).Run();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static void createBSWAPShuffleMask(EVT VT, SmallVectorImpl< int > &ShuffleMask)
mir Rename Register Operands
This file defines the SmallVector class.
This file describes how to lower LLVM code to machine code.
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
unsigned getVectorNumElements() const
bool isVector() const
Return true if this is a vector value type.
MVT getVectorElementType() const
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Represents one node in the SelectionDAG.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
LLVM_ABI bool LegalizeVectors()
This transforms the SelectionDAG into a SelectionDAG that only uses vector math operations supported ...
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
LLVM_ABI SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
LLVM_ABI SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
SDValue getInsertSubvector(const SDLoc &DL, SDValue Vec, SDValue SubVec, unsigned Idx)
Insert SubVec at the Idx element of Vec.
LLVM_ABI SDValue getStepVector(const SDLoc &DL, EVT ResVT, const APInt &StepVal)
Returns a vector of type ResVT whose elements contain the linear sequence <0, Step,...
LLVM_ABI SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
const TargetLowering & getTargetLoweringInfo() const
LLVM_ABI std::pair< SDValue, SDValue > UnrollVectorOverflowOp(SDNode *N, unsigned ResNE=0)
Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
allnodes_const_iterator allnodes_begin() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
allnodes_const_iterator allnodes_end() const
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS, SDNodeFlags Flags=SDNodeFlags())
Helper function to make it easier to build Select's if you just have operands and don't want to check...
const DataLayout & getDataLayout() const
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
LLVM_ABI void RemoveDeadNodes()
This method deletes all unreachable nodes in the SelectionDAG.
LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT)
LLVM_ABI SDValue getVPLogicalNOT(const SDLoc &DL, SDValue Val, SDValue Mask, SDValue EVL, EVT VT)
Create a vector-predicated logical NOT operation as (VP_XOR Val, BooleanOne, Mask,...
LLVM_ABI SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI SDValue getValueType(EVT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
LLVM_ABI unsigned AssignTopologicalOrder()
Topological-sort the AllNodes list and a assign a unique node id for each node in the DAG based on th...
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
const TargetLibraryInfo & getLibInfo() const
LLVM_ABI SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT)
Create a true or false constant of type VT using the target's BooleanContent for type OpVT.
LLVM_ABI SDValue getVectorIdxConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI bool expandMultipleResultFPLibCall(RTLIB::Libcall LC, SDNode *Node, SmallVectorImpl< SDValue > &Results, std::optional< unsigned > CallRetResNo={})
Expands a node with multiple results to an FP or vector libcall.
LLVMContext * getContext() const
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
LLVM_ABI SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
SDValue getSplat(EVT VT, const SDLoc &DL, SDValue Op)
Returns a node representing a splat of one value into all lanes of the provided vector type.
LLVM_ABI SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
LLVM_ABI SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a logical NOT operation as (XOR Val, BooleanOne).
ilist< SDNode >::iterator allnodes_iterator
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
const VecDesc * getVectorMappingInfo(StringRef F, const ElementCount &VF, bool Masked) const
virtual bool isShuffleMaskLegal(ArrayRef< int >, EVT) const
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations,...
LegalizeAction getCondCodeAction(ISD::CondCode CC, MVT VT) const
Return how the condition code should be treated: either it is legal, needs to be expanded to some oth...
LegalizeAction getFixedPointOperationAction(unsigned Op, EVT VT, unsigned Scale) const
Some fixed point operations may be natively supported by the target but only for specific scales.
bool isStrictFPEnabled() const
Return true if the target support strict float operation.
virtual EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const
Return the ValueType of the result of SETCC operations.
BooleanContent getBooleanContents(bool isVec, bool isFloat) const
For targets without i1 registers, this gives the nature of the high-bits of boolean values held in ty...
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
LegalizeAction getTruncStoreAction(EVT ValVT, EVT MemVT) const
Return how this store with truncation should be treated: either it is legal, needs to be promoted to ...
LegalizeAction getLoadExtAction(unsigned ExtType, EVT ValVT, EVT MemVT) const
Return how this load with extension should be treated: either it is legal, needs to be promoted to a ...
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
LegalizeAction getPartialReduceMLAAction(unsigned Opc, EVT AccVT, EVT InputVT) const
Return how a PARTIAL_REDUCE_U/SMLA node with Acc type AccVT and Input type InputVT should be treated.
LegalizeAction getStrictFPOperationAction(unsigned Op, EVT VT) const
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
LegalizeAction getOperationAction(unsigned Op, EVT VT) const
Return how this operation should be treated: either it is legal, needs to be promoted to a larger siz...
MVT getTypeToPromoteTo(unsigned Op, MVT VT) const
If the action for this operation is to promote, this method returns the ValueType to promote to.
bool isOperationLegalOrCustomOrPromote(unsigned Op, EVT VT, bool LegalOnly=false) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
SDValue expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US][ADD|SUB]SAT.
SDValue expandVPCTLZ(SDNode *N, SelectionDAG &DAG) const
Expand VP_CTLZ/VP_CTLZ_ZERO_UNDEF nodes.
bool expandMULO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]MULO.
SDValue scalarizeVectorStore(StoreSDNode *ST, SelectionDAG &DAG) const
SDValue expandVPBSWAP(SDNode *N, SelectionDAG &DAG) const
Expand VP_BSWAP nodes.
SDValue expandVecReduceSeq(SDNode *Node, SelectionDAG &DAG) const
Expand a VECREDUCE_SEQ_* into an explicit ordered calculation.
SDValue expandCTLZ(SDNode *N, SelectionDAG &DAG) const
Expand CTLZ/CTLZ_ZERO_UNDEF nodes.
SDValue expandBITREVERSE(SDNode *N, SelectionDAG &DAG) const
Expand BITREVERSE nodes.
SDValue expandCTTZ(SDNode *N, SelectionDAG &DAG) const
Expand CTTZ/CTTZ_ZERO_UNDEF nodes.
SDValue expandABD(SDNode *N, SelectionDAG &DAG) const
Expand ABDS/ABDU nodes.
SDValue expandShlSat(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]SHLSAT.
SDValue expandFP_TO_INT_SAT(SDNode *N, SelectionDAG &DAG) const
Expand FP_TO_[US]INT_SAT into FP_TO_[US]INT and selects or min/max.
void expandSADDSUBO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::S(ADD|SUB)O.
SDValue expandVPBITREVERSE(SDNode *N, SelectionDAG &DAG) const
Expand VP_BITREVERSE nodes.
SDValue expandABS(SDNode *N, SelectionDAG &DAG, bool IsNegative=false) const
Expand ABS nodes.
SDValue expandVecReduce(SDNode *Node, SelectionDAG &DAG) const
Expand a VECREDUCE_* into an explicit calculation.
bool expandFP_TO_UINT(SDNode *N, SDValue &Result, SDValue &Chain, SelectionDAG &DAG) const
Expand float to UINT conversion.
bool expandREM(SDNode *Node, SDValue &Result, SelectionDAG &DAG) const
Expand an SREM or UREM using SDIV/UDIV or SDIVREM/UDIVREM, if legal.
SDValue expandFMINIMUMNUM_FMAXIMUMNUM(SDNode *N, SelectionDAG &DAG) const
Expand fminimumnum/fmaximumnum into multiple comparison with selects.
SDValue expandCTPOP(SDNode *N, SelectionDAG &DAG) const
Expand CTPOP nodes.
SDValue expandVectorNaryOpBySplitting(SDNode *Node, SelectionDAG &DAG) const
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
SDValue expandBSWAP(SDNode *N, SelectionDAG &DAG) const
Expand BSWAP nodes.
SDValue expandFMINIMUM_FMAXIMUM(SDNode *N, SelectionDAG &DAG) const
Expand fminimum/fmaximum into multiple comparison with selects.
std::pair< SDValue, SDValue > scalarizeVectorLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Turn load of vector type into a load of the individual elements.
SDValue expandFunnelShift(SDNode *N, SelectionDAG &DAG) const
Expand funnel shift.
bool LegalizeSetCCCondCode(SelectionDAG &DAG, EVT VT, SDValue &LHS, SDValue &RHS, SDValue &CC, SDValue Mask, SDValue EVL, bool &NeedInvert, const SDLoc &dl, SDValue &Chain, bool IsSignaling=false) const
Legalize a SETCC or VP_SETCC with given LHS and RHS and condition code CC on the current target.
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const
This callback is invoked for operations that are unsupported by the target, which are registered to u...
SDValue expandVPCTPOP(SDNode *N, SelectionDAG &DAG) const
Expand VP_CTPOP nodes.
SDValue expandFixedPointDiv(unsigned Opcode, const SDLoc &dl, SDValue LHS, SDValue RHS, unsigned Scale, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]DIVFIX[SAT].
SDValue expandVPCTTZ(SDNode *N, SelectionDAG &DAG) const
Expand VP_CTTZ/VP_CTTZ_ZERO_UNDEF nodes.
SDValue expandVECTOR_COMPRESS(SDNode *Node, SelectionDAG &DAG) const
Expand a vector VECTOR_COMPRESS into a sequence of extract element, store temporarily,...
SDValue expandROT(SDNode *N, bool AllowVectorOps, SelectionDAG &DAG) const
Expand rotations.
SDValue expandFMINNUM_FMAXNUM(SDNode *N, SelectionDAG &DAG) const
Expand fminnum/fmaxnum into fminnum_ieee/fmaxnum_ieee with quieted inputs.
SDValue expandCMP(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]CMP.
SDValue expandFixedPointMul(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[U|S]MULFIX[SAT].
SDValue expandIntMINMAX(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US][MIN|MAX].
SDValue expandVectorFindLastActive(SDNode *N, SelectionDAG &DAG) const
Expand VECTOR_FIND_LAST_ACTIVE nodes.
SDValue expandPartialReduceMLA(SDNode *Node, SelectionDAG &DAG) const
Expands PARTIAL_REDUCE_S/UMLA nodes to a series of simpler operations, consisting of zext/sext,...
void expandUADDSUBO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::U(ADD|SUB)O.
bool expandUINT_TO_FP(SDNode *N, SDValue &Result, SDValue &Chain, SelectionDAG &DAG) const
Expand UINT(i64) to double(f64) conversion.
SDValue expandAVG(SDNode *N, SelectionDAG &DAG) const
Expand vector/scalar AVGCEILS/AVGCEILU/AVGFLOORS/AVGFLOORU nodes.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM_ABI std::string getVectorFunctionABIVariantString() const
Returns a vector function ABI variant string on the form: ZGV<isa><mask><vlen><vparams><scalarname>(<...
StringRef getVectorFnName() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
@ MERGE_VALUES
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
@ LOOP_DEPENDENCE_RAW_MASK
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
@ BSWAP
Byte Swap and Counting operators.
@ SMULFIX
RESULT = [US]MULFIX(LHS, RHS, SCALE) - Perform fixed point multiplication on 2 integers with the same...
@ ADD
Simple integer binary arithmetic operators.
@ SMULFIXSAT
Same as the corresponding unsaturated fixed point instructions, but the result is clamped between the...
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
@ FMA
FMA - Perform a * b + c with no intermediate rounding step.
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
@ FADD
Simple binary floating point operators.
@ ABS
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth.
@ SIGN_EXTEND_VECTOR_INREG
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
@ FPTRUNC_ROUND
FPTRUNC_ROUND - This corresponds to the fptrunc_round intrinsic.
@ SDIVFIX
RESULT = [US]DIVFIX(LHS, RHS, SCALE) - Perform fixed point division on 2 integers with the same width...
@ STRICT_FSQRT
Constrained versions of libm-equivalent floating point intrinsics.
@ SIGN_EXTEND
Conversion operators.
@ AVGCEILS
AVGCEILS/AVGCEILU - Rounding averaging add - Add two integers using an integer of type i[N+2],...
@ CTTZ_ZERO_UNDEF
Bit counting operators with an undefined result for zero inputs.
@ SSUBO
Same for subtraction.
@ STEP_VECTOR
STEP_VECTOR(IMM) - Returns a scalable vector whose lanes are comprised of a linear sequence of unsign...
@ FCANONICALIZE
Returns platform specific canonical encoding of a floating point number.
@ SSUBSAT
RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 integers with the same bit width ...
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
@ SPLAT_VECTOR
SPLAT_VECTOR(VAL) - Returns a vector with the scalar value VAL duplicated in all lanes.
@ SADDO
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
@ SHL
Shift and rotation operations.
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
@ SSHLSAT
RESULT = [US]SHLSAT(LHS, RHS) - Perform saturation left shift.
@ SMULO
Same for multiplication.
@ ANY_EXTEND_VECTOR_INREG
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
@ SIGN_EXTEND_INREG
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
@ SMIN
[US]{MIN/MAX} - Binary minimum or maximum of signed or unsigned integers.
@ SDIVFIXSAT
Same as the corresponding unsaturated fixed point instructions, but the result is clamped between the...
@ VSELECT
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
@ STRICT_SINT_TO_FP
STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to a floating point value.
@ STRICT_FP_ROUND
X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision ...
@ STRICT_FP_TO_SINT
STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ FP_TO_SINT
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ STRICT_FP_EXTEND
X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ SCMP
[US]CMP - 3-way comparison of signed or unsigned integers.
@ AVGFLOORS
AVGFLOORS/AVGFLOORU - Averaging add - Add two integers using an integer of type i[N+1],...
@ STRICT_FADD
Constrained versions of the binary floating point operators.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ FP_ROUND
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
@ VECTOR_COMPRESS
VECTOR_COMPRESS(Vec, Mask, Passthru) consecutively place vector elements based on mask e....
@ ZERO_EXTEND_VECTOR_INREG
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
@ FP_TO_SINT_SAT
FP_TO_[US]INT_SAT - Convert floating point value in operand 0 to a signed or unsigned scalar integer ...
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
@ AssertSext
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
@ FCOPYSIGN
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
@ SADDSAT
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
@ ABDS
ABDS/ABDU - Absolute difference - Return the absolute difference between two numbers interpreted as s...
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
@ LOOP_DEPENDENCE_WAR_MASK
Set rounding mode.
LLVM_ABI std::optional< unsigned > getVPMaskIdx(unsigned Opcode)
The operand position of the vector mask.
LLVM_ABI std::optional< unsigned > getVPExplicitVectorLengthIdx(unsigned Opcode)
The operand position of the explicit vector length parameter.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
LLVM_ABI bool isVPOpcode(unsigned Opcode)
Whether this is a vector-predicated Opcode.
LLVM_ABI Libcall getSINCOSPI(EVT RetVT)
getSINCOSPI - Return the SINCOSPI_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI Libcall getMODF(EVT RetVT)
getMODF - Return the MODF_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI Libcall getFPLibCall(EVT VT, Libcall Call_F32, Libcall Call_F64, Libcall Call_F80, Libcall Call_F128, Libcall Call_PPCF128)
GetFPLibCall - Helper to return the right libcall for the given floating point type,...
LLVM_ABI Libcall getSINCOS(EVT RetVT)
getSINCOS - Return the SINCOS_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI std::optional< VFInfo > tryDemangleForVFABI(StringRef MangledName, const FunctionType *FTy)
Function to construct a VFInfo out of a mangled names in the following format:
NodeAddr< NodeBase * > Node
This is an optimization pass for GlobalISel generic memory operations.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
SmallVector< ValueTypeFromRangeType< R >, Size > to_vector(R &&Range)
Given a range of type R, iterate the entire range and return a SmallVector with elements of the vecto...
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
@ Xor
Bitwise or logical XOR of integers.
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT.
ElementCount getVectorElementCount() const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
EVT changeElementType(EVT EltVT) const
Return a VT for a type whose attributes match ourselves with the exception of the element type that i...
uint64_t getScalarSizeInBits() const
bool isFixedLengthVector() const
bool isVector() const
Return true if this is a vector value type.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
LLVM_ABI Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
EVT changeVectorElementType(EVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.