28 #define DEBUG_TYPE "legalize-types"
38 void DAGTypeLegalizer::PromoteIntegerResult(
SDNode *
N,
unsigned ResNo) {
49 dbgs() <<
"PromoteIntegerResult #" << ResNo <<
": ";
56 case ISD::BITCAST: Res = PromoteIntRes_BITCAST(N);
break;
58 case ISD::BSWAP: Res = PromoteIntRes_BSWAP(N);
break;
62 case ISD::CTLZ: Res = PromoteIntRes_CTLZ(N);
break;
63 case ISD::CTPOP: Res = PromoteIntRes_CTPOP(N);
break;
65 case ISD::CTTZ: Res = PromoteIntRes_CTTZ(N);
break;
67 Res = PromoteIntRes_EXTRACT_VECTOR_ELT(N);
break;
68 case ISD::LOAD: Res = PromoteIntRes_LOAD(cast<LoadSDNode>(N));
break;
69 case ISD::MLOAD: Res = PromoteIntRes_MLOAD(cast<MaskedLoadSDNode>(N));
71 case ISD::MGATHER: Res = PromoteIntRes_MGATHER(cast<MaskedGatherSDNode>(N));
73 case ISD::SELECT: Res = PromoteIntRes_SELECT(N);
break;
74 case ISD::VSELECT: Res = PromoteIntRes_VSELECT(N);
break;
76 case ISD::SETCC: Res = PromoteIntRes_SETCC(N);
break;
78 case ISD::SMAX: Res = PromoteIntRes_SExtIntBinOp(N);
break;
80 case ISD::UMAX: Res = PromoteIntRes_ZExtIntBinOp(N);
break;
82 case ISD::SHL: Res = PromoteIntRes_SHL(N);
break;
84 Res = PromoteIntRes_SIGN_EXTEND_INREG(N);
break;
85 case ISD::SRA: Res = PromoteIntRes_SRA(N);
break;
86 case ISD::SRL: Res = PromoteIntRes_SRL(N);
break;
88 case ISD::UNDEF: Res = PromoteIntRes_UNDEF(N);
break;
89 case ISD::VAARG: Res = PromoteIntRes_VAARG(N);
break;
92 Res = PromoteIntRes_EXTRACT_SUBVECTOR(N);
break;
94 Res = PromoteIntRes_VECTOR_SHUFFLE(N);
break;
96 Res = PromoteIntRes_INSERT_VECTOR_ELT(N);
break;
98 Res = PromoteIntRes_BUILD_VECTOR(N);
break;
100 Res = PromoteIntRes_SCALAR_TO_VECTOR(N);
break;
102 Res = PromoteIntRes_CONCAT_VECTORS(N);
break;
107 Res = PromoteIntRes_EXTEND_VECTOR_INREG(N);
break;
123 case ISD::MUL: Res = PromoteIntRes_SimpleIntBinOp(N);
break;
126 case ISD::SREM: Res = PromoteIntRes_SExtIntBinOp(N);
break;
129 case ISD::UREM: Res = PromoteIntRes_ZExtIntBinOp(N);
break;
132 case ISD::SSUBO: Res = PromoteIntRes_SADDSUBO(N, ResNo);
break;
134 case ISD::USUBO: Res = PromoteIntRes_UADDSUBO(N, ResNo);
break;
136 case ISD::UMULO: Res = PromoteIntRes_XMULO(N, ResNo);
break;
139 case ISD::SUBCARRY: Res = PromoteIntRes_ADDSUBCARRY(N, ResNo);
break;
142 Res = PromoteIntRes_Atomic0(cast<AtomicSDNode>(N));
break;
155 Res = PromoteIntRes_Atomic1(cast<AtomicSDNode>(N));
break;
159 Res = PromoteIntRes_AtomicCmpSwap(cast<AtomicSDNode>(N), ResNo);
165 SetPromotedInteger(
SDValue(N, ResNo), Res);
170 SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
171 return GetPromotedInteger(Op);
181 SDValue DAGTypeLegalizer::PromoteIntRes_AssertZext(
SDNode *N) {
242 for (
unsigned i = 1, NumResults = N->
getNumValues(); i < NumResults; ++i)
255 switch (getTypeAction(InVT)) {
268 SDValue PromotedOp = GetPromotedFloat(InOp);
279 BitConvertToInteger(GetScalarizedVector(InOp)));
286 Lo = BitConvertToInteger(Lo);
287 Hi = BitConvertToInteger(Hi);
295 JoinIntegers(Lo, Hi));
307 CreateStackStoreLoad(InOp, OutVT));
323 SDValue DAGTypeLegalizer::PromoteIntRes_BITREVERSE(
SDNode *N) {
336 SDValue DAGTypeLegalizer::PromoteIntRes_BUILD_PAIR(
SDNode *N) {
345 SDValue DAGTypeLegalizer::PromoteIntRes_Constant(
SDNode *N) {
355 assert(isa<ConstantSDNode>(Result) &&
"Didn't constant fold ext?");
389 OVT.getScalarSizeInBits());
395 SDValue DAGTypeLegalizer::PromoteIntRes_EXTRACT_VECTOR_ELT(
SDNode *N) {
402 SDValue DAGTypeLegalizer::PromoteIntRes_FP_TO_XINT(
SDNode *N) {
430 SDValue DAGTypeLegalizer::PromoteIntRes_FP_TO_FP16(
SDNode *N) {
437 SDValue DAGTypeLegalizer::PromoteIntRes_INT_EXTEND(
SDNode *N) {
498 "Gather result type and the passThru agrument type should be the same");
513 SDValue DAGTypeLegalizer::PromoteIntRes_Overflow(
SDNode *N) {
519 assert(NumOps <= 3 &&
"Too many operands");
528 ReplaceValueWith(
SDValue(N, 0), Res);
533 SDValue DAGTypeLegalizer::PromoteIntRes_SADDSUBO(
SDNode *N,
unsigned ResNo) {
535 return PromoteIntRes_Overflow(N);
557 ReplaceValueWith(
SDValue(N, 1), Ofl);
574 Mask = PromoteTargetBoolean(Mask, OpTy);
581 SDValue DAGTypeLegalizer::PromoteIntRes_SELECT_CC(
SDNode *N) {
601 "Vector compare must return a vector result!");
607 !LHS.getValueType().isVector())
608 LHS = GetPromotedInteger(LHS);
611 RHS = GetPromotedInteger(RHS);
626 LHS = GetPromotedInteger(LHS);
628 RHS = ZExtPromotedInteger(RHS);
632 SDValue DAGTypeLegalizer::PromoteIntRes_SIGN_EXTEND_INREG(
SDNode *N) {
638 SDValue DAGTypeLegalizer::PromoteIntRes_SimpleIntBinOp(
SDNode *N) {
648 SDValue DAGTypeLegalizer::PromoteIntRes_SExtIntBinOp(
SDNode *N) {
656 SDValue DAGTypeLegalizer::PromoteIntRes_ZExtIntBinOp(
SDNode *N) {
669 LHS = SExtPromotedInteger(LHS);
671 RHS = ZExtPromotedInteger(RHS);
680 LHS = ZExtPromotedInteger(LHS);
682 RHS = ZExtPromotedInteger(RHS);
686 SDValue DAGTypeLegalizer::PromoteIntRes_TRUNCATE(
SDNode *N) {
699 Res = GetPromotedInteger(InOp);
706 "Dst and Src must have the same number of elements");
708 "Promoted vector type must be a power of two");
711 GetSplitVector(InOp, EOp1, EOp2);
721 SDValue WideInOp = GetWidenedVector(InOp);
745 SDValue DAGTypeLegalizer::PromoteIntRes_UADDSUBO(
SDNode *N,
unsigned ResNo) {
747 return PromoteIntRes_Overflow(N);
768 ReplaceValueWith(
SDValue(N, 1), Ofl);
773 SDValue DAGTypeLegalizer::PromoteIntRes_ADDSUBCARRY(
SDNode *N,
unsigned ResNo) {
775 return PromoteIntRes_Overflow(N);
779 SDValue DAGTypeLegalizer::PromoteIntRes_XMULO(
SDNode *N,
unsigned ResNo) {
782 return PromoteIntRes_Overflow(N);
793 LHS = SExtPromotedInteger(LHS);
794 RHS = SExtPromotedInteger(RHS);
796 LHS = ZExtPromotedInteger(LHS);
797 RHS = ZExtPromotedInteger(RHS);
827 ReplaceValueWith(
SDValue(N, 1), Overflow);
847 for (
unsigned i = 0; i < NumRegs; ++i) {
860 for (
unsigned i = 1; i < NumRegs; ++i) {
871 ReplaceValueWith(
SDValue(N, 1), Chain);
884 bool DAGTypeLegalizer::PromoteIntegerOperand(
SDNode *N,
unsigned OpNo) {
894 dbgs() <<
"PromoteIntegerOperand Op #" << OpNo <<
": ";
901 Res = PromoteIntOp_ATOMIC_STORE(cast<AtomicSDNode>(N));
903 case ISD::BITCAST: Res = PromoteIntOp_BITCAST(N);
break;
904 case ISD::BR_CC: Res = PromoteIntOp_BR_CC(N, OpNo);
break;
905 case ISD::BRCOND: Res = PromoteIntOp_BRCOND(N, OpNo);
break;
911 Res = PromoteIntOp_INSERT_VECTOR_ELT(N, OpNo);
break;
913 Res = PromoteIntOp_SCALAR_TO_VECTOR(N);
break;
915 case ISD::SELECT: Res = PromoteIntOp_SELECT(N, OpNo);
break;
916 case ISD::SELECT_CC: Res = PromoteIntOp_SELECT_CC(N, OpNo);
break;
917 case ISD::SETCC: Res = PromoteIntOp_SETCC(N, OpNo);
break;
920 case ISD::STORE: Res = PromoteIntOp_STORE(cast<StoreSDNode>(N),
922 case ISD::MSTORE: Res = PromoteIntOp_MSTORE(cast<MaskedStoreSDNode>(N),
924 case ISD::MLOAD: Res = PromoteIntOp_MLOAD(cast<MaskedLoadSDNode>(N),
926 case ISD::MGATHER: Res = PromoteIntOp_MGATHER(cast<MaskedGatherSDNode>(N),
928 case ISD::MSCATTER: Res = PromoteIntOp_MSCATTER(cast<MaskedScatterSDNode>(N),
940 case ISD::ROTR: Res = PromoteIntOp_Shift(N);
break;
943 case ISD::SUBCARRY: Res = PromoteIntOp_ADDSUBCARRY(N, OpNo);
break;
947 if (!Res.getNode())
return false;
951 if (Res.getNode() ==
N)
955 "Invalid operand expansion");
957 ReplaceValueWith(
SDValue(N, 0), Res);
963 void DAGTypeLegalizer::PromoteSetCCOperands(
SDValue &NewLHS,
SDValue &NewRHS,
972 SDValue OpL = GetPromotedInteger(NewLHS);
973 SDValue OpR = GetPromotedInteger(NewRHS);
979 unsigned OpLEffectiveBits =
981 unsigned OpREffectiveBits =
988 NewLHS = ZExtPromotedInteger(NewLHS);
989 NewRHS = ZExtPromotedInteger(NewRHS);
1000 NewLHS = ZExtPromotedInteger(NewLHS);
1001 NewRHS = ZExtPromotedInteger(NewRHS);
1007 NewLHS = SExtPromotedInteger(NewLHS);
1008 NewRHS = SExtPromotedInteger(NewRHS);
1013 SDValue DAGTypeLegalizer::PromoteIntOp_ANY_EXTEND(
SDNode *N) {
1030 SDValue DAGTypeLegalizer::PromoteIntOp_BR_CC(
SDNode *N,
unsigned OpNo) {
1031 assert(OpNo == 2 &&
"Don't know how to promote this operand!");
1035 PromoteSetCCOperands(LHS, RHS, cast<CondCodeSDNode>(N->
getOperand(1))->
get());
1044 SDValue DAGTypeLegalizer::PromoteIntOp_BRCOND(
SDNode *N,
unsigned OpNo) {
1045 assert(OpNo == 1 &&
"only know how to promote condition");
1055 SDValue DAGTypeLegalizer::PromoteIntOp_BUILD_PAIR(
SDNode *N) {
1069 SDValue DAGTypeLegalizer::PromoteIntOp_BUILD_VECTOR(
SDNode *N) {
1076 "Legal vector of one illegal element?");
1083 "Type of inserted value narrower than vector element type!");
1086 for (
unsigned i = 0; i < NumElts; ++i)
1092 SDValue DAGTypeLegalizer::PromoteIntOp_INSERT_VECTOR_ELT(
SDNode *N,
1101 "Type of inserted value narrower than vector element type!");
1108 assert(OpNo == 2 &&
"Different operand and result vector types?");
1117 SDValue DAGTypeLegalizer::PromoteIntOp_SCALAR_TO_VECTOR(
SDNode *N) {
1124 SDValue DAGTypeLegalizer::PromoteIntOp_SELECT(
SDNode *N,
unsigned OpNo) {
1125 assert(OpNo == 0 &&
"Only know how to promote the condition!");
1130 if (
SDValue Res = WidenVSELECTAndMask(N))
1135 Cond = PromoteTargetBoolean(Cond, OpVT);
1141 SDValue DAGTypeLegalizer::PromoteIntOp_SELECT_CC(
SDNode *N,
unsigned OpNo) {
1142 assert(OpNo == 0 &&
"Don't know how to promote this operand!");
1146 PromoteSetCCOperands(LHS, RHS, cast<CondCodeSDNode>(N->
getOperand(4))->
get());
1153 SDValue DAGTypeLegalizer::PromoteIntOp_SETCC(
SDNode *N,
unsigned OpNo) {
1154 assert(OpNo == 0 &&
"Don't know how to promote this operand!");
1158 PromoteSetCCOperands(LHS, RHS, cast<CondCodeSDNode>(N->
getOperand(2))->
get());
1169 SDValue DAGTypeLegalizer::PromoteIntOp_SIGN_EXTEND(
SDNode *N) {
1177 SDValue DAGTypeLegalizer::PromoteIntOp_SINT_TO_FP(
SDNode *N) {
1202 bool TruncateStore =
false;
1210 Mask = PromoteTargetBoolean(Mask, DataVT);
1213 return PromoteIntOp_MSTORE(N, 3);
1216 return WidenVecOp_MSTORE(N, 3);
1220 return SplitVecOp_MSTORE(N, 3);
1224 assert(OpNo == 3 &&
"Unexpected operand for promotion");
1225 DataOp = GetPromotedInteger(DataOp);
1226 Mask = PromoteTargetBoolean(Mask, DataOp.
getValueType());
1227 TruncateStore =
true;
1237 assert(OpNo == 2 &&
"Only know how to promote the mask!");
1241 NewOps[OpNo] =
Mask;
1252 NewOps[OpNo] = PromoteTargetBoolean(N->
getOperand(OpNo), DataVT);
1254 NewOps[OpNo] = GetPromotedInteger(N->
getOperand(OpNo));
1258 if (Res.getNode() ==
N)
1272 NewOps[OpNo] = PromoteTargetBoolean(N->
getOperand(OpNo), DataVT);
1274 NewOps[OpNo] = GetPromotedInteger(N->
getOperand(OpNo));
1278 SDValue DAGTypeLegalizer::PromoteIntOp_TRUNCATE(
SDNode *N) {
1283 SDValue DAGTypeLegalizer::PromoteIntOp_UINT_TO_FP(
SDNode *N) {
1288 SDValue DAGTypeLegalizer::PromoteIntOp_ZERO_EXTEND(
SDNode *N) {
1296 SDValue DAGTypeLegalizer::PromoteIntOp_ADDSUBCARRY(
SDNode *N,
unsigned OpNo) {
1297 assert(OpNo == 2 &&
"Don't know how to promote this operand!");
1329 void DAGTypeLegalizer::ExpandIntegerResult(
SDNode *N,
unsigned ResNo) {
1341 dbgs() <<
"ExpandIntegerResult #" << ResNo <<
": ";
1344 llvm_unreachable(
"Do not know how to expand the result of this operator!");
1347 case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi);
break;
1349 case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi);
break;
1351 case ISD::BITCAST: ExpandRes_BITCAST(N, Lo, Hi);
break;
1355 case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi);
break;
1361 case ISD::BSWAP: ExpandIntRes_BSWAP(N, Lo, Hi);
break;
1362 case ISD::Constant: ExpandIntRes_Constant(N, Lo, Hi);
break;
1364 case ISD::CTLZ: ExpandIntRes_CTLZ(N, Lo, Hi);
break;
1365 case ISD::CTPOP: ExpandIntRes_CTPOP(N, Lo, Hi);
break;
1367 case ISD::CTTZ: ExpandIntRes_CTTZ(N, Lo, Hi);
break;
1371 case ISD::LOAD: ExpandIntRes_LOAD(cast<LoadSDNode>(N), Lo, Hi);
break;
1372 case ISD::MUL: ExpandIntRes_MUL(N, Lo, Hi);
break;
1374 case ISD::SDIV: ExpandIntRes_SDIV(N, Lo, Hi);
break;
1377 case ISD::SREM: ExpandIntRes_SREM(N, Lo, Hi);
break;
1378 case ISD::TRUNCATE: ExpandIntRes_TRUNCATE(N, Lo, Hi);
break;
1379 case ISD::UDIV: ExpandIntRes_UDIV(N, Lo, Hi);
break;
1380 case ISD::UREM: ExpandIntRes_UREM(N, Lo, Hi);
break;
1396 std::pair<SDValue, SDValue> Tmp = ExpandAtomic(N);
1397 SplitInteger(Tmp.first, Lo, Hi);
1398 ReplaceValueWith(
SDValue(N, 1), Tmp.second);
1415 SplitInteger(Tmp, Lo, Hi);
1416 ReplaceValueWith(
SDValue(N, 1), Success);
1423 case ISD::XOR: ExpandIntRes_Logical(N, Lo, Hi);
break;
1428 case ISD::SMIN: ExpandIntRes_MINMAX(N, Lo, Hi);
break;
1431 case ISD::SUB: ExpandIntRes_ADDSUB(N, Lo, Hi);
break;
1434 case ISD::SUBC: ExpandIntRes_ADDSUBC(N, Lo, Hi);
break;
1437 case ISD::SUBE: ExpandIntRes_ADDSUBE(N, Lo, Hi);
break;
1440 case ISD::SUBCARRY: ExpandIntRes_ADDSUBCARRY(N, Lo, Hi);
break;
1444 case ISD::SRL: ExpandIntRes_Shift(N, Lo, Hi);
break;
1447 case ISD::SSUBO: ExpandIntRes_SADDSUBO(N, Lo, Hi);
break;
1449 case ISD::USUBO: ExpandIntRes_UADDSUBO(N, Lo, Hi);
break;
1451 case ISD::SMULO: ExpandIntRes_XMULO(N, Lo, Hi);
break;
1460 std::pair <SDValue, SDValue> DAGTypeLegalizer::ExpandAtomic(
SDNode *Node) {
1466 return ExpandChainLibCall(LC, Node,
false);
1471 void DAGTypeLegalizer::ExpandShiftByConstant(
SDNode *N,
const APInt &Amt,
1476 GetExpandedInteger(N->
getOperand(0), InL, InH);
1492 if (Amt.
ugt(VTBits)) {
1494 }
else if (Amt.
ugt(NVTBits)) {
1498 }
else if (Amt == NVTBits) {
1513 if (Amt.
ugt(VTBits)) {
1515 }
else if (Amt.
ugt(NVTBits)) {
1519 }
else if (Amt == NVTBits) {
1534 if (Amt.
ugt(VTBits)) {
1537 }
else if (Amt.
ugt(NVTBits)) {
1542 }
else if (Amt == NVTBits) {
1560 bool DAGTypeLegalizer::
1568 "Expanded integer type size not a power of two!");
1576 if (((Known.
Zero|Known.
One) & HighBitMask) == 0)
1581 GetExpandedInteger(N->
getOperand(0), InL, InH);
1648 bool DAGTypeLegalizer::
1655 "Expanded integer type size not a power of two!");
1660 GetExpandedInteger(N->
getOperand(0), InL, InH);
1685 Lo = DAG.
getSelect(dl, NVT, isShort, LoS, LoL);
1686 Hi = DAG.
getSelect(dl, NVT, isZero, InH,
1687 DAG.
getSelect(dl, NVT, isShort, HiS, HiL));
1702 Lo = DAG.
getSelect(dl, NVT, isZero, InL,
1703 DAG.
getSelect(dl, NVT, isShort, LoS, LoL));
1704 Hi = DAG.
getSelect(dl, NVT, isShort, HiS, HiL);
1718 Lo = DAG.
getSelect(dl, NVT, isZero, InL,
1719 DAG.
getSelect(dl, NVT, isShort, LoS, LoL));
1720 Hi = DAG.
getSelect(dl, NVT, isShort, HiS, HiL);
1740 void DAGTypeLegalizer::ExpandIntRes_MINMAX(
SDNode *N,
1748 SDValue LHSL, LHSH, RHSL, RHSH;
1749 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
1750 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
1753 EVT NVT = LHSL.getValueType();
1754 EVT CCT = getSetCCResultType(NVT);
1770 Lo = DAG.
getSelect(
DL, NVT, IsHiEq, LoMinMax, LoCmp);
1773 void DAGTypeLegalizer::ExpandIntRes_ADDSUB(
SDNode *N,
1777 SDValue LHSL, LHSH, RHSL, RHSH;
1778 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
1779 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
1782 SDValue LoOps[2] = { LHSL, RHSL };
1783 SDValue HiOps[3] = { LHSH, RHSH };
1833 EVT OvfVT = getSetCCResultType(NVT);
1857 Hi = DAG.
getNode(RevOpc, dl, NVT, Hi, OVF);
1865 SDValue Cmp1 = DAG.
getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[0],
1877 SDValue Cmp2 = DAG.
getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[1],
1886 DAG.
getSetCC(dl, getSetCCResultType(LoOps[0].getValueType()),
1900 void DAGTypeLegalizer::ExpandIntRes_ADDSUBC(
SDNode *N,
1903 SDValue LHSL, LHSH, RHSL, RHSH;
1905 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
1906 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
1908 SDValue LoOps[2] = { LHSL, RHSL };
1909 SDValue HiOps[3] = { LHSH, RHSH };
1926 void DAGTypeLegalizer::ExpandIntRes_ADDSUBE(
SDNode *N,
1929 SDValue LHSL, LHSH, RHSL, RHSH;
1931 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
1932 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
1935 SDValue HiOps[3] = { LHSH, RHSH };
1946 void DAGTypeLegalizer::ExpandIntRes_UADDSUBO(
SDNode *N,
1960 SDValue LHSL, LHSH, RHSL, RHSH;
1961 GetExpandedInteger(LHS, LHSL, LHSH);
1962 GetExpandedInteger(RHS, RHSL, RHSH);
1964 SDValue LoOps[2] = { LHSL, RHSL };
1965 SDValue HiOps[3] = { LHSH, RHSH };
1970 Hi = DAG.
getNode(Opc, dl, VTList, HiOps);
1978 SplitInteger(Sum, Lo, Hi);
1988 ReplaceValueWith(
SDValue(N, 1), Ovf);
1991 void DAGTypeLegalizer::ExpandIntRes_ADDSUBCARRY(
SDNode *N,
1994 SDValue LHSL, LHSH, RHSL, RHSH;
1996 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
1997 GetExpandedInteger(N->
getOperand(1), RHSL, RHSH);
2011 void DAGTypeLegalizer::ExpandIntRes_ANY_EXTEND(
SDNode *N,
2025 "Only know how to promote this result!");
2026 SDValue Res = GetPromotedInteger(Op);
2028 "Operand over promoted?");
2030 SplitInteger(Res, Lo, Hi);
2034 void DAGTypeLegalizer::ExpandIntRes_AssertSext(
SDNode *N,
2040 unsigned NVTBits = NVT.getSizeInBits();
2043 if (NVTBits < EVTBits) {
2046 EVTBits - NVTBits)));
2056 void DAGTypeLegalizer::ExpandIntRes_AssertZext(
SDNode *N,
2061 EVT EVT = cast<VTSDNode>(N->
getOperand(1))->getVT();
2062 unsigned NVTBits = NVT.getSizeInBits();
2065 if (NVTBits < EVTBits) {
2068 EVTBits - NVTBits)));
2076 void DAGTypeLegalizer::ExpandIntRes_BITREVERSE(
SDNode *N,
2084 void DAGTypeLegalizer::ExpandIntRes_BSWAP(
SDNode *N,
2092 void DAGTypeLegalizer::ExpandIntRes_Constant(
SDNode *N,
2096 auto Constant = cast<ConstantSDNode>(
N);
2098 bool IsTarget =
Constant->isTargetOpcode();
2099 bool IsOpaque =
Constant->isOpaque();
2101 Lo = DAG.
getConstant(Cst.trunc(NBitWidth), dl, NVT, IsTarget, IsOpaque);
2102 Hi = DAG.
getConstant(Cst.lshr(NBitWidth).trunc(NBitWidth), dl, NVT, IsTarget,
2106 void DAGTypeLegalizer::ExpandIntRes_CTLZ(
SDNode *N,
2119 Lo = DAG.
getSelect(dl, NVT, HiNotZero, HiLZ,
2126 void DAGTypeLegalizer::ExpandIntRes_CTPOP(
SDNode *N,
2137 void DAGTypeLegalizer::ExpandIntRes_CTTZ(
SDNode *N,
2150 Lo = DAG.
getSelect(dl, NVT, LoNotZero, LoLZ,
2157 void DAGTypeLegalizer::ExpandIntRes_FLT_ROUNDS(
SDNode *N,
SDValue &Lo,
2170 void DAGTypeLegalizer::ExpandIntRes_FP_TO_SINT(
SDNode *N,
SDValue &Lo,
2177 Op = GetPromotedFloat(Op);
2181 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Op,
true, dl).first,
2185 void DAGTypeLegalizer::ExpandIntRes_FP_TO_UINT(
SDNode *N,
SDValue &Lo,
2192 Op = GetPromotedFloat(Op);
2196 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Op,
false, dl).first,
2200 void DAGTypeLegalizer::ExpandIntRes_LOAD(
LoadSDNode *N,
2203 ExpandRes_NormalLoad(N, Lo, Hi);
2225 Alignment, MMOFlags, AAInfo);
2250 unsigned ExcessBits =
2258 Hi = DAG.
getExtLoad(ExtType, dl, NVT, Ch, Ptr,
2260 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
2272 unsigned ExcessBits = (EBytes - IncrementSize)*8;
2278 Alignment, MMOFlags, AAInfo);
2287 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
2311 ReplaceValueWith(
SDValue(N, 1), Ch);
2314 void DAGTypeLegalizer::ExpandIntRes_Logical(
SDNode *N,
2318 GetExpandedInteger(N->
getOperand(0), LL, LH);
2319 GetExpandedInteger(N->
getOperand(1), RL, RH);
2324 void DAGTypeLegalizer::ExpandIntRes_MUL(
SDNode *N,
2331 GetExpandedInteger(N->
getOperand(0), LL, LH);
2332 GetExpandedInteger(N->
getOperand(1), RL, RH);
2356 unsigned HalfBits = Bits >> 1;
2399 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops,
true, dl).first,
2403 void DAGTypeLegalizer::ExpandIntRes_READCYCLECOUNTER(
SDNode *N,
SDValue &Lo,
2414 void DAGTypeLegalizer::ExpandIntRes_SADDSUBO(
SDNode *Node,
2425 SplitInteger(Sum, Lo, Hi);
2453 ReplaceValueWith(
SDValue(Node, 1), Cmp);
2456 void DAGTypeLegalizer::ExpandIntRes_SDIV(
SDNode *N,
2479 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops,
true, dl).first,
Lo,
Hi);
2482 void DAGTypeLegalizer::ExpandIntRes_Shift(
SDNode *N,
2490 return ExpandShiftByConstant(N, CN->getAPIntValue(),
Lo,
Hi);
2494 if (ExpandShiftWithKnownAmountBit(N, Lo, Hi))
2516 GetExpandedInteger(N->
getOperand(0), LHSL, LHSH);
2526 "ShiftAmountTy is too small to cover the range of this type!");
2530 SDValue Ops[] = { LHSL, LHSH, ShiftOp };
2574 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops, isSigned, dl).first,
Lo,
Hi);
2578 if (!ExpandShiftWithUnknownAmountBit(N, Lo, Hi))
2582 void DAGTypeLegalizer::ExpandIntRes_SIGN_EXTEND(
SDNode *N,
2600 "Only know how to promote this result!");
2601 SDValue Res = GetPromotedInteger(Op);
2603 "Operand over promoted?");
2605 SplitInteger(Res, Lo, Hi);
2613 void DAGTypeLegalizer::
2617 EVT EVT = cast<VTSDNode>(N->
getOperand(1))->getVT();
2639 void DAGTypeLegalizer::ExpandIntRes_SREM(
SDNode *N,
2662 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops,
true, dl).first,
Lo,
Hi);
2665 void DAGTypeLegalizer::ExpandIntRes_TRUNCATE(
SDNode *N,
2677 void DAGTypeLegalizer::ExpandIntRes_XMULO(
SDNode *N,
2687 SplitInteger(MUL, Lo, Hi);
2701 ReplaceValueWith(
SDValue(N, 1), Overflow);
2726 TargetLowering::ArgListEntry Entry;
2732 Entry.IsSExt =
true;
2733 Entry.IsZExt =
false;
2734 Args.push_back(Entry);
2740 Entry.IsSExt =
true;
2741 Entry.IsZExt =
false;
2742 Args.push_back(Entry);
2754 SplitInteger(CallInfo.first, Lo, Hi);
2761 ReplaceValueWith(
SDValue(N, 1), Ofl);
2764 void DAGTypeLegalizer::ExpandIntRes_UDIV(
SDNode *N,
2787 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops,
false, dl).first,
Lo,
Hi);
2790 void DAGTypeLegalizer::ExpandIntRes_UREM(
SDNode *N,
2813 SplitInteger(TLI.
makeLibCall(DAG, LC, VT, Ops,
false, dl).first,
Lo,
Hi);
2816 void DAGTypeLegalizer::ExpandIntRes_ZERO_EXTEND(
SDNode *N,
2830 "Only know how to promote this result!");
2831 SDValue Res = GetPromotedInteger(Op);
2833 "Operand over promoted?");
2835 SplitInteger(Res, Lo, Hi);
2843 void DAGTypeLegalizer::ExpandIntRes_ATOMIC_LOAD(
SDNode *N,
2846 EVT VT = cast<AtomicSDNode>(
N)->getMemoryVT();
2851 cast<AtomicSDNode>(N)->getMemoryVT(), VTs, N->
getOperand(0),
2866 bool DAGTypeLegalizer::ExpandIntegerOperand(
SDNode *N,
unsigned OpNo) {
2876 dbgs() <<
"ExpandIntegerOperand Op #" << OpNo <<
": ";
2882 case ISD::BR_CC: Res = ExpandIntOp_BR_CC(N);
break;
2888 case ISD::SETCC: Res = ExpandIntOp_SETCC(N);
break;
2889 case ISD::SETCCE: Res = ExpandIntOp_SETCCE(N);
break;
2892 case ISD::STORE: Res = ExpandIntOp_STORE(cast<StoreSDNode>(N), OpNo);
break;
2900 case ISD::ROTR: Res = ExpandIntOp_Shift(N);
break;
2908 if (!Res.getNode())
return false;
2912 if (Res.getNode() ==
N)
2916 "Invalid operand expansion");
2918 ReplaceValueWith(
SDValue(N, 0), Res);
2924 void DAGTypeLegalizer::IntegerExpandSetCCOperands(
SDValue &NewLHS,
2928 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
2929 GetExpandedInteger(NewLHS, LHSLo, LHSHi);
2930 GetExpandedInteger(NewRHS, RHSLo, RHSHi);
2933 if (RHSLo == RHSHi) {
2935 if (RHSCST->isAllOnesValue()) {
2955 if ((CCCode ==
ISD::SETLT && CST->isNullValue()) ||
2956 (CCCode ==
ISD::SETGT && CST->isAllOnesValue())) {
2988 RHSLo, LowCC,
false, DagCombineInfo, dl);
2995 RHSHi, CCCode,
false, DagCombineInfo, dl);
3007 if ((EqAllowed && (HiCmpC && HiCmpC->isNullValue())) ||
3008 (!EqAllowed && ((HiCmpC && (HiCmpC->getAPIntValue() == 1)) ||
3018 if (LHSHi == RHSHi) {
3031 if (HasSETCCCARRY ||
3035 bool FlipOperands =
false;
3053 LoVT, HasSETCCCARRY ? getSetCCResultType(LoVT) :
MVT::Glue);
3055 VTList, LHSLo, RHSLo);
3057 getSetCCResultType(HiVT), LHSHi, RHSHi,
3065 false, DagCombineInfo, dl);
3076 IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
3091 SDValue DAGTypeLegalizer::ExpandIntOp_SELECT_CC(
SDNode *N) {
3094 IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
3112 IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
3117 "Unexpected setcc expansion!");
3133 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
3134 GetExpandedInteger(LHS, LHSLo, LHSHi);
3135 GetExpandedInteger(RHS, RHSLo, RHSHi);
3144 SDValue DAGTypeLegalizer::ExpandIntOp_SETCCCARRY(
SDNode *N) {
3151 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
3152 GetExpandedInteger(LHS, LHSLo, LHSHi);
3153 GetExpandedInteger(RHS, RHSLo, RHSHi);
3171 SDValue DAGTypeLegalizer::ExpandIntOp_RETURNADDR(
SDNode *N) {
3180 SDValue DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP(
SDNode *N) {
3185 "Don't know how to expand this SINT_TO_FP!");
3191 return ExpandOp_NormalStore(N, OpNo);
3194 assert(OpNo == 1 &&
"Can only expand the stored value so far");
3221 unsigned ExcessBits =
3231 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
3240 unsigned EBytes = ExtVT.getStoreSize();
3242 unsigned ExcessBits = (EBytes - IncrementSize)*8;
3244 ExtVT.getSizeInBits() - ExcessBits);
3269 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
3275 GetExpandedInteger(N->
getOperand(0), InL, InH);
3280 SDValue DAGTypeLegalizer::ExpandIntOp_UINT_TO_FP(
SDNode *N) {
3300 const uint64_t F32TwoE32 = 0x4F800000ULL;
3301 const uint64_t F32TwoE64 = 0x5F800000ULL;
3302 const uint64_t F32TwoE128 = 0x7F800000ULL;
3306 FF =
APInt(32, F32TwoE32);
3308 FF =
APInt(32, F32TwoE64);
3310 FF =
APInt(32, F32TwoE128);
3316 GetExpandedInteger(Op, Lo, Hi);
3335 unsigned Alignment = cast<ConstantPoolSDNode>(FudgePtr)->
getAlignment();
3338 Alignment =
std::min(Alignment, 4u);
3352 "Don't know how to expand this UINT_TO_FP!");
3353 return TLI.
makeLibCall(DAG, LC, DstVT, Op,
true, dl).first;
3356 SDValue DAGTypeLegalizer::ExpandIntOp_ATOMIC_STORE(
SDNode *N) {
3359 cast<AtomicSDNode>(N)->getMemoryVT(),
3362 cast<AtomicSDNode>(
N)->getMemOperand());
3367 SDValue DAGTypeLegalizer::PromoteIntRes_EXTRACT_SUBVECTOR(
SDNode *N) {
3373 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
3382 for (
unsigned i = 0; i != OutNumElems; ++i) {
3399 SDValue DAGTypeLegalizer::PromoteIntRes_VECTOR_SHUFFLE(
SDNode *N) {
3414 SDValue DAGTypeLegalizer::PromoteIntRes_BUILD_VECTOR(
SDNode *N) {
3417 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
3425 for (
unsigned i = 0; i != NumElems; ++i) {
3441 SDValue DAGTypeLegalizer::PromoteIntRes_SCALAR_TO_VECTOR(
SDNode *N) {
3446 "Input must be a scalar");
3450 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
3458 SDValue DAGTypeLegalizer::PromoteIntRes_CONCAT_VECTORS(
SDNode *N) {
3463 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
3471 assert(NumElem * NumOperands == NumOutElem &&
3472 "Unexpected number of elements");
3476 for (
unsigned i = 0; i < NumOperands; ++i) {
3478 for (
unsigned j = 0; j < NumElem; ++j) {
3489 SDValue DAGTypeLegalizer::PromoteIntRes_EXTEND_VECTOR_INREG(
SDNode *N) {
3492 assert(NVT.
isVector() &&
"This type must be promoted to a vector type");
3506 Promoted = SExtPromotedInteger(N->
getOperand(0));
3509 Promoted = ZExtPromotedInteger(N->
getOperand(0));
3512 Promoted = GetPromotedInteger(N->
getOperand(0));
3524 SDValue DAGTypeLegalizer::PromoteIntRes_INSERT_VECTOR_ELT(
SDNode *N) {
3527 assert(NOutVT.
isVector() &&
"This type must be promoted to a vector type");
3540 SDValue DAGTypeLegalizer::PromoteIntOp_EXTRACT_VECTOR_ELT(
SDNode *N) {
3554 SDValue DAGTypeLegalizer::PromoteIntOp_EXTRACT_SUBVECTOR(
SDNode *N) {
3564 SDValue DAGTypeLegalizer::PromoteIntOp_CONCAT_VECTORS(
SDNode *N) {
3574 for (
unsigned VecIdx = 0; VecIdx != NumElems; ++VecIdx) {
3579 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...
void push_back(const T &Elt)
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
SDValue getValue(unsigned R) const
const SDValue & getValue() const
static std::pair< ISD::CondCode, ISD::NodeType > getExpandedMinMaxOps(int Op)
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.
Flags getFlags() const
Return the raw flags of the source value,.
LLVMContext * getContext() const
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
BR_CC - Conditional branch.
unsigned getNumRegisters(LLVMContext &Context, EVT VT) const
Return the number of registers that this ValueType will eventually require.
static MVT getVectorVT(MVT VT, unsigned NumElements)
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
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...
Carry-setting nodes for multiple precision addition and subtraction.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
const SDValue & getSrc0() const
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
unsigned getSizeInBits() const
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
unsigned getNumOperands() const
Return the number of values used by this operation.
EVT getTypeToExpandTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
const SDValue & getOperand(unsigned Num) const
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 ...
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT TVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
void reserve(size_type N)
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...
const SDValue & getBasePtr() const
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned char TargetFlags=0)
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.
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
SDValue getExternalSymbol(const char *Sym, EVT VT)
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
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...
bool isVector() const
Return true if this is a vector value type.
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
static uint32_t getAlignment(const MCSectionCOFF &Sec)
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.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
MachineFunction & getMachineFunction() const
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
MachinePointerInfo getWithOffset(int64_t O) const
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
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.
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.
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.
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 getVectorElementType() const
Given a vector type, return the type of each element.
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...
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
SDValue getMaskedGather(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO)
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
bool isUNINDEXEDStore(const SDNode *N)
Returns true if the specified node is an unindexed store.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
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.
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Simple integer binary arithmetic operators.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isLittleEndian() const
Layout endianness...
const SDValue & getBasePtr() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Mask, EVT MemVT, MachineMemOperand *MMO, bool IsTruncating=false, bool IsCompressing=false)
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
EVT getMemoryVT() const
Return the type of the in-memory value.
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 DataLayout & getDataLayout() const
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
const SDValue & getBasePtr() const
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.
SDNode * getNode() const
get the SDNode which holds the desired result
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getScalarSizeInBits() const
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
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.
bool intersects(const APInt &RHS) const
This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are...
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...
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
Simple binary floating point operators.
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...
This is an important base class in LLVM.
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...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Carry-using nodes for multiple precision addition and subtraction.
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
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.
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.
const SDValue & getBasePtr() const
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::LoadExtType, bool IsExpanding=false)
const SDValue & getValue() const
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...
std::vector< ArgListEntry > ArgListTy
const SDValue & getMask() const
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
This structure contains all information that is necessary for lowering calls.
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...
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, ArrayRef< SDValue > Ops, bool isSigned, const SDLoc &dl, bool doesNotReturn=false, bool isReturnValueUsed=true) const
Returns a pair of (return value, chain).
This class contains a discriminated union of information about pointers in memory operands...
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachinePointerInfo PtrInfo, unsigned Alignment, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID)
Gets a node for an atomic cmpxchg op.
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.
const MachinePointerInfo & getPointerInfo() const
bool isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
ArrayRef< int > getMask() const
bool ugt(const APInt &RHS) const
Unsigned greather than comparison.
LegalizeAction
This enum indicates whether operations are valid for a target, and if not, what action should be used...
TokenFactor - This node takes multiple tokens as input and produces a single token result...
void dump() const
Dump this node, for debugging.
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
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 ...
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.
BRCOND - Conditional branch.
const SDValue & getChain() const
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Represents one node in the SelectionDAG.
static unsigned int semanticsPrecision(const fltSemantics &)
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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.
const SDValue & getValue() const
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
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...
Class for arbitrary precision integers.
Select(COND, TRUEVAL, FALSEVAL).
op_iterator op_begin() const
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
iterator_range< value_op_iterator > op_values() const
Flags
Flags values. These may be or'd together.
llvm_unreachable("Unknown RegBank!")
const SDValue & getMask() const
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...
Bitwise operators - logical and, logical or, logical xor.
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
op_iterator op_end() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
This class is used to represent an MSCATTER node.
const SDValue & getIndex() const
static MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
EVT getValueType() const
Return the ValueType of the referenced return value.
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)
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, and op #2 is a carry value...
Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value *PtrVal, unsigned Alignment, AtomicOrdering Ordering, SyncScope::ID SSID)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
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...
bool isByteSized() const
Return true if the bit size is a multiple of 8.
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class is used to represent an MLOAD node.
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...
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
const SDValue & getBasePtr() const
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::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
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...
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
SetCC operator - This evaluates to a true value iff the condition is true.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
BooleanContent
Enum that describes how the target represents true/false values.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT SrcTy)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value...
TRUNCATE - Completely drop the high bits.
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL) const
unsigned getAlignment() const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const
This callback is invoked for operations that are unsupported by the target, which are registered to u...
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Carry-using nodes for multiple precision addition and subtraction.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
This class is used to represent ISD::LOAD nodes.