27 #define DEBUG_TYPE "legalize-types"
49 bool DAGTypeLegalizer::SoftenFloatResult(
SDNode *
N,
unsigned ResNo) {
50 DEBUG(
dbgs() <<
"Soften float result " << ResNo <<
": "; N->
dump(&DAG);
57 dbgs() <<
"SoftenFloatResult #" << ResNo <<
": ";
66 "Unsupported SoftenFloatRes opcode!");
71 case ISD::BITCAST: R = SoftenFloatRes_BITCAST(N, ResNo);
break;
75 R = SoftenFloatRes_EXTRACT_VECTOR_ELT(N, ResNo);
break;
76 case ISD::FABS: R = SoftenFloatRes_FABS(N, ResNo);
break;
79 case ISD::FADD: R = SoftenFloatRes_FADD(N);
break;
80 case ISD::FCEIL: R = SoftenFloatRes_FCEIL(N);
break;
81 case ISD::FCOPYSIGN: R = SoftenFloatRes_FCOPYSIGN(N, ResNo);
break;
82 case ISD::FCOS: R = SoftenFloatRes_FCOS(N);
break;
83 case ISD::FDIV: R = SoftenFloatRes_FDIV(N);
break;
84 case ISD::FEXP: R = SoftenFloatRes_FEXP(N);
break;
85 case ISD::FEXP2: R = SoftenFloatRes_FEXP2(N);
break;
86 case ISD::FFLOOR: R = SoftenFloatRes_FFLOOR(N);
break;
87 case ISD::FLOG: R = SoftenFloatRes_FLOG(N);
break;
88 case ISD::FLOG2: R = SoftenFloatRes_FLOG2(N);
break;
89 case ISD::FLOG10: R = SoftenFloatRes_FLOG10(N);
break;
90 case ISD::FMA: R = SoftenFloatRes_FMA(N);
break;
91 case ISD::FMUL: R = SoftenFloatRes_FMUL(N);
break;
93 case ISD::FNEG: R = SoftenFloatRes_FNEG(N, ResNo);
break;
97 case ISD::FPOW: R = SoftenFloatRes_FPOW(N);
break;
98 case ISD::FPOWI: R = SoftenFloatRes_FPOWI(N);
break;
99 case ISD::FREM: R = SoftenFloatRes_FREM(N);
break;
100 case ISD::FRINT: R = SoftenFloatRes_FRINT(N);
break;
101 case ISD::FROUND: R = SoftenFloatRes_FROUND(N);
break;
102 case ISD::FSIN: R = SoftenFloatRes_FSIN(N);
break;
103 case ISD::FSQRT: R = SoftenFloatRes_FSQRT(N);
break;
104 case ISD::FSUB: R = SoftenFloatRes_FSUB(N);
break;
105 case ISD::FTRUNC: R = SoftenFloatRes_FTRUNC(N);
break;
106 case ISD::LOAD: R = SoftenFloatRes_LOAD(N, ResNo);
break;
107 case ISD::SELECT: R = SoftenFloatRes_SELECT(N, ResNo);
break;
108 case ISD::SELECT_CC: R = SoftenFloatRes_SELECT_CC(N, ResNo);
break;
111 case ISD::UNDEF: R = SoftenFloatRes_UNDEF(N);
break;
112 case ISD::VAARG: R = SoftenFloatRes_VAARG(N);
break;
115 if (R.getNode() && R.getNode() !=
N) {
116 SetSoftenedFloat(
SDValue(N, ResNo), R);
126 SDValue DAGTypeLegalizer::SoftenFloatRes_BITCAST(
SDNode *N,
unsigned ResNo) {
132 SDValue DAGTypeLegalizer::SoftenFloatRes_MERGE_VALUES(
SDNode *N,
134 SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
135 return BitConvertToInteger(Op);
138 SDValue DAGTypeLegalizer::SoftenFloatRes_BUILD_PAIR(
SDNode *N) {
147 SDValue DAGTypeLegalizer::SoftenFloatRes_ConstantFP(
SDNode *N,
unsigned ResNo) {
163 APInt Val(128, words);
174 SDValue DAGTypeLegalizer::SoftenFloatRes_EXTRACT_VECTOR_ELT(
SDNode *N,
unsigned ResNo) {
184 SDValue DAGTypeLegalizer::SoftenFloatRes_FABS(
SDNode *N,
unsigned ResNo) {
199 SDValue DAGTypeLegalizer::SoftenFloatRes_FMINNUM(
SDNode *N) {
212 SDValue DAGTypeLegalizer::SoftenFloatRes_FMAXNUM(
SDNode *N) {
250 SDValue DAGTypeLegalizer::SoftenFloatRes_FCOPYSIGN(
SDNode *N,
unsigned ResNo) {
259 EVT RVT = RHS.getValueType();
280 }
else if (SizeDiff < 0) {
425 SDValue DAGTypeLegalizer::SoftenFloatRes_FNEARBYINT(
SDNode *N) {
437 SDValue DAGTypeLegalizer::SoftenFloatRes_FNEG(
SDNode *N,
unsigned ResNo) {
452 NVT, Ops,
false, dl).first;
455 SDValue DAGTypeLegalizer::SoftenFloatRes_FP_EXTEND(
SDNode *N) {
469 Op = GetPromotedFloat(Op);
473 return BitConvertToInteger(Op);
484 SDValue DAGTypeLegalizer::SoftenFloatRes_FP16_TO_FP(
SDNode *N) {
488 false,
SDLoc(N)).first;
498 SDValue DAGTypeLegalizer::SoftenFloatRes_FP_ROUND(
SDNode *N) {
527 "Unsupported power type!");
628 SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(
SDNode *N,
unsigned ResNo) {
629 bool LegalInHWReg = isLegalInHWReg(N->
getValueType(ResNo));
636 L->getMemOperand()->getFlags() &
640 NewL = DAG.
getLoad(L->getAddressingMode(), L->getExtensionType(), NVT, dl,
641 L->getChain(), L->getBasePtr(), L->getOffset(),
642 L->getPointerInfo(), NVT, L->getAlignment(), MMOFlags,
653 dl, L->getChain(), L->getBasePtr(), L->getOffset(),
654 L->getPointerInfo(), L->getMemoryVT(), L->getAlignment(),
655 MMOFlags, L->getAAInfo());
662 return BitConvertToInteger(ExtendNode);
665 SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT(
SDNode *N,
unsigned ResNo) {
674 SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT_CC(
SDNode *N,
unsigned ResNo) {
707 SDValue DAGTypeLegalizer::SoftenFloatRes_XINT_TO_FP(
SDNode *N) {
732 Op, Signed, dl).first;
740 bool DAGTypeLegalizer::SoftenFloatOperand(
SDNode *N,
unsigned OpNo) {
741 DEBUG(
dbgs() <<
"Soften float operand " << OpNo <<
": "; N->
dump(&DAG);
747 if (CanSkipSoftenFloatOperand(N, OpNo))
750 dbgs() <<
"SoftenFloatOperand Op #" << OpNo <<
": ";
755 case ISD::BITCAST: Res = SoftenFloatOp_BITCAST(N);
break;
757 case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N);
break;
758 case ISD::FABS: Res = SoftenFloatOp_FABS(N);
break;
760 case ISD::FNEG: Res = SoftenFloatOp_FNEG(N);
break;
766 case ISD::SELECT: Res = SoftenFloatOp_SELECT(N);
break;
768 case ISD::SETCC: Res = SoftenFloatOp_SETCC(N);
break;
770 Res = SoftenFloatOp_STORE(N, OpNo);
774 if (Res.getNode() == N &&
782 if (!Res.getNode())
return false;
786 if (Res.getNode() ==
N)
790 "Invalid operand expansion");
792 ReplaceValueWith(
SDValue(N, 0), Res);
796 bool DAGTypeLegalizer::CanSkipSoftenFloatOperand(
SDNode *N,
unsigned OpNo) {
831 SDValue DAGTypeLegalizer::SoftenFloatOp_COPY_TO_REG(
SDNode *N) {
846 SDValue DAGTypeLegalizer::SoftenFloatOp_FP_EXTEND(
SDNode *N) {
862 SDValue DAGTypeLegalizer::SoftenFloatOp_FP_ROUND(
SDNode *N) {
883 NewLHS = GetSoftenedFloat(NewLHS);
884 NewRHS = GetSoftenedFloat(NewRHS);
889 if (!NewRHS.getNode()) {
910 SDValue DAGTypeLegalizer::SoftenFloatOp_FCOPYSIGN(
SDNode *N) {
929 SDValue DAGTypeLegalizer::SoftenFloatOp_FP_TO_XINT(
SDNode *N) {
969 SDValue DAGTypeLegalizer::SoftenFloatOp_SELECT_CC(
SDNode *N) {
974 NewLHS = GetSoftenedFloat(NewLHS);
975 NewRHS = GetSoftenedFloat(NewRHS);
980 if (!NewRHS.getNode()) {
997 NewLHS = GetSoftenedFloat(NewLHS);
998 NewRHS = GetSoftenedFloat(NewRHS);
1002 if (!NewRHS.getNode()) {
1004 "Unexpected setcc expansion!");
1014 SDValue DAGTypeLegalizer::SoftenFloatOp_STORE(
SDNode *N,
unsigned OpNo) {
1016 assert(OpNo == 1 &&
"Can only soften the stored value!");
1026 Val = GetSoftenedFloat(Val);
1041 void DAGTypeLegalizer::ExpandFloatResult(
SDNode *N,
unsigned ResNo) {
1053 dbgs() <<
"ExpandFloatResult #" << ResNo <<
": ";
1056 llvm_unreachable(
"Do not know how to expand the result of this operator!");
1058 case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi);
break;
1059 case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi);
break;
1063 case ISD::BITCAST: ExpandRes_BITCAST(N, Lo, Hi);
break;
1067 case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi);
break;
1070 case ISD::FABS: ExpandFloatRes_FABS(N, Lo, Hi);
break;
1071 case ISD::FMINNUM: ExpandFloatRes_FMINNUM(N, Lo, Hi);
break;
1072 case ISD::FMAXNUM: ExpandFloatRes_FMAXNUM(N, Lo, Hi);
break;
1073 case ISD::FADD: ExpandFloatRes_FADD(N, Lo, Hi);
break;
1074 case ISD::FCEIL: ExpandFloatRes_FCEIL(N, Lo, Hi);
break;
1076 case ISD::FCOS: ExpandFloatRes_FCOS(N, Lo, Hi);
break;
1077 case ISD::FDIV: ExpandFloatRes_FDIV(N, Lo, Hi);
break;
1078 case ISD::FEXP: ExpandFloatRes_FEXP(N, Lo, Hi);
break;
1079 case ISD::FEXP2: ExpandFloatRes_FEXP2(N, Lo, Hi);
break;
1080 case ISD::FFLOOR: ExpandFloatRes_FFLOOR(N, Lo, Hi);
break;
1081 case ISD::FLOG: ExpandFloatRes_FLOG(N, Lo, Hi);
break;
1082 case ISD::FLOG2: ExpandFloatRes_FLOG2(N, Lo, Hi);
break;
1083 case ISD::FLOG10: ExpandFloatRes_FLOG10(N, Lo, Hi);
break;
1084 case ISD::FMA: ExpandFloatRes_FMA(N, Lo, Hi);
break;
1085 case ISD::FMUL: ExpandFloatRes_FMUL(N, Lo, Hi);
break;
1087 case ISD::FNEG: ExpandFloatRes_FNEG(N, Lo, Hi);
break;
1089 case ISD::FPOW: ExpandFloatRes_FPOW(N, Lo, Hi);
break;
1090 case ISD::FPOWI: ExpandFloatRes_FPOWI(N, Lo, Hi);
break;
1091 case ISD::FRINT: ExpandFloatRes_FRINT(N, Lo, Hi);
break;
1092 case ISD::FROUND: ExpandFloatRes_FROUND(N, Lo, Hi);
break;
1093 case ISD::FSIN: ExpandFloatRes_FSIN(N, Lo, Hi);
break;
1094 case ISD::FSQRT: ExpandFloatRes_FSQRT(N, Lo, Hi);
break;
1095 case ISD::FSUB: ExpandFloatRes_FSUB(N, Lo, Hi);
break;
1096 case ISD::FTRUNC: ExpandFloatRes_FTRUNC(N, Lo, Hi);
break;
1097 case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi);
break;
1100 case ISD::FREM: ExpandFloatRes_FREM(N, Lo, Hi);
break;
1108 void DAGTypeLegalizer::ExpandFloatRes_ConstantFP(
SDNode *N,
SDValue &Lo,
1112 "Do not know how to expand this float constant!");
1113 APInt C = cast<ConstantFPSDNode>(
N)->getValueAPF().bitcastToAPInt();
1116 APInt(64, C.getRawData()[1])),
1119 APInt(64, C.getRawData()[0])),
1123 void DAGTypeLegalizer::ExpandFloatRes_FABS(
SDNode *N,
SDValue &Lo,
1126 "Logic only correct for ppcf128!");
1137 void DAGTypeLegalizer::ExpandFloatRes_FMINNUM(
SDNode *N,
SDValue &Lo,
1144 GetPairElements(Call, Lo, Hi);
1147 void DAGTypeLegalizer::ExpandFloatRes_FMAXNUM(
SDNode *N,
SDValue &Lo,
1154 GetPairElements(Call, Lo, Hi);
1157 void DAGTypeLegalizer::ExpandFloatRes_FADD(
SDNode *N,
SDValue &Lo,
1164 GetPairElements(Call, Lo, Hi);
1167 void DAGTypeLegalizer::ExpandFloatRes_FCEIL(
SDNode *N,
1174 GetPairElements(Call, Lo, Hi);
1177 void DAGTypeLegalizer::ExpandFloatRes_FCOPYSIGN(
SDNode *N,
1186 GetPairElements(Call, Lo, Hi);
1189 void DAGTypeLegalizer::ExpandFloatRes_FCOS(
SDNode *N,
1196 GetPairElements(Call, Lo, Hi);
1199 void DAGTypeLegalizer::ExpandFloatRes_FDIV(
SDNode *N,
SDValue &Lo,
1210 GetPairElements(Call, Lo, Hi);
1213 void DAGTypeLegalizer::ExpandFloatRes_FEXP(
SDNode *N,
1220 GetPairElements(Call, Lo, Hi);
1223 void DAGTypeLegalizer::ExpandFloatRes_FEXP2(
SDNode *N,
1230 GetPairElements(Call, Lo, Hi);
1233 void DAGTypeLegalizer::ExpandFloatRes_FFLOOR(
SDNode *N,
1240 GetPairElements(Call, Lo, Hi);
1243 void DAGTypeLegalizer::ExpandFloatRes_FLOG(
SDNode *N,
1250 GetPairElements(Call, Lo, Hi);
1253 void DAGTypeLegalizer::ExpandFloatRes_FLOG2(
SDNode *N,
1260 GetPairElements(Call, Lo, Hi);
1263 void DAGTypeLegalizer::ExpandFloatRes_FLOG10(
SDNode *N,
1270 GetPairElements(Call, Lo, Hi);
1273 void DAGTypeLegalizer::ExpandFloatRes_FMA(
SDNode *N,
SDValue &Lo,
1284 GetPairElements(Call, Lo, Hi);
1287 void DAGTypeLegalizer::ExpandFloatRes_FMUL(
SDNode *N,
SDValue &Lo,
1298 GetPairElements(Call, Lo, Hi);
1301 void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(
SDNode *N,
1310 GetPairElements(Call, Lo, Hi);
1313 void DAGTypeLegalizer::ExpandFloatRes_FNEG(
SDNode *N,
SDValue &Lo,
1321 void DAGTypeLegalizer::ExpandFloatRes_FP_EXTEND(
SDNode *N,
SDValue &Lo,
1330 void DAGTypeLegalizer::ExpandFloatRes_FPOW(
SDNode *N,
1337 GetPairElements(Call, Lo, Hi);
1340 void DAGTypeLegalizer::ExpandFloatRes_FPOWI(
SDNode *N,
1347 GetPairElements(Call, Lo, Hi);
1350 void DAGTypeLegalizer::ExpandFloatRes_FREM(
SDNode *N,
1357 GetPairElements(Call, Lo, Hi);
1360 void DAGTypeLegalizer::ExpandFloatRes_FRINT(
SDNode *N,
1367 GetPairElements(Call, Lo, Hi);
1370 void DAGTypeLegalizer::ExpandFloatRes_FROUND(
SDNode *N,
1379 GetPairElements(Call, Lo, Hi);
1382 void DAGTypeLegalizer::ExpandFloatRes_FSIN(
SDNode *N,
1389 GetPairElements(Call, Lo, Hi);
1392 void DAGTypeLegalizer::ExpandFloatRes_FSQRT(
SDNode *N,
1399 GetPairElements(Call, Lo, Hi);
1402 void DAGTypeLegalizer::ExpandFloatRes_FSUB(
SDNode *N,
SDValue &Lo,
1413 GetPairElements(Call, Lo, Hi);
1416 void DAGTypeLegalizer::ExpandFloatRes_FTRUNC(
SDNode *N,
1423 GetPairElements(Call, Lo, Hi);
1426 void DAGTypeLegalizer::ExpandFloatRes_LOAD(
SDNode *N,
SDValue &Lo,
1429 ExpandRes_NormalLoad(N, Lo, Hi);
1451 APInt(NVT.getSizeInBits(), 0)), dl, NVT);
1455 ReplaceValueWith(
SDValue(LD, 1), Chain);
1458 void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(
SDNode *N,
SDValue &Lo,
1490 Hi = TLI.
makeLibCall(DAG, LC, VT, Src,
true, dl).first;
1491 GetPairElements(Hi, Lo, Hi);
1502 static const uint64_t TwoE32[] = { 0x41f0000000000000LL, 0 };
1503 static const uint64_t TwoE64[] = { 0x43f0000000000000LL, 0 };
1504 static const uint64_t TwoE128[] = { 0x47f0000000000000LL, 0 };
1528 GetPairElements(Lo, Lo, Hi);
1540 bool DAGTypeLegalizer::ExpandFloatOperand(
SDNode *N,
unsigned OpNo) {
1551 dbgs() <<
"ExpandFloatOperand Op #" << OpNo <<
": ";
1560 case ISD::BR_CC: Res = ExpandFloatOp_BR_CC(N);
break;
1566 case ISD::SETCC: Res = ExpandFloatOp_SETCC(N);
break;
1567 case ISD::STORE: Res = ExpandFloatOp_STORE(cast<StoreSDNode>(N),
1572 if (!Res.getNode())
return false;
1576 if (Res.getNode() ==
N)
1580 "Invalid operand expansion");
1582 ReplaceValueWith(
SDValue(N, 0), Res);
1588 void DAGTypeLegalizer::FloatExpandSetCCOperands(
SDValue &NewLHS,
1592 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
1593 GetExpandedFloat(NewLHS, LHSLo, LHSHi);
1594 GetExpandedFloat(NewRHS, RHSLo, RHSHi);
1607 LHSLo, RHSLo, CCCode);
1612 LHSHi, RHSHi, CCCode);
1614 NewLHS = DAG.
getNode(
ISD::OR, dl, Tmp1.getValueType(), Tmp1, Tmp3);
1621 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
1636 SDValue DAGTypeLegalizer::ExpandFloatOp_FCOPYSIGN(
SDNode *N) {
1638 "Logic only correct for ppcf128!");
1647 SDValue DAGTypeLegalizer::ExpandFloatOp_FP_ROUND(
SDNode *N) {
1649 "Logic only correct for ppcf128!");
1657 SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_SINT(
SDNode *N) {
1665 "Logic only correct for ppcf128!");
1678 SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_UINT(
SDNode *N) {
1686 "Logic only correct for ppcf128!");
1687 const uint64_t TwoE31[] = {0x41e0000000000000LL, 0};
1713 SDValue DAGTypeLegalizer::ExpandFloatOp_SELECT_CC(
SDNode *N) {
1716 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
1734 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
1739 "Unexpected setcc expansion!");
1748 SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(
SDNode *N,
unsigned OpNo) {
1750 return ExpandOp_NormalStore(N, OpNo);
1753 assert(OpNo == 1 &&
"Can only expand the stored value so far");
1787 bool DAGTypeLegalizer::PromoteFloatOperand(
SDNode *N,
unsigned OpNo) {
1799 case ISD::BITCAST: R = PromoteFloatOp_BITCAST(N, OpNo);
break;
1800 case ISD::FCOPYSIGN: R = PromoteFloatOp_FCOPYSIGN(N, OpNo);
break;
1803 case ISD::FP_EXTEND: R = PromoteFloatOp_FP_EXTEND(N, OpNo);
break;
1804 case ISD::SELECT_CC: R = PromoteFloatOp_SELECT_CC(N, OpNo);
break;
1805 case ISD::SETCC: R = PromoteFloatOp_SETCC(N, OpNo);
break;
1806 case ISD::STORE: R = PromoteFloatOp_STORE(N, OpNo);
break;
1810 ReplaceValueWith(
SDValue(N, 0), R);
1814 SDValue DAGTypeLegalizer::PromoteFloatOp_BITCAST(
SDNode *N,
unsigned OpNo) {
1822 EVT PromotedVT = Promoted->getValueType(0);
1831 SDValue DAGTypeLegalizer::PromoteFloatOp_FCOPYSIGN(
SDNode *N,
unsigned OpNo) {
1832 assert (OpNo == 1 &&
"Only Operand 1 must need promotion here");
1840 SDValue DAGTypeLegalizer::PromoteFloatOp_FP_TO_XINT(
SDNode *N,
unsigned OpNo) {
1845 SDValue DAGTypeLegalizer::PromoteFloatOp_FP_EXTEND(
SDNode *N,
unsigned OpNo) {
1860 SDValue DAGTypeLegalizer::PromoteFloatOp_SELECT_CC(
SDNode *N,
unsigned OpNo) {
1871 SDValue DAGTypeLegalizer::PromoteFloatOp_SETCC(
SDNode *N,
unsigned OpNo) {
1884 SDValue DAGTypeLegalizer::PromoteFloatOp_STORE(
SDNode *N,
unsigned OpNo) {
1889 SDValue Promoted = GetPromotedFloat(Val);
1905 void DAGTypeLegalizer::PromoteFloatResult(
SDNode *N,
unsigned ResNo) {
1916 case ISD::BITCAST: R = PromoteFloatRes_BITCAST(N);
break;
1919 R = PromoteFloatRes_EXTRACT_VECTOR_ELT(N);
break;
1938 case ISD::FTRUNC: R = PromoteFloatRes_UnaryOp(N);
break;
1950 case ISD::FSUB: R = PromoteFloatRes_BinOp(N);
break;
1953 case ISD::FMAD: R = PromoteFloatRes_FMAD(N);
break;
1955 case ISD::FPOWI: R = PromoteFloatRes_FPOWI(N);
break;
1958 case ISD::LOAD: R = PromoteFloatRes_LOAD(N);
break;
1959 case ISD::SELECT: R = PromoteFloatRes_SELECT(N);
break;
1964 case ISD::UNDEF: R = PromoteFloatRes_UNDEF(N);
break;
1969 SetPromotedFloat(
SDValue(N, ResNo), R);
1977 SDValue DAGTypeLegalizer::PromoteFloatRes_BITCAST(
SDNode *N) {
1984 SDValue DAGTypeLegalizer::PromoteFloatRes_ConstantFP(
SDNode *N) {
2005 SDValue DAGTypeLegalizer::PromoteFloatRes_EXTRACT_VECTOR_ELT(
SDNode *N) {
2016 uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
2018 switch (getTypeAction(VecVT)) {
2022 ReplaceValueWith(
SDValue(N, 0), Res);
2026 Vec = GetWidenedVector(Vec);
2028 ReplaceValueWith(
SDValue(N, 0), Res);
2033 GetSplitVector(Vec, Lo, Hi);
2037 if (IdxVal < LoElts)
2043 ReplaceValueWith(
SDValue(N, 0), Res);
2067 SDValue DAGTypeLegalizer::PromoteFloatRes_FCOPYSIGN(
SDNode *N) {
2080 SDValue DAGTypeLegalizer::PromoteFloatRes_UnaryOp(
SDNode *N) {
2091 SDValue DAGTypeLegalizer::PromoteFloatRes_BinOp(
SDNode *N) {
2110 SDValue DAGTypeLegalizer::PromoteFloatRes_FPOWI(
SDNode *N) {
2121 SDValue DAGTypeLegalizer::PromoteFloatRes_FP_ROUND(
SDNode *N) {
2159 SDValue DAGTypeLegalizer::PromoteFloatRes_SELECT(
SDNode *N) {
2169 SDValue DAGTypeLegalizer::PromoteFloatRes_SELECT_CC(
SDNode *N) {
2180 SDValue DAGTypeLegalizer::PromoteFloatRes_XINT_TO_FP(
SDNode *N) {
2191 SDValue DAGTypeLegalizer::PromoteFloatRes_UNDEF(
SDNode *N) {
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
SDValue getValue(unsigned R) const
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,.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
LLVMContext * getContext() const
DiagnosticInfoOptimizationBase::Argument NV
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...
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.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
unsigned getNumOperands() const
Return the number of values used by this operation.
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...
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())
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
const SDValue & getBasePtr() const
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.
Libcall getFPROUND(EVT OpVT, EVT RetVT)
getFPROUND - Return the FPROUND_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
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.
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
APInt bitcastToAPInt() const
The memory access is dereferenceable (i.e., doesn't trap).
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
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())
EVT getVectorElementType() const
Given a vector type, return the type of each element.
[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.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
void clearBit(unsigned BitPosition)
Set a given bit to 0.
Simple integer binary arithmetic operators.
const SDValue & getBasePtr() const
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...
EVT getMemoryVT() const
Return the type of the in-memory value.
static RTLIB::Libcall GetFPLibCall(EVT VT, RTLIB::Libcall Call_F32, RTLIB::Libcall Call_F64, RTLIB::Libcall Call_F80, RTLIB::Libcall Call_F128, RTLIB::Libcall Call_PPCF128)
GetFPLibCall - Return the right libcall for the given floating point type.
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.
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...
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL) const
Soften the operands of a comparison.
SDNode * getNode() const
get the SDNode which holds the desired result
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
Simple binary floating point operators.
const SDNodeFlags getFlags() const
Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
unsigned getOpcode() const
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.
const SDValue & getValue() const
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
const APFloat & getValueAPF() const
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
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).
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...
const MachinePointerInfo & getPointerInfo() const
bool isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
const SDValue & getOffset() const
Libcall getFPEXT(EVT OpVT, EVT RetVT)
getFPEXT - Return the FPEXT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
void dump() const
Dump this node, for debugging.
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.
X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and rounds it to a floating point val...
const SDValue & getChain() const
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...
Represents one node in the SelectionDAG.
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.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
Class for arbitrary precision integers.
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
Select(COND, TRUEVAL, FALSEVAL).
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
FMINNAN/FMAXNAN - Behave identically to FMINNUM/FMAXNUM, except that when a single input is NaN...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
static const fltSemantics & PPCDoubleDouble() LLVM_READNONE
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.
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
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.
The memory access always returns the same value (or traps).
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
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)
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...
bool isByteSized() const
Return true if the bit size is a multiple of 8.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
FMA - Perform a * b + c with no intermediate rounding step.
bool isTruncatingStore() const
Return true if the op does a truncation before store.
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
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.
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations...
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...
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...
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
static ISD::NodeType GetPromotionOpcode(EVT OpVT, EVT RetVT)
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
This class is used to represent ISD::LOAD nodes.