27 #define DEBUG_TYPE "legalize-types" 37 void DAGTypeLegalizer::PromoteIntegerResult(
SDNode *
N,
unsigned ResNo) {
51 dbgs() <<
"PromoteIntegerResult #" << ResNo <<
": ";
58 case ISD::BITCAST: Res = PromoteIntRes_BITCAST(N);
break;
60 case ISD::BSWAP: Res = PromoteIntRes_BSWAP(N);
break;
64 case ISD::CTLZ: Res = PromoteIntRes_CTLZ(N);
break;
65 case ISD::CTPOP: Res = PromoteIntRes_CTPOP(N);
break;
67 case ISD::CTTZ: Res = PromoteIntRes_CTTZ(N);
break;
69 Res = PromoteIntRes_EXTRACT_VECTOR_ELT(N);
break;
70 case ISD::LOAD: Res = PromoteIntRes_LOAD(cast<LoadSDNode>(N));
break;
71 case ISD::MLOAD: Res = PromoteIntRes_MLOAD(cast<MaskedLoadSDNode>(N));
73 case ISD::MGATHER: Res = PromoteIntRes_MGATHER(cast<MaskedGatherSDNode>(N));
75 case ISD::SELECT: Res = PromoteIntRes_SELECT(N);
break;
76 case ISD::VSELECT: Res = PromoteIntRes_VSELECT(N);
break;
80 case ISD::SETCC: Res = PromoteIntRes_SETCC(N);
break;
82 case ISD::SMAX: Res = PromoteIntRes_SExtIntBinOp(N);
break;
84 case ISD::UMAX: Res = PromoteIntRes_ZExtIntBinOp(N);
break;
86 case ISD::SHL: Res = PromoteIntRes_SHL(N);
break;
88 Res = PromoteIntRes_SIGN_EXTEND_INREG(N);
break;
89 case ISD::SRA: Res = PromoteIntRes_SRA(N);
break;
90 case ISD::SRL: Res = PromoteIntRes_SRL(N);
break;
92 case ISD::UNDEF: Res = PromoteIntRes_UNDEF(N);
break;
93 case ISD::VAARG: Res = PromoteIntRes_VAARG(N);
break;
96 Res = PromoteIntRes_EXTRACT_SUBVECTOR(N);
break;
98 Res = PromoteIntRes_VECTOR_SHUFFLE(N);
break;
100 Res = PromoteIntRes_INSERT_VECTOR_ELT(N);
break;
102 Res = PromoteIntRes_BUILD_VECTOR(N);
break;
104 Res = PromoteIntRes_SCALAR_TO_VECTOR(N);
break;
106 Res = PromoteIntRes_SPLAT_VECTOR(N);
break;
108 Res = PromoteIntRes_CONCAT_VECTORS(N);
break;
113 Res = PromoteIntRes_EXTEND_VECTOR_INREG(N);
break;
133 case ISD::MUL: Res = PromoteIntRes_SimpleIntBinOp(N);
break;
136 case ISD::SREM: Res = PromoteIntRes_SExtIntBinOp(N);
break;
139 case ISD::UREM: Res = PromoteIntRes_ZExtIntBinOp(N);
break;
142 case ISD::SSUBO: Res = PromoteIntRes_SADDSUBO(N, ResNo);
break;
144 case ISD::USUBO: Res = PromoteIntRes_UADDSUBO(N, ResNo);
break;
146 case ISD::UMULO: Res = PromoteIntRes_XMULO(N, ResNo);
break;
151 case ISD::SUBCARRY: Res = PromoteIntRes_ADDSUBCARRY(N, ResNo);
break;
156 case ISD::USUBSAT: Res = PromoteIntRes_ADDSUBSAT(N);
break;
164 case ISD::UDIVFIX: Res = PromoteIntRes_DIVFIX(N);
break;
166 case ISD::ABS: Res = PromoteIntRes_ABS(N);
break;
169 Res = PromoteIntRes_Atomic0(cast<AtomicSDNode>(N));
break;
183 Res = PromoteIntRes_Atomic1(cast<AtomicSDNode>(N));
break;
187 Res = PromoteIntRes_AtomicCmpSwap(cast<AtomicSDNode>(N), ResNo);
199 Res = PromoteIntRes_VECREDUCE(N);
205 SetPromotedInteger(
SDValue(N, ResNo), Res);
210 SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
211 return GetPromotedInteger(Op);
214 SDValue DAGTypeLegalizer::PromoteIntRes_AssertSext(
SDNode *N) {
221 SDValue DAGTypeLegalizer::PromoteIntRes_AssertZext(
SDNode *N) {
282 for (
unsigned i = 1, NumResults = N->
getNumValues(); i < NumResults; ++i)
295 switch (getTypeAction(InVT)) {
319 BitConvertToInteger(GetScalarizedVector(InOp)));
327 Lo = BitConvertToInteger(Lo);
328 Hi = BitConvertToInteger(Hi);
336 JoinIntegers(Lo, Hi));
366 if (WidenInSize % OutSize == 0) {
367 unsigned Scale = WidenInSize / OutSize;
371 if (isTypeLegal(WideOutVT)) {
372 InOp = DAG.
getBitcast(WideOutVT, GetWidenedVector(InOp));
383 CreateStackStoreLoad(InOp, OutVT));
411 SDValue DAGTypeLegalizer::PromoteIntRes_BITREVERSE(
SDNode *N) {
424 SDValue DAGTypeLegalizer::PromoteIntRes_BUILD_PAIR(
SDNode *N) {
433 SDValue DAGTypeLegalizer::PromoteIntRes_Constant(
SDNode *N) {
443 assert(isa<ConstantSDNode>(Result) &&
"Didn't constant fold ext?");
477 OVT.getScalarSizeInBits());
483 SDValue DAGTypeLegalizer::PromoteIntRes_EXTRACT_VECTOR_ELT(
SDNode *N) {
508 SDValue DAGTypeLegalizer::PromoteIntRes_FP_TO_XINT(
SDNode *N) {
550 SDValue DAGTypeLegalizer::PromoteIntRes_FP_TO_FP16(
SDNode *N) {
557 SDValue DAGTypeLegalizer::PromoteIntRes_FLT_ROUNDS(
SDNode *N) {
564 SDValue DAGTypeLegalizer::PromoteIntRes_INT_EXTEND(
SDNode *N) {
626 "Gather result type and the passThru argument type should be the same");
641 SDValue DAGTypeLegalizer::PromoteIntRes_Overflow(
SDNode *N) {
646 EVT SVT = getSetCCResultType(VT);
649 assert(NumOps <= 3 &&
"Too many operands");
659 ReplaceValueWith(
SDValue(N, 0), Res);
665 SDValue DAGTypeLegalizer::PromoteIntRes_ADDSUBSAT(
SDNode *N) {
680 SDValue Op1Promoted, Op2Promoted;
682 Op1Promoted = ZExtPromotedInteger(Op1);
683 Op2Promoted = ZExtPromotedInteger(Op2);
685 Op1Promoted = SExtPromotedInteger(Op1);
686 Op2Promoted = SExtPromotedInteger(Op2);
704 "addition or subtraction");
707 unsigned SHLAmount = NewBits - OldBits;
716 DAG.
getNode(Opcode, dl, PromotedType, Op1Promoted, Op2Promoted);
717 return DAG.
getNode(ShiftOp, dl, PromotedType, Result, ShiftAmount);
739 DAG.
getNode(AddOp, dl, PromotedType, Op1Promoted, Op2Promoted);
749 SDValue Op1Promoted, Op2Promoted;
755 Op1Promoted = SExtPromotedInteger(N->
getOperand(0));
756 Op2Promoted = SExtPromotedInteger(N->
getOperand(1));
758 Op1Promoted = ZExtPromotedInteger(N->
getOperand(0));
759 Op2Promoted = ZExtPromotedInteger(N->
getOperand(1));
777 return DAG.
getNode(ShiftOp, dl, PromotedType, Result,
780 return DAG.
getNode(N->
getOpcode(), dl, PromotedType, Op1Promoted, Op2Promoted,
812 assert(Res &&
"Expanding DIVFIX with wide type failed?");
818 SDValue Op1Promoted, Op2Promoted;
821 Op1Promoted = SExtPromotedInteger(N->
getOperand(0));
822 Op2Promoted = SExtPromotedInteger(N->
getOperand(1));
824 Op1Promoted = ZExtPromotedInteger(N->
getOperand(0));
825 Op2Promoted = ZExtPromotedInteger(N->
getOperand(1));
849 SDValue DAGTypeLegalizer::PromoteIntRes_SADDSUBO(
SDNode *N,
unsigned ResNo) {
851 return PromoteIntRes_Overflow(N);
873 ReplaceValueWith(
SDValue(N, 1), Ofl);
894 SDValue DAGTypeLegalizer::PromoteIntRes_SELECT_CC(
SDNode *N) {
907 EVT SVT = getSetCCResultType(InVT);
915 SVT = getSetCCResultType(InVT);
924 "Vector compare must return a vector result!");
948 RHS = ZExtPromotedInteger(RHS);
952 SDValue DAGTypeLegalizer::PromoteIntRes_SIGN_EXTEND_INREG(
SDNode *N) {
958 SDValue DAGTypeLegalizer::PromoteIntRes_SimpleIntBinOp(
SDNode *N) {
968 SDValue DAGTypeLegalizer::PromoteIntRes_SExtIntBinOp(
SDNode *N) {
976 SDValue DAGTypeLegalizer::PromoteIntRes_ZExtIntBinOp(
SDNode *N) {
989 RHS = ZExtPromotedInteger(RHS);
998 RHS = ZExtPromotedInteger(RHS);
1002 SDValue DAGTypeLegalizer::PromoteIntRes_TRUNCATE(
SDNode *N) {
1015 Res = GetPromotedInteger(InOp);
1022 "Dst and Src must have the same number of elements");
1024 "Promoted vector type must be a power of two");
1027 GetSplitVector(InOp, EOp1, EOp2);
1037 SDValue WideInOp = GetWidenedVector(InOp);
1061 SDValue DAGTypeLegalizer::PromoteIntRes_UADDSUBO(
SDNode *N,
unsigned ResNo) {
1063 return PromoteIntRes_Overflow(N);
1084 ReplaceValueWith(
SDValue(N, 1), Ofl);
1092 SDValue DAGTypeLegalizer::PromoteIntRes_ADDSUBCARRY(
SDNode *N,
unsigned ResNo) {
1094 return PromoteIntRes_Overflow(N);
1126 SDValue DAGTypeLegalizer::PromoteIntRes_XMULO(
SDNode *N,
unsigned ResNo) {
1129 return PromoteIntRes_Overflow(N);
1140 LHS = SExtPromotedInteger(LHS);
1141 RHS = SExtPromotedInteger(RHS);
1143 LHS = ZExtPromotedInteger(LHS);
1144 RHS = ZExtPromotedInteger(RHS);
1175 ReplaceValueWith(
SDValue(N, 1), Overflow);
1195 for (
unsigned i = 0; i < NumRegs; ++i) {
1198 Chain = Parts[i].getValue(1);
1208 for (
unsigned i = 1; i < NumRegs; ++i) {
1219 ReplaceValueWith(
SDValue(N, 1), Chain);
1232 bool DAGTypeLegalizer::PromoteIntegerOperand(
SDNode *N,
unsigned OpNo) {
1244 dbgs() <<
"PromoteIntegerOperand Op #" << OpNo <<
": ";
1251 Res = PromoteIntOp_ATOMIC_STORE(cast<AtomicSDNode>(N));
1253 case ISD::BITCAST: Res = PromoteIntOp_BITCAST(N);
break;
1254 case ISD::BR_CC: Res = PromoteIntOp_BR_CC(N, OpNo);
break;
1255 case ISD::BRCOND: Res = PromoteIntOp_BRCOND(N, OpNo);
break;
1261 Res = PromoteIntOp_INSERT_VECTOR_ELT(N, OpNo);
break;
1263 Res = PromoteIntOp_SCALAR_TO_VECTOR(N);
break;
1265 Res = PromoteIntOp_SPLAT_VECTOR(N);
break;
1267 case ISD::SELECT: Res = PromoteIntOp_SELECT(N, OpNo);
break;
1268 case ISD::SELECT_CC: Res = PromoteIntOp_SELECT_CC(N, OpNo);
break;
1269 case ISD::SETCC: Res = PromoteIntOp_SETCC(N, OpNo);
break;
1273 case ISD::STORE: Res = PromoteIntOp_STORE(cast<StoreSDNode>(N),
1275 case ISD::MSTORE: Res = PromoteIntOp_MSTORE(cast<MaskedStoreSDNode>(N),
1277 case ISD::MLOAD: Res = PromoteIntOp_MLOAD(cast<MaskedLoadSDNode>(N),
1279 case ISD::MGATHER: Res = PromoteIntOp_MGATHER(cast<MaskedGatherSDNode>(N),
1281 case ISD::MSCATTER: Res = PromoteIntOp_MSCATTER(cast<MaskedScatterSDNode>(N),
1294 case ISD::ROTR: Res = PromoteIntOp_Shift(N);
break;
1297 case ISD::SUBCARRY: Res = PromoteIntOp_ADDSUBCARRY(N, OpNo);
break;
1302 case ISD::PREFETCH: Res = PromoteIntOp_PREFETCH(N, OpNo);
break;
1311 case ISD::FPOWI: Res = PromoteIntOp_FPOWI(N);
break;
1325 if (!Res.getNode())
return false;
1329 if (Res.getNode() ==
N)
1335 "Invalid operand expansion");
1339 ReplaceValueWith(
SDValue(N, 0), Res);
1348 void DAGTypeLegalizer::PromoteSetCCOperands(
SDValue &NewLHS,
SDValue &NewRHS,
1358 SDValue OpL = GetPromotedInteger(NewLHS);
1359 SDValue OpR = GetPromotedInteger(NewRHS);
1365 unsigned OpLEffectiveBits =
1367 unsigned OpREffectiveBits =
1374 NewLHS = SExtOrZExtPromotedInteger(NewLHS);
1375 NewRHS = SExtOrZExtPromotedInteger(NewRHS);
1383 NewLHS = SExtOrZExtPromotedInteger(NewLHS);
1384 NewRHS = SExtOrZExtPromotedInteger(NewRHS);
1390 NewLHS = SExtPromotedInteger(NewLHS);
1391 NewRHS = SExtPromotedInteger(NewRHS);
1396 SDValue DAGTypeLegalizer::PromoteIntOp_ANY_EXTEND(
SDNode *N) {
1413 SDValue DAGTypeLegalizer::PromoteIntOp_BR_CC(
SDNode *N,
unsigned OpNo) {
1414 assert(OpNo == 2 &&
"Don't know how to promote this operand!");
1418 PromoteSetCCOperands(LHS, RHS, cast<CondCodeSDNode>(N->
getOperand(1))->
get());
1427 SDValue DAGTypeLegalizer::PromoteIntOp_BRCOND(
SDNode *N,
unsigned OpNo) {
1428 assert(OpNo == 1 &&
"only know how to promote condition");
1438 SDValue DAGTypeLegalizer::PromoteIntOp_BUILD_PAIR(
SDNode *N) {
1452 SDValue DAGTypeLegalizer::PromoteIntOp_BUILD_VECTOR(
SDNode *N) {
1459 "Legal vector of one illegal element?");
1466 "Type of inserted value narrower than vector element type!");
1469 for (
unsigned i = 0; i < NumElts; ++i)
1475 SDValue DAGTypeLegalizer::PromoteIntOp_INSERT_VECTOR_ELT(
SDNode *N,
1484 "Type of inserted value narrower than vector element type!");
1491 assert(OpNo == 2 &&
"Different operand and result vector types?");
1500 SDValue DAGTypeLegalizer::PromoteIntOp_SCALAR_TO_VECTOR(
SDNode *N) {
1507 SDValue DAGTypeLegalizer::PromoteIntOp_SPLAT_VECTOR(
SDNode *N) {
1514 SDValue DAGTypeLegalizer::PromoteIntOp_SELECT(
SDNode *N,
unsigned OpNo) {
1515 assert(OpNo == 0 &&
"Only know how to promote the condition!");
1520 if (
SDValue Res = WidenVSELECTAndMask(N))
1525 Cond = PromoteTargetBoolean(Cond, OpVT);
1531 SDValue DAGTypeLegalizer::PromoteIntOp_SELECT_CC(
SDNode *N,
unsigned OpNo) {
1532 assert(OpNo == 0 &&
"Don't know how to promote this operand!");
1536 PromoteSetCCOperands(LHS, RHS, cast<CondCodeSDNode>(N->
getOperand(4))->
get());
1543 SDValue DAGTypeLegalizer::PromoteIntOp_SETCC(
SDNode *N,
unsigned OpNo) {
1544 assert(OpNo == 0 &&
"Don't know how to promote this operand!");
1548 PromoteSetCCOperands(LHS, RHS, cast<CondCodeSDNode>(N->
getOperand(2))->
get());
1559 SDValue DAGTypeLegalizer::PromoteIntOp_SIGN_EXTEND(
SDNode *N) {
1567 SDValue DAGTypeLegalizer::PromoteIntOp_SINT_TO_FP(
SDNode *N) {
1572 SDValue DAGTypeLegalizer::PromoteIntOp_STRICT_SINT_TO_FP(
SDNode *N) {
1597 bool TruncateStore =
false;
1599 Mask = PromoteTargetBoolean(Mask, DataVT);
1605 assert(OpNo == 1 &&
"Unexpected operand for promotion");
1606 DataOp = GetPromotedInteger(DataOp);
1607 TruncateStore =
true;
1618 assert(OpNo == 3 &&
"Only know how to promote the mask!");
1622 NewOps[OpNo] =
Mask;
1633 NewOps[OpNo] = PromoteTargetBoolean(N->
getOperand(OpNo), DataVT);
1634 }
else if (OpNo == 4) {
1638 NewOps[OpNo] = SExtPromotedInteger(N->
getOperand(OpNo));
1640 NewOps[OpNo] = ZExtPromotedInteger(N->
getOperand(OpNo));
1642 NewOps[OpNo] = GetPromotedInteger(N->
getOperand(OpNo));
1653 NewOps[OpNo] = PromoteTargetBoolean(N->
getOperand(OpNo), DataVT);
1654 }
else if (OpNo == 4) {
1658 NewOps[OpNo] = SExtPromotedInteger(N->
getOperand(OpNo));
1660 NewOps[OpNo] = ZExtPromotedInteger(N->
getOperand(OpNo));
1662 NewOps[OpNo] = GetPromotedInteger(N->
getOperand(OpNo));
1666 SDValue DAGTypeLegalizer::PromoteIntOp_TRUNCATE(
SDNode *N) {
1671 SDValue DAGTypeLegalizer::PromoteIntOp_UINT_TO_FP(
SDNode *N) {
1676 SDValue DAGTypeLegalizer::PromoteIntOp_STRICT_UINT_TO_FP(
SDNode *N) {
1681 SDValue DAGTypeLegalizer::PromoteIntOp_ZERO_EXTEND(
SDNode *N) {
1689 SDValue DAGTypeLegalizer::PromoteIntOp_ADDSUBCARRY(
SDNode *N,
unsigned OpNo) {
1690 assert(OpNo == 2 &&
"Don't know how to promote this operand!");
1697 Carry = PromoteTargetBoolean(Carry, LHS.
getValueType());
1708 SDValue DAGTypeLegalizer::PromoteIntOp_FRAMERETURNADDR(
SDNode *N) {
1714 SDValue DAGTypeLegalizer::PromoteIntOp_PREFETCH(
SDNode *N,
unsigned OpNo) {
1715 assert(OpNo > 1 &&
"Don't know how to promote this operand!");
1731 SDValue DAGTypeLegalizer::PromoteIntOp_VECREDUCE(
SDNode *N) {
1772 void DAGTypeLegalizer::ExpandIntegerResult(
SDNode *N,
unsigned ResNo) {
1785 dbgs() <<
"ExpandIntegerResult #" << ResNo <<
": ";
1792 case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi);
break;
1794 case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi);
break;
1796 case ISD::BITCAST: ExpandRes_BITCAST(N, Lo, Hi);
break;
1800 case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi);
break;
1806 case ISD::BSWAP: ExpandIntRes_BSWAP(N, Lo, Hi);
break;
1807 case ISD::Constant: ExpandIntRes_Constant(N, Lo, Hi);
break;
1808 case ISD::ABS: ExpandIntRes_ABS(N, Lo, Hi);
break;
1810 case ISD::CTLZ: ExpandIntRes_CTLZ(N, Lo, Hi);
break;
1811 case ISD::CTPOP: ExpandIntRes_CTPOP(N, Lo, Hi);
break;
1813 case ISD::CTTZ: ExpandIntRes_CTTZ(N, Lo, Hi);
break;
1822 case ISD::LLRINT: ExpandIntRes_LLROUND_LLRINT(N, Lo, Hi);
break;
1823 case ISD::LOAD: ExpandIntRes_LOAD(cast<LoadSDNode>(N), Lo, Hi);
break;
1824 case ISD::MUL: ExpandIntRes_MUL(N, Lo, Hi);
break;
1826 case ISD::SDIV: ExpandIntRes_SDIV(N, Lo, Hi);
break;
1829 case ISD::SREM: ExpandIntRes_SREM(N, Lo, Hi);
break;
1830 case ISD::TRUNCATE: ExpandIntRes_TRUNCATE(N, Lo, Hi);
break;
1831 case ISD::UDIV: ExpandIntRes_UDIV(N, Lo, Hi);
break;
1832 case ISD::UREM: ExpandIntRes_UREM(N, Lo, Hi);
break;
1849 std::pair<SDValue, SDValue> Tmp = ExpandAtomic(N);
1850 SplitInteger(Tmp.first, Lo, Hi);
1851 ReplaceValueWith(
SDValue(N, 1), Tmp.second);
1868 SplitInteger(Tmp, Lo, Hi);
1869 ReplaceValueWith(
SDValue(N, 1), Success);
1876 case ISD::XOR: ExpandIntRes_Logical(N, Lo, Hi);
break;
1881 case ISD::SMIN: ExpandIntRes_MINMAX(N, Lo, Hi);
break;
1884 case ISD::SUB: ExpandIntRes_ADDSUB(N, Lo, Hi);
break;
1887 case ISD::SUBC: ExpandIntRes_ADDSUBC(N, Lo, Hi);
break;
1890 case ISD::SUBE: ExpandIntRes_ADDSUBE(N, Lo, Hi);
break;
1893 case ISD::SUBCARRY: ExpandIntRes_ADDSUBCARRY(N, Lo, Hi);
break;
1897 case ISD::SRL: ExpandIntRes_Shift(N, Lo, Hi);
break;
1900 case ISD::SSUBO: ExpandIntRes_SADDSUBO(N, Lo, Hi);
break;
1902 case ISD::USUBO: ExpandIntRes_UADDSUBO(N, Lo, Hi);
break;
1904 case ISD::SMULO: ExpandIntRes_XMULO(N, Lo, Hi);
break;
1909 case ISD::USUBSAT: ExpandIntRes_ADDSUBSAT(N, Lo, Hi);
break;
1917 case ISD::UDIVFIX: ExpandIntRes_DIVFIX(N, Lo, Hi);
break;
1936 std::pair <SDValue, SDValue> DAGTypeLegalizer::ExpandAtomic(
SDNode *Node) {
1938 MVT VT = cast<AtomicSDNode>(Node)->getMemoryVT().getSimpleVT();
1940 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected atomic op or value type!");
1951 void DAGTypeLegalizer::ExpandShiftByConstant(
SDNode *N,
const APInt &Amt,
1956 GetExpandedInteger(N->
getOperand(0), InL, InH);
1972 if (Amt.
ugt(VTBits)) {
1974 }
else if (Amt.
ugt(NVTBits)) {
1977 NVT, InL, DAG.
getConstant(Amt - NVTBits, DL, ShTy));
1978 }
else if (Amt == NVTBits) {
1993 if (Amt.
ugt(VTBits)) {
1995 }
else if (Amt.
ugt(NVTBits)) {
1997 NVT, InH, DAG.
getConstant(Amt - NVTBits, DL, ShTy));
1999 }
else if (Amt == NVTBits) {
2014 if (Amt.
ugt(VTBits)) {
2017 }
else if (Amt.
ugt(NVTBits)) {
2022 }
else if (Amt == NVTBits) {
2040 bool DAGTypeLegalizer::
2048 "Expanded integer type size not a power of two!");
2055 if (((Known.
Zero|Known.
One) & HighBitMask) == 0)
2060 GetExpandedInteger(N->
getOperand(0), InL, InH);
2127 bool DAGTypeLegalizer::
2134 "Expanded integer type size not a power of two!");
2139 GetExpandedInteger(N->
getOperand(0), InL, InH);
2164 Lo = DAG.
getSelect(dl, NVT, isShort, LoS, LoL);
2165 Hi = DAG.
getSelect(dl, NVT, isZero, InH,
2166 DAG.
getSelect(dl, NVT, isShort, HiS, HiL));
2181 Lo = DAG.
getSelect(dl, NVT, isZero, InL,
2182 DAG.
getSelect(dl, NVT, isShort, LoS, LoL));
2183 Hi = DAG.
getSelect(dl, NVT, isShort, HiS, HiL);
2197 Lo = DAG.
getSelect(dl, NVT, isZero, InL,
2198 DAG.
getSelect(dl, NVT, isShort, LoS, LoL));
2199 Hi = DAG.
getSelect(dl, NVT, isShort, HiS, HiL);
2219 void DAGTypeLegalizer::ExpandIntRes_MINMAX(
SDNode *N,
2227 SDValue LHSL, LHSH, RHSL, RHSH;
2228 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
2229 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
2232 EVT NVT = LHSL.getValueType();
2233 EVT CCT = getSetCCResultType(NVT);
2249 Lo = DAG.
getSelect(DL, NVT, IsHiEq, LoMinMax, LoCmp);
2252 void DAGTypeLegalizer::ExpandIntRes_ADDSUB(
SDNode *N,
2256 SDValue LHSL, LHSH, RHSL, RHSH;
2257 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
2258 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
2261 SDValue LoOps[2] = { LHSL, RHSL };
2262 SDValue HiOps[3] = { LHSH, RHSH };
2312 EVT OvfVT = getSetCCResultType(NVT);
2336 Hi = DAG.
getNode(RevOpc, dl, NVT, Hi, OVF);
2344 SDValue Cmp1 = DAG.
getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[0],
2356 SDValue Cmp2 = DAG.
getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[1],
2365 DAG.
getSetCC(dl, getSetCCResultType(LoOps[0].getValueType()),
2379 void DAGTypeLegalizer::ExpandIntRes_ADDSUBC(
SDNode *N,
2382 SDValue LHSL, LHSH, RHSL, RHSH;
2384 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
2385 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
2387 SDValue LoOps[2] = { LHSL, RHSL };
2388 SDValue HiOps[3] = { LHSH, RHSH };
2405 void DAGTypeLegalizer::ExpandIntRes_ADDSUBE(
SDNode *N,
2408 SDValue LHSL, LHSH, RHSL, RHSH;
2410 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
2411 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
2414 SDValue HiOps[3] = { LHSH, RHSH };
2425 void DAGTypeLegalizer::ExpandIntRes_UADDSUBO(
SDNode *N,
2433 unsigned CarryOp, NoCarryOp;
2455 SDValue LHSL, LHSH, RHSL, RHSH;
2456 GetExpandedInteger(LHS, LHSL, LHSH);
2457 GetExpandedInteger(RHS, RHSL, RHSH);
2459 SDValue LoOps[2] = { LHSL, RHSL };
2460 SDValue HiOps[3] = { LHSH, RHSH };
2464 Hi = DAG.
getNode(CarryOp, dl, VTList, HiOps);
2471 SplitInteger(Sum, Lo, Hi);
2480 ReplaceValueWith(
SDValue(N, 1), Ovf);
2483 void DAGTypeLegalizer::ExpandIntRes_ADDSUBCARRY(
SDNode *N,
2486 SDValue LHSL, LHSH, RHSL, RHSH;
2488 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
2489 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
2503 void DAGTypeLegalizer::ExpandIntRes_ANY_EXTEND(
SDNode *N,
2517 "Only know how to promote this result!");
2518 SDValue Res = GetPromotedInteger(Op);
2520 "Operand over promoted?");
2522 SplitInteger(Res, Lo, Hi);
2526 void DAGTypeLegalizer::ExpandIntRes_AssertSext(
SDNode *N,
2532 unsigned NVTBits = NVT.getSizeInBits();
2535 if (NVTBits < EVTBits) {
2538 EVTBits - NVTBits)));
2548 void DAGTypeLegalizer::ExpandIntRes_AssertZext(
SDNode *N,
2554 unsigned NVTBits = NVT.getSizeInBits();
2557 if (NVTBits < EVTBits) {
2560 EVTBits - NVTBits)));
2568 void DAGTypeLegalizer::ExpandIntRes_BITREVERSE(
SDNode *N,
2576 void DAGTypeLegalizer::ExpandIntRes_BSWAP(
SDNode *N,
2584 void DAGTypeLegalizer::ExpandIntRes_Constant(
SDNode *N,
2588 auto Constant = cast<ConstantSDNode>(
N);
2590 bool IsTarget =
Constant->isTargetOpcode();
2591 bool IsOpaque =
Constant->isOpaque();
2593 Lo = DAG.
getConstant(Cst.trunc(NBitWidth), dl, NVT, IsTarget, IsOpaque);
2594 Hi = DAG.
getConstant(Cst.lshr(NBitWidth).trunc(NBitWidth), dl, NVT, IsTarget,
2607 SplitInteger(Neg, NegLo, NegHi);
2609 GetExpandedInteger(N0, Lo, Hi);
2613 Lo = DAG.
getSelect(dl, NVT, HiIsNeg, NegLo, Lo);
2614 Hi = DAG.
getSelect(dl, NVT, HiIsNeg, NegHi, Hi);
2617 void DAGTypeLegalizer::ExpandIntRes_CTLZ(
SDNode *N,
2630 Lo = DAG.
getSelect(dl, NVT, HiNotZero, HiLZ,
2637 void DAGTypeLegalizer::ExpandIntRes_CTPOP(
SDNode *N,
2648 void DAGTypeLegalizer::ExpandIntRes_CTTZ(
SDNode *N,
2661 Lo = DAG.
getSelect(dl, NVT, LoNotZero, LoLZ,
2668 void DAGTypeLegalizer::ExpandIntRes_FLT_ROUNDS(
SDNode *N,
SDValue &Lo,
2681 void DAGTypeLegalizer::ExpandIntRes_FP_TO_SINT(
SDNode *N,
SDValue &Lo,
2690 Op = GetPromotedFloat(Op);
2693 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected fp-to-sint conversion!");
2696 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, VT, Op,
2697 CallOptions, dl, Chain);
2698 SplitInteger(Tmp.first, Lo, Hi);
2701 ReplaceValueWith(
SDValue(N, 1), Tmp.second);
2704 void DAGTypeLegalizer::ExpandIntRes_FP_TO_UINT(
SDNode *N,
SDValue &Lo,
2713 Op = GetPromotedFloat(Op);
2716 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected fp-to-uint conversion!");
2718 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, VT, Op,
2719 CallOptions, dl, Chain);
2720 SplitInteger(Tmp.first, Lo, Hi);
2723 ReplaceValueWith(
SDValue(N, 1), Tmp.second);
2726 void DAGTypeLegalizer::ExpandIntRes_LLROUND_LLRINT(
SDNode *N,
SDValue &Lo,
2731 "Input type needs to be promoted!");
2739 LC = RTLIB::LLROUND_F32;
2741 LC = RTLIB::LLROUND_F64;
2743 LC = RTLIB::LLROUND_F80;
2745 LC = RTLIB::LLROUND_F128;
2747 LC = RTLIB::LLROUND_PPCF128;
2748 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected llround input type!");
2752 LC = RTLIB::LLRINT_F32;
2754 LC = RTLIB::LLRINT_F64;
2756 LC = RTLIB::LLRINT_F80;
2758 LC = RTLIB::LLRINT_F128;
2760 LC = RTLIB::LLRINT_PPCF128;
2761 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected llrint input type!");
2771 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, RetVT,
2772 Op, CallOptions, dl,
2774 SplitInteger(Tmp.first, Lo, Hi);
2777 ReplaceValueWith(
SDValue(N, 1), Tmp.second);
2780 void DAGTypeLegalizer::ExpandIntRes_LOAD(
LoadSDNode *N,
2798 ExpandRes_NormalLoad(N, Lo, Hi);
2820 Alignment, MMOFlags, AAInfo);
2845 unsigned ExcessBits =
2852 Hi = DAG.
getExtLoad(ExtType, dl, NVT, Ch, Ptr,
2854 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
2866 unsigned ExcessBits = (EBytes - IncrementSize)*8;
2872 Alignment, MMOFlags, AAInfo);
2880 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
2904 ReplaceValueWith(
SDValue(N, 1), Ch);
2907 void DAGTypeLegalizer::ExpandIntRes_Logical(
SDNode *N,
2911 GetExpandedInteger(N->
getOperand(0), LL, LH);
2912 GetExpandedInteger(N->
getOperand(1), RL, RH);
2917 void DAGTypeLegalizer::ExpandIntRes_MUL(
SDNode *N,
2924 GetExpandedInteger(N->
getOperand(0), LL, LH);
2925 GetExpandedInteger(N->
getOperand(1), RL, RH);
2935 LC = RTLIB::MUL_I16;
2937 LC = RTLIB::MUL_I32;
2939 LC = RTLIB::MUL_I64;
2941 LC = RTLIB::MUL_I128;
2949 unsigned HalfBits = Bits >> 1;
2994 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops, CallOptions, dl).first,
2998 void DAGTypeLegalizer::ExpandIntRes_READCYCLECOUNTER(
SDNode *N,
SDValue &Lo,
3009 void DAGTypeLegalizer::ExpandIntRes_ADDSUBSAT(
SDNode *N,
SDValue &Lo,
3012 SplitInteger(Result, Lo, Hi);
3020 void DAGTypeLegalizer::ExpandIntRes_MULFIX(
SDNode *N,
SDValue &Lo,
3039 EVT BoolVT = getSetCCResultType(VT);
3051 Result = DAG.
getSelect(dl, VT, ProdNeg, SatMax, SatMin);
3052 Result = DAG.
getSelect(dl, VT, Overflow, Result, Product);
3058 Result = DAG.
getSelect(dl, VT, Overflow, SatMax, Product);
3061 SplitInteger(Result, Lo, Hi);
3067 assert(Scale <= VTSize &&
"Scale can't be larger than the value type size.");
3071 GetExpandedInteger(LHS, LL, LH);
3072 GetExpandedInteger(RHS, RL, RH);
3076 if (!TLI.
expandMUL_LOHI(LoHiOp, VT, dl, LHS, RHS, Result, NVT, DAG,
3084 assert((VTSize == NVTSize * 2) &&
"Expected the new value type to be half " 3085 "the size of the current value type");
3107 uint64_t Part0 = Scale / NVTSize;
3108 if (Scale % NVTSize) {
3116 Hi = Result[Part0 + 1];
3124 if (Scale == VTSize)
3145 EVT BoolNVT = getSetCCResultType(NVT);
3148 if (Scale < NVTSize) {
3154 }
else if (Scale == NVTSize) {
3157 }
else if (Scale < VTSize) {
3165 "(and saturation can't happen with Scale==VTSize).");
3167 Hi = DAG.
getSelect(dl, NVT, SatMax, NVTNeg1, Hi);
3168 Lo = DAG.
getSelect(dl, NVT, SatMax, NVTNeg1, Lo);
3172 if (Scale < NVTSize) {
3177 unsigned OverflowBits = VTSize - Scale + 1;
3178 assert(OverflowBits <= VTSize && OverflowBits > NVTSize &&
3179 "Extent of overflow bits must start within HL");
3196 }
else if (Scale == NVTSize) {
3209 }
else if (Scale < VTSize) {
3212 unsigned OverflowBits = VTSize - Scale + 1;
3230 Lo = DAG.
getSelect(dl, NVT, SatMin, NVTZero, Lo);
3233 void DAGTypeLegalizer::ExpandIntRes_DIVFIX(
SDNode *N,
SDValue &Lo,
3237 SplitInteger(Res, Lo, Hi);
3240 void DAGTypeLegalizer::ExpandIntRes_SADDSUBO(
SDNode *Node,
3251 SplitInteger(Sum, Lo, Hi);
3279 ReplaceValueWith(
SDValue(Node, 1), Cmp);
3282 void DAGTypeLegalizer::ExpandIntRes_SDIV(
SDNode *N,
3296 LC = RTLIB::SDIV_I16;
3298 LC = RTLIB::SDIV_I32;
3300 LC = RTLIB::SDIV_I64;
3302 LC = RTLIB::SDIV_I128;
3303 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported SDIV!");
3307 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops, CallOptions, dl).first,
Lo,
Hi);
3310 void DAGTypeLegalizer::ExpandIntRes_Shift(
SDNode *N,
3318 return ExpandShiftByConstant(N, CN->getAPIntValue(),
Lo,
Hi);
3322 if (ExpandShiftWithKnownAmountBit(N, Lo, Hi))
3341 const bool LegalOrCustom =
3348 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
3358 "ShiftAmountTy is too small to cover the range of this type!");
3362 SDValue Ops[] = { LHSL, LHSH, ShiftOp };
3374 LC = RTLIB::SHL_I16;
3376 LC = RTLIB::SHL_I32;
3378 LC = RTLIB::SHL_I64;
3380 LC = RTLIB::SHL_I128;
3384 LC = RTLIB::SRL_I16;
3386 LC = RTLIB::SRL_I32;
3388 LC = RTLIB::SRL_I64;
3390 LC = RTLIB::SRL_I128;
3395 LC = RTLIB::SRA_I16;
3397 LC = RTLIB::SRA_I32;
3399 LC = RTLIB::SRA_I64;
3401 LC = RTLIB::SRA_I128;
3407 CallOptions.
setSExt(isSigned);
3408 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops, CallOptions, dl).first,
Lo,
Hi);
3412 if (!ExpandShiftWithUnknownAmountBit(N, Lo, Hi))
3416 void DAGTypeLegalizer::ExpandIntRes_SIGN_EXTEND(
SDNode *N,
3434 "Only know how to promote this result!");
3435 SDValue Res = GetPromotedInteger(Op);
3437 "Operand over promoted?");
3439 SplitInteger(Res, Lo, Hi);
3447 void DAGTypeLegalizer::
3473 void DAGTypeLegalizer::ExpandIntRes_SREM(
SDNode *N,
3487 LC = RTLIB::SREM_I16;
3489 LC = RTLIB::SREM_I32;
3491 LC = RTLIB::SREM_I64;
3493 LC = RTLIB::SREM_I128;
3494 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported SREM!");
3498 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops, CallOptions, dl).first,
Lo,
Hi);
3501 void DAGTypeLegalizer::ExpandIntRes_TRUNCATE(
SDNode *N,
3513 void DAGTypeLegalizer::ExpandIntRes_XMULO(
SDNode *N,
3532 SDValue LHSHigh, LHSLow, RHSHigh, RHSLow;
3533 SplitInteger(LHS, LHSLow, LHSHigh);
3534 SplitInteger(RHS, RHSLow, RHSHigh);
3567 SplitInteger(Five, Lo, Hi);
3568 ReplaceValueWith(
SDValue(N, 1), Overflow);
3579 LC = RTLIB::MULO_I32;
3581 LC = RTLIB::MULO_I64;
3583 LC = RTLIB::MULO_I128;
3584 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported XMULO!");
3593 TargetLowering::ArgListEntry
Entry;
3595 EVT ArgVT =
Op.getValueType();
3599 Entry.IsSExt =
true;
3600 Entry.IsZExt =
false;
3601 Args.push_back(Entry);
3607 Entry.IsSExt =
true;
3608 Entry.IsZExt =
false;
3609 Args.push_back(Entry);
3621 SplitInteger(CallInfo.first, Lo, Hi);
3628 ReplaceValueWith(
SDValue(N, 1), Ofl);
3631 void DAGTypeLegalizer::ExpandIntRes_UDIV(
SDNode *N,
3645 LC = RTLIB::UDIV_I16;
3647 LC = RTLIB::UDIV_I32;
3649 LC = RTLIB::UDIV_I64;
3651 LC = RTLIB::UDIV_I128;
3652 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported UDIV!");
3655 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops, CallOptions, dl).first,
Lo,
Hi);
3658 void DAGTypeLegalizer::ExpandIntRes_UREM(
SDNode *N,
3672 LC = RTLIB::UREM_I16;
3674 LC = RTLIB::UREM_I32;
3676 LC = RTLIB::UREM_I64;
3678 LC = RTLIB::UREM_I128;
3679 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported UREM!");
3682 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops, CallOptions, dl).first,
Lo,
Hi);
3685 void DAGTypeLegalizer::ExpandIntRes_ZERO_EXTEND(
SDNode *N,
3699 "Only know how to promote this result!");
3700 SDValue Res = GetPromotedInteger(Op);
3702 "Operand over promoted?");
3704 SplitInteger(Res, Lo, Hi);
3712 void DAGTypeLegalizer::ExpandIntRes_ATOMIC_LOAD(
SDNode *N,
3715 EVT VT = cast<AtomicSDNode>(
N)->getMemoryVT();
3720 cast<AtomicSDNode>(N)->getMemoryVT(), VTs, N->
getOperand(0),
3721 N->
getOperand(1), Zero, Zero, cast<AtomicSDNode>(
N)->getMemOperand());
3727 void DAGTypeLegalizer::ExpandIntRes_VECREDUCE(
SDNode *N,
3732 SplitInteger(Res, Lo, Hi);
3743 bool DAGTypeLegalizer::ExpandIntegerOperand(
SDNode *N,
unsigned OpNo) {
3754 dbgs() <<
"ExpandIntegerOperand Op #" << OpNo <<
": ";
3760 case ISD::BR_CC: Res = ExpandIntOp_BR_CC(N);
break;
3766 case ISD::SETCC: Res = ExpandIntOp_SETCC(N);
break;
3770 case ISD::STORE: Res = ExpandIntOp_STORE(cast<StoreSDNode>(N), OpNo);
break;
3779 case ISD::ROTR: Res = ExpandIntOp_Shift(N);
break;
3787 if (!Res.getNode())
return false;
3791 if (Res.getNode() ==
N)
3795 "Invalid operand expansion");
3797 ReplaceValueWith(
SDValue(N, 0), Res);
3803 void DAGTypeLegalizer::IntegerExpandSetCCOperands(
SDValue &NewLHS,
3807 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
3808 GetExpandedInteger(NewLHS, LHSLo, LHSHi);
3809 GetExpandedInteger(NewRHS, RHSLo, RHSHi);
3812 if (RHSLo == RHSHi) {
3814 if (RHSCST->isAllOnesValue()) {
3834 if ((CCCode ==
ISD::SETLT && CST->isNullValue()) ||
3835 (CCCode ==
ISD::SETGT && CST->isAllOnesValue())) {
3867 RHSLo, LowCC,
false, DagCombineInfo, dl);
3874 RHSHi, CCCode,
false, DagCombineInfo, dl);
3886 if ((EqAllowed && (HiCmpC && HiCmpC->isNullValue())) ||
3887 (!EqAllowed && ((HiCmpC && (HiCmpC->getAPIntValue() == 1)) ||
3897 if (LHSHi == RHSHi) {
3910 if (HasSETCCCARRY) {
3913 bool FlipOperands =
false;
3941 false, DagCombineInfo, dl);
3952 IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
3967 SDValue DAGTypeLegalizer::ExpandIntOp_SELECT_CC(
SDNode *N) {
3970 IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
3988 IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
3993 "Unexpected setcc expansion!");
4002 SDValue DAGTypeLegalizer::ExpandIntOp_SETCCCARRY(
SDNode *N) {
4009 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
4010 GetExpandedInteger(LHS, LHSLo, LHSHi);
4011 GetExpandedInteger(RHS, RHSLo, RHSHi);
4029 SDValue DAGTypeLegalizer::ExpandIntOp_RETURNADDR(
SDNode *N) {
4038 SDValue DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP(
SDNode *N) {
4044 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
4045 "Don't know how to expand this SINT_TO_FP!");
4048 std::pair<SDValue, SDValue> Tmp =
4054 ReplaceValueWith(
SDValue(N, 1), Tmp.second);
4055 ReplaceValueWith(
SDValue(N, 0), Tmp.first);
4071 return ExpandOp_NormalStore(N, OpNo);
4074 assert(OpNo == 1 &&
"Can only expand the stored value so far");
4101 unsigned ExcessBits =
4110 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
4121 unsigned ExcessBits = (EBytes - IncrementSize)*8;
4123 ExtVT.getSizeInBits() - ExcessBits);
4147 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
4153 GetExpandedInteger(N->
getOperand(0), InL, InH);
4158 SDValue DAGTypeLegalizer::ExpandIntOp_UINT_TO_FP(
SDNode *N) {
4164 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
4165 "Don't know how to expand this UINT_TO_FP!");
4168 std::pair<SDValue, SDValue> Tmp =
4174 ReplaceValueWith(
SDValue(N, 1), Tmp.second);
4175 ReplaceValueWith(
SDValue(N, 0), Tmp.first);
4179 SDValue DAGTypeLegalizer::ExpandIntOp_ATOMIC_STORE(
SDNode *N) {
4182 cast<AtomicSDNode>(N)->getMemoryVT(),
4185 cast<AtomicSDNode>(
N)->getMemOperand());
4190 SDValue DAGTypeLegalizer::PromoteIntRes_EXTRACT_SUBVECTOR(
SDNode *N) {
4194 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
4203 InOp0 = GetPromotedInteger(N->
getOperand(0));
4209 for (
unsigned i = 0; i != OutNumElems; ++i) {
4226 SDValue DAGTypeLegalizer::PromoteIntRes_VECTOR_SHUFFLE(
SDNode *N) {
4241 SDValue DAGTypeLegalizer::PromoteIntRes_BUILD_VECTOR(
SDNode *N) {
4244 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
4252 for (
unsigned i = 0; i != NumElems; ++i) {
4268 SDValue DAGTypeLegalizer::PromoteIntRes_SCALAR_TO_VECTOR(
SDNode *N) {
4273 "Input must be a scalar");
4277 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
4285 SDValue DAGTypeLegalizer::PromoteIntRes_SPLAT_VECTOR(
SDNode *N) {
4294 assert(NOutVT.
isVector() &&
"Type must be promoted to a vector type");
4302 SDValue DAGTypeLegalizer::PromoteIntRes_CONCAT_VECTORS(
SDNode *N) {
4307 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
4314 assert(NumElem * NumOperands == NumOutElem &&
4315 "Unexpected number of elements");
4319 for (
unsigned i = 0; i < NumOperands; ++i) {
4322 Op = GetPromotedInteger(Op);
4325 "Unexpected number of elements");
4327 for (
unsigned j = 0; j < NumElem; ++j) {
4338 SDValue DAGTypeLegalizer::PromoteIntRes_EXTEND_VECTOR_INREG(
SDNode *N) {
4341 assert(NVT.
isVector() &&
"This type must be promoted to a vector type");
4355 Promoted = SExtPromotedInteger(N->
getOperand(0));
4358 Promoted = ZExtPromotedInteger(N->
getOperand(0));
4361 Promoted = GetPromotedInteger(N->
getOperand(0));
4373 SDValue DAGTypeLegalizer::PromoteIntRes_INSERT_VECTOR_ELT(
SDNode *N) {
4376 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
4389 SDValue DAGTypeLegalizer::PromoteIntRes_VECREDUCE(
SDNode *N) {
4397 SDValue DAGTypeLegalizer::PromoteIntOp_EXTRACT_VECTOR_ELT(
SDNode *N) {
4411 SDValue DAGTypeLegalizer::PromoteIntOp_EXTRACT_SUBVECTOR(
SDNode *N) {
4421 SDValue DAGTypeLegalizer::PromoteIntOp_CONCAT_VECTORS(
SDNode *N) {
4431 for (
unsigned VecIdx = 0; VecIdx != NumElems; ++VecIdx) {
4436 for (
unsigned i=0; i<NumElem; ++i) {
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...
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
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.
static std::pair< ISD::CondCode, ISD::NodeType > getExpandedMinMaxOps(int Op)
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 ...
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
APInt sext(unsigned width) const
Sign extend to a new width.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
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.
BR_CC - Conditional branch.
This class represents lattice values for constants.
static MVT getVectorVT(MVT VT, unsigned NumElements)
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.
This structure is used to pass arguments to makeLibCall function.
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 ...
Libcall getSYNC(unsigned Opc, MVT VT)
Return the SYNC_FETCH_AND_* value for the given opcode and type, or UNKNOWN_LIBCALL if there is none...
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)
Carry-setting nodes for multiple precision addition and subtraction.
void push_back(const T &Elt)
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
APInt zext(unsigned width) const
Zero extend to a new width.
const SDValue & getValue() const
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
const SDValue & getBasePtr() const
const SDValue & getChain() const
SPLAT_VECTOR(VAL) - Returns a vector with the scalar value VAL duplicated in all lanes.
unsigned getAlignment() const
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
TypeSize getScalarValueSizeInBits() const
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
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.
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.
void reserve(size_type N)
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.
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...
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
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.
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
SDValue getExternalSymbol(const char *Sym, EVT VT)
Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
virtual bool shouldExpandShift(SelectionDAG &DAG, SDNode *N) const
Return true if SHIFT instructions should be expanded to SHIFT_PARTS instructions, and false if a libr...
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
SDValue SimplifySetCC(EVT VT, SDValue N0, SDValue N1, ISD::CondCode Cond, bool foldBooleans, DAGCombinerInfo &DCI, const SDLoc &dl) const
Try to simplify a setcc built with the specified operands and cc.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Shift and rotation operations.
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
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...
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
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...
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
RESULT = [US]MULFIX(LHS, RHS, SCALE) - Perform fixed point multiplication on 2 integers with the same...
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.
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
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.
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
This is an SDNode representing atomic operations.
bool expandMUL(SDNode *N, SDValue &Lo, SDValue &Hi, EVT HiLoVT, SelectionDAG &DAG, MulExpansionKind Kind, SDValue LL=SDValue(), SDValue LH=SDValue(), SDValue RL=SDValue(), SDValue RH=SDValue()) const
Expand a MUL into two nodes.
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.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only...
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
bool isUNINDEXEDStore(const SDNode *N)
Returns true if the specified node is an unindexed store.
const SDValue & getScale() const
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
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 getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
bool isLittleEndian() const
Layout endianness...
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
op_iterator op_begin() const
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
const SDValue & getMask() const
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, MachineMemOperand *MMO)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
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...
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits...
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.
EVT getTypeToExpandTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
const SDValue & getBasePtr() const
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
static SDValue earlyExpandDIVFIX(SDNode *N, SDValue LHS, SDValue RHS, unsigned Scale, const TargetLowering &TLI, SelectionDAG &DAG)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
The instances of the Type class are immutable: once they are created, they are never changed...
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
This is an important base class in LLVM.
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...
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Carry-using nodes for multiple precision addition and subtraction.
Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
const SDValue & getOffset() const
SDValue expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US][ADD|SUB]SAT.
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
const SDValue & getValue() const
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachineMemOperand *MMO)
Gets a node for an atomic cmpxchg op.
Bit counting operators with an undefined result for zero inputs.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
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...
std::vector< ArgListEntry > ArgListTy
const SDValue & getIndex() const
const SDValue & getBasePtr() const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
This structure contains all information that is necessary for lowering calls.
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.
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value...
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 isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
LegalizeAction
This enum indicates whether operations are valid for a target, and if not, what action should be used...
SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type...
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
SDValue expandVecReduce(SDNode *Node, SelectionDAG &DAG) const
Expand a VECREDUCE_* into an explicit calculation.
TokenFactor - This node takes multiple tokens as input and produces a single token result...
void dump() const
Dump this node, for debugging.
SDValue getMemBasePlusOffset(SDValue Base, int64_t Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
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.
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, but op #2 is a boolean indicating ...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const SDValue & getMask() const
bool isAtomic() const
Return true if the memory operation ordering is Unordered or higher.
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...
MakeLibCallOptions & setSExt(bool Value=true)
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
BRCOND - Conditional branch.
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.
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...
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachinePointerInfo getWithOffset(int64_t O) const
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
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.
Class for arbitrary precision integers.
bool isIndexSigned() const
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.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array...
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
Flags
Flags values. These may be or'd together.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
bool ugt(const APInt &RHS) const
Unsigned greater than comparison.
static bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT, AssumptionCache *AC)
Libcall getFPTOUINT(EVT OpVT, EVT RetVT)
getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
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.
bool intersects(const APInt &RHS) const
This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are...
Bitwise operators - logical and, logical or, logical xor.
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
static EVT getShiftAmountTyForConstant(EVT VT, const TargetLowering &TLI, SelectionDAG &DAG)
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 ...
bool expandMUL_LOHI(unsigned Opcode, EVT VT, SDLoc dl, SDValue LHS, SDValue RHS, SmallVectorImpl< SDValue > &Result, EVT HiLoVT, SelectionDAG &DAG, MulExpansionKind Kind, SDValue LL=SDValue(), SDValue LH=SDValue(), SDValue RL=SDValue(), SDValue RH=SDValue()) const
Expand a MUL or [US]MUL_LOHI of n-bit values into two or four nodes, respectively, each computing an n/2-bit part of the result.
Flags getFlags() const
Return the raw flags of the source value,.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 integers with the same bit width ...
const SDValue & getBasePtr() const
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
SDValue getValue(unsigned R) const
This class is used to represent an MSCATTER node.
unsigned getNumRegisters(LLVMContext &Context, EVT VT) const
Return the number of registers that this ValueType will eventually require.
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.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getCondCode(ISD::CondCode Cond)
Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
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
ArrayRef< int > getMask() const
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
Integer reductions may have a result type larger than the vector element type.
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...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
This class is used to represent an MGATHER node.
SDValue getValueType(EVT)
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, ArrayRef< SDValue > Ops, MakeLibCallOptions CallOptions, const SDLoc &dl, SDValue Chain=SDValue()) const
Returns a pair of (return value, chain).
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.
PREFETCH - This corresponds to a prefetch intrinsic.
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)
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.
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.
KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
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.
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
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...
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.
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
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...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL, bool LegalTypes=true) const
Carry-using nodes for multiple precision addition and subtraction.
const SDValue & getMask() const
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
This class is used to represent ISD::LOAD nodes.