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 " 311 return Subtarget.
hasDSP() ? &Mips::ACC64DSPRegClass : &Mips::ACC64RegClass;
452 case ISD::LOAD:
return lowerLOAD(Op, DAG);
503 int32_t Log2IfPositive = (Mask->
getAPIntValue() + 1).exactLogBase2();
505 if (Log2IfPositive <= 0)
509 EVT ExtendTy = cast<VTSDNode>(Op0Op2)->getVT();
511 unsigned Log2 = Log2IfPositive;
514 Log2 == ExtendTySize) {
540 APInt SplatValue, SplatUndef;
541 unsigned SplatBitSize;
544 if (!Node->
isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
565 APInt SplatValue, SplatUndef;
566 unsigned SplatBitSize;
571 if (BVN->
isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs))
616 bool IsLittleEndian = !Subtarget.
isLittle();
619 bool IsConstantMask =
false;
626 if (
isVSplat(Op0Op0, Mask, IsLittleEndian)) {
630 if (
isVSplat(Op1Op0, InvMask, IsLittleEndian) &&
633 else if (
isVSplat(Op1Op1, InvMask, IsLittleEndian) &&
637 IsConstantMask =
true;
647 if (
isVSplat(Op1Op0, InvMask, IsLittleEndian) &&
650 else if (
isVSplat(Op1Op1, InvMask, IsLittleEndian) &&
654 IsConstantMask =
true;
703 if (IsConstantMask) {
745 unsigned MaxSteps = Subtarget.
isABI_O32() ? 8 : 12;
751 while (!WorkStack.
empty()) {
754 if (Val == 0 || Val == 1)
757 if (Steps >= MaxSteps)
768 if ((Val - Floor).ule(Ceil - Val)) {
816 if ((C - Floor).ule(Ceil - C)) {
849 APInt SplatValue, SplatUndef;
850 unsigned SplatBitSize;
859 !BV->
isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
861 (SplatBitSize != EltSize) ||
917 EVT ExtendTy = cast<VTSDNode>(Op0Op0->
getOperand(2))->getVT();
920 if (TotalBits == 32 ||
964 default:
return false;
1072 case Mips::BPOSGE32_PSEUDO:
1073 return emitBPOSGE32(MI, BB);
1074 case Mips::SNZ_B_PSEUDO:
1075 return emitMSACBranchPseudo(MI, BB, Mips::BNZ_B);
1076 case Mips::SNZ_H_PSEUDO:
1077 return emitMSACBranchPseudo(MI, BB, Mips::BNZ_H);
1078 case Mips::SNZ_W_PSEUDO:
1079 return emitMSACBranchPseudo(MI, BB, Mips::BNZ_W);
1080 case Mips::SNZ_D_PSEUDO:
1081 return emitMSACBranchPseudo(MI, BB, Mips::BNZ_D);
1082 case Mips::SNZ_V_PSEUDO:
1083 return emitMSACBranchPseudo(MI, BB, Mips::BNZ_V);
1084 case Mips::SZ_B_PSEUDO:
1085 return emitMSACBranchPseudo(MI, BB, Mips::BZ_B);
1086 case Mips::SZ_H_PSEUDO:
1087 return emitMSACBranchPseudo(MI, BB, Mips::BZ_H);
1088 case Mips::SZ_W_PSEUDO:
1089 return emitMSACBranchPseudo(MI, BB, Mips::BZ_W);
1090 case Mips::SZ_D_PSEUDO:
1091 return emitMSACBranchPseudo(MI, BB, Mips::BZ_D);
1092 case Mips::SZ_V_PSEUDO:
1093 return emitMSACBranchPseudo(MI, BB, Mips::BZ_V);
1094 case Mips::COPY_FW_PSEUDO:
1095 return emitCOPY_FW(MI, BB);
1096 case Mips::COPY_FD_PSEUDO:
1097 return emitCOPY_FD(MI, BB);
1098 case Mips::INSERT_FW_PSEUDO:
1099 return emitINSERT_FW(MI, BB);
1100 case Mips::INSERT_FD_PSEUDO:
1101 return emitINSERT_FD(MI, BB);
1102 case Mips::INSERT_B_VIDX_PSEUDO:
1103 case Mips::INSERT_B_VIDX64_PSEUDO:
1104 return emitINSERT_DF_VIDX(MI, BB, 1,
false);
1105 case Mips::INSERT_H_VIDX_PSEUDO:
1106 case Mips::INSERT_H_VIDX64_PSEUDO:
1107 return emitINSERT_DF_VIDX(MI, BB, 2,
false);
1108 case Mips::INSERT_W_VIDX_PSEUDO:
1109 case Mips::INSERT_W_VIDX64_PSEUDO:
1110 return emitINSERT_DF_VIDX(MI, BB, 4,
false);
1111 case Mips::INSERT_D_VIDX_PSEUDO:
1112 case Mips::INSERT_D_VIDX64_PSEUDO:
1113 return emitINSERT_DF_VIDX(MI, BB, 8,
false);
1114 case Mips::INSERT_FW_VIDX_PSEUDO:
1115 case Mips::INSERT_FW_VIDX64_PSEUDO:
1116 return emitINSERT_DF_VIDX(MI, BB, 4,
true);
1117 case Mips::INSERT_FD_VIDX_PSEUDO:
1118 case Mips::INSERT_FD_VIDX64_PSEUDO:
1119 return emitINSERT_DF_VIDX(MI, BB, 8,
true);
1120 case Mips::FILL_FW_PSEUDO:
1121 return emitFILL_FW(MI, BB);
1122 case Mips::FILL_FD_PSEUDO:
1123 return emitFILL_FD(MI, BB);
1124 case Mips::FEXP2_W_1_PSEUDO:
1125 return emitFEXP2_W_1(MI, BB);
1126 case Mips::FEXP2_D_1_PSEUDO:
1127 return emitFEXP2_D_1(MI, BB);
1129 return emitST_F16_PSEUDO(MI, BB);
1131 return emitLD_F16_PSEUDO(MI, BB);
1132 case Mips::MSA_FP_EXTEND_W_PSEUDO:
1133 return emitFPEXTEND_PSEUDO(MI, BB,
false);
1134 case Mips::MSA_FP_ROUND_W_PSEUDO:
1135 return emitFPROUND_PSEUDO(MI, BB,
false);
1136 case Mips::MSA_FP_EXTEND_D_PSEUDO:
1137 return emitFPEXTEND_PSEUDO(MI, BB,
true);
1138 case Mips::MSA_FP_ROUND_D_PSEUDO:
1139 return emitFPROUND_PSEUDO(MI, BB,
true);
1143 bool MipsSETargetLowering::isEligibleForTailCallOptimization(
1144 const CCState &CCInfo,
unsigned NextStackOffset,
1162 void MipsSETargetLowering::
1164 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
1165 bool IsPICCall,
bool GlobalOrExternal,
bool InternalLinkage,
1170 InternalLinkage, IsCallReloc, CLI, Callee,
1212 EVT PtrVT = Ptr.getValueType();
1263 SDValue MipsSETargetLowering::lowerMulDiv(
SDValue Op,
unsigned NewOpc,
1264 bool HasLo,
bool HasHi,
1280 if (!HasLo || !HasHi)
1281 return HasLo ?
Lo :
Hi;
1329 if (Opnd.getValueType() ==
MVT::i64)
1377 EVT ViaVecTy = ResVecTy;
1390 if (isa<ConstantSDNode>(LaneA))
1404 SDValue Ops[16] = { LaneA, LaneB, LaneA, LaneB, LaneA, LaneB, LaneA, LaneB,
1405 LaneA, LaneB, LaneA, LaneB, LaneA, LaneB, LaneA, LaneB };
1410 if (ViaVecTy != ResVecTy) {
1420 bool IsSigned =
false) {
1421 auto *CImm = cast<ConstantSDNode>(Op->
getOperand(ImmOp));
1424 IsSigned ? CImm->getSExtValue() : CImm->getZExtValue(), IsSigned),
1430 EVT ViaVecTy = VecTy;
1431 SDValue SplatValueA = SplatValue;
1432 SDValue SplatValueB = SplatValue;
1433 SDLoc DL(SplatValue);
1450 SDValue Ops[16] = { SplatValueA, SplatValueB, SplatValueA, SplatValueB,
1451 SplatValueA, SplatValueB, SplatValueA, SplatValueB,
1452 SplatValueA, SplatValueB, SplatValueA, SplatValueB,
1453 SplatValueA, SplatValueB, SplatValueA, SplatValueB };
1458 if (VecTy != ViaVecTy)
1475 APInt BitImm =
APInt(64, 1) << CImm->getAPIntValue();
1487 {BitImmLoOp, BitImmHiOp, BitImmLoOp, BitImmHiOp}));
1528 DAG.
getNOT(DL, Bit, ResTy));
1535 << cast<ConstantSDNode>(Op->
getOperand(2))->getAPIntValue();
1541 SDValue MipsSETargetLowering::lowerINTRINSIC_WO_CHAIN(
SDValue Op,
1544 unsigned Intrinsic = cast<ConstantSDNode>(Op->
getOperand(0))->getZExtValue();
1545 switch (Intrinsic) {
1548 case Intrinsic::mips_shilo:
1550 case Intrinsic::mips_dpau_h_qbl:
1552 case Intrinsic::mips_dpau_h_qbr:
1554 case Intrinsic::mips_dpsu_h_qbl:
1556 case Intrinsic::mips_dpsu_h_qbr:
1558 case Intrinsic::mips_dpa_w_ph:
1560 case Intrinsic::mips_dps_w_ph:
1562 case Intrinsic::mips_dpax_w_ph:
1564 case Intrinsic::mips_dpsx_w_ph:
1566 case Intrinsic::mips_mulsa_w_ph:
1568 case Intrinsic::mips_mult:
1570 case Intrinsic::mips_multu:
1572 case Intrinsic::mips_madd:
1574 case Intrinsic::mips_maddu:
1576 case Intrinsic::mips_msub:
1578 case Intrinsic::mips_msubu:
1580 case Intrinsic::mips_addv_b:
1581 case Intrinsic::mips_addv_h:
1582 case Intrinsic::mips_addv_w:
1583 case Intrinsic::mips_addv_d:
1586 case Intrinsic::mips_addvi_b:
1587 case Intrinsic::mips_addvi_h:
1588 case Intrinsic::mips_addvi_w:
1589 case Intrinsic::mips_addvi_d:
1592 case Intrinsic::mips_and_v:
1595 case Intrinsic::mips_andi_b:
1598 case Intrinsic::mips_bclr_b:
1599 case Intrinsic::mips_bclr_h:
1600 case Intrinsic::mips_bclr_w:
1601 case Intrinsic::mips_bclr_d:
1603 case Intrinsic::mips_bclri_b:
1604 case Intrinsic::mips_bclri_h:
1605 case Intrinsic::mips_bclri_w:
1606 case Intrinsic::mips_bclri_d:
1608 case Intrinsic::mips_binsli_b:
1609 case Intrinsic::mips_binsli_h:
1610 case Intrinsic::mips_binsli_w:
1611 case Intrinsic::mips_binsli_d: {
1623 case Intrinsic::mips_binsri_b:
1624 case Intrinsic::mips_binsri_h:
1625 case Intrinsic::mips_binsri_w:
1626 case Intrinsic::mips_binsri_d: {
1638 case Intrinsic::mips_bmnz_v:
1641 case Intrinsic::mips_bmnzi_b:
1645 case Intrinsic::mips_bmz_v:
1648 case Intrinsic::mips_bmzi_b:
1652 case Intrinsic::mips_bneg_b:
1653 case Intrinsic::mips_bneg_h:
1654 case Intrinsic::mips_bneg_w:
1655 case Intrinsic::mips_bneg_d: {
1663 case Intrinsic::mips_bnegi_b:
1664 case Intrinsic::mips_bnegi_h:
1665 case Intrinsic::mips_bnegi_w:
1666 case Intrinsic::mips_bnegi_d:
1669 case Intrinsic::mips_bnz_b:
1670 case Intrinsic::mips_bnz_h:
1671 case Intrinsic::mips_bnz_w:
1672 case Intrinsic::mips_bnz_d:
1675 case Intrinsic::mips_bnz_v:
1678 case Intrinsic::mips_bsel_v:
1683 case Intrinsic::mips_bseli_b:
1688 case Intrinsic::mips_bset_b:
1689 case Intrinsic::mips_bset_h:
1690 case Intrinsic::mips_bset_w:
1691 case Intrinsic::mips_bset_d: {
1699 case Intrinsic::mips_bseti_b:
1700 case Intrinsic::mips_bseti_h:
1701 case Intrinsic::mips_bseti_w:
1702 case Intrinsic::mips_bseti_d:
1705 case Intrinsic::mips_bz_b:
1706 case Intrinsic::mips_bz_h:
1707 case Intrinsic::mips_bz_w:
1708 case Intrinsic::mips_bz_d:
1711 case Intrinsic::mips_bz_v:
1714 case Intrinsic::mips_ceq_b:
1715 case Intrinsic::mips_ceq_h:
1716 case Intrinsic::mips_ceq_w:
1717 case Intrinsic::mips_ceq_d:
1720 case Intrinsic::mips_ceqi_b:
1721 case Intrinsic::mips_ceqi_h:
1722 case Intrinsic::mips_ceqi_w:
1723 case Intrinsic::mips_ceqi_d:
1726 case Intrinsic::mips_cle_s_b:
1727 case Intrinsic::mips_cle_s_h:
1728 case Intrinsic::mips_cle_s_w:
1729 case Intrinsic::mips_cle_s_d:
1732 case Intrinsic::mips_clei_s_b:
1733 case Intrinsic::mips_clei_s_h:
1734 case Intrinsic::mips_clei_s_w:
1735 case Intrinsic::mips_clei_s_d:
1738 case Intrinsic::mips_cle_u_b:
1739 case Intrinsic::mips_cle_u_h:
1740 case Intrinsic::mips_cle_u_w:
1741 case Intrinsic::mips_cle_u_d:
1744 case Intrinsic::mips_clei_u_b:
1745 case Intrinsic::mips_clei_u_h:
1746 case Intrinsic::mips_clei_u_w:
1747 case Intrinsic::mips_clei_u_d:
1750 case Intrinsic::mips_clt_s_b:
1751 case Intrinsic::mips_clt_s_h:
1752 case Intrinsic::mips_clt_s_w:
1753 case Intrinsic::mips_clt_s_d:
1756 case Intrinsic::mips_clti_s_b:
1757 case Intrinsic::mips_clti_s_h:
1758 case Intrinsic::mips_clti_s_w:
1759 case Intrinsic::mips_clti_s_d:
1762 case Intrinsic::mips_clt_u_b:
1763 case Intrinsic::mips_clt_u_h:
1764 case Intrinsic::mips_clt_u_w:
1765 case Intrinsic::mips_clt_u_d:
1768 case Intrinsic::mips_clti_u_b:
1769 case Intrinsic::mips_clti_u_h:
1770 case Intrinsic::mips_clti_u_w:
1771 case Intrinsic::mips_clti_u_d:
1774 case Intrinsic::mips_copy_s_b:
1775 case Intrinsic::mips_copy_s_h:
1776 case Intrinsic::mips_copy_s_w:
1778 case Intrinsic::mips_copy_s_d:
1789 case Intrinsic::mips_copy_u_b:
1790 case Intrinsic::mips_copy_u_h:
1791 case Intrinsic::mips_copy_u_w:
1793 case Intrinsic::mips_copy_u_d:
1807 case Intrinsic::mips_div_s_b:
1808 case Intrinsic::mips_div_s_h:
1809 case Intrinsic::mips_div_s_w:
1810 case Intrinsic::mips_div_s_d:
1813 case Intrinsic::mips_div_u_b:
1814 case Intrinsic::mips_div_u_h:
1815 case Intrinsic::mips_div_u_w:
1816 case Intrinsic::mips_div_u_d:
1819 case Intrinsic::mips_fadd_w:
1820 case Intrinsic::mips_fadd_d:
1825 case Intrinsic::mips_fceq_w:
1826 case Intrinsic::mips_fceq_d:
1829 case Intrinsic::mips_fcle_w:
1830 case Intrinsic::mips_fcle_d:
1833 case Intrinsic::mips_fclt_w:
1834 case Intrinsic::mips_fclt_d:
1837 case Intrinsic::mips_fcne_w:
1838 case Intrinsic::mips_fcne_d:
1841 case Intrinsic::mips_fcor_w:
1842 case Intrinsic::mips_fcor_d:
1845 case Intrinsic::mips_fcueq_w:
1846 case Intrinsic::mips_fcueq_d:
1849 case Intrinsic::mips_fcule_w:
1850 case Intrinsic::mips_fcule_d:
1853 case Intrinsic::mips_fcult_w:
1854 case Intrinsic::mips_fcult_d:
1857 case Intrinsic::mips_fcun_w:
1858 case Intrinsic::mips_fcun_d:
1861 case Intrinsic::mips_fcune_w:
1862 case Intrinsic::mips_fcune_d:
1865 case Intrinsic::mips_fdiv_w:
1866 case Intrinsic::mips_fdiv_d:
1870 case Intrinsic::mips_ffint_u_w:
1871 case Intrinsic::mips_ffint_u_d:
1874 case Intrinsic::mips_ffint_s_w:
1875 case Intrinsic::mips_ffint_s_d:
1878 case Intrinsic::mips_fill_b:
1879 case Intrinsic::mips_fill_h:
1880 case Intrinsic::mips_fill_w:
1881 case Intrinsic::mips_fill_d: {
1890 case Intrinsic::mips_fexp2_w:
1891 case Intrinsic::mips_fexp2_d: {
1898 case Intrinsic::mips_flog2_w:
1899 case Intrinsic::mips_flog2_d:
1901 case Intrinsic::mips_fmadd_w:
1902 case Intrinsic::mips_fmadd_d:
1905 case Intrinsic::mips_fmul_w:
1906 case Intrinsic::mips_fmul_d:
1910 case Intrinsic::mips_fmsub_w:
1911 case Intrinsic::mips_fmsub_d: {
1916 case Intrinsic::mips_frint_w:
1917 case Intrinsic::mips_frint_d:
1919 case Intrinsic::mips_fsqrt_w:
1920 case Intrinsic::mips_fsqrt_d:
1922 case Intrinsic::mips_fsub_w:
1923 case Intrinsic::mips_fsub_d:
1927 case Intrinsic::mips_ftrunc_u_w:
1928 case Intrinsic::mips_ftrunc_u_d:
1931 case Intrinsic::mips_ftrunc_s_w:
1932 case Intrinsic::mips_ftrunc_s_d:
1935 case Intrinsic::mips_ilvev_b:
1936 case Intrinsic::mips_ilvev_h:
1937 case Intrinsic::mips_ilvev_w:
1938 case Intrinsic::mips_ilvev_d:
1941 case Intrinsic::mips_ilvl_b:
1942 case Intrinsic::mips_ilvl_h:
1943 case Intrinsic::mips_ilvl_w:
1944 case Intrinsic::mips_ilvl_d:
1947 case Intrinsic::mips_ilvod_b:
1948 case Intrinsic::mips_ilvod_h:
1949 case Intrinsic::mips_ilvod_w:
1950 case Intrinsic::mips_ilvod_d:
1953 case Intrinsic::mips_ilvr_b:
1954 case Intrinsic::mips_ilvr_h:
1955 case Intrinsic::mips_ilvr_w:
1956 case Intrinsic::mips_ilvr_d:
1959 case Intrinsic::mips_insert_b:
1960 case Intrinsic::mips_insert_h:
1961 case Intrinsic::mips_insert_w:
1962 case Intrinsic::mips_insert_d:
1965 case Intrinsic::mips_insve_b:
1966 case Intrinsic::mips_insve_h:
1967 case Intrinsic::mips_insve_w:
1968 case Intrinsic::mips_insve_d: {
1971 switch (Intrinsic) {
1972 case Intrinsic::mips_insve_b: Max = 15;
break;
1973 case Intrinsic::mips_insve_h: Max = 7;
break;
1974 case Intrinsic::mips_insve_w: Max = 3;
break;
1975 case Intrinsic::mips_insve_d: Max = 1;
break;
1978 int64_t
Value = cast<ConstantSDNode>(Op->
getOperand(2))->getSExtValue();
1985 case Intrinsic::mips_ldi_b:
1986 case Intrinsic::mips_ldi_h:
1987 case Intrinsic::mips_ldi_w:
1988 case Intrinsic::mips_ldi_d:
1990 case Intrinsic::mips_lsa:
1991 case Intrinsic::mips_dlsa: {
1997 case Intrinsic::mips_maddv_b:
1998 case Intrinsic::mips_maddv_h:
1999 case Intrinsic::mips_maddv_w:
2000 case Intrinsic::mips_maddv_d: {
2006 case Intrinsic::mips_max_s_b:
2007 case Intrinsic::mips_max_s_h:
2008 case Intrinsic::mips_max_s_w:
2009 case Intrinsic::mips_max_s_d:
2012 case Intrinsic::mips_max_u_b:
2013 case Intrinsic::mips_max_u_h:
2014 case Intrinsic::mips_max_u_w:
2015 case Intrinsic::mips_max_u_d:
2018 case Intrinsic::mips_maxi_s_b:
2019 case Intrinsic::mips_maxi_s_h:
2020 case Intrinsic::mips_maxi_s_w:
2021 case Intrinsic::mips_maxi_s_d:
2024 case Intrinsic::mips_maxi_u_b:
2025 case Intrinsic::mips_maxi_u_h:
2026 case Intrinsic::mips_maxi_u_w:
2027 case Intrinsic::mips_maxi_u_d:
2030 case Intrinsic::mips_min_s_b:
2031 case Intrinsic::mips_min_s_h:
2032 case Intrinsic::mips_min_s_w:
2033 case Intrinsic::mips_min_s_d:
2036 case Intrinsic::mips_min_u_b:
2037 case Intrinsic::mips_min_u_h:
2038 case Intrinsic::mips_min_u_w:
2039 case Intrinsic::mips_min_u_d:
2042 case Intrinsic::mips_mini_s_b:
2043 case Intrinsic::mips_mini_s_h:
2044 case Intrinsic::mips_mini_s_w:
2045 case Intrinsic::mips_mini_s_d:
2048 case Intrinsic::mips_mini_u_b:
2049 case Intrinsic::mips_mini_u_h:
2050 case Intrinsic::mips_mini_u_w:
2051 case Intrinsic::mips_mini_u_d:
2054 case Intrinsic::mips_mod_s_b:
2055 case Intrinsic::mips_mod_s_h:
2056 case Intrinsic::mips_mod_s_w:
2057 case Intrinsic::mips_mod_s_d:
2060 case Intrinsic::mips_mod_u_b:
2061 case Intrinsic::mips_mod_u_h:
2062 case Intrinsic::mips_mod_u_w:
2063 case Intrinsic::mips_mod_u_d:
2066 case Intrinsic::mips_mulv_b:
2067 case Intrinsic::mips_mulv_h:
2068 case Intrinsic::mips_mulv_w:
2069 case Intrinsic::mips_mulv_d:
2072 case Intrinsic::mips_msubv_b:
2073 case Intrinsic::mips_msubv_h:
2074 case Intrinsic::mips_msubv_w:
2075 case Intrinsic::mips_msubv_d: {
2081 case Intrinsic::mips_nlzc_b:
2082 case Intrinsic::mips_nlzc_h:
2083 case Intrinsic::mips_nlzc_w:
2084 case Intrinsic::mips_nlzc_d:
2086 case Intrinsic::mips_nor_v: {
2091 case Intrinsic::mips_nori_b: {
2097 case Intrinsic::mips_or_v:
2100 case Intrinsic::mips_ori_b:
2103 case Intrinsic::mips_pckev_b:
2104 case Intrinsic::mips_pckev_h:
2105 case Intrinsic::mips_pckev_w:
2106 case Intrinsic::mips_pckev_d:
2109 case Intrinsic::mips_pckod_b:
2110 case Intrinsic::mips_pckod_h:
2111 case Intrinsic::mips_pckod_w:
2112 case Intrinsic::mips_pckod_d:
2115 case Intrinsic::mips_pcnt_b:
2116 case Intrinsic::mips_pcnt_h:
2117 case Intrinsic::mips_pcnt_w:
2118 case Intrinsic::mips_pcnt_d:
2120 case Intrinsic::mips_sat_s_b:
2121 case Intrinsic::mips_sat_s_h:
2122 case Intrinsic::mips_sat_s_w:
2123 case Intrinsic::mips_sat_s_d:
2124 case Intrinsic::mips_sat_u_b:
2125 case Intrinsic::mips_sat_u_h:
2126 case Intrinsic::mips_sat_u_w:
2127 case Intrinsic::mips_sat_u_d: {
2130 switch (Intrinsic) {
2131 case Intrinsic::mips_sat_s_b:
2132 case Intrinsic::mips_sat_u_b: Max = 7;
break;
2133 case Intrinsic::mips_sat_s_h:
2134 case Intrinsic::mips_sat_u_h: Max = 15;
break;
2135 case Intrinsic::mips_sat_s_w:
2136 case Intrinsic::mips_sat_u_w: Max = 31;
break;
2137 case Intrinsic::mips_sat_s_d:
2138 case Intrinsic::mips_sat_u_d: Max = 63;
break;
2141 int64_t
Value = cast<ConstantSDNode>(Op->
getOperand(2))->getSExtValue();
2146 case Intrinsic::mips_shf_b:
2147 case Intrinsic::mips_shf_h:
2148 case Intrinsic::mips_shf_w: {
2149 int64_t
Value = cast<ConstantSDNode>(Op->
getOperand(2))->getSExtValue();
2155 case Intrinsic::mips_sldi_b:
2156 case Intrinsic::mips_sldi_h:
2157 case Intrinsic::mips_sldi_w:
2158 case Intrinsic::mips_sldi_d: {
2161 switch (Intrinsic) {
2162 case Intrinsic::mips_sldi_b: Max = 15;
break;
2163 case Intrinsic::mips_sldi_h: Max = 7;
break;
2164 case Intrinsic::mips_sldi_w: Max = 3;
break;
2165 case Intrinsic::mips_sldi_d: Max = 1;
break;
2168 int64_t
Value = cast<ConstantSDNode>(Op->
getOperand(3))->getSExtValue();
2173 case Intrinsic::mips_sll_b:
2174 case Intrinsic::mips_sll_h:
2175 case Intrinsic::mips_sll_w:
2176 case Intrinsic::mips_sll_d:
2179 case Intrinsic::mips_slli_b:
2180 case Intrinsic::mips_slli_h:
2181 case Intrinsic::mips_slli_w:
2182 case Intrinsic::mips_slli_d:
2185 case Intrinsic::mips_splat_b:
2186 case Intrinsic::mips_splat_h:
2187 case Intrinsic::mips_splat_w:
2188 case Intrinsic::mips_splat_d:
2196 case Intrinsic::mips_splati_b:
2197 case Intrinsic::mips_splati_h:
2198 case Intrinsic::mips_splati_w:
2199 case Intrinsic::mips_splati_d:
2203 case Intrinsic::mips_sra_b:
2204 case Intrinsic::mips_sra_h:
2205 case Intrinsic::mips_sra_w:
2206 case Intrinsic::mips_sra_d:
2209 case Intrinsic::mips_srai_b:
2210 case Intrinsic::mips_srai_h:
2211 case Intrinsic::mips_srai_w:
2212 case Intrinsic::mips_srai_d:
2215 case Intrinsic::mips_srari_b:
2216 case Intrinsic::mips_srari_h:
2217 case Intrinsic::mips_srari_w:
2218 case Intrinsic::mips_srari_d: {
2221 switch (Intrinsic) {
2222 case Intrinsic::mips_srari_b: Max = 7;
break;
2223 case Intrinsic::mips_srari_h: Max = 15;
break;
2224 case Intrinsic::mips_srari_w: Max = 31;
break;
2225 case Intrinsic::mips_srari_d: Max = 63;
break;
2228 int64_t
Value = cast<ConstantSDNode>(Op->
getOperand(2))->getSExtValue();
2233 case Intrinsic::mips_srl_b:
2234 case Intrinsic::mips_srl_h:
2235 case Intrinsic::mips_srl_w:
2236 case Intrinsic::mips_srl_d:
2239 case Intrinsic::mips_srli_b:
2240 case Intrinsic::mips_srli_h:
2241 case Intrinsic::mips_srli_w:
2242 case Intrinsic::mips_srli_d:
2245 case Intrinsic::mips_srlri_b:
2246 case Intrinsic::mips_srlri_h:
2247 case Intrinsic::mips_srlri_w:
2248 case Intrinsic::mips_srlri_d: {
2251 switch (Intrinsic) {
2252 case Intrinsic::mips_srlri_b: Max = 7;
break;
2253 case Intrinsic::mips_srlri_h: Max = 15;
break;
2254 case Intrinsic::mips_srlri_w: Max = 31;
break;
2255 case Intrinsic::mips_srlri_d: Max = 63;
break;
2258 int64_t
Value = cast<ConstantSDNode>(Op->
getOperand(2))->getSExtValue();
2263 case Intrinsic::mips_subv_b:
2264 case Intrinsic::mips_subv_h:
2265 case Intrinsic::mips_subv_w:
2266 case Intrinsic::mips_subv_d:
2269 case Intrinsic::mips_subvi_b:
2270 case Intrinsic::mips_subvi_h:
2271 case Intrinsic::mips_subvi_w:
2272 case Intrinsic::mips_subvi_d:
2275 case Intrinsic::mips_vshf_b:
2276 case Intrinsic::mips_vshf_h:
2277 case Intrinsic::mips_vshf_w:
2278 case Intrinsic::mips_vshf_d:
2281 case Intrinsic::mips_xor_v:
2284 case Intrinsic::mips_xori_b:
2287 case Intrinsic::thread_pointer: {
2316 unsigned Intr = cast<ConstantSDNode>(Op->
getOperand(1))->getZExtValue();
2320 case Intrinsic::mips_extp:
2322 case Intrinsic::mips_extpdp:
2324 case Intrinsic::mips_extr_w:
2326 case Intrinsic::mips_extr_r_w:
2328 case Intrinsic::mips_extr_rs_w:
2330 case Intrinsic::mips_extr_s_h:
2332 case Intrinsic::mips_mthlip:
2334 case Intrinsic::mips_mulsaq_s_w_ph:
2336 case Intrinsic::mips_maq_s_w_phl:
2338 case Intrinsic::mips_maq_s_w_phr:
2340 case Intrinsic::mips_maq_sa_w_phl:
2342 case Intrinsic::mips_maq_sa_w_phr:
2344 case Intrinsic::mips_dpaq_s_w_ph:
2346 case Intrinsic::mips_dpsq_s_w_ph:
2348 case Intrinsic::mips_dpaq_sa_l_w:
2350 case Intrinsic::mips_dpsq_sa_l_w:
2352 case Intrinsic::mips_dpaqx_s_w_ph:
2354 case Intrinsic::mips_dpaqx_sa_w_ph:
2356 case Intrinsic::mips_dpsqx_s_w_ph:
2358 case Intrinsic::mips_dpsqx_sa_w_ph:
2360 case Intrinsic::mips_ld_b:
2361 case Intrinsic::mips_ld_h:
2362 case Intrinsic::mips_ld_w:
2363 case Intrinsic::mips_ld_d:
2391 unsigned Intr = cast<ConstantSDNode>(Op->
getOperand(1))->getZExtValue();
2395 case Intrinsic::mips_st_b:
2396 case Intrinsic::mips_st_h:
2397 case Intrinsic::mips_st_w:
2398 case Intrinsic::mips_st_d:
2410 SDValue MipsSETargetLowering::
2433 if (isa<ConstantSDNode>(Op))
2435 if (isa<ConstantFPSDNode>(Op))
2465 APInt SplatValue, SplatUndef;
2466 unsigned SplatBitSize;
2476 if (SplatBitSize != 8 && SplatBitSize != 16 && SplatBitSize != 32 &&
2483 if (ResTy.isInteger() && !HasAnyUndefs)
2488 switch (SplatBitSize) {
2509 if (ViaVecTy != ResTy)
2525 for (
unsigned i = 0; i < NumElts; ++i) {
2557 int SHFIndices[4] = { -1, -1, -1, -1 };
2559 if (Indices.
size() < 4)
2562 for (
unsigned i = 0; i < 4; ++i) {
2563 for (
unsigned j = i; j < Indices.
size(); j += 4) {
2564 int Idx = Indices[j];
2570 if (Idx < 0 || Idx >= 4)
2576 if (SHFIndices[i] == -1)
2577 SHFIndices[i] = Idx;
2581 if (!(Idx == -1 || Idx == SHFIndices[i]))
2588 for (
int i = 3; i >= 0; --i) {
2589 int Idx = SHFIndices[i];
2606 template <
typename ValType>
2609 unsigned CheckStride,
2611 ValType ExpectedIndex,
unsigned ExpectedIndexStride) {
2615 if (*
I != -1 && *
I != ExpectedIndex)
2617 ExpectedIndex += ExpectedIndexStride;
2621 for (
unsigned n = 0; n < CheckStride &&
I != End; ++n, ++
I)
2640 int SplatIndex = -1;
2641 for (
const auto &V : Indices) {
2648 return fitsRegularPattern<int>(Indices.begin(), 1, Indices.end(), SplatIndex,
2674 const auto &Begin = Indices.
begin();
2675 const auto &End = Indices.
end();
2679 if (fitsRegularPattern<int>(Begin, 2, End, 0, 2))
2681 else if (fitsRegularPattern<int>(Begin, 2, End, Indices.
size(), 2))
2688 if (fitsRegularPattern<int>(Begin + 1, 2, End, 0, 2))
2690 else if (fitsRegularPattern<int>(Begin + 1, 2, End, Indices.
size(), 2))
2720 const auto &Begin = Indices.
begin();
2721 const auto &End = Indices.
end();
2725 if (fitsRegularPattern<int>(Begin, 2, End, 1, 2))
2727 else if (fitsRegularPattern<int>(Begin, 2, End, Indices.
size() + 1, 2))
2734 if (fitsRegularPattern<int>(Begin + 1, 2, End, 1, 2))
2736 else if (fitsRegularPattern<int>(Begin + 1, 2, End, Indices.
size() + 1, 2))
2767 const auto &Begin = Indices.
begin();
2768 const auto &End = Indices.
end();
2772 if (fitsRegularPattern<int>(Begin, 2, End, 0, 1))
2774 else if (fitsRegularPattern<int>(Begin, 2, End, Indices.
size(), 1))
2781 if (fitsRegularPattern<int>(Begin + 1, 2, End, 0, 1))
2783 else if (fitsRegularPattern<int>(Begin + 1, 2, End, Indices.
size(), 1))
2812 unsigned HalfSize = Indices.
size() / 2;
2815 const auto &Begin = Indices.
begin();
2816 const auto &End = Indices.
end();
2820 if (fitsRegularPattern<int>(Begin, 2, End, HalfSize, 1))
2822 else if (fitsRegularPattern<int>(Begin, 2, End, Indices.
size() + HalfSize, 1))
2829 if (fitsRegularPattern<int>(Begin + 1, 2, End, HalfSize, 1))
2831 else if (fitsRegularPattern<int>(Begin + 1, 2, End, Indices.
size() + HalfSize,
2862 const auto &Begin = Indices.
begin();
2863 const auto &Mid = Indices.
begin() + Indices.
size() / 2;
2864 const auto &End = Indices.
end();
2866 if (fitsRegularPattern<int>(Begin, 1, Mid, 0, 2))
2868 else if (fitsRegularPattern<int>(Begin, 1, Mid, Indices.
size(), 2))
2873 if (fitsRegularPattern<int>(Mid, 1, End, 0, 2))
2875 else if (fitsRegularPattern<int>(Mid, 1, End, Indices.
size(), 2))
2905 const auto &Begin = Indices.
begin();
2906 const auto &Mid = Indices.
begin() + Indices.
size() / 2;
2907 const auto &End = Indices.
end();
2909 if (fitsRegularPattern<int>(Begin, 1, Mid, 1, 2))
2911 else if (fitsRegularPattern<int>(Begin, 1, Mid, Indices.
size() + 1, 2))
2916 if (fitsRegularPattern<int>(Mid, 1, End, 1, 2))
2918 else if (fitsRegularPattern<int>(Mid, 1, End, Indices.
size() + 1, 2))
2942 bool Using1stVec =
false;
2943 bool Using2ndVec =
false;
2947 for (
int i = 0; i < ResTyNumElts; ++i) {
2949 int Idx = Indices[i];
2951 if (0 <= Idx && Idx < ResTyNumElts)
2953 if (ResTyNumElts <= Idx && Idx < ResTyNumElts * 2)
2963 if (Using1stVec && Using2ndVec) {
2966 }
else if (Using1stVec)
2968 else if (Using2ndVec)
2971 llvm_unreachable(
"shuffle vector mask references neither vector operand?");
2990 if (!ResTy.is128BitVector())
2993 int ResTyNumElts = ResTy.getVectorNumElements();
2996 for (
int i = 0; i < ResTyNumElts; ++i)
3063 BuildMI(BB, DL, TII->
get(Mips::BPOSGE32)).addMBB(TBB);
3065 BuildMI(BB, DL, TII->
get(Mips::BPOSGE32C_MMR3)).addMBB(TBB);
3070 .addReg(Mips::ZERO).
addImm(0);
3076 .addReg(Mips::ZERO).
addImm(1);
3139 .addReg(Mips::ZERO).
addImm(0);
3145 .addReg(Mips::ZERO).
addImm(1);
3186 BuildMI(*BB, MI, DL, TII->
get(Mips::COPY), Wt).addReg(Ws);
3189 BuildMI(*BB, MI, DL, TII->
get(Mips::COPY), Fd).addReg(Wt, 0, Mips::sub_lo);
3193 : &Mips::MSA128WEvensRegClass);
3195 BuildMI(*BB, MI, DL, TII->
get(Mips::SPLATI_W), Wt).addReg(Ws).
addImm(Lane);
3196 BuildMI(*BB, MI, DL, TII->
get(Mips::COPY), Fd).addReg(Wt, 0, Mips::sub_lo);
3226 BuildMI(*BB, MI, DL, TII->
get(Mips::COPY), Fd).addReg(Ws, 0, Mips::sub_64);
3231 BuildMI(*BB, MI, DL, TII->
get(Mips::COPY), Fd).addReg(Wt, 0, Mips::sub_64);
3256 : &Mips::MSA128WEvensRegClass);
3258 BuildMI(*BB, MI, DL, TII->
get(Mips::SUBREG_TO_REG), Wt)
3262 BuildMI(*BB, MI, DL, TII->
get(Mips::INSVE_W), Wd)
3292 BuildMI(*BB, MI, DL, TII->
get(Mips::SUBREG_TO_REG), Wt)
3296 BuildMI(*BB, MI, DL, TII->
get(Mips::INSVE_D), Wd)
3343 unsigned EltLog2Size;
3344 unsigned InsertOp = 0;
3345 unsigned InsveOp = 0;
3346 switch (EltSizeInBytes) {
3351 InsertOp = Mips::INSERT_B;
3352 InsveOp = Mips::INSVE_B;
3353 VecRC = &Mips::MSA128BRegClass;
3357 InsertOp = Mips::INSERT_H;
3358 InsveOp = Mips::INSVE_H;
3359 VecRC = &Mips::MSA128HRegClass;
3363 InsertOp = Mips::INSERT_W;
3364 InsveOp = Mips::INSVE_W;
3365 VecRC = &Mips::MSA128WRegClass;
3369 InsertOp = Mips::INSERT_D;
3370 InsveOp = Mips::INSVE_D;
3371 VecRC = &Mips::MSA128DRegClass;
3377 BuildMI(*BB, MI, DL, TII->
get(Mips::SUBREG_TO_REG), Wt)
3380 .
addImm(EltSizeInBytes == 8 ? Mips::sub_64 : Mips::sub_lo);
3385 if (EltSizeInBytes != 1) {
3387 BuildMI(*BB, MI, DL, TII->
get(ShiftOp), LaneTmp1)
3395 BuildMI(*BB, MI, DL, TII->
get(Mips::SLD_B), WdTmp1)
3398 .
addReg(LaneReg, 0, SubRegIdx);
3403 BuildMI(*BB, MI, DL, TII->
get(InsveOp), WdTmp2)
3410 BuildMI(*BB, MI, DL, TII->
get(InsertOp), WdTmp2)
3424 BuildMI(*BB, MI, DL, TII->
get(Mips::SLD_B), Wd)
3427 .
addReg(LaneTmp2, 0, SubRegIdx);
3450 : &Mips::MSA128WEvensRegClass);
3453 : &Mips::MSA128WEvensRegClass);
3455 BuildMI(*BB, MI, DL, TII->
get(Mips::IMPLICIT_DEF), Wt1);
3456 BuildMI(*BB, MI, DL, TII->
get(Mips::INSERT_SUBREG), Wt2)
3486 BuildMI(*BB, MI, DL, TII->
get(Mips::IMPLICIT_DEF), Wt1);
3487 BuildMI(*BB, MI, DL, TII->
get(Mips::INSERT_SUBREG), Wt2)
3509 MipsSETargetLowering::emitST_F16_PSEUDO(
MachineInstr &MI,
3526 : &Mips::GPR64RegClass);
3527 const bool UsingMips32 = RC == &Mips::GPR32RegClass;
3533 BuildMI(*BB, MI, DL, TII->
get(Mips::SUBREG_TO_REG), Tmp)
3539 BuildMI(*BB, MI, DL, TII->
get(UsingMips32 ? Mips::SH : Mips::SH64))
3564 MipsSETargetLowering::emitLD_F16_PSEUDO(
MachineInstr &MI,
3578 : &Mips::GPR64RegClass);
3580 const bool UsingMips32 = RC == &Mips::GPR32RegClass;
3584 BuildMI(*BB, MI, DL, TII->
get(UsingMips32 ? Mips::LH : Mips::LH64), Rt);
3590 BuildMI(*BB, MI, DL, TII->
get(Mips::COPY), Tmp).addReg(Rt, 0, Mips::sub_32);
3594 BuildMI(*BB, MI, DL, TII->
get(Mips::FILL_H), Wd).addReg(Rt);
3650 MipsSETargetLowering::emitFPROUND_PSEUDO(
MachineInstr &MI,
3652 bool IsFGR64)
const {
3670 IsFGR64onMips64 ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
3671 unsigned MFC1Opc = IsFGR64onMips64
3673 : (IsFGR64onMips32 ? Mips::MFC1_D64 : Mips::MFC1);
3674 unsigned FILLOpc = IsFGR64onMips64 ? Mips::FILL_D : Mips::FILL_W;
3678 BuildMI(*BB, MI, DL, TII->
get(MFC1Opc), Rtemp).addReg(Fs);
3679 BuildMI(*BB, MI, DL, TII->
get(FILLOpc), Wtemp).addReg(Rtemp);
3680 unsigned WPHI = Wtemp;
3682 if (IsFGR64onMips32) {
3684 BuildMI(*BB, MI, DL, TII->
get(Mips::MFHC1_D64), Rtemp2).addReg(Fs);
3687 BuildMI(*BB, MI, DL, TII->
get(Mips::INSERT_W), Wtemp2)
3691 BuildMI(*BB, MI, DL, TII->
get(Mips::INSERT_W), Wtemp3)
3700 BuildMI(*BB, MI, DL, TII->
get(Mips::FEXDO_W), Wtemp2)
3706 BuildMI(*BB, MI, DL, TII->
get(Mips::FEXDO_H), Wd).addReg(WPHI).
addReg(WPHI);
3755 MipsSETargetLowering::emitFPEXTEND_PSEUDO(
MachineInstr &MI,
3757 bool IsFGR64)
const {
3774 IsFGR64onMips64 ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
3775 unsigned MTC1Opc = IsFGR64onMips64
3778 Register COPYOpc = IsFGR64onMips64 ? Mips::COPY_S_D : Mips::COPY_S_W;
3783 BuildMI(*BB, MI, DL, TII->
get(Mips::FEXUPR_W), Wtemp).addReg(Ws);
3786 BuildMI(*BB, MI, DL, TII->
get(Mips::FEXUPR_D), WPHI).addReg(Wtemp);
3795 BuildMI(*BB, MI, DL, TII->
get(MTC1Opc), FPRPHI).addReg(Rtemp);
3797 if (IsFGR64onMips32) {
3799 BuildMI(*BB, MI, DL, TII->
get(Mips::COPY_S_W), Rtemp2)
3802 BuildMI(*BB, MI, DL, TII->
get(Mips::MTHC1_D64), Fd)
3828 BuildMI(*BB, MI, DL, TII->
get(Mips::LDI_W), Ws1).addImm(1);
3829 BuildMI(*BB, MI, DL, TII->
get(Mips::FFINT_U_W), Ws2).addReg(Ws1);
3857 BuildMI(*BB, MI, DL, TII->
get(Mips::LDI_D), Ws1).addImm(1);
3858 BuildMI(*BB, MI, DL, TII->
get(Mips::FFINT_U_D), Ws2).addReg(Ws1);
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
const MipsTargetLowering * createMipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
unsigned Log2(Align A)
Returns the log2 of the alignment.
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
static SDValue genConstMult(SDValue X, APInt C, const SDLoc &DL, EVT VT, EVT ShiftTy, SelectionDAG &DAG)
const MachineInstrBuilder & add(const MachineOperand &MO) const
BUILTIN_OP_END - This must be the last enum value in this list.
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
EVT getValueType() const
Return the ValueType of the referenced return value.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
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...
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
uint64_t getZExtValue() const
Get zero extended value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
const MipsSubtarget & Subtarget
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...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
BR_CC - Conditional branch.
This class represents lattice values for constants.
value_iterator value_end() const
static SDValue initAccumulator(SDValue In, const SDLoc &DL, SelectionDAG &DAG)
static SDValue performVSELECTCombine(SDNode *N, SelectionDAG &DAG)
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0...
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
virtual const TargetRegisterClass * getRepRegClassFor(MVT VT) const
Return the 'representative' register class for the specified value type.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
unsigned getSizeInBits(Register Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
const SDValue & getBasePtr() const
Carry-setting nodes for multiple precision addition and subtraction.
void push_back(const T &Elt)
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
static SDValue performANDCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
const SDValue & getValue() const
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
SDVTList getVTList() const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
const MipsInstrInfo * getInstrInfo() const override
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
const SDValue & getChain() const
uint64_t getSize() const
Return the size in bytes of the memory reference.
unsigned getAlignment() const
APInt trunc(unsigned width) const
Truncate to new width.
bool isInteger() const
Return true if this is an integer or a vector integer type.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
TypeSize getScalarValueSizeInBits() const
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
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...
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
unsigned getBitWidth() const
Return the number of bits in the APInt.
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
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...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
const Triple & getTargetTriple() const
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
static SDValue lowerMSAStoreIntr(SDValue Op, SelectionDAG &DAG, unsigned Intr, const MipsSubtarget &Subtarget)
A description of a memory reference used in the backend.
const HexagonInstrInfo * TII
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Shift and rotation operations.
unsigned getNumOperands() const
Retuns the total number of operands.
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
void setCondCodeAction(ISD::CondCode CC, MVT VT, LegalizeAction Action)
Indicate that the specified condition code is or isn't supported on the target and indicate what to d...
static SDValue lowerMSABitClearImm(SDValue Op, SelectionDAG &DAG)
static bool isConstantOrUndefBUILD_VECTOR(const BuildVectorSDNode *Op)
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
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...
const DataLayout & getDataLayout() const
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned 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.
This file implements a class to represent arbitrary precision integral constant values and operations...
static SDValue lowerVECTOR_SHUFFLE_VSHF(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
static bool isVSplat(SDValue N, APInt &Imm, bool IsLittleEndian)
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
static bool isVECTOR_SHUFFLE_SPLATI(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
Simple integer binary arithmetic operators.
static bool isConstantOrUndef(const SDValue Op)
unsigned getIncomingArgSize() const
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
static SDValue lowerVECTOR_SHUFFLE_ILVR(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
TargetInstrInfo - Interface to description of machine instruction set.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
static SDValue performORCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue lowerMSASplatImm(SDValue Op, unsigned ImmOp, SelectionDAG &DAG, bool IsSigned=false)
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...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
bool isNegative() const
Determine sign of this APInt.
const SDValue & getBasePtr() const
initializer< Ty > init(const Ty &Val)
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
bool isAllOnesValue() const
Determine if all bits are set.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static SDValue lowerVECTOR_SHUFFLE_ILVEV(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static SDValue lowerDSPIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc)
bool isLittleEndian() const
Tests whether the target triple is little endian.
LLVM Basic Block Representation.
static SDValue lowerMSALoadIntr(SDValue Op, SelectionDAG &DAG, unsigned Intr, const MipsSubtarget &Subtarget)
static SDValue getBuildVectorSplat(EVT VecTy, SDValue SplatValue, bool BigEndian, SelectionDAG &DAG)
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
Simple binary floating point operators.
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
static bool isLegalDSPCondCode(EVT Ty, ISD::CondCode CC)
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const SDValue & getOperand(unsigned Num) const
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
Carry-using nodes for multiple precision addition and subtraction.
static bool isVectorAllOnes(SDValue N)
static SDValue lowerVECTOR_SHUFFLE_PCKEV(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
const APInt & getAPIntValue() const
static SDValue performSRACombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const
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...
static SDValue performMULCombine(SDNode *N, SelectionDAG &DAG, const TargetLowering::DAGCombinerInfo &DCI, const MipsSETargetLowering *TL, const MipsSubtarget &Subtarget)
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.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
bool isSingleFloat() const
unsigned ceilLogBase2() const
This structure contains all information that is necessary for lowering calls.
This class contains a discriminated union of information about pointers in memory operands...
unsigned getNumOperands() const
Return the number of values used by this operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, 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...
bool isBuildVectorAllOnes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are ~0 or undef...
const TargetLowering & getTargetLoweringInfo() const
Iterator for intrusive lists based on ilist_node.
CCState - This class holds information needed while lowering arguments and return values...
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
static SDValue truncateVecElts(SDValue Op, SelectionDAG &DAG)
static SDValue performSHLCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
const MipsRegisterInfo * getRegisterInfo() const override
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
value_iterator value_begin() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
static SDValue lowerMSABitClear(SDValue Op, SelectionDAG &DAG)
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
BRCOND - Conditional branch.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
LLVM_NODISCARD T pop_back_val()
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static SDValue lowerMSACopyIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc)
Represents one node in the SelectionDAG.
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
unsigned logBase2() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG, const MipsSubtarget &Subtarget)
static SDValue performSETCCCombine(SDNode *N, SelectionDAG &DAG)
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS=0, unsigned Align=1, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, bool *Fast=nullptr) const override
Determine if the target supports unaligned memory accesses.
EVT getMemoryVT() const
Return the type of the in-memory value.
Class for arbitrary precision integers.
amdgpu Simplify well known AMD library false FunctionCallee Callee
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
static SDValue performDSPShiftCombine(unsigned Opc, SDNode *N, EVT Ty, SelectionDAG &DAG, const MipsSubtarget &Subtarget)
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
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_ILVOD(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static SDValue lowerMSASplatZExt(SDValue Op, unsigned OpNr, SelectionDAG &DAG)
static SDValue performSRLCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
int getMaskElt(unsigned Idx) const
static bool isBitwiseInverse(SDValue N, SDValue OfNode)
Flags
Flags values. These may be or'd together.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool isVector() const
Return true if this is a vector value type.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Bitwise operators - logical and, logical or, logical xor.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
LLVM_NODISCARD bool empty() const
bool is128BitVector() const
Return true if this is a 128-bit vector type.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
const TargetRegisterClass * getRepRegClassFor(MVT VT) const override
Return the 'representative' register class for the specified value type.
const TargetSubtargetInfo & getSubtarget() const
Flags getFlags() const
Return the raw flags of the source value,.
SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
static SDValue lowerMSABinaryBitImmIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc, SDValue Imm, bool BigEndian)
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static bool shouldTransformMulToShiftsAddsSubs(APInt C, EVT VT, SelectionDAG &DAG, const MipsSubtarget &Subtarget)
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
SDValue getValue(unsigned R) const
unsigned getInRegsParamsCount() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts)
Test whether V has a splatted value for all the demanded elements.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void insert(iterator MBBI, MachineBasicBlock *MBB)
TypeSize getScalarSizeInBits() const
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
FMA - Perform a * b + c with no intermediate rounding step.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
SDValue getValueType(EVT)
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
bool isUndef() const
Return true if the type of the node type undefined.
static SDValue lowerVECTOR_SHUFFLE_SHF(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
static SDValue lowerVECTOR_SHUFFLE_ILVL(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
bool useSoftFloat() const
MipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
static mvt_range fixedlen_vector_valuetypes()
static SDValue extractLOHI(SDValue Op, const SDLoc &DL, SelectionDAG &DAG)
static cl::opt< bool > UseMipsTailCalls("mips-tail-calls", cl::Hidden, cl::desc("MIPS: permit tail calls."), cl::init(false))
SetCC operator - This evaluates to a true value iff the condition is true.
Register getReg() const
getReg - Returns the register number.
const SDValue & getOperand(unsigned i) const
bool systemSupportsUnalignedAccess() const
Does the system support unaligned memory access.
void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC)
Enable MSA support for the given integer type and Register class.
uint64_t getZExtValue() const
TRUNCATE - Completely drop the high bits.
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
Perform various unary floating-point operations inspired by libm.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
LLVMContext * getContext() const
static SDValue lowerVECTOR_SHUFFLE_PCKOD(SDValue Op, EVT ResTy, SmallVector< int, 16 > Indices, SelectionDAG &DAG)
void addMSAFloatType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC)
Enable MSA support for the given floating-point type and Register class.
Wrapper class representing virtual and physical registers.
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...
MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
EVT is not used in-tree, but is used by out-of-tree target.
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
This class is used to represent ISD::LOAD nodes.