38#include "llvm/IR/IntrinsicsRISCV.h"
51#define DEBUG_TYPE "riscv-lower"
57 cl::desc(
"Give the maximum size (in number of nodes) of the web of "
58 "instructions that we will consider for VW expansion"),
63 cl::desc(
"Allow the formation of VW_W operations (e.g., "
64 "VWADD_W) with splat constants"),
69 cl::desc(
"Set the minimum number of repetitions of a divisor to allow "
70 "transformation to multiplications by the reciprocal"),
75 cl::desc(
"Give the maximum number of instructions that we will "
76 "use for creating a floating-point immediate value"),
87 !Subtarget.hasStdExtF()) {
88 errs() <<
"Hard-float 'f' ABI can't be used for a target that "
89 "doesn't support the F instruction set extension (ignoring "
93 !Subtarget.hasStdExtD()) {
94 errs() <<
"Hard-float 'd' ABI can't be used for a target that "
95 "doesn't support the D instruction set extension (ignoring "
119 if (Subtarget.hasStdExtZfhmin())
121 if (Subtarget.hasStdExtZfbfmin())
123 if (Subtarget.hasStdExtF())
125 if (Subtarget.hasStdExtD())
127 if (Subtarget.hasStdExtZhinxmin())
129 if (Subtarget.hasStdExtZfinx())
131 if (Subtarget.hasStdExtZdinx()) {
139 MVT::nxv1i1, MVT::nxv2i1, MVT::nxv4i1, MVT::nxv8i1,
140 MVT::nxv16i1, MVT::nxv32i1, MVT::nxv64i1};
142 MVT::nxv1i8, MVT::nxv2i8, MVT::nxv4i8, MVT::nxv8i8, MVT::nxv16i8,
143 MVT::nxv32i8, MVT::nxv64i8, MVT::nxv1i16, MVT::nxv2i16, MVT::nxv4i16,
144 MVT::nxv8i16, MVT::nxv16i16, MVT::nxv32i16, MVT::nxv1i32, MVT::nxv2i32,
145 MVT::nxv4i32, MVT::nxv8i32, MVT::nxv16i32, MVT::nxv1i64, MVT::nxv2i64,
146 MVT::nxv4i64, MVT::nxv8i64};
148 MVT::nxv1f16, MVT::nxv2f16, MVT::nxv4f16,
149 MVT::nxv8f16, MVT::nxv16f16, MVT::nxv32f16};
151 MVT::nxv1bf16, MVT::nxv2bf16, MVT::nxv4bf16,
152 MVT::nxv8bf16, MVT::nxv16bf16, MVT::nxv32bf16};
154 MVT::nxv1f32, MVT::nxv2f32, MVT::nxv4f32, MVT::nxv8f32, MVT::nxv16f32};
156 MVT::nxv1f64, MVT::nxv2f64, MVT::nxv4f64, MVT::nxv8f64};
159 auto addRegClassForRVV = [
this](
MVT VT) {
163 if (VT.getVectorMinNumElements() < MinElts)
166 unsigned Size = VT.getSizeInBits().getKnownMinValue();
169 RC = &RISCV::VRRegClass;
171 RC = &RISCV::VRM2RegClass;
173 RC = &RISCV::VRM4RegClass;
175 RC = &RISCV::VRM8RegClass;
182 for (
MVT VT : BoolVecVTs)
183 addRegClassForRVV(VT);
184 for (
MVT VT : IntVecVTs) {
185 if (VT.getVectorElementType() == MVT::i64 &&
188 addRegClassForRVV(VT);
192 for (
MVT VT : F16VecVTs)
193 addRegClassForRVV(VT);
196 for (
MVT VT : BF16VecVTs)
197 addRegClassForRVV(VT);
200 for (
MVT VT : F32VecVTs)
201 addRegClassForRVV(VT);
204 for (
MVT VT : F64VecVTs)
205 addRegClassForRVV(VT);
208 auto addRegClassForFixedVectors = [
this](
MVT VT) {
215 if (useRVVForFixedLengthVectorVT(VT))
216 addRegClassForFixedVectors(VT);
219 if (useRVVForFixedLengthVectorVT(VT))
220 addRegClassForFixedVectors(VT);
247 if (!(Subtarget.hasVendorXCValu() && !Subtarget.
is64Bit())) {
261 if (!Subtarget.hasStdExtZbb() && !Subtarget.hasVendorXTHeadBb() &&
262 !(Subtarget.hasVendorXCValu() && !Subtarget.
is64Bit()))
272 if (!Subtarget.hasStdExtZbb())
278 if (!Subtarget.hasStdExtZmmul()) {
280 }
else if (Subtarget.
is64Bit()) {
287 if (!Subtarget.hasStdExtM()) {
290 }
else if (Subtarget.
is64Bit()) {
292 {MVT::i8, MVT::i16, MVT::i32},
Custom);
302 if (Subtarget.hasStdExtZbb() || Subtarget.hasStdExtZbkb()) {
305 }
else if (Subtarget.hasVendorXTHeadBb()) {
309 }
else if (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit()) {
318 (Subtarget.hasStdExtZbb() || Subtarget.hasStdExtZbkb() ||
319 Subtarget.hasVendorXTHeadBb())
323 if (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit()) {
331 if (Subtarget.hasStdExtZbb() ||
332 (Subtarget.hasVendorXCValu() && !Subtarget.
is64Bit())) {
337 if (Subtarget.hasStdExtZbb() ||
338 (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit())) {
345 if (Subtarget.hasStdExtZbb() || Subtarget.hasVendorXTHeadBb() ||
346 (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit())) {
355 if (Subtarget.hasVendorXCValu() && !Subtarget.
is64Bit()) {
357 }
else if (Subtarget.hasShortForwardBranchOpt()) {
360 }
else if (Subtarget.
is64Bit()) {
364 if (!Subtarget.hasVendorXTHeadCondMov())
367 static const unsigned FPLegalNodeTypes[] = {
381 static const unsigned FPOpToExpand[] = {
385 static const unsigned FPRndMode[] = {
392 static const unsigned ZfhminZfbfminPromoteOps[] = {
408 if (Subtarget.hasStdExtZfbfmin()) {
491 if (Subtarget.hasStdExtZfa()) {
508 if (Subtarget.hasStdExtZfa()) {
580 if (Subtarget.hasStdExtZicbop()) {
584 if (Subtarget.hasStdExtA()) {
586 if (Subtarget.hasStdExtZabha() && Subtarget.hasStdExtZacas())
590 }
else if (Subtarget.hasForcedAtomics()) {
614 {MVT::i8, MVT::i16},
Custom);
625 static const unsigned IntegerVPOps[] = {
626 ISD::VP_ADD, ISD::VP_SUB, ISD::VP_MUL,
627 ISD::VP_SDIV, ISD::VP_UDIV, ISD::VP_SREM,
628 ISD::VP_UREM, ISD::VP_AND, ISD::VP_OR,
629 ISD::VP_XOR, ISD::VP_SRA, ISD::VP_SRL,
630 ISD::VP_SHL, ISD::VP_REDUCE_ADD, ISD::VP_REDUCE_AND,
631 ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR, ISD::VP_REDUCE_SMAX,
632 ISD::VP_REDUCE_SMIN, ISD::VP_REDUCE_UMAX, ISD::VP_REDUCE_UMIN,
633 ISD::VP_MERGE, ISD::VP_SELECT, ISD::VP_FP_TO_SINT,
634 ISD::VP_FP_TO_UINT, ISD::VP_SETCC, ISD::VP_SIGN_EXTEND,
635 ISD::VP_ZERO_EXTEND, ISD::VP_TRUNCATE, ISD::VP_SMIN,
636 ISD::VP_SMAX, ISD::VP_UMIN, ISD::VP_UMAX,
637 ISD::VP_ABS, ISD::EXPERIMENTAL_VP_REVERSE, ISD::EXPERIMENTAL_VP_SPLICE,
638 ISD::VP_SADDSAT, ISD::VP_UADDSAT, ISD::VP_SSUBSAT,
639 ISD::VP_USUBSAT, ISD::VP_CTTZ_ELTS, ISD::VP_CTTZ_ELTS_ZERO_UNDEF,
640 ISD::EXPERIMENTAL_VP_SPLAT};
642 static const unsigned FloatingPointVPOps[] = {
643 ISD::VP_FADD, ISD::VP_FSUB, ISD::VP_FMUL,
644 ISD::VP_FDIV, ISD::VP_FNEG, ISD::VP_FABS,
645 ISD::VP_FMA, ISD::VP_REDUCE_FADD, ISD::VP_REDUCE_SEQ_FADD,
646 ISD::VP_REDUCE_FMIN, ISD::VP_REDUCE_FMAX, ISD::VP_MERGE,
647 ISD::VP_SELECT, ISD::VP_SINT_TO_FP, ISD::VP_UINT_TO_FP,
648 ISD::VP_SETCC, ISD::VP_FP_ROUND, ISD::VP_FP_EXTEND,
649 ISD::VP_SQRT, ISD::VP_FMINNUM, ISD::VP_FMAXNUM,
650 ISD::VP_FCEIL, ISD::VP_FFLOOR, ISD::VP_FROUND,
651 ISD::VP_FROUNDEVEN, ISD::VP_FCOPYSIGN, ISD::VP_FROUNDTOZERO,
652 ISD::VP_FRINT, ISD::VP_FNEARBYINT, ISD::VP_IS_FPCLASS,
653 ISD::VP_FMINIMUM, ISD::VP_FMAXIMUM, ISD::VP_LRINT,
654 ISD::VP_LLRINT, ISD::EXPERIMENTAL_VP_REVERSE,
655 ISD::EXPERIMENTAL_VP_SPLICE, ISD::VP_REDUCE_FMINIMUM,
656 ISD::VP_REDUCE_FMAXIMUM, ISD::EXPERIMENTAL_VP_SPLAT};
658 static const unsigned IntegerVecReduceOps[] = {
663 static const unsigned FloatingPointVecReduceOps[] = {
676 ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR,
677 ISD::VP_REDUCE_SMAX, ISD::VP_REDUCE_SMIN,
678 ISD::VP_REDUCE_UMAX, ISD::VP_REDUCE_UMIN},
682 for (
MVT VT : BoolVecVTs) {
712 {ISD::VP_REDUCE_AND, ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR}, VT,
736 ISD::VP_TRUNCATE, ISD::VP_SETCC},
752 for (
MVT VT : IntVecVTs) {
763 if (VT.getVectorElementType() == MVT::i64 && !Subtarget.hasStdExtV())
813 {ISD::VP_LOAD, ISD::VP_STORE, ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
814 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER, ISD::VP_SCATTER},
838 if (Subtarget.hasStdExtZvkb()) {
846 if (Subtarget.hasStdExtZvbb()) {
850 ISD::VP_CTTZ_ZERO_UNDEF, ISD::VP_CTPOP},
856 ISD::VP_CTTZ_ZERO_UNDEF, ISD::VP_CTPOP},
865 ISD::VP_CTLZ_ZERO_UNDEF, ISD::VP_CTTZ_ZERO_UNDEF},
885 static const unsigned ZvfhminPromoteOps[] = {
895 static const unsigned ZvfhminPromoteVPOps[] = {
896 ISD::VP_FADD, ISD::VP_FSUB, ISD::VP_FMUL,
897 ISD::VP_FDIV, ISD::VP_FNEG, ISD::VP_FABS,
898 ISD::VP_FMA, ISD::VP_REDUCE_FADD, ISD::VP_REDUCE_SEQ_FADD,
899 ISD::VP_REDUCE_FMIN, ISD::VP_REDUCE_FMAX, ISD::VP_SQRT,
900 ISD::VP_FMINNUM, ISD::VP_FMAXNUM, ISD::VP_FCEIL,
901 ISD::VP_FFLOOR, ISD::VP_FROUND, ISD::VP_FROUNDEVEN,
902 ISD::VP_FCOPYSIGN, ISD::VP_FROUNDTOZERO, ISD::VP_FRINT,
903 ISD::VP_FNEARBYINT, ISD::VP_SETCC, ISD::VP_FMINIMUM,
904 ISD::VP_FMAXIMUM, ISD::VP_REDUCE_FMINIMUM, ISD::VP_REDUCE_FMAXIMUM};
907 const auto SetCommonVFPActions = [&](
MVT VT) {
952 {ISD::VP_LOAD, ISD::VP_STORE, ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
953 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER, ISD::VP_SCATTER},
984 const auto SetCommonVFPExtLoadTruncStoreActions =
986 for (
auto SmallVT : SmallerVTs) {
993 for (
MVT VT : F16VecVTs) {
996 SetCommonVFPActions(VT);
999 for (
MVT VT : F16VecVTs) {
1010 ISD::VP_SINT_TO_FP, ISD::VP_UINT_TO_FP},
1015 if (Subtarget.hasStdExtZfhmin())
1021 if (VT == MVT::nxv32f16) {
1035 for (
MVT VT : BF16VecVTs) {
1046 if (Subtarget.hasStdExtZfbfmin())
1056 for (
MVT VT : F32VecVTs) {
1059 SetCommonVFPActions(VT);
1060 SetCommonVFPExtLoadTruncStoreActions(VT, F16VecVTs);
1065 for (
MVT VT : F64VecVTs) {
1068 SetCommonVFPActions(VT);
1069 SetCommonVFPExtLoadTruncStoreActions(VT, F16VecVTs);
1070 SetCommonVFPExtLoadTruncStoreActions(VT, F32VecVTs);
1076 if (!useRVVForFixedLengthVectorVT(VT))
1122 {ISD::VP_REDUCE_AND, ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR}, VT,
1149 ISD::VP_SETCC, ISD::VP_TRUNCATE},
1171 ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
1172 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER,
1209 if (Subtarget.hasStdExtZvkb())
1212 if (Subtarget.hasStdExtZvbb()) {
1234 if (!useRVVForFixedLengthVectorVT(VT))
1264 ISD::VP_SINT_TO_FP, ISD::VP_UINT_TO_FP},
1267 if (Subtarget.hasStdExtZfhmin()) {
1305 ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
1306 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER,
1352 if (Subtarget.hasStdExtA())
1355 if (Subtarget.hasForcedAtomics()) {
1365 if (Subtarget.hasVendorXTHeadMemIdx()) {
1381 if (Subtarget.hasVendorXCVmem() && !Subtarget.
is64Bit()) {
1406 if (Subtarget.hasStdExtZbb())
1409 if ((Subtarget.hasStdExtZbs() && Subtarget.
is64Bit()) ||
1413 if (Subtarget.hasStdExtZbkb())
1425 ISD::EXPERIMENTAL_VP_REVERSE,
ISD::MUL,
1428 if (Subtarget.hasVendorXTHeadMemPair())
1457MVT RISCVTargetLowering::getVPExplicitVectorLengthTy()
const {
1462bool RISCVTargetLowering::shouldExpandGetVectorLength(
EVT TripCountVT,
1464 bool IsScalable)
const {
1471 if (TripCountVT != MVT::i32 && TripCountVT != Subtarget.
getXLenVT())
1496 unsigned Intrinsic)
const {
1497 auto &
DL =
I.getDataLayout();
1499 auto SetRVVLoadStoreInfo = [&](
unsigned PtrOp,
bool IsStore,
1500 bool IsUnitStrided,
bool UsePtrVal =
false) {
1505 Info.ptrVal =
I.getArgOperand(PtrOp);
1507 Info.fallbackAddressSpace =
1508 I.getArgOperand(PtrOp)->getType()->getPointerAddressSpace();
1512 MemTy =
I.getArgOperand(0)->getType();
1515 MemTy =
I.getType();
1530 if (
I.hasMetadata(LLVMContext::MD_nontemporal))
1534 switch (Intrinsic) {
1537 case Intrinsic::riscv_masked_atomicrmw_xchg_i32:
1538 case Intrinsic::riscv_masked_atomicrmw_add_i32:
1539 case Intrinsic::riscv_masked_atomicrmw_sub_i32:
1540 case Intrinsic::riscv_masked_atomicrmw_nand_i32:
1541 case Intrinsic::riscv_masked_atomicrmw_max_i32:
1542 case Intrinsic::riscv_masked_atomicrmw_min_i32:
1543 case Intrinsic::riscv_masked_atomicrmw_umax_i32:
1544 case Intrinsic::riscv_masked_atomicrmw_umin_i32:
1545 case Intrinsic::riscv_masked_cmpxchg_i32:
1547 Info.memVT = MVT::i32;
1548 Info.ptrVal =
I.getArgOperand(0);
1554 case Intrinsic::riscv_seg2_load:
1555 case Intrinsic::riscv_seg3_load:
1556 case Intrinsic::riscv_seg4_load:
1557 case Intrinsic::riscv_seg5_load:
1558 case Intrinsic::riscv_seg6_load:
1559 case Intrinsic::riscv_seg7_load:
1560 case Intrinsic::riscv_seg8_load:
1561 return SetRVVLoadStoreInfo( 0,
false,
1563 case Intrinsic::riscv_seg2_store:
1564 case Intrinsic::riscv_seg3_store:
1565 case Intrinsic::riscv_seg4_store:
1566 case Intrinsic::riscv_seg5_store:
1567 case Intrinsic::riscv_seg6_store:
1568 case Intrinsic::riscv_seg7_store:
1569 case Intrinsic::riscv_seg8_store:
1571 return SetRVVLoadStoreInfo(
I.arg_size() - 2,
1574 case Intrinsic::riscv_vle:
1575 case Intrinsic::riscv_vle_mask:
1576 case Intrinsic::riscv_vleff:
1577 case Intrinsic::riscv_vleff_mask:
1578 return SetRVVLoadStoreInfo( 1,
1582 case Intrinsic::riscv_vse:
1583 case Intrinsic::riscv_vse_mask:
1584 return SetRVVLoadStoreInfo( 1,
1588 case Intrinsic::riscv_vlse:
1589 case Intrinsic::riscv_vlse_mask:
1590 case Intrinsic::riscv_vloxei:
1591 case Intrinsic::riscv_vloxei_mask:
1592 case Intrinsic::riscv_vluxei:
1593 case Intrinsic::riscv_vluxei_mask:
1594 return SetRVVLoadStoreInfo( 1,
1597 case Intrinsic::riscv_vsse:
1598 case Intrinsic::riscv_vsse_mask:
1599 case Intrinsic::riscv_vsoxei:
1600 case Intrinsic::riscv_vsoxei_mask:
1601 case Intrinsic::riscv_vsuxei:
1602 case Intrinsic::riscv_vsuxei_mask:
1603 return SetRVVLoadStoreInfo( 1,
1606 case Intrinsic::riscv_vlseg2:
1607 case Intrinsic::riscv_vlseg3:
1608 case Intrinsic::riscv_vlseg4:
1609 case Intrinsic::riscv_vlseg5:
1610 case Intrinsic::riscv_vlseg6:
1611 case Intrinsic::riscv_vlseg7:
1612 case Intrinsic::riscv_vlseg8:
1613 case Intrinsic::riscv_vlseg2ff:
1614 case Intrinsic::riscv_vlseg3ff:
1615 case Intrinsic::riscv_vlseg4ff:
1616 case Intrinsic::riscv_vlseg5ff:
1617 case Intrinsic::riscv_vlseg6ff:
1618 case Intrinsic::riscv_vlseg7ff:
1619 case Intrinsic::riscv_vlseg8ff:
1620 return SetRVVLoadStoreInfo(
I.arg_size() - 2,
1623 case Intrinsic::riscv_vlseg2_mask:
1624 case Intrinsic::riscv_vlseg3_mask:
1625 case Intrinsic::riscv_vlseg4_mask:
1626 case Intrinsic::riscv_vlseg5_mask:
1627 case Intrinsic::riscv_vlseg6_mask:
1628 case Intrinsic::riscv_vlseg7_mask:
1629 case Intrinsic::riscv_vlseg8_mask:
1630 case Intrinsic::riscv_vlseg2ff_mask:
1631 case Intrinsic::riscv_vlseg3ff_mask:
1632 case Intrinsic::riscv_vlseg4ff_mask:
1633 case Intrinsic::riscv_vlseg5ff_mask:
1634 case Intrinsic::riscv_vlseg6ff_mask:
1635 case Intrinsic::riscv_vlseg7ff_mask:
1636 case Intrinsic::riscv_vlseg8ff_mask:
1637 return SetRVVLoadStoreInfo(
I.arg_size() - 4,
1640 case Intrinsic::riscv_vlsseg2:
1641 case Intrinsic::riscv_vlsseg3:
1642 case Intrinsic::riscv_vlsseg4:
1643 case Intrinsic::riscv_vlsseg5:
1644 case Intrinsic::riscv_vlsseg6:
1645 case Intrinsic::riscv_vlsseg7:
1646 case Intrinsic::riscv_vlsseg8:
1647 case Intrinsic::riscv_vloxseg2:
1648 case Intrinsic::riscv_vloxseg3:
1649 case Intrinsic::riscv_vloxseg4:
1650 case Intrinsic::riscv_vloxseg5:
1651 case Intrinsic::riscv_vloxseg6:
1652 case Intrinsic::riscv_vloxseg7:
1653 case Intrinsic::riscv_vloxseg8:
1654 case Intrinsic::riscv_vluxseg2:
1655 case Intrinsic::riscv_vluxseg3:
1656 case Intrinsic::riscv_vluxseg4:
1657 case Intrinsic::riscv_vluxseg5:
1658 case Intrinsic::riscv_vluxseg6:
1659 case Intrinsic::riscv_vluxseg7:
1660 case Intrinsic::riscv_vluxseg8:
1661 return SetRVVLoadStoreInfo(
I.arg_size() - 3,
1664 case Intrinsic::riscv_vlsseg2_mask:
1665 case Intrinsic::riscv_vlsseg3_mask:
1666 case Intrinsic::riscv_vlsseg4_mask:
1667 case Intrinsic::riscv_vlsseg5_mask:
1668 case Intrinsic::riscv_vlsseg6_mask:
1669 case Intrinsic::riscv_vlsseg7_mask:
1670 case Intrinsic::riscv_vlsseg8_mask:
1671 case Intrinsic::riscv_vloxseg2_mask:
1672 case Intrinsic::riscv_vloxseg3_mask:
1673 case Intrinsic::riscv_vloxseg4_mask:
1674 case Intrinsic::riscv_vloxseg5_mask:
1675 case Intrinsic::riscv_vloxseg6_mask:
1676 case Intrinsic::riscv_vloxseg7_mask:
1677 case Intrinsic::riscv_vloxseg8_mask:
1678 case Intrinsic::riscv_vluxseg2_mask:
1679 case Intrinsic::riscv_vluxseg3_mask:
1680 case Intrinsic::riscv_vluxseg4_mask:
1681 case Intrinsic::riscv_vluxseg5_mask:
1682 case Intrinsic::riscv_vluxseg6_mask:
1683 case Intrinsic::riscv_vluxseg7_mask:
1684 case Intrinsic::riscv_vluxseg8_mask:
1685 return SetRVVLoadStoreInfo(
I.arg_size() - 5,
1688 case Intrinsic::riscv_vsseg2:
1689 case Intrinsic::riscv_vsseg3:
1690 case Intrinsic::riscv_vsseg4:
1691 case Intrinsic::riscv_vsseg5:
1692 case Intrinsic::riscv_vsseg6:
1693 case Intrinsic::riscv_vsseg7:
1694 case Intrinsic::riscv_vsseg8:
1695 return SetRVVLoadStoreInfo(
I.arg_size() - 2,
1698 case Intrinsic::riscv_vsseg2_mask:
1699 case Intrinsic::riscv_vsseg3_mask:
1700 case Intrinsic::riscv_vsseg4_mask:
1701 case Intrinsic::riscv_vsseg5_mask:
1702 case Intrinsic::riscv_vsseg6_mask:
1703 case Intrinsic::riscv_vsseg7_mask:
1704 case Intrinsic::riscv_vsseg8_mask:
1705 return SetRVVLoadStoreInfo(
I.arg_size() - 3,
1708 case Intrinsic::riscv_vssseg2:
1709 case Intrinsic::riscv_vssseg3:
1710 case Intrinsic::riscv_vssseg4:
1711 case Intrinsic::riscv_vssseg5:
1712 case Intrinsic::riscv_vssseg6:
1713 case Intrinsic::riscv_vssseg7:
1714 case Intrinsic::riscv_vssseg8:
1715 case Intrinsic::riscv_vsoxseg2:
1716 case Intrinsic::riscv_vsoxseg3:
1717 case Intrinsic::riscv_vsoxseg4:
1718 case Intrinsic::riscv_vsoxseg5:
1719 case Intrinsic::riscv_vsoxseg6:
1720 case Intrinsic::riscv_vsoxseg7:
1721 case Intrinsic::riscv_vsoxseg8:
1722 case Intrinsic::riscv_vsuxseg2:
1723 case Intrinsic::riscv_vsuxseg3:
1724 case Intrinsic::riscv_vsuxseg4:
1725 case Intrinsic::riscv_vsuxseg5:
1726 case Intrinsic::riscv_vsuxseg6:
1727 case Intrinsic::riscv_vsuxseg7:
1728 case Intrinsic::riscv_vsuxseg8:
1729 return SetRVVLoadStoreInfo(
I.arg_size() - 3,
1732 case Intrinsic::riscv_vssseg2_mask:
1733 case Intrinsic::riscv_vssseg3_mask:
1734 case Intrinsic::riscv_vssseg4_mask:
1735 case Intrinsic::riscv_vssseg5_mask:
1736 case Intrinsic::riscv_vssseg6_mask:
1737 case Intrinsic::riscv_vssseg7_mask:
1738 case Intrinsic::riscv_vssseg8_mask:
1739 case Intrinsic::riscv_vsoxseg2_mask:
1740 case Intrinsic::riscv_vsoxseg3_mask:
1741 case Intrinsic::riscv_vsoxseg4_mask:
1742 case Intrinsic::riscv_vsoxseg5_mask:
1743 case Intrinsic::riscv_vsoxseg6_mask:
1744 case Intrinsic::riscv_vsoxseg7_mask:
1745 case Intrinsic::riscv_vsoxseg8_mask:
1746 case Intrinsic::riscv_vsuxseg2_mask:
1747 case Intrinsic::riscv_vsuxseg3_mask:
1748 case Intrinsic::riscv_vsuxseg4_mask:
1749 case Intrinsic::riscv_vsuxseg5_mask:
1750 case Intrinsic::riscv_vsuxseg6_mask:
1751 case Intrinsic::riscv_vsuxseg7_mask:
1752 case Intrinsic::riscv_vsuxseg8_mask:
1753 return SetRVVLoadStoreInfo(
I.arg_size() - 4,
1794 return isInt<12>(Imm);
1798 return isInt<12>(Imm);
1811 return (SrcBits == 64 && DestBits == 32);
1822 return (SrcBits == 64 && DestBits == 32);
1833 if (SrcBits == DestBits * 2) {
1844 if (
auto *LD = dyn_cast<LoadSDNode>(Val)) {
1845 EVT MemVT = LD->getMemoryVT();
1846 if ((MemVT == MVT::i8 || MemVT == MVT::i16) &&
1856 return Subtarget.
is64Bit() && SrcVT == MVT::i32 && DstVT == MVT::i64;
1864 return Subtarget.hasStdExtZbb() ||
1865 (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit());
1869 return Subtarget.hasStdExtZbb() || Subtarget.hasVendorXTHeadBb() ||
1870 (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit());
1881 if (!Subtarget.hasStdExtZbs() && !Subtarget.hasVendorXTHeadBs())
1886 return !Mask->getValue().isSignedIntN(12) && Mask->getValue().isPowerOf2();
1890 EVT VT =
Y.getValueType();
1896 return (Subtarget.hasStdExtZbb() || Subtarget.hasStdExtZbkb()) &&
1897 (!isa<ConstantSDNode>(
Y) || cast<ConstantSDNode>(
Y)->isOpaque());
1902 if (Subtarget.hasStdExtZbs())
1903 return X.getValueType().isScalarInteger();
1904 auto *
C = dyn_cast<ConstantSDNode>(
Y);
1906 if (Subtarget.hasVendorXTHeadBs())
1907 return C !=
nullptr;
1909 return C &&
C->getAPIntValue().ule(10);
1929 if (BitSize > Subtarget.
getXLen())
1933 int64_t Val = Imm.getSExtValue();
1941 if (!Subtarget.enableUnalignedScalarMem())
1957 unsigned OldShiftOpcode,
unsigned NewShiftOpcode,
1964 if (XC && OldShiftOpcode ==
ISD::SRL && XC->isOne())
1968 if (NewShiftOpcode ==
ISD::SRL &&
CC->isOne())
1980 case Instruction::Add:
1981 case Instruction::Sub:
1982 case Instruction::Mul:
1983 case Instruction::And:
1984 case Instruction::Or:
1985 case Instruction::Xor:
1986 case Instruction::FAdd:
1987 case Instruction::FSub:
1988 case Instruction::FMul:
1989 case Instruction::FDiv:
1990 case Instruction::ICmp:
1991 case Instruction::FCmp:
1993 case Instruction::Shl:
1994 case Instruction::LShr:
1995 case Instruction::AShr:
1996 case Instruction::UDiv:
1997 case Instruction::SDiv:
1998 case Instruction::URem:
1999 case Instruction::SRem:
2000 case Instruction::Select:
2001 return Operand == 1;
2015 auto *
II = dyn_cast<IntrinsicInst>(
I);
2019 switch (
II->getIntrinsicID()) {
2020 case Intrinsic::fma:
2021 case Intrinsic::vp_fma:
2022 return Operand == 0 || Operand == 1;
2023 case Intrinsic::vp_shl:
2024 case Intrinsic::vp_lshr:
2025 case Intrinsic::vp_ashr:
2026 case Intrinsic::vp_udiv:
2027 case Intrinsic::vp_sdiv:
2028 case Intrinsic::vp_urem:
2029 case Intrinsic::vp_srem:
2030 case Intrinsic::ssub_sat:
2031 case Intrinsic::vp_ssub_sat:
2032 case Intrinsic::usub_sat:
2033 case Intrinsic::vp_usub_sat:
2034 return Operand == 1;
2036 case Intrinsic::vp_add:
2037 case Intrinsic::vp_mul:
2038 case Intrinsic::vp_and:
2039 case Intrinsic::vp_or:
2040 case Intrinsic::vp_xor:
2041 case Intrinsic::vp_fadd:
2042 case Intrinsic::vp_fmul:
2043 case Intrinsic::vp_icmp:
2044 case Intrinsic::vp_fcmp:
2045 case Intrinsic::smin:
2046 case Intrinsic::vp_smin:
2047 case Intrinsic::umin:
2048 case Intrinsic::vp_umin:
2049 case Intrinsic::smax:
2050 case Intrinsic::vp_smax:
2051 case Intrinsic::umax:
2052 case Intrinsic::vp_umax:
2053 case Intrinsic::sadd_sat:
2054 case Intrinsic::vp_sadd_sat:
2055 case Intrinsic::uadd_sat:
2056 case Intrinsic::vp_uadd_sat:
2058 case Intrinsic::vp_sub:
2059 case Intrinsic::vp_fsub:
2060 case Intrinsic::vp_fdiv:
2061 return Operand == 0 || Operand == 1;
2082 if (!Subtarget.sinkSplatOperands())
2085 for (
auto OpIdx :
enumerate(
I->operands())) {
2089 Instruction *
Op = dyn_cast<Instruction>(OpIdx.value().get());
2091 if (!
Op ||
any_of(Ops, [&](
Use *U) {
return U->get() ==
Op; }))
2100 if (cast<VectorType>(
Op->getType())->getElementType()->isIntegerTy(1))
2105 for (
Use &U :
Op->uses()) {
2157 if (!Subtarget.hasStdExtZfa())
2158 return std::make_pair(-1,
false);
2160 bool IsSupportedVT =
false;
2161 if (VT == MVT::f16) {
2162 IsSupportedVT = Subtarget.hasStdExtZfh() || Subtarget.hasStdExtZvfh();
2163 }
else if (VT == MVT::f32) {
2164 IsSupportedVT =
true;
2165 }
else if (VT == MVT::f64) {
2166 assert(Subtarget.hasStdExtD() &&
"Expect D extension");
2167 IsSupportedVT =
true;
2171 return std::make_pair(-1,
false);
2174 if (
Index < 0 && Imm.isNegative())
2178 return std::make_pair(
Index,
false);
2182 bool ForCodeSize)
const {
2183 bool IsLegalVT =
false;
2186 else if (VT == MVT::f32)
2188 else if (VT == MVT::f64)
2190 else if (VT == MVT::bf16)
2191 IsLegalVT = Subtarget.hasStdExtZfbfmin();
2203 return Imm.isZero();
2207 if (Imm.isNegZero())
2220 unsigned Index)
const {
2233 if (EltVT == MVT::i1)
2246 if (
Index + ResElts <= MinVLMAX &&
Index < 31)
2253 if ((ResElts * 2) != SrcElts)
2294 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
2296 Context,
CC, VT, IntermediateVT, NumIntermediates, RegisterVT);
2311 isa<ConstantSDNode>(
LHS.getOperand(1))) {
2317 ShAmt =
LHS.getValueSizeInBits() - 1 -
Log2_64(Mask);
2330 if (
auto *RHSC = dyn_cast<ConstantSDNode>(
RHS)) {
2331 int64_t
C = RHSC->getSExtValue();
2373 switch (KnownSize) {
2401 return RISCV::VRRegClassID;
2403 return RISCV::VRM2RegClassID;
2405 return RISCV::VRM4RegClassID;
2407 return RISCV::VRM8RegClassID;
2417 static_assert(RISCV::sub_vrm1_7 == RISCV::sub_vrm1_0 + 7,
2418 "Unexpected subreg numbering");
2419 return RISCV::sub_vrm1_0 +
Index;
2422 static_assert(RISCV::sub_vrm2_3 == RISCV::sub_vrm2_0 + 3,
2423 "Unexpected subreg numbering");
2424 return RISCV::sub_vrm2_0 +
Index;
2427 static_assert(RISCV::sub_vrm4_1 == RISCV::sub_vrm4_0 + 1,
2428 "Unexpected subreg numbering");
2429 return RISCV::sub_vrm4_0 +
Index;
2436 return RISCV::VRRegClassID;
2445std::pair<unsigned, unsigned>
2447 MVT VecVT,
MVT SubVecVT,
unsigned InsertExtractIdx,
2449 static_assert((RISCV::VRM8RegClassID > RISCV::VRM4RegClassID &&
2450 RISCV::VRM4RegClassID > RISCV::VRM2RegClassID &&
2451 RISCV::VRM2RegClassID > RISCV::VRRegClassID),
2452 "Register classes not ordered");
2461 unsigned SubRegIdx = RISCV::NoSubRegister;
2462 for (
const unsigned RCID :
2463 {RISCV::VRM4RegClassID, RISCV::VRM2RegClassID, RISCV::VRRegClassID})
2464 if (VecRegClassID > RCID && SubRegClassID <= RCID) {
2468 SubRegIdx =
TRI->composeSubRegIndices(SubRegIdx,
2473 return {SubRegIdx, InsertExtractIdx};
2478bool RISCVTargetLowering::mergeStoresAfterLegalization(
EVT VT)
const {
2507unsigned RISCVTargetLowering::combineRepeatedFPDivisors()
const {
2514 "Unexpected opcode");
2516 unsigned IntNo =
Op.getConstantOperandVal(HasChain ? 1 : 0);
2518 RISCVVIntrinsicsTable::getRISCVVIntrinsicInfo(IntNo);
2521 return Op.getOperand(
II->VLOperand + 1 + HasChain);
2595bool RISCVTargetLowering::useRVVForFixedLengthVectorVT(
MVT VT)
const {
2596 return ::useRVVForFixedLengthVectorVT(VT, Subtarget);
2605 "Expected legal fixed length vector!");
2608 unsigned MaxELen = Subtarget.
getELen();
2642 return ::getContainerForFixedLengthVector(*
this, VT,
getSubtarget());
2649 "Expected to convert into a scalable vector!");
2650 assert(V.getValueType().isFixedLengthVector() &&
2651 "Expected a fixed length vector operand!");
2661 "Expected to convert into a fixed length vector!");
2662 assert(V.getValueType().isScalableVector() &&
2663 "Expected a scalable vector operand!");
2686static std::pair<SDValue, SDValue>
2695static std::pair<SDValue, SDValue>
2708static std::pair<SDValue, SDValue>
2725std::pair<unsigned, unsigned>
2741 return std::make_pair(MinVLMAX, MaxVLMAX);
2753 EVT VT,
unsigned DefinedValues)
const {
2767 std::tie(LMul, Fractional) =
2770 Cost = LMul <= DLenFactor ? (DLenFactor / LMul) : 1;
2772 Cost = (LMul * DLenFactor);
2817 MVT DstVT =
Op.getSimpleValueType();
2818 EVT SatVT = cast<VTSDNode>(
Op.getOperand(1))->getVT();
2826 Src.getValueType() == MVT::bf16) {
2833 else if (DstVT == MVT::i64 && SatVT == MVT::i32)
2841 Opc,
DL, DstVT, Src,
2855 MVT SrcVT = Src.getSimpleValueType();
2861 if (SatVT != DstEltVT)
2864 MVT DstContainerVT = DstVT;
2865 MVT SrcContainerVT = SrcVT;
2871 "Expected same element count");
2880 {Src, Src, DAG.getCondCode(ISD::SETNE),
2881 DAG.getUNDEF(Mask.getValueType()), Mask, VL});
2885 if (DstEltSize > (2 * SrcEltSize)) {
2891 MVT CvtContainerVT = DstContainerVT;
2892 MVT CvtEltVT = DstEltVT;
2893 if (SrcEltSize > (2 * DstEltSize)) {
2902 while (CvtContainerVT != DstContainerVT) {
2908 Res = DAG.
getNode(ClipOpc,
DL, CvtContainerVT, Res, Mask, VL);
2915 Res, DAG.
getUNDEF(DstContainerVT), VL);
2927 case ISD::VP_FROUNDEVEN:
2931 case ISD::VP_FROUNDTOZERO:
2935 case ISD::VP_FFLOOR:
2943 case ISD::VP_FROUND:
2959 MVT VT =
Op.getSimpleValueType();
2966 MVT ContainerVT = VT;
2973 if (
Op->isVPOpcode()) {
2974 Mask =
Op.getOperand(1);
2978 VL =
Op.getOperand(2);
3000 DAG.
getUNDEF(ContainerVT), MaxValNode, VL);
3014 switch (
Op.getOpcode()) {
3020 case ISD::VP_FFLOOR:
3023 case ISD::VP_FROUND:
3024 case ISD::VP_FROUNDEVEN:
3025 case ISD::VP_FROUNDTOZERO: {
3041 case ISD::VP_FNEARBYINT:
3054 Src, Src, Mask, VL);
3069 MVT VT =
Op.getSimpleValueType();
3073 MVT ContainerVT = VT;
3085 MVT MaskVT = Mask.getSimpleValueType();
3088 {Chain, Src, Src, DAG.getCondCode(ISD::SETUNE),
3089 DAG.getUNDEF(MaskVT), Mask, VL});
3093 {Chain, Src, Src, Src, Unorder, VL});
3094 Chain = Src.getValue(1);
3110 DAG.
getUNDEF(ContainerVT), MaxValNode, VL);
3122 switch (
Op.getOpcode()) {
3133 {Chain, Src, Mask, DAG.getTargetConstant(FRM, DL, XLenVT), VL});
3139 DAG.
getVTList(IntVT, MVT::Other), Chain, Src, Mask, VL);
3143 DAG.
getVTList(ContainerVT, MVT::Other), Chain, Src,
3152 DAG.
getVTList(ContainerVT, MVT::Other), Chain,
3153 Truncated, Mask, VL);
3159 Src, Src, Mask, VL);
3169 MVT VT =
Op.getSimpleValueType();
3197 MVT VT =
Op.getSimpleValueType();
3202 MVT ContainerVT = VT;
3245 "Unexpected vector MVT");
3273 return std::nullopt;
3291 unsigned EltSizeInBits) {
3294 return std::nullopt;
3295 bool IsInteger =
Op.getValueType().isInteger();
3297 std::optional<unsigned> SeqStepDenom;
3298 std::optional<APInt> SeqStepNum;
3299 std::optional<APInt> SeqAddend;
3300 std::optional<std::pair<APInt, unsigned>> PrevElt;
3301 assert(EltSizeInBits >=
Op.getValueType().getScalarSizeInBits());
3306 const unsigned OpSize =
Op.getScalarValueSizeInBits();
3308 if (Elt.isUndef()) {
3309 Elts[
Idx] = std::nullopt;
3313 Elts[
Idx] = Elt->getAsAPIntVal().trunc(OpSize).zext(EltSizeInBits);
3318 return std::nullopt;
3319 Elts[
Idx] = *ExactInteger;
3332 unsigned IdxDiff =
Idx - PrevElt->second;
3333 APInt ValDiff = *Elt - PrevElt->first;
3341 int64_t Remainder = ValDiff.
srem(IdxDiff);
3346 return std::nullopt;
3347 ValDiff = ValDiff.
sdiv(IdxDiff);
3352 SeqStepNum = ValDiff;
3353 else if (ValDiff != SeqStepNum)
3354 return std::nullopt;
3357 SeqStepDenom = IdxDiff;
3358 else if (IdxDiff != *SeqStepDenom)
3359 return std::nullopt;
3363 if (!PrevElt || PrevElt->first != *Elt)
3364 PrevElt = std::make_pair(*Elt,
Idx);
3368 if (!SeqStepNum || !SeqStepDenom)
3369 return std::nullopt;
3377 (
APInt(EltSizeInBits,
Idx) * *SeqStepNum).sdiv(*SeqStepDenom);
3379 APInt Addend = *Elt - ExpectedVal;
3382 else if (Addend != SeqAddend)
3383 return std::nullopt;
3386 assert(SeqAddend &&
"Must have an addend if we have a step");
3388 return VIDSequence{SeqStepNum->getSExtValue(), *SeqStepDenom,
3389 SeqAddend->getSExtValue()};
3410 MVT ContainerVT = VT;
3438 MVT VT =
Op.getSimpleValueType();
3450 unsigned MostCommonCount = 0;
3452 unsigned NumUndefElts =
3460 unsigned NumScalarLoads = 0;
3466 ValueCounts.
insert(std::make_pair(V, 0));
3467 unsigned &Count = ValueCounts[V];
3469 if (
auto *CFP = dyn_cast<ConstantFPSDNode>(V))
3470 NumScalarLoads += !CFP->isExactlyValue(+0.0);
3475 if (++Count >= MostCommonCount) {
3477 MostCommonCount = Count;
3481 assert(DominantValue &&
"Not expecting an all-undef BUILD_VECTOR");
3482 unsigned NumDefElts = NumElts - NumUndefElts;
3483 unsigned DominantValueCountThreshold = NumDefElts <= 2 ? 0 : NumDefElts - 2;
3489 ((MostCommonCount > DominantValueCountThreshold) ||
3502 !LastOp.isUndef() && ValueCounts[LastOp] == 1 &&
3503 LastOp != DominantValue) {
3512 Processed.insert(LastOp);
3517 const SDValue &V = OpIdx.value();
3518 if (V.isUndef() || !Processed.insert(V).second)
3520 if (ValueCounts[V] == 1) {
3529 return DAG.getConstant(V == V1, DL, XLenVT);
3545 MVT VT =
Op.getSimpleValueType();
3575 unsigned NumViaIntegerBits = std::clamp(NumElts, 8u, Subtarget.
getXLen());
3576 NumViaIntegerBits = std::min(NumViaIntegerBits, Subtarget.
getELen());
3584 unsigned IntegerViaVecElts =
divideCeil(NumElts, NumViaIntegerBits);
3585 MVT IntegerViaVecVT =
3590 unsigned BitPos = 0, IntegerEltIdx = 0;
3593 for (
unsigned I = 0;
I < NumElts;) {
3595 bool BitValue = !V.isUndef() && V->getAsZExtVal();
3596 Bits |= ((
uint64_t)BitValue << BitPos);
3602 if (
I % NumViaIntegerBits == 0 ||
I == NumElts) {
3603 if (NumViaIntegerBits <= 32)
3604 Bits = SignExtend64<32>(Bits);
3606 Elts[IntegerEltIdx] = Elt;
3615 if (NumElts < NumViaIntegerBits) {
3619 assert(IntegerViaVecVT == MVT::v1i8 &&
"Unexpected mask vector type");
3647 int64_t StepNumerator = SimpleVID->StepNumerator;
3648 unsigned StepDenominator = SimpleVID->StepDenominator;
3649 int64_t Addend = SimpleVID->Addend;
3651 assert(StepNumerator != 0 &&
"Invalid step");
3652 bool Negate =
false;
3653 int64_t SplatStepVal = StepNumerator;
3657 if (StepNumerator != 1 && StepNumerator !=
INT64_MIN &&
3659 Negate = StepNumerator < 0;
3661 SplatStepVal =
Log2_64(std::abs(StepNumerator));
3668 if (((StepOpcode ==
ISD::MUL && isInt<12>(SplatStepVal)) ||
3669 (StepOpcode ==
ISD::SHL && isUInt<5>(SplatStepVal))) &&
3671 (SplatStepVal >= 0 || StepDenominator == 1) && isInt<5>(Addend)) {
3674 MVT VIDContainerVT =
3682 if ((StepOpcode ==
ISD::MUL && SplatStepVal != 1) ||
3683 (StepOpcode ==
ISD::SHL && SplatStepVal != 0)) {
3685 VID = DAG.
getNode(StepOpcode,
DL, VIDVT, VID, SplatStep);
3687 if (StepDenominator != 1) {
3692 if (Addend != 0 || Negate) {
3711 assert((ViaIntVT == MVT::i16 || ViaIntVT == MVT::i32) &&
3712 "Unexpected sequence type");
3716 unsigned ViaVecLen =
3720 uint64_t EltMask = maskTrailingOnes<uint64_t>(EltBitSize);
3723 for (
const auto &OpIdx :
enumerate(
Op->op_values())) {
3724 const auto &SeqV = OpIdx.value();
3725 if (!SeqV.isUndef())
3727 ((SeqV->getAsZExtVal() & EltMask) << (OpIdx.index() * EltBitSize));
3733 if (ViaIntVT == MVT::i32)
3734 SplatValue = SignExtend64<32>(SplatValue);
3756 const auto *BV = cast<BuildVectorSDNode>(
Op);
3759 BV->getRepeatedSequence(Sequence) &&
3760 (Sequence.size() * EltBitSize) <= Subtarget.
getELen()) {
3761 unsigned SeqLen = Sequence.size();
3763 assert((ViaIntVT == MVT::i16 || ViaIntVT == MVT::i32 ||
3764 ViaIntVT == MVT::i64) &&
3765 "Unexpected sequence type");
3770 const unsigned RequiredVL = NumElts / SeqLen;
3771 const unsigned ViaVecLen =
3773 NumElts : RequiredVL;
3776 unsigned EltIdx = 0;
3777 uint64_t EltMask = maskTrailingOnes<uint64_t>(EltBitSize);
3781 for (
const auto &SeqV : Sequence) {
3782 if (!SeqV.isUndef())
3784 ((SeqV->getAsZExtVal() & EltMask) << (EltIdx * EltBitSize));
3791 if (ViaIntVT == MVT::i32)
3792 SplatValue = SignExtend64<32>(SplatValue);
3798 (!Subtarget.
is64Bit() && ViaIntVT == MVT::i64)) &&
3799 "Unexpected bitcast sequence");
3800 if (ViaIntVT.
bitsLE(XLenVT) || isInt<32>(SplatValue)) {
3803 MVT ViaContainerVT =
3810 if (ViaVecLen != RequiredVL)
3830 Source, DAG, Subtarget);
3850 return RISCV::PACKH;
3852 return Subtarget.
is64Bit() ? RISCV::PACKW : RISCV::PACK;
3867 MVT VT =
Op.getSimpleValueType();
3875 if (!Subtarget.hasStdExtZbb() || !Subtarget.hasStdExtZba())
3880 if (ElemSizeInBits >= std::min(Subtarget.
getELen(), Subtarget.
getXLen()) ||
3894 if (Subtarget.hasStdExtZbkb())
3899 ElemDL, XLenVT,
A,
B),
3906 Flags.setDisjoint(
true);
3912 NewOperands.
reserve(NumElts / 2);
3914 NewOperands.
push_back(pack(
Op.getOperand(i),
Op.getOperand(i + 1)));
3924 MVT VT =
Op.getSimpleValueType();
3935 MVT VT =
Op.getSimpleValueType();
3940 !Subtarget.hasStdExtZfhmin())
4012 auto OneVRegOfOps =
ArrayRef(BuildVectorOps).
slice(i, ElemsPerVReg);
4016 unsigned InsertIdx = (i / ElemsPerVReg) * NumOpElts;
4039 unsigned NumUndefElts =
4041 unsigned NumDefElts = NumElts - NumUndefElts;
4042 if (NumDefElts >= 8 && NumDefElts > NumElts / 2 &&
4049 for (
unsigned i = 0; i < NumElts; i++) {
4051 if (i < NumElts / 2) {
4058 bool SelectMaskVal = (i < NumElts / 2);
4061 assert(SubVecAOps.
size() == NumElts && SubVecBOps.
size() == NumElts &&
4062 MaskVals.
size() == NumElts);
4097 unsigned UndefCount = 0;
4104 LinearBudget -= PerSlideCost;
4107 LinearBudget -= PerSlideCost;
4110 LinearBudget -= PerSlideCost;
4113 if (LinearBudget < 0)
4118 "Illegal type which will result in reserved encoding");
4143 Vec,
Offset, Mask, VL, Policy);
4156 Vec,
Offset, Mask, VL, Policy);
4166 if (isa<ConstantSDNode>(
Lo) && isa<ConstantSDNode>(
Hi)) {
4167 int32_t LoC = cast<ConstantSDNode>(
Lo)->getSExtValue();
4168 int32_t HiC = cast<ConstantSDNode>(
Hi)->getSExtValue();
4171 if ((LoC >> 31) == HiC)
4182 (isa<RegisterSDNode>(VL) &&
4183 cast<RegisterSDNode>(VL)->
getReg() == RISCV::X0))
4185 else if (isa<ConstantSDNode>(VL) && isUInt<4>(VL->
getAsZExtVal()))
4200 isa<ConstantSDNode>(
Hi.getOperand(1)) &&
4201 Hi.getConstantOperandVal(1) == 31)