52#define DEBUG_TYPE "legalizevectorops"
56class VectorLegalizer {
68 LegalizedNodes.
insert(std::make_pair(From, To));
71 LegalizedNodes.
insert(std::make_pair(To, To));
142 std::pair<SDValue, SDValue> ExpandLoad(
SDNode *
N);
207bool VectorLegalizer::Run() {
209 bool HasVectors =
false;
214 HasVectors =
llvm::any_of(
I->values(), [](EVT
T) { return T.isVector(); });
238 assert(LegalizedNodes.count(OldRoot) &&
"Root didn't get legalized?");
239 DAG.
setRoot(LegalizedNodes[OldRoot]);
241 LegalizedNodes.clear();
249SDValue VectorLegalizer::TranslateLegalizeResults(
SDValue Op, SDNode *Result) {
251 "Unexpected number of results");
253 for (
unsigned i = 0, e =
Op->getNumValues(); i != e; ++i)
254 AddLegalizedOperand(
Op.getValue(i),
SDValue(Result, i));
259VectorLegalizer::RecursivelyLegalizeResults(
SDValue Op,
262 "Unexpected number of results");
264 for (
unsigned i = 0, e =
Results.
size(); i != e; ++i) {
266 AddLegalizedOperand(
Op.getValue(i),
Results[i]);
275 auto I = LegalizedNodes.find(
Op);
276 if (
I != LegalizedNodes.end())
return I->second;
280 for (
const SDValue &Oper :
Op->op_values())
281 Ops.push_back(LegalizeOp(Oper));
285 bool HasVectorValueOrOp =
288 [](
SDValue O) { return O.getValueType().isVector(); });
289 if (!HasVectorValueOrOp)
290 return TranslateLegalizeResults(
Op, Node);
292 TargetLowering::LegalizeAction Action = TargetLowering::Legal;
294 switch (
Op.getOpcode()) {
296 return TranslateLegalizeResults(
Op, Node);
300 EVT LoadedVT =
LD->getMemoryVT();
303 LD->getAddressSpace(), ExtType,
false);
308 EVT StVT =
ST->getMemoryVT();
309 MVT ValVT =
ST->getValue().getSimpleValueType();
310 if (StVT.
isVector() &&
ST->isTruncatingStore())
312 ST->getAddressSpace());
319 EVT VecVT =
Node->getOperand(0).getValueType();
330 if (Action == TargetLowering::Legal)
331 Action = TargetLowering::Expand;
333#define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \
334 case ISD::STRICT_##DAGN:
335#include "llvm/IR/ConstrainedOps.def"
336 ValVT =
Node->getValueType(0);
339 ValVT =
Node->getOperand(1).getValueType();
342 MVT OpVT =
Node->getOperand(1).getSimpleValueType();
345 if (Action == TargetLowering::Legal)
357 TargetLowering::Legal) {
360 == TargetLowering::Expand &&
362 == TargetLowering::Legal)
363 Action = TargetLowering::Legal;
513 EVT VT =
Node->getValueType(0);
514 unsigned Factor =
Node->getNumOperands();
517 if (Action == TargetLowering::Custom &&
519 Action = TargetLowering::Legal;
531 unsigned Scale =
Node->getConstantOperandVal(2);
533 Node->getValueType(0), Scale);
563 Node->getOperand(0).getValueType());
568 Node->getOperand(1).getValueType());
571 MVT OpVT =
Node->getOperand(0).getSimpleValueType();
574 if (Action == TargetLowering::Legal)
584 Node->getOperand(1).getValueType());
587#define BEGIN_REGISTER_VP_SDNODE(VPID, LEGALPOS, ...) \
589 EVT LegalizeVT = LEGALPOS < 0 ? Node->getValueType(-(1 + LEGALPOS)) \
590 : Node->getOperand(LEGALPOS).getValueType(); \
592 if (!Node->getValueType(0).isVector() && \
593 Node->getValueType(0) != MVT::Other) { \
594 Action = TargetLowering::Legal; \
597 Action = TLI.getOperationAction(Node->getOpcode(), LegalizeVT); \
599#include "llvm/IR/VPIntrinsics.def"
607 case TargetLowering::Promote:
609 "This action is not supported yet!");
611 Promote(Node, ResultVals);
612 assert(!ResultVals.
empty() &&
"No results for promotion?");
614 case TargetLowering::Legal:
617 case TargetLowering::Custom:
619 if (LowerOperationWrapper(Node, ResultVals))
623 case TargetLowering::Expand:
625 Expand(Node, ResultVals);
629 if (ResultVals.
empty())
630 return TranslateLegalizeResults(
Op, Node);
633 return RecursivelyLegalizeResults(
Op, ResultVals);
638bool VectorLegalizer::LowerOperationWrapper(SDNode *Node,
639 SmallVectorImpl<SDValue> &
Results) {
650 if (
Node->getNumValues() == 1) {
658 "Lowering returned the wrong number of results!");
661 for (
unsigned I = 0,
E =
Node->getNumValues();
I !=
E; ++
I)
667void VectorLegalizer::PromoteSETCC(SDNode *Node,
668 SmallVectorImpl<SDValue> &
Results) {
669 MVT VecVT =
Node->getOperand(0).getSimpleValueType();
685 if (ResVT !=
Node->getValueType(0))
690void VectorLegalizer::PromoteSTRICT(SDNode *Node,
691 SmallVectorImpl<SDValue> &
Results) {
692 MVT VecVT =
Node->getOperand(1).getSimpleValueType();
701 for (
unsigned j = 1;
j !=
Node->getNumOperands(); ++
j)
702 if (
Node->getOperand(j).getValueType().isVector() &&
709 {
Node->getOperand(0),
Node->getOperand(j)});
715 SDVTList VTs = DAG.
getVTList(NewVecVT,
Node->getValueType(1));
731void VectorLegalizer::PromoteFloatVECREDUCE(SDNode *Node,
732 SmallVectorImpl<SDValue> &
Results,
733 bool NonArithmetic) {
734 MVT OpVT =
Node->getOperand(0).getSimpleValueType();
749void VectorLegalizer::PromoteVECTOR_COMPRESS(
750 SDNode *Node, SmallVectorImpl<SDValue> &
Results) {
752 EVT VT =
Node->getValueType(0);
755 "Only integer promotion or bitcasts between types is supported");
766 Passthru = DAG.
getBitcast(PromotedVT, Passthru);
776void VectorLegalizer::Promote(SDNode *Node, SmallVectorImpl<SDValue> &
Results) {
779 switch (
Node->getOpcode()) {
785 PromoteINT_TO_FP(Node,
Results);
792 PromoteFP_TO_INT(Node,
Results);
819 PromoteFloatVECREDUCE(Node,
Results,
false);
827 PromoteFloatVECREDUCE(Node,
Results,
true);
830 PromoteVECTOR_COMPRESS(Node,
Results);
846 "Can't promote a vector with multiple results!");
847 MVT VT =
Node->getSimpleValueType(0);
852 for (
unsigned j = 0;
j !=
Node->getNumOperands(); ++
j) {
856 if (
Node->getOperand(j).getValueType().isVector() && !SkipPromote)
857 if (
Node->getOperand(j)
859 .getVectorElementType()
860 .isFloatingPoint() &&
883void VectorLegalizer::PromoteINT_TO_FP(SDNode *Node,
884 SmallVectorImpl<SDValue> &
Results) {
887 bool IsStrict =
Node->isStrictFPOpcode();
888 MVT VT =
Node->getOperand(IsStrict ? 1 : 0).getSimpleValueType();
891 "Vectors have different number of elements!");
900 for (
unsigned j = 0;
j !=
Node->getNumOperands(); ++
j) {
901 if (
Node->getOperand(j).getValueType().isVector())
909 {Node->getValueType(0), MVT::Other},
Operands);
924void VectorLegalizer::PromoteFP_TO_INT(SDNode *Node,
925 SmallVectorImpl<SDValue> &
Results) {
926 MVT VT =
Node->getSimpleValueType(0);
928 bool IsStrict =
Node->isStrictFPOpcode();
930 "Vectors have different number of elements!");
932 unsigned NewOpc =
Node->getOpcode();
946 Promoted = DAG.
getNode(NewOpc, dl, {NVT, MVT::Other},
947 {
Node->getOperand(0),
Node->getOperand(1)});
950 Promoted = DAG.
getNode(NewOpc, dl, NVT,
Node->getOperand(0));
961 Promoted = DAG.
getNode(NewOpc, dl, NVT, Promoted,
969std::pair<SDValue, SDValue> VectorLegalizer::ExpandLoad(SDNode *
N) {
974SDValue VectorLegalizer::ExpandSubByteInsertExtractVectorElt(SDNode *Node) {
985 Node->getOperand(1));
991 Node->getOperand(2));
995SDValue VectorLegalizer::ExpandStore(SDNode *
N) {
1001void VectorLegalizer::Expand(SDNode *Node, SmallVectorImpl<SDValue> &
Results) {
1002 switch (
Node->getOpcode()) {
1004 std::pair<SDValue, SDValue> Tmp = ExpandLoad(Node);
1006 Results.push_back(Tmp.second);
1010 Results.push_back(ExpandStore(Node));
1013 for (
unsigned i = 0, e =
Node->getNumValues(); i != e; ++i)
1018 Results.push_back(ExpandSubByteInsertExtractVectorElt(Node));
1027 if (
SDValue Expanded = ExpandSEXTINREG(Node)) {
1033 Results.push_back(ExpandANY_EXTEND_VECTOR_INREG(Node));
1036 Results.push_back(ExpandSIGN_EXTEND_VECTOR_INREG(Node));
1039 Results.push_back(ExpandZERO_EXTEND_VECTOR_INREG(Node));
1042 if (
SDValue Expanded = ExpandBSWAP(Node)) {
1048 if (
SDValue Expanded = ExpandVSELECT(Node)) {
1055 if (
SDValue Expanded = ExpandVP_REM(Node)) {
1061 if (
SDValue Expanded = ExpandSELECT(Node)) {
1067 if (
Node->getValueType(0).isScalableVector()) {
1072 Node->getOperand(1),
Node->getOperand(4));
1074 Node->getOperand(2),
1075 Node->getOperand(3)));
1081 ExpandFP_TO_UINT(Node,
Results);
1084 ExpandUINT_TO_FLOAT(Node,
Results);
1087 if (
SDValue Expanded = ExpandFNEG(Node)) {
1093 if (
SDValue Expanded = ExpandFABS(Node)) {
1099 if (
SDValue Expanded = ExpandFCOPYSIGN(Node)) {
1108 EVT VT =
Node->getValueType(0);
1112 TargetLowering::Expand)
1149 if (
SDValue Expanded = ExpandBITREVERSE(Node)) {
1228 ExpandUADDSUBO(Node,
Results);
1232 ExpandSADDSUBO(Node,
Results);
1264 if (
Node->getValueType(0).isScalableVector()) {
1282 ExpandFixedPointDiv(Node,
Results);
1287#define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \
1288 case ISD::STRICT_##DAGN:
1289#include "llvm/IR/ConstrainedOps.def"
1290 ExpandStrictFPOp(Node,
Results);
1329 if (
SDValue Expanded = ExpandVP_MERGE(Node)) {
1335 if (tryExpandVecMathCall(Node, RTLIB::getREM,
Results))
1340 EVT VT =
Node->getValueType(0);
1342 ? RTLIB::getSINCOS(VT)
1343 : RTLIB::getSINCOSPI(VT);
1344 if (LC != RTLIB::UNKNOWN_LIBCALL &&
1353 if (tryExpandVecMathCall(Node, RTLIB::getPOW,
Results))
1360 if (tryExpandVecMathCall(Node, RTLIB::getCBRT,
Results))
1367 EVT VT =
Node->getValueType(0);
1368 RTLIB::Libcall LC = RTLIB::getMODF(VT);
1369 if (LC != RTLIB::UNKNOWN_LIBCALL &&
1398 Results.push_back(ExpandLOOP_DEPENDENCE_MASK(Node));
1401 Results.push_back(ExpandMASK_BEFOREFIRST(Node));
1437 Results.push_back(ExpandMaskedBinOp(Node));
1442 if (
Node->getNumValues() == 1) {
1446 "VectorLegalizer Expand returned wrong number of results!");
1452SDValue VectorLegalizer::ExpandSELECT(SDNode *Node) {
1456 EVT VT =
Node->getValueType(0);
1479 VT) == TargetLowering::Expand)
1508SDValue VectorLegalizer::ExpandSEXTINREG(SDNode *Node) {
1509 EVT VT =
Node->getValueType(0);
1529SDValue VectorLegalizer::ExpandANY_EXTEND_VECTOR_INREG(SDNode *Node) {
1531 EVT VT =
Node->getValueType(0);
1534 EVT SrcVT = Src.getValueType();
1541 "ANY_EXTEND_VECTOR_INREG vector size mismatch");
1549 SmallVector<int, 16> ShuffleMask;
1550 ShuffleMask.
resize(NumSrcElements, -1);
1553 int ExtLaneScale = NumSrcElements / NumElements;
1555 for (
int i = 0; i < NumElements; ++i)
1556 ShuffleMask[i * ExtLaneScale + EndianOffset] = i;
1563SDValue VectorLegalizer::ExpandSIGN_EXTEND_VECTOR_INREG(SDNode *Node) {
1565 EVT VT =
Node->getValueType(0);
1567 EVT SrcVT = Src.getValueType();
1584SDValue VectorLegalizer::ExpandZERO_EXTEND_VECTOR_INREG(SDNode *Node) {
1586 EVT VT =
Node->getValueType(0);
1589 EVT SrcVT = Src.getValueType();
1596 "ZERO_EXTEND_VECTOR_INREG vector size mismatch");
1610 int ExtLaneScale = NumSrcElements / NumElements;
1612 for (
int i = 0; i < NumElements; ++i)
1613 ShuffleMask[i * ExtLaneScale + EndianOffset] = NumSrcElements + i;
1622 for (
int J = ScalarSizeInBytes - 1; J >= 0; --J)
1623 ShuffleMask.push_back((
I * ScalarSizeInBytes) + J);
1626SDValue VectorLegalizer::ExpandBSWAP(SDNode *Node) {
1627 EVT VT =
Node->getValueType(0);
1634 SmallVector<int, 16> ShuffleMask;
1659SDValue VectorLegalizer::ExpandBITREVERSE(SDNode *Node) {
1660 EVT VT =
Node->getValueType(0);
1674 if (ScalarSizeInBits > 8 && (ScalarSizeInBits % 8) == 0) {
1675 SmallVector<int, 16> BSWAPMask;
1707SDValue VectorLegalizer::ExpandVSELECT(SDNode *Node) {
1716 EVT VT =
Mask.getValueType();
1732 if (BoolContents != TargetLowering::ZeroOrNegativeOneBooleanContent &&
1733 !(BoolContents == TargetLowering::ZeroOrOneBooleanContent &&
1757SDValue VectorLegalizer::ExpandVP_MERGE(SDNode *Node) {
1769 EVT MaskVT =
Mask.getValueType();
1786 EVLVecVT) != MaskVT)
1792 DAG.
getSetCC(
DL, MaskVT, StepVec, SplatEVL, ISD::CondCode::SETULT);
1799SDValue VectorLegalizer::ExpandVP_REM(SDNode *Node) {
1801 EVT VT =
Node->getValueType(0);
1803 unsigned DivOpc =
Node->getOpcode() == ISD::VP_SREM ? ISD::VP_SDIV : ISD::VP_UDIV;
1823SDValue VectorLegalizer::ExpandLOOP_DEPENDENCE_MASK(SDNode *
N) {
1827SDValue VectorLegalizer::ExpandMASK_BEFOREFIRST(SDNode *
N) {
1830 EVT VT =
N->getValueType(0);
1838SDValue VectorLegalizer::ExpandMaskedBinOp(SDNode *
N) {
1843 EVT VT =
N->getValueType(0);
1845 dl, VT,
N->getOperand(2),
N->getOperand(1), DAG.
getConstant(1, dl, VT));
1847 N->getOperand(0), SafeDivisor);
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);
2002 if ((NumElts == 1 &&
2018SDValue VectorLegalizer::ExpandFABS(SDNode *Node) {
2019 EVT VT =
Node->getValueType(0);
2038 if ((NumElts == 1 &&
2054SDValue VectorLegalizer::ExpandFCOPYSIGN(SDNode *Node) {
2055 EVT VT =
Node->getValueType(0);
2058 if (VT !=
Node->getOperand(1).getValueType() ||
2076 if ((NumElts == 1 &&
2102void VectorLegalizer::ExpandFSUB(SDNode *Node,
2103 SmallVectorImpl<SDValue> &
Results) {
2107 EVT VT =
Node->getValueType(0);
2121void VectorLegalizer::ExpandSETCC(SDNode *Node,
2122 SmallVectorImpl<SDValue> &
Results) {
2123 bool NeedInvert =
false;
2127 unsigned Offset = IsStrict ? 1 : 0;
2134 MVT OpVT =
LHS.getSimpleValueType();
2139 UnrollStrictFPOp(Node,
Results);
2142 Results.push_back(UnrollVSETCC(Node));
2149 NeedInvert, dl, Chain, IsSignaling);
2157 {Chain, LHS, RHS, CC},
Node->getFlags());
2158 Chain =
LHS.getValue(1);
2170 assert(!IsStrict &&
"Don't know how to expand for strict nodes.");
2174 EVT VT =
Node->getValueType(0);
2186void VectorLegalizer::ExpandUADDSUBO(SDNode *Node,
2187 SmallVectorImpl<SDValue> &
Results) {
2194void VectorLegalizer::ExpandSADDSUBO(SDNode *Node,
2195 SmallVectorImpl<SDValue> &
Results) {
2202void VectorLegalizer::ExpandMULO(SDNode *Node,
2203 SmallVectorImpl<SDValue> &
Results) {
2212void VectorLegalizer::ExpandFixedPointDiv(SDNode *Node,
2213 SmallVectorImpl<SDValue> &
Results) {
2216 N->getOperand(0),
N->getOperand(1),
N->getConstantOperandVal(2), DAG))
2220void VectorLegalizer::ExpandStrictFPOp(SDNode *Node,
2221 SmallVectorImpl<SDValue> &
Results) {
2222 switch (
Node->getOpcode()) {
2226 ExpandUINT_TO_FLOAT(Node,
Results);
2229 ExpandFP_TO_UINT(Node,
Results);
2249 Results.push_back(Expanded.getValue(0));
2250 Results.push_back(Expanded.getValue(1));
2257 UnrollStrictFPOp(Node,
Results);
2260void VectorLegalizer::ExpandREM(SDNode *Node,
2261 SmallVectorImpl<SDValue> &
Results) {
2263 "Expected REM node");
2277bool VectorLegalizer::tryExpandVecMathCall(
2278 SDNode *Node, function_ref<RTLIB::Libcall(EVT)> GetLibcall,
2279 SmallVectorImpl<SDValue> &
Results) {
2282 assert(!
Node->isStrictFPOpcode() &&
"Unexpected strict fp operation!");
2284 EVT VT =
Node->getValueType(0);
2286 const LibcallLoweringInfo &Libcalls = DAG.
getLibcalls();
2290 RTLIB::LibcallImpl LCImpl =
2294 while (LCImpl == RTLIB::Unsupported) {
2308 TargetLowering::ArgListTy
Args;
2313 assert(FuncTy->getNumParams() ==
Node->getNumOperands() + HasMaskArg &&
2314 EVT::getEVT(FuncTy->getReturnType(),
true) == CallVT &&
2315 "mismatch in value type and call signature type");
2317 for (
unsigned I = 0,
E = FuncTy->getNumParams();
I !=
E; ++
I) {
2318 Type *ParamTy = FuncTy->getParamType(
I);
2320 if (HasMaskArg &&
I ==
E - 1) {
2324 "unexpected vector mask type");
2333 Args.emplace_back(Mask, ParamTy);
2336 assert(
Op.getValueType() == VT &&
"mismatch in vector types");
2338 unsigned NumConcat =
2344 "mismatch in value type and call argument type");
2345 Args.emplace_back(
Op, ParamTy);
2354 TargetLowering::CallLoweringInfo CLI(DAG);
2357 .setLibCallee(
CC, FuncTy->getReturnType(), Callee, std::move(Args));
2367void VectorLegalizer::UnrollStrictFPOp(SDNode *Node,
2368 SmallVectorImpl<SDValue> &
Results) {
2369 EVT VT =
Node->getValueType(0);
2378 unsigned NumOpers =
Node->getNumOperands();
2381 EVT TmpEltVT = EltVT;
2387 EVT ValueVTs[] = {TmpEltVT, MVT::Other};
2393 for (
unsigned i = 0; i < NumElems; ++i) {
2401 for (
unsigned j = 1;
j < NumOpers; ++
j) {
2418 ScalarResult = DAG.
getSelect(dl, EltVT, ScalarResult,
2433SDValue VectorLegalizer::UnrollVSETCC(SDNode *Node) {
2434 EVT VT =
Node->getValueType(0);
2440 EVT TmpEltVT =
LHS.getValueType().getVectorElementType();
2443 for (
unsigned i = 0; i < NumElems; ++i) {
2452 LHSElem, RHSElem,
CC);
2461 return VectorLegalizer(*this).Run();
const TargetLowering & TLI
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)
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)
constexpr bool isScalar() const
Exactly one element.
const RTLIB::RuntimeLibcallsInfo & getRuntimeLibcallsInfo() const
RTLIB::LibcallImpl getVectorLibcallImplOrMasked(RTLIB::Libcall Call) const
Return the implementation for Call, or for its masked variant if Call has no implementation.
const Triple & getTargetTriple() const
unsigned getVectorNumElements() const
bool isVector() const
Return true if this is a vector value type.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
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.
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Represents one node in the SelectionDAG.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
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.
const TargetSubtargetInfo & getSubtarget() const
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 ...
LLVM_ABI SDValue getFreeze(SDValue V)
Return a freeze using the SDLoc of the value operand.
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 getExtractSubvector(const SDLoc &DL, EVT VT, SDValue Vec, unsigned Idx)
Return the VT typed sub-vector of Vec at Idx.
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,...
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false, SDNodeFlags Flags={})
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
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
LLVM_ABI SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type.
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 getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT)
Convert Op, which must be of integer type, to the integer type VT, by using an extension appropriate ...
LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT)
LLVM_ABI SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
const LibcallLoweringInfo & getLibcalls() const
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...
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)
SDValue getPOISON(EVT VT)
Return a POISON node. POISON does not have a useful SDLoc.
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)
virtual bool isShuffleMaskLegal(ArrayRef< int >, EVT) const
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations,...
SDValue promoteTargetBoolean(SelectionDAG &DAG, SDValue Bool, EVT ValVT) const
Promote the given target boolean to a target boolean of the given type.
MVT getVectorIdxTy(const DataLayout &DL) const
Returns the type to be used for the index operand of: ISD::INSERT_VECTOR_ELT, ISD::EXTRACT_VECTOR_ELT...
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 getTruncStoreAction(EVT ValVT, EVT MemVT, Align Alignment, unsigned AddrSpace) const
Return how this store with truncation should be treated: either it is legal, needs to be promoted to ...
virtual bool isExtractVecEltCheap(EVT VT, unsigned Index) const
Return true if extraction of a scalar element from the given vector type at the given index is cheap.
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...
LegalizeAction getVectorInterleaveAction(unsigned Opc, unsigned Factor, EVT VT) const
Return how a VECTOR_INTERLEAVE or VECTOR_DEINTERLEAVE node with the given interleave factor and VT sh...
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
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...
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
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 getLoadAction(EVT ValVT, EVT MemVT, Align Alignment, unsigned AddrSpace, unsigned ExtType, bool Atomic) const
Return how this load with extension should be treated: either it is legal, needs to be promoted to a ...
LegalizeAction getStrictFPOperationAction(unsigned Op, EVT VT) const
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.
void expandVectorDeinterleave(SDNode *Node, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const
Expand a VECTOR_DEINTERLEAVE without introducing wider vector types.
bool expandMultipleResultFPLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, SDNode *Node, SmallVectorImpl< SDValue > &Results, std::optional< unsigned > CallRetResNo={}) const
Expands a node with multiple results to an FP or vector libcall.
bool expandMULO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]MULO.
bool LegalizeSetCCCondCode(SelectionDAG &DAG, EVT VT, SDValue &LHS, SDValue &RHS, SDValue &CC, bool &NeedInvert, const SDLoc &dl, SDValue &Chain, bool IsSignaling=false) const
Legalize a SETCC with given LHS and RHS and condition code CC on the current target.
SDValue scalarizeVectorStore(StoreSDNode *ST, SelectionDAG &DAG) const
SDValue expandVecReduceSeq(SDNode *Node, SelectionDAG &DAG) const
Expand a VECREDUCE_SEQ_* into an explicit ordered calculation.
SDValue expandFCANONICALIZE(SDNode *Node, SelectionDAG &DAG) const
Expand FCANONICALIZE to FMUL with 1.
SDValue expandCTLZ(SDNode *N, SelectionDAG &DAG) const
Expand CTLZ/CTLZ_ZERO_POISON nodes.
SDValue expandBITREVERSE(SDNode *N, SelectionDAG &DAG) const
Expand BITREVERSE nodes.
SDValue expandCTTZ(SDNode *N, SelectionDAG &DAG) const
Expand CTTZ/CTTZ_ZERO_POISON nodes.
SDValue expandABD(SDNode *N, SelectionDAG &DAG) const
Expand ABDS/ABDU nodes.
SDValue expandGetActiveLaneMask(SDNode *N, SelectionDAG &DAG) const
Expand GET_ACTIVE_LANE_MASK nodes.
SDValue expandCLMUL(SDNode *N, SelectionDAG &DAG) const
Expand carryless multiply.
SDValue expandShlSat(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]SHLSAT.
SDValue expandVECTOR_SHUFFLE_VAR(SDNode *Node, SelectionDAG &DAG) const
Expand a VECTOR_SHUFFLE_VAR into variable-index element extracts.
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.
SDValue expandCttzElts(SDNode *Node, SelectionDAG &DAG) const
Expand a CTTZ_ELTS or CTTZ_ELTS_ZERO_POISON by calculating (VL - i) for each active lane (i),...
void expandSADDSUBO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::S(ADD|SUB)O.
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.
SDValue expandMULH(SDNode *Node, SelectionDAG &DAG) const
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.
void expandVectorInterleave(SDNode *Node, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const
Expand a VECTOR_INTERLEAVE without introducing wider vector types.
SDValue expandLoopDependenceMask(SDNode *N, SelectionDAG &DAG) const
Expand LOOP_DEPENDENCE_MASK nodes.
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 expandVectorMatch(SDNode *N, SelectionDAG &DAG) const
Expand VECTOR_MATCH nodes.
SDValue expandCONVERT_TO_ARBITRARY_FP(SDNode *Node, SelectionDAG &DAG) const
Expand CONVERT_TO_ARBITRARY_FP using bit manipulation.
SDValue expandFunnelShift(SDNode *N, SelectionDAG &DAG) const
Expand funnel shift.
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 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 expandPEXT(SDNode *N, SelectionDAG &DAG) const
Expand parallel bit extract (compress).
SDValue expandVECTOR_COMPRESS(SDNode *Node, SelectionDAG &DAG) const
Expand a vector VECTOR_COMPRESS into a sequence of extract element, store temporarily,...
SDValue expandCONVERT_FROM_ARBITRARY_FP(SDNode *Node, SelectionDAG &DAG) const
Expand CONVERT_FROM_ARBITRARY_FP using bit manipulation.
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.
SDValue expandPDEP(SDNode *N, SelectionDAG &DAG) const
Expand parallel bit deposit (expand).
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.
An efficient, type-erasing, non-owning reference to a callable.
#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.
@ PARTIAL_REDUCE_SMLA
PARTIAL_REDUCE_[U|S]MLA(Accumulator, Input1, Input2) The partial reduction nodes sign or zero extend ...
@ LOOP_DEPENDENCE_RAW_MASK
@ MASK_BEFOREFIRST
Has one mask vector operand.
@ VECREDUCE_SEQ_FADD
Generic reduction nodes.
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
@ AVGSUBFLOORS
AVGSUBFLOORS/AVGSUBFLOORU - Averaging subtract - Subtract two integers using an integer of type i[N+1...
@ 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.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ 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.
@ CTTZ_ELTS
Returns the number of number of trailing (least significant) zero elements in a vector.
@ FMA
FMA - Perform a * b + c with no intermediate rounding step.
@ VECTOR_FIND_LAST_ACTIVE
Finds the index of the last active mask element Operands: Mask.
@ FMODF
FMODF - Decomposes the operand into integral and fractional parts, each having the same type and sign...
@ FATAN2
FATAN2 - atan2, inspired by libm.
@ FSINCOSPI
FSINCOSPI - Compute both the sine and cosine times pi more accurately than FSINCOS(pi*x),...
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
@ CONCAT_VECTORS
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
@ VECREDUCE_FMAX
FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
@ FADD
Simple binary floating point operators.
@ VECREDUCE_FMAXIMUM
FMINIMUM/FMAXIMUM nodes propatate NaNs and signed zeroes using the llvm.minimum and llvm....
@ VECTOR_SHUFFLE_VAR
VECTOR_SHUFFLE_VAR(VEC, MASK) - Returns VEC permuted by MASK, an integer vector with the same number ...
@ 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.
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ CLMUL
Carry-less multiplication operations.
@ FLDEXP
FLDEXP - ldexp, inspired by libm (op0 * 2**op1).
@ 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.
@ CONVERT_FROM_ARBITRARY_FP
CONVERT_FROM_ARBITRARY_FP - This operator converts from an arbitrary floating-point represented as an...
@ SIGN_EXTEND
Conversion operators.
@ AVGCEILS
AVGCEILS/AVGCEILU - Rounding averaging add - Add two integers using an integer of type i[N+2],...
@ VECREDUCE_FADD
These reductions have relaxed evaluation order semantics, and have a single vector operand.
@ VECREDUCE_FMAXIMUMNUM
FMINIMUMNUM/FMAXIMUMNUM nodes do not propagate NaNs and order signed zeroes using the llvm....
@ FSINCOS
FSINCOS - Compute both fsin and fcos as a single operation.
@ FNEG
Perform various unary floating-point operations inspired by libm.
@ SSUBO
Same for subtraction.
@ VECTOR_INTERLEAVE
VECTOR_INTERLEAVE(VEC1, VEC2, ...) - Returns N vectors from N input vectors, where N is the factor to...
@ 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.
@ GET_ACTIVE_LANE_MASK
GET_ACTIVE_LANE_MASK - this corrosponds to the llvm.get.active.lane.mask intrinsic.
@ SADDO
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
@ VECREDUCE_ADD
Integer reductions may have a result type larger than the vector element type.
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
@ SHL
Shift and rotation operations.
@ FMINNUM_IEEE
FMINNUM_IEEE/FMAXNUM_IEEE - Same as FMINNUM/FMAXNUM, except that a signaling NaN operand deterministi...
@ 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) ...
@ FMINNUM
FMINNUM/FMAXNUM - Same semantics as the llvm.minnum/maxnum intrinsics.
@ 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.
@ MASKED_UDIV
Masked vector arithmetic that returns poison on disabled lanes.
@ SDIVFIXSAT
Same as the corresponding unsaturated fixed point instructions, but the result is clamped between the...
@ FP_EXTEND
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ 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.
@ MGATHER
Masked gather and scatter - load and store operations for a vector of random addresses with additiona...
@ PEXT
Parallel bit extract (compress) and parallel bit deposit (expand).
@ 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.
@ FMINIMUM
FMINIMUM/FMAXIMUM - Same semantics as the llvm.minimum/maximum intrinsics.
@ 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],...
@ VECTOR_MATCH
VECTOR_MATCH - this corresponds to the llvm.experimental.vector.match intrinsic.
@ STRICT_FADD
Constrained versions of the binary floating point operators.
@ INSERT_VECTOR_ELT
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ CTTZ_ZERO_POISON
Bit counting operators with a poisoned result for zero inputs.
@ FFREXP
FFREXP - frexp, extract fractional and exponent component of a floating-point value.
@ 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.
@ CONVERT_TO_ARBITRARY_FP
CONVERT_TO_ARBITRARY_FP - Converts a native FP value to an arbitrary floating-point format,...
@ 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)...
@ VECTOR_DEINTERLEAVE
VECTOR_DEINTERLEAVE(VEC1, VEC2, ...) - Returns N vectors from N input vectors, where N is the factor ...
@ FMINIMUMNUM
FMINIMUMNUM/FMAXIMUMNUM - Same semantics as the llvm.minimumnum/maximumnum intrinsics.
@ ABDS
ABDS/ABDU - Absolute difference - Return the absolute difference between two numbers interpreted as s...
@ ABS_MIN_POISON
ABS with a poison result for INT_MIN.
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
@ LOOP_DEPENDENCE_WAR_MASK
The llvm.loop.dependence.
LLVM_ABI NodeType getUnmaskedBinOpOpcode(unsigned MaskedOpc)
Given a MaskedOpc of ISD::MASKED_(U|S)(DIV|REM), returns the unmasked ISD::(U|S)(DIV|REM).
LLVM_ABI std::optional< unsigned > getVPMaskIdx(unsigned Opcode)
The operand position of the vector mask.
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.
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...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
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.
constexpr 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 ...
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
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
EVT getDoubleNumVectorElementsVT(LLVMContext &Context) const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
bool isByteSized() const
Return true if the bit size is a multiple of 8.
unsigned getVectorMinNumElements() const
Given a vector type, return the minimum number of elements it contains.
uint64_t getScalarSizeInBits() const
static LLVM_ABI EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
EVT changeVectorElementType(LLVMContext &Context, EVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
EVT changeVectorElementCount(LLVMContext &Context, ElementCount EC) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element coun...
bool isFixedLengthVector() const
EVT getRoundIntegerType(LLVMContext &Context) const
Rounds the bit-width of the given integer EVT up to the nearest power of two (and at least to eight),...
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.
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 changeElementType(LLVMContext &Context, EVT EltVT) const
Return a VT for a type whose attributes match ourselves with the exception of the element type that i...
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.
bool isInteger() const
Return true if this is an integer or a vector integer type.
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
static bool hasVectorMaskArgument(RTLIB::LibcallImpl Impl)
Returns true if the function has a vector mask argument, which is assumed to be the last argument.
LLVM_ABI std::pair< FunctionType *, AttributeList > getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const