27#define DEBUG_TYPE "legalize-types"
39 VT == MVT::f32 ? Call_F32 :
40 VT == MVT::f64 ? Call_F64 :
41 VT == MVT::f80 ? Call_F80 :
42 VT == MVT::f128 ? Call_F128 :
43 VT == MVT::ppcf128 ? Call_PPCF128 :
44 RTLIB::UNKNOWN_LIBCALL;
51void DAGTypeLegalizer::SoftenFloatResult(
SDNode *
N,
unsigned ResNo) {
52 LLVM_DEBUG(
dbgs() <<
"Soften float result " << ResNo <<
": ";
N->dump(&DAG));
55 switch (
N->getOpcode()) {
59 dbgs() <<
"SoftenFloatResult #" << ResNo <<
": ";
60 N->dump(&DAG);
dbgs() <<
"\n";
71 R = SoftenFloatRes_EXTRACT_VECTOR_ELT(
N, ResNo);
break;
101 case ISD::FMA:
R = SoftenFloatRes_FMA(
N);
break;
162 SetSoftenedFloat(
SDValue(
N, ResNo), R);
167 bool IsStrict =
N->isStrictFPOpcode();
169 unsigned Offset = IsStrict ? 1 : 0;
171 "Unexpected number of operands!");
175 EVT OpVT =
N->getOperand(0 +
Offset).getValueType();
177 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, NVT,
Op,
181 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
186 bool IsStrict =
N->isStrictFPOpcode();
188 unsigned Offset = IsStrict ? 1 : 0;
190 "Unexpected number of operands!");
192 GetSoftenedFloat(
N->getOperand(1 +
Offset)) };
195 EVT OpsVT[2] = {
N->getOperand(0 +
Offset).getValueType(),
196 N->getOperand(1 +
Offset).getValueType() };
198 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, NVT, Ops,
202 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
207 return BitConvertToInteger(
N->getOperand(0));
213 GetSoftenedFloat(
N->getOperand(0)));
219 GetSoftenedFloat(
N->getOperand(0)));
225 SDValue Op = DisintegrateMERGE_VALUES(
N, ResNo);
226 return BitConvertToInteger(
Op);
234 BitConvertToInteger(
N->getOperand(0)),
235 BitConvertToInteger(
N->getOperand(1)));
251 APInt Val(128, words);
262SDValue DAGTypeLegalizer::SoftenFloatRes_EXTRACT_ELEMENT(
SDNode *
N) {
264 assert(Src.getValueType() == MVT::ppcf128 &&
265 "In floats only ppcf128 can be extracted by element!");
267 N->getValueType(0).changeTypeToInteger(),
271SDValue DAGTypeLegalizer::SoftenFloatRes_EXTRACT_VECTOR_ELT(
SDNode *
N,
unsigned ResNo) {
272 SDValue NewOp = BitConvertVectorToIntegerVector(
N->getOperand(0));
275 NewOp,
N->getOperand(1));
286 SDValue Op = GetSoftenedFloat(
N->getOperand(0));
292 return SoftenFloatRes_SELECT_CC(SelCC.getNode());
298 RTLIB::FMIN_PPCF128));
303 return SoftenFloatRes_SELECT_CC(SelCC.getNode());
309 RTLIB::FMAX_PPCF128));
318 RTLIB::ADD_PPCF128));
327 RTLIB::CBRT_PPCF128));
336 RTLIB::CEIL_PPCF128));
341 SDValue RHS = BitConvertToInteger(
N->getOperand(1));
344 EVT LVT =
LHS.getValueType();
345 EVT RVT =
RHS.getValueType();
366 }
else if (SizeDiff < 0) {
393 RTLIB::COS_PPCF128));
402 RTLIB::DIV_PPCF128));
411 RTLIB::EXP_PPCF128));
420 RTLIB::EXP2_PPCF128));
424 return SoftenFloatRes_Unary(
426 GetFPLibCall(
N->getValueType(0), RTLIB::EXP10_F32, RTLIB::EXP10_F64,
427 RTLIB::EXP10_F80, RTLIB::EXP10_F128, RTLIB::EXP10_PPCF128));
436 RTLIB::FLOOR_PPCF128));
445 RTLIB::LOG_PPCF128));
454 RTLIB::LOG2_PPCF128));
463 RTLIB::LOG10_PPCF128));
467 bool IsStrict =
N->isStrictFPOpcode();
469 unsigned Offset = IsStrict ? 1 : 0;
471 GetSoftenedFloat(
N->getOperand(1 +
Offset)),
472 GetSoftenedFloat(
N->getOperand(2 +
Offset)) };
475 EVT OpsVT[3] = {
N->getOperand(0 +
Offset).getValueType(),
476 N->getOperand(1 +
Offset).getValueType(),
477 N->getOperand(2 +
Offset).getValueType() };
479 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG,
486 NVT, Ops, CallOptions,
SDLoc(
N), Chain);
488 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
498 RTLIB::MUL_PPCF128));
503 RTLIB::NEARBYINT_F32,
504 RTLIB::NEARBYINT_F64,
505 RTLIB::NEARBYINT_F80,
506 RTLIB::NEARBYINT_F128,
507 RTLIB::NEARBYINT_PPCF128));
521 bool IsStrict =
N->isStrictFPOpcode();
528 Op = GetPromotedFloat(
Op);
531 if (
Op.getValueType() ==
N->getValueType(0)) {
533 ReplaceValueWith(
SDValue(
N, 1), Chain);
534 return BitConvertToInteger(
Op);
542 if ((
Op.getValueType() == MVT::f16 ||
Op.getValueType() == MVT::bf16) &&
543 N->getValueType(0) != MVT::f32) {
546 { MVT::f32, MVT::Other }, { Chain,
Op });
547 Chain =
Op.getValue(1);
553 if (
Op.getValueType() == MVT::bf16) {
555 return SoftenFloatRes_BF16_TO_FP(
N);
559 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported FP_EXTEND!");
561 EVT OpVT =
N->getOperand(IsStrict ? 1 : 0).getValueType();
563 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, NVT,
Op,
567 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
577 EVT OpsVT[1] = {
N->getOperand(0).getValueType() };
580 CallOptions,
SDLoc(
N)).first;
581 if (
N->getValueType(0) == MVT::f32)
586 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported FP_EXTEND!");
593 assert(
N->getValueType(0) == MVT::f32 &&
594 "Can only soften BF16_TO_FP with f32 result");
606 bool IsStrict =
N->isStrictFPOpcode();
611 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported FP_ROUND!");
613 EVT OpVT =
N->getOperand(IsStrict ? 1 : 0).getValueType();
615 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, NVT,
Op,
619 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
629 RTLIB::POW_PPCF128));
633 bool IsStrict =
N->isStrictFPOpcode();
634 unsigned Offset = IsStrict ? 1 : 0;
635 assert((
N->getOperand(1 +
Offset).getValueType() == MVT::i16 ||
636 N->getOperand(1 +
Offset).getValueType() == MVT::i32) &&
637 "Unsupported power type!");
643 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected fpowi.");
652 N->getOperand(1 +
Offset).getValueType().getSizeInBits()) {
664 EVT OpsVT[2] = {
N->getOperand(0 +
Offset).getValueType(),
665 N->getOperand(1 +
Offset).getValueType() };
667 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, NVT, Ops,
671 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
676 assert(!
N->isStrictFPOpcode() &&
"strictfp not implemented for frexp");
677 EVT VT0 =
N->getValueType(0);
678 EVT VT1 =
N->getValueType(1);
695 SDValue Ops[2] = {GetSoftenedFloat(
N->getOperand(0)), StackSlot};
702 auto [ReturnVal, Chain] = TLI.
makeLibCall(DAG, LC, NVT0, Ops, CallOptions,
DL,
704 int FrameIdx = cast<FrameIndexSDNode>(StackSlot)->getIndex();
710 ReplaceValueWith(
SDValue(
N, 1), LoadExp);
720 RTLIB::REM_PPCF128));
729 RTLIB::RINT_PPCF128));
738 RTLIB::ROUND_PPCF128));
743 RTLIB::ROUNDEVEN_F32,
744 RTLIB::ROUNDEVEN_F64,
745 RTLIB::ROUNDEVEN_F80,
746 RTLIB::ROUNDEVEN_F128,
747 RTLIB::ROUNDEVEN_PPCF128));
756 RTLIB::SIN_PPCF128));
765 RTLIB::SQRT_PPCF128));
774 RTLIB::SUB_PPCF128));
783 RTLIB::TRUNC_PPCF128));
788 EVT VT =
N->getValueType(0);
793 L->getMemOperand()->getFlags() &
797 NewL = DAG.
getLoad(
L->getAddressingMode(),
L->getExtensionType(), NVT, dl,
798 L->getChain(),
L->getBasePtr(),
L->getOffset(),
799 L->getPointerInfo(), NVT,
L->getOriginalAlign(),
800 MMOFlags,
L->getAAInfo());
809 dl,
L->getChain(),
L->getBasePtr(),
L->getOffset(),
810 L->getPointerInfo(),
L->getMemoryVT(),
811 L->getOriginalAlign(), MMOFlags,
L->getAAInfo());
816 return BitConvertToInteger(ExtendNode);
821 EVT VT =
N->getValueType(0);
828 {L->getChain(), L->getBasePtr()},
L->getMemOperand());
843 LHS.getValueType(),
N->getOperand(0), LHS, RHS);
850 LHS.getValueType(),
N->getOperand(0),
851 N->getOperand(1), LHS, RHS,
N->getOperand(4));
856 N->getValueType(0)));
862 EVT VT =
N->getValueType(0);
867 NewVAARG = DAG.
getVAArg(NVT, dl, Chain,
Ptr,
N->getOperand(2),
868 N->getConstantOperandVal(3));
878 bool IsStrict =
N->isStrictFPOpcode();
881 EVT SVT =
N->getOperand(IsStrict ? 1 : 0).getValueType();
882 EVT RVT =
N->getValueType(0);
890 for (
unsigned t = MVT::FIRST_INTEGER_VALUETYPE;
891 t <= MVT::LAST_INTEGER_VALUETYPE && LC == RTLIB::UNKNOWN_LIBCALL; ++t) {
897 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported XINT_TO_FP!");
902 NVT,
N->getOperand(IsStrict ? 1 : 0));
906 std::pair<SDValue, SDValue> Tmp =
908 Op, CallOptions, dl, Chain);
911 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
921SDValue DAGTypeLegalizer::SoftenFloatRes_VECREDUCE_SEQ(
SDNode *
N) {
930bool DAGTypeLegalizer::SoftenFloatOperand(
SDNode *
N,
unsigned OpNo) {
931 LLVM_DEBUG(
dbgs() <<
"Soften float operand " << OpNo <<
": ";
N->dump(&DAG));
934 switch (
N->getOpcode()) {
937 dbgs() <<
"SoftenFloatOperand Op #" << OpNo <<
": ";
938 N->dump(&DAG);
dbgs() <<
"\n";
943 case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(
N);
break;
956 Res = SoftenFloatOp_FP_TO_XINT_SAT(
N);
break;
962 case ISD::LRINT: Res = SoftenFloatOp_LRINT(
N);
break;
968 case ISD::SETCC: Res = SoftenFloatOp_SETCC(
N);
break;
969 case ISD::STORE: Res = SoftenFloatOp_STORE(
N, OpNo);
break;
971 Res = SoftenFloatOp_ATOMIC_STORE(
N, OpNo);
977 if (!Res.
getNode())
return false;
985 "Invalid operand softening");
987 ReplaceValueWith(
SDValue(
N, 0), Res);
992 SDValue Op0 = GetSoftenedFloat(
N->getOperand(0));
1006 bool IsStrict =
N->isStrictFPOpcode();
1007 SDValue Op =
N->getOperand(IsStrict ? 1 : 0);
1008 EVT SVT =
Op.getValueType();
1009 EVT RVT =
N->getValueType(0);
1013 FloatRVT = MVT::f16;
1016 FloatRVT = MVT::bf16;
1019 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported FP_ROUND libcall");
1022 Op = GetSoftenedFloat(
Op);
1025 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, RVT,
Op,
1029 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
1030 ReplaceValueWith(
SDValue(
N, 0), Tmp.first);
1037 SDValue NewLHS =
N->getOperand(2), NewRHS =
N->getOperand(3);
1038 ISD::CondCode CCCode = cast<CondCodeSDNode>(
N->getOperand(1))->get();
1041 NewLHS = GetSoftenedFloat(NewLHS);
1042 NewRHS = GetSoftenedFloat(NewRHS);
1044 N->getOperand(2),
N->getOperand(3));
1048 if (!NewRHS.getNode()) {
1066 for (
unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
1067 IntVT <= MVT::LAST_INTEGER_VALUETYPE && LC == RTLIB::UNKNOWN_LIBCALL;
1071 if (Promoted.
bitsGE(RetVT))
1079 bool IsStrict =
N->isStrictFPOpcode();
1083 SDValue Op =
N->getOperand(IsStrict ? 1 : 0);
1084 EVT SVT =
Op.getValueType();
1085 EVT RVT =
N->getValueType(0);
1095 "Unsupported FP_TO_XINT!");
1097 Op = GetSoftenedFloat(
Op);
1101 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, NVT,
Op,
1102 CallOptions, dl, Chain);
1110 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
1111 ReplaceValueWith(
SDValue(
N, 0), Res);
1115SDValue DAGTypeLegalizer::SoftenFloatOp_FP_TO_XINT_SAT(
SDNode *
N) {
1121 SDValue NewLHS =
N->getOperand(0), NewRHS =
N->getOperand(1);
1122 ISD::CondCode CCCode = cast<CondCodeSDNode>(
N->getOperand(4))->get();
1125 NewLHS = GetSoftenedFloat(NewLHS);
1126 NewRHS = GetSoftenedFloat(NewRHS);
1128 N->getOperand(0),
N->getOperand(1));
1132 if (!NewRHS.getNode()) {
1139 N->getOperand(2),
N->getOperand(3),
1145 bool IsStrict =
N->isStrictFPOpcode();
1146 SDValue Op0 =
N->getOperand(IsStrict ? 1 : 0);
1147 SDValue Op1 =
N->getOperand(IsStrict ? 2 : 1);
1150 cast<CondCodeSDNode>(
N->getOperand(IsStrict ? 3 : 2))->get();
1153 SDValue NewLHS = GetSoftenedFloat(Op0);
1154 SDValue NewRHS = GetSoftenedFloat(Op1);
1170 "Unexpected setcc expansion!");
1173 ReplaceValueWith(
SDValue(
N, 0), NewLHS);
1174 ReplaceValueWith(
SDValue(
N, 1), Chain);
1180SDValue DAGTypeLegalizer::SoftenFloatOp_STORE(
SDNode *
N,
unsigned OpNo) {
1182 assert(OpNo == 1 &&
"Can only soften the stored value!");
1187 if (
ST->isTruncatingStore())
1189 Val = BitConvertToInteger(
1193 Val = GetSoftenedFloat(Val);
1195 return DAG.
getStore(
ST->getChain(), dl, Val,
ST->getBasePtr(),
1196 ST->getMemOperand());
1199SDValue DAGTypeLegalizer::SoftenFloatOp_ATOMIC_STORE(
SDNode *
N,
unsigned OpNo) {
1200 assert(OpNo == 1 &&
"Can only soften the stored value!");
1206 assert(
ST->getMemoryVT() == VT &&
"truncating atomic store not handled");
1208 SDValue NewVal = GetSoftenedFloat(Val);
1210 ST->getBasePtr(),
ST->getMemOperand());
1215 SDValue RHS = BitConvertToInteger(
N->getOperand(1));
1218 EVT LVT =
LHS.getValueType();
1220 EVT RVT =
RHS.getValueType();
1226 int SizeDiff = RSize - LSize;
1234 }
else if (SizeDiff < 0) {
1249 bool IsStrict =
N->isStrictFPOpcode();
1250 unsigned Offset = IsStrict ? 1 : 0;
1254 EVT OpVT =
N->getOperand(0 +
Offset).getValueType();
1256 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC, NVT,
Op,
1260 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
1261 ReplaceValueWith(
SDValue(
N, 0), Tmp.first);
1269 EVT OpVT =
N->getOperand(
N->isStrictFPOpcode() ? 1 : 0).getValueType();
1275 RTLIB::LROUND_PPCF128));
1279 EVT OpVT =
N->getOperand(
N->isStrictFPOpcode() ? 1 : 0).getValueType();
1284 RTLIB::LLROUND_F128,
1285 RTLIB::LLROUND_PPCF128));
1289 EVT OpVT =
N->getOperand(
N->isStrictFPOpcode() ? 1 : 0).getValueType();
1295 RTLIB::LRINT_PPCF128));
1299 EVT OpVT =
N->getOperand(
N->isStrictFPOpcode() ? 1 : 0).getValueType();
1305 RTLIB::LLRINT_PPCF128));
1316void DAGTypeLegalizer::ExpandFloatResult(
SDNode *
N,
unsigned ResNo) {
1322 if (CustomLowerNode(
N,
N->getValueType(ResNo),
true))
1325 switch (
N->getOpcode()) {
1328 dbgs() <<
"ExpandFloatResult #" << ResNo <<
": ";
1329 N->dump(&DAG);
dbgs() <<
"\n";
1422 "Do not know how to expand this float constant!");
1423 APInt C = cast<ConstantFPSDNode>(
N)->getValueAPF().bitcastToAPInt();
1426 APInt(64,
C.getRawData()[1])),
1429 APInt(64,
C.getRawData()[0])),
1435 bool IsStrict =
N->isStrictFPOpcode();
1436 unsigned Offset = IsStrict ? 1 : 0;
1440 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC,
N->getValueType(0),
1444 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
1445 GetPairElements(Tmp.first,
Lo,
Hi);
1450 bool IsStrict =
N->isStrictFPOpcode();
1451 unsigned Offset = IsStrict ? 1 : 0;
1455 std::pair<SDValue, SDValue> Tmp = TLI.
makeLibCall(DAG, LC,
N->getValueType(0),
1456 Ops, CallOptions,
SDLoc(
N),
1459 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
1460 GetPairElements(Tmp.first,
Lo,
Hi);
1465 assert(
N->getValueType(0) == MVT::ppcf128 &&
1466 "Logic only correct for ppcf128!");
1469 GetExpandedFloat(
N->getOperand(0),
Lo, Tmp);
1480 RTLIB::FMIN_F32, RTLIB::FMIN_F64,
1481 RTLIB::FMIN_F80, RTLIB::FMIN_F128,
1482 RTLIB::FMIN_PPCF128),
Lo,
Hi);
1488 RTLIB::FMAX_F32, RTLIB::FMAX_F64,
1489 RTLIB::FMAX_F80, RTLIB::FMAX_F128,
1490 RTLIB::FMAX_PPCF128),
Lo,
Hi);
1496 RTLIB::ADD_F32, RTLIB::ADD_F64,
1497 RTLIB::ADD_F80, RTLIB::ADD_F128,
1498 RTLIB::ADD_PPCF128),
Lo,
Hi);
1503 ExpandFloatRes_Unary(
N,
GetFPLibCall(
N->getValueType(0), RTLIB::CBRT_F32,
1504 RTLIB::CBRT_F64, RTLIB::CBRT_F80,
1506 RTLIB::CBRT_PPCF128),
Lo,
Hi);
1509void DAGTypeLegalizer::ExpandFloatRes_FCEIL(
SDNode *
N,
1512 RTLIB::CEIL_F32, RTLIB::CEIL_F64,
1513 RTLIB::CEIL_F80, RTLIB::CEIL_F128,
1514 RTLIB::CEIL_PPCF128),
Lo,
Hi);
1517void DAGTypeLegalizer::ExpandFloatRes_FCOPYSIGN(
SDNode *
N,
1520 RTLIB::COPYSIGN_F32,
1521 RTLIB::COPYSIGN_F64,
1522 RTLIB::COPYSIGN_F80,
1523 RTLIB::COPYSIGN_F128,
1524 RTLIB::COPYSIGN_PPCF128),
Lo,
Hi);
1527void DAGTypeLegalizer::ExpandFloatRes_FCOS(
SDNode *
N,
1530 RTLIB::COS_F32, RTLIB::COS_F64,
1531 RTLIB::COS_F80, RTLIB::COS_F128,
1532 RTLIB::COS_PPCF128),
Lo,
Hi);
1542 RTLIB::DIV_PPCF128),
Lo,
Hi);
1545void DAGTypeLegalizer::ExpandFloatRes_FEXP(
SDNode *
N,
1548 RTLIB::EXP_F32, RTLIB::EXP_F64,
1549 RTLIB::EXP_F80, RTLIB::EXP_F128,
1550 RTLIB::EXP_PPCF128),
Lo,
Hi);
1553void DAGTypeLegalizer::ExpandFloatRes_FEXP2(
SDNode *
N,
1556 RTLIB::EXP2_F32, RTLIB::EXP2_F64,
1557 RTLIB::EXP2_F80, RTLIB::EXP2_F128,
1558 RTLIB::EXP2_PPCF128),
Lo,
Hi);
1563 ExpandFloatRes_Unary(
N,
1565 RTLIB::EXP10_F64, RTLIB::EXP10_F80,
1566 RTLIB::EXP10_F128, RTLIB::EXP10_PPCF128),
1570void DAGTypeLegalizer::ExpandFloatRes_FFLOOR(
SDNode *
N,
1573 RTLIB::FLOOR_F32, RTLIB::FLOOR_F64,
1574 RTLIB::FLOOR_F80, RTLIB::FLOOR_F128,
1575 RTLIB::FLOOR_PPCF128),
Lo,
Hi);
1578void DAGTypeLegalizer::ExpandFloatRes_FLOG(
SDNode *
N,
1581 RTLIB::LOG_F32, RTLIB::LOG_F64,
1582 RTLIB::LOG_F80, RTLIB::LOG_F128,
1583 RTLIB::LOG_PPCF128),
Lo,
Hi);
1586void DAGTypeLegalizer::ExpandFloatRes_FLOG2(
SDNode *
N,
1589 RTLIB::LOG2_F32, RTLIB::LOG2_F64,
1590 RTLIB::LOG2_F80, RTLIB::LOG2_F128,
1591 RTLIB::LOG2_PPCF128),
Lo,
Hi);
1594void DAGTypeLegalizer::ExpandFloatRes_FLOG10(
SDNode *
N,
1597 RTLIB::LOG10_F32, RTLIB::LOG10_F64,
1598 RTLIB::LOG10_F80, RTLIB::LOG10_F128,
1599 RTLIB::LOG10_PPCF128),
Lo,
Hi);
1604 bool IsStrict =
N->isStrictFPOpcode();
1605 unsigned Offset = IsStrict ? 1 : 0;
1615 RTLIB::FMA_PPCF128),
1616 N->getValueType(0), Ops, CallOptions,
1619 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
1620 GetPairElements(Tmp.first,
Lo,
Hi);
1630 RTLIB::MUL_PPCF128),
Lo,
Hi);
1633void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(
SDNode *
N,
1636 RTLIB::NEARBYINT_F32,
1637 RTLIB::NEARBYINT_F64,
1638 RTLIB::NEARBYINT_F80,
1639 RTLIB::NEARBYINT_F128,
1640 RTLIB::NEARBYINT_PPCF128),
Lo,
Hi);
1646 GetExpandedFloat(
N->getOperand(0),
Lo,
Hi);
1655 bool IsStrict =
N->isStrictFPOpcode();
1660 if (NVT ==
N->getOperand(1).getValueType()) {
1661 Hi =
N->getOperand(1);
1662 Chain =
N->getOperand(0);
1666 {
N->getOperand(0),
N->getOperand(1) });
1667 Chain =
Hi.getValue(1);
1677 ReplaceValueWith(
SDValue(
N, 1), Chain);
1680void DAGTypeLegalizer::ExpandFloatRes_FPOW(
SDNode *
N,
1683 RTLIB::POW_F32, RTLIB::POW_F64,
1684 RTLIB::POW_F80, RTLIB::POW_F128,
1685 RTLIB::POW_PPCF128),
Lo,
Hi);
1688void DAGTypeLegalizer::ExpandFloatRes_FPOWI(
SDNode *
N,
1698void DAGTypeLegalizer::ExpandFloatRes_FREEZE(
SDNode *
N,
1700 assert(
N->getValueType(0) == MVT::ppcf128 &&
1701 "Logic only correct for ppcf128!");
1704 GetExpandedFloat(
N->getOperand(0),
Lo,
Hi);
1709void DAGTypeLegalizer::ExpandFloatRes_FREM(
SDNode *
N,
1712 RTLIB::REM_F32, RTLIB::REM_F64,
1713 RTLIB::REM_F80, RTLIB::REM_F128,
1714 RTLIB::REM_PPCF128),
Lo,
Hi);
1717void DAGTypeLegalizer::ExpandFloatRes_FRINT(
SDNode *
N,
1720 RTLIB::RINT_F32, RTLIB::RINT_F64,
1721 RTLIB::RINT_F80, RTLIB::RINT_F128,
1722 RTLIB::RINT_PPCF128),
Lo,
Hi);
1725void DAGTypeLegalizer::ExpandFloatRes_FROUND(
SDNode *
N,
1732 RTLIB::ROUND_PPCF128),
Lo,
Hi);
1735void DAGTypeLegalizer::ExpandFloatRes_FROUNDEVEN(
SDNode *
N,
1738 RTLIB::ROUNDEVEN_F32,
1739 RTLIB::ROUNDEVEN_F64,
1740 RTLIB::ROUNDEVEN_F80,
1741 RTLIB::ROUNDEVEN_F128,
1742 RTLIB::ROUNDEVEN_PPCF128),
Lo,
Hi);
1745void DAGTypeLegalizer::ExpandFloatRes_FSIN(
SDNode *
N,
1748 RTLIB::SIN_F32, RTLIB::SIN_F64,
1749 RTLIB::SIN_F80, RTLIB::SIN_F128,
1750 RTLIB::SIN_PPCF128),
Lo,
Hi);
1753void DAGTypeLegalizer::ExpandFloatRes_FSQRT(
SDNode *
N,
1756 RTLIB::SQRT_F32, RTLIB::SQRT_F64,
1757 RTLIB::SQRT_F80, RTLIB::SQRT_F128,
1758 RTLIB::SQRT_PPCF128),
Lo,
Hi);
1768 RTLIB::SUB_PPCF128),
Lo,
Hi);
1771void DAGTypeLegalizer::ExpandFloatRes_FTRUNC(
SDNode *
N,
1774 RTLIB::TRUNC_F32, RTLIB::TRUNC_F64,
1775 RTLIB::TRUNC_F80, RTLIB::TRUNC_F128,
1776 RTLIB::TRUNC_PPCF128),
Lo,
Hi);
1782 ExpandRes_NormalLoad(
N,
Lo,
Hi);
1794 assert(
LD->getMemoryVT().bitsLE(NVT) &&
"Float type not round?");
1797 LD->getMemoryVT(),
LD->getMemOperand());
1800 Chain =
Hi.getValue(1);
1808 ReplaceValueWith(
SDValue(LD, 1), Chain);
1813 assert(
N->getValueType(0) == MVT::ppcf128 &&
"Unsupported XINT_TO_FP!");
1814 EVT VT =
N->getValueType(0);
1816 bool Strict =
N->isStrictFPOpcode();
1817 SDValue Src =
N->getOperand(Strict ? 1 : 0);
1818 EVT SrcVT = Src.getValueType();
1826 Flags.setNoFPExcept(
N->getFlags().hasNoFPExcept());
1831 if (SrcVT.
bitsLE(MVT::i32)) {
1837 {Chain, Src}, Flags);
1838 Chain =
Hi.getValue(1);
1840 Hi = DAG.
getNode(
N->getOpcode(), dl, NVT, Src);
1843 if (SrcVT.
bitsLE(MVT::i64)) {
1846 LC = RTLIB::SINTTOFP_I64_PPCF128;
1847 }
else if (SrcVT.
bitsLE(MVT::i128)) {
1849 LC = RTLIB::SINTTOFP_I128_PPCF128;
1851 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unsupported XINT_TO_FP!");
1855 std::pair<SDValue, SDValue> Tmp =
1856 TLI.
makeLibCall(DAG, LC, VT, Src, CallOptions, dl, Chain);
1859 GetPairElements(Tmp.first,
Lo,
Hi);
1865 ReplaceValueWith(
SDValue(
N, 1), Chain);
1875 SrcVT = Src.getValueType();
1878 static const uint64_t TwoE32[] = { 0x41f0000000000000LL, 0 };
1879 static const uint64_t TwoE64[] = { 0x43f0000000000000LL, 0 };
1880 static const uint64_t TwoE128[] = { 0x47f0000000000000LL, 0 };
1902 {Chain, Hi, NewLo}, Flags);
1903 Chain =
Lo.getValue(1);
1904 ReplaceValueWith(
SDValue(
N, 1), Chain);
1909 GetPairElements(
Lo,
Lo,
Hi);
1921bool DAGTypeLegalizer::ExpandFloatOperand(
SDNode *
N,
unsigned OpNo) {
1926 if (CustomLowerNode(
N,
N->getOperand(OpNo).getValueType(),
false))
1929 switch (
N->getOpcode()) {
1932 dbgs() <<
"ExpandFloatOperand Op #" << OpNo <<
": ";
1933 N->dump(&DAG);
dbgs() <<
"\n";
1941 case ISD::BR_CC: Res = ExpandFloatOp_BR_CC(
N);
break;
1949 case ISD::LROUND: Res = ExpandFloatOp_LROUND(
N);
break;
1951 case ISD::LRINT: Res = ExpandFloatOp_LRINT(
N);
break;
1952 case ISD::LLRINT: Res = ExpandFloatOp_LLRINT(
N);
break;
1956 case ISD::SETCC: Res = ExpandFloatOp_SETCC(
N);
break;
1957 case ISD::STORE: Res = ExpandFloatOp_STORE(cast<StoreSDNode>(
N),
1962 if (!Res.
getNode())
return false;
1970 "Invalid operand expansion");
1972 ReplaceValueWith(
SDValue(
N, 0), Res);
1978void DAGTypeLegalizer::FloatExpandSetCCOperands(
SDValue &NewLHS,
1983 SDValue LHSLo, LHSHi, RHSLo, RHSHi;
1984 GetExpandedFloat(NewLHS, LHSLo, LHSHi);
1985 GetExpandedFloat(NewRHS, RHSLo, RHSHi);
1994 SDValue Tmp1, Tmp2, Tmp3, OutputChain;
1999 RHSLo, CCCode, OutputChain, IsSignaling);
2007 RHSHi, CCCode, OutputChain, IsSignaling);
2012 Chain = OutputChain;
2016 SDValue NewLHS =
N->getOperand(2), NewRHS =
N->getOperand(3);
2017 ISD::CondCode CCCode = cast<CondCodeSDNode>(
N->getOperand(1))->get();
2019 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(
N), Chain);
2031 N->getOperand(4)), 0);
2035 assert(
N->getOperand(1).getValueType() == MVT::ppcf128 &&
2036 "Logic only correct for ppcf128!");
2038 GetExpandedFloat(
N->getOperand(1),
Lo,
Hi);
2042 N->getValueType(0),
N->getOperand(0),
Hi);
2046 bool IsStrict =
N->isStrictFPOpcode();
2047 assert(
N->getOperand(IsStrict ? 1 : 0).getValueType() == MVT::ppcf128 &&
2048 "Logic only correct for ppcf128!");
2050 GetExpandedFloat(
N->getOperand(IsStrict ? 1 : 0),
Lo,
Hi);
2055 N->getValueType(0),
Hi,
N->getOperand(1));
2059 if (
Hi.getValueType() ==
N->getValueType(0)) {
2061 ReplaceValueWith(
SDValue(
N, 1),
N->getOperand(0));
2067 {
N->getValueType(0), MVT::Other},
2068 {
N->getOperand(0),
Hi,
N->getOperand(2)});
2075 EVT RVT =
N->getValueType(0);
2078 bool IsStrict =
N->isStrictFPOpcode();
2081 SDValue Op =
N->getOperand(IsStrict ? 1 : 0);
2087 "Unsupported FP_TO_XINT!");
2089 std::pair<SDValue, SDValue> Tmp =
2094 ReplaceValueWith(
SDValue(
N, 1), Tmp.second);
2095 ReplaceValueWith(
SDValue(
N, 0), Tmp.first);
2100 SDValue NewLHS =
N->getOperand(0), NewRHS =
N->getOperand(1);
2101 ISD::CondCode CCCode = cast<CondCodeSDNode>(
N->getOperand(4))->get();
2103 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(
N), Chain);
2114 N->getOperand(2),
N->getOperand(3),
2119 bool IsStrict =
N->isStrictFPOpcode();
2120 SDValue NewLHS =
N->getOperand(IsStrict ? 1 : 0);
2121 SDValue NewRHS =
N->getOperand(IsStrict ? 2 : 1);
2124 cast<CondCodeSDNode>(
N->getOperand(IsStrict ? 3 : 2))->get();
2125 FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode,
SDLoc(
N), Chain,
2131 "Unexpected setcc expansion!");
2133 ReplaceValueWith(
SDValue(
N, 0), NewLHS);
2134 ReplaceValueWith(
SDValue(
N, 1), Chain);
2140SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(
SDNode *
N,
unsigned OpNo) {
2142 return ExpandOp_NormalStore(
N, OpNo);
2145 assert(OpNo == 1 &&
"Can only expand the stored value so far");
2152 ST->getValue().getValueType());
2154 assert(
ST->getMemoryVT().bitsLE(NVT) &&
"Float type not round?");
2158 GetExpandedOp(
ST->getValue(),
Lo,
Hi);
2161 ST->getMemoryVT(),
ST->getMemOperand());
2165 EVT RVT =
N->getValueType(0);
2166 EVT RetVT =
N->getOperand(0).getValueType();
2173 RTLIB::LROUND_PPCF128),
2174 RVT,
N->getOperand(0), CallOptions,
SDLoc(
N)).first;
2178 EVT RVT =
N->getValueType(0);
2179 EVT RetVT =
N->getOperand(0).getValueType();
2185 RTLIB::LLROUND_F128,
2186 RTLIB::LLROUND_PPCF128),
2187 RVT,
N->getOperand(0), CallOptions,
SDLoc(
N)).first;
2191 EVT RVT =
N->getValueType(0);
2192 EVT RetVT =
N->getOperand(0).getValueType();
2199 RTLIB::LRINT_PPCF128),
2200 RVT,
N->getOperand(0), CallOptions,
SDLoc(
N)).first;
2204 EVT RVT =
N->getValueType(0);
2205 EVT RetVT =
N->getOperand(0).getValueType();
2212 RTLIB::LLRINT_PPCF128),
2213 RVT,
N->getOperand(0), CallOptions,
SDLoc(
N)).first;
2222 if (OpVT == MVT::f16) {
2224 }
else if (RetVT == MVT::f16) {
2226 }
else if (OpVT == MVT::bf16) {
2228 }
else if (RetVT == MVT::bf16) {
2236 if (OpVT == MVT::f16)
2239 if (RetVT == MVT::f16)
2242 if (OpVT == MVT::bf16)
2245 if (RetVT == MVT::bf16)
2251bool DAGTypeLegalizer::PromoteFloatOperand(
SDNode *
N,
unsigned OpNo) {
2252 LLVM_DEBUG(
dbgs() <<
"Promote float operand " << OpNo <<
": ";
N->dump(&DAG));
2255 if (CustomLowerNode(
N,
N->getOperand(OpNo).getValueType(),
false)) {
2266 switch (
N->getOpcode()) {
2269 dbgs() <<
"PromoteFloatOperand Op #" << OpNo <<
": ";
2270 N->dump(&DAG);
dbgs() <<
"\n";
2279 case ISD::LLRINT:
R = PromoteFloatOp_UnaryOp(
N, OpNo);
break;
2282 R = PromoteFloatOp_FP_TO_XINT_SAT(
N, OpNo);
break;
2285 R = PromoteFloatOp_STRICT_FP_EXTEND(
N, OpNo);
2288 case ISD::SETCC:
R = PromoteFloatOp_SETCC(
N, OpNo);
break;
2289 case ISD::STORE:
R = PromoteFloatOp_STORE(
N, OpNo);
break;
2295 ReplaceValueWith(
SDValue(
N, 0), R);
2299SDValue DAGTypeLegalizer::PromoteFloatOp_BITCAST(
SDNode *
N,
unsigned OpNo) {
2301 EVT OpVT =
Op->getValueType(0);
2303 SDValue Promoted = GetPromotedFloat(
N->getOperand(0));
2312 return DAG.
getBitcast(
N->getValueType(0), Convert);
2317SDValue DAGTypeLegalizer::PromoteFloatOp_FCOPYSIGN(
SDNode *
N,
unsigned OpNo) {
2318 assert (OpNo == 1 &&
"Only Operand 1 must need promotion here");
2319 SDValue Op1 = GetPromotedFloat(
N->getOperand(1));
2322 N->getOperand(0), Op1);
2326SDValue DAGTypeLegalizer::PromoteFloatOp_UnaryOp(
SDNode *
N,
unsigned OpNo) {
2327 SDValue Op = GetPromotedFloat(
N->getOperand(0));
2331SDValue DAGTypeLegalizer::PromoteFloatOp_FP_TO_XINT_SAT(
SDNode *
N,
2333 SDValue Op = GetPromotedFloat(
N->getOperand(0));
2338SDValue DAGTypeLegalizer::PromoteFloatOp_FP_EXTEND(
SDNode *
N,
unsigned OpNo) {
2339 SDValue Op = GetPromotedFloat(
N->getOperand(0));
2340 EVT VT =
N->getValueType(0);
2343 if (VT ==
Op->getValueType(0))
2350SDValue DAGTypeLegalizer::PromoteFloatOp_STRICT_FP_EXTEND(
SDNode *
N,
2352 assert(OpNo == 1 &&
"Promoting unpromotable operand");
2354 SDValue Op = GetPromotedFloat(
N->getOperand(1));
2355 EVT VT =
N->getValueType(0);
2358 if (VT ==
Op->getValueType(0)) {
2359 ReplaceValueWith(
SDValue(
N, 1),
N->getOperand(0));
2365 N->getOperand(0),
Op);
2373SDValue DAGTypeLegalizer::PromoteFloatOp_SELECT_CC(
SDNode *
N,
unsigned OpNo) {
2378 LHS, RHS,
N->getOperand(2),
N->getOperand(3),
2384SDValue DAGTypeLegalizer::PromoteFloatOp_SETCC(
SDNode *
N,
unsigned OpNo) {
2385 EVT VT =
N->getValueType(0);
2386 SDValue Op0 = GetPromotedFloat(
N->getOperand(0));
2387 SDValue Op1 = GetPromotedFloat(
N->getOperand(1));
2388 ISD::CondCode CCCode = cast<CondCodeSDNode>(
N->getOperand(2))->get();
2396SDValue DAGTypeLegalizer::PromoteFloatOp_STORE(
SDNode *
N,
unsigned OpNo) {
2401 SDValue Promoted = GetPromotedFloat(Val);
2402 EVT VT =
ST->getOperand(1).getValueType();
2409 return DAG.
getStore(
ST->getChain(),
DL, NewVal,
ST->getBasePtr(),
2410 ST->getMemOperand());
2419 SDValue Promoted = GetPromotedFloat(Val);
2420 EVT VT =
ST->getOperand(1).getValueType();
2427 ST->getBasePtr(),
ST->getMemOperand());
2434void DAGTypeLegalizer::PromoteFloatResult(
SDNode *
N,
unsigned ResNo) {
2435 LLVM_DEBUG(
dbgs() <<
"Promote float result " << ResNo <<
": ";
N->dump(&DAG));
2439 if (CustomLowerNode(
N,
N->getValueType(ResNo),
true)) {
2444 switch (
N->getOpcode()) {
2451 dbgs() <<
"PromoteFloatResult #" << ResNo <<
": ";
2452 N->dump(&DAG);
dbgs() <<
"\n";
2459 R = PromoteFloatRes_EXTRACT_VECTOR_ELT(
N);
break;
2494 case ISD::FSUB:
R = PromoteFloatRes_BinOp(
N);
break;
2497 case ISD::FMAD:
R = PromoteFloatRes_FMAD(
N);
break;
2505 R = PromoteFloatRes_STRICT_FP_ROUND(
N);
2507 case ISD::LOAD:
R = PromoteFloatRes_LOAD(
N);
break;
2509 R = PromoteFloatRes_ATOMIC_LOAD(
N);
2524 R = PromoteFloatRes_VECREDUCE(
N);
2528 R = PromoteFloatRes_VECREDUCE_SEQ(
N);
2533 SetPromotedFloat(
SDValue(
N, ResNo), R);
2542 EVT VT =
N->getValueType(0);
2547 N->getOperand(0).getValueType().getSizeInBits());
2554 EVT VT =
N->getValueType(0);
2573SDValue DAGTypeLegalizer::PromoteFloatRes_EXTRACT_VECTOR_ELT(
SDNode *
N) {
2578 if (isa<ConstantSDNode>(
N->getOperand(1))) {
2586 switch (getTypeAction(VecVT)) {
2589 SDValue Res = GetScalarizedVector(
N->getOperand(0));
2590 ReplaceValueWith(
SDValue(
N, 0), Res);
2594 Vec = GetWidenedVector(Vec);
2596 ReplaceValueWith(
SDValue(
N, 0), Res);
2601 GetSplitVector(Vec,
Lo,
Hi);
2603 uint64_t LoElts =
Lo.getValueType().getVectorNumElements();
2605 if (IdxVal < LoElts)
2610 Idx.getValueType()));
2611 ReplaceValueWith(
SDValue(
N, 0), Res);
2619 SDValue NewOp = BitConvertVectorToIntegerVector(
N->getOperand(0));
2624 NewOp,
N->getOperand(1));
2627 EVT VT =
N->getValueType(0);
2636 EVT VT =
N->getValueType(0);
2638 SDValue Op0 = GetPromotedFloat(
N->getOperand(0));
2649 EVT VT =
N->getValueType(0);
2651 SDValue Op = GetPromotedFloat(
N->getOperand(0));
2660 EVT VT =
N->getValueType(0);
2662 SDValue Op0 = GetPromotedFloat(
N->getOperand(0));
2663 SDValue Op1 = GetPromotedFloat(
N->getOperand(1));
2664 return DAG.
getNode(
N->getOpcode(),
SDLoc(
N), NVT, Op0, Op1,
N->getFlags());
2668 EVT VT =
N->getValueType(0);
2670 SDValue Op0 = GetPromotedFloat(
N->getOperand(0));
2671 SDValue Op1 = GetPromotedFloat(
N->getOperand(1));
2672 SDValue Op2 = GetPromotedFloat(
N->getOperand(2));
2674 return DAG.
getNode(
N->getOpcode(),
SDLoc(
N), NVT, Op0, Op1, Op2);
2679 EVT VT =
N->getValueType(0);
2681 SDValue Op0 = GetPromotedFloat(
N->getOperand(0));
2688 EVT VT =
N->getValueType(0);
2690 SDValue Op = GetPromotedFloat(
N->getOperand(0));
2704 EVT VT =
N->getValueType(0);
2705 EVT OpVT =
Op->getValueType(0);
2717SDValue DAGTypeLegalizer::PromoteFloatRes_STRICT_FP_ROUND(
SDNode *
N) {
2722 EVT VT =
N->getValueType(0);
2723 EVT OpVT =
Op->getValueType(0);
2740 EVT VT =
N->getValueType(0);
2745 L->getAddressingMode(),
L->getExtensionType(), IVT,
SDLoc(
N),
2746 L->getChain(),
L->getBasePtr(),
L->getOffset(),
L->getPointerInfo(), IVT,
2747 L->getOriginalAlign(),
L->getMemOperand()->getFlags(),
L->getAAInfo());
2757SDValue DAGTypeLegalizer::PromoteFloatRes_ATOMIC_LOAD(
SDNode *
N) {
2782 N->getOperand(0), TrueVal, FalseVal);
2792 TrueVal.getNode()->getValueType(0),
N->getOperand(0),
2793 N->getOperand(1), TrueVal, FalseVal,
N->getOperand(4));
2800 EVT VT =
N->getValueType(0);
2812 N->getValueType(0)));
2824SDValue DAGTypeLegalizer::PromoteFloatRes_VECREDUCE_SEQ(
SDNode *
N) {
2830 EVT VT =
N->getValueType(0);
2841 { AM->getChain(), AM->getBasePtr(), CastVal },
2864void DAGTypeLegalizer::SoftPromoteHalfResult(
SDNode *
N,
unsigned ResNo) {
2865 LLVM_DEBUG(
dbgs() <<
"Soft promote half result " << ResNo <<
": ";
2870 if (CustomLowerNode(
N,
N->getValueType(ResNo),
true)) {
2875 switch (
N->getOpcode()) {
2878 dbgs() <<
"SoftPromoteHalfResult #" << ResNo <<
": ";
2879 N->dump(&DAG);
dbgs() <<
"\n";
2885 R = SoftPromoteHalfRes_ARITH_FENCE(
N);
break;
2889 R = SoftPromoteHalfRes_EXTRACT_VECTOR_ELT(
N);
break;
2927 case ISD::FSUB:
R = SoftPromoteHalfRes_BinOp(
N);
break;
2930 case ISD::FMAD:
R = SoftPromoteHalfRes_FMAD(
N);
break;
2937 case ISD::LOAD:
R = SoftPromoteHalfRes_LOAD(
N);
break;
2939 R = SoftPromoteHalfRes_ATOMIC_LOAD(
N);
2945 case ISD::UNDEF:
R = SoftPromoteHalfRes_UNDEF(
N);
break;
2953 R = SoftPromoteHalfRes_VECREDUCE(
N);
2957 R = SoftPromoteHalfRes_VECREDUCE_SEQ(
N);
2962 SetSoftPromotedHalf(
SDValue(
N, ResNo), R);
2965SDValue DAGTypeLegalizer::SoftPromoteHalfRes_ARITH_FENCE(
SDNode *
N) {
2967 BitConvertToInteger(
N->getOperand(0)));
2971 return BitConvertToInteger(
N->getOperand(0));
2974SDValue DAGTypeLegalizer::SoftPromoteHalfRes_ConstantFP(
SDNode *
N) {
2982SDValue DAGTypeLegalizer::SoftPromoteHalfRes_EXTRACT_VECTOR_ELT(
SDNode *
N) {
2983 SDValue NewOp = BitConvertVectorToIntegerVector(
N->getOperand(0));
2989SDValue DAGTypeLegalizer::SoftPromoteHalfRes_FCOPYSIGN(
SDNode *
N) {
2990 SDValue LHS = GetSoftPromotedHalf(
N->getOperand(0));
2991 SDValue RHS = BitConvertToInteger(
N->getOperand(1));
2994 EVT LVT =
LHS.getValueType();
2995 EVT RVT =
RHS.getValueType();
3016 }
else if (SizeDiff < 0) {
3038 EVT OVT =
N->getValueType(0);
3040 SDValue Op0 = GetSoftPromotedHalf(
N->getOperand(0));
3041 SDValue Op1 = GetSoftPromotedHalf(
N->getOperand(1));
3042 SDValue Op2 = GetSoftPromotedHalf(
N->getOperand(2));
3047 Op0 = DAG.
getNode(PromotionOpcode, dl, NVT, Op0);
3048 Op1 = DAG.
getNode(PromotionOpcode, dl, NVT, Op1);
3049 Op2 = DAG.
getNode(PromotionOpcode, dl, NVT, Op2);
3058 EVT OVT =
N->getValueType(0);
3060 SDValue Op0 = GetSoftPromotedHalf(
N->getOperand(0));
3074 EVT OVT =
N->getValueType(0);
3076 SDValue Op = GetSoftPromotedHalf(
N->getOperand(0));
3091SDValue DAGTypeLegalizer::SoftPromoteHalfRes_FP_ROUND(
SDNode *
N) {
3092 EVT RVT =
N->getValueType(0);
3093 EVT SVT =
N->getOperand(0).getValueType();
3095 if (
N->isStrictFPOpcode()) {
3098 if (RVT == MVT::f16)
3100 else if (RVT == MVT::bf16)
3105 {
N->getOperand(0),
N->getOperand(1)});
3120 DAG.
getLoad(
L->getAddressingMode(),
L->getExtensionType(), MVT::i16,
3121 SDLoc(
N),
L->getChain(),
L->getBasePtr(),
L->getOffset(),
3122 L->getPointerInfo(), MVT::i16,
L->getOriginalAlign(),
3123 L->getMemOperand()->getFlags(),
L->getAAInfo());
3130SDValue DAGTypeLegalizer::SoftPromoteHalfRes_ATOMIC_LOAD(
SDNode *
N) {
3145 SDValue Op1 = GetSoftPromotedHalf(
N->getOperand(1));
3146 SDValue Op2 = GetSoftPromotedHalf(
N->getOperand(2));
3151SDValue DAGTypeLegalizer::SoftPromoteHalfRes_SELECT_CC(
SDNode *
N) {
3152 SDValue Op2 = GetSoftPromotedHalf(
N->getOperand(2));
3153 SDValue Op3 = GetSoftPromotedHalf(
N->getOperand(3));
3155 N->getOperand(0),
N->getOperand(1), Op2, Op3,
3159SDValue DAGTypeLegalizer::SoftPromoteHalfRes_XINT_TO_FP(
SDNode *
N) {
3160 EVT OVT =
N->getValueType(0);
3175 EVT OVT =
N->getValueType(0);
3177 SDValue Op = GetSoftPromotedHalf(
N->getOperand(0));
3190 EVT OVT =
N->getValueType(0);
3192 SDValue Op0 = GetSoftPromotedHalf(
N->getOperand(0));
3193 SDValue Op1 = GetSoftPromotedHalf(
N->getOperand(1));
3198 Op0 = DAG.
getNode(PromotionOpcode, dl, NVT, Op0);
3199 Op1 = DAG.
getNode(PromotionOpcode, dl, NVT, Op1);
3207SDValue DAGTypeLegalizer::SoftPromoteHalfRes_VECREDUCE(
SDNode *
N) {
3213SDValue DAGTypeLegalizer::SoftPromoteHalfRes_VECREDUCE_SEQ(
SDNode *
N) {
3223bool DAGTypeLegalizer::SoftPromoteHalfOperand(
SDNode *
N,
unsigned OpNo) {
3224 LLVM_DEBUG(
dbgs() <<
"Soft promote half operand " << OpNo <<
": ";
3228 if (CustomLowerNode(
N,
N->getOperand(OpNo).getValueType(),
false)) {
3238 switch (
N->getOpcode()) {
3241 dbgs() <<
"SoftPromoteHalfOperand Op #" << OpNo <<
": ";
3242 N->dump(&DAG);
dbgs() <<
"\n";
3247 case ISD::BITCAST: Res = SoftPromoteHalfOp_BITCAST(
N);
break;
3248 case ISD::FCOPYSIGN: Res = SoftPromoteHalfOp_FCOPYSIGN(
N, OpNo);
break;
3253 Res = SoftPromoteHalfOp_FP_TO_XINT_SAT(
N);
break;
3256 case ISD::SELECT_CC: Res = SoftPromoteHalfOp_SELECT_CC(
N, OpNo);
break;
3257 case ISD::SETCC: Res = SoftPromoteHalfOp_SETCC(
N);
break;
3258 case ISD::STORE: Res = SoftPromoteHalfOp_STORE(
N, OpNo);
break;
3260 Res = SoftPromoteHalfOp_ATOMIC_STORE(
N, OpNo);
3263 Res = SoftPromoteHalfOp_STACKMAP(
N, OpNo);
3266 Res = SoftPromoteHalfOp_PATCHPOINT(
N, OpNo);
3276 "Invalid operand expansion");
3278 ReplaceValueWith(
SDValue(
N, 0), Res);
3283 SDValue Op0 = GetSoftPromotedHalf(
N->getOperand(0));
3290 assert(OpNo == 1 &&
"Only Operand 1 must need promotion here");
3297 Op1 = GetSoftPromotedHalf(Op1);
3300 return DAG.
getNode(
N->getOpcode(), dl,
N->getValueType(0),
N->getOperand(0),
3304SDValue DAGTypeLegalizer::SoftPromoteHalfOp_FP_EXTEND(
SDNode *
N) {
3305 EVT RVT =
N->getValueType(0);
3306 bool IsStrict =
N->isStrictFPOpcode();
3307 SDValue Op =
N->getOperand(IsStrict ? 1 : 0);
3308 EVT SVT =
Op.getValueType();
3309 Op = GetSoftPromotedHalf(
N->getOperand(IsStrict ? 1 : 0));
3313 if (SVT == MVT::f16)
3315 else if (SVT == MVT::bf16)
3321 {
N->getOperand(0),
Op});
3323 ReplaceValueWith(
SDValue(
N, 0), Res);
3330SDValue DAGTypeLegalizer::SoftPromoteHalfOp_FP_TO_XINT(
SDNode *
N) {
3331 EVT RVT =
N->getValueType(0);
3333 EVT SVT =
Op.getValueType();
3338 Op = GetSoftPromotedHalf(
Op);
3342 return DAG.
getNode(
N->getOpcode(), dl,
N->getValueType(0), Res);
3345SDValue DAGTypeLegalizer::SoftPromoteHalfOp_FP_TO_XINT_SAT(
SDNode *
N) {
3346 EVT RVT =
N->getValueType(0);
3348 EVT SVT =
Op.getValueType();
3353 Op = GetSoftPromotedHalf(
Op);
3357 return DAG.
getNode(
N->getOpcode(), dl,
N->getValueType(0), Res,
3363 assert(OpNo == 0 &&
"Can only soften the comparison values");
3371 Op0 = GetSoftPromotedHalf(Op0);
3372 Op1 = GetSoftPromotedHalf(Op1);
3376 Op0 = DAG.
getNode(PromotionOpcode, dl, NVT, Op0);
3377 Op1 = DAG.
getNode(PromotionOpcode, dl, NVT, Op1);
3380 N->getOperand(2),
N->getOperand(3),
N->getOperand(4));
3386 ISD::CondCode CCCode = cast<CondCodeSDNode>(
N->getOperand(2))->get();
3392 Op0 = GetSoftPromotedHalf(Op0);
3393 Op1 = GetSoftPromotedHalf(Op1);
3397 Op0 = DAG.
getNode(PromotionOpcode, dl, NVT, Op0);
3398 Op1 = DAG.
getNode(PromotionOpcode, dl, NVT, Op1);
3403SDValue DAGTypeLegalizer::SoftPromoteHalfOp_STORE(
SDNode *
N,
unsigned OpNo) {
3404 assert(OpNo == 1 &&
"Can only soften the stored value!");
3409 assert(!
ST->isTruncatingStore() &&
"Unexpected truncating store.");
3410 SDValue Promoted = GetSoftPromotedHalf(Val);
3411 return DAG.
getStore(
ST->getChain(), dl, Promoted,
ST->getBasePtr(),
3412 ST->getMemOperand());
3415SDValue DAGTypeLegalizer::SoftPromoteHalfOp_ATOMIC_STORE(
SDNode *
N,
3417 assert(OpNo == 1 &&
"Can only soften the stored value!");
3422 SDValue Promoted = GetSoftPromotedHalf(Val);
3424 ST->getChain(), Promoted,
ST->getBasePtr(),
3425 ST->getMemOperand());
3428SDValue DAGTypeLegalizer::SoftPromoteHalfOp_STACKMAP(
SDNode *
N,
unsigned OpNo) {
3432 NewOps[OpNo] = GetSoftPromotedHalf(
Op);
3436 for (
unsigned ResNum = 0; ResNum <
N->getNumValues(); ResNum++)
3447 NewOps[OpNo] = GetSoftPromotedHalf(
Op);
3451 for (
unsigned ResNum = 0; ResNum <
N->getNumValues(); ResNum++)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static bool isSigned(unsigned int Opcode)
static RTLIB::Libcall findFPToIntLibcall(EVT SrcVT, EVT RetVT, EVT &Promoted, bool Signed)
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.
static ISD::NodeType GetPromotionOpcode(EVT OpVT, EVT RetVT)
static ISD::NodeType GetPromotionOpcodeStrict(EVT OpVT, EVT RetVT)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
APInt bitcastToAPInt() const
Class for arbitrary precision integers.
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
void clearBit(unsigned BitPosition)
Set a given bit to 0.
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an SDNode representing atomic operations.
const SDValue & getVal() const
const APFloat & getValueAPF() const
@ NewNode
This is a new node, not before seen, that was created in the process of legalizing some other node.
This class represents an Operation in the Expression.
void emitError(uint64_t LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
This class is used to represent ISD::LOAD nodes.
@ MODereferenceable
The memory access is dereferenceable (i.e., doesn't trap).
@ MOInvariant
The memory access always returns the same value (or traps).
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.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
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...
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), 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 getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, MachineMemOperand *MMO)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type.
const DataLayout & getDataLayout() const
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue SV, unsigned Align)
VAArg produces a result and token chain, and takes a pointer and a source value as input.
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
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 getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
const TargetLibraryInfo & getLibInfo() const
MachineFunction & getMachineFunction() const
SDValue getCondCode(ISD::CondCode Cond)
LLVMContext * getContext() const
SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL, bool LegalTypes=true)
SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment)
Create a stack temporary based on the size in bytes and the alignment.
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class is used to represent ISD::STORE nodes.
unsigned getIntSize() const
Get size of a C-level int or unsigned int, in bits.
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL, bool LegalTypes=true) const
Returns the type for the shift amount of a shift opcode.
virtual EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL, const SDValue OldLHS, const SDValue OldRHS) const
Soften the operands of a comparison.
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, ArrayRef< SDValue > Ops, MakeLibCallOptions CallOptions, const SDLoc &dl, SDValue Chain=SDValue()) const
Returns a pair of (return value, chain).
SDValue expandVecReduceSeq(SDNode *Node, SelectionDAG &DAG) const
Expand a VECREDUCE_SEQ_* into an explicit ordered calculation.
SDValue expandFP_TO_INT_SAT(SDNode *N, SelectionDAG &DAG) const
Expand FP_TO_[US]INT_SAT into FP_TO_[US]INT and selects or min/max.
SDValue expandVecReduce(SDNode *Node, SelectionDAG &DAG) const
Expand a VECREDUCE_* into an explicit calculation.
SDValue createSelectForFMINNUM_FMAXNUM(SDNode *Node, SelectionDAG &DAG) const
Try to convert the fminnum/fmaxnum to a compare/select sequence.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
@ C
The default llvm calling convention, compatible with C.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
@ MERGE_VALUES
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
@ VECREDUCE_SEQ_FADD
Generic reduction nodes.
@ ATOMIC_STORE
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
@ FMAD
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
@ FMA
FMA - Perform a * b + c with no intermediate rounding step.
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
@ VECREDUCE_FMAX
FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
@ FADD
Simple binary floating point operators.
@ VECREDUCE_FMAXIMUM
FMINIMUM/FMAXIMUM nodes propatate NaNs and signed zeroes using the llvm.minimum and llvm....
@ FP16_TO_FP
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ BUILD_PAIR
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
@ FLDEXP
FLDEXP - ldexp, inspired by libm (op0 * 2**op1).
@ STRICT_FSQRT
Constrained versions of libm-equivalent floating point intrinsics.
@ SIGN_EXTEND
Conversion operators.
@ VECREDUCE_FADD
These reductions have relaxed evaluation order semantics, and have a single vector operand.
@ FNEG
Perform various unary floating-point operations inspired by libm.
@ BR_CC
BR_CC - Conditional branch.
@ FCANONICALIZE
Returns platform specific canonical encoding of a floating point number.
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
@ ATOMIC_LOAD
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
@ UNDEF
UNDEF - An undefined node.
@ EXTRACT_ELEMENT
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant,...
@ ARITH_FENCE
ARITH_FENCE - This corresponds to a arithmetic fence intrinsic.
@ SHL
Shift and rotation operations.
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
@ FMINNUM
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
@ FP_EXTEND
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ STRICT_SINT_TO_FP
STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to a floating point value.
@ BF16_TO_FP
BF16_TO_FP, FP_TO_BF16 - These operators are used to perform promotions and truncation for bfloat16.
@ STRICT_FP_ROUND
X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision ...
@ STRICT_FP_TO_SINT
STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ FMINIMUM
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0....
@ FP_TO_SINT
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ STRICT_FP_EXTEND
X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ STRICT_FADD
Constrained versions of the binary floating point operators.
@ ATOMIC_SWAP
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN,...
@ FFREXP
FFREXP - frexp, extract fractional and exponent component of a floating-point value.
@ FP_ROUND
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
@ FP_TO_SINT_SAT
FP_TO_[US]INT_SAT - Convert floating point value in operand 0 to a signed or unsigned scalar integer ...
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
@ VAARG
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
@ FCOPYSIGN
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
bool isUNINDEXEDLoad(const SDNode *N)
Returns true if the specified node is an unindexed load.
bool isUNINDEXEDStore(const SDNode *N)
Returns true if the specified node is an unindexed store.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
Libcall getPOWI(EVT RetVT)
getPOWI - Return the POWI_* value for the given types, or UNKNOWN_LIBCALL if there is none.
Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
Libcall getLDEXP(EVT RetVT)
getLDEXP - Return the LDEXP_* 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.
Libcall getFREXP(EVT RetVT)
getFREXP - Return the FREXP_* value for the given types, or UNKNOWN_LIBCALL if there is none.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit.
Libcall getFPTOUINT(EVT OpVT, EVT RetVT)
getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
Libcall getFPEXT(EVT OpVT, EVT RetVT)
getFPEXT - Return the FPEXT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
Libcall getFPROUND(EVT OpVT, EVT RetVT)
getFPROUND - Return the FPROUND_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
DiagnosticInfoOptimizationBase::Argument NV
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
DWARFExpression::Operation Op
static const fltSemantics & PPCDoubleDouble() LLVM_READNONE
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
bool isByteSized() const
Return true if the bit size is a multiple of 8.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
These are IR-level optimization flags that may be propagated to SDNodes.
This structure is used to pass arguments to makeLibCall function.
MakeLibCallOptions & setSExt(bool Value=true)
MakeLibCallOptions & setTypeListBeforeSoften(ArrayRef< EVT > OpsVT, EVT RetVT, bool Value=true)