27 #define DEBUG_TYPE "legalize-types"
49 void DAGTypeLegalizer::SoftenFloatResult(
SDNode *
N,
unsigned ResNo) {
50 DEBUG(
dbgs() <<
"Soften float result " << ResNo <<
": "; N->
dump(&DAG);
57 dbgs() <<
"SoftenFloatResult #" << ResNo <<
": ";
66 R = SoftenFloatRes_ConstantFP(cast<ConstantFPSDNode>(N));
69 R = SoftenFloatRes_EXTRACT_VECTOR_ELT(N);
break;
70 case ISD::FABS: R = SoftenFloatRes_FABS(N);
break;
73 case ISD::FADD: R = SoftenFloatRes_FADD(N);
break;
74 case ISD::FCEIL: R = SoftenFloatRes_FCEIL(N);
break;
76 case ISD::FCOS: R = SoftenFloatRes_FCOS(N);
break;
77 case ISD::FDIV: R = SoftenFloatRes_FDIV(N);
break;
78 case ISD::FEXP: R = SoftenFloatRes_FEXP(N);
break;
79 case ISD::FEXP2: R = SoftenFloatRes_FEXP2(N);
break;
80 case ISD::FFLOOR: R = SoftenFloatRes_FFLOOR(N);
break;
81 case ISD::FLOG: R = SoftenFloatRes_FLOG(N);
break;
82 case ISD::FLOG2: R = SoftenFloatRes_FLOG2(N);
break;
83 case ISD::FLOG10: R = SoftenFloatRes_FLOG10(N);
break;
84 case ISD::FMA: R = SoftenFloatRes_FMA(N);
break;
85 case ISD::FMUL: R = SoftenFloatRes_FMUL(N);
break;
87 case ISD::FNEG: R = SoftenFloatRes_FNEG(N);
break;
91 case ISD::FPOW: R = SoftenFloatRes_FPOW(N);
break;
92 case ISD::FPOWI: R = SoftenFloatRes_FPOWI(N);
break;
93 case ISD::FREM: R = SoftenFloatRes_FREM(N);
break;
94 case ISD::FRINT: R = SoftenFloatRes_FRINT(N);
break;
95 case ISD::FROUND: R = SoftenFloatRes_FROUND(N);
break;
96 case ISD::FSIN: R = SoftenFloatRes_FSIN(N);
break;
97 case ISD::FSQRT: R = SoftenFloatRes_FSQRT(N);
break;
98 case ISD::FSUB: R = SoftenFloatRes_FSUB(N);
break;
99 case ISD::FTRUNC: R = SoftenFloatRes_FTRUNC(N);
break;
100 case ISD::LOAD: R = SoftenFloatRes_LOAD(N);
break;
101 case ISD::SELECT: R = SoftenFloatRes_SELECT(N);
break;
105 case ISD::UNDEF: R = SoftenFloatRes_UNDEF(N);
break;
106 case ISD::VAARG: R = SoftenFloatRes_VAARG(N);
break;
111 SetSoftenedFloat(
SDValue(N, ResNo), R);
114 SDValue DAGTypeLegalizer::SoftenFloatRes_BITCAST(
SDNode *N) {
118 SDValue DAGTypeLegalizer::SoftenFloatRes_MERGE_VALUES(
SDNode *N,
120 SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
121 return BitConvertToInteger(Op);
124 SDValue DAGTypeLegalizer::SoftenFloatRes_BUILD_PAIR(
SDNode *N) {
139 SDValue DAGTypeLegalizer::SoftenFloatRes_EXTRACT_VECTOR_ELT(
SDNode *N) {
158 SDValue DAGTypeLegalizer::SoftenFloatRes_FMINNUM(
SDNode *N) {
168 NVT, Ops, 2,
false,
SDLoc(N)).first;
171 SDValue DAGTypeLegalizer::SoftenFloatRes_FMAXNUM(
SDNode *N) {
181 NVT, Ops, 2,
false,
SDLoc(N)).first;
194 NVT, Ops, 2,
false,
SDLoc(N)).first;
206 NVT, &Op, 1,
false,
SDLoc(N)).first;
209 SDValue DAGTypeLegalizer::SoftenFloatRes_FCOPYSIGN(
SDNode *N) {
215 EVT RVT = RHS.getValueType();
236 }
else if (SizeDiff < 0) {
266 NVT, &Op, 1,
false,
SDLoc(N)).first;
279 NVT, Ops, 2,
false,
SDLoc(N)).first;
291 NVT, &Op, 1,
false,
SDLoc(N)).first;
303 NVT, &Op, 1,
false,
SDLoc(N)).first;
315 NVT, &Op, 1,
false,
SDLoc(N)).first;
327 NVT, &Op, 1,
false,
SDLoc(N)).first;
339 NVT, &Op, 1,
false,
SDLoc(N)).first;
351 NVT, &Op, 1,
false,
SDLoc(N)).first;
365 NVT, Ops, 3,
false,
SDLoc(N)).first;
378 NVT, Ops, 2,
false,
SDLoc(N)).first;
381 SDValue DAGTypeLegalizer::SoftenFloatRes_FNEARBYINT(
SDNode *N) {
390 NVT, &Op, 1,
false,
SDLoc(N)).first;
405 NVT, Ops, 2,
false, dl).first;
408 SDValue DAGTypeLegalizer::SoftenFloatRes_FP_EXTEND(
SDNode *N) {
418 SoftenFloatResult(Op.
getNode(), 0);
423 Op = GetSoftenedFloat(Op);
430 SDValue DAGTypeLegalizer::SoftenFloatRes_FP16_TO_FP(
SDNode *N) {
434 false,
SDLoc(N)).first;
444 SDValue DAGTypeLegalizer::SoftenFloatRes_FP_ROUND(
SDNode *N) {
468 NVT, Ops, 2,
false,
SDLoc(N)).first;
473 "Unsupported power type!");
482 NVT, Ops, 2,
false,
SDLoc(N)).first;
495 NVT, Ops, 2,
false,
SDLoc(N)).first;
507 NVT, &Op, 1,
false,
SDLoc(N)).first;
519 NVT, &Op, 1,
false,
SDLoc(N)).first;
531 NVT, &Op, 1,
false,
SDLoc(N)).first;
543 NVT, &Op, 1,
false,
SDLoc(N)).first;
556 NVT, Ops, 2,
false,
SDLoc(N)).first;
571 NVT, &Op, 1,
false,
SDLoc(N)).first;
613 SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT_CC(
SDNode *N) {
643 SDValue DAGTypeLegalizer::SoftenFloatRes_XINT_TO_FP(
SDNode *N) {
668 &Op, 1, Signed, dl).first;
676 bool DAGTypeLegalizer::SoftenFloatOperand(
SDNode *N,
unsigned OpNo) {
677 DEBUG(
dbgs() <<
"Soften float operand " << OpNo <<
": "; N->
dump(&DAG);
684 dbgs() <<
"SoftenFloatOperand Op #" << OpNo <<
": ";
689 case ISD::BITCAST: Res = SoftenFloatOp_BITCAST(N);
break;
690 case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N);
break;
697 case ISD::SETCC: Res = SoftenFloatOp_SETCC(N);
break;
698 case ISD::STORE: Res = SoftenFloatOp_STORE(N, OpNo);
break;
702 if (!Res.getNode())
return false;
706 if (Res.getNode() ==
N)
710 "Invalid operand expansion");
712 ReplaceValueWith(
SDValue(N, 0), Res);
721 SDValue DAGTypeLegalizer::SoftenFloatOp_FP_EXTEND(
SDNode *N) {
737 SDValue DAGTypeLegalizer::SoftenFloatOp_FP_ROUND(
SDNode *N) {
758 NewLHS = GetSoftenedFloat(NewLHS);
759 NewRHS = GetSoftenedFloat(NewRHS);
764 if (!NewRHS.getNode()) {
776 SDValue DAGTypeLegalizer::SoftenFloatOp_FP_TO_SINT(
SDNode *N) {
784 SDValue DAGTypeLegalizer::SoftenFloatOp_FP_TO_UINT(
SDNode *N) {
792 SDValue DAGTypeLegalizer::SoftenFloatOp_SELECT_CC(
SDNode *N) {
797 NewLHS = GetSoftenedFloat(NewLHS);
798 NewRHS = GetSoftenedFloat(NewRHS);
803 if (!NewRHS.getNode()) {
820 NewLHS = GetSoftenedFloat(NewLHS);
821 NewRHS = GetSoftenedFloat(NewRHS);
825 if (!NewRHS.getNode()) {
827 "Unexpected setcc expansion!");
837 SDValue DAGTypeLegalizer::SoftenFloatOp_STORE(
SDNode *N,
unsigned OpNo) {
839 assert(OpNo == 1 &&
"Can only soften the stored value!");
849 Val = GetSoftenedFloat(Val);
864 void DAGTypeLegalizer::ExpandFloatResult(
SDNode *N,
unsigned ResNo) {
876 dbgs() <<
"ExpandFloatResult #" << ResNo <<
": ";
881 case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi);
break;
882 case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi);
break;
890 case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi);
break;
893 case ISD::FABS: ExpandFloatRes_FABS(N, Lo, Hi);
break;
894 case ISD::FMINNUM: ExpandFloatRes_FMINNUM(N, Lo, Hi);
break;
895 case ISD::FMAXNUM: ExpandFloatRes_FMAXNUM(N, Lo, Hi);
break;
896 case ISD::FADD: ExpandFloatRes_FADD(N, Lo, Hi);
break;
897 case ISD::FCEIL: ExpandFloatRes_FCEIL(N, Lo, Hi);
break;
899 case ISD::FCOS: ExpandFloatRes_FCOS(N, Lo, Hi);
break;
900 case ISD::FDIV: ExpandFloatRes_FDIV(N, Lo, Hi);
break;
901 case ISD::FEXP: ExpandFloatRes_FEXP(N, Lo, Hi);
break;
902 case ISD::FEXP2: ExpandFloatRes_FEXP2(N, Lo, Hi);
break;
903 case ISD::FFLOOR: ExpandFloatRes_FFLOOR(N, Lo, Hi);
break;
904 case ISD::FLOG: ExpandFloatRes_FLOG(N, Lo, Hi);
break;
905 case ISD::FLOG2: ExpandFloatRes_FLOG2(N, Lo, Hi);
break;
906 case ISD::FLOG10: ExpandFloatRes_FLOG10(N, Lo, Hi);
break;
907 case ISD::FMA: ExpandFloatRes_FMA(N, Lo, Hi);
break;
908 case ISD::FMUL: ExpandFloatRes_FMUL(N, Lo, Hi);
break;
910 case ISD::FNEG: ExpandFloatRes_FNEG(N, Lo, Hi);
break;
912 case ISD::FPOW: ExpandFloatRes_FPOW(N, Lo, Hi);
break;
913 case ISD::FPOWI: ExpandFloatRes_FPOWI(N, Lo, Hi);
break;
914 case ISD::FRINT: ExpandFloatRes_FRINT(N, Lo, Hi);
break;
915 case ISD::FROUND: ExpandFloatRes_FROUND(N, Lo, Hi);
break;
916 case ISD::FSIN: ExpandFloatRes_FSIN(N, Lo, Hi);
break;
917 case ISD::FSQRT: ExpandFloatRes_FSQRT(N, Lo, Hi);
break;
918 case ISD::FSUB: ExpandFloatRes_FSUB(N, Lo, Hi);
break;
919 case ISD::FTRUNC: ExpandFloatRes_FTRUNC(N, Lo, Hi);
break;
920 case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi);
break;
923 case ISD::FREM: ExpandFloatRes_FREM(N, Lo, Hi);
break;
931 void DAGTypeLegalizer::ExpandFloatRes_ConstantFP(
SDNode *N,
SDValue &Lo,
935 "Do not know how to expand this float constant!");
936 APInt C = cast<ConstantFPSDNode>(
N)->getValueAPF().bitcastToAPInt();
946 void DAGTypeLegalizer::ExpandFloatRes_FABS(
SDNode *N,
SDValue &Lo,
949 "Logic only correct for ppcf128!");
960 void DAGTypeLegalizer::ExpandFloatRes_FMINNUM(
SDNode *N,
SDValue &Lo,
967 GetPairElements(Call, Lo, Hi);
970 void DAGTypeLegalizer::ExpandFloatRes_FMAXNUM(
SDNode *N,
SDValue &Lo,
977 GetPairElements(Call, Lo, Hi);
980 void DAGTypeLegalizer::ExpandFloatRes_FADD(
SDNode *N,
SDValue &Lo,
987 GetPairElements(Call, Lo, Hi);
990 void DAGTypeLegalizer::ExpandFloatRes_FCEIL(
SDNode *N,
997 GetPairElements(Call, Lo, Hi);
1000 void DAGTypeLegalizer::ExpandFloatRes_FCOPYSIGN(
SDNode *N,
1009 GetPairElements(Call, Lo, Hi);
1012 void DAGTypeLegalizer::ExpandFloatRes_FCOS(
SDNode *N,
1019 GetPairElements(Call, Lo, Hi);
1022 void DAGTypeLegalizer::ExpandFloatRes_FDIV(
SDNode *N,
SDValue &Lo,
1033 GetPairElements(Call, Lo, Hi);
1036 void DAGTypeLegalizer::ExpandFloatRes_FEXP(
SDNode *N,
1043 GetPairElements(Call, Lo, Hi);
1046 void DAGTypeLegalizer::ExpandFloatRes_FEXP2(
SDNode *N,
1053 GetPairElements(Call, Lo, Hi);
1056 void DAGTypeLegalizer::ExpandFloatRes_FFLOOR(
SDNode *N,
1063 GetPairElements(Call, Lo, Hi);
1066 void DAGTypeLegalizer::ExpandFloatRes_FLOG(
SDNode *N,
1073 GetPairElements(Call, Lo, Hi);
1076 void DAGTypeLegalizer::ExpandFloatRes_FLOG2(
SDNode *N,
1083 GetPairElements(Call, Lo, Hi);
1086 void DAGTypeLegalizer::ExpandFloatRes_FLOG10(
SDNode *N,
1093 GetPairElements(Call, Lo, Hi);
1096 void DAGTypeLegalizer::ExpandFloatRes_FMA(
SDNode *N,
SDValue &Lo,
1107 GetPairElements(Call, Lo, Hi);
1110 void DAGTypeLegalizer::ExpandFloatRes_FMUL(
SDNode *N,
SDValue &Lo,
1121 GetPairElements(Call, Lo, Hi);
1124 void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(
SDNode *N,
1133 GetPairElements(Call, Lo, Hi);
1136 void DAGTypeLegalizer::ExpandFloatRes_FNEG(
SDNode *N,
SDValue &Lo,
1144 void DAGTypeLegalizer::ExpandFloatRes_FP_EXTEND(
SDNode *N,
SDValue &Lo,
1153 void DAGTypeLegalizer::ExpandFloatRes_FPOW(
SDNode *N,
1160 GetPairElements(Call, Lo, Hi);
1163 void DAGTypeLegalizer::ExpandFloatRes_FPOWI(
SDNode *N,
1170 GetPairElements(Call, Lo, Hi);
1173 void DAGTypeLegalizer::ExpandFloatRes_FREM(
SDNode *N,
1180 GetPairElements(Call, Lo, Hi);
1183 void DAGTypeLegalizer::ExpandFloatRes_FRINT(
SDNode *N,
1190 GetPairElements(Call, Lo, Hi);
1193 void DAGTypeLegalizer::ExpandFloatRes_FROUND(
SDNode *N,
1202 GetPairElements(Call, Lo, Hi);
1205 void DAGTypeLegalizer::ExpandFloatRes_FSIN(
SDNode *N,
1212 GetPairElements(Call, Lo, Hi);
1215 void DAGTypeLegalizer::ExpandFloatRes_FSQRT(
SDNode *N,
1222 GetPairElements(Call, Lo, Hi);
1225 void DAGTypeLegalizer::ExpandFloatRes_FSUB(
SDNode *N,
SDValue &Lo,
1236 GetPairElements(Call, Lo, Hi);
1239 void DAGTypeLegalizer::ExpandFloatRes_FTRUNC(
SDNode *N,
1246 GetPairElements(Call, Lo, Hi);
1249 void DAGTypeLegalizer::ExpandFloatRes_LOAD(
SDNode *N,
SDValue &Lo,
1252 ExpandRes_NormalLoad(N, Lo, Hi);
1263 assert(NVT.
isByteSized() &&
"Expanded type not byte sized!");
1274 APInt(NVT.getSizeInBits(), 0)), dl, NVT);
1278 ReplaceValueWith(
SDValue(LD, 1), Chain);
1281 void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(
SDNode *N,
SDValue &Lo,
1313 Hi = TLI.
makeLibCall(DAG, LC, VT, &Src, 1,
true, dl).first;
1314 GetPairElements(Hi, Lo, Hi);
1325 static const uint64_t TwoE32[] = { 0x41f0000000000000LL, 0 };
1326 static const uint64_t TwoE64[] = { 0x43f0000000000000LL, 0 };
1327 static const uint64_t TwoE128[] = { 0x47f0000000000000LL, 0 };
1350 GetPairElements(Lo, Lo, Hi);
1362 bool DAGTypeLegalizer::ExpandFloatOperand(
SDNode *N,
unsigned OpNo) {
1373 dbgs() <<
"ExpandFloatOperand Op #" << OpNo <<
": ";
1382 case ISD::BR_CC: Res = ExpandFloatOp_BR_CC(N);
break;
1388 case ISD::SETCC: Res = ExpandFloatOp_SETCC(N);
break;
1389 case ISD::STORE: Res = ExpandFloatOp_STORE(cast<StoreSDNode>(N),
1394 if (!Res.getNode())
return false;
1398 if (Res.getNode() ==
N)
1402 "Invalid operand expansion");
1404 ReplaceValueWith(
SDValue(N, 0), Res);
1410 void DAGTypeLegalizer::FloatExpandSetCCOperands(
SDValue &NewLHS,
1414 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
1415 GetExpandedFloat(NewLHS, LHSLo, LHSHi);
1416 GetExpandedFloat(NewRHS, RHSLo, RHSHi);
1429 LHSLo, RHSLo, CCCode);
1434 LHSHi, RHSHi, CCCode);
1436 NewLHS = DAG.
getNode(
ISD::OR, dl, Tmp1.getValueType(), Tmp1, Tmp3);
1443 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
1458 SDValue DAGTypeLegalizer::ExpandFloatOp_FCOPYSIGN(
SDNode *N) {
1460 "Logic only correct for ppcf128!");
1469 SDValue DAGTypeLegalizer::ExpandFloatOp_FP_ROUND(
SDNode *N) {
1471 "Logic only correct for ppcf128!");
1479 SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_SINT(
SDNode *N) {
1487 "Logic only correct for ppcf128!");
1500 SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_UINT(
SDNode *N) {
1508 "Logic only correct for ppcf128!");
1509 const uint64_t TwoE31[] = {0x41e0000000000000LL, 0};
1534 SDValue DAGTypeLegalizer::ExpandFloatOp_SELECT_CC(
SDNode *N) {
1537 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
1555 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(N));
1560 "Unexpected setcc expansion!");
1569 SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(
SDNode *N,
unsigned OpNo) {
1571 return ExpandOp_NormalStore(N, OpNo);
1574 assert(OpNo == 1 &&
"Can only expand the stored value so far");
1582 assert(NVT.
isByteSized() &&
"Expanded type not byte sized!");
1608 bool DAGTypeLegalizer::PromoteFloatOperand(
SDNode *N,
unsigned OpNo) {
1620 case ISD::BITCAST: R = PromoteFloatOp_BITCAST(N, OpNo);
break;
1621 case ISD::FCOPYSIGN: R = PromoteFloatOp_FCOPYSIGN(N, OpNo);
break;
1624 case ISD::FP_EXTEND: R = PromoteFloatOp_FP_EXTEND(N, OpNo);
break;
1625 case ISD::SELECT_CC: R = PromoteFloatOp_SELECT_CC(N, OpNo);
break;
1626 case ISD::SETCC: R = PromoteFloatOp_SETCC(N, OpNo);
break;
1627 case ISD::STORE: R = PromoteFloatOp_STORE(N, OpNo);
break;
1631 ReplaceValueWith(
SDValue(N, 0), R);
1635 SDValue DAGTypeLegalizer::PromoteFloatOp_BITCAST(
SDNode *N,
unsigned OpNo) {
1640 assert (IVT == N->
getValueType(0) &&
"Bitcast to type of different size");
1643 EVT PromotedVT = Promoted->getValueType(0);
1652 SDValue DAGTypeLegalizer::PromoteFloatOp_FCOPYSIGN(
SDNode *N,
unsigned OpNo) {
1653 assert (OpNo == 1 &&
"Only Operand 1 must need promotion here");
1661 SDValue DAGTypeLegalizer::PromoteFloatOp_FP_TO_XINT(
SDNode *N,
unsigned OpNo) {
1666 SDValue DAGTypeLegalizer::PromoteFloatOp_FP_EXTEND(
SDNode *N,
unsigned OpNo) {
1681 SDValue DAGTypeLegalizer::PromoteFloatOp_SELECT_CC(
SDNode *N,
unsigned OpNo) {
1692 SDValue DAGTypeLegalizer::PromoteFloatOp_SETCC(
SDNode *N,
unsigned OpNo) {
1705 SDValue DAGTypeLegalizer::PromoteFloatOp_STORE(
SDNode *N,
unsigned OpNo) {
1710 SDValue Promoted = GetPromotedFloat(Val);
1726 void DAGTypeLegalizer::PromoteFloatResult(
SDNode *N,
unsigned ResNo) {
1737 case ISD::BITCAST: R = PromoteFloatRes_BITCAST(N);
break;
1740 R = PromoteFloatRes_EXTRACT_VECTOR_ELT(N);
break;
1759 case ISD::FTRUNC: R = PromoteFloatRes_UnaryOp(N);
break;
1769 case ISD::FSUB: R = PromoteFloatRes_BinOp(N);
break;
1772 case ISD::FMAD: R = PromoteFloatRes_FMAD(N);
break;
1774 case ISD::FPOWI: R = PromoteFloatRes_FPOWI(N);
break;
1777 case ISD::LOAD: R = PromoteFloatRes_LOAD(N);
break;
1778 case ISD::SELECT: R = PromoteFloatRes_SELECT(N);
break;
1783 case ISD::UNDEF: R = PromoteFloatRes_UNDEF(N);
break;
1788 SetPromotedFloat(
SDValue(N, ResNo), R);
1796 SDValue DAGTypeLegalizer::PromoteFloatRes_BITCAST(
SDNode *N) {
1803 SDValue DAGTypeLegalizer::PromoteFloatRes_ConstantFP(
SDNode *N) {
1824 SDValue DAGTypeLegalizer::PromoteFloatRes_EXTRACT_VECTOR_ELT(
SDNode *N) {
1835 uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
1837 switch (getTypeAction(VecVT)) {
1841 ReplaceValueWith(
SDValue(N, 0), Res);
1845 Vec = GetWidenedVector(Vec);
1847 ReplaceValueWith(
SDValue(N, 0), Res);
1852 GetSplitVector(Vec, Lo, Hi);
1856 if (IdxVal < LoElts)
1862 ReplaceValueWith(
SDValue(N, 0), Res);
1886 SDValue DAGTypeLegalizer::PromoteFloatRes_FCOPYSIGN(
SDNode *N) {
1899 SDValue DAGTypeLegalizer::PromoteFloatRes_UnaryOp(
SDNode *N) {
1910 SDValue DAGTypeLegalizer::PromoteFloatRes_BinOp(
SDNode *N) {
1930 SDValue DAGTypeLegalizer::PromoteFloatRes_FPOWI(
SDNode *N) {
1941 SDValue DAGTypeLegalizer::PromoteFloatRes_FP_ROUND(
SDNode *N) {
1977 SDValue DAGTypeLegalizer::PromoteFloatRes_SELECT(
SDNode *N) {
1987 SDValue DAGTypeLegalizer::PromoteFloatRes_SELECT_CC(
SDNode *N) {
1998 SDValue DAGTypeLegalizer::PromoteFloatRes_XINT_TO_FP(
SDNode *N) {
2004 SDValue DAGTypeLegalizer::PromoteFloatRes_UNDEF(
SDNode *N) {
SDValue getTruncStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT TVT, bool isNonTemporal, bool isVolatile, unsigned Alignment, const AAMDNodes &AAInfo=AAMDNodes())
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 ...
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.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
LLVMContext * getContext() const
void dump() const
Dump this node, for debugging.
BR_CC - Conditional branch.
SDValue getVAArg(EVT VT, 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...
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.
SDValue getSelectCC(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 getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, bool isInvariant, unsigned Alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
const SDValue & getOperand(unsigned Num) const
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...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, unsigned Alignment, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
Shift and rotation operations.
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, const SDValue *Ops, unsigned NumOps, bool isSigned, SDLoc dl, bool doesNotReturn=false, bool isReturnValueUsed=true) const
Returns a pair of (return value, chain).
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
bool bitsGE(EVT VT) const
bitsGE - Return true if this has no less bits than VT.
EVT getVectorElementType() const
getVectorElementType - 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.
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
bitsLE - 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...
SDNode * getNode() const
get the SDNode which holds the desired result
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
Simple binary floating point operators.
bool isNonTemporal() const
const unsigned int integerPartWidth
Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
const SDValue & getValue() const
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, bool isVolatile, bool isNonTemporal, bool isInvariant, unsigned Alignment, const AAMDNodes &AAInfo=AAMDNodes())
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
EVT - Extended Value 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.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
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...
static const fltSemantics PPCDoubleDouble
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.
Select(COND, TRUEVAL, FALSEVAL).
ZERO_EXTEND - Used for integer types, zeroing the new bits.
APInt bitcastToAPInt() const
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
ANY_EXTEND - Used for integer types. The high bits are undefined.
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
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.
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
void clearBit(unsigned bitPosition)
Set a given bit to 0.
EVT getValueType() const
Return the ValueType of the referenced return 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 getConstant(uint64_t Val, SDLoc DL, EVT VT, bool isTarget=false, bool isOpaque=false)
bool isByteSized() const
isByteSized - Return true if the bit size is a multiple of 8.
SDValue getSelect(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...
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 getValueType(EVT)
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.
SDValue getConstantFP(double Val, SDLoc DL, EVT VT, bool isTarget=false)
SDValue getSetCC(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...
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)
getIntegerVT - Returns the EVT that represents an integer with the given number of bits...
static ISD::NodeType GetPromotionOpcode(EVT OpVT, EVT RetVT)
MVT getSimpleVT() const
getSimpleVT - Return the SimpleValueType held in the specified simple EVT.
SDValue getIntPtrConstant(uint64_t Val, SDLoc DL, bool isTarget=false)
unsigned getVectorNumElements() const
getVectorNumElements - Given a vector type, return the number of elements it contains.
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, SDLoc DL) const
SoftenSetCCOperands - Soften the operands of a comparison.
This class is used to represent ISD::LOAD nodes.