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()))
273 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[] = {
380 static const unsigned FPOpToExpand[] = {
384 static const unsigned FPRndMode[] = {
391 static const unsigned ZfhminZfbfminPromoteOps[] = {
402 if (Subtarget.hasStdExtZfbfmin()) {
485 if (Subtarget.hasStdExtZfa()) {
502 if (Subtarget.hasStdExtZfa()) {
574 if (Subtarget.hasStdExtZicbop()) {
578 if (Subtarget.hasStdExtA()) {
580 if (Subtarget.hasStdExtZabha() && Subtarget.hasStdExtZacas())
584 }
else if (Subtarget.hasForcedAtomics()) {
608 {MVT::i8, MVT::i16},
Custom);
619 static const unsigned IntegerVPOps[] = {
620 ISD::VP_ADD, ISD::VP_SUB, ISD::VP_MUL,
621 ISD::VP_SDIV, ISD::VP_UDIV, ISD::VP_SREM,
622 ISD::VP_UREM, ISD::VP_AND, ISD::VP_OR,
623 ISD::VP_XOR, ISD::VP_SRA, ISD::VP_SRL,
624 ISD::VP_SHL, ISD::VP_REDUCE_ADD, ISD::VP_REDUCE_AND,
625 ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR, ISD::VP_REDUCE_SMAX,
626 ISD::VP_REDUCE_SMIN, ISD::VP_REDUCE_UMAX, ISD::VP_REDUCE_UMIN,
627 ISD::VP_MERGE, ISD::VP_SELECT, ISD::VP_FP_TO_SINT,
628 ISD::VP_FP_TO_UINT, ISD::VP_SETCC, ISD::VP_SIGN_EXTEND,
629 ISD::VP_ZERO_EXTEND, ISD::VP_TRUNCATE, ISD::VP_SMIN,
630 ISD::VP_SMAX, ISD::VP_UMIN, ISD::VP_UMAX,
631 ISD::VP_ABS, ISD::EXPERIMENTAL_VP_REVERSE, ISD::EXPERIMENTAL_VP_SPLICE,
632 ISD::VP_SADDSAT, ISD::VP_UADDSAT, ISD::VP_SSUBSAT,
633 ISD::VP_USUBSAT, ISD::VP_CTTZ_ELTS, ISD::VP_CTTZ_ELTS_ZERO_UNDEF,
634 ISD::EXPERIMENTAL_VP_SPLAT};
636 static const unsigned FloatingPointVPOps[] = {
637 ISD::VP_FADD, ISD::VP_FSUB, ISD::VP_FMUL,
638 ISD::VP_FDIV, ISD::VP_FNEG, ISD::VP_FABS,
639 ISD::VP_FMA, ISD::VP_REDUCE_FADD, ISD::VP_REDUCE_SEQ_FADD,
640 ISD::VP_REDUCE_FMIN, ISD::VP_REDUCE_FMAX, ISD::VP_MERGE,
641 ISD::VP_SELECT, ISD::VP_SINT_TO_FP, ISD::VP_UINT_TO_FP,
642 ISD::VP_SETCC, ISD::VP_FP_ROUND, ISD::VP_FP_EXTEND,
643 ISD::VP_SQRT, ISD::VP_FMINNUM, ISD::VP_FMAXNUM,
644 ISD::VP_FCEIL, ISD::VP_FFLOOR, ISD::VP_FROUND,
645 ISD::VP_FROUNDEVEN, ISD::VP_FCOPYSIGN, ISD::VP_FROUNDTOZERO,
646 ISD::VP_FRINT, ISD::VP_FNEARBYINT, ISD::VP_IS_FPCLASS,
647 ISD::VP_FMINIMUM, ISD::VP_FMAXIMUM, ISD::VP_LRINT,
648 ISD::VP_LLRINT, ISD::EXPERIMENTAL_VP_REVERSE,
649 ISD::EXPERIMENTAL_VP_SPLICE, ISD::VP_REDUCE_FMINIMUM,
650 ISD::VP_REDUCE_FMAXIMUM, ISD::EXPERIMENTAL_VP_SPLAT};
652 static const unsigned IntegerVecReduceOps[] = {
657 static const unsigned FloatingPointVecReduceOps[] = {
670 ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR,
671 ISD::VP_REDUCE_SMAX, ISD::VP_REDUCE_SMIN,
672 ISD::VP_REDUCE_UMAX, ISD::VP_REDUCE_UMIN},
676 for (
MVT VT : BoolVecVTs) {
706 {ISD::VP_REDUCE_AND, ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR}, VT,
730 ISD::VP_TRUNCATE, ISD::VP_SETCC},
746 for (
MVT VT : IntVecVTs) {
757 if (VT.getVectorElementType() == MVT::i64 && !Subtarget.hasStdExtV())
805 {ISD::VP_LOAD, ISD::VP_STORE, ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
806 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER, ISD::VP_SCATTER},
830 if (Subtarget.hasStdExtZvkb()) {
838 if (Subtarget.hasStdExtZvbb()) {
842 ISD::VP_CTTZ_ZERO_UNDEF, ISD::VP_CTPOP},
848 ISD::VP_CTTZ_ZERO_UNDEF, ISD::VP_CTPOP},
857 ISD::VP_CTLZ_ZERO_UNDEF, ISD::VP_CTTZ_ZERO_UNDEF},
877 static const unsigned ZvfhminPromoteOps[] = {
887 static const unsigned ZvfhminPromoteVPOps[] = {
888 ISD::VP_FADD, ISD::VP_FSUB, ISD::VP_FMUL,
889 ISD::VP_FDIV, ISD::VP_FNEG, ISD::VP_FABS,
890 ISD::VP_FMA, ISD::VP_REDUCE_FADD, ISD::VP_REDUCE_SEQ_FADD,
891 ISD::VP_REDUCE_FMIN, ISD::VP_REDUCE_FMAX, ISD::VP_SQRT,
892 ISD::VP_FMINNUM, ISD::VP_FMAXNUM, ISD::VP_FCEIL,
893 ISD::VP_FFLOOR, ISD::VP_FROUND, ISD::VP_FROUNDEVEN,
894 ISD::VP_FCOPYSIGN, ISD::VP_FROUNDTOZERO, ISD::VP_FRINT,
895 ISD::VP_FNEARBYINT, ISD::VP_SETCC, ISD::VP_FMINIMUM,
896 ISD::VP_FMAXIMUM, ISD::VP_REDUCE_FMINIMUM, ISD::VP_REDUCE_FMAXIMUM};
899 const auto SetCommonVFPActions = [&](
MVT VT) {
944 {ISD::VP_LOAD, ISD::VP_STORE, ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
945 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER, ISD::VP_SCATTER},
976 const auto SetCommonVFPExtLoadTruncStoreActions =
978 for (
auto SmallVT : SmallerVTs) {
985 for (
MVT VT : F16VecVTs) {
988 SetCommonVFPActions(VT);
991 for (
MVT VT : F16VecVTs) {
1002 ISD::VP_SINT_TO_FP, ISD::VP_UINT_TO_FP},
1007 if (Subtarget.hasStdExtZfhmin())
1013 if (VT == MVT::nxv32f16) {
1027 for (
MVT VT : BF16VecVTs) {
1038 if (Subtarget.hasStdExtZfbfmin())
1048 for (
MVT VT : F32VecVTs) {
1051 SetCommonVFPActions(VT);
1052 SetCommonVFPExtLoadTruncStoreActions(VT, F16VecVTs);
1057 for (
MVT VT : F64VecVTs) {
1060 SetCommonVFPActions(VT);
1061 SetCommonVFPExtLoadTruncStoreActions(VT, F16VecVTs);
1062 SetCommonVFPExtLoadTruncStoreActions(VT, F32VecVTs);
1068 if (!useRVVForFixedLengthVectorVT(VT))
1111 {ISD::VP_REDUCE_AND, ISD::VP_REDUCE_OR, ISD::VP_REDUCE_XOR}, VT,
1138 ISD::VP_SETCC, ISD::VP_TRUNCATE},
1160 ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
1161 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER,
1198 if (Subtarget.hasStdExtZvkb())
1201 if (Subtarget.hasStdExtZvbb()) {
1223 if (!useRVVForFixedLengthVectorVT(VT))
1253 ISD::VP_SINT_TO_FP, ISD::VP_UINT_TO_FP},
1256 if (Subtarget.hasStdExtZfhmin()) {
1294 ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
1295 ISD::EXPERIMENTAL_VP_STRIDED_STORE, ISD::VP_GATHER,
1341 if (Subtarget.hasStdExtA())
1344 if (Subtarget.hasForcedAtomics()) {
1354 if (Subtarget.hasVendorXTHeadMemIdx()) {
1370 if (Subtarget.hasVendorXCVmem() && !Subtarget.
is64Bit()) {
1395 if (Subtarget.hasStdExtZbb())
1398 if ((Subtarget.hasStdExtZbs() && Subtarget.
is64Bit()) ||
1402 if (Subtarget.hasStdExtZbkb())
1414 ISD::EXPERIMENTAL_VP_REVERSE,
ISD::MUL,
1417 if (Subtarget.hasVendorXTHeadMemPair())
1445MVT RISCVTargetLowering::getVPExplicitVectorLengthTy()
const {
1450bool RISCVTargetLowering::shouldExpandGetVectorLength(
EVT TripCountVT,
1452 bool IsScalable)
const {
1459 if (TripCountVT != MVT::i32 && TripCountVT != Subtarget.
getXLenVT())
1484 unsigned Intrinsic)
const {
1485 auto &
DL =
I.getDataLayout();
1487 auto SetRVVLoadStoreInfo = [&](
unsigned PtrOp,
bool IsStore,
1488 bool IsUnitStrided,
bool UsePtrVal =
false) {
1493 Info.ptrVal =
I.getArgOperand(PtrOp);
1495 Info.fallbackAddressSpace =
1496 I.getArgOperand(PtrOp)->getType()->getPointerAddressSpace();
1500 MemTy =
I.getArgOperand(0)->getType();
1503 MemTy =
I.getType();
1518 if (
I.hasMetadata(LLVMContext::MD_nontemporal))
1522 switch (Intrinsic) {
1525 case Intrinsic::riscv_masked_atomicrmw_xchg_i32:
1526 case Intrinsic::riscv_masked_atomicrmw_add_i32:
1527 case Intrinsic::riscv_masked_atomicrmw_sub_i32:
1528 case Intrinsic::riscv_masked_atomicrmw_nand_i32:
1529 case Intrinsic::riscv_masked_atomicrmw_max_i32:
1530 case Intrinsic::riscv_masked_atomicrmw_min_i32:
1531 case Intrinsic::riscv_masked_atomicrmw_umax_i32:
1532 case Intrinsic::riscv_masked_atomicrmw_umin_i32:
1533 case Intrinsic::riscv_masked_cmpxchg_i32:
1535 Info.memVT = MVT::i32;
1536 Info.ptrVal =
I.getArgOperand(0);
1542 case Intrinsic::riscv_seg2_load:
1543 case Intrinsic::riscv_seg3_load:
1544 case Intrinsic::riscv_seg4_load:
1545 case Intrinsic::riscv_seg5_load:
1546 case Intrinsic::riscv_seg6_load:
1547 case Intrinsic::riscv_seg7_load:
1548 case Intrinsic::riscv_seg8_load:
1549 return SetRVVLoadStoreInfo( 0,
false,
1551 case Intrinsic::riscv_seg2_store:
1552 case Intrinsic::riscv_seg3_store:
1553 case Intrinsic::riscv_seg4_store:
1554 case Intrinsic::riscv_seg5_store:
1555 case Intrinsic::riscv_seg6_store:
1556 case Intrinsic::riscv_seg7_store:
1557 case Intrinsic::riscv_seg8_store:
1559 return SetRVVLoadStoreInfo(
I.arg_size() - 2,
1562 case Intrinsic::riscv_vle:
1563 case Intrinsic::riscv_vle_mask:
1564 case Intrinsic::riscv_vleff:
1565 case Intrinsic::riscv_vleff_mask:
1566 return SetRVVLoadStoreInfo( 1,
1570 case Intrinsic::riscv_vse:
1571 case Intrinsic::riscv_vse_mask:
1572 return SetRVVLoadStoreInfo( 1,
1576 case Intrinsic::riscv_vlse:
1577 case Intrinsic::riscv_vlse_mask:
1578 case Intrinsic::riscv_vloxei:
1579 case Intrinsic::riscv_vloxei_mask:
1580 case Intrinsic::riscv_vluxei:
1581 case Intrinsic::riscv_vluxei_mask:
1582 return SetRVVLoadStoreInfo( 1,
1585 case Intrinsic::riscv_vsse:
1586 case Intrinsic::riscv_vsse_mask:
1587 case Intrinsic::riscv_vsoxei:
1588 case Intrinsic::riscv_vsoxei_mask:
1589 case Intrinsic::riscv_vsuxei:
1590 case Intrinsic::riscv_vsuxei_mask:
1591 return SetRVVLoadStoreInfo( 1,
1594 case Intrinsic::riscv_vlseg2:
1595 case Intrinsic::riscv_vlseg3:
1596 case Intrinsic::riscv_vlseg4:
1597 case Intrinsic::riscv_vlseg5:
1598 case Intrinsic::riscv_vlseg6:
1599 case Intrinsic::riscv_vlseg7:
1600 case Intrinsic::riscv_vlseg8:
1601 case Intrinsic::riscv_vlseg2ff:
1602 case Intrinsic::riscv_vlseg3ff:
1603 case Intrinsic::riscv_vlseg4ff:
1604 case Intrinsic::riscv_vlseg5ff:
1605 case Intrinsic::riscv_vlseg6ff:
1606 case Intrinsic::riscv_vlseg7ff:
1607 case Intrinsic::riscv_vlseg8ff:
1608 return SetRVVLoadStoreInfo(
I.arg_size() - 2,
1611 case Intrinsic::riscv_vlseg2_mask:
1612 case Intrinsic::riscv_vlseg3_mask:
1613 case Intrinsic::riscv_vlseg4_mask:
1614 case Intrinsic::riscv_vlseg5_mask:
1615 case Intrinsic::riscv_vlseg6_mask:
1616 case Intrinsic::riscv_vlseg7_mask:
1617 case Intrinsic::riscv_vlseg8_mask:
1618 case Intrinsic::riscv_vlseg2ff_mask:
1619 case Intrinsic::riscv_vlseg3ff_mask:
1620 case Intrinsic::riscv_vlseg4ff_mask:
1621 case Intrinsic::riscv_vlseg5ff_mask:
1622 case Intrinsic::riscv_vlseg6ff_mask:
1623 case Intrinsic::riscv_vlseg7ff_mask:
1624 case Intrinsic::riscv_vlseg8ff_mask:
1625 return SetRVVLoadStoreInfo(
I.arg_size() - 4,
1628 case Intrinsic::riscv_vlsseg2:
1629 case Intrinsic::riscv_vlsseg3:
1630 case Intrinsic::riscv_vlsseg4:
1631 case Intrinsic::riscv_vlsseg5:
1632 case Intrinsic::riscv_vlsseg6:
1633 case Intrinsic::riscv_vlsseg7:
1634 case Intrinsic::riscv_vlsseg8:
1635 case Intrinsic::riscv_vloxseg2:
1636 case Intrinsic::riscv_vloxseg3:
1637 case Intrinsic::riscv_vloxseg4:
1638 case Intrinsic::riscv_vloxseg5:
1639 case Intrinsic::riscv_vloxseg6:
1640 case Intrinsic::riscv_vloxseg7:
1641 case Intrinsic::riscv_vloxseg8:
1642 case Intrinsic::riscv_vluxseg2:
1643 case Intrinsic::riscv_vluxseg3:
1644 case Intrinsic::riscv_vluxseg4:
1645 case Intrinsic::riscv_vluxseg5:
1646 case Intrinsic::riscv_vluxseg6:
1647 case Intrinsic::riscv_vluxseg7:
1648 case Intrinsic::riscv_vluxseg8:
1649 return SetRVVLoadStoreInfo(
I.arg_size() - 3,
1652 case Intrinsic::riscv_vlsseg2_mask:
1653 case Intrinsic::riscv_vlsseg3_mask:
1654 case Intrinsic::riscv_vlsseg4_mask:
1655 case Intrinsic::riscv_vlsseg5_mask:
1656 case Intrinsic::riscv_vlsseg6_mask:
1657 case Intrinsic::riscv_vlsseg7_mask:
1658 case Intrinsic::riscv_vlsseg8_mask:
1659 case Intrinsic::riscv_vloxseg2_mask:
1660 case Intrinsic::riscv_vloxseg3_mask:
1661 case Intrinsic::riscv_vloxseg4_mask:
1662 case Intrinsic::riscv_vloxseg5_mask:
1663 case Intrinsic::riscv_vloxseg6_mask:
1664 case Intrinsic::riscv_vloxseg7_mask:
1665 case Intrinsic::riscv_vloxseg8_mask:
1666 case Intrinsic::riscv_vluxseg2_mask:
1667 case Intrinsic::riscv_vluxseg3_mask:
1668 case Intrinsic::riscv_vluxseg4_mask:
1669 case Intrinsic::riscv_vluxseg5_mask:
1670 case Intrinsic::riscv_vluxseg6_mask:
1671 case Intrinsic::riscv_vluxseg7_mask:
1672 case Intrinsic::riscv_vluxseg8_mask:
1673 return SetRVVLoadStoreInfo(
I.arg_size() - 5,
1676 case Intrinsic::riscv_vsseg2:
1677 case Intrinsic::riscv_vsseg3:
1678 case Intrinsic::riscv_vsseg4:
1679 case Intrinsic::riscv_vsseg5:
1680 case Intrinsic::riscv_vsseg6:
1681 case Intrinsic::riscv_vsseg7:
1682 case Intrinsic::riscv_vsseg8:
1683 return SetRVVLoadStoreInfo(
I.arg_size() - 2,
1686 case Intrinsic::riscv_vsseg2_mask:
1687 case Intrinsic::riscv_vsseg3_mask:
1688 case Intrinsic::riscv_vsseg4_mask:
1689 case Intrinsic::riscv_vsseg5_mask:
1690 case Intrinsic::riscv_vsseg6_mask:
1691 case Intrinsic::riscv_vsseg7_mask:
1692 case Intrinsic::riscv_vsseg8_mask:
1693 return SetRVVLoadStoreInfo(
I.arg_size() - 3,
1696 case Intrinsic::riscv_vssseg2:
1697 case Intrinsic::riscv_vssseg3:
1698 case Intrinsic::riscv_vssseg4:
1699 case Intrinsic::riscv_vssseg5:
1700 case Intrinsic::riscv_vssseg6:
1701 case Intrinsic::riscv_vssseg7:
1702 case Intrinsic::riscv_vssseg8:
1703 case Intrinsic::riscv_vsoxseg2:
1704 case Intrinsic::riscv_vsoxseg3:
1705 case Intrinsic::riscv_vsoxseg4:
1706 case Intrinsic::riscv_vsoxseg5:
1707 case Intrinsic::riscv_vsoxseg6:
1708 case Intrinsic::riscv_vsoxseg7:
1709 case Intrinsic::riscv_vsoxseg8:
1710 case Intrinsic::riscv_vsuxseg2:
1711 case Intrinsic::riscv_vsuxseg3:
1712 case Intrinsic::riscv_vsuxseg4:
1713 case Intrinsic::riscv_vsuxseg5:
1714 case Intrinsic::riscv_vsuxseg6:
1715 case Intrinsic::riscv_vsuxseg7:
1716 case Intrinsic::riscv_vsuxseg8:
1717 return SetRVVLoadStoreInfo(
I.arg_size() - 3,
1720 case Intrinsic::riscv_vssseg2_mask:
1721 case Intrinsic::riscv_vssseg3_mask:
1722 case Intrinsic::riscv_vssseg4_mask:
1723 case Intrinsic::riscv_vssseg5_mask:
1724 case Intrinsic::riscv_vssseg6_mask:
1725 case Intrinsic::riscv_vssseg7_mask:
1726 case Intrinsic::riscv_vssseg8_mask:
1727 case Intrinsic::riscv_vsoxseg2_mask:
1728 case Intrinsic::riscv_vsoxseg3_mask:
1729 case Intrinsic::riscv_vsoxseg4_mask:
1730 case Intrinsic::riscv_vsoxseg5_mask:
1731 case Intrinsic::riscv_vsoxseg6_mask:
1732 case Intrinsic::riscv_vsoxseg7_mask:
1733 case Intrinsic::riscv_vsoxseg8_mask:
1734 case Intrinsic::riscv_vsuxseg2_mask:
1735 case Intrinsic::riscv_vsuxseg3_mask:
1736 case Intrinsic::riscv_vsuxseg4_mask:
1737 case Intrinsic::riscv_vsuxseg5_mask:
1738 case Intrinsic::riscv_vsuxseg6_mask:
1739 case Intrinsic::riscv_vsuxseg7_mask:
1740 case Intrinsic::riscv_vsuxseg8_mask:
1741 return SetRVVLoadStoreInfo(
I.arg_size() - 4,
1782 return isInt<12>(Imm);
1786 return isInt<12>(Imm);
1799 return (SrcBits == 64 && DestBits == 32);
1810 return (SrcBits == 64 && DestBits == 32);
1821 if (SrcBits == DestBits * 2) {
1832 if (
auto *LD = dyn_cast<LoadSDNode>(Val)) {
1833 EVT MemVT = LD->getMemoryVT();
1834 if ((MemVT == MVT::i8 || MemVT == MVT::i16) &&
1844 return Subtarget.
is64Bit() && SrcVT == MVT::i32 && DstVT == MVT::i64;
1852 return Subtarget.hasStdExtZbb() ||
1853 (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit());
1857 return Subtarget.hasStdExtZbb() || Subtarget.hasVendorXTHeadBb() ||
1858 (Subtarget.hasVendorXCVbitmanip() && !Subtarget.
is64Bit());
1869 if (!Subtarget.hasStdExtZbs() && !Subtarget.hasVendorXTHeadBs())
1874 return !Mask->getValue().isSignedIntN(12) && Mask->getValue().isPowerOf2();
1878 EVT VT =
Y.getValueType();
1884 return (Subtarget.hasStdExtZbb() || Subtarget.hasStdExtZbkb()) &&
1885 (!isa<ConstantSDNode>(
Y) || cast<ConstantSDNode>(
Y)->isOpaque());
1890 if (Subtarget.hasStdExtZbs())
1891 return X.getValueType().isScalarInteger();
1892 auto *
C = dyn_cast<ConstantSDNode>(
Y);
1894 if (Subtarget.hasVendorXTHeadBs())
1895 return C !=
nullptr;
1897 return C &&
C->getAPIntValue().ule(10);
1917 if (BitSize > Subtarget.
getXLen())
1921 int64_t Val = Imm.getSExtValue();
1929 if (!Subtarget.enableUnalignedScalarMem())
1945 unsigned OldShiftOpcode,
unsigned NewShiftOpcode,
1952 if (XC && OldShiftOpcode ==
ISD::SRL && XC->isOne())
1956 if (NewShiftOpcode ==
ISD::SRL &&
CC->isOne())
1968 case Instruction::Add:
1969 case Instruction::Sub:
1970 case Instruction::Mul:
1971 case Instruction::And:
1972 case Instruction::Or:
1973 case Instruction::Xor:
1974 case Instruction::FAdd:
1975 case Instruction::FSub:
1976 case Instruction::FMul:
1977 case Instruction::FDiv:
1978 case Instruction::ICmp:
1979 case Instruction::FCmp:
1981 case Instruction::Shl:
1982 case Instruction::LShr:
1983 case Instruction::AShr:
1984 case Instruction::UDiv:
1985 case Instruction::SDiv:
1986 case Instruction::URem:
1987 case Instruction::SRem:
1988 case Instruction::Select:
1989 return Operand == 1;
2003 auto *
II = dyn_cast<IntrinsicInst>(
I);
2007 switch (
II->getIntrinsicID()) {
2008 case Intrinsic::fma:
2009 case Intrinsic::vp_fma:
2010 return Operand == 0 || Operand == 1;
2011 case Intrinsic::vp_shl:
2012 case Intrinsic::vp_lshr:
2013 case Intrinsic::vp_ashr:
2014 case Intrinsic::vp_udiv:
2015 case Intrinsic::vp_sdiv:
2016 case Intrinsic::vp_urem:
2017 case Intrinsic::vp_srem:
2018 case Intrinsic::ssub_sat:
2019 case Intrinsic::vp_ssub_sat:
2020 case Intrinsic::usub_sat:
2021 case Intrinsic::vp_usub_sat:
2022 return Operand == 1;
2024 case Intrinsic::vp_add:
2025 case Intrinsic::vp_mul:
2026 case Intrinsic::vp_and:
2027 case Intrinsic::vp_or:
2028 case Intrinsic::vp_xor:
2029 case Intrinsic::vp_fadd:
2030 case Intrinsic::vp_fmul:
2031 case Intrinsic::vp_icmp:
2032 case Intrinsic::vp_fcmp:
2033 case Intrinsic::smin:
2034 case Intrinsic::vp_smin:
2035 case Intrinsic::umin:
2036 case Intrinsic::vp_umin:
2037 case Intrinsic::smax:
2038 case Intrinsic::vp_smax:
2039 case Intrinsic::umax:
2040 case Intrinsic::vp_umax:
2041 case Intrinsic::sadd_sat:
2042 case Intrinsic::vp_sadd_sat:
2043 case Intrinsic::uadd_sat:
2044 case Intrinsic::vp_uadd_sat:
2046 case Intrinsic::vp_sub:
2047 case Intrinsic::vp_fsub:
2048 case Intrinsic::vp_fdiv:
2049 return Operand == 0 || Operand == 1;
2070 if (!Subtarget.sinkSplatOperands())
2073 for (
auto OpIdx :
enumerate(
I->operands())) {
2077 Instruction *
Op = dyn_cast<Instruction>(OpIdx.value().get());
2079 if (!
Op ||
any_of(Ops, [&](
Use *U) {
return U->get() ==
Op; }))
2088 if (cast<VectorType>(
Op->getType())->getElementType()->isIntegerTy(1))
2093 for (
Use &U :
Op->uses()) {
2145 if (!Subtarget.hasStdExtZfa())
2146 return std::make_pair(-1,
false);
2148 bool IsSupportedVT =
false;
2149 if (VT == MVT::f16) {
2150 IsSupportedVT = Subtarget.hasStdExtZfh() || Subtarget.hasStdExtZvfh();
2151 }
else if (VT == MVT::f32) {
2152 IsSupportedVT =
true;
2153 }
else if (VT == MVT::f64) {
2154 assert(Subtarget.hasStdExtD() &&
"Expect D extension");
2155 IsSupportedVT =
true;
2159 return std::make_pair(-1,
false);
2162 if (
Index < 0 && Imm.isNegative())
2166 return std::make_pair(
Index,
false);
2170 bool ForCodeSize)
const {
2171 bool IsLegalVT =
false;
2174 else if (VT == MVT::f32)
2176 else if (VT == MVT::f64)
2178 else if (VT == MVT::bf16)
2179 IsLegalVT = Subtarget.hasStdExtZfbfmin();
2191 return Imm.isZero();
2195 if (Imm.isNegZero())
2208 unsigned Index)
const {
2221 if (EltVT == MVT::i1)
2234 if (
Index + ResElts <= MinVLMAX &&
Index < 31)
2241 if ((ResElts * 2) != SrcElts)
2282 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
2284 Context,
CC, VT, IntermediateVT, NumIntermediates, RegisterVT);
2299 isa<ConstantSDNode>(
LHS.getOperand(1))) {
2305 ShAmt =
LHS.getValueSizeInBits() - 1 -
Log2_64(Mask);
2318 if (
auto *RHSC = dyn_cast<ConstantSDNode>(
RHS)) {
2319 int64_t
C = RHSC->getSExtValue();
2361 switch (KnownSize) {
2389 return RISCV::VRRegClassID;
2391 return RISCV::VRM2RegClassID;
2393 return RISCV::VRM4RegClassID;
2395 return RISCV::VRM8RegClassID;
2405 static_assert(RISCV::sub_vrm1_7 == RISCV::sub_vrm1_0 + 7,
2406 "Unexpected subreg numbering");
2407 return RISCV::sub_vrm1_0 +
Index;
2410 static_assert(RISCV::sub_vrm2_3 == RISCV::sub_vrm2_0 + 3,
2411 "Unexpected subreg numbering");
2412 return RISCV::sub_vrm2_0 +
Index;
2415 static_assert(RISCV::sub_vrm4_1 == RISCV::sub_vrm4_0 + 1,
2416 "Unexpected subreg numbering");
2417 return RISCV::sub_vrm4_0 +
Index;
2424 return RISCV::VRRegClassID;
2433std::pair<unsigned, unsigned>
2435 MVT VecVT,
MVT SubVecVT,
unsigned InsertExtractIdx,
2437 static_assert((RISCV::VRM8RegClassID > RISCV::VRM4RegClassID &&
2438 RISCV::VRM4RegClassID > RISCV::VRM2RegClassID &&
2439 RISCV::VRM2RegClassID > RISCV::VRRegClassID),
2440 "Register classes not ordered");
2449 unsigned SubRegIdx = RISCV::NoSubRegister;
2450 for (
const unsigned RCID :
2451 {RISCV::VRM4RegClassID, RISCV::VRM2RegClassID, RISCV::VRRegClassID})
2452 if (VecRegClassID > RCID && SubRegClassID <= RCID) {
2456 SubRegIdx =
TRI->composeSubRegIndices(SubRegIdx,
2461 return {SubRegIdx, InsertExtractIdx};
2466bool RISCVTargetLowering::mergeStoresAfterLegalization(
EVT VT)
const {
2495unsigned RISCVTargetLowering::combineRepeatedFPDivisors()
const {
2502 "Unexpected opcode");
2504 unsigned IntNo =
Op.getConstantOperandVal(HasChain ? 1 : 0);
2506 RISCVVIntrinsicsTable::getRISCVVIntrinsicInfo(IntNo);
2509 return Op.getOperand(
II->VLOperand + 1 + HasChain);
2583bool RISCVTargetLowering::useRVVForFixedLengthVectorVT(
MVT VT)
const {
2584 return ::useRVVForFixedLengthVectorVT(VT, Subtarget);
2593 "Expected legal fixed length vector!");
2596 unsigned MaxELen = Subtarget.
getELen();
2630 return ::getContainerForFixedLengthVector(*
this, VT,
getSubtarget());
2637 "Expected to convert into a scalable vector!");
2638 assert(V.getValueType().isFixedLengthVector() &&
2639 "Expected a fixed length vector operand!");
2649 "Expected to convert into a fixed length vector!");
2650 assert(V.getValueType().isScalableVector() &&
2651 "Expected a scalable vector operand!");
2674static std::pair<SDValue, SDValue>
2683static std::pair<SDValue, SDValue>
2696static std::pair<SDValue, SDValue>
2713std::pair<unsigned, unsigned>
2729 return std::make_pair(MinVLMAX, MaxVLMAX);
2741 EVT VT,
unsigned DefinedValues)
const {
2755 std::tie(LMul, Fractional) =
2758 Cost = LMul <= DLenFactor ? (DLenFactor / LMul) : 1;
2760 Cost = (LMul * DLenFactor);
2805 MVT DstVT =
Op.getSimpleValueType();
2806 EVT SatVT = cast<VTSDNode>(
Op.getOperand(1))->getVT();
2814 Src.getValueType() == MVT::bf16) {
2821 else if (DstVT == MVT::i64 && SatVT == MVT::i32)
2829 Opc,
DL, DstVT, Src,
2843 MVT SrcVT = Src.getSimpleValueType();
2849 if (SatVT != DstEltVT)
2852 MVT DstContainerVT = DstVT;
2853 MVT SrcContainerVT = SrcVT;
2859 "Expected same element count");
2868 {Src, Src, DAG.getCondCode(ISD::SETNE),
2869 DAG.getUNDEF(Mask.getValueType()), Mask, VL});
2873 if (DstEltSize > (2 * SrcEltSize)) {
2879 MVT CvtContainerVT = DstContainerVT;
2880 MVT CvtEltVT = DstEltVT;
2881 if (SrcEltSize > (2 * DstEltSize)) {
2890 while (CvtContainerVT != DstContainerVT) {
2896 Res = DAG.
getNode(ClipOpc,
DL, CvtContainerVT, Res, Mask, VL);
2903 Res, DAG.
getUNDEF(DstContainerVT), VL);
2915 case ISD::VP_FROUNDEVEN:
2919 case ISD::VP_FROUNDTOZERO:
2923 case ISD::VP_FFLOOR:
2931 case ISD::VP_FROUND:
2947 MVT VT =
Op.getSimpleValueType();
2954 MVT ContainerVT = VT;
2961 if (
Op->isVPOpcode()) {
2962 Mask =
Op.getOperand(1);
2966 VL =
Op.getOperand(2);
2988 DAG.
getUNDEF(ContainerVT), MaxValNode, VL);
3002 switch (
Op.getOpcode()) {
3008 case ISD::VP_FFLOOR:
3011 case ISD::VP_FROUND:
3012 case ISD::VP_FROUNDEVEN:
3013 case ISD::VP_FROUNDTOZERO: {
3029 case ISD::VP_FNEARBYINT:
3042 Src, Src, Mask, VL);
3057 MVT VT =
Op.getSimpleValueType();
3061 MVT ContainerVT = VT;
3073 MVT MaskVT = Mask.getSimpleValueType();
3076 {Chain, Src, Src, DAG.getCondCode(ISD::SETUNE),
3077 DAG.getUNDEF(MaskVT), Mask, VL});
3081 {Chain, Src, Src, Src, Unorder, VL});
3082 Chain = Src.getValue(1);
3098 DAG.
getUNDEF(ContainerVT), MaxValNode, VL);
3110 switch (
Op.getOpcode()) {
3121 {Chain, Src, Mask, DAG.getTargetConstant(FRM, DL, XLenVT), VL});
3127 DAG.
getVTList(IntVT, MVT::Other), Chain, Src, Mask, VL);
3131 DAG.
getVTList(ContainerVT, MVT::Other), Chain, Src,
3140 DAG.
getVTList(ContainerVT, MVT::Other), Chain,
3141 Truncated, Mask, VL);
3147 Src, Src, Mask, VL);
3157 MVT VT =
Op.getSimpleValueType();
3185 MVT VT =
Op.getSimpleValueType();
3190 MVT ContainerVT = VT;
3233 "Unexpected vector MVT");
3261 return std::nullopt;
3279 unsigned EltSizeInBits) {
3282 return std::nullopt;
3283 bool IsInteger =
Op.getValueType().isInteger();
3285 std::optional<unsigned> SeqStepDenom;
3286 std::optional<APInt> SeqStepNum;
3287 std::optional<APInt> SeqAddend;
3288 std::optional<std::pair<APInt, unsigned>> PrevElt;
3289 assert(EltSizeInBits >=
Op.getValueType().getScalarSizeInBits());
3294 const unsigned OpSize =
Op.getScalarValueSizeInBits();
3296 if (Elt.isUndef()) {
3297 Elts[
Idx] = std::nullopt;
3301 Elts[
Idx] = Elt->getAsAPIntVal().trunc(OpSize).zext(EltSizeInBits);
3306 return std::nullopt;
3307 Elts[
Idx] = *ExactInteger;
3320 unsigned IdxDiff =
Idx - PrevElt->second;
3321 APInt ValDiff = *Elt - PrevElt->first;
3329 int64_t Remainder = ValDiff.
srem(IdxDiff);
3334 return std::nullopt;
3335 ValDiff = ValDiff.
sdiv(IdxDiff);
3340 SeqStepNum = ValDiff;
3341 else if (ValDiff != SeqStepNum)
3342 return std::nullopt;
3345 SeqStepDenom = IdxDiff;
3346 else if (IdxDiff != *SeqStepDenom)
3347 return std::nullopt;
3351 if (!PrevElt || PrevElt->first != *Elt)
3352 PrevElt = std::make_pair(*Elt,
Idx);
3356 if (!SeqStepNum || !SeqStepDenom)
3357 return std::nullopt;
3365 (
APInt(EltSizeInBits,
Idx) * *SeqStepNum).sdiv(*SeqStepDenom);
3367 APInt Addend = *Elt - ExpectedVal;
3370 else if (Addend != SeqAddend)
3371 return std::nullopt;
3374 assert(SeqAddend &&
"Must have an addend if we have a step");
3376 return VIDSequence{SeqStepNum->getSExtValue(), *SeqStepDenom,
3377 SeqAddend->getSExtValue()};
3398 MVT ContainerVT = VT;
3426 MVT VT =
Op.getSimpleValueType();
3438 unsigned MostCommonCount = 0;
3440 unsigned NumUndefElts =
3448 unsigned NumScalarLoads = 0;
3454 ValueCounts.
insert(std::make_pair(V, 0));
3455 unsigned &Count = ValueCounts[V];
3457 if (
auto *CFP = dyn_cast<ConstantFPSDNode>(V))
3458 NumScalarLoads += !CFP->isExactlyValue(+0.0);
3463 if (++Count >= MostCommonCount) {
3465 MostCommonCount = Count;
3469 assert(DominantValue &&
"Not expecting an all-undef BUILD_VECTOR");
3470 unsigned NumDefElts = NumElts - NumUndefElts;
3471 unsigned DominantValueCountThreshold = NumDefElts <= 2 ? 0 : NumDefElts - 2;
3477 ((MostCommonCount > DominantValueCountThreshold) ||
3490 !LastOp.isUndef() && ValueCounts[LastOp] == 1 &&
3491 LastOp != DominantValue) {
3500 Processed.insert(LastOp);
3505 const SDValue &V = OpIdx.value();
3506 if (V.isUndef() || !Processed.insert(V).second)
3508 if (ValueCounts[V] == 1) {
3517 return DAG.getConstant(V == V1, DL, XLenVT);
3533 MVT VT =
Op.getSimpleValueType();
3563 unsigned NumViaIntegerBits = std::clamp(NumElts, 8u, Subtarget.
getXLen());
3564 NumViaIntegerBits = std::min(NumViaIntegerBits, Subtarget.
getELen());
3572 unsigned IntegerViaVecElts =
divideCeil(NumElts, NumViaIntegerBits);
3573 MVT IntegerViaVecVT =
3578 unsigned BitPos = 0, IntegerEltIdx = 0;
3581 for (
unsigned I = 0;
I < NumElts;) {
3583 bool BitValue = !V.isUndef() && V->getAsZExtVal();
3584 Bits |= ((
uint64_t)BitValue << BitPos);
3590 if (
I % NumViaIntegerBits == 0 ||
I == NumElts) {
3591 if (NumViaIntegerBits <= 32)
3592 Bits = SignExtend64<32>(Bits);
3594 Elts[IntegerEltIdx] = Elt;
3603 if (NumElts < NumViaIntegerBits) {
3607 assert(IntegerViaVecVT == MVT::v1i8 &&
"Unexpected mask vector type");
3635 int64_t StepNumerator = SimpleVID->StepNumerator;
3636 unsigned StepDenominator = SimpleVID->StepDenominator;
3637 int64_t Addend = SimpleVID->Addend;
3639 assert(StepNumerator != 0 &&
"Invalid step");
3640 bool Negate =
false;
3641 int64_t SplatStepVal = StepNumerator;
3645 if (StepNumerator != 1 && StepNumerator !=
INT64_MIN &&
3647 Negate = StepNumerator < 0;
3649 SplatStepVal =
Log2_64(std::abs(StepNumerator));
3656 if (((StepOpcode ==
ISD::MUL && isInt<12>(SplatStepVal)) ||
3657 (StepOpcode ==
ISD::SHL && isUInt<5>(SplatStepVal))) &&
3659 (SplatStepVal >= 0 || StepDenominator == 1) && isInt<5>(Addend)) {
3662 MVT VIDContainerVT =
3670 if ((StepOpcode ==
ISD::MUL && SplatStepVal != 1) ||
3671 (StepOpcode ==
ISD::SHL && SplatStepVal != 0)) {
3673 VID = DAG.
getNode(StepOpcode,
DL, VIDVT, VID, SplatStep);
3675 if (StepDenominator != 1) {
3680 if (Addend != 0 || Negate) {
3699 assert((ViaIntVT == MVT::i16 || ViaIntVT == MVT::i32) &&
3700 "Unexpected sequence type");
3704 unsigned ViaVecLen =
3708 uint64_t EltMask = maskTrailingOnes<uint64_t>(EltBitSize);
3711 for (
const auto &OpIdx :
enumerate(
Op->op_values())) {
3712 const auto &SeqV = OpIdx.value();
3713 if (!SeqV.isUndef())
3715 ((SeqV->getAsZExtVal() & EltMask) << (OpIdx.index() * EltBitSize));
3720 if (Subtarget.
is64Bit() && ViaIntVT == MVT::i32)
3721 SplatValue = SignExtend64<32>(SplatValue);
3743 const auto *BV = cast<BuildVectorSDNode>(
Op);
3746 BV->getRepeatedSequence(Sequence) &&
3747 (Sequence.size() * EltBitSize) <= Subtarget.
getELen()) {
3748 unsigned SeqLen = Sequence.size();
3750 assert((ViaIntVT == MVT::i16 || ViaIntVT == MVT::i32 ||
3751 ViaIntVT == MVT::i64) &&
3752 "Unexpected sequence type");
3757 const unsigned RequiredVL = NumElts / SeqLen;
3758 const unsigned ViaVecLen =
3760 NumElts : RequiredVL;
3763 unsigned EltIdx = 0;
3764 uint64_t EltMask = maskTrailingOnes<uint64_t>(EltBitSize);
3768 for (
const auto &SeqV : Sequence) {
3769 if (!SeqV.isUndef())
3771 ((SeqV->getAsZExtVal() & EltMask) << (EltIdx * EltBitSize));
3777 if (Subtarget.
is64Bit() && ViaIntVT == MVT::i32)
3778 SplatValue = SignExtend64<32>(SplatValue);
3784 (!Subtarget.
is64Bit() && ViaIntVT == MVT::i64)) &&
3785 "Unexpected bitcast sequence");
3786 if (ViaIntVT.
bitsLE(XLenVT) || isInt<32>(SplatValue)) {
3789 MVT ViaContainerVT =
3796 if (ViaVecLen != RequiredVL)
3813 if (EltBitSize - SignBits < 8) {
3817 Source, DAG, Subtarget);
3838 return RISCV::PACKH;
3840 return Subtarget.
is64Bit() ? RISCV::PACKW : RISCV::PACK;
3855 MVT VT =
Op.getSimpleValueType();
3863 if (!Subtarget.hasStdExtZbb() || !Subtarget.hasStdExtZba())
3868 if (ElemSizeInBits >= std::min(Subtarget.
getELen(), Subtarget.
getXLen()) ||
3882 if (Subtarget.hasStdExtZbkb())
3887 ElemDL, XLenVT,
A,
B),
3894 Flags.setDisjoint(
true);
3900 NewOperands.
reserve(NumElts / 2);
3902 NewOperands.
push_back(pack(
Op.getOperand(i),
Op.getOperand(i + 1)));
3912 MVT VT =
Op.getSimpleValueType();
3923 MVT VT =
Op.getSimpleValueType();
3928 !Subtarget.hasStdExtZfhmin())
4000 auto OneVRegOfOps =
ArrayRef(BuildVectorOps).
slice(i, ElemsPerVReg);
4004 unsigned InsertIdx = (i / ElemsPerVReg) * NumOpElts;
4027 unsigned NumUndefElts =
4029 unsigned NumDefElts = NumElts - NumUndefElts;
4030 if (NumDefElts >= 8 && NumDefElts > NumElts / 2 &&
4037 for (
unsigned i = 0; i < NumElts; i++) {
4039 if (i < NumElts / 2) {
4046 bool SelectMaskVal = (i < NumElts / 2);
4049 assert(SubVecAOps.
size() == NumElts && SubVecBOps.
size() == NumElts &&
4050 MaskVals.
size() == NumElts);
4085 unsigned UndefCount = 0;
4092 LinearBudget -= PerSlideCost;
4095 LinearBudget -= PerSlideCost;
4098 LinearBudget -= PerSlideCost;
4101 if (LinearBudget < 0)
4106 "Illegal type which will result in reserved encoding");
4131 Vec,
Offset, Mask, VL, Policy);
4144 Vec,
Offset, Mask, VL, Policy);
4154 if (isa<ConstantSDNode>(
Lo) && isa<ConstantSDNode>(
Hi)) {
4155 int32_t LoC = cast<ConstantSDNode>(
Lo)->getSExtValue();
4156 int32_t HiC = cast<ConstantSDNode>(
Hi)->getSExtValue();
4159 if ((LoC >> 31) == HiC)
4170 (isa<RegisterSDNode>(VL) &&
4171 cast<RegisterSDNode>(VL)->
getReg() == RISCV::X0))
4173 else if (isa<ConstantSDNode>(VL) && isUInt<4>(VL->
getAsZExtVal()))
4188 isa<ConstantSDNode>(
Hi.getOperand(1)) &&
4189 Hi.getConstantOperandVal(1) == 31)