37#include "llvm/IR/IntrinsicsMips.h"
53#define DEBUG_TYPE "mips-isel"
60 cl::desc(
"Expand double precision loads and "
61 "stores to their single precision "
127 for (
const auto &VecTy : VecTys) {
371 if (VT == MVT::Untyped)
372 return Subtarget.hasDSP() ? &Mips::ACC64DSPRegClass : &Mips::ACC64RegClass;
416 if (Ty == MVT::v4i32 || Ty == MVT::v2i64) {
447 if (Ty != MVT::v8f16) {
474 EVT ResTy =
Op->getValueType(0);
481 return DAG.
getNode(MipsISD::FSELECT,
DL, ResTy, Tmp,
Op->getOperand(1),
489 if (
Subtarget.systemSupportsUnalignedAccess()) {
514 switch(
Op.getOpcode()) {
517 case ISD::SMUL_LOHI:
return lowerMulDiv(
Op, MipsISD::Mult,
true,
true, DAG);
518 case ISD::UMUL_LOHI:
return lowerMulDiv(
Op, MipsISD::Multu,
true,
true, DAG);
519 case ISD::MULHS:
return lowerMulDiv(
Op, MipsISD::Mult,
false,
true, DAG);
520 case ISD::MULHU:
return lowerMulDiv(
Op, MipsISD::Multu,
false,
true, DAG);
521 case ISD::MUL:
return lowerMulDiv(
Op, MipsISD::Mult,
true,
false, DAG);
522 case ISD::SDIVREM:
return lowerMulDiv(
Op, MipsISD::DivRem,
true,
true, DAG);
523 case ISD::UDIVREM:
return lowerMulDiv(
Op, MipsISD::DivRemU,
true,
true,
559 if (Op0Opcode == MipsISD::VEXTRACT_SEXT_ELT ||
560 Op0Opcode == MipsISD::VEXTRACT_ZEXT_ELT) {
566 int32_t Log2IfPositive = (Mask->getAPIntValue() + 1).exactLogBase2();
568 if (Log2IfPositive <= 0)
574 unsigned Log2 = Log2IfPositive;
576 if ((Op0Opcode == MipsISD::VEXTRACT_ZEXT_ELT &&
Log2 >= ExtendTySize) ||
577 Log2 == ExtendTySize) {
579 return DAG.
getNode(MipsISD::VEXTRACT_ZEXT_ELT,
SDLoc(Op0),
603 APInt SplatValue, SplatUndef;
604 unsigned SplatBitSize;
607 if (!
Node->isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
621 N =
N->getOperand(0);
628 APInt SplatValue, SplatUndef;
629 unsigned SplatBitSize;
634 if (BVN->
isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs))
646 return N->getOperand(1) == OfNode;
649 return N->getOperand(0) == OfNode;
666 EVT Ty =
N->getValueType(0);
668 if (!Ty.is128BitVector())
679 bool IsLittleEndian = !Subtarget.
isLittle();
682 bool IsConstantMask =
false;
689 if (
isVSplat(Op0Op0, Mask, IsLittleEndian)) {
693 if (
isVSplat(Op1Op0, InvMask, IsLittleEndian) &&
694 Mask.getBitWidth() == InvMask.
getBitWidth() && Mask == ~InvMask)
696 else if (
isVSplat(Op1Op1, InvMask, IsLittleEndian) &&
697 Mask.getBitWidth() == InvMask.
getBitWidth() && Mask == ~InvMask)
700 IsConstantMask =
true;
710 if (
isVSplat(Op1Op0, InvMask, IsLittleEndian) &&
711 Mask.getBitWidth() == InvMask.
getBitWidth() && Mask == ~InvMask)
713 else if (
isVSplat(Op1Op1, InvMask, IsLittleEndian) &&
714 Mask.getBitWidth() == InvMask.
getBitWidth() && Mask == ~InvMask)
717 IsConstantMask =
true;
766 if (IsConstantMask) {
767 if (Mask.isAllOnes())
814 while (!WorkStack.
empty()) {
817 if (Val == 0 || Val == 1)
831 if ((Val - Floor).ule(Ceil - Val)) {
879 if ((
C - Floor).ule(Ceil -
C)) {
896 EVT VT =
N->getValueType(0);
900 C->getAPIntValue(), VT, DAG, Subtarget))
912 APInt SplatValue, SplatUndef;
913 unsigned SplatBitSize;
915 unsigned EltSize = Ty.getScalarSizeInBits();
922 !BV->
isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
924 (SplatBitSize != EltSize) ||
936 EVT Ty =
N->getValueType(0);
938 if ((Ty != MVT::v2i16) && (Ty != MVT::v4i8))
959 EVT Ty =
N->getValueType(0);
976 if (Op0Op0->
getOpcode() != MipsISD::VEXTRACT_SEXT_ELT &&
977 Op0Op0->
getOpcode() != MipsISD::VEXTRACT_ZEXT_ELT)
983 if (TotalBits == 32 ||
984 (Op0Op0->
getOpcode() == MipsISD::VEXTRACT_SEXT_ELT &&
988 return DAG.
getNode(MipsISD::VEXTRACT_SEXT_ELT,
SDLoc(Op0Op0),
995 if ((Ty != MVT::v2i16) && ((Ty != MVT::v4i8) || !Subtarget.
hasDSPR2()))
1005 EVT Ty =
N->getValueType(0);
1007 if (((Ty != MVT::v2i16) || !Subtarget.
hasDSPR2()) && (Ty != MVT::v4i8))
1014 bool IsV216 = (Ty == MVT::v2i16);
1027 default:
return false;
1032 EVT Ty =
N->getValueType(0);
1034 if ((Ty != MVT::v2i16) && (Ty != MVT::v4i8))
1040 return DAG.
getNode(MipsISD::SETCC_DSP,
SDLoc(
N), Ty,
N->getOperand(0),
1041 N->getOperand(1),
N->getOperand(2));
1045 EVT Ty =
N->getValueType(0);
1047 if (Ty == MVT::v2i16 || Ty == MVT::v4i8) {
1050 if (SetCC.
getOpcode() != MipsISD::SETCC_DSP)
1055 N->getOperand(1),
N->getOperand(2), SetCC.
getOperand(2));
1063 EVT Ty =
N->getValueType(0);
1065 if (Subtarget.
hasMSA() && Ty.is128BitVector() && Ty.isInteger()) {
1093 switch (
N->getOpcode()) {
1121 N->printrWithDepth(
dbgs(), &DAG);
dbgs() <<
"\n=> \n";
1132 switch (
MI.getOpcode()) {
1135 case Mips::BPOSGE32_PSEUDO:
1136 return emitBPOSGE32(
MI, BB);
1137 case Mips::SNZ_B_PSEUDO:
1138 return emitMSACBranchPseudo(
MI, BB, Mips::BNZ_B);
1139 case Mips::SNZ_H_PSEUDO:
1140 return emitMSACBranchPseudo(
MI, BB, Mips::BNZ_H);
1141 case Mips::SNZ_W_PSEUDO:
1142 return emitMSACBranchPseudo(
MI, BB, Mips::BNZ_W);
1143 case Mips::SNZ_D_PSEUDO:
1144 return emitMSACBranchPseudo(
MI, BB, Mips::BNZ_D);
1145 case Mips::SNZ_V_PSEUDO:
1146 return emitMSACBranchPseudo(
MI, BB, Mips::BNZ_V);
1147 case Mips::SZ_B_PSEUDO:
1148 return emitMSACBranchPseudo(
MI, BB, Mips::BZ_B);
1149 case Mips::SZ_H_PSEUDO:
1150 return emitMSACBranchPseudo(
MI, BB, Mips::BZ_H);
1151 case Mips::SZ_W_PSEUDO:
1152 return emitMSACBranchPseudo(
MI, BB, Mips::BZ_W);
1153 case Mips::SZ_D_PSEUDO:
1154 return emitMSACBranchPseudo(
MI, BB, Mips::BZ_D);
1155 case Mips::SZ_V_PSEUDO:
1156 return emitMSACBranchPseudo(
MI, BB, Mips::BZ_V);
1157 case Mips::COPY_FW_PSEUDO:
1158 return emitCOPY_FW(
MI, BB);
1159 case Mips::COPY_FD_PSEUDO:
1160 return emitCOPY_FD(
MI, BB);
1161 case Mips::INSERT_FW_PSEUDO:
1162 return emitINSERT_FW(
MI, BB);
1163 case Mips::INSERT_FD_PSEUDO:
1164 return emitINSERT_FD(
MI, BB);
1165 case Mips::INSERT_B_VIDX_PSEUDO:
1166 case Mips::INSERT_B_VIDX64_PSEUDO:
1167 return emitINSERT_DF_VIDX(
MI, BB, 1,
false);
1168 case Mips::INSERT_H_VIDX_PSEUDO:
1169 case Mips::INSERT_H_VIDX64_PSEUDO:
1170 return emitINSERT_DF_VIDX(
MI, BB, 2,
false);
1171 case Mips::INSERT_W_VIDX_PSEUDO:
1172 case Mips::INSERT_W_VIDX64_PSEUDO:
1173 return emitINSERT_DF_VIDX(
MI, BB, 4,
false);
1174 case Mips::INSERT_D_VIDX_PSEUDO:
1175 case Mips::INSERT_D_VIDX64_PSEUDO:
1176 return emitINSERT_DF_VIDX(
MI, BB, 8,
false);
1177 case Mips::INSERT_FW_VIDX_PSEUDO:
1178 case Mips::INSERT_FW_VIDX64_PSEUDO:
1179 return emitINSERT_DF_VIDX(
MI, BB, 4,
true);
1180 case Mips::INSERT_FD_VIDX_PSEUDO:
1181 case Mips::INSERT_FD_VIDX64_PSEUDO:
1182 return emitINSERT_DF_VIDX(
MI, BB, 8,
true);
1183 case Mips::FILL_FW_PSEUDO:
1184 return emitFILL_FW(
MI, BB);
1185 case Mips::FILL_FD_PSEUDO:
1186 return emitFILL_FD(
MI, BB);
1187 case Mips::FEXP2_W_1_PSEUDO:
1188 return emitFEXP2_W_1(
MI, BB);
1189 case Mips::FEXP2_D_1_PSEUDO:
1190 return emitFEXP2_D_1(
MI, BB);
1192 return emitST_F16_PSEUDO(
MI, BB);
1194 return emitLD_F16_PSEUDO(
MI, BB);
1195 case Mips::MSA_FP_EXTEND_W_PSEUDO:
1196 return emitFPEXTEND_PSEUDO(
MI, BB,
false);
1197 case Mips::MSA_FP_ROUND_W_PSEUDO:
1198 return emitFPROUND_PSEUDO(
MI, BB,
false);
1199 case Mips::MSA_FP_EXTEND_D_PSEUDO:
1200 return emitFPEXTEND_PSEUDO(
MI, BB,
true);
1201 case Mips::MSA_FP_ROUND_D_PSEUDO:
1202 return emitFPROUND_PSEUDO(
MI, BB,
true);
1206bool MipsSETargetLowering::isEligibleForTailCallOptimization(
1207 const CCState &CCInfo,
unsigned NextStackOffset,
1225void MipsSETargetLowering::
1227 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
1228 bool IsPICCall,
bool GlobalOrExternal,
bool InternalLinkage,
1229 bool IsCallReloc, CallLoweringInfo &CLI,
SDValue Callee,
1231 Ops.push_back(Callee);
1233 InternalLinkage, IsCallReloc, CLI, Callee,
1255 MVT::i32,
DL,
Lo.getValue(1), Ptr, MachinePointerInfo(),
1290 return DAG.
getStore(Chain,
DL,
Hi, Ptr, MachinePointerInfo(),
1298 MVT Src =
Op.getOperand(0).getValueType().getSimpleVT();
1299 MVT Dest =
Op.getValueType().getSimpleVT();
1302 if (Src == MVT::i64 && Dest == MVT::f64) {
1306 return DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64,
Lo,
Hi);
1310 if (Src == MVT::f64 && Dest == MVT::i64) {
1317 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(0),
1320 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(0),
1330 bool HasLo,
bool HasHi,
1335 EVT Ty =
Op.getOperand(0).getValueType();
1338 Op.getOperand(0),
Op.getOperand(1));
1346 if (!HasLo || !HasHi)
1347 return HasLo ?
Lo :
Hi;
1355 std::tie(InLo, InHi) = DAG.
SplitScalar(In,
DL, MVT::i32, MVT::i32);
1356 return DAG.
getNode(MipsISD::MTLOHI,
DL, MVT::Untyped, InLo, InHi);
1379 bool HasChainIn =
Op->getOperand(0).getValueType() == MVT::Other;
1385 Ops.push_back(
Op->getOperand(OpNo++));
1391 SDValue Opnd =
Op->getOperand(++OpNo), In64;
1396 Ops.push_back(Opnd);
1399 for (++OpNo ; OpNo <
Op->getNumOperands(); ++OpNo)
1400 Ops.push_back(
Op->getOperand(OpNo));
1404 Ops.push_back(In64);
1409 for (
EVT Ty :
Op->values())
1410 ResTys.
push_back((Ty == MVT::i64) ? MVT::Untyped : Ty);
1429 EVT ResTy =
Op->getValueType(0);
1439 EVT ResVecTy =
Op->getValueType(0);
1440 EVT ViaVecTy = ResVecTy;
1450 if (ResVecTy == MVT::v2i64) {
1461 ViaVecTy = MVT::v4i32;
1467 SDValue Ops[16] = { LaneA, LaneB, LaneA, LaneB, LaneA, LaneB, LaneA, LaneB,
1468 LaneA, LaneB, LaneA, LaneB, LaneA, LaneB, LaneA, LaneB };
1473 if (ViaVecTy != ResVecTy) {
1483 bool IsSigned =
false) {
1486 APInt(
Op->getValueType(0).getScalarType().getSizeInBits(),
1487 IsSigned ? CImm->getSExtValue() : CImm->getZExtValue(), IsSigned),
1493 EVT ViaVecTy = VecTy;
1494 SDValue SplatValueA = SplatValue;
1495 SDValue SplatValueB = SplatValue;
1498 if (VecTy == MVT::v2i64) {
1500 ViaVecTy = MVT::v4i32;
1513 SDValue Ops[16] = { SplatValueA, SplatValueB, SplatValueA, SplatValueB,
1514 SplatValueA, SplatValueB, SplatValueA, SplatValueB,
1515 SplatValueA, SplatValueB, SplatValueA, SplatValueB,
1516 SplatValueA, SplatValueB, SplatValueA, SplatValueB };
1521 if (VecTy != ViaVecTy)
1530 EVT VecTy =
Op->getValueType(0);
1536 if (VecTy == MVT::v2i64) {
1538 APInt BitImm =
APInt(64, 1) << CImm->getAPIntValue();
1550 {BitImmLoOp, BitImmHiOp, BitImmLoOp, BitImmHiOp}));
1559 if (VecTy == MVT::v2i64)
1573 EVT ResTy =
Op->getValueType(0);
1576 MVT ResEltTy = ResTy == MVT::v2i64 ? MVT::i64 : MVT::i32;
1585 EVT ResTy =
Op->getValueType(0);
1596 EVT ResTy =
Op->getValueType(0);
1598 <<
Op->getConstantOperandAPInt(2);
1607 unsigned Intrinsic =
Op->getConstantOperandVal(0);
1608 switch (Intrinsic) {
1611 case Intrinsic::mips_shilo:
1613 case Intrinsic::mips_dpau_h_qbl:
1615 case Intrinsic::mips_dpau_h_qbr:
1617 case Intrinsic::mips_dpsu_h_qbl:
1619 case Intrinsic::mips_dpsu_h_qbr:
1621 case Intrinsic::mips_dpa_w_ph:
1623 case Intrinsic::mips_dps_w_ph:
1625 case Intrinsic::mips_dpax_w_ph:
1627 case Intrinsic::mips_dpsx_w_ph:
1629 case Intrinsic::mips_mulsa_w_ph:
1631 case Intrinsic::mips_mult:
1633 case Intrinsic::mips_multu:
1635 case Intrinsic::mips_madd:
1637 case Intrinsic::mips_maddu:
1639 case Intrinsic::mips_msub:
1641 case Intrinsic::mips_msubu:
1643 case Intrinsic::mips_addv_b:
1644 case Intrinsic::mips_addv_h:
1645 case Intrinsic::mips_addv_w:
1646 case Intrinsic::mips_addv_d:
1649 case Intrinsic::mips_addvi_b:
1650 case Intrinsic::mips_addvi_h:
1651 case Intrinsic::mips_addvi_w:
1652 case Intrinsic::mips_addvi_d:
1655 case Intrinsic::mips_and_v:
1658 case Intrinsic::mips_andi_b:
1661 case Intrinsic::mips_bclr_b:
1662 case Intrinsic::mips_bclr_h:
1663 case Intrinsic::mips_bclr_w:
1664 case Intrinsic::mips_bclr_d:
1666 case Intrinsic::mips_bclri_b:
1667 case Intrinsic::mips_bclri_h:
1668 case Intrinsic::mips_bclri_w:
1669 case Intrinsic::mips_bclri_d:
1671 case Intrinsic::mips_binsli_b:
1672 case Intrinsic::mips_binsli_h:
1673 case Intrinsic::mips_binsli_w:
1674 case Intrinsic::mips_binsli_d: {
1676 EVT VecTy =
Op->getValueType(0);
1681 Op->getConstantOperandVal(3) + 1);
1684 Op->getOperand(2),
Op->getOperand(1));
1686 case Intrinsic::mips_binsri_b:
1687 case Intrinsic::mips_binsri_h:
1688 case Intrinsic::mips_binsri_w:
1689 case Intrinsic::mips_binsri_d: {
1691 EVT VecTy =
Op->getValueType(0);
1696 Op->getConstantOperandVal(3) + 1);
1699 Op->getOperand(2),
Op->getOperand(1));
1701 case Intrinsic::mips_bmnz_v:
1703 Op->getOperand(2),
Op->getOperand(1));
1704 case Intrinsic::mips_bmnzi_b:
1708 case Intrinsic::mips_bmz_v:
1710 Op->getOperand(1),
Op->getOperand(2));
1711 case Intrinsic::mips_bmzi_b:
1715 case Intrinsic::mips_bneg_b:
1716 case Intrinsic::mips_bneg_h:
1717 case Intrinsic::mips_bneg_w:
1718 case Intrinsic::mips_bneg_d: {
1719 EVT VecTy =
Op->getValueType(0);
1726 case Intrinsic::mips_bnegi_b:
1727 case Intrinsic::mips_bnegi_h:
1728 case Intrinsic::mips_bnegi_w:
1729 case Intrinsic::mips_bnegi_d:
1732 case Intrinsic::mips_bnz_b:
1733 case Intrinsic::mips_bnz_h:
1734 case Intrinsic::mips_bnz_w:
1735 case Intrinsic::mips_bnz_d:
1736 return DAG.
getNode(MipsISD::VALL_NONZERO,
DL,
Op->getValueType(0),
1738 case Intrinsic::mips_bnz_v:
1739 return DAG.
getNode(MipsISD::VANY_NONZERO,
DL,
Op->getValueType(0),
1741 case Intrinsic::mips_bsel_v:
1744 Op->getOperand(1),
Op->getOperand(3),
1746 case Intrinsic::mips_bseli_b:
1751 case Intrinsic::mips_bset_b:
1752 case Intrinsic::mips_bset_h:
1753 case Intrinsic::mips_bset_w:
1754 case Intrinsic::mips_bset_d: {
1755 EVT VecTy =
Op->getValueType(0);
1762 case Intrinsic::mips_bseti_b:
1763 case Intrinsic::mips_bseti_h:
1764 case Intrinsic::mips_bseti_w:
1765 case Intrinsic::mips_bseti_d:
1768 case Intrinsic::mips_bz_b:
1769 case Intrinsic::mips_bz_h:
1770 case Intrinsic::mips_bz_w:
1771 case Intrinsic::mips_bz_d:
1772 return DAG.
getNode(MipsISD::VALL_ZERO,
DL,
Op->getValueType(0),
1774 case Intrinsic::mips_bz_v:
1775 return DAG.
getNode(MipsISD::VANY_ZERO,
DL,
Op->getValueType(0),
1777 case Intrinsic::mips_ceq_b:
1778 case Intrinsic::mips_ceq_h:
1779 case Intrinsic::mips_ceq_w:
1780 case Intrinsic::mips_ceq_d:
1783 case Intrinsic::mips_ceqi_b:
1784 case Intrinsic::mips_ceqi_h:
1785 case Intrinsic::mips_ceqi_w:
1786 case Intrinsic::mips_ceqi_d:
1789 case Intrinsic::mips_cle_s_b:
1790 case Intrinsic::mips_cle_s_h:
1791 case Intrinsic::mips_cle_s_w:
1792 case Intrinsic::mips_cle_s_d:
1795 case Intrinsic::mips_clei_s_b:
1796 case Intrinsic::mips_clei_s_h:
1797 case Intrinsic::mips_clei_s_w:
1798 case Intrinsic::mips_clei_s_d:
1801 case Intrinsic::mips_cle_u_b:
1802 case Intrinsic::mips_cle_u_h:
1803 case Intrinsic::mips_cle_u_w:
1804 case Intrinsic::mips_cle_u_d:
1807 case Intrinsic::mips_clei_u_b:
1808 case Intrinsic::mips_clei_u_h:
1809 case Intrinsic::mips_clei_u_w:
1810 case Intrinsic::mips_clei_u_d:
1813 case Intrinsic::mips_clt_s_b:
1814 case Intrinsic::mips_clt_s_h:
1815 case Intrinsic::mips_clt_s_w:
1816 case Intrinsic::mips_clt_s_d:
1819 case Intrinsic::mips_clti_s_b:
1820 case Intrinsic::mips_clti_s_h:
1821 case Intrinsic::mips_clti_s_w:
1822 case Intrinsic::mips_clti_s_d:
1825 case Intrinsic::mips_clt_u_b:
1826 case Intrinsic::mips_clt_u_h:
1827 case Intrinsic::mips_clt_u_w:
1828 case Intrinsic::mips_clt_u_d:
1831 case Intrinsic::mips_clti_u_b:
1832 case Intrinsic::mips_clti_u_h:
1833 case Intrinsic::mips_clti_u_w:
1834 case Intrinsic::mips_clti_u_d:
1837 case Intrinsic::mips_copy_s_b:
1838 case Intrinsic::mips_copy_s_h:
1839 case Intrinsic::mips_copy_s_w:
1841 case Intrinsic::mips_copy_s_d:
1849 Op->getValueType(0),
Op->getOperand(1),
1852 case Intrinsic::mips_copy_u_b:
1853 case Intrinsic::mips_copy_u_h:
1854 case Intrinsic::mips_copy_u_w:
1856 case Intrinsic::mips_copy_u_d:
1867 Op->getValueType(0),
Op->getOperand(1),
1870 case Intrinsic::mips_div_s_b:
1871 case Intrinsic::mips_div_s_h:
1872 case Intrinsic::mips_div_s_w:
1873 case Intrinsic::mips_div_s_d:
1876 case Intrinsic::mips_div_u_b:
1877 case Intrinsic::mips_div_u_h:
1878 case Intrinsic::mips_div_u_w:
1879 case Intrinsic::mips_div_u_d:
1882 case Intrinsic::mips_fadd_w:
1883 case Intrinsic::mips_fadd_d:
1888 case Intrinsic::mips_fceq_w:
1889 case Intrinsic::mips_fceq_d:
1892 case Intrinsic::mips_fcle_w:
1893 case Intrinsic::mips_fcle_d:
1896 case Intrinsic::mips_fclt_w:
1897 case Intrinsic::mips_fclt_d:
1900 case Intrinsic::mips_fcne_w:
1901 case Intrinsic::mips_fcne_d:
1904 case Intrinsic::mips_fcor_w:
1905 case Intrinsic::mips_fcor_d:
1908 case Intrinsic::mips_fcueq_w:
1909 case Intrinsic::mips_fcueq_d:
1912 case Intrinsic::mips_fcule_w:
1913 case Intrinsic::mips_fcule_d:
1916 case Intrinsic::mips_fcult_w:
1917 case Intrinsic::mips_fcult_d:
1920 case Intrinsic::mips_fcun_w:
1921 case Intrinsic::mips_fcun_d:
1924 case Intrinsic::mips_fcune_w:
1925 case Intrinsic::mips_fcune_d:
1928 case Intrinsic::mips_fdiv_w:
1929 case Intrinsic::mips_fdiv_d:
1933 case Intrinsic::mips_ffint_u_w:
1934 case Intrinsic::mips_ffint_u_d:
1937 case Intrinsic::mips_ffint_s_w:
1938 case Intrinsic::mips_ffint_s_d:
1941 case Intrinsic::mips_fill_b:
1942 case Intrinsic::mips_fill_h:
1943 case Intrinsic::mips_fill_w:
1944 case Intrinsic::mips_fill_d: {
1945 EVT ResTy =
Op->getValueType(0);
1953 case Intrinsic::mips_fexp2_w:
1954 case Intrinsic::mips_fexp2_d: {
1956 EVT ResTy =
Op->getValueType(0);
1961 case Intrinsic::mips_flog2_w:
1962 case Intrinsic::mips_flog2_d:
1964 case Intrinsic::mips_fmadd_w:
1965 case Intrinsic::mips_fmadd_d:
1967 Op->getOperand(1),
Op->getOperand(2),
Op->getOperand(3));
1968 case Intrinsic::mips_fmul_w:
1969 case Intrinsic::mips_fmul_d:
1973 case Intrinsic::mips_fmsub_w:
1974 case Intrinsic::mips_fmsub_d: {
1976 return DAG.
getNode(MipsISD::FMS, SDLoc(
Op),
Op->getValueType(0),
1977 Op->getOperand(1),
Op->getOperand(2),
Op->getOperand(3));
1979 case Intrinsic::mips_frint_w:
1980 case Intrinsic::mips_frint_d:
1982 case Intrinsic::mips_fsqrt_w:
1983 case Intrinsic::mips_fsqrt_d:
1985 case Intrinsic::mips_fsub_w:
1986 case Intrinsic::mips_fsub_d:
1990 case Intrinsic::mips_ftrunc_u_w:
1991 case Intrinsic::mips_ftrunc_u_d:
1994 case Intrinsic::mips_ftrunc_s_w:
1995 case Intrinsic::mips_ftrunc_s_d:
1998 case Intrinsic::mips_ilvev_b:
1999 case Intrinsic::mips_ilvev_h:
2000 case Intrinsic::mips_ilvev_w:
2001 case Intrinsic::mips_ilvev_d:
2002 return DAG.
getNode(MipsISD::ILVEV,
DL,
Op->getValueType(0),
2003 Op->getOperand(1),
Op->getOperand(2));
2004 case Intrinsic::mips_ilvl_b:
2005 case Intrinsic::mips_ilvl_h:
2006 case Intrinsic::mips_ilvl_w:
2007 case Intrinsic::mips_ilvl_d:
2008 return DAG.
getNode(MipsISD::ILVL,
DL,
Op->getValueType(0),
2009 Op->getOperand(1),
Op->getOperand(2));
2010 case Intrinsic::mips_ilvod_b:
2011 case Intrinsic::mips_ilvod_h:
2012 case Intrinsic::mips_ilvod_w:
2013 case Intrinsic::mips_ilvod_d:
2014 return DAG.
getNode(MipsISD::ILVOD,
DL,
Op->getValueType(0),
2015 Op->getOperand(1),
Op->getOperand(2));
2016 case Intrinsic::mips_ilvr_b:
2017 case Intrinsic::mips_ilvr_h:
2018 case Intrinsic::mips_ilvr_w:
2019 case Intrinsic::mips_ilvr_d:
2020 return DAG.
getNode(MipsISD::ILVR,
DL,
Op->getValueType(0),
2021 Op->getOperand(1),
Op->getOperand(2));
2022 case Intrinsic::mips_insert_b:
2023 case Intrinsic::mips_insert_h:
2024 case Intrinsic::mips_insert_w:
2025 case Intrinsic::mips_insert_d:
2027 Op->getOperand(1),
Op->getOperand(3),
Op->getOperand(2));
2028 case Intrinsic::mips_insve_b:
2029 case Intrinsic::mips_insve_h:
2030 case Intrinsic::mips_insve_w:
2031 case Intrinsic::mips_insve_d: {
2034 switch (Intrinsic) {
2035 case Intrinsic::mips_insve_b:
Max = 15;
break;
2036 case Intrinsic::mips_insve_h:
Max = 7;
break;
2037 case Intrinsic::mips_insve_w:
Max = 3;
break;
2038 case Intrinsic::mips_insve_d:
Max = 1;
break;
2044 return DAG.
getNode(MipsISD::INSVE,
DL,
Op->getValueType(0),
2045 Op->getOperand(1),
Op->getOperand(2),
Op->getOperand(3),
2048 case Intrinsic::mips_ldi_b:
2049 case Intrinsic::mips_ldi_h:
2050 case Intrinsic::mips_ldi_w:
2051 case Intrinsic::mips_ldi_d:
2053 case Intrinsic::mips_lsa:
2054 case Intrinsic::mips_dlsa: {
2055 EVT ResTy =
Op->getValueType(0);
2058 Op->getOperand(2),
Op->getOperand(3)));
2060 case Intrinsic::mips_maddv_b:
2061 case Intrinsic::mips_maddv_h:
2062 case Intrinsic::mips_maddv_w:
2063 case Intrinsic::mips_maddv_d: {
2064 EVT ResTy =
Op->getValueType(0);
2067 Op->getOperand(2),
Op->getOperand(3)));
2069 case Intrinsic::mips_max_s_b:
2070 case Intrinsic::mips_max_s_h:
2071 case Intrinsic::mips_max_s_w:
2072 case Intrinsic::mips_max_s_d:
2074 Op->getOperand(1),
Op->getOperand(2));
2075 case Intrinsic::mips_max_u_b:
2076 case Intrinsic::mips_max_u_h:
2077 case Intrinsic::mips_max_u_w:
2078 case Intrinsic::mips_max_u_d:
2080 Op->getOperand(1),
Op->getOperand(2));
2081 case Intrinsic::mips_maxi_s_b:
2082 case Intrinsic::mips_maxi_s_h:
2083 case Intrinsic::mips_maxi_s_w:
2084 case Intrinsic::mips_maxi_s_d:
2087 case Intrinsic::mips_maxi_u_b:
2088 case Intrinsic::mips_maxi_u_h:
2089 case Intrinsic::mips_maxi_u_w:
2090 case Intrinsic::mips_maxi_u_d:
2093 case Intrinsic::mips_min_s_b:
2094 case Intrinsic::mips_min_s_h:
2095 case Intrinsic::mips_min_s_w:
2096 case Intrinsic::mips_min_s_d:
2098 Op->getOperand(1),
Op->getOperand(2));
2099 case Intrinsic::mips_min_u_b:
2100 case Intrinsic::mips_min_u_h:
2101 case Intrinsic::mips_min_u_w:
2102 case Intrinsic::mips_min_u_d:
2104 Op->getOperand(1),
Op->getOperand(2));
2105 case Intrinsic::mips_mini_s_b:
2106 case Intrinsic::mips_mini_s_h:
2107 case Intrinsic::mips_mini_s_w:
2108 case Intrinsic::mips_mini_s_d:
2111 case Intrinsic::mips_mini_u_b:
2112 case Intrinsic::mips_mini_u_h:
2113 case Intrinsic::mips_mini_u_w:
2114 case Intrinsic::mips_mini_u_d:
2117 case Intrinsic::mips_mod_s_b:
2118 case Intrinsic::mips_mod_s_h:
2119 case Intrinsic::mips_mod_s_w:
2120 case Intrinsic::mips_mod_s_d:
2123 case Intrinsic::mips_mod_u_b:
2124 case Intrinsic::mips_mod_u_h:
2125 case Intrinsic::mips_mod_u_w:
2126 case Intrinsic::mips_mod_u_d:
2129 case Intrinsic::mips_mulv_b:
2130 case Intrinsic::mips_mulv_h:
2131 case Intrinsic::mips_mulv_w:
2132 case Intrinsic::mips_mulv_d:
2135 case Intrinsic::mips_msubv_b:
2136 case Intrinsic::mips_msubv_h:
2137 case Intrinsic::mips_msubv_w:
2138 case Intrinsic::mips_msubv_d: {
2139 EVT ResTy =
Op->getValueType(0);
2142 Op->getOperand(2),
Op->getOperand(3)));
2144 case Intrinsic::mips_nlzc_b:
2145 case Intrinsic::mips_nlzc_h:
2146 case Intrinsic::mips_nlzc_w:
2147 case Intrinsic::mips_nlzc_d:
2149 case Intrinsic::mips_nor_v: {
2151 Op->getOperand(1),
Op->getOperand(2));
2154 case Intrinsic::mips_nori_b: {
2160 case Intrinsic::mips_or_v:
2163 case Intrinsic::mips_ori_b:
2166 case Intrinsic::mips_pckev_b:
2167 case Intrinsic::mips_pckev_h:
2168 case Intrinsic::mips_pckev_w:
2169 case Intrinsic::mips_pckev_d:
2170 return DAG.
getNode(MipsISD::PCKEV,
DL,
Op->getValueType(0),
2171 Op->getOperand(1),
Op->getOperand(2));
2172 case Intrinsic::mips_pckod_b:
2173 case Intrinsic::mips_pckod_h:
2174 case Intrinsic::mips_pckod_w:
2175 case Intrinsic::mips_pckod_d:
2176 return DAG.
getNode(MipsISD::PCKOD,
DL,
Op->getValueType(0),
2177 Op->getOperand(1),
Op->getOperand(2));
2178 case Intrinsic::mips_pcnt_b:
2179 case Intrinsic::mips_pcnt_h:
2180 case Intrinsic::mips_pcnt_w:
2181 case Intrinsic::mips_pcnt_d:
2183 case Intrinsic::mips_sat_s_b:
2184 case Intrinsic::mips_sat_s_h:
2185 case Intrinsic::mips_sat_s_w:
2186 case Intrinsic::mips_sat_s_d:
2187 case Intrinsic::mips_sat_u_b:
2188 case Intrinsic::mips_sat_u_h:
2189 case Intrinsic::mips_sat_u_w:
2190 case Intrinsic::mips_sat_u_d: {
2193 switch (Intrinsic) {
2194 case Intrinsic::mips_sat_s_b:
2195 case Intrinsic::mips_sat_u_b:
Max = 7;
break;
2196 case Intrinsic::mips_sat_s_h:
2197 case Intrinsic::mips_sat_u_h:
Max = 15;
break;
2198 case Intrinsic::mips_sat_s_w:
2199 case Intrinsic::mips_sat_u_w:
Max = 31;
break;
2200 case Intrinsic::mips_sat_s_d:
2201 case Intrinsic::mips_sat_u_d:
Max = 63;
break;
2209 case Intrinsic::mips_shf_b:
2210 case Intrinsic::mips_shf_h:
2211 case Intrinsic::mips_shf_w: {
2215 return DAG.
getNode(MipsISD::SHF,
DL,
Op->getValueType(0),
2216 Op->getOperand(2),
Op->getOperand(1));
2218 case Intrinsic::mips_sldi_b:
2219 case Intrinsic::mips_sldi_h:
2220 case Intrinsic::mips_sldi_w:
2221 case Intrinsic::mips_sldi_d: {
2224 switch (Intrinsic) {
2225 case Intrinsic::mips_sldi_b:
Max = 15;
break;
2226 case Intrinsic::mips_sldi_h:
Max = 7;
break;
2227 case Intrinsic::mips_sldi_w:
Max = 3;
break;
2228 case Intrinsic::mips_sldi_d:
Max = 1;
break;
2236 case Intrinsic::mips_sll_b:
2237 case Intrinsic::mips_sll_h:
2238 case Intrinsic::mips_sll_w:
2239 case Intrinsic::mips_sll_d:
2242 case Intrinsic::mips_slli_b:
2243 case Intrinsic::mips_slli_h:
2244 case Intrinsic::mips_slli_w:
2245 case Intrinsic::mips_slli_d:
2248 case Intrinsic::mips_splat_b:
2249 case Intrinsic::mips_splat_h:
2250 case Intrinsic::mips_splat_w:
2251 case Intrinsic::mips_splat_d:
2256 return DAG.
getNode(MipsISD::VSHF,
DL,
Op->getValueType(0),
2259 case Intrinsic::mips_splati_b:
2260 case Intrinsic::mips_splati_h:
2261 case Intrinsic::mips_splati_w:
2262 case Intrinsic::mips_splati_d:
2263 return DAG.
getNode(MipsISD::VSHF,
DL,
Op->getValueType(0),
2266 case Intrinsic::mips_sra_b:
2267 case Intrinsic::mips_sra_h:
2268 case Intrinsic::mips_sra_w:
2269 case Intrinsic::mips_sra_d:
2272 case Intrinsic::mips_srai_b:
2273 case Intrinsic::mips_srai_h:
2274 case Intrinsic::mips_srai_w:
2275 case Intrinsic::mips_srai_d:
2278 case Intrinsic::mips_srari_b:
2279 case Intrinsic::mips_srari_h:
2280 case Intrinsic::mips_srari_w:
2281 case Intrinsic::mips_srari_d: {
2284 switch (Intrinsic) {
2285 case Intrinsic::mips_srari_b:
Max = 7;
break;
2286 case Intrinsic::mips_srari_h:
Max = 15;
break;
2287 case Intrinsic::mips_srari_w:
Max = 31;
break;
2288 case Intrinsic::mips_srari_d:
Max = 63;
break;
2296 case Intrinsic::mips_srl_b:
2297 case Intrinsic::mips_srl_h:
2298 case Intrinsic::mips_srl_w:
2299 case Intrinsic::mips_srl_d:
2302 case Intrinsic::mips_srli_b:
2303 case Intrinsic::mips_srli_h:
2304 case Intrinsic::mips_srli_w:
2305 case Intrinsic::mips_srli_d:
2308 case Intrinsic::mips_srlri_b:
2309 case Intrinsic::mips_srlri_h:
2310 case Intrinsic::mips_srlri_w:
2311 case Intrinsic::mips_srlri_d: {
2314 switch (Intrinsic) {
2315 case Intrinsic::mips_srlri_b:
Max = 7;
break;
2316 case Intrinsic::mips_srlri_h:
Max = 15;
break;
2317 case Intrinsic::mips_srlri_w:
Max = 31;
break;
2318 case Intrinsic::mips_srlri_d:
Max = 63;
break;
2326 case Intrinsic::mips_subv_b:
2327 case Intrinsic::mips_subv_h:
2328 case Intrinsic::mips_subv_w:
2329 case Intrinsic::mips_subv_d:
2332 case Intrinsic::mips_subvi_b:
2333 case Intrinsic::mips_subvi_h:
2334 case Intrinsic::mips_subvi_w:
2335 case Intrinsic::mips_subvi_d:
2338 case Intrinsic::mips_vshf_b:
2339 case Intrinsic::mips_vshf_h:
2340 case Intrinsic::mips_vshf_w:
2341 case Intrinsic::mips_vshf_d:
2342 return DAG.
getNode(MipsISD::VSHF,
DL,
Op->getValueType(0),
2343 Op->getOperand(1),
Op->getOperand(2),
Op->getOperand(3));
2344 case Intrinsic::mips_xor_v:
2347 case Intrinsic::mips_xori_b:
2350 case Intrinsic::thread_pointer: {
2352 return DAG.
getNode(MipsISD::ThreadPointer,
DL, PtrVT);
2363 EVT ResTy =
Op->getValueType(0);
2364 EVT PtrTy = Address->getValueType(0);
2379 unsigned Intr =
Op->getConstantOperandVal(1);
2383 case Intrinsic::mips_extp:
2385 case Intrinsic::mips_extpdp:
2387 case Intrinsic::mips_extr_w:
2389 case Intrinsic::mips_extr_r_w:
2391 case Intrinsic::mips_extr_rs_w:
2393 case Intrinsic::mips_extr_s_h:
2395 case Intrinsic::mips_mthlip:
2397 case Intrinsic::mips_mulsaq_s_w_ph:
2399 case Intrinsic::mips_maq_s_w_phl:
2401 case Intrinsic::mips_maq_s_w_phr:
2403 case Intrinsic::mips_maq_sa_w_phl:
2405 case Intrinsic::mips_maq_sa_w_phr:
2407 case Intrinsic::mips_dpaq_s_w_ph:
2409 case Intrinsic::mips_dpsq_s_w_ph:
2411 case Intrinsic::mips_dpaq_sa_l_w:
2413 case Intrinsic::mips_dpsq_sa_l_w:
2415 case Intrinsic::mips_dpaqx_s_w_ph:
2417 case Intrinsic::mips_dpaqx_sa_w_ph:
2419 case Intrinsic::mips_dpsqx_s_w_ph:
2421 case Intrinsic::mips_dpsqx_sa_w_ph:
2423 case Intrinsic::mips_ld_b:
2424 case Intrinsic::mips_ld_h:
2425 case Intrinsic::mips_ld_w:
2426 case Intrinsic::mips_ld_d:
2438 EVT PtrTy = Address->getValueType(0);
2454 unsigned Intr =
Op->getConstantOperandVal(1);
2458 case Intrinsic::mips_st_b:
2459 case Intrinsic::mips_st_h:
2460 case Intrinsic::mips_st_w:
2461 case Intrinsic::mips_st_d:
2476 EVT ResTy =
Op->getValueType(0);
2486 return DAG.
getNode(MipsISD::VEXTRACT_SEXT_ELT,
DL, ResTy, Op0, Op1,
2504 for (
unsigned i = 0; i <
Op->getNumOperands(); ++i)
2526 EVT ResTy =
Op->getValueType(0);
2528 APInt SplatValue, SplatUndef;
2529 unsigned SplatBitSize;
2535 if (
Node->isConstantSplat(SplatValue, SplatUndef, SplatBitSize,
2537 !
Subtarget.isLittle()) && SplatBitSize <= 64) {
2539 if (SplatBitSize != 8 && SplatBitSize != 16 && SplatBitSize != 32 &&
2551 switch (SplatBitSize) {
2555 ViaVecTy = MVT::v16i8;
2558 ViaVecTy = MVT::v8i16;
2561 ViaVecTy = MVT::v4i32;
2572 if (ViaVecTy != ResTy)
2582 EVT ResTy =
Node->getValueType(0);
2588 for (
unsigned i = 0; i < NumElts; ++i) {
2590 Node->getOperand(i),
2620 int SHFIndices[4] = { -1, -1, -1, -1 };
2622 if (Indices.
size() < 4)
2625 for (
unsigned i = 0; i < 4; ++i) {
2626 for (
unsigned j = i; j < Indices.
size(); j += 4) {
2627 int Idx = Indices[j];
2633 if (Idx < 0 || Idx >= 4)
2639 if (SHFIndices[i] == -1)
2640 SHFIndices[i] = Idx;
2644 if (!(Idx == -1 || Idx == SHFIndices[i]))
2651 for (
int i = 3; i >= 0; --i) {
2652 int Idx = SHFIndices[i];
2662 return DAG.
getNode(MipsISD::SHF,
DL, ResTy,
2669template <
typename ValType>
2672 unsigned CheckStride,
2674 ValType ExpectedIndex,
unsigned ExpectedIndexStride) {
2678 if (*
I != -1 && *
I != ExpectedIndex)
2680 ExpectedIndex += ExpectedIndexStride;
2684 for (
unsigned n = 0; n < CheckStride &&
I != End; ++n, ++
I)
2703 int SplatIndex = -1;
2704 for (
const auto &V : Indices) {
2737 const auto &Begin = Indices.
begin();
2738 const auto &End = Indices.
end();
2743 Wt =
Op->getOperand(0);
2745 Wt =
Op->getOperand(1);
2752 Ws =
Op->getOperand(0);
2754 Ws =
Op->getOperand(1);
2783 const auto &Begin = Indices.
begin();
2784 const auto &End = Indices.
end();
2789 Wt =
Op->getOperand(0);
2791 Wt =
Op->getOperand(1);
2798 Ws =
Op->getOperand(0);
2800 Ws =
Op->getOperand(1);
2830 const auto &Begin = Indices.
begin();
2831 const auto &End = Indices.
end();
2836 Wt =
Op->getOperand(0);
2838 Wt =
Op->getOperand(1);
2845 Ws =
Op->getOperand(0);
2847 Ws =
Op->getOperand(1);
2875 unsigned HalfSize = Indices.
size() / 2;
2878 const auto &Begin = Indices.
begin();
2879 const auto &End = Indices.
end();
2884 Wt =
Op->getOperand(0);
2886 Wt =
Op->getOperand(1);
2893 Ws =
Op->getOperand(0);
2896 Ws =
Op->getOperand(1);
2925 const auto &Begin = Indices.
begin();
2926 const auto &Mid = Indices.
begin() + Indices.
size() / 2;
2927 const auto &End = Indices.
end();
2930 Wt =
Op->getOperand(0);
2932 Wt =
Op->getOperand(1);
2937 Ws =
Op->getOperand(0);
2939 Ws =
Op->getOperand(1);
2968 const auto &Begin = Indices.
begin();
2969 const auto &Mid = Indices.
begin() + Indices.
size() / 2;
2970 const auto &End = Indices.
end();
2973 Wt =
Op->getOperand(0);
2975 Wt =
Op->getOperand(1);
2980 Ws =
Op->getOperand(0);
2982 Ws =
Op->getOperand(1);
3004 const bool isSPLATI,
3011 bool Using1stVec =
false;
3012 bool Using2ndVec =
false;
3016 assert(Indices[0] >= 0 &&
3017 "shuffle mask starts with an UNDEF, which is not expected");
3019 for (
int i = 0; i < ResTyNumElts; ++i) {
3021 int Idx = Indices[i];
3023 if (0 <= Idx && Idx < ResTyNumElts)
3025 if (ResTyNumElts <= Idx && Idx < ResTyNumElts * 2)
3028 int LastValidIndex = 0;
3029 for (
size_t i = 0; i < Indices.
size(); i++) {
3030 int Idx = Indices[i];
3033 Idx = isSPLATI ? Indices[0] : LastValidIndex;
3035 LastValidIndex = Idx;
3042 if (Using1stVec && Using2ndVec) {
3043 Op0 =
Op->getOperand(0);
3044 Op1 =
Op->getOperand(1);
3045 }
else if (Using1stVec)
3046 Op0 = Op1 =
Op->getOperand(0);
3047 else if (Using2ndVec)
3048 Op0 = Op1 =
Op->getOperand(1);
3050 llvm_unreachable(
"shuffle vector mask references neither vector operand?");
3059 return DAG.
getNode(MipsISD::VSHF,
DL, ResTy, MaskVec, Op1, Op0);
3067 EVT ResTy =
Op->getValueType(0);
3073 SmallVector<int, 16> Indices;
3075 for (
int i = 0; i < ResTyNumElts; ++i)
3118 const TargetRegisterClass *RC = &Mips::GPR32RegClass;
3124 MachineBasicBlock *
TBB =
F->CreateMachineBasicBlock(LLVM_BB);
3125 MachineBasicBlock *
Sink =
F->CreateMachineBasicBlock(LLVM_BB);
3128 F->insert(It, Sink);
3133 Sink->transferSuccessorsAndUpdatePHIs(BB);
3159 MI.getOperand(0).getReg())
3165 MI.eraseFromParent();
3187 const TargetRegisterClass *RC = &Mips::GPR32RegClass;
3192 MachineBasicBlock *FBB =
F->CreateMachineBasicBlock(LLVM_BB);
3193 MachineBasicBlock *
TBB =
F->CreateMachineBasicBlock(LLVM_BB);
3194 MachineBasicBlock *
Sink =
F->CreateMachineBasicBlock(LLVM_BB);
3197 F->insert(It, Sink);
3202 Sink->transferSuccessorsAndUpdatePHIs(BB);
3228 MI.getOperand(0).getReg())
3234 MI.eraseFromParent();
3256 unsigned Lane =
MI.getOperand(2).getImm();
3271 Subtarget.useOddSPReg() ? &Mips::MSA128WRegClass
3272 : &Mips::MSA128WEvensRegClass);
3278 MI.eraseFromParent();
3301 unsigned Lane =
MI.getOperand(2).getImm() * 2;
3313 MI.eraseFromParent();
3331 unsigned Lane =
MI.getOperand(2).getImm();
3334 Subtarget.useOddSPReg() ? &Mips::MSA128WRegClass
3335 : &Mips::MSA128WEvensRegClass);
3347 MI.eraseFromParent();
3367 unsigned Lane =
MI.getOperand(2).getImm();
3381 MI.eraseFromParent();
3412 Register SrcVecReg =
MI.getOperand(1).getReg();
3413 Register LaneReg =
MI.getOperand(2).getReg();
3414 Register SrcValReg =
MI.getOperand(3).getReg();
3416 const TargetRegisterClass *VecRC =
nullptr;
3418 const TargetRegisterClass *GPRRC =
3419 Subtarget.isABI_N64() ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
3420 unsigned SubRegIdx =
Subtarget.isABI_N64() ? Mips::sub_32 : 0;
3421 unsigned ShiftOp =
Subtarget.isABI_N64() ? Mips::DSLL : Mips::SLL;
3422 unsigned EltLog2Size;
3423 unsigned InsertOp = 0;
3424 unsigned InsveOp = 0;
3425 switch (EltSizeInBytes) {
3430 InsertOp = Mips::INSERT_B;
3431 InsveOp = Mips::INSVE_B;
3432 VecRC = &Mips::MSA128BRegClass;
3436 InsertOp = Mips::INSERT_H;
3437 InsveOp = Mips::INSVE_H;
3438 VecRC = &Mips::MSA128HRegClass;
3442 InsertOp = Mips::INSERT_W;
3443 InsveOp = Mips::INSVE_W;
3444 VecRC = &Mips::MSA128WRegClass;
3448 InsertOp = Mips::INSERT_D;
3449 InsveOp = Mips::INSVE_D;
3450 VecRC = &Mips::MSA128DRegClass;
3459 .
addImm(EltSizeInBytes == 8 ? Mips::sub_64 : Mips::sub_lo);
3464 if (EltSizeInBytes != 1) {
3477 .
addReg(LaneReg, 0, SubRegIdx);
3506 .
addReg(LaneTmp2, 0, SubRegIdx);
3508 MI.eraseFromParent();
3528 Subtarget.useOddSPReg() ? &Mips::MSA128WRegClass
3529 : &Mips::MSA128WEvensRegClass);
3531 Subtarget.useOddSPReg() ? &Mips::MSA128WRegClass
3532 : &Mips::MSA128WEvensRegClass);
3541 MI.eraseFromParent();
3572 MI.eraseFromParent();
3596 const MachineMemOperand &MMO = **
MI.memoperands_begin();
3602 const TargetRegisterClass *RC =
3603 MI.getOperand(1).isReg() ? RegInfo.
getRegClass(
MI.getOperand(1).getReg())
3604 : (
Subtarget.isABI_O32() ? &Mips::GPR32RegClass
3605 : &Mips::GPR64RegClass);
3606 const bool UsingMips32 = RC == &Mips::GPR32RegClass;
3618 BuildMI(*BB,
MI,
DL,
TII->get(UsingMips32 ? Mips::SH : Mips::SH64))
3625 MI.eraseFromParent();
3654 const TargetRegisterClass *RC =
3655 MI.getOperand(1).isReg() ? RegInfo.
getRegClass(
MI.getOperand(1).getReg())
3656 : (
Subtarget.isABI_O32() ? &Mips::GPR32RegClass
3657 : &Mips::GPR64RegClass);
3659 const bool UsingMips32 = RC == &Mips::GPR32RegClass;
3662 MachineInstrBuilder MIB =
3663 BuildMI(*BB,
MI,
DL,
TII->get(UsingMips32 ? Mips::LH : Mips::LH64), Rt);
3675 MI.eraseFromParent();
3731 bool IsFGR64)
const {
3738 bool IsFGR64onMips64 =
Subtarget.hasMips64() && IsFGR64;
3739 bool IsFGR64onMips32 = !
Subtarget.hasMips64() && IsFGR64;
3748 const TargetRegisterClass *GPRRC =
3749 IsFGR64onMips64 ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
3750 unsigned MFC1Opc = IsFGR64onMips64
3752 : (IsFGR64onMips32 ? Mips::MFC1_D64 : Mips::MFC1);
3753 unsigned FILLOpc = IsFGR64onMips64 ? Mips::FILL_D : Mips::FILL_W;
3759 unsigned WPHI = Wtemp;
3761 if (IsFGR64onMips32) {
3787 MI.eraseFromParent();
3836 bool IsFGR64)
const {
3843 bool IsFGR64onMips64 =
Subtarget.hasMips64() && IsFGR64;
3844 bool IsFGR64onMips32 = !
Subtarget.hasMips64() && IsFGR64;
3852 const TargetRegisterClass *GPRRC =
3853 IsFGR64onMips64 ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
3854 unsigned MTC1Opc = IsFGR64onMips64
3856 : (IsFGR64onMips32 ? Mips::MTC1_D64 : Mips::MTC1);
3857 Register COPYOpc = IsFGR64onMips64 ? Mips::COPY_S_D : Mips::COPY_S_W;
3876 if (IsFGR64onMips32) {
3886 MI.eraseFromParent();
3901 const TargetRegisterClass *RC = &Mips::MSA128WRegClass;
3913 .
addReg(
MI.getOperand(1).getReg());
3915 MI.eraseFromParent();
3930 const TargetRegisterClass *RC = &Mips::MSA128DRegClass;
3942 .
addReg(
MI.getOperand(1).getReg());
3944 MI.eraseFromParent();
static SDValue performSHLCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
If the operand is a bitwise AND with a constant RHS, and the shift has a constant RHS and is the only...
static SDValue performORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget, const AArch64TargetLowering &TLI)
static SDValue performANDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static SDValue performSETCCCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const HexagonInstrInfo * TII
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static bool fitsRegularPattern(typename SmallVectorImpl< ValType >::const_iterator Begin, unsigned CheckStride, typename SmallVectorImpl< ValType >::const_iterator End, ValType ExpectedIndex, unsigned ExpectedIndexStride)
Determine whether a range fits a regular pattern of values.
static SDValue performSRLCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue truncateVecElts(SDNode *Node, SelectionDAG &DAG)
Promote Memory to Register
static SDValue lowerMSABinaryBitImmIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc, SDValue Imm, bool BigEndian)
static SDValue lowerMSABitClearImm(SDValue Op, SelectionDAG &DAG)
static SDValue performMULCombine(SDNode *N, SelectionDAG &DAG, const TargetLowering::DAGCombinerInfo &DCI, const MipsSETargetLowering *TL, const MipsSubtarget &Subtarget)
static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG, const MipsSubtarget &Subtarget)
static SDValue lowerDSPIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc)
static SDValue performDSPShiftCombine(unsigned Opc, SDNode *N, EVT Ty, SelectionDAG &DAG, const MipsSubtarget &Subtarget)
static SDValue lowerMSACopyIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc)
static cl::opt< bool > NoDPLoadStore("mno-ldc1-sdc1", cl::init(false), cl::desc("Expand double precision loads and " "stores to their single precision " "counterparts"))
static SDValue lowerVECTOR_SHUFFLE_ILVR(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static SDValue getBuildVectorSplat(EVT VecTy, SDValue SplatValue, bool BigEndian, SelectionDAG &DAG)
static SDValue performVSELECTCombine(SDNode *N, SelectionDAG &DAG)
static bool isVSplat(SDValue N, APInt &Imm, bool IsLittleEndian)
static SDValue initAccumulator(SDValue In, const SDLoc &DL, SelectionDAG &DAG)
static bool isBitwiseInverse(SDValue N, SDValue OfNode)
static SDValue lowerMSAStoreIntr(SDValue Op, SelectionDAG &DAG, unsigned Intr, const MipsSubtarget &Subtarget)
static SDValue performSRACombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static bool isVectorAllOnes(SDValue N)
static SDValue lowerVECTOR_SHUFFLE_PCKOD(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static bool isLegalDSPCondCode(EVT Ty, ISD::CondCode CC)
static SDValue lowerMSASplatZExt(SDValue Op, unsigned OpNr, SelectionDAG &DAG)
static SDValue lowerMSABitClear(SDValue Op, SelectionDAG &DAG)
static SDValue lowerVECTOR_SHUFFLE_PCKEV(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static SDValue genConstMult(SDValue X, APInt C, const SDLoc &DL, EVT VT, EVT ShiftTy, SelectionDAG &DAG)
static SDValue lowerMSASplatImm(SDValue Op, unsigned ImmOp, SelectionDAG &DAG, bool IsSigned=false)
static SDValue lowerVECTOR_SHUFFLE_ILVOD(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static bool isConstantOrUndef(const SDValue Op)
static SDValue lowerVECTOR_SHUFFLE_VSHF(SDValue Op, EVT ResTy, const SmallVector< int, 16 > &Indices, const bool isSPLATI, SelectionDAG &DAG)
static SDValue lowerVECTOR_SHUFFLE_SHF(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static SDValue extractLOHI(SDValue Op, const SDLoc &DL, SelectionDAG &DAG)
static bool shouldTransformMulToShiftsAddsSubs(APInt C, EVT VT, SelectionDAG &DAG, const MipsSubtarget &Subtarget)
static SDValue lowerVECTOR_SHUFFLE_ILVEV(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static bool isVECTOR_SHUFFLE_SPLATI(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static bool isConstantOrUndefBUILD_VECTOR(const BuildVectorSDNode *Op)
static SDValue lowerMSALoadIntr(SDValue Op, SelectionDAG &DAG, unsigned Intr, const MipsSubtarget &Subtarget)
static cl::opt< bool > UseMipsTailCalls("mips-tail-calls", cl::Hidden, cl::desc("MIPS: permit tail calls."), cl::init(false))
static SDValue lowerVECTOR_SHUFFLE_ILVL(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
static cl::opt< unsigned > MaxSteps("has-predecessor-max-steps", cl::Hidden, cl::init(8192), cl::desc("DAG combiner limit number of steps when searching DAG " "for predecessor nodes"))
This file defines the SmallVector class.
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
This file describes how to lower LLVM code to machine code.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
LLVM_ABI APInt trunc(unsigned width) const
Truncate to new width.
bool isAllOnes() const
Determine if all bits are set. This is true for zero-width values.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool isNegative() const
Determine sign of this APInt.
unsigned logBase2() const
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Constructs an APInt value that has the bottom loBitsSet bits set.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Constructs an APInt value that has the top hiBitsSet bits set.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A "pseudo-class" with methods for operating on BUILD_VECTORs.
LLVM_ABI bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector.
CCState - This class holds information needed while lowering arguments and return values.
unsigned getInRegsParamsCount() const
uint64_t getZExtValue() const
const SDValue & getBasePtr() const
const Triple & getTargetTriple() const
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
static auto fixedlen_vector_valuetypes()
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
LLVM_ABI void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
BasicBlockListType::iterator iterator
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *BB=nullptr, std::optional< UniqueBBID > BBID=std::nullopt)
CreateMachineInstr - Allocate a new MachineInstr.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
Representation of each machine instruction.
LocationSize getSize() const
Return the size in bytes of the memory reference.
Flags
Flags values. These may be or'd together.
Flags getFlags() const
Return the raw flags of the source value,.
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
const SDValue & getChain() const
EVT getMemoryVT() const
Return the type of the in-memory value.
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
unsigned getIncomingArgSize() const
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(MVT VT) const override
Return the preferred vector type legalization action.
void addMSAFloatType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC)
Enable MSA support for the given floating-point type and Register class.
void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC)
Enable MSA support for the given integer type and Register class.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
const TargetRegisterClass * getRepRegClassFor(MVT VT) const override
Return the 'representative' register class for the specified value type.
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS=0, Align Alignment=Align(1), MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *Fast=nullptr) const override
Determine if the target supports unaligned memory accesses.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
MipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
Return the type to use for a scalar shift opcode, given the shifted amount type.
MipsTargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const
virtual void getOpndList(SmallVectorImpl< SDValue > &Ops, std::deque< std::pair< unsigned, SDValue > > &RegsToPass, bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage, bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const
This function fills Ops, which is the list of operands that will later be used when a function call n...
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
const MipsSubtarget & Subtarget
SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
unsigned getNumOperands() const
Return the number of values used by this operation.
SDVTList getVTList() const
const SDValue & getOperand(unsigned Num) const
LLVM_ABI void printrWithDepth(raw_ostream &O, const SelectionDAG *G=nullptr, unsigned depth=100) const
Print a SelectionDAG node and children up to depth "depth." The given SelectionDAG allows target-spec...
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.
const SDValue & getOperand(unsigned i) const
uint64_t getScalarValueSizeInBits() const
unsigned getOpcode() const
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const TargetSubtargetInfo & getSubtarget() const
LLVM_ABI SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
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...
LLVM_ABI 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,...
LLVM_ABI SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
const TargetLowering & getTargetLoweringInfo() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
LLVM_ABI bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts, unsigned Depth=0) const
Test whether V has a splatted value for all the demanded elements.
const DataLayout & getDataLayout() const
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
LLVM_ABI 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.
LLVM_ABI SDValue getValueType(EVT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVMContext * getContext() const
LLVM_ABI std::pair< SDValue, SDValue > SplitScalar(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the scalar node with EXTRACT_ELEMENT using the provided VTs and return the low/high part.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
typename SuperClass::const_iterator const_iterator
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
const SDValue & getBasePtr() const
const SDValue & getValue() const
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
virtual TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(MVT VT) const
Return the preferred vector type legalization action.
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type.
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
virtual const TargetRegisterClass * getRepRegClassFor(MVT VT) const
Return the 'representative' register class for the specified value type.
void setCondCodeAction(ArrayRef< ISD::CondCode > CCs, MVT VT, LegalizeAction Action)
Indicate that the specified condition code is or isn't supported on the target and indicate what to d...
void setTargetDAGCombine(ArrayRef< ISD::NodeType > NTs)
Targets should invoke this method for each target independent node that they want to provide a custom...
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
LLVM_ABI bool isLittleEndian() const
Tests whether the target triple is little endian.
LLVM Value Representation.
#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.
@ Fast
Attempts to make calls as fast as possible (e.g.
@ C
The default llvm calling convention, compatible with C.
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
@ ADDC
Carry-setting nodes for multiple precision addition and subtraction.
@ ADD
Simple integer binary arithmetic operators.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ FMA
FMA - Perform a * b + c with no intermediate rounding step.
@ INTRINSIC_VOID
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
@ FADD
Simple binary floating point operators.
@ ATOMIC_FENCE
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
@ 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.
@ STRICT_FSQRT
Constrained versions of libm-equivalent floating point intrinsics.
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
@ SIGN_EXTEND
Conversion operators.
@ FSINCOS
FSINCOS - Compute both fsin and fcos as a single operation.
@ FNEG
Perform various unary floating-point operations inspired by libm.
@ BR_CC
BR_CC - Conditional branch.
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
@ UNDEF
UNDEF - An undefined node.
@ BasicBlock
Various leaf nodes.
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
@ SHL
Shift and rotation operations.
@ VECTOR_SHUFFLE
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
@ 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 maximum on two values, following IEEE-754 definition...
@ SMIN
[US]{MIN/MAX} - Binary minimum or maximum of signed or unsigned integers.
@ FP_EXTEND
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ VSELECT
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
@ 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.
@ TargetConstant
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification,...
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ INTRINSIC_WO_CHAIN
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
@ ADDE
Carry-using nodes for multiple precision addition and subtraction.
@ STRICT_FADD
Constrained versions of the binary floating point operators.
@ INSERT_VECTOR_ELT
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL.
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
@ BRCOND
BRCOND - Conditional branch.
@ FCOPYSIGN
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
@ INTRINSIC_W_CHAIN
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LLVM_ABI bool isBuildVectorAllOnes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are ~0 or undef.
initializer< Ty > init(const Ty &Val)
NodeAddr< NodeBase * > Node
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
FunctionAddr VTableAddr Value
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
constexpr unsigned BitWidth
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
const MipsTargetLowering * createMipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Align commonAlignment(Align A, uint64_t Offset)
Returns the alignment that satisfies both alignments.
unsigned Log2(Align A)
Returns the log2 of the alignment.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
This struct is a compact representation of a valid (non-zero power of two) alignment.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
uint64_t getScalarSizeInBits() const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool isVector() const
Return true if this is a vector value type.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
bool isInteger() const
Return true if this is an integer or a vector integer type.
This class contains a discriminated union of information about pointers in memory operands,...