29 #define DEBUG_TYPE "legalize-types" 35 void DAGTypeLegalizer::ScalarizeVectorResult(
SDNode *
N,
unsigned ResNo) {
43 dbgs() <<
"ScalarizeVectorResult #" << ResNo <<
": ";
51 case ISD::BITCAST: R = ScalarizeVecRes_BITCAST(N);
break;
55 case ISD::FPOWI: R = ScalarizeVecRes_FPOWI(N);
break;
57 case ISD::LOAD: R = ScalarizeVecRes_LOAD(cast<LoadSDNode>(N));
break;
60 case ISD::VSELECT: R = ScalarizeVecRes_VSELECT(N);
break;
61 case ISD::SELECT: R = ScalarizeVecRes_SELECT(N);
break;
63 case ISD::SETCC: R = ScalarizeVecRes_SETCC(N);
break;
64 case ISD::UNDEF: R = ScalarizeVecRes_UNDEF(N);
break;
69 R = ScalarizeVecRes_VecInregOp(N);
105 R = ScalarizeVecRes_UnaryOp(N);
144 R = ScalarizeVecRes_BinOp(N);
147 R = ScalarizeVecRes_TernaryOp(N);
150 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \ 151 case ISD::STRICT_##DAGN: 152 #include "llvm/IR/ConstrainedOps.def" 153 R = ScalarizeVecRes_StrictFPOp(N);
162 R = ScalarizeVecRes_OverflowOp(N, ResNo);
170 R = ScalarizeVecRes_FIX(N);
176 SetScalarizedVector(
SDValue(N, ResNo), R);
186 SDValue DAGTypeLegalizer::ScalarizeVecRes_TernaryOp(
SDNode *N) {
202 SDValue DAGTypeLegalizer::ScalarizeVecRes_StrictFPOp(
SDNode *N) {
215 for (
unsigned i = 1; i < NumOpers; ++i) {
219 Oper = GetScalarizedVector(Oper);
232 SDValue DAGTypeLegalizer::ScalarizeVecRes_OverflowOp(
SDNode *N,
240 ScalarLHS = GetScalarizedVector(N->
getOperand(0));
241 ScalarRHS = GetScalarizedVector(N->
getOperand(1));
246 ScalarLHS = ElemsLHS[0];
247 ScalarRHS = ElemsRHS[0];
253 N->
getOpcode(), DL, ScalarVTs, ScalarLHS, ScalarRHS).getNode();
256 unsigned OtherNo = 1 - ResNo;
259 SetScalarizedVector(
SDValue(N, OtherNo),
SDValue(ScalarNode, OtherNo));
263 ReplaceValueWith(
SDValue(N, OtherNo), OtherVal);
266 return SDValue(ScalarNode, ResNo);
269 SDValue DAGTypeLegalizer::ScalarizeVecRes_MERGE_VALUES(
SDNode *N,
271 SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
272 return GetScalarizedVector(Op);
275 SDValue DAGTypeLegalizer::ScalarizeVecRes_BITCAST(
SDNode *N) {
280 Op = GetScalarizedVector(Op);
286 SDValue DAGTypeLegalizer::ScalarizeVecRes_BUILD_VECTOR(
SDNode *N) {
296 SDValue DAGTypeLegalizer::ScalarizeVecRes_EXTRACT_SUBVECTOR(
SDNode *N) {
302 SDValue DAGTypeLegalizer::ScalarizeVecRes_FP_ROUND(
SDNode *N) {
315 SDValue DAGTypeLegalizer::ScalarizeVecRes_INSERT_VECTOR_ELT(
SDNode *N) {
343 SDValue DAGTypeLegalizer::ScalarizeVecRes_UnaryOp(
SDNode *N) {
357 Op = GetScalarizedVector(Op);
367 SDValue DAGTypeLegalizer::ScalarizeVecRes_InregOp(
SDNode *N) {
375 SDValue DAGTypeLegalizer::ScalarizeVecRes_VecInregOp(
SDNode *N) {
384 Op = GetScalarizedVector(Op);
403 SDValue DAGTypeLegalizer::ScalarizeVecRes_SCALAR_TO_VECTOR(
SDNode *N) {
413 SDValue DAGTypeLegalizer::ScalarizeVecRes_VSELECT(
SDNode *N) {
421 Cond = GetScalarizedVector(Cond);
451 if (ScalarBool != VecBool) {
452 switch (ScalarBool) {
473 auto BoolVT = getSetCCResultType(CondVT);
474 if (BoolVT.bitsLT(CondVT))
482 SDValue DAGTypeLegalizer::ScalarizeVecRes_SELECT(
SDNode *N) {
489 SDValue DAGTypeLegalizer::ScalarizeVecRes_SELECT_CC(
SDNode *N) {
501 SDValue DAGTypeLegalizer::ScalarizeVecRes_VECTOR_SHUFFLE(
SDNode *N) {
506 unsigned Op = !cast<ConstantSDNode>(
Arg)->isNullValue();
507 return GetScalarizedVector(N->
getOperand(Op));
513 "Operand types must be vectors");
516 EVT OpVT = LHS.getValueType();
522 LHS = GetScalarizedVector(LHS);
523 RHS = GetScalarizedVector(RHS);
541 return DAG.
getNode(ExtendCode, DL, NVT, Res);
549 bool DAGTypeLegalizer::ScalarizeVectorOperand(
SDNode *N,
unsigned OpNo) {
554 if (!Res.getNode()) {
558 dbgs() <<
"ScalarizeVectorOperand Op #" << OpNo <<
": ";
565 Res = ScalarizeVecOp_BITCAST(N);
575 Res = ScalarizeVecOp_UnaryOp(N);
581 Res = ScalarizeVecOp_UnaryOp_StrictFP(N);
584 Res = ScalarizeVecOp_CONCAT_VECTORS(N);
587 Res = ScalarizeVecOp_EXTRACT_VECTOR_ELT(N);
590 Res = ScalarizeVecOp_VSELECT(N);
593 Res = ScalarizeVecOp_VSETCC(N);
596 Res = ScalarizeVecOp_STORE(cast<StoreSDNode>(N), OpNo);
599 Res = ScalarizeVecOp_STRICT_FP_ROUND(N, OpNo);
602 Res = ScalarizeVecOp_FP_ROUND(N, OpNo);
617 Res = ScalarizeVecOp_VECREDUCE(N);
623 if (!Res.getNode())
return false;
627 if (Res.getNode() ==
N)
631 "Invalid operand expansion");
633 ReplaceValueWith(
SDValue(N, 0), Res);
639 SDValue DAGTypeLegalizer::ScalarizeVecOp_BITCAST(
SDNode *N) {
647 SDValue DAGTypeLegalizer::ScalarizeVecOp_UnaryOp(
SDNode *N) {
649 "Unexpected vector type!");
660 SDValue DAGTypeLegalizer::ScalarizeVecOp_UnaryOp_StrictFP(
SDNode *N) {
662 "Unexpected vector type!");
676 ReplaceValueWith(
SDValue(N, 0), Res);
681 SDValue DAGTypeLegalizer::ScalarizeVecOp_CONCAT_VECTORS(
SDNode *N) {
684 Ops[i] = GetScalarizedVector(N->
getOperand(i));
690 SDValue DAGTypeLegalizer::ScalarizeVecOp_EXTRACT_VECTOR_ELT(
SDNode *N) {
703 SDValue DAGTypeLegalizer::ScalarizeVecOp_VSELECT(
SDNode *N) {
717 "Operand types must be vectors");
736 Res = DAG.
getNode(ExtendCode, DL, NVT, Res);
745 assert(OpNo == 1 &&
"Do not know how to scalarize this operand!");
763 SDValue DAGTypeLegalizer::ScalarizeVecOp_FP_ROUND(
SDNode *N,
unsigned OpNo) {
771 SDValue DAGTypeLegalizer::ScalarizeVecOp_STRICT_FP_ROUND(
SDNode *N,
773 assert(OpNo == 1 &&
"Wrong operand for scalarization!");
787 ReplaceValueWith(
SDValue(N, 0), Res);
791 SDValue DAGTypeLegalizer::ScalarizeVecOp_VECREDUCE(
SDNode *N) {
807 void DAGTypeLegalizer::SplitVectorResult(
SDNode *N,
unsigned ResNo) {
818 dbgs() <<
"SplitVectorResult #" << ResNo <<
": ";
827 case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi);
break;
829 case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi);
break;
830 case ISD::BITCAST: SplitVecRes_BITCAST(N, Lo, Hi);
break;
835 case ISD::FPOWI: SplitVecRes_FPOWI(N, Lo, Hi);
break;
841 SplitVecRes_LOAD(cast<LoadSDNode>(N), Lo, Hi);
844 SplitVecRes_MLOAD(cast<MaskedLoadSDNode>(N), Lo, Hi);
847 SplitVecRes_MGATHER(cast<MaskedGatherSDNode>(N), Lo, Hi);
850 SplitVecRes_SETCC(N, Lo, Hi);
853 SplitVecRes_VECTOR_SHUFFLE(cast<ShuffleVectorSDNode>(N), Lo, Hi);
856 SplitVecRes_VAARG(N, Lo, Hi);
862 SplitVecRes_ExtVecInRegOp(N, Lo, Hi);
897 SplitVecRes_UnaryOp(N, Lo, Hi);
903 SplitVecRes_ExtendOp(N, Lo, Hi);
939 SplitVecRes_BinOp(N, Lo, Hi);
942 SplitVecRes_TernaryOp(N, Lo, Hi);
945 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \ 946 case ISD::STRICT_##DAGN: 947 #include "llvm/IR/ConstrainedOps.def" 948 SplitVecRes_StrictFPOp(N, Lo, Hi);
957 SplitVecRes_OverflowOp(N, ResNo, Lo, Hi);
965 SplitVecRes_FIX(N, Lo, Hi);
977 GetSplitVector(N->
getOperand(0), LHSLo, LHSHi);
979 GetSplitVector(N->
getOperand(1), RHSLo, RHSHi);
988 void DAGTypeLegalizer::SplitVecRes_TernaryOp(
SDNode *N,
SDValue &Lo,
991 GetSplitVector(N->
getOperand(0), Op0Lo, Op0Hi);
993 GetSplitVector(N->
getOperand(1), Op1Lo, Op1Hi);
995 GetSplitVector(N->
getOperand(2), Op2Lo, Op2Hi);
999 Op0Lo, Op1Lo, Op2Lo);
1001 Op0Hi, Op1Hi, Op2Hi);
1006 GetSplitVector(N->
getOperand(0), LHSLo, LHSHi);
1008 GetSplitVector(N->
getOperand(1), RHSLo, RHSHi);
1017 void DAGTypeLegalizer::SplitVecRes_BITCAST(
SDNode *N,
SDValue &Lo,
1029 switch (getTypeAction(InVT)) {
1043 GetExpandedOp(InOp, Lo, Hi);
1054 GetSplitVector(InOp, Lo, Hi);
1066 SplitInteger(BitConvertToInteger(InOp), LoIntVT, HiIntVT, Lo, Hi);
1074 void DAGTypeLegalizer::SplitVecRes_BUILD_VECTOR(
SDNode *N,
SDValue &Lo,
1087 void DAGTypeLegalizer::SplitVecRes_CONCAT_VECTORS(
SDNode *N,
SDValue &Lo,
1092 if (NumSubvectors == 1) {
1108 void DAGTypeLegalizer::SplitVecRes_EXTRACT_SUBVECTOR(
SDNode *N,
SDValue &Lo,
1118 uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
1124 void DAGTypeLegalizer::SplitVecRes_INSERT_SUBVECTOR(
SDNode *N,
SDValue &Lo,
1130 GetSplitVector(Vec, Lo, Hi);
1143 unsigned IdxVal = ConstIdx->getZExtValue();
1144 if ((IdxVal == 0) && (IdxVal + SubElems <= VecElems / 2)) {
1173 MinAlign(Alignment, IncrementSize));
1176 void DAGTypeLegalizer::SplitVecRes_FPOWI(
SDNode *N,
SDValue &Lo,
1184 void DAGTypeLegalizer::SplitVecRes_FCOPYSIGN(
SDNode *N,
SDValue &Lo,
1187 GetSplitVector(N->
getOperand(0), LHSLo, LHSHi);
1194 GetSplitVector(RHS, RHSLo, RHSHi);
1203 void DAGTypeLegalizer::SplitVecRes_InregOp(
SDNode *N,
SDValue &Lo,
1206 GetSplitVector(N->
getOperand(0), LHSLo, LHSHi);
1210 std::tie(LoVT, HiVT) =
1219 void DAGTypeLegalizer::SplitVecRes_ExtVecInRegOp(
SDNode *N,
SDValue &Lo,
1228 GetSplitVector(N0, InLo, InHi);
1235 EVT OutLoVT, OutHiVT;
1238 assert((2 * OutNumElements) <= InNumElements &&
1239 "Illegal extend vector in reg split");
1249 for (
unsigned i = 0; i != OutNumElements; ++i)
1250 SplitHi[i] = i + OutNumElements;
1253 Lo = DAG.
getNode(Opcode, dl, OutLoVT, InLo);
1254 Hi = DAG.
getNode(Opcode, dl, OutHiVT, InHi);
1257 void DAGTypeLegalizer::SplitVecRes_StrictFPOp(
SDNode *N,
SDValue &Lo,
1273 for (
unsigned i = 1; i < NumOps; ++i) {
1283 GetSplitVector(Op, OpLo, OpHi);
1293 EVT HiValueVTs[] = {HiVT, MVT::Other};
1304 ReplaceValueWith(
SDValue(N, 1), Chain);
1307 SDValue DAGTypeLegalizer::UnrollVectorOp_StrictFP(
SDNode *N,
unsigned ResNE) {
1320 else if (NE > ResNE)
1328 for (i = 0; i !=
NE; ++i) {
1352 for (; i < ResNE; ++i)
1357 ReplaceValueWith(
SDValue(N, 1), Chain);
1364 void DAGTypeLegalizer::SplitVecRes_OverflowOp(
SDNode *N,
unsigned ResNo,
1369 EVT LoResVT, HiResVT, LoOvVT, HiOvVT;
1373 SDValue LoLHS, HiLHS, LoRHS, HiRHS;
1375 GetSplitVector(N->
getOperand(0), LoLHS, HiLHS);
1376 GetSplitVector(N->
getOperand(1), LoRHS, HiRHS);
1392 unsigned OtherNo = 1 - ResNo;
1395 SetSplitVector(
SDValue(N, OtherNo),
1401 ReplaceValueWith(
SDValue(N, OtherNo), OtherVal);
1405 void DAGTypeLegalizer::SplitVecRes_INSERT_VECTOR_ELT(
SDNode *N,
SDValue &Lo,
1411 GetSplitVector(Vec, Lo, Hi);
1414 unsigned IdxVal = CIdx->getZExtValue();
1416 if (IdxVal < LoNumElts)
1463 Lo = DAG.
getLoad(LoVT, dl, Store, StackPtr, PtrInfo);
1467 StackPtr = DAG.
getNode(
ISD::ADD, dl, StackPtr.getValueType(), StackPtr,
1469 StackPtr.getValueType()));
1472 Hi = DAG.
getLoad(HiVT, dl, Store, StackPtr,
1473 PtrInfo.getWithOffset(IncrementSize),
1474 MinAlign(Alignment, IncrementSize));
1484 void DAGTypeLegalizer::SplitVecRes_SCALAR_TO_VECTOR(
SDNode *N,
SDValue &Lo,
1509 EVT LoMemVT, HiMemVT;
1519 Alignment, MMOFlags, AAInfo);
1528 ReplaceValueWith(
SDValue(LD, 1), Ch);
1541 assert(Offset.
isUndef() &&
"Unexpected indexed masked load offset");
1550 SplitVecRes_SETCC(Mask.getNode(), MaskLo, MaskHi);
1553 GetSplitVector(Mask, MaskLo, MaskHi);
1555 std::tie(MaskLo, MaskHi) = DAG.
SplitVector(Mask, dl);
1559 EVT LoMemVT, HiMemVT;
1562 SDValue PassThruLo, PassThruHi;
1564 GetSplitVector(PassThru, PassThruLo, PassThruHi);
1566 std::tie(PassThruLo, PassThruHi) = DAG.
SplitVector(PassThru, dl);
1573 Lo = DAG.
getMaskedLoad(LoVT, dl, Ch, Ptr, Offset, MaskLo, PassThruLo, LoMemVT,
1586 Hi = DAG.
getMaskedLoad(HiVT, dl, Ch, Ptr, Offset, MaskHi, PassThruHi, HiMemVT,
1597 ReplaceValueWith(
SDValue(MLD, 1), Ch);
1618 SplitVecRes_SETCC(Mask.
getNode(), MaskLo, MaskHi);
1621 GetSplitVector(Mask, MaskLo, MaskHi);
1623 std::tie(MaskLo, MaskHi) = DAG.
SplitVector(Mask, dl);
1627 EVT LoMemVT, HiMemVT;
1631 SDValue PassThruLo, PassThruHi;
1633 GetSplitVector(PassThru, PassThruLo, PassThruHi);
1635 std::tie(PassThruLo, PassThruHi) = DAG.
SplitVector(PassThru, dl);
1639 GetSplitVector(Index, IndexLo, IndexHi);
1641 std::tie(IndexLo, IndexHi) = DAG.
SplitVector(Index, dl);
1648 SDValue OpsLo[] = {Ch, PassThruLo, MaskLo, Ptr, IndexLo, Scale};
1652 SDValue OpsHi[] = {Ch, PassThruHi, MaskHi, Ptr, IndexHi, Scale};
1663 ReplaceValueWith(
SDValue(MGT, 1), Ch);
1670 "Operand types must be vectors");
1694 void DAGTypeLegalizer::SplitVecRes_UnaryOp(
SDNode *N,
SDValue &Lo,
1719 void DAGTypeLegalizer::SplitVecRes_ExtendOp(
SDNode *N,
SDValue &Lo,
1741 if ((NumElements & 1) == 0 &&
1747 EVT SplitLoVT, SplitHiVT;
1751 LLVM_DEBUG(
dbgs() <<
"Split vector extend via incremental extend:";
1765 SplitVecRes_UnaryOp(N, Lo, Hi);
1773 GetSplitVector(N->
getOperand(0), Inputs[0], Inputs[1]);
1774 GetSplitVector(N->
getOperand(1), Inputs[2], Inputs[3]);
1789 unsigned InputUsed[2] = { -1U, -1U };
1790 unsigned FirstMaskIdx =
High * NewElts;
1791 bool useBuildVector =
false;
1792 for (
unsigned MaskOffset = 0; MaskOffset < NewElts; ++MaskOffset) {
1794 int Idx = N->
getMaskElt(FirstMaskIdx + MaskOffset);
1797 unsigned Input = (
unsigned)Idx / NewElts;
1806 Idx -= Input * NewElts;
1811 if (InputUsed[OpNo] == Input) {
1814 }
else if (InputUsed[OpNo] == -1U) {
1816 InputUsed[OpNo] = Input;
1824 useBuildVector =
true;
1832 if (useBuildVector) {
1837 for (
unsigned MaskOffset = 0; MaskOffset < NewElts; ++MaskOffset) {
1839 int Idx = N->
getMaskElt(FirstMaskIdx + MaskOffset);
1842 unsigned Input = (
unsigned)Idx / NewElts;
1851 Idx -= Input * NewElts;
1861 }
else if (InputUsed[0] == -1U) {
1865 SDValue Op0 = Inputs[InputUsed[0]];
1867 SDValue Op1 = InputUsed[1] == -1U ?
1868 DAG.
getUNDEF(NewVT) : Inputs[InputUsed[1]];
1888 Lo = DAG.
getVAArg(NVT, dl, Chain, Ptr, SV, Alignment);
1894 ReplaceValueWith(
SDValue(N, 1), Chain);
1906 bool DAGTypeLegalizer::SplitVectorOperand(
SDNode *N,
unsigned OpNo) {
1914 if (!Res.getNode()) {
1918 dbgs() <<
"SplitVectorOperand Op #" << OpNo <<
": ";
1925 case ISD::SETCC: Res = SplitVecOp_VSETCC(N);
break;
1931 Res = SplitVecOp_TruncateHelper(N);
1937 Res = SplitVecOp_STORE(cast<StoreSDNode>(N), OpNo);
1940 Res = SplitVecOp_MSTORE(cast<MaskedStoreSDNode>(N), OpNo);
1943 Res = SplitVecOp_MSCATTER(cast<MaskedScatterSDNode>(N), OpNo);
1946 Res = SplitVecOp_MGATHER(cast<MaskedGatherSDNode>(N), OpNo);
1949 Res = SplitVecOp_VSELECT(N, OpNo);
1957 Res = SplitVecOp_TruncateHelper(N);
1959 Res = SplitVecOp_UnaryOp(N);
1975 Res = SplitVecOp_UnaryOp(N);
1981 Res = SplitVecOp_ExtVecInRegOp(N);
1997 Res = SplitVecOp_VECREDUCE(N, OpNo);
2003 if (!Res.getNode())
return false;
2007 if (Res.getNode() ==
N)
2012 "Invalid operand expansion");
2015 "Invalid operand expansion");
2017 ReplaceValueWith(
SDValue(N, 0), Res);
2021 SDValue DAGTypeLegalizer::SplitVecOp_VSELECT(
SDNode *N,
unsigned OpNo) {
2024 assert(OpNo == 0 &&
"Illegal operand must be mask");
2035 assert(Lo.getValueType() == Hi.getValueType() &&
2036 "Lo and Hi have differing types");
2040 assert(LoOpVT == HiOpVT &&
"Asymmetric vector split?");
2042 SDValue LoOp0, HiOp0, LoOp1, HiOp1, LoMask, HiMask;
2043 std::tie(LoOp0, HiOp0) = DAG.
SplitVector(Src0, DL);
2044 std::tie(LoOp1, HiOp1) = DAG.
SplitVector(Src1, DL);
2045 std::tie(LoMask, HiMask) = DAG.
SplitVector(Mask, DL);
2055 SDValue DAGTypeLegalizer::SplitVecOp_VECREDUCE(
SDNode *N,
unsigned OpNo) {
2062 assert(VecVT.
isVector() &&
"Can only split reduce vector operand");
2063 GetSplitVector(VecOp, Lo, Hi);
2068 unsigned CombineOpc = 0;
2121 ReplaceValueWith(
SDValue(N, 1), Ch);
2136 Lo = BitConvertToInteger(Lo);
2137 Hi = BitConvertToInteger(Hi);
2143 JoinIntegers(Lo, Hi));
2146 SDValue DAGTypeLegalizer::SplitVecOp_EXTRACT_SUBVECTOR(
SDNode *N) {
2155 uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
2157 if (IdxVal < LoElts) {
2159 "Extracted subvector crosses vector split!");
2168 SDValue DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT(
SDNode *N) {
2173 if (isa<ConstantSDNode>(Idx)) {
2174 uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
2177 GetSplitVector(Vec, Lo, Hi);
2181 if (IdxVal < LoElts)
2225 SDValue DAGTypeLegalizer::SplitVecOp_ExtVecInRegOp(
SDNode *N) {
2230 SplitVecRes_ExtVecInRegOp(N, Lo, Hi);
2252 GetSplitVector(Mask, MaskLo, MaskHi);
2254 std::tie(MaskLo, MaskHi) = DAG.
SplitVector(Mask, dl);
2257 EVT LoMemVT, HiMemVT;
2260 SDValue PassThruLo, PassThruHi;
2262 GetSplitVector(PassThru, PassThruLo, PassThruHi);
2264 std::tie(PassThruLo, PassThruHi) = DAG.
SplitVector(PassThru, dl);
2268 GetSplitVector(Index, IndexLo, IndexHi);
2270 std::tie(IndexLo, IndexHi) = DAG.
SplitVector(Index, dl);
2277 SDValue OpsLo[] = {Ch, PassThruLo, MaskLo, Ptr, IndexLo, Scale};
2287 SDValue OpsHi[] = {Ch, PassThruHi, MaskHi, Ptr, IndexHi, Scale};
2298 ReplaceValueWith(
SDValue(MGT, 1), Ch);
2302 ReplaceValueWith(
SDValue(MGT, 0), Res);
2312 assert(Offset.
isUndef() &&
"Unexpected indexed masked store offset");
2319 EVT LoMemVT, HiMemVT;
2325 GetSplitVector(Data, DataLo, DataHi);
2327 std::tie(DataLo, DataHi) = DAG.
SplitVector(Data, DL);
2331 if (OpNo == 1 && Mask.getOpcode() ==
ISD::SETCC) {
2332 SplitVecRes_SETCC(Mask.getNode(), MaskLo, MaskHi);
2335 GetSplitVector(Mask, MaskLo, MaskHi);
2337 std::tie(MaskLo, MaskHi) = DAG.
SplitVector(Mask, DL);
2346 Lo = DAG.
getMaskedStore(Ch, DL, DataLo, Ptr, Offset, MaskLo, LoMemVT, MMO,
2359 Hi = DAG.
getMaskedStore(Ch, DL, DataHi, Ptr, Offset, MaskHi, HiMemVT, MMO,
2381 EVT LoMemVT, HiMemVT;
2387 GetSplitVector(Data, DataLo, DataHi);
2389 std::tie(DataLo, DataHi) = DAG.
SplitVector(Data, DL);
2394 SplitVecRes_SETCC(Mask.
getNode(), MaskLo, MaskHi);
2397 GetSplitVector(Mask, MaskLo, MaskHi);
2399 std::tie(MaskLo, MaskHi) = DAG.
SplitVector(Mask, DL);
2404 GetSplitVector(Index, IndexLo, IndexHi);
2406 std::tie(IndexLo, IndexHi) = DAG.
SplitVector(Index, DL);
2414 SDValue OpsLo[] = {Ch, DataLo, MaskLo, Ptr, IndexLo, Scale};
2426 SDValue OpsHi[] = {
Lo, DataHi, MaskHi, Ptr, IndexHi, Scale};
2433 assert(OpNo == 1 &&
"Can only split the stored value");
2446 EVT LoMemVT, HiMemVT;
2450 if (!LoMemVT.isByteSized() || !HiMemVT.isByteSized())
2453 unsigned IncrementSize = LoMemVT.getSizeInBits()/8;
2457 Alignment, MMOFlags, AAInfo);
2468 HiMemVT, Alignment, MMOFlags, AAInfo);
2472 Alignment, MMOFlags, AAInfo);
2477 SDValue DAGTypeLegalizer::SplitVecOp_CONCAT_VECTORS(
SDNode *N) {
2488 for (
unsigned i = 0,
e =
Op.getValueType().getVectorNumElements();
2499 SDValue DAGTypeLegalizer::SplitVecOp_TruncateHelper(
SDNode *N) {
2526 assert(!(NumElements & 1) &&
"Splitting vector, but not in half!");
2532 EVT LoOutVT, HiOutVT;
2534 assert(LoOutVT == HiOutVT &&
"Unequal split?");
2539 if (isTypeLegal(LoOutVT) ||
2540 InElementSize <= OutElementSize * 2)
2541 return SplitVecOp_UnaryOp(N);
2550 return SplitVecOp_UnaryOp(N);
2554 GetSplitVector(InVec, InLoVec, InHiVec);
2557 EVT HalfElementVT = IsFloat ?
2608 "Operand types must be vectors");
2610 SDValue Lo0, Hi0, Lo1, Hi1, LoRes, HiRes;
2614 unsigned PartElements = Lo0.getValueType().getVectorNumElements();
2649 ReplaceValueWith(
SDValue(N, 1), NewChain);
2669 void DAGTypeLegalizer::WidenVectorResult(
SDNode *N,
unsigned ResNo) {
2681 dbgs() <<
"WidenVectorResult #" << ResNo <<
": ";
2688 case ISD::BITCAST: Res = WidenVecRes_BITCAST(N);
break;
2693 case ISD::LOAD: Res = WidenVecRes_LOAD(N);
break;
2697 case ISD::SELECT: Res = WidenVecRes_SELECT(N);
break;
2699 case ISD::SETCC: Res = WidenVecRes_SETCC(N);
break;
2700 case ISD::UNDEF: Res = WidenVecRes_UNDEF(N);
break;
2702 Res = WidenVecRes_VECTOR_SHUFFLE(cast<ShuffleVectorSDNode>(N));
2705 Res = WidenVecRes_MLOAD(cast<MaskedLoadSDNode>(N));
2708 Res = WidenVecRes_MGATHER(cast<MaskedGatherSDNode>(N));
2731 Res = WidenVecRes_Binary(N);
2744 Res = WidenVecRes_BinaryCanTrap(N);
2753 Res = WidenVecRes_BinaryWithExtraScalarOp(N);
2756 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \ 2757 case ISD::STRICT_##DAGN: 2758 #include "llvm/IR/ConstrainedOps.def" 2759 Res = WidenVecRes_StrictFP(N);
2768 Res = WidenVecRes_OverflowOp(N, ResNo);
2772 Res = WidenVecRes_FCOPYSIGN(N);
2776 Res = WidenVecRes_POWI(N);
2782 Res = WidenVecRes_Shift(N);
2788 Res = WidenVecRes_EXTEND_VECTOR_INREG(N);
2801 Res = WidenVecRes_Convert(N);
2846 Res = WidenVecRes_Unary(N);
2849 Res = WidenVecRes_Ternary(N);
2855 SetWidenedVector(
SDValue(N, ResNo), Res);
2877 SDValue DAGTypeLegalizer::WidenVecRes_BinaryWithExtraScalarOp(
SDNode *N) {
2893 unsigned ConcatEnd,
EVT VT,
EVT MaxVT,
2896 if (ConcatEnd == 1) {
2897 VT = ConcatOps[0].getValueType();
2899 return ConcatOps[0];
2902 SDLoc dl(ConcatOps[0]);
2909 while (ConcatOps[ConcatEnd-1].getValueType() != MaxVT) {
2910 int Idx = ConcatEnd - 1;
2911 VT = ConcatOps[Idx--].getValueType();
2912 while (Idx >= 0 && ConcatOps[Idx].getValueType() == VT)
2925 unsigned NumToInsert = ConcatEnd - Idx - 1;
2926 for (
unsigned i = 0, OpIdx = Idx+1; i < NumToInsert; i++, OpIdx++) {
2931 ConcatOps[Idx+1] = VecOp;
2932 ConcatEnd = Idx + 2;
2938 unsigned RealVals = ConcatEnd - Idx - 1;
2939 unsigned SubConcatEnd = 0;
2940 unsigned SubConcatIdx = Idx + 1;
2941 while (SubConcatEnd < RealVals)
2942 SubConcatOps[SubConcatEnd++] = ConcatOps[++Idx];
2943 while (SubConcatEnd < OpsToConcat)
2944 SubConcatOps[SubConcatEnd++] = undefVec;
2946 NextVT, SubConcatOps);
2947 ConcatEnd = SubConcatIdx + 1;
2952 if (ConcatEnd == 1) {
2953 VT = ConcatOps[0].getValueType();
2955 return ConcatOps[0];
2960 if (NumOps != ConcatEnd ) {
2962 for (
unsigned j = ConcatEnd; j < NumOps; ++j)
2963 ConcatOps[j] = UndefVal;
2969 SDValue DAGTypeLegalizer::WidenVecRes_BinaryCanTrap(
SDNode *N) {
2979 NumElts = NumElts / 2;
3001 unsigned ConcatEnd = 0;
3009 while (CurNumElts != 0) {
3010 while (CurNumElts >= NumElts) {
3017 ConcatOps[ConcatEnd++] = DAG.
getNode(Opcode, dl, VT, EOp1, EOp2, Flags);
3019 CurNumElts -= NumElts;
3022 NumElts = NumElts / 2;
3027 for (
unsigned i = 0; i != CurNumElts; ++i, ++Idx) {
3034 ConcatOps[ConcatEnd++] = DAG.
getNode(Opcode, dl, WidenEltVT,
3048 return WidenVecRes_STRICT_FSETCC(N);
3055 return WidenVecRes_Convert_StrictFP(N);
3069 NumElts = NumElts / 2;
3084 unsigned ConcatEnd = 0;
3091 for (
unsigned i = 1; i < NumOpers; ++i) {
3096 "Invalid operand type to widen!");
3097 Oper = GetWidenedVector(Oper);
3108 while (CurNumElts != 0) {
3109 while (CurNumElts >= NumElts) {
3112 for (
unsigned i = 0; i < NumOpers; ++i) {
3125 ConcatOps[ConcatEnd++] = Oper;
3128 CurNumElts -= NumElts;
3131 NumElts = NumElts / 2;
3136 for (
unsigned i = 0; i != CurNumElts; ++i, ++Idx) {
3139 for (
unsigned i = 0; i < NumOpers; ++i) {
3153 ConcatOps[ConcatEnd++] = Oper;
3162 if (Chains.
size() == 1)
3163 NewChain = Chains[0];
3166 ReplaceValueWith(
SDValue(N, 1), NewChain);
3171 SDValue DAGTypeLegalizer::WidenVecRes_OverflowOp(
SDNode *N,
unsigned ResNo) {
3175 EVT WideResVT, WideOvVT;
3185 WideLHS = GetWidenedVector(N->
getOperand(0));
3186 WideRHS = GetWidenedVector(N->
getOperand(1));
3205 N->
getOpcode(), DL, WideVTs, WideLHS, WideRHS).getNode();
3208 unsigned OtherNo = 1 - ResNo;
3211 SetWidenedVector(
SDValue(N, OtherNo),
SDValue(WideNode, OtherNo));
3217 ReplaceValueWith(
SDValue(N, OtherNo), OtherVal);
3220 return SDValue(WideNode, ResNo);
3240 InVTNumElts = InVT.getVectorNumElements();
3241 if (InVTNumElts == WidenNumElts) {
3243 return DAG.
getNode(Opcode, DL, WidenVT, InOp);
3265 if (WidenNumElts % InVTNumElts == 0) {
3267 unsigned NumConcat = WidenNumElts/InVTNumElts;
3272 return DAG.
getNode(Opcode, DL, WidenVT, InVec);
3276 if (InVTNumElts % WidenNumElts == 0) {
3282 return DAG.
getNode(Opcode, DL, WidenVT, InVal);
3293 for (
unsigned i=0; i < MinElts; ++i) {
3298 Ops[i] = DAG.
getNode(Opcode, DL, EltVT, Val);
3306 SDValue DAGTypeLegalizer::WidenVecRes_Convert_StrictFP(
SDNode *N) {
3312 unsigned WidenNumElts = WidenVT.getVectorNumElements();
3323 EVT EltVT = WidenVT.getVectorElementType();
3330 for (
unsigned i=0; i < MinElts; ++i) {
3334 Ops[i] = DAG.
getNode(Opcode, DL, EltVTs, NewOps);
3338 ReplaceValueWith(
SDValue(N, 1), NewChain);
3343 SDValue DAGTypeLegalizer::WidenVecRes_EXTEND_VECTOR_INREG(
SDNode *N) {
3357 InOp = GetWidenedVector(InOp);
3364 return DAG.
getNode(Opcode, DL, WidenVT, InOp);
3371 for (
unsigned i = 0,
e = std::min(InVTNumElts, WidenNumElts); i !=
e; ++i) {
3390 while (Ops.
size() != WidenNumElts)
3396 SDValue DAGTypeLegalizer::WidenVecRes_FCOPYSIGN(
SDNode *N) {
3400 return WidenVecRes_BinaryCanTrap(N);
3419 EVT ShVT = ShOp.getValueType();
3421 ShOp = GetWidenedVector(ShOp);
3422 ShVT = ShOp.getValueType();
3427 if (ShVT != ShWidenVT)
3428 ShOp = ModifyToType(ShOp, ShWidenVT);
3444 .getVectorElementType(),
3451 SDValue DAGTypeLegalizer::WidenVecRes_MERGE_VALUES(
SDNode *N,
unsigned ResNo) {
3452 SDValue WidenVec = DisintegrateMERGE_VALUES(N, ResNo);
3453 return GetWidenedVector(WidenVec);
3463 switch (getTypeAction(InVT)) {
3475 SDValue NInOp = GetPromotedInteger(InOp);
3477 if (WidenVT.
bitsEq(NInVT)) {
3503 InOp = GetWidenedVector(InOp);
3505 if (WidenVT.
bitsEq(InVT))
3514 if (WidenSize % InSize == 0 && InVT !=
MVT::x86mmx) {
3519 unsigned NewNumElts = WidenSize / InSize;
3547 return CreateStackStoreLoad(InOp, WidenVT);
3550 SDValue DAGTypeLegalizer::WidenVecRes_BUILD_VECTOR(
SDNode *N) {
3564 assert(WidenNumElts >= NumElts &&
"Shrinking vector instead of widening!");
3565 NewOps.append(WidenNumElts - NumElts, DAG.
getUNDEF(EltVT));
3570 SDValue DAGTypeLegalizer::WidenVecRes_CONCAT_VECTORS(
SDNode *N) {
3578 bool InputWidened =
false;
3586 for (
unsigned i=0; i < NumOperands; ++i)
3588 for (
unsigned i = NumOperands; i != NumConcat; ++i)
3593 InputWidened =
true;
3597 for (i=1; i < NumOperands; ++i)
3601 if (i == NumOperands)
3606 if (NumOperands == 2) {
3609 for (
unsigned i = 0; i < NumInElts; ++i) {
3611 MaskOps[i + NumInElts] = i + WidenNumElts;
3625 for (
unsigned i=0; i < NumOperands; ++i) {
3628 InOp = GetWidenedVector(InOp);
3629 for (
unsigned j=0; j < NumInElts; ++j)
3635 for (; Idx < WidenNumElts; ++Idx)
3636 Ops[Idx] = UndefVal;
3640 SDValue DAGTypeLegalizer::WidenVecRes_EXTRACT_SUBVECTOR(
SDNode *N) {
3649 InOp = GetWidenedVector(InOp);
3654 uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
3655 if (IdxVal == 0 && InVT == WidenVT)
3660 if (IdxVal % WidenNumElts == 0 && IdxVal + WidenNumElts < InNumElts)
3669 for (i=0; i < NumElts; ++i)
3676 for (; i < WidenNumElts; ++i)
3681 SDValue DAGTypeLegalizer::WidenVecRes_INSERT_VECTOR_ELT(
SDNode *N) {
3695 Result = GenWidenVectorExtLoads(LdChain, LD, ExtType);
3697 Result = GenWidenVectorLoads(LdChain, LD);
3703 if (LdChain.
size() == 1)
3704 NewChain = LdChain[0];
3710 ReplaceValueWith(
SDValue(N, 1), NewChain);
3728 Mask = ModifyToType(Mask, WideMaskVT,
true);
3754 Mask = ModifyToType(Mask, WideMaskVT,
true);
3761 Index = ModifyToType(Index, WideIndexVT);
3774 SDValue DAGTypeLegalizer::WidenVecRes_SCALAR_TO_VECTOR(
SDNode *N) {
3863 if (MaskScalarBits < ToMaskScalBits) {
3867 }
else if (MaskScalarBits > ToMaskScalBits) {
3873 assert(Mask->getValueType(0).getScalarSizeInBits() ==
3875 "Mask should have the right element size by now.");
3878 unsigned CurrMaskNumEls = Mask->getValueType(0).getVectorNumElements();
3886 EVT SubVT = Mask->getValueType(0);
3892 assert((Mask->getValueType(0) == ToMaskVT) &&
3893 "A mask of ToMaskVT should have been produced by now.");
3924 EVT FinalVT = VSelVT;
3936 EVT SetCCResVT = getSetCCResultType(SetCCOpVT);
3954 VSelOp1 = GetWidenedVector(VSelOp1);
3955 VSelOp2 = GetWidenedVector(VSelOp2);
3959 EVT ToMaskVT = VSelVT;
3966 Mask = convertMask(Cond, MaskVT, ToMaskVT);
3982 if (ScalarBits0 != ScalarBits1) {
3983 EVT NarrowVT = ((ScalarBits0 < ScalarBits1) ? VT0 : VT1);
3984 EVT WideVT = ((NarrowVT == VT0) ? VT1 : VT0);
3996 SETCC0 = convertMask(SETCC0, VT0, MaskVT);
3997 SETCC1 = convertMask(SETCC1, VT1, MaskVT);
4001 Mask = convertMask(Cond, MaskVT, ToMaskVT);
4015 if (
SDValue Res = WidenVSELECTAndMask(N))
4020 CondEltVT, WidenNumElts);
4022 Cond1 = GetWidenedVector(Cond1);
4030 SDValue SplitSelect = SplitVecOp_VSELECT(N, 0);
4031 SDValue Res = ModifyToType(SplitSelect, WidenVT);
4036 Cond1 = ModifyToType(Cond1, CondWidenVT);
4043 WidenVT, Cond1, InOp1, InOp2);
4046 SDValue DAGTypeLegalizer::WidenVecRes_SELECT_CC(
SDNode *N) {
4072 for (
unsigned i = 0; i != NumElts; ++i) {
4074 if (Idx < (
int)NumElts)
4075 NewMask.push_back(Idx);
4077 NewMask.push_back(Idx - NumElts + WidenNumElts);
4079 for (
unsigned i = NumElts; i != WidenNumElts; ++i)
4080 NewMask.push_back(-1);
4087 "Operands must be vectors");
4101 SDValue SplitVSetCC = SplitVecOp_VSETCC(N);
4102 SDValue Res = ModifyToType(SplitVSetCC, WidenVT);
4109 InOp1 = GetWidenedVector(InOp1);
4110 InOp2 = GetWidenedVector(InOp2);
4120 "Input not widened to expected type!");
4126 SDValue DAGTypeLegalizer::WidenVecRes_STRICT_FSETCC(
SDNode *N) {
4129 "Operands must be vectors");
4133 unsigned NumElts = VT.getVectorNumElements();
4146 for (
unsigned i = 0; i != NumElts; ++i) {
4155 {Chain, LHSElem, RHSElem, CC});
4156 Chains[i] = Scalars[i].getValue(1);
4157 Scalars[i] = DAG.
getSelect(dl, EltVT, Scalars[i],
4163 ReplaceValueWith(
SDValue(N, 1), NewChain);
4171 bool DAGTypeLegalizer::WidenVectorOperand(
SDNode *N,
unsigned OpNo) {
4183 dbgs() <<
"WidenVectorOperand op #" << OpNo <<
": ";
4193 case ISD::STORE: Res = WidenVecOp_STORE(N);
break;
4194 case ISD::MSTORE: Res = WidenVecOp_MSTORE(N, OpNo);
break;
4195 case ISD::MGATHER: Res = WidenVecOp_MGATHER(N, OpNo);
break;
4196 case ISD::MSCATTER: Res = WidenVecOp_MSCATTER(N, OpNo);
break;
4197 case ISD::SETCC: Res = WidenVecOp_SETCC(N);
break;
4206 Res = WidenVecOp_EXTEND(N);
4222 Res = WidenVecOp_Convert(N);
4238 Res = WidenVecOp_VECREDUCE(N);
4243 if (!Res.getNode())
return false;
4247 if (Res.getNode() ==
N)
4253 "Invalid operand expansion");
4256 "Invalid operand expansion");
4258 ReplaceValueWith(
SDValue(N, 0), Res);
4269 "Unexpected type action");
4270 InOp = GetWidenedVector(InOp);
4273 "Input wasn't widened!");
4285 FixedEltVT == InEltVT) {
4287 "Not enough elements in the fixed type for the operand!");
4289 "We can't have the same type as we started with!");
4306 return WidenVecOp_Convert(N);
4339 "Unexpected type action");
4340 InOp = GetWidenedVector(InOp);
4355 Res = DAG.
getNode(Opcode, dl, { WideVT, MVT::Other },
4364 Res = DAG.
getNode(Opcode, dl, WideVT, InOp);
4378 for (
unsigned i=0; i < NumElts; ++i) {
4386 ReplaceValueWith(
SDValue(N, 1), NewChain);
4388 for (
unsigned i = 0; i < NumElts; ++i)
4406 unsigned InWidenSize = InWidenVT.getSizeInBits();
4410 unsigned NewNumElts = InWidenSize /
Size;
4427 if (InWidenSize % EltSize == 0) {
4428 unsigned NewNumElts = InWidenSize / EltSize;
4438 return CreateStackStoreLoad(InOp, VT);
4441 SDValue DAGTypeLegalizer::WidenVecOp_CONCAT_VECTORS(
SDNode *N) {
4452 for (i = 1; i < NumOperands; ++i)
4456 if (i == NumOperands)
4467 for (
unsigned i=0; i < NumOperands; ++i) {
4471 "Unexpected type action");
4472 InOp = GetWidenedVector(InOp);
4473 for (
unsigned j=0; j < NumInElts; ++j)
4481 SDValue DAGTypeLegalizer::WidenVecOp_EXTRACT_SUBVECTOR(
SDNode *N) {
4487 SDValue DAGTypeLegalizer::WidenVecOp_EXTRACT_VECTOR_ELT(
SDNode *N) {
4503 GenWidenVectorTruncStores(StChain, ST);
4505 GenWidenVectorStores(StChain, ST);
4507 if (StChain.
size() == 1)
4513 SDValue DAGTypeLegalizer::WidenVecOp_MSTORE(
SDNode *N,
unsigned OpNo) {
4514 assert((OpNo == 1 || OpNo == 3) &&
4515 "Can widen only data or mask operand of mstore");
4518 EVT MaskVT = Mask.getValueType();
4524 StVal = GetWidenedVector(StVal);
4531 Mask = ModifyToType(Mask, WideMaskVT,
true);
4535 Mask = ModifyToType(Mask, WideMaskVT,
true);
4541 StVal = ModifyToType(StVal, WideVT);
4544 assert(Mask.getValueType().getVectorNumElements() ==
4546 "Mask and data vectors should have the same number of elements");
4553 SDValue DAGTypeLegalizer::WidenVecOp_MGATHER(
SDNode *N,
unsigned OpNo) {
4554 assert(OpNo == 4 &&
"Can widen only the index of mgather");
4555 auto *MG = cast<MaskedGatherSDNode>(
N);
4556 SDValue DataOp = MG->getPassThru();
4558 SDValue Scale = MG->getScale();
4567 MG->getMemOperand(), MG->getIndexType());
4573 SDValue DAGTypeLegalizer::WidenVecOp_MSCATTER(
SDNode *N,
unsigned OpNo) {
4581 DataOp = GetWidenedVector(DataOp);
4582 unsigned NumElts = DataOp.getValueType().getVectorNumElements();
4588 Index = ModifyToType(Index, WideIndexVT);
4594 Mask = ModifyToType(Mask, WideMaskVT,
true);
4595 }
else if (OpNo == 4) {
4597 Index = GetWidenedVector(Index);
4640 return DAG.
getNode(ExtendCode, dl, VT, CC);
4643 SDValue DAGTypeLegalizer::WidenVecOp_STRICT_FSETCC(
SDNode *N) {
4659 for (
unsigned i = 0; i != NumElts; ++i) {
4668 {Chain, LHSElem, RHSElem, CC});
4669 Chains[i] = Scalars[i].getValue(1);
4670 Scalars[i] = DAG.
getSelect(dl, EltVT, Scalars[i],
4676 ReplaceValueWith(
SDValue(N, 1), NewChain);
4719 -std::numeric_limits<double>::infinity(), dl, ElemVT);
4723 std::numeric_limits<double>::infinity(), dl, ElemVT);
4728 unsigned OrigElts = OrigVT.getVectorNumElements();
4730 for (
unsigned Idx = OrigElts; Idx < WideElts; Idx++)
4769 unsigned Align = 0,
unsigned WidenEx = 0) {
4774 unsigned AlignInBits =
Align*8;
4777 EVT RetVT = WidenEltVT;
4778 if (Width == WidenEltWidth)
4795 (WidenWidth % MemVTWidth) == 0 &&
4797 (MemVTWidth <= Width ||
4798 (
Align!=0 && MemVTWidth<=AlignInBits && MemVTWidth<=Width+WidenEx))) {
4799 if (MemVTWidth == WidenWidth)
4820 (WidenWidth % MemVTWidth) == 0 &&
4822 (MemVTWidth <= Width ||
4823 (
Align!=0 && MemVTWidth<=AlignInBits && MemVTWidth<=Width+WidenEx))) {
4838 unsigned Start,
unsigned End) {
4840 SDLoc dl(LdOps[Start]);
4841 EVT LdTy = LdOps[Start].getValueType();
4849 for (
unsigned i = Start + 1; i != End; ++i) {
4850 EVT NewLdTy = LdOps[i].getValueType();
4851 if (NewLdTy != LdTy) {
4887 int WidthDiff = WidenWidth - LdWidth;
4888 unsigned LdAlign = (!LD->
isSimple()) ? 0 : Align;
4891 EVT NewVT =
FindMemType(DAG, TLI, LdWidth, WidenVT, LdAlign, WidthDiff);
4894 Align, MMOFlags, AAInfo);
4898 if (LdWidth <= NewVTWidth) {
4900 unsigned NumElts = WidenWidth / NewVTWidth;
4905 if (NewVT == WidenVT)
4908 assert(WidenWidth % NewVTWidth == 0);
4909 unsigned NumConcat = WidenWidth / NewVTWidth;
4912 ConcatOps[0] = LdOp;
4913 for (
unsigned i = 1; i != NumConcat; ++i)
4914 ConcatOps[i] = UndefVal;
4922 LdWidth -= NewVTWidth;
4925 while (LdWidth > 0) {
4926 unsigned Increment = NewVTWidth / 8;
4927 Offset += Increment;
4931 if (LdWidth < NewVTWidth) {
4933 NewVT =
FindMemType(DAG, TLI, LdWidth, WidenVT, LdAlign, WidthDiff);
4935 L = DAG.
getLoad(NewVT, dl, Chain, BasePtr,
4937 MinAlign(Align, Increment), MMOFlags, AAInfo);
4946 while (size < LdOp->getValueSizeInBits(0)) {
4953 L = DAG.
getLoad(NewVT, dl, Chain, BasePtr,
4955 MinAlign(Align, Increment), MMOFlags, AAInfo);
4962 LdWidth -= NewVTWidth;
4966 unsigned End = LdOps.
size();
4967 if (!LdOps[0].getValueType().
isVector())
4977 EVT LdTy = LdOps[i].getValueType();
4980 for (--i; i >= 0; --i) {
4981 LdTy = LdOps[i].getValueType();
4987 ConcatOps[--Idx] = LdOps[i];
4988 for (--i; i >= 0; --i) {
4989 EVT NewLdTy = LdOps[i].getValueType();
4990 if (NewLdTy != LdTy) {
4997 ConcatOps[--Idx] = LdOps[i];
5010 for (; i != End-Idx; ++i)
5011 WidenOps[i] = ConcatOps[Idx+i];
5012 for (; i != NumOps; ++i)
5013 WidenOps[i] = UndefVal;
5046 LdEltVT,
Align, MMOFlags, AAInfo);
5048 unsigned i = 0,
Offset = Increment;
5049 for (i=1; i < NumElts; ++i,
Offset += Increment) {
5051 Ops[i] = DAG.
getExtLoad(ExtType, dl, EltVT, Chain, NewBasePtr,
5053 Align, MMOFlags, AAInfo);
5059 for (; i != WidenNumElts; ++i)
5088 while (StWidth != 0) {
5092 unsigned Increment = NewVTWidth / 8;
5101 MinAlign(Align, Offset), MMOFlags, AAInfo));
5102 StWidth -= NewVTWidth;
5103 Offset += Increment;
5107 }
while (StWidth != 0 && StWidth >= NewVTWidth);
5110 unsigned NumElts = ValWidth / NewVTWidth;
5114 Idx = Idx * ValEltWidth / NewVTWidth;
5122 MinAlign(Align, Offset), MMOFlags, AAInfo));
5123 StWidth -= NewVTWidth;
5124 Offset += Increment;
5126 }
while (StWidth != 0 && StWidth >= NewVTWidth);
5128 Idx = Idx * NewVTWidth / ValEltWidth;
5166 unsigned Offset = Increment;
5167 for (
unsigned i=1; i < NumElts; ++i, Offset += Increment) {
5174 StEltVT,
MinAlign(Align, Offset), MMOFlags, AAInfo));
5182 bool FillWithZeroes) {
5187 "input and widen element type must match");
5196 if (WidenNumElts > InNumElts && WidenNumElts % InNumElts == 0) {
5197 unsigned NumConcat = WidenNumElts / InNumElts;
5202 for (
unsigned i = 1; i != NumConcat; ++i)
5208 if (WidenNumElts < InNumElts && InNumElts % WidenNumElts)
5216 unsigned MinNumElts = std::min(WidenNumElts, InNumElts);
5218 for (Idx = 0; Idx < MinNumElts; ++Idx)
5225 for ( ; Idx < WidenNumElts; ++Idx)
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
virtual 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...
EVT getValueType() const
Return the ValueType of the referenced return value.
void setFlags(SDNodeFlags NewFlags)
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
bool isBuildVectorOfConstantSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantSDNode or undef...
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
static SDValue CollectOpsToWiden(SelectionDAG &DAG, const TargetLowering &TLI, SmallVectorImpl< SDValue > &ConcatOps, unsigned ConcatEnd, EVT VT, EVT MaxVT, EVT WidenVT)
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0...
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
SDValue scalarizeVectorStore(StoreSDNode *ST, SelectionDAG &DAG) const
Same as the corresponding unsaturated fixed point instructions, but the result is clamped between the...
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
const SDValue & getBasePtr() const
SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base, SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, ISD::LoadExtType, bool IsExpanding=false)
void push_back(const T &Elt)
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
const SDValue & getValue() const
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
static ISD::NodeType getExtendForContent(BooleanContent Content)
const SDValue & getChain() const
unsigned getAlignment() const
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
static EVT getSETCCOperandType(SDValue N)
bool isInteger() const
Return true if this is an integer or a vector integer type.
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS)
Helper function to make it easier to build Select's if you just have operands and don't want to check...
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
const SDNodeFlags getFlags() const
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...
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
bool isByteSized() const
Return true if the bit size is a multiple of 8.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
static SDValue BuildVectorFromScalar(SelectionDAG &DAG, EVT VecTy, SmallVectorImpl< SDValue > &LdOps, unsigned Start, unsigned End)
SDValue WidenVector(const SDValue &N, const SDLoc &DL)
Widen the vector up to the next power of two using INSERT_SUBVECTOR.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
LegalityPredicate isVector(unsigned TypeIdx)
True iff the specified type index is a vector.
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
A description of a memory reference used in the backend.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Shift and rotation operations.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth...
This is used by foldAnyOrAllBitsSet() to capture a source value (Root) and the bit indexes (Mask) nee...
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, int64_t Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object...
RESULT = [US]MULFIX(LHS, RHS, SCALE) - Perform fixed point multiplication on 2 integers with the same...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
const SDValue & getPassThru() const
op_iterator op_end() const
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
const SDValue & getValue() const
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
mir Rename Register Operands
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
This class is used to represent an MSTORE node.
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only...
MachineFunction & getMachineFunction() const
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
const SDValue & getScale() const
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Simple integer binary arithmetic operators.
STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to a floating point value.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
op_iterator op_begin() const
X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
const SDValue & getMask() const
std::pair< EVT, EVT > GetSplitDestVTs(const EVT &VT) const
Compute the VTs needed for the low/hi parts of a type which is split (or expanded) into two not neces...
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
const SDValue & getBasePtr() const
bool isSimple() const
Returns true if the memory operation is neither atomic or volatile.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
static MachinePointerInfo getUnknownStack(MachineFunction &MF)
Stack memory without other information.
These reductions are non-strict, and have a single vector operand.
SDValue getVectorElementPointer(SelectionDAG &DAG, SDValue VecPtr, EVT VecVT, SDValue Index) const
Get a pointer to vector element Idx located in memory for a vector of type VecVT starting at a base a...
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
bool isExpandingLoad() const
static EVT FindMemType(SelectionDAG &DAG, const TargetLowering &TLI, unsigned Width, EVT WidenVT, unsigned Align=0, unsigned WidenEx=0)
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Simple binary floating point operators.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
iterator_range< value_op_iterator > op_values() const
const SDValue & getOperand(unsigned Num) const
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
std::pair< SDValue, SDValue > SplitVectorOperand(const SDNode *N, unsigned OpNo)
Split the node's operand with EXTRACT_SUBVECTOR and return the low/high part.
SDValue getMaskedScatter(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
const SDValue & getOffset() const
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
unsigned getOriginalAlignment() const
Returns alignment and volatility of the memory access.
const SDValue & getValue() const
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
Bit counting operators with an undefined result for zero inputs.
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP 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...
const SDValue & getIndex() const
const SDValue & getBasePtr() const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
This class contains a discriminated union of information about pointers in memory operands...
unsigned getNumOperands() const
Return the number of values used by this operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
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...
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
SDValue CreateStackTemporary(EVT VT, unsigned minAlign=1)
Create a stack temporary, suitable for holding the specified value type.
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
bool isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
The memory access writes data.
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
TokenFactor - This node takes multiple tokens as input and produces a single token result...
void dump() const
Dump this node, for debugging.
const TargetLowering & getTargetLoweringInfo() const
SDValue getMemBasePlusOffset(SDValue Base, int64_t Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
Returns platform specific canonical encoding of a floating point number.
virtual bool canOpTrap(unsigned Op, EVT VT) const
Returns true if the operation can trap for the value type.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provides VTs and return the low/high part...
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const SDValue & getMask() const
SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
FMINNUM_IEEE/FMAXNUM_IEEE - Perform floating-point minimum or maximum on two values, following the IEEE-754 2008 definition.
const SDValue & getPassThru() const
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Byte Swap and Counting operators.
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
EVT widenIntegerVectorElementType(LLVMContext &Context) const
Return a VT for an integer vector type with the size of the elements doubled.
void ExtractVectorElements(SDValue Op, SmallVectorImpl< SDValue > &Args, unsigned Start=0, unsigned Count=0)
Append the extracted elements from Start to Count out of the vector Op in Args.
SDValue IncrementMemoryAddress(SDValue Addr, SDValue Mask, const SDLoc &DL, EVT DataVT, SelectionDAG &DAG, bool IsCompressedMemory) const
Increments memory address Addr according to the type of the value DataVT that should be stored...
Represents one node in the SelectionDAG.
static bool isSETCCorConvertedSETCC(SDValue N)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachinePointerInfo getWithOffset(int64_t O) const
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
TypeSize getValueSizeInBits(unsigned ResNo) const
Returns MVT::getSizeInBits(getValueType(ResNo)).
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...
EVT getMemoryVT() const
Return the type of the in-memory value.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
Select(COND, TRUEVAL, FALSEVAL).
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
const SDValue & getBasePtr() const
ANY_EXTEND - Used for integer types. The high bits are undefined.
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
int getMaskElt(unsigned Idx) const
Flags
Flags values. These may be or'd together.
The memory access reads data.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
static bool isSETCCOp(unsigned Opcode)
These are IR-level optimization flags that may be propagated to SDNodes.
bool isVector() const
Return true if this is a vector value type.
ISD::MemIndexType getIndexType() const
How is Index applied to BasePtr when computing addresses.
Bitwise operators - logical and, logical or, logical xor.
pointer data()
Return a pointer to the vector's buffer, even if empty().
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
uint64_t getKnownMinSize() const
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
Flags getFlags() const
Return the raw flags of the source value,.
RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 integers with the same bit width ...
X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision ...
const SDValue & getBasePtr() const
unsigned getOpcode() const
SDValue getValue(unsigned R) const
This class is used to represent an MSCATTER node.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue SV, unsigned Align)
VAArg produces a result and token chain, and takes a pointer and a source value as input...
const MachinePointerInfo & getPointerInfo() const
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
This class is used to represent an MLOAD node.
TypeSize getScalarSizeInBits() const
FMA - Perform a * b + c with no intermediate rounding step.
Integer reductions may have a result type larger than the vector element type.
FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
bool isTruncatingStore() const
Return true if the op does a truncation before store.
static MachineMemOperand * getMachineMemOperand(MachineFunction &MF, FrameIndexSDNode &FI)
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
This class is used to represent an MGATHER node.
SDValue getValueType(EVT)
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Base, SDValue Offset, SDValue Mask, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
bool isUndef() const
Return true if the type of the node type undefined.
const SDValue & getOffset() const
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
ISD::LoadExtType getExtensionType() const
SetCC operator - This evaluates to a true value iff the condition is true.
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
static bool isLogicalMaskOp(unsigned Opcode)
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
bool isStrictFPOpcode()
Test if this node is a strict floating point pseudo-op.
BooleanContent
Enum that describes how the target represents true/false values.
const SDValue & getOperand(unsigned i) const
SDValue getMaskedGather(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
TRUNCATE - Completely drop the high bits.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
RESULT = [US]DIVFIX(LHS, RHS, SCALE) - Perform fixed point division on 2 integers with the same width...
Perform various unary floating-point operations inspired by libm.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
LLVMContext * getContext() const
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
bool isOperationExpand(unsigned Op, EVT VT) const
Return true if the specified operation is illegal on this target or unlikely to be made legal with cu...
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL, bool LegalTypes=true) const
const SDValue & getMask() const
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
This class is used to represent ISD::LOAD nodes.