xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/MipsDSPInstrInfo.td (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric//===- MipsDSPInstrInfo.td - DSP ASE instructions -*- tablegen ------------*-=//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric//
90b57cec5SDimitry Andric// This file describes Mips DSP ASE instructions.
100b57cec5SDimitry Andric//
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric// ImmLeaf
140b57cec5SDimitry Andricdef immZExt1 : ImmLeaf<i32, [{return isUInt<1>(Imm);}]>;
158bcb0991SDimitry Andricdef timmZExt1 : ImmLeaf<i32, [{return isUInt<1>(Imm);}], NOOP_SDNodeXForm, timm>;
160b57cec5SDimitry Andricdef immZExt2 : ImmLeaf<i32, [{return isUInt<2>(Imm);}]>;
178bcb0991SDimitry Andricdef timmZExt2 : ImmLeaf<i32, [{return isUInt<2>(Imm);}], NOOP_SDNodeXForm, timm>;
180b57cec5SDimitry Andricdef immZExt3 : ImmLeaf<i32, [{return isUInt<3>(Imm);}]>;
198bcb0991SDimitry Andricdef timmZExt3 : ImmLeaf<i32, [{return isUInt<3>(Imm);}], NOOP_SDNodeXForm, timm>;
200b57cec5SDimitry Andricdef immZExt4 : ImmLeaf<i32, [{return isUInt<4>(Imm);}]>;
218bcb0991SDimitry Andricdef timmZExt4 : ImmLeaf<i32, [{return isUInt<4>(Imm);}], NOOP_SDNodeXForm, timm>;
220b57cec5SDimitry Andricdef immZExt8 : ImmLeaf<i32, [{return isUInt<8>(Imm);}]>;
238bcb0991SDimitry Andricdef timmZExt8 : ImmLeaf<i32, [{return isUInt<8>(Imm);}], NOOP_SDNodeXForm, timm>;
240b57cec5SDimitry Andricdef immZExt10 : ImmLeaf<i32, [{return isUInt<10>(Imm);}]>;
258bcb0991SDimitry Andricdef timmZExt10 : ImmLeaf<i32, [{return isUInt<10>(Imm);}], NOOP_SDNodeXForm, timm>;
260b57cec5SDimitry Andricdef immSExt6 : ImmLeaf<i32, [{return isInt<6>(Imm);}]>;
278bcb0991SDimitry Andricdef timmSExt6 : ImmLeaf<i32, [{return isInt<6>(Imm);}], NOOP_SDNodeXForm, timm>;
280b57cec5SDimitry Andricdef immSExt10 : ImmLeaf<i32, [{return isInt<10>(Imm);}]>;
290b57cec5SDimitry Andric
300b57cec5SDimitry Andric// Mips-specific dsp nodes
310b57cec5SDimitry Andricdef SDT_MipsExtr : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisSameAs<0, 1>,
320b57cec5SDimitry Andric                                        SDTCisVT<2, untyped>]>;
330b57cec5SDimitry Andricdef SDT_MipsShilo : SDTypeProfile<1, 2, [SDTCisVT<0, untyped>,
340b57cec5SDimitry Andric                                         SDTCisSameAs<0, 2>, SDTCisVT<1, i32>]>;
350b57cec5SDimitry Andricdef SDT_MipsDPA : SDTypeProfile<1, 3, [SDTCisVT<0, untyped>, SDTCisSameAs<0, 3>,
360b57cec5SDimitry Andric                                       SDTCisVT<1, i32>, SDTCisSameAs<1, 2>]>;
370b57cec5SDimitry Andricdef SDT_MipsSHIFT_DSP : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
380b57cec5SDimitry Andric                                             SDTCisVT<2, i32>]>;
390b57cec5SDimitry Andric
400b57cec5SDimitry Andricclass MipsDSPBase<string Opc, SDTypeProfile Prof> :
410b57cec5SDimitry Andric  SDNode<!strconcat("MipsISD::", Opc), Prof>;
420b57cec5SDimitry Andric
430b57cec5SDimitry Andricclass MipsDSPSideEffectBase<string Opc, SDTypeProfile Prof> :
440b57cec5SDimitry Andric  SDNode<!strconcat("MipsISD::", Opc), Prof, [SDNPHasChain, SDNPSideEffect]>;
450b57cec5SDimitry Andric
460b57cec5SDimitry Andricdef MipsEXTP : MipsDSPSideEffectBase<"EXTP", SDT_MipsExtr>;
470b57cec5SDimitry Andricdef MipsEXTPDP : MipsDSPSideEffectBase<"EXTPDP", SDT_MipsExtr>;
480b57cec5SDimitry Andricdef MipsEXTR_S_H : MipsDSPSideEffectBase<"EXTR_S_H", SDT_MipsExtr>;
490b57cec5SDimitry Andricdef MipsEXTR_W : MipsDSPSideEffectBase<"EXTR_W", SDT_MipsExtr>;
500b57cec5SDimitry Andricdef MipsEXTR_R_W : MipsDSPSideEffectBase<"EXTR_R_W", SDT_MipsExtr>;
510b57cec5SDimitry Andricdef MipsEXTR_RS_W : MipsDSPSideEffectBase<"EXTR_RS_W", SDT_MipsExtr>;
520b57cec5SDimitry Andric
530b57cec5SDimitry Andricdef MipsSHILO : MipsDSPBase<"SHILO", SDT_MipsShilo>;
540b57cec5SDimitry Andricdef MipsMTHLIP : MipsDSPSideEffectBase<"MTHLIP", SDT_MipsShilo>;
550b57cec5SDimitry Andric
560b57cec5SDimitry Andricdef MipsMULSAQ_S_W_PH : MipsDSPSideEffectBase<"MULSAQ_S_W_PH", SDT_MipsDPA>;
570b57cec5SDimitry Andricdef MipsMAQ_S_W_PHL : MipsDSPSideEffectBase<"MAQ_S_W_PHL", SDT_MipsDPA>;
580b57cec5SDimitry Andricdef MipsMAQ_S_W_PHR : MipsDSPSideEffectBase<"MAQ_S_W_PHR", SDT_MipsDPA>;
590b57cec5SDimitry Andricdef MipsMAQ_SA_W_PHL : MipsDSPSideEffectBase<"MAQ_SA_W_PHL", SDT_MipsDPA>;
600b57cec5SDimitry Andricdef MipsMAQ_SA_W_PHR : MipsDSPSideEffectBase<"MAQ_SA_W_PHR", SDT_MipsDPA>;
610b57cec5SDimitry Andric
620b57cec5SDimitry Andricdef MipsDPAU_H_QBL : MipsDSPBase<"DPAU_H_QBL", SDT_MipsDPA>;
630b57cec5SDimitry Andricdef MipsDPAU_H_QBR : MipsDSPBase<"DPAU_H_QBR", SDT_MipsDPA>;
640b57cec5SDimitry Andricdef MipsDPSU_H_QBL : MipsDSPBase<"DPSU_H_QBL", SDT_MipsDPA>;
650b57cec5SDimitry Andricdef MipsDPSU_H_QBR : MipsDSPBase<"DPSU_H_QBR", SDT_MipsDPA>;
660b57cec5SDimitry Andricdef MipsDPAQ_S_W_PH : MipsDSPSideEffectBase<"DPAQ_S_W_PH", SDT_MipsDPA>;
670b57cec5SDimitry Andricdef MipsDPSQ_S_W_PH : MipsDSPSideEffectBase<"DPSQ_S_W_PH", SDT_MipsDPA>;
680b57cec5SDimitry Andricdef MipsDPAQ_SA_L_W : MipsDSPSideEffectBase<"DPAQ_SA_L_W", SDT_MipsDPA>;
690b57cec5SDimitry Andricdef MipsDPSQ_SA_L_W : MipsDSPSideEffectBase<"DPSQ_SA_L_W", SDT_MipsDPA>;
700b57cec5SDimitry Andric
710b57cec5SDimitry Andricdef MipsDPA_W_PH : MipsDSPBase<"DPA_W_PH", SDT_MipsDPA>;
720b57cec5SDimitry Andricdef MipsDPS_W_PH : MipsDSPBase<"DPS_W_PH", SDT_MipsDPA>;
730b57cec5SDimitry Andricdef MipsDPAQX_S_W_PH : MipsDSPSideEffectBase<"DPAQX_S_W_PH", SDT_MipsDPA>;
740b57cec5SDimitry Andricdef MipsDPAQX_SA_W_PH : MipsDSPSideEffectBase<"DPAQX_SA_W_PH", SDT_MipsDPA>;
750b57cec5SDimitry Andricdef MipsDPAX_W_PH : MipsDSPBase<"DPAX_W_PH", SDT_MipsDPA>;
760b57cec5SDimitry Andricdef MipsDPSX_W_PH : MipsDSPBase<"DPSX_W_PH", SDT_MipsDPA>;
770b57cec5SDimitry Andricdef MipsDPSQX_S_W_PH : MipsDSPSideEffectBase<"DPSQX_S_W_PH", SDT_MipsDPA>;
780b57cec5SDimitry Andricdef MipsDPSQX_SA_W_PH : MipsDSPSideEffectBase<"DPSQX_SA_W_PH", SDT_MipsDPA>;
790b57cec5SDimitry Andricdef MipsMULSA_W_PH : MipsDSPBase<"MULSA_W_PH", SDT_MipsDPA>;
800b57cec5SDimitry Andric
810b57cec5SDimitry Andricdef MipsMULT : MipsDSPBase<"MULT", SDT_MipsDPA>;
820b57cec5SDimitry Andricdef MipsMULTU : MipsDSPBase<"MULTU", SDT_MipsDPA>;
830b57cec5SDimitry Andricdef MipsMADD_DSP : MipsDSPBase<"MADD_DSP", SDT_MipsDPA>;
840b57cec5SDimitry Andricdef MipsMADDU_DSP : MipsDSPBase<"MADDU_DSP", SDT_MipsDPA>;
850b57cec5SDimitry Andricdef MipsMSUB_DSP : MipsDSPBase<"MSUB_DSP", SDT_MipsDPA>;
860b57cec5SDimitry Andricdef MipsMSUBU_DSP : MipsDSPBase<"MSUBU_DSP", SDT_MipsDPA>;
870b57cec5SDimitry Andricdef MipsSHLL_DSP : MipsDSPBase<"SHLL_DSP", SDT_MipsSHIFT_DSP>;
880b57cec5SDimitry Andricdef MipsSHRA_DSP : MipsDSPBase<"SHRA_DSP", SDT_MipsSHIFT_DSP>;
890b57cec5SDimitry Andricdef MipsSHRL_DSP : MipsDSPBase<"SHRL_DSP", SDT_MipsSHIFT_DSP>;
900b57cec5SDimitry Andricdef MipsSETCC_DSP : MipsDSPBase<"SETCC_DSP", SDTSetCC>;
910b57cec5SDimitry Andricdef MipsSELECT_CC_DSP : MipsDSPBase<"SELECT_CC_DSP", SDTSelectCC>;
920b57cec5SDimitry Andric
930b57cec5SDimitry Andric// Flags.
940b57cec5SDimitry Andricclass Uses<list<Register> Regs> {
950b57cec5SDimitry Andric  list<Register> Uses = Regs;
960b57cec5SDimitry Andric}
970b57cec5SDimitry Andric
980b57cec5SDimitry Andricclass Defs<list<Register> Regs> {
990b57cec5SDimitry Andric  list<Register> Defs = Regs;
1000b57cec5SDimitry Andric}
1010b57cec5SDimitry Andric
1020b57cec5SDimitry Andric// Instruction encoding.
1030b57cec5SDimitry Andricclass ADDU_QB_ENC : ADDU_QB_FMT<0b00000>;
1040b57cec5SDimitry Andricclass ADDU_S_QB_ENC : ADDU_QB_FMT<0b00100>;
1050b57cec5SDimitry Andricclass SUBU_QB_ENC : ADDU_QB_FMT<0b00001>;
1060b57cec5SDimitry Andricclass SUBU_S_QB_ENC : ADDU_QB_FMT<0b00101>;
1070b57cec5SDimitry Andricclass ADDQ_PH_ENC : ADDU_QB_FMT<0b01010>;
1080b57cec5SDimitry Andricclass ADDQ_S_PH_ENC : ADDU_QB_FMT<0b01110>;
1090b57cec5SDimitry Andricclass SUBQ_PH_ENC : ADDU_QB_FMT<0b01011>;
1100b57cec5SDimitry Andricclass SUBQ_S_PH_ENC : ADDU_QB_FMT<0b01111>;
1110b57cec5SDimitry Andricclass ADDQ_S_W_ENC : ADDU_QB_FMT<0b10110>;
1120b57cec5SDimitry Andricclass SUBQ_S_W_ENC : ADDU_QB_FMT<0b10111>;
1130b57cec5SDimitry Andricclass ADDSC_ENC : ADDU_QB_FMT<0b10000>;
1140b57cec5SDimitry Andricclass ADDWC_ENC : ADDU_QB_FMT<0b10001>;
1150b57cec5SDimitry Andricclass MODSUB_ENC : ADDU_QB_FMT<0b10010>;
1160b57cec5SDimitry Andricclass RADDU_W_QB_ENC : RADDU_W_QB_FMT<0b10100>;
1170b57cec5SDimitry Andricclass ABSQ_S_PH_ENC : ABSQ_S_PH_R2_FMT<0b01001>;
1180b57cec5SDimitry Andricclass ABSQ_S_W_ENC : ABSQ_S_PH_R2_FMT<0b10001>;
1190b57cec5SDimitry Andricclass PRECRQ_QB_PH_ENC : CMP_EQ_QB_R3_FMT<0b01100>;
1200b57cec5SDimitry Andricclass PRECRQ_PH_W_ENC : CMP_EQ_QB_R3_FMT<0b10100>;
1210b57cec5SDimitry Andricclass PRECRQ_RS_PH_W_ENC : CMP_EQ_QB_R3_FMT<0b10101>;
1220b57cec5SDimitry Andricclass PRECRQU_S_QB_PH_ENC : CMP_EQ_QB_R3_FMT<0b01111>;
1230b57cec5SDimitry Andricclass PRECEQ_W_PHL_ENC : ABSQ_S_PH_R2_FMT<0b01100>;
1240b57cec5SDimitry Andricclass PRECEQ_W_PHR_ENC : ABSQ_S_PH_R2_FMT<0b01101>;
1250b57cec5SDimitry Andricclass PRECEQU_PH_QBL_ENC : ABSQ_S_PH_R2_FMT<0b00100>;
1260b57cec5SDimitry Andricclass PRECEQU_PH_QBR_ENC : ABSQ_S_PH_R2_FMT<0b00101>;
1270b57cec5SDimitry Andricclass PRECEQU_PH_QBLA_ENC : ABSQ_S_PH_R2_FMT<0b00110>;
1280b57cec5SDimitry Andricclass PRECEQU_PH_QBRA_ENC : ABSQ_S_PH_R2_FMT<0b00111>;
1290b57cec5SDimitry Andricclass PRECEU_PH_QBL_ENC : ABSQ_S_PH_R2_FMT<0b11100>;
1300b57cec5SDimitry Andricclass PRECEU_PH_QBR_ENC : ABSQ_S_PH_R2_FMT<0b11101>;
1310b57cec5SDimitry Andricclass PRECEU_PH_QBLA_ENC : ABSQ_S_PH_R2_FMT<0b11110>;
1320b57cec5SDimitry Andricclass PRECEU_PH_QBRA_ENC : ABSQ_S_PH_R2_FMT<0b11111>;
1330b57cec5SDimitry Andricclass SHLL_QB_ENC : SHLL_QB_FMT<0b00000>;
1340b57cec5SDimitry Andricclass SHLLV_QB_ENC : SHLL_QB_FMT<0b00010>;
1350b57cec5SDimitry Andricclass SHRL_QB_ENC : SHLL_QB_FMT<0b00001>;
1360b57cec5SDimitry Andricclass SHRLV_QB_ENC : SHLL_QB_FMT<0b00011>;
1370b57cec5SDimitry Andricclass SHLL_PH_ENC : SHLL_QB_FMT<0b01000>;
1380b57cec5SDimitry Andricclass SHLLV_PH_ENC : SHLL_QB_FMT<0b01010>;
1390b57cec5SDimitry Andricclass SHLL_S_PH_ENC : SHLL_QB_FMT<0b01100>;
1400b57cec5SDimitry Andricclass SHLLV_S_PH_ENC : SHLL_QB_FMT<0b01110>;
1410b57cec5SDimitry Andricclass SHRA_PH_ENC : SHLL_QB_FMT<0b01001>;
1420b57cec5SDimitry Andricclass SHRAV_PH_ENC : SHLL_QB_FMT<0b01011>;
1430b57cec5SDimitry Andricclass SHRA_R_PH_ENC : SHLL_QB_FMT<0b01101>;
1440b57cec5SDimitry Andricclass SHRAV_R_PH_ENC : SHLL_QB_FMT<0b01111>;
1450b57cec5SDimitry Andricclass SHLL_S_W_ENC : SHLL_QB_FMT<0b10100>;
1460b57cec5SDimitry Andricclass SHLLV_S_W_ENC : SHLL_QB_FMT<0b10110>;
1470b57cec5SDimitry Andricclass SHRA_R_W_ENC : SHLL_QB_FMT<0b10101>;
1480b57cec5SDimitry Andricclass SHRAV_R_W_ENC : SHLL_QB_FMT<0b10111>;
1490b57cec5SDimitry Andricclass MULEU_S_PH_QBL_ENC : ADDU_QB_FMT<0b00110>;
1500b57cec5SDimitry Andricclass MULEU_S_PH_QBR_ENC : ADDU_QB_FMT<0b00111>;
1510b57cec5SDimitry Andricclass MULEQ_S_W_PHL_ENC : ADDU_QB_FMT<0b11100>;
1520b57cec5SDimitry Andricclass MULEQ_S_W_PHR_ENC : ADDU_QB_FMT<0b11101>;
1530b57cec5SDimitry Andricclass MULQ_RS_PH_ENC : ADDU_QB_FMT<0b11111>;
1540b57cec5SDimitry Andricclass MULSAQ_S_W_PH_ENC : DPA_W_PH_FMT<0b00110>;
1550b57cec5SDimitry Andricclass MAQ_S_W_PHL_ENC : DPA_W_PH_FMT<0b10100>;
1560b57cec5SDimitry Andricclass MAQ_S_W_PHR_ENC : DPA_W_PH_FMT<0b10110>;
1570b57cec5SDimitry Andricclass MAQ_SA_W_PHL_ENC : DPA_W_PH_FMT<0b10000>;
1580b57cec5SDimitry Andricclass MAQ_SA_W_PHR_ENC : DPA_W_PH_FMT<0b10010>;
1590b57cec5SDimitry Andricclass MFHI_ENC : MFHI_FMT<0b010000>;
1600b57cec5SDimitry Andricclass MFLO_ENC : MFHI_FMT<0b010010>;
1610b57cec5SDimitry Andricclass MTHI_ENC : MTHI_FMT<0b010001>;
1620b57cec5SDimitry Andricclass MTLO_ENC : MTHI_FMT<0b010011>;
1630b57cec5SDimitry Andricclass DPAU_H_QBL_ENC : DPA_W_PH_FMT<0b00011>;
1640b57cec5SDimitry Andricclass DPAU_H_QBR_ENC : DPA_W_PH_FMT<0b00111>;
1650b57cec5SDimitry Andricclass DPSU_H_QBL_ENC : DPA_W_PH_FMT<0b01011>;
1660b57cec5SDimitry Andricclass DPSU_H_QBR_ENC : DPA_W_PH_FMT<0b01111>;
1670b57cec5SDimitry Andricclass DPAQ_S_W_PH_ENC : DPA_W_PH_FMT<0b00100>;
1680b57cec5SDimitry Andricclass DPSQ_S_W_PH_ENC : DPA_W_PH_FMT<0b00101>;
1690b57cec5SDimitry Andricclass DPAQ_SA_L_W_ENC : DPA_W_PH_FMT<0b01100>;
1700b57cec5SDimitry Andricclass DPSQ_SA_L_W_ENC : DPA_W_PH_FMT<0b01101>;
1710b57cec5SDimitry Andricclass MULT_DSP_ENC : MULT_FMT<0b000000, 0b011000>;
1720b57cec5SDimitry Andricclass MULTU_DSP_ENC : MULT_FMT<0b000000, 0b011001>;
1730b57cec5SDimitry Andricclass MADD_DSP_ENC : MULT_FMT<0b011100, 0b000000>;
1740b57cec5SDimitry Andricclass MADDU_DSP_ENC : MULT_FMT<0b011100, 0b000001>;
1750b57cec5SDimitry Andricclass MSUB_DSP_ENC : MULT_FMT<0b011100, 0b000100>;
1760b57cec5SDimitry Andricclass MSUBU_DSP_ENC : MULT_FMT<0b011100, 0b000101>;
1770b57cec5SDimitry Andricclass CMPU_EQ_QB_ENC : CMP_EQ_QB_R2_FMT<0b00000>;
1780b57cec5SDimitry Andricclass CMPU_LT_QB_ENC : CMP_EQ_QB_R2_FMT<0b00001>;
1790b57cec5SDimitry Andricclass CMPU_LE_QB_ENC : CMP_EQ_QB_R2_FMT<0b00010>;
1800b57cec5SDimitry Andricclass CMPGU_EQ_QB_ENC : CMP_EQ_QB_R3_FMT<0b00100>;
1810b57cec5SDimitry Andricclass CMPGU_LT_QB_ENC : CMP_EQ_QB_R3_FMT<0b00101>;
1820b57cec5SDimitry Andricclass CMPGU_LE_QB_ENC : CMP_EQ_QB_R3_FMT<0b00110>;
1830b57cec5SDimitry Andricclass CMP_EQ_PH_ENC : CMP_EQ_QB_R2_FMT<0b01000>;
1840b57cec5SDimitry Andricclass CMP_LT_PH_ENC : CMP_EQ_QB_R2_FMT<0b01001>;
1850b57cec5SDimitry Andricclass CMP_LE_PH_ENC : CMP_EQ_QB_R2_FMT<0b01010>;
1860b57cec5SDimitry Andricclass BITREV_ENC : ABSQ_S_PH_R2_FMT<0b11011>;
1870b57cec5SDimitry Andricclass PACKRL_PH_ENC : CMP_EQ_QB_R3_FMT<0b01110>;
1880b57cec5SDimitry Andricclass REPL_QB_ENC : REPL_FMT<0b00010>;
1890b57cec5SDimitry Andricclass REPL_PH_ENC : REPL_FMT<0b01010>;
1900b57cec5SDimitry Andricclass REPLV_QB_ENC : ABSQ_S_PH_R2_FMT<0b00011>;
1910b57cec5SDimitry Andricclass REPLV_PH_ENC : ABSQ_S_PH_R2_FMT<0b01011>;
1920b57cec5SDimitry Andricclass PICK_QB_ENC : CMP_EQ_QB_R3_FMT<0b00011>;
1930b57cec5SDimitry Andricclass PICK_PH_ENC : CMP_EQ_QB_R3_FMT<0b01011>;
1940b57cec5SDimitry Andricclass LWX_ENC : LX_FMT<0b00000>;
1950b57cec5SDimitry Andricclass LHX_ENC : LX_FMT<0b00100>;
1960b57cec5SDimitry Andricclass LBUX_ENC : LX_FMT<0b00110>;
1970b57cec5SDimitry Andricclass BPOSGE32_ENC : BPOSGE32_FMT<0b11100>;
1980b57cec5SDimitry Andricclass INSV_ENC : INSV_FMT<0b001100>;
1990b57cec5SDimitry Andric
2000b57cec5SDimitry Andricclass EXTP_ENC : EXTR_W_TY1_FMT<0b00010>;
2010b57cec5SDimitry Andricclass EXTPV_ENC : EXTR_W_TY1_FMT<0b00011>;
2020b57cec5SDimitry Andricclass EXTPDP_ENC : EXTR_W_TY1_FMT<0b01010>;
2030b57cec5SDimitry Andricclass EXTPDPV_ENC : EXTR_W_TY1_FMT<0b01011>;
2040b57cec5SDimitry Andricclass EXTR_W_ENC : EXTR_W_TY1_FMT<0b00000>;
2050b57cec5SDimitry Andricclass EXTRV_W_ENC : EXTR_W_TY1_FMT<0b00001>;
2060b57cec5SDimitry Andricclass EXTR_R_W_ENC : EXTR_W_TY1_FMT<0b00100>;
2070b57cec5SDimitry Andricclass EXTRV_R_W_ENC : EXTR_W_TY1_FMT<0b00101>;
2080b57cec5SDimitry Andricclass EXTR_RS_W_ENC : EXTR_W_TY1_FMT<0b00110>;
2090b57cec5SDimitry Andricclass EXTRV_RS_W_ENC : EXTR_W_TY1_FMT<0b00111>;
2100b57cec5SDimitry Andricclass EXTR_S_H_ENC : EXTR_W_TY1_FMT<0b01110>;
2110b57cec5SDimitry Andricclass EXTRV_S_H_ENC : EXTR_W_TY1_FMT<0b01111>;
2120b57cec5SDimitry Andricclass SHILO_ENC : SHILO_R1_FMT<0b11010>;
2130b57cec5SDimitry Andricclass SHILOV_ENC : SHILO_R2_FMT<0b11011>;
2140b57cec5SDimitry Andricclass MTHLIP_ENC : SHILO_R2_FMT<0b11111>;
2150b57cec5SDimitry Andric
2160b57cec5SDimitry Andricclass RDDSP_ENC : RDDSP_FMT<0b10010>;
2170b57cec5SDimitry Andricclass WRDSP_ENC : WRDSP_FMT<0b10011>;
2180b57cec5SDimitry Andricclass ADDU_PH_ENC : ADDU_QB_FMT<0b01000>;
2190b57cec5SDimitry Andricclass ADDU_S_PH_ENC : ADDU_QB_FMT<0b01100>;
2200b57cec5SDimitry Andricclass SUBU_PH_ENC : ADDU_QB_FMT<0b01001>;
2210b57cec5SDimitry Andricclass SUBU_S_PH_ENC : ADDU_QB_FMT<0b01101>;
2220b57cec5SDimitry Andricclass CMPGDU_EQ_QB_ENC : CMP_EQ_QB_R3_FMT<0b11000>;
2230b57cec5SDimitry Andricclass CMPGDU_LT_QB_ENC : CMP_EQ_QB_R3_FMT<0b11001>;
2240b57cec5SDimitry Andricclass CMPGDU_LE_QB_ENC : CMP_EQ_QB_R3_FMT<0b11010>;
2250b57cec5SDimitry Andricclass ABSQ_S_QB_ENC : ABSQ_S_PH_R2_FMT<0b00001>;
2260b57cec5SDimitry Andricclass ADDUH_QB_ENC : ADDUH_QB_FMT<0b00000>;
2270b57cec5SDimitry Andricclass ADDUH_R_QB_ENC : ADDUH_QB_FMT<0b00010>;
2280b57cec5SDimitry Andricclass SUBUH_QB_ENC : ADDUH_QB_FMT<0b00001>;
2290b57cec5SDimitry Andricclass SUBUH_R_QB_ENC : ADDUH_QB_FMT<0b00011>;
2300b57cec5SDimitry Andricclass ADDQH_PH_ENC : ADDUH_QB_FMT<0b01000>;
2310b57cec5SDimitry Andricclass ADDQH_R_PH_ENC : ADDUH_QB_FMT<0b01010>;
2320b57cec5SDimitry Andricclass SUBQH_PH_ENC : ADDUH_QB_FMT<0b01001>;
2330b57cec5SDimitry Andricclass SUBQH_R_PH_ENC : ADDUH_QB_FMT<0b01011>;
2340b57cec5SDimitry Andricclass ADDQH_W_ENC : ADDUH_QB_FMT<0b10000>;
2350b57cec5SDimitry Andricclass ADDQH_R_W_ENC : ADDUH_QB_FMT<0b10010>;
2360b57cec5SDimitry Andricclass SUBQH_W_ENC : ADDUH_QB_FMT<0b10001>;
2370b57cec5SDimitry Andricclass SUBQH_R_W_ENC : ADDUH_QB_FMT<0b10011>;
2380b57cec5SDimitry Andricclass MUL_PH_ENC : ADDUH_QB_FMT<0b01100>;
2390b57cec5SDimitry Andricclass MUL_S_PH_ENC : ADDUH_QB_FMT<0b01110>;
2400b57cec5SDimitry Andricclass MULQ_S_W_ENC : ADDUH_QB_FMT<0b10110>;
2410b57cec5SDimitry Andricclass MULQ_RS_W_ENC : ADDUH_QB_FMT<0b10111>;
2420b57cec5SDimitry Andricclass MULQ_S_PH_ENC : ADDU_QB_FMT<0b11110>;
2430b57cec5SDimitry Andricclass DPA_W_PH_ENC : DPA_W_PH_FMT<0b00000>;
2440b57cec5SDimitry Andricclass DPS_W_PH_ENC : DPA_W_PH_FMT<0b00001>;
2450b57cec5SDimitry Andricclass DPAQX_S_W_PH_ENC : DPA_W_PH_FMT<0b11000>;
2460b57cec5SDimitry Andricclass DPAQX_SA_W_PH_ENC : DPA_W_PH_FMT<0b11010>;
2470b57cec5SDimitry Andricclass DPAX_W_PH_ENC : DPA_W_PH_FMT<0b01000>;
2480b57cec5SDimitry Andricclass DPSX_W_PH_ENC : DPA_W_PH_FMT<0b01001>;
2490b57cec5SDimitry Andricclass DPSQX_S_W_PH_ENC : DPA_W_PH_FMT<0b11001>;
2500b57cec5SDimitry Andricclass DPSQX_SA_W_PH_ENC : DPA_W_PH_FMT<0b11011>;
2510b57cec5SDimitry Andricclass MULSA_W_PH_ENC : DPA_W_PH_FMT<0b00010>;
2520b57cec5SDimitry Andricclass PRECR_QB_PH_ENC : CMP_EQ_QB_R3_FMT<0b01101>;
2530b57cec5SDimitry Andricclass PRECR_SRA_PH_W_ENC : PRECR_SRA_PH_W_FMT<0b11110>;
2540b57cec5SDimitry Andricclass PRECR_SRA_R_PH_W_ENC : PRECR_SRA_PH_W_FMT<0b11111>;
2550b57cec5SDimitry Andricclass SHRA_QB_ENC : SHLL_QB_FMT<0b00100>;
2560b57cec5SDimitry Andricclass SHRAV_QB_ENC : SHLL_QB_FMT<0b00110>;
2570b57cec5SDimitry Andricclass SHRA_R_QB_ENC : SHLL_QB_FMT<0b00101>;
2580b57cec5SDimitry Andricclass SHRAV_R_QB_ENC : SHLL_QB_FMT<0b00111>;
2590b57cec5SDimitry Andricclass SHRL_PH_ENC : SHLL_QB_FMT<0b11001>;
2600b57cec5SDimitry Andricclass SHRLV_PH_ENC : SHLL_QB_FMT<0b11011>;
2610b57cec5SDimitry Andricclass APPEND_ENC : APPEND_FMT<0b00000>;
2620b57cec5SDimitry Andricclass BALIGN_ENC : APPEND_FMT<0b10000>;
2630b57cec5SDimitry Andricclass PREPEND_ENC : APPEND_FMT<0b00001>;
2640b57cec5SDimitry Andric
2650b57cec5SDimitry Andric// Instruction desc.
2660b57cec5SDimitry Andricclass ADDU_QB_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
2670b57cec5SDimitry Andric                        InstrItinClass itin, RegisterOperand ROD,
2680b57cec5SDimitry Andric                        RegisterOperand ROS,  RegisterOperand ROT = ROS> {
2690b57cec5SDimitry Andric  dag OutOperandList = (outs ROD:$rd);
2700b57cec5SDimitry Andric  dag InOperandList = (ins ROS:$rs, ROT:$rt);
2710b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
2720b57cec5SDimitry Andric  list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs, ROT:$rt))];
2730b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
2740b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
2750b57cec5SDimitry Andric}
2760b57cec5SDimitry Andric
2770b57cec5SDimitry Andricclass RADDU_W_QB_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
2780b57cec5SDimitry Andric                           InstrItinClass itin, RegisterOperand ROD,
2790b57cec5SDimitry Andric                           RegisterOperand ROS = ROD> {
2800b57cec5SDimitry Andric  dag OutOperandList = (outs ROD:$rd);
2810b57cec5SDimitry Andric  dag InOperandList = (ins ROS:$rs);
2820b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $rs");
2830b57cec5SDimitry Andric  list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs))];
2840b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
2850b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
2860b57cec5SDimitry Andric}
2870b57cec5SDimitry Andric
2880b57cec5SDimitry Andricclass CMP_EQ_QB_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
2890b57cec5SDimitry Andric                             InstrItinClass itin, RegisterOperand ROS,
2900b57cec5SDimitry Andric                             RegisterOperand ROT = ROS> {
2910b57cec5SDimitry Andric  dag OutOperandList = (outs);
2920b57cec5SDimitry Andric  dag InOperandList = (ins ROS:$rs, ROT:$rt);
2930b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rs, $rt");
2940b57cec5SDimitry Andric  list<dag> Pattern = [(OpNode ROS:$rs, ROT:$rt)];
2950b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
2960b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
2970b57cec5SDimitry Andric}
2980b57cec5SDimitry Andric
2990b57cec5SDimitry Andricclass CMP_EQ_QB_R3_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3000b57cec5SDimitry Andric                             InstrItinClass itin, RegisterOperand ROD,
3010b57cec5SDimitry Andric                             RegisterOperand ROS,  RegisterOperand ROT = ROS> {
3020b57cec5SDimitry Andric  dag OutOperandList = (outs ROD:$rd);
3030b57cec5SDimitry Andric  dag InOperandList = (ins ROS:$rs, ROT:$rt);
3040b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
3050b57cec5SDimitry Andric  list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs, ROT:$rt))];
3060b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3070b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3080b57cec5SDimitry Andric}
3090b57cec5SDimitry Andric
3100b57cec5SDimitry Andricclass PRECR_SRA_PH_W_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3110b57cec5SDimitry Andric                               InstrItinClass itin, RegisterOperand ROT,
3120b57cec5SDimitry Andric                               RegisterOperand ROS = ROT> {
3130b57cec5SDimitry Andric  dag OutOperandList = (outs ROT:$rt);
3140b57cec5SDimitry Andric  dag InOperandList = (ins ROS:$rs, uimm5:$sa, ROS:$src);
3150b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $sa");
3168bcb0991SDimitry Andric  list<dag> Pattern = [(set ROT:$rt, (OpNode ROS:$src, ROS:$rs, timmZExt5:$sa))];
3170b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3180b57cec5SDimitry Andric  string Constraints = "$src = $rt";
3190b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3200b57cec5SDimitry Andric}
3210b57cec5SDimitry Andric
3220b57cec5SDimitry Andricclass ABSQ_S_PH_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3230b57cec5SDimitry Andric                             InstrItinClass itin, RegisterOperand ROD,
3240b57cec5SDimitry Andric                             RegisterOperand ROT = ROD> {
3250b57cec5SDimitry Andric  dag OutOperandList = (outs ROD:$rd);
3260b57cec5SDimitry Andric  dag InOperandList = (ins ROT:$rt);
3270b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $rt");
3280b57cec5SDimitry Andric  list<dag> Pattern = [(set ROD:$rd, (OpNode ROT:$rt))];
3290b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3300b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3310b57cec5SDimitry Andric}
3320b57cec5SDimitry Andric
3330b57cec5SDimitry Andricclass REPL_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3340b57cec5SDimitry Andric                     Operand ImmOp, ImmLeaf immPat, InstrItinClass itin,
3350b57cec5SDimitry Andric                     RegisterOperand RO> {
3360b57cec5SDimitry Andric  dag OutOperandList = (outs RO:$rd);
3370b57cec5SDimitry Andric  dag InOperandList = (ins ImmOp:$imm);
3380b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $imm");
3390b57cec5SDimitry Andric  list<dag> Pattern = [(set RO:$rd, (OpNode immPat:$imm))];
3400b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3410b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3420b57cec5SDimitry Andric}
3430b57cec5SDimitry Andric
3440b57cec5SDimitry Andricclass SHLL_QB_R3_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3450b57cec5SDimitry Andric                           InstrItinClass itin, RegisterOperand RO> {
3460b57cec5SDimitry Andric  dag OutOperandList = (outs RO:$rd);
3470b57cec5SDimitry Andric  dag InOperandList =  (ins RO:$rt, GPR32Opnd:$rs_sa);
3480b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $rt, $rs_sa");
3490b57cec5SDimitry Andric  list<dag> Pattern = [(set RO:$rd, (OpNode RO:$rt, GPR32Opnd:$rs_sa))];
3500b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3510b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3520b57cec5SDimitry Andric}
3530b57cec5SDimitry Andric
3540b57cec5SDimitry Andricclass SHLL_QB_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3550b57cec5SDimitry Andric                           SDPatternOperator ImmPat, InstrItinClass itin,
3560b57cec5SDimitry Andric                           RegisterOperand RO, Operand ImmOpnd> {
3570b57cec5SDimitry Andric  dag OutOperandList = (outs RO:$rd);
3580b57cec5SDimitry Andric  dag InOperandList = (ins RO:$rt, ImmOpnd:$rs_sa);
3590b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $rt, $rs_sa");
3600b57cec5SDimitry Andric  list<dag> Pattern = [(set RO:$rd, (OpNode RO:$rt, ImmPat:$rs_sa))];
3610b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3620b57cec5SDimitry Andric  bit hasSideEffects = 1;
3630b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3640b57cec5SDimitry Andric}
3650b57cec5SDimitry Andric
3660b57cec5SDimitry Andricclass LX_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3670b57cec5SDimitry Andric                   InstrItinClass itin> {
3680b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rd);
3690b57cec5SDimitry Andric  dag InOperandList = (ins PtrRC:$base, PtrRC:$index);
3700b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, ${index}(${base})");
3710b57cec5SDimitry Andric  list<dag> Pattern = [(set GPR32Opnd:$rd, (OpNode iPTR:$base, iPTR:$index))];
3720b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3730b57cec5SDimitry Andric  bit mayLoad = 1;
3740b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3750b57cec5SDimitry Andric}
3760b57cec5SDimitry Andric
3770b57cec5SDimitry Andricclass ADDUH_QB_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
3780b57cec5SDimitry Andric                         InstrItinClass itin, RegisterOperand ROD,
3790b57cec5SDimitry Andric                         RegisterOperand ROS = ROD, RegisterOperand ROT = ROD> {
3800b57cec5SDimitry Andric  dag OutOperandList = (outs ROD:$rd);
3810b57cec5SDimitry Andric  dag InOperandList = (ins ROS:$rs, ROT:$rt);
3820b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
3830b57cec5SDimitry Andric  list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs, ROT:$rt))];
3840b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3850b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3860b57cec5SDimitry Andric}
3870b57cec5SDimitry Andric
3880b57cec5SDimitry Andricclass APPEND_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
389480093f4SDimitry Andric                       Operand ImmOp, SDPatternOperator Imm,
390480093f4SDimitry Andric                       InstrItinClass itin> {
3910b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rt);
3920b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs, ImmOp:$sa, GPR32Opnd:$src);
3930b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $sa");
3940b57cec5SDimitry Andric  list<dag> Pattern =  [(set GPR32Opnd:$rt,
3950b57cec5SDimitry Andric                        (OpNode GPR32Opnd:$src, GPR32Opnd:$rs, Imm:$sa))];
3960b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
3970b57cec5SDimitry Andric  string Constraints = "$src = $rt";
3980b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
3990b57cec5SDimitry Andric}
4000b57cec5SDimitry Andric
401*349cc55cSDimitry Andricclass EXTR_W_TY1_R2_DESC_BASE<string instr_asm, InstrItinClass itin> {
4020b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rt);
4030b57cec5SDimitry Andric  dag InOperandList = (ins ACC64DSPOpnd:$ac, GPR32Opnd:$shift_rs);
4040b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $ac, $shift_rs");
4050b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
4060b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4070b57cec5SDimitry Andric}
4080b57cec5SDimitry Andric
409*349cc55cSDimitry Andricclass EXTR_W_TY1_R1_DESC_BASE<string instr_asm, InstrItinClass itin> {
4100b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rt);
4110b57cec5SDimitry Andric  dag InOperandList = (ins ACC64DSPOpnd:$ac, uimm5:$shift_rs);
4120b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $ac, $shift_rs");
4130b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
4140b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4150b57cec5SDimitry Andric}
4160b57cec5SDimitry Andric
4170b57cec5SDimitry Andricclass SHILO_R1_DESC_BASE<string instr_asm, SDPatternOperator OpNode> {
4180b57cec5SDimitry Andric  dag OutOperandList = (outs ACC64DSPOpnd:$ac);
4190b57cec5SDimitry Andric  dag InOperandList = (ins simm6:$shift, ACC64DSPOpnd:$acin);
4200b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$ac, $shift");
4210b57cec5SDimitry Andric  list<dag> Pattern = [(set ACC64DSPOpnd:$ac,
4220b57cec5SDimitry Andric                        (OpNode immSExt6:$shift, ACC64DSPOpnd:$acin))];
4230b57cec5SDimitry Andric  string Constraints = "$acin = $ac";
4240b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4250b57cec5SDimitry Andric}
4260b57cec5SDimitry Andric
4270b57cec5SDimitry Andricclass SHILO_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode> {
4280b57cec5SDimitry Andric  dag OutOperandList = (outs ACC64DSPOpnd:$ac);
4290b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs, ACC64DSPOpnd:$acin);
4300b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$ac, $rs");
4310b57cec5SDimitry Andric  list<dag> Pattern = [(set ACC64DSPOpnd:$ac,
4320b57cec5SDimitry Andric                        (OpNode GPR32Opnd:$rs, ACC64DSPOpnd:$acin))];
4330b57cec5SDimitry Andric  string Constraints = "$acin = $ac";
4340b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4350b57cec5SDimitry Andric}
4360b57cec5SDimitry Andric
4370b57cec5SDimitry Andricclass MTHLIP_DESC_BASE<string instr_asm, SDPatternOperator OpNode> {
4380b57cec5SDimitry Andric  dag OutOperandList = (outs ACC64DSPOpnd:$ac);
4390b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs, ACC64DSPOpnd:$acin);
4400b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rs, $ac");
4410b57cec5SDimitry Andric  list<dag> Pattern = [(set ACC64DSPOpnd:$ac,
4420b57cec5SDimitry Andric                        (OpNode GPR32Opnd:$rs, ACC64DSPOpnd:$acin))];
4430b57cec5SDimitry Andric  string Constraints = "$acin = $ac";
4440b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4450b57cec5SDimitry Andric}
4460b57cec5SDimitry Andric
4470b57cec5SDimitry Andricclass RDDSP_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
4480b57cec5SDimitry Andric                      InstrItinClass itin> {
4490b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rd);
4500b57cec5SDimitry Andric  dag InOperandList = (ins uimm10:$mask);
4510b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $mask");
4528bcb0991SDimitry Andric  list<dag> Pattern = [(set GPR32Opnd:$rd, (OpNode timmZExt10:$mask))];
4530b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
4540b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4550b57cec5SDimitry Andric}
4560b57cec5SDimitry Andric
4570b57cec5SDimitry Andricclass WRDSP_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
4580b57cec5SDimitry Andric                      InstrItinClass itin> {
4590b57cec5SDimitry Andric  dag OutOperandList = (outs);
4600b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs, uimm10:$mask);
4610b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rs, $mask");
4628bcb0991SDimitry Andric  list<dag> Pattern = [(OpNode GPR32Opnd:$rs, timmZExt10:$mask)];
4630b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
4640b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4650b57cec5SDimitry Andric}
4660b57cec5SDimitry Andric
4670b57cec5SDimitry Andricclass DPA_W_PH_DESC_BASE<string instr_asm, SDPatternOperator OpNode> {
4680b57cec5SDimitry Andric  dag OutOperandList = (outs ACC64DSPOpnd:$ac);
4690b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin);
4700b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$ac, $rs, $rt");
4710b57cec5SDimitry Andric  list<dag> Pattern = [(set ACC64DSPOpnd:$ac,
4720b57cec5SDimitry Andric                        (OpNode GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin))];
4730b57cec5SDimitry Andric  string Constraints = "$acin = $ac";
4740b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4750b57cec5SDimitry Andric}
4760b57cec5SDimitry Andric
4770b57cec5SDimitry Andricclass MULT_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
4780b57cec5SDimitry Andric                     InstrItinClass itin> {
4790b57cec5SDimitry Andric  dag OutOperandList = (outs ACC64DSPOpnd:$ac);
4800b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs, GPR32Opnd:$rt);
4810b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$ac, $rs, $rt");
4820b57cec5SDimitry Andric  list<dag> Pattern = [(set ACC64DSPOpnd:$ac, (OpNode GPR32Opnd:$rs, GPR32Opnd:$rt))];
4830b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
4840b57cec5SDimitry Andric  bit isCommutable = 1;
4850b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4860b57cec5SDimitry Andric}
4870b57cec5SDimitry Andric
4880b57cec5SDimitry Andricclass MADD_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
4890b57cec5SDimitry Andric                     InstrItinClass itin> {
4900b57cec5SDimitry Andric  dag OutOperandList = (outs ACC64DSPOpnd:$ac);
4910b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin);
4920b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$ac, $rs, $rt");
4930b57cec5SDimitry Andric  list<dag> Pattern = [(set ACC64DSPOpnd:$ac,
4940b57cec5SDimitry Andric                        (OpNode GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin))];
4950b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
4960b57cec5SDimitry Andric  string Constraints = "$acin = $ac";
4970b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
4980b57cec5SDimitry Andric}
4990b57cec5SDimitry Andric
5000b57cec5SDimitry Andricclass MFHI_DESC_BASE<string instr_asm, RegisterOperand RO, SDNode OpNode,
5010b57cec5SDimitry Andric                     InstrItinClass itin> {
5020b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rd);
5030b57cec5SDimitry Andric  dag InOperandList = (ins RO:$ac);
5040b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rd, $ac");
5050b57cec5SDimitry Andric  list<dag> Pattern = [(set GPR32Opnd:$rd, (OpNode RO:$ac))];
5060b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
5070b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
5080b57cec5SDimitry Andric  bit isMoveReg = 1;
5090b57cec5SDimitry Andric}
5100b57cec5SDimitry Andric
511480093f4SDimitry Andricclass MTHI_DESC_BASE<string instr_asm, RegisterOperand RO,
512480093f4SDimitry Andric                     InstrItinClass itin> {
5130b57cec5SDimitry Andric  dag OutOperandList = (outs RO:$ac);
5140b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs);
5150b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rs, $ac");
5160b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
5170b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
5180b57cec5SDimitry Andric  bit isMoveReg = 1;
5190b57cec5SDimitry Andric}
5200b57cec5SDimitry Andric
521*349cc55cSDimitry Andricclass BPOSGE32_PSEUDO_DESC_BASE<SDPatternOperator OpNode> :
5220b57cec5SDimitry Andric  MipsPseudo<(outs GPR32Opnd:$dst), (ins), [(set GPR32Opnd:$dst, (OpNode))]> {
5230b57cec5SDimitry Andric  bit hasNoSchedulingInfo = 1;
5240b57cec5SDimitry Andric  bit usesCustomInserter = 1;
5250b57cec5SDimitry Andric}
5260b57cec5SDimitry Andric
5270b57cec5SDimitry Andricclass BPOSGE32_DESC_BASE<string instr_asm, DAGOperand opnd,
5280b57cec5SDimitry Andric                         InstrItinClass itin> {
5290b57cec5SDimitry Andric  dag OutOperandList = (outs);
5300b57cec5SDimitry Andric  dag InOperandList = (ins opnd:$offset);
5310b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$offset");
5320b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
5330b57cec5SDimitry Andric  bit isBranch = 1;
5340b57cec5SDimitry Andric  bit isTerminator = 1;
5350b57cec5SDimitry Andric  bit hasDelaySlot = 1;
5360b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
5370b57cec5SDimitry Andric}
5380b57cec5SDimitry Andric
5390b57cec5SDimitry Andricclass INSV_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
5400b57cec5SDimitry Andric                     InstrItinClass itin> {
5410b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rt);
5420b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$src, GPR32Opnd:$rs);
5430b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $rs");
5440b57cec5SDimitry Andric  list<dag> Pattern = [(set GPR32Opnd:$rt, (OpNode GPR32Opnd:$src, GPR32Opnd:$rs))];
5450b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
5460b57cec5SDimitry Andric  string Constraints = "$src = $rt";
5470b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
5480b57cec5SDimitry Andric}
5490b57cec5SDimitry Andric
5500b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5510b57cec5SDimitry Andric// MIPS DSP Rev 1
5520b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5530b57cec5SDimitry Andric
5540b57cec5SDimitry Andric// Addition/subtraction
5550b57cec5SDimitry Andricclass ADDU_QB_DESC : ADDU_QB_DESC_BASE<"addu.qb", null_frag, NoItinerary,
5560b57cec5SDimitry Andric                                       DSPROpnd, DSPROpnd>, IsCommutable,
5570b57cec5SDimitry Andric                     Defs<[DSPOutFlag20]>;
5580b57cec5SDimitry Andric
5590b57cec5SDimitry Andricclass ADDU_S_QB_DESC : ADDU_QB_DESC_BASE<"addu_s.qb", int_mips_addu_s_qb,
5600b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd, DSPROpnd>,
5610b57cec5SDimitry Andric                       IsCommutable, Defs<[DSPOutFlag20]>;
5620b57cec5SDimitry Andric
5630b57cec5SDimitry Andricclass SUBU_QB_DESC : ADDU_QB_DESC_BASE<"subu.qb", null_frag, NoItinerary,
5640b57cec5SDimitry Andric                                       DSPROpnd, DSPROpnd>,
5650b57cec5SDimitry Andric                     Defs<[DSPOutFlag20]>;
5660b57cec5SDimitry Andric
5670b57cec5SDimitry Andricclass SUBU_S_QB_DESC : ADDU_QB_DESC_BASE<"subu_s.qb", int_mips_subu_s_qb,
5680b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd, DSPROpnd>,
5690b57cec5SDimitry Andric                       Defs<[DSPOutFlag20]>;
5700b57cec5SDimitry Andric
5710b57cec5SDimitry Andricclass ADDQ_PH_DESC : ADDU_QB_DESC_BASE<"addq.ph", null_frag, NoItinerary,
5720b57cec5SDimitry Andric                                       DSPROpnd, DSPROpnd>, IsCommutable,
5730b57cec5SDimitry Andric                     Defs<[DSPOutFlag20]>;
5740b57cec5SDimitry Andric
5750b57cec5SDimitry Andricclass ADDQ_S_PH_DESC : ADDU_QB_DESC_BASE<"addq_s.ph", int_mips_addq_s_ph,
5760b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd, DSPROpnd>,
5770b57cec5SDimitry Andric                       IsCommutable, Defs<[DSPOutFlag20]>;
5780b57cec5SDimitry Andric
5790b57cec5SDimitry Andricclass SUBQ_PH_DESC : ADDU_QB_DESC_BASE<"subq.ph", null_frag, NoItinerary,
5800b57cec5SDimitry Andric                                       DSPROpnd, DSPROpnd>,
5810b57cec5SDimitry Andric                     Defs<[DSPOutFlag20]>;
5820b57cec5SDimitry Andric
5830b57cec5SDimitry Andricclass SUBQ_S_PH_DESC : ADDU_QB_DESC_BASE<"subq_s.ph", int_mips_subq_s_ph,
5840b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd, DSPROpnd>,
5850b57cec5SDimitry Andric                       Defs<[DSPOutFlag20]>;
5860b57cec5SDimitry Andric
5870b57cec5SDimitry Andricclass ADDQ_S_W_DESC : ADDU_QB_DESC_BASE<"addq_s.w", int_mips_addq_s_w,
5880b57cec5SDimitry Andric                                        NoItinerary, GPR32Opnd, GPR32Opnd>,
5890b57cec5SDimitry Andric                      IsCommutable, Defs<[DSPOutFlag20]>;
5900b57cec5SDimitry Andric
5910b57cec5SDimitry Andricclass SUBQ_S_W_DESC : ADDU_QB_DESC_BASE<"subq_s.w", int_mips_subq_s_w,
5920b57cec5SDimitry Andric                                        NoItinerary, GPR32Opnd, GPR32Opnd>,
5930b57cec5SDimitry Andric                      Defs<[DSPOutFlag20]>;
5940b57cec5SDimitry Andric
5950b57cec5SDimitry Andricclass ADDSC_DESC : ADDU_QB_DESC_BASE<"addsc", null_frag, NoItinerary,
5960b57cec5SDimitry Andric                                     GPR32Opnd, GPR32Opnd>, IsCommutable,
5970b57cec5SDimitry Andric                   Defs<[DSPCarry]>;
5980b57cec5SDimitry Andric
5990b57cec5SDimitry Andricclass ADDWC_DESC : ADDU_QB_DESC_BASE<"addwc", null_frag, NoItinerary,
6000b57cec5SDimitry Andric                                     GPR32Opnd, GPR32Opnd>,
6010b57cec5SDimitry Andric                   IsCommutable, Uses<[DSPCarry]>, Defs<[DSPOutFlag20]>;
6020b57cec5SDimitry Andric
6030b57cec5SDimitry Andricclass MODSUB_DESC : ADDU_QB_DESC_BASE<"modsub", int_mips_modsub, NoItinerary,
6040b57cec5SDimitry Andric                                      GPR32Opnd, GPR32Opnd>;
6050b57cec5SDimitry Andric
6060b57cec5SDimitry Andricclass RADDU_W_QB_DESC : RADDU_W_QB_DESC_BASE<"raddu.w.qb", int_mips_raddu_w_qb,
6070b57cec5SDimitry Andric                                             NoItinerary, GPR32Opnd, DSPROpnd>;
6080b57cec5SDimitry Andric
6090b57cec5SDimitry Andric// Absolute value
6100b57cec5SDimitry Andricclass ABSQ_S_PH_DESC : ABSQ_S_PH_R2_DESC_BASE<"absq_s.ph", int_mips_absq_s_ph,
6110b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd>,
6120b57cec5SDimitry Andric                       Defs<[DSPOutFlag20]>;
6130b57cec5SDimitry Andric
6140b57cec5SDimitry Andricclass ABSQ_S_W_DESC : ABSQ_S_PH_R2_DESC_BASE<"absq_s.w", int_mips_absq_s_w,
6150b57cec5SDimitry Andric                                             NoItinerary, GPR32Opnd>,
6160b57cec5SDimitry Andric                      Defs<[DSPOutFlag20]>;
6170b57cec5SDimitry Andric
6180b57cec5SDimitry Andric// Precision reduce/expand
6190b57cec5SDimitry Andricclass PRECRQ_QB_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrq.qb.ph",
6200b57cec5SDimitry Andric                                                 int_mips_precrq_qb_ph,
6210b57cec5SDimitry Andric                                                 NoItinerary, DSPROpnd, DSPROpnd>;
6220b57cec5SDimitry Andric
6230b57cec5SDimitry Andricclass PRECRQ_PH_W_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrq.ph.w",
6240b57cec5SDimitry Andric                                                int_mips_precrq_ph_w,
6250b57cec5SDimitry Andric                                                NoItinerary, DSPROpnd, GPR32Opnd>;
6260b57cec5SDimitry Andric
6270b57cec5SDimitry Andricclass PRECRQ_RS_PH_W_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrq_rs.ph.w",
6280b57cec5SDimitry Andric                                                   int_mips_precrq_rs_ph_w,
6290b57cec5SDimitry Andric                                                   NoItinerary, DSPROpnd,
6300b57cec5SDimitry Andric                                                   GPR32Opnd>,
6310b57cec5SDimitry Andric                            Defs<[DSPOutFlag22]>;
6320b57cec5SDimitry Andric
6330b57cec5SDimitry Andricclass PRECRQU_S_QB_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrqu_s.qb.ph",
6340b57cec5SDimitry Andric                                                    int_mips_precrqu_s_qb_ph,
6350b57cec5SDimitry Andric                                                    NoItinerary, DSPROpnd,
6360b57cec5SDimitry Andric                                                    DSPROpnd>,
6370b57cec5SDimitry Andric                             Defs<[DSPOutFlag22]>;
6380b57cec5SDimitry Andric
6390b57cec5SDimitry Andricclass PRECEQ_W_PHL_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceq.w.phl",
6400b57cec5SDimitry Andric                                                 int_mips_preceq_w_phl,
6410b57cec5SDimitry Andric                                                 NoItinerary, GPR32Opnd, DSPROpnd>;
6420b57cec5SDimitry Andric
6430b57cec5SDimitry Andricclass PRECEQ_W_PHR_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceq.w.phr",
6440b57cec5SDimitry Andric                                                 int_mips_preceq_w_phr,
6450b57cec5SDimitry Andric                                                 NoItinerary, GPR32Opnd, DSPROpnd>;
6460b57cec5SDimitry Andric
6470b57cec5SDimitry Andricclass PRECEQU_PH_QBL_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbl",
6480b57cec5SDimitry Andric                                                   int_mips_precequ_ph_qbl,
6490b57cec5SDimitry Andric                                                   NoItinerary, DSPROpnd>;
6500b57cec5SDimitry Andric
6510b57cec5SDimitry Andricclass PRECEQU_PH_QBR_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbr",
6520b57cec5SDimitry Andric                                                   int_mips_precequ_ph_qbr,
6530b57cec5SDimitry Andric                                                   NoItinerary, DSPROpnd>;
6540b57cec5SDimitry Andric
6550b57cec5SDimitry Andricclass PRECEQU_PH_QBLA_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbla",
6560b57cec5SDimitry Andric                                                    int_mips_precequ_ph_qbla,
6570b57cec5SDimitry Andric                                                    NoItinerary, DSPROpnd>;
6580b57cec5SDimitry Andric
6590b57cec5SDimitry Andricclass PRECEQU_PH_QBRA_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbra",
6600b57cec5SDimitry Andric                                                    int_mips_precequ_ph_qbra,
6610b57cec5SDimitry Andric                                                    NoItinerary, DSPROpnd>;
6620b57cec5SDimitry Andric
6630b57cec5SDimitry Andricclass PRECEU_PH_QBL_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbl",
6640b57cec5SDimitry Andric                                                  int_mips_preceu_ph_qbl,
6650b57cec5SDimitry Andric                                                  NoItinerary, DSPROpnd>;
6660b57cec5SDimitry Andric
6670b57cec5SDimitry Andricclass PRECEU_PH_QBR_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbr",
6680b57cec5SDimitry Andric                                                  int_mips_preceu_ph_qbr,
6690b57cec5SDimitry Andric                                                  NoItinerary, DSPROpnd>;
6700b57cec5SDimitry Andric
6710b57cec5SDimitry Andricclass PRECEU_PH_QBLA_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbla",
6720b57cec5SDimitry Andric                                                   int_mips_preceu_ph_qbla,
6730b57cec5SDimitry Andric                                                   NoItinerary, DSPROpnd>;
6740b57cec5SDimitry Andric
6750b57cec5SDimitry Andricclass PRECEU_PH_QBRA_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbra",
6760b57cec5SDimitry Andric                                                   int_mips_preceu_ph_qbra,
6770b57cec5SDimitry Andric                                                   NoItinerary, DSPROpnd>;
6780b57cec5SDimitry Andric
6790b57cec5SDimitry Andric// Shift
6800b57cec5SDimitry Andricclass SHLL_QB_DESC : SHLL_QB_R2_DESC_BASE<"shll.qb", null_frag, immZExt3,
6810b57cec5SDimitry Andric                                          NoItinerary, DSPROpnd, uimm3>,
6820b57cec5SDimitry Andric                     Defs<[DSPOutFlag22]>;
6830b57cec5SDimitry Andric
6840b57cec5SDimitry Andricclass SHLLV_QB_DESC : SHLL_QB_R3_DESC_BASE<"shllv.qb", int_mips_shll_qb,
6850b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>,
6860b57cec5SDimitry Andric                      Defs<[DSPOutFlag22]>;
6870b57cec5SDimitry Andric
6880b57cec5SDimitry Andricclass SHRL_QB_DESC : SHLL_QB_R2_DESC_BASE<"shrl.qb", null_frag, immZExt3,
6890b57cec5SDimitry Andric                                          NoItinerary, DSPROpnd, uimm3>;
6900b57cec5SDimitry Andric
6910b57cec5SDimitry Andricclass SHRLV_QB_DESC : SHLL_QB_R3_DESC_BASE<"shrlv.qb", int_mips_shrl_qb,
6920b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>;
6930b57cec5SDimitry Andric
6940b57cec5SDimitry Andricclass SHLL_PH_DESC : SHLL_QB_R2_DESC_BASE<"shll.ph", null_frag, immZExt4,
6950b57cec5SDimitry Andric                                          NoItinerary, DSPROpnd, uimm4>,
6960b57cec5SDimitry Andric                     Defs<[DSPOutFlag22]>;
6970b57cec5SDimitry Andric
6980b57cec5SDimitry Andricclass SHLLV_PH_DESC : SHLL_QB_R3_DESC_BASE<"shllv.ph", int_mips_shll_ph,
6990b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>,
7000b57cec5SDimitry Andric                      Defs<[DSPOutFlag22]>;
7010b57cec5SDimitry Andric
7020b57cec5SDimitry Andricclass SHLL_S_PH_DESC : SHLL_QB_R2_DESC_BASE<"shll_s.ph", int_mips_shll_s_ph,
7030b57cec5SDimitry Andric                                            immZExt4, NoItinerary, DSPROpnd,
7040b57cec5SDimitry Andric                                            uimm4>,
7050b57cec5SDimitry Andric                       Defs<[DSPOutFlag22]>;
7060b57cec5SDimitry Andric
7070b57cec5SDimitry Andricclass SHLLV_S_PH_DESC : SHLL_QB_R3_DESC_BASE<"shllv_s.ph", int_mips_shll_s_ph,
7080b57cec5SDimitry Andric                                             NoItinerary, DSPROpnd>,
7090b57cec5SDimitry Andric                        Defs<[DSPOutFlag22]>;
7100b57cec5SDimitry Andric
7110b57cec5SDimitry Andricclass SHRA_PH_DESC : SHLL_QB_R2_DESC_BASE<"shra.ph", null_frag, immZExt4,
7120b57cec5SDimitry Andric                                          NoItinerary, DSPROpnd, uimm4>;
7130b57cec5SDimitry Andric
7140b57cec5SDimitry Andricclass SHRAV_PH_DESC : SHLL_QB_R3_DESC_BASE<"shrav.ph", int_mips_shra_ph,
7150b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>;
7160b57cec5SDimitry Andric
7170b57cec5SDimitry Andricclass SHRA_R_PH_DESC : SHLL_QB_R2_DESC_BASE<"shra_r.ph", int_mips_shra_r_ph,
7180b57cec5SDimitry Andric                                            immZExt4, NoItinerary, DSPROpnd,
7190b57cec5SDimitry Andric                                            uimm4>;
7200b57cec5SDimitry Andric
7210b57cec5SDimitry Andricclass SHRAV_R_PH_DESC : SHLL_QB_R3_DESC_BASE<"shrav_r.ph", int_mips_shra_r_ph,
7220b57cec5SDimitry Andric                                             NoItinerary, DSPROpnd>;
7230b57cec5SDimitry Andric
7240b57cec5SDimitry Andricclass SHLL_S_W_DESC : SHLL_QB_R2_DESC_BASE<"shll_s.w", int_mips_shll_s_w,
7250b57cec5SDimitry Andric                                           immZExt5, NoItinerary, GPR32Opnd,
7260b57cec5SDimitry Andric                                           uimm5>,
7270b57cec5SDimitry Andric                      Defs<[DSPOutFlag22]>;
7280b57cec5SDimitry Andric
7290b57cec5SDimitry Andricclass SHLLV_S_W_DESC : SHLL_QB_R3_DESC_BASE<"shllv_s.w", int_mips_shll_s_w,
7300b57cec5SDimitry Andric                                            NoItinerary, GPR32Opnd>,
7310b57cec5SDimitry Andric                       Defs<[DSPOutFlag22]>;
7320b57cec5SDimitry Andric
7330b57cec5SDimitry Andricclass SHRA_R_W_DESC : SHLL_QB_R2_DESC_BASE<"shra_r.w", int_mips_shra_r_w,
7340b57cec5SDimitry Andric                                           immZExt5, NoItinerary, GPR32Opnd,
7350b57cec5SDimitry Andric                                           uimm5>;
7360b57cec5SDimitry Andric
7370b57cec5SDimitry Andricclass SHRAV_R_W_DESC : SHLL_QB_R3_DESC_BASE<"shrav_r.w", int_mips_shra_r_w,
7380b57cec5SDimitry Andric                                            NoItinerary, GPR32Opnd>;
7390b57cec5SDimitry Andric
7400b57cec5SDimitry Andric// Multiplication
7410b57cec5SDimitry Andricclass MULEU_S_PH_QBL_DESC : ADDU_QB_DESC_BASE<"muleu_s.ph.qbl",
7420b57cec5SDimitry Andric                                              int_mips_muleu_s_ph_qbl,
7430b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd, DSPROpnd>,
7440b57cec5SDimitry Andric                            Defs<[DSPOutFlag21]>;
7450b57cec5SDimitry Andric
7460b57cec5SDimitry Andricclass MULEU_S_PH_QBR_DESC : ADDU_QB_DESC_BASE<"muleu_s.ph.qbr",
7470b57cec5SDimitry Andric                                              int_mips_muleu_s_ph_qbr,
7480b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd, DSPROpnd>,
7490b57cec5SDimitry Andric                            Defs<[DSPOutFlag21]>;
7500b57cec5SDimitry Andric
7510b57cec5SDimitry Andricclass MULEQ_S_W_PHL_DESC : ADDU_QB_DESC_BASE<"muleq_s.w.phl",
7520b57cec5SDimitry Andric                                             int_mips_muleq_s_w_phl,
7530b57cec5SDimitry Andric                                             NoItinerary, GPR32Opnd, DSPROpnd>,
7540b57cec5SDimitry Andric                           IsCommutable, Defs<[DSPOutFlag21]>;
7550b57cec5SDimitry Andric
7560b57cec5SDimitry Andricclass MULEQ_S_W_PHR_DESC : ADDU_QB_DESC_BASE<"muleq_s.w.phr",
7570b57cec5SDimitry Andric                                             int_mips_muleq_s_w_phr,
7580b57cec5SDimitry Andric                                             NoItinerary, GPR32Opnd, DSPROpnd>,
7590b57cec5SDimitry Andric                           IsCommutable, Defs<[DSPOutFlag21]>;
7600b57cec5SDimitry Andric
7610b57cec5SDimitry Andricclass MULQ_RS_PH_DESC : ADDU_QB_DESC_BASE<"mulq_rs.ph", int_mips_mulq_rs_ph,
7620b57cec5SDimitry Andric                                          NoItinerary, DSPROpnd, DSPROpnd>,
7630b57cec5SDimitry Andric                        IsCommutable, Defs<[DSPOutFlag21]>;
7640b57cec5SDimitry Andric
7650b57cec5SDimitry Andricclass MULSAQ_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"mulsaq_s.w.ph",
7660b57cec5SDimitry Andric                                              MipsMULSAQ_S_W_PH>,
7670b57cec5SDimitry Andric                           Defs<[DSPOutFlag16_19]>;
7680b57cec5SDimitry Andric
7690b57cec5SDimitry Andricclass MAQ_S_W_PHL_DESC : DPA_W_PH_DESC_BASE<"maq_s.w.phl", MipsMAQ_S_W_PHL>,
7700b57cec5SDimitry Andric                         Defs<[DSPOutFlag16_19]>;
7710b57cec5SDimitry Andric
7720b57cec5SDimitry Andricclass MAQ_S_W_PHR_DESC : DPA_W_PH_DESC_BASE<"maq_s.w.phr", MipsMAQ_S_W_PHR>,
7730b57cec5SDimitry Andric                         Defs<[DSPOutFlag16_19]>;
7740b57cec5SDimitry Andric
7750b57cec5SDimitry Andricclass MAQ_SA_W_PHL_DESC : DPA_W_PH_DESC_BASE<"maq_sa.w.phl", MipsMAQ_SA_W_PHL>,
7760b57cec5SDimitry Andric                          Defs<[DSPOutFlag16_19]>;
7770b57cec5SDimitry Andric
7780b57cec5SDimitry Andricclass MAQ_SA_W_PHR_DESC : DPA_W_PH_DESC_BASE<"maq_sa.w.phr", MipsMAQ_SA_W_PHR>,
7790b57cec5SDimitry Andric                          Defs<[DSPOutFlag16_19]>;
7800b57cec5SDimitry Andric
7810b57cec5SDimitry Andric// Move from/to hi/lo.
7820b57cec5SDimitry Andricclass MFHI_DESC : MFHI_DESC_BASE<"mfhi", ACC64DSPOpnd, MipsMFHI, NoItinerary>;
7830b57cec5SDimitry Andricclass MFLO_DESC : MFHI_DESC_BASE<"mflo", ACC64DSPOpnd, MipsMFLO, NoItinerary>;
7840b57cec5SDimitry Andricclass MTHI_DESC : MTHI_DESC_BASE<"mthi", HI32DSPOpnd, NoItinerary>;
7850b57cec5SDimitry Andricclass MTLO_DESC : MTHI_DESC_BASE<"mtlo", LO32DSPOpnd, NoItinerary>;
7860b57cec5SDimitry Andric
7870b57cec5SDimitry Andric// Dot product with accumulate/subtract
7880b57cec5SDimitry Andricclass DPAU_H_QBL_DESC : DPA_W_PH_DESC_BASE<"dpau.h.qbl", MipsDPAU_H_QBL>;
7890b57cec5SDimitry Andric
7900b57cec5SDimitry Andricclass DPAU_H_QBR_DESC : DPA_W_PH_DESC_BASE<"dpau.h.qbr", MipsDPAU_H_QBR>;
7910b57cec5SDimitry Andric
7920b57cec5SDimitry Andricclass DPSU_H_QBL_DESC : DPA_W_PH_DESC_BASE<"dpsu.h.qbl", MipsDPSU_H_QBL>;
7930b57cec5SDimitry Andric
7940b57cec5SDimitry Andricclass DPSU_H_QBR_DESC : DPA_W_PH_DESC_BASE<"dpsu.h.qbr", MipsDPSU_H_QBR>;
7950b57cec5SDimitry Andric
7960b57cec5SDimitry Andricclass DPAQ_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpaq_s.w.ph", MipsDPAQ_S_W_PH>,
7970b57cec5SDimitry Andric                         Defs<[DSPOutFlag16_19]>;
7980b57cec5SDimitry Andric
7990b57cec5SDimitry Andricclass DPSQ_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsq_s.w.ph", MipsDPSQ_S_W_PH>,
8000b57cec5SDimitry Andric                         Defs<[DSPOutFlag16_19]>;
8010b57cec5SDimitry Andric
8020b57cec5SDimitry Andricclass DPAQ_SA_L_W_DESC : DPA_W_PH_DESC_BASE<"dpaq_sa.l.w", MipsDPAQ_SA_L_W>,
8030b57cec5SDimitry Andric                         Defs<[DSPOutFlag16_19]>;
8040b57cec5SDimitry Andric
8050b57cec5SDimitry Andricclass DPSQ_SA_L_W_DESC : DPA_W_PH_DESC_BASE<"dpsq_sa.l.w", MipsDPSQ_SA_L_W>,
8060b57cec5SDimitry Andric                         Defs<[DSPOutFlag16_19]>;
8070b57cec5SDimitry Andric
8080b57cec5SDimitry Andricclass MULT_DSP_DESC  : MULT_DESC_BASE<"mult", MipsMult, NoItinerary>;
8090b57cec5SDimitry Andricclass MULTU_DSP_DESC : MULT_DESC_BASE<"multu", MipsMultu, NoItinerary>;
8100b57cec5SDimitry Andricclass MADD_DSP_DESC  : MADD_DESC_BASE<"madd", MipsMAdd, NoItinerary>;
8110b57cec5SDimitry Andricclass MADDU_DSP_DESC : MADD_DESC_BASE<"maddu", MipsMAddu, NoItinerary>;
8120b57cec5SDimitry Andricclass MSUB_DSP_DESC  : MADD_DESC_BASE<"msub", MipsMSub, NoItinerary>;
8130b57cec5SDimitry Andricclass MSUBU_DSP_DESC : MADD_DESC_BASE<"msubu", MipsMSubu, NoItinerary>;
8140b57cec5SDimitry Andric
8150b57cec5SDimitry Andric// Comparison
8160b57cec5SDimitry Andricclass CMPU_EQ_QB_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmpu.eq.qb",
8170b57cec5SDimitry Andric                                               int_mips_cmpu_eq_qb, NoItinerary,
8180b57cec5SDimitry Andric                                               DSPROpnd>,
8190b57cec5SDimitry Andric                        IsCommutable, Defs<[DSPCCond]>;
8200b57cec5SDimitry Andric
8210b57cec5SDimitry Andricclass CMPU_LT_QB_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmpu.lt.qb",
8220b57cec5SDimitry Andric                                               int_mips_cmpu_lt_qb, NoItinerary,
8230b57cec5SDimitry Andric                                               DSPROpnd>, Defs<[DSPCCond]>;
8240b57cec5SDimitry Andric
8250b57cec5SDimitry Andricclass CMPU_LE_QB_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmpu.le.qb",
8260b57cec5SDimitry Andric                                               int_mips_cmpu_le_qb, NoItinerary,
8270b57cec5SDimitry Andric                                               DSPROpnd>, Defs<[DSPCCond]>;
8280b57cec5SDimitry Andric
8290b57cec5SDimitry Andricclass CMPGU_EQ_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgu.eq.qb",
8300b57cec5SDimitry Andric                                                int_mips_cmpgu_eq_qb,
8310b57cec5SDimitry Andric                                                NoItinerary, GPR32Opnd, DSPROpnd>,
8320b57cec5SDimitry Andric                         IsCommutable;
8330b57cec5SDimitry Andric
8340b57cec5SDimitry Andricclass CMPGU_LT_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgu.lt.qb",
8350b57cec5SDimitry Andric                                                int_mips_cmpgu_lt_qb,
8360b57cec5SDimitry Andric                                                NoItinerary, GPR32Opnd, DSPROpnd>;
8370b57cec5SDimitry Andric
8380b57cec5SDimitry Andricclass CMPGU_LE_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgu.le.qb",
8390b57cec5SDimitry Andric                                                int_mips_cmpgu_le_qb,
8400b57cec5SDimitry Andric                                                NoItinerary, GPR32Opnd, DSPROpnd>;
8410b57cec5SDimitry Andric
8420b57cec5SDimitry Andricclass CMP_EQ_PH_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmp.eq.ph", int_mips_cmp_eq_ph,
8430b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd>,
8440b57cec5SDimitry Andric                       IsCommutable, Defs<[DSPCCond]>;
8450b57cec5SDimitry Andric
8460b57cec5SDimitry Andricclass CMP_LT_PH_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmp.lt.ph", int_mips_cmp_lt_ph,
8470b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd>,
8480b57cec5SDimitry Andric                       Defs<[DSPCCond]>;
8490b57cec5SDimitry Andric
8500b57cec5SDimitry Andricclass CMP_LE_PH_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmp.le.ph", int_mips_cmp_le_ph,
8510b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd>,
8520b57cec5SDimitry Andric                       Defs<[DSPCCond]>;
8530b57cec5SDimitry Andric
8540b57cec5SDimitry Andric// Misc
8550b57cec5SDimitry Andricclass BITREV_DESC : ABSQ_S_PH_R2_DESC_BASE<"bitrev", int_mips_bitrev,
8560b57cec5SDimitry Andric                                           NoItinerary, GPR32Opnd>;
8570b57cec5SDimitry Andric
8580b57cec5SDimitry Andricclass PACKRL_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"packrl.ph", int_mips_packrl_ph,
8590b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd, DSPROpnd>;
8600b57cec5SDimitry Andric
8610b57cec5SDimitry Andricclass REPL_QB_DESC : REPL_DESC_BASE<"repl.qb", int_mips_repl_qb, uimm8,
8620b57cec5SDimitry Andric                                    immZExt8, NoItinerary, DSPROpnd>;
8630b57cec5SDimitry Andric
8640b57cec5SDimitry Andricclass REPL_PH_DESC : REPL_DESC_BASE<"repl.ph", int_mips_repl_ph, simm10,
8650b57cec5SDimitry Andric                                    immSExt10, NoItinerary, DSPROpnd>;
8660b57cec5SDimitry Andric
8670b57cec5SDimitry Andricclass REPLV_QB_DESC : ABSQ_S_PH_R2_DESC_BASE<"replv.qb", int_mips_repl_qb,
8680b57cec5SDimitry Andric                                             NoItinerary, DSPROpnd, GPR32Opnd>;
8690b57cec5SDimitry Andric
8700b57cec5SDimitry Andricclass REPLV_PH_DESC : ABSQ_S_PH_R2_DESC_BASE<"replv.ph", int_mips_repl_ph,
8710b57cec5SDimitry Andric                                             NoItinerary, DSPROpnd, GPR32Opnd>;
8720b57cec5SDimitry Andric
8730b57cec5SDimitry Andricclass PICK_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"pick.qb", int_mips_pick_qb,
8740b57cec5SDimitry Andric                                            NoItinerary, DSPROpnd, DSPROpnd>,
8750b57cec5SDimitry Andric                     Uses<[DSPCCond]>;
8760b57cec5SDimitry Andric
8770b57cec5SDimitry Andricclass PICK_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"pick.ph", int_mips_pick_ph,
8780b57cec5SDimitry Andric                                            NoItinerary, DSPROpnd, DSPROpnd>,
8790b57cec5SDimitry Andric                     Uses<[DSPCCond]>;
8800b57cec5SDimitry Andric
8810b57cec5SDimitry Andricclass LWX_DESC : LX_DESC_BASE<"lwx", int_mips_lwx, NoItinerary>;
8820b57cec5SDimitry Andric
8830b57cec5SDimitry Andricclass LHX_DESC : LX_DESC_BASE<"lhx", int_mips_lhx, NoItinerary>;
8840b57cec5SDimitry Andric
8850b57cec5SDimitry Andricclass LBUX_DESC : LX_DESC_BASE<"lbux", int_mips_lbux, NoItinerary>;
8860b57cec5SDimitry Andric
8870b57cec5SDimitry Andricclass BPOSGE32_DESC : BPOSGE32_DESC_BASE<"bposge32", brtarget, NoItinerary>;
8880b57cec5SDimitry Andric
8890b57cec5SDimitry Andric// Extr
890*349cc55cSDimitry Andricclass EXTP_DESC : EXTR_W_TY1_R1_DESC_BASE<"extp", NoItinerary>,
8910b57cec5SDimitry Andric                  Uses<[DSPPos]>, Defs<[DSPEFI]>;
8920b57cec5SDimitry Andric
893*349cc55cSDimitry Andricclass EXTPV_DESC : EXTR_W_TY1_R2_DESC_BASE<"extpv", NoItinerary>,
8940b57cec5SDimitry Andric                   Uses<[DSPPos]>, Defs<[DSPEFI]>;
8950b57cec5SDimitry Andric
896*349cc55cSDimitry Andricclass EXTPDP_DESC : EXTR_W_TY1_R1_DESC_BASE<"extpdp", NoItinerary>,
8970b57cec5SDimitry Andric                    Uses<[DSPPos]>, Defs<[DSPPos, DSPEFI]>;
8980b57cec5SDimitry Andric
899*349cc55cSDimitry Andricclass EXTPDPV_DESC : EXTR_W_TY1_R2_DESC_BASE<"extpdpv", NoItinerary>,
9000b57cec5SDimitry Andric                     Uses<[DSPPos]>, Defs<[DSPPos, DSPEFI]>;
9010b57cec5SDimitry Andric
902*349cc55cSDimitry Andricclass EXTR_W_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr.w", NoItinerary>,
9030b57cec5SDimitry Andric                    Defs<[DSPOutFlag23]>;
9040b57cec5SDimitry Andric
905*349cc55cSDimitry Andricclass EXTRV_W_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv.w", NoItinerary>,
9060b57cec5SDimitry Andric                     Defs<[DSPOutFlag23]>;
9070b57cec5SDimitry Andric
908*349cc55cSDimitry Andricclass EXTR_R_W_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr_r.w", NoItinerary>,
9090b57cec5SDimitry Andric                      Defs<[DSPOutFlag23]>;
9100b57cec5SDimitry Andric
911*349cc55cSDimitry Andricclass EXTRV_R_W_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv_r.w", NoItinerary>,
9120b57cec5SDimitry Andric                       Defs<[DSPOutFlag23]>;
9130b57cec5SDimitry Andric
914*349cc55cSDimitry Andricclass EXTR_RS_W_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr_rs.w", NoItinerary>,
9150b57cec5SDimitry Andric                       Defs<[DSPOutFlag23]>;
9160b57cec5SDimitry Andric
917*349cc55cSDimitry Andricclass EXTRV_RS_W_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv_rs.w", NoItinerary>,
9180b57cec5SDimitry Andric                        Defs<[DSPOutFlag23]>;
9190b57cec5SDimitry Andric
920*349cc55cSDimitry Andricclass EXTR_S_H_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr_s.h", NoItinerary>,
921*349cc55cSDimitry Andric                      Defs<[DSPOutFlag23]>;
922*349cc55cSDimitry Andric
923*349cc55cSDimitry Andricclass EXTRV_S_H_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv_s.h", NoItinerary>,
9240b57cec5SDimitry Andric                       Defs<[DSPOutFlag23]>;
9250b57cec5SDimitry Andric
9260b57cec5SDimitry Andricclass SHILO_DESC : SHILO_R1_DESC_BASE<"shilo", MipsSHILO>;
9270b57cec5SDimitry Andric
9280b57cec5SDimitry Andricclass SHILOV_DESC : SHILO_R2_DESC_BASE<"shilov", MipsSHILO>;
9290b57cec5SDimitry Andric
9300b57cec5SDimitry Andricclass MTHLIP_DESC : MTHLIP_DESC_BASE<"mthlip", MipsMTHLIP>, Defs<[DSPPos]>;
9310b57cec5SDimitry Andric
9320b57cec5SDimitry Andricclass RDDSP_DESC : RDDSP_DESC_BASE<"rddsp", int_mips_rddsp, NoItinerary>;
9330b57cec5SDimitry Andric
9340b57cec5SDimitry Andricclass WRDSP_DESC : WRDSP_DESC_BASE<"wrdsp", int_mips_wrdsp, NoItinerary>;
9350b57cec5SDimitry Andric
9360b57cec5SDimitry Andricclass INSV_DESC : INSV_DESC_BASE<"insv", int_mips_insv, NoItinerary>,
9370b57cec5SDimitry Andric                  Uses<[DSPPos, DSPSCount]>;
9380b57cec5SDimitry Andric
9390b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
9400b57cec5SDimitry Andric// MIPS DSP Rev 2
9410b57cec5SDimitry Andric// Addition/subtraction
9420b57cec5SDimitry Andricclass ADDU_PH_DESC : ADDU_QB_DESC_BASE<"addu.ph", int_mips_addu_ph, NoItinerary,
9430b57cec5SDimitry Andric                                       DSPROpnd, DSPROpnd>, IsCommutable,
9440b57cec5SDimitry Andric                     Defs<[DSPOutFlag20]>;
9450b57cec5SDimitry Andric
9460b57cec5SDimitry Andricclass ADDU_S_PH_DESC : ADDU_QB_DESC_BASE<"addu_s.ph", int_mips_addu_s_ph,
9470b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd, DSPROpnd>,
9480b57cec5SDimitry Andric                       IsCommutable, Defs<[DSPOutFlag20]>;
9490b57cec5SDimitry Andric
9500b57cec5SDimitry Andricclass SUBU_PH_DESC : ADDU_QB_DESC_BASE<"subu.ph", int_mips_subu_ph, NoItinerary,
9510b57cec5SDimitry Andric                                       DSPROpnd, DSPROpnd>,
9520b57cec5SDimitry Andric                     Defs<[DSPOutFlag20]>;
9530b57cec5SDimitry Andric
9540b57cec5SDimitry Andricclass SUBU_S_PH_DESC : ADDU_QB_DESC_BASE<"subu_s.ph", int_mips_subu_s_ph,
9550b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd, DSPROpnd>,
9560b57cec5SDimitry Andric                       Defs<[DSPOutFlag20]>;
9570b57cec5SDimitry Andric
9580b57cec5SDimitry Andricclass ADDUH_QB_DESC : ADDUH_QB_DESC_BASE<"adduh.qb", int_mips_adduh_qb,
9590b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd>, IsCommutable;
9600b57cec5SDimitry Andric
9610b57cec5SDimitry Andricclass ADDUH_R_QB_DESC : ADDUH_QB_DESC_BASE<"adduh_r.qb", int_mips_adduh_r_qb,
9620b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>, IsCommutable;
9630b57cec5SDimitry Andric
9640b57cec5SDimitry Andricclass SUBUH_QB_DESC : ADDUH_QB_DESC_BASE<"subuh.qb", int_mips_subuh_qb,
9650b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd>;
9660b57cec5SDimitry Andric
9670b57cec5SDimitry Andricclass SUBUH_R_QB_DESC : ADDUH_QB_DESC_BASE<"subuh_r.qb", int_mips_subuh_r_qb,
9680b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>;
9690b57cec5SDimitry Andric
9700b57cec5SDimitry Andricclass ADDQH_PH_DESC : ADDUH_QB_DESC_BASE<"addqh.ph", int_mips_addqh_ph,
9710b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd>, IsCommutable;
9720b57cec5SDimitry Andric
9730b57cec5SDimitry Andricclass ADDQH_R_PH_DESC : ADDUH_QB_DESC_BASE<"addqh_r.ph", int_mips_addqh_r_ph,
9740b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>, IsCommutable;
9750b57cec5SDimitry Andric
9760b57cec5SDimitry Andricclass SUBQH_PH_DESC : ADDUH_QB_DESC_BASE<"subqh.ph", int_mips_subqh_ph,
9770b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd>;
9780b57cec5SDimitry Andric
9790b57cec5SDimitry Andricclass SUBQH_R_PH_DESC : ADDUH_QB_DESC_BASE<"subqh_r.ph", int_mips_subqh_r_ph,
9800b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>;
9810b57cec5SDimitry Andric
9820b57cec5SDimitry Andricclass ADDQH_W_DESC : ADDUH_QB_DESC_BASE<"addqh.w", int_mips_addqh_w,
9830b57cec5SDimitry Andric                                        NoItinerary, GPR32Opnd>, IsCommutable;
9840b57cec5SDimitry Andric
9850b57cec5SDimitry Andricclass ADDQH_R_W_DESC : ADDUH_QB_DESC_BASE<"addqh_r.w", int_mips_addqh_r_w,
9860b57cec5SDimitry Andric                                          NoItinerary, GPR32Opnd>, IsCommutable;
9870b57cec5SDimitry Andric
9880b57cec5SDimitry Andricclass SUBQH_W_DESC : ADDUH_QB_DESC_BASE<"subqh.w", int_mips_subqh_w,
9890b57cec5SDimitry Andric                                        NoItinerary, GPR32Opnd>;
9900b57cec5SDimitry Andric
9910b57cec5SDimitry Andricclass SUBQH_R_W_DESC : ADDUH_QB_DESC_BASE<"subqh_r.w", int_mips_subqh_r_w,
9920b57cec5SDimitry Andric                                          NoItinerary, GPR32Opnd>;
9930b57cec5SDimitry Andric
9940b57cec5SDimitry Andric// Comparison
9950b57cec5SDimitry Andricclass CMPGDU_EQ_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgdu.eq.qb",
9960b57cec5SDimitry Andric                                                 int_mips_cmpgdu_eq_qb,
9970b57cec5SDimitry Andric                                                 NoItinerary, GPR32Opnd, DSPROpnd>,
9980b57cec5SDimitry Andric                          IsCommutable, Defs<[DSPCCond]>;
9990b57cec5SDimitry Andric
10000b57cec5SDimitry Andricclass CMPGDU_LT_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgdu.lt.qb",
10010b57cec5SDimitry Andric                                                 int_mips_cmpgdu_lt_qb,
10020b57cec5SDimitry Andric                                                 NoItinerary, GPR32Opnd, DSPROpnd>,
10030b57cec5SDimitry Andric                          Defs<[DSPCCond]>;
10040b57cec5SDimitry Andric
10050b57cec5SDimitry Andricclass CMPGDU_LE_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgdu.le.qb",
10060b57cec5SDimitry Andric                                                 int_mips_cmpgdu_le_qb,
10070b57cec5SDimitry Andric                                                 NoItinerary, GPR32Opnd, DSPROpnd>,
10080b57cec5SDimitry Andric                          Defs<[DSPCCond]>;
10090b57cec5SDimitry Andric
10100b57cec5SDimitry Andric// Absolute
10110b57cec5SDimitry Andricclass ABSQ_S_QB_DESC : ABSQ_S_PH_R2_DESC_BASE<"absq_s.qb", int_mips_absq_s_qb,
10120b57cec5SDimitry Andric                                              NoItinerary, DSPROpnd>,
10130b57cec5SDimitry Andric                       Defs<[DSPOutFlag20]>;
10140b57cec5SDimitry Andric
10150b57cec5SDimitry Andric// Multiplication
10160b57cec5SDimitry Andricclass MUL_PH_DESC : ADDUH_QB_DESC_BASE<"mul.ph", null_frag, NoItinerary,
10170b57cec5SDimitry Andric                                       DSPROpnd>, IsCommutable,
10180b57cec5SDimitry Andric                    Defs<[DSPOutFlag21]>;
10190b57cec5SDimitry Andric
10200b57cec5SDimitry Andricclass MUL_S_PH_DESC : ADDUH_QB_DESC_BASE<"mul_s.ph", int_mips_mul_s_ph,
10210b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd>, IsCommutable,
10220b57cec5SDimitry Andric                      Defs<[DSPOutFlag21]>;
10230b57cec5SDimitry Andric
10240b57cec5SDimitry Andricclass MULQ_S_W_DESC : ADDUH_QB_DESC_BASE<"mulq_s.w", int_mips_mulq_s_w,
10250b57cec5SDimitry Andric                                         NoItinerary, GPR32Opnd>, IsCommutable,
10260b57cec5SDimitry Andric                      Defs<[DSPOutFlag21]>;
10270b57cec5SDimitry Andric
10280b57cec5SDimitry Andricclass MULQ_RS_W_DESC : ADDUH_QB_DESC_BASE<"mulq_rs.w", int_mips_mulq_rs_w,
10290b57cec5SDimitry Andric                                          NoItinerary, GPR32Opnd>, IsCommutable,
10300b57cec5SDimitry Andric                       Defs<[DSPOutFlag21]>;
10310b57cec5SDimitry Andric
10320b57cec5SDimitry Andricclass MULQ_S_PH_DESC : ADDU_QB_DESC_BASE<"mulq_s.ph", int_mips_mulq_s_ph,
10330b57cec5SDimitry Andric                                         NoItinerary, DSPROpnd, DSPROpnd>,
10340b57cec5SDimitry Andric                       IsCommutable, Defs<[DSPOutFlag21]>;
10350b57cec5SDimitry Andric
10360b57cec5SDimitry Andric// Dot product with accumulate/subtract
10370b57cec5SDimitry Andricclass DPA_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpa.w.ph", MipsDPA_W_PH>;
10380b57cec5SDimitry Andric
10390b57cec5SDimitry Andricclass DPS_W_PH_DESC : DPA_W_PH_DESC_BASE<"dps.w.ph", MipsDPS_W_PH>;
10400b57cec5SDimitry Andric
10410b57cec5SDimitry Andricclass DPAQX_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpaqx_s.w.ph", MipsDPAQX_S_W_PH>,
10420b57cec5SDimitry Andric                          Defs<[DSPOutFlag16_19]>;
10430b57cec5SDimitry Andric
10440b57cec5SDimitry Andricclass DPAQX_SA_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpaqx_sa.w.ph",
10450b57cec5SDimitry Andric                                              MipsDPAQX_SA_W_PH>,
10460b57cec5SDimitry Andric                           Defs<[DSPOutFlag16_19]>;
10470b57cec5SDimitry Andric
10480b57cec5SDimitry Andricclass DPAX_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpax.w.ph", MipsDPAX_W_PH>;
10490b57cec5SDimitry Andric
10500b57cec5SDimitry Andricclass DPSX_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsx.w.ph", MipsDPSX_W_PH>;
10510b57cec5SDimitry Andric
10520b57cec5SDimitry Andricclass DPSQX_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsqx_s.w.ph", MipsDPSQX_S_W_PH>,
10530b57cec5SDimitry Andric                          Defs<[DSPOutFlag16_19]>;
10540b57cec5SDimitry Andric
10550b57cec5SDimitry Andricclass DPSQX_SA_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsqx_sa.w.ph",
10560b57cec5SDimitry Andric                                              MipsDPSQX_SA_W_PH>,
10570b57cec5SDimitry Andric                           Defs<[DSPOutFlag16_19]>;
10580b57cec5SDimitry Andric
10590b57cec5SDimitry Andricclass MULSA_W_PH_DESC : DPA_W_PH_DESC_BASE<"mulsa.w.ph", MipsMULSA_W_PH>;
10600b57cec5SDimitry Andric
10610b57cec5SDimitry Andric// Precision reduce/expand
10620b57cec5SDimitry Andricclass PRECR_QB_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"precr.qb.ph",
10630b57cec5SDimitry Andric                                                int_mips_precr_qb_ph,
10640b57cec5SDimitry Andric                                                NoItinerary, DSPROpnd, DSPROpnd>;
10650b57cec5SDimitry Andric
10660b57cec5SDimitry Andricclass PRECR_SRA_PH_W_DESC : PRECR_SRA_PH_W_DESC_BASE<"precr_sra.ph.w",
10670b57cec5SDimitry Andric                                                     int_mips_precr_sra_ph_w,
10680b57cec5SDimitry Andric                                                     NoItinerary, DSPROpnd,
10690b57cec5SDimitry Andric                                                     GPR32Opnd>;
10700b57cec5SDimitry Andric
10710b57cec5SDimitry Andricclass PRECR_SRA_R_PH_W_DESC : PRECR_SRA_PH_W_DESC_BASE<"precr_sra_r.ph.w",
10720b57cec5SDimitry Andric                                                      int_mips_precr_sra_r_ph_w,
10730b57cec5SDimitry Andric                                                       NoItinerary, DSPROpnd,
10740b57cec5SDimitry Andric                                                       GPR32Opnd>;
10750b57cec5SDimitry Andric
10760b57cec5SDimitry Andric// Shift
10770b57cec5SDimitry Andricclass SHRA_QB_DESC : SHLL_QB_R2_DESC_BASE<"shra.qb", null_frag, immZExt3,
10780b57cec5SDimitry Andric                                          NoItinerary, DSPROpnd, uimm3>;
10790b57cec5SDimitry Andric
10800b57cec5SDimitry Andricclass SHRAV_QB_DESC : SHLL_QB_R3_DESC_BASE<"shrav.qb", int_mips_shra_qb,
10810b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>;
10820b57cec5SDimitry Andric
10830b57cec5SDimitry Andricclass SHRA_R_QB_DESC : SHLL_QB_R2_DESC_BASE<"shra_r.qb", int_mips_shra_r_qb,
10840b57cec5SDimitry Andric                                            immZExt3, NoItinerary, DSPROpnd,
10850b57cec5SDimitry Andric                                            uimm3>;
10860b57cec5SDimitry Andric
10870b57cec5SDimitry Andricclass SHRAV_R_QB_DESC : SHLL_QB_R3_DESC_BASE<"shrav_r.qb", int_mips_shra_r_qb,
10880b57cec5SDimitry Andric                                             NoItinerary, DSPROpnd>;
10890b57cec5SDimitry Andric
10900b57cec5SDimitry Andricclass SHRL_PH_DESC : SHLL_QB_R2_DESC_BASE<"shrl.ph", null_frag, immZExt4,
10910b57cec5SDimitry Andric                                          NoItinerary, DSPROpnd, uimm4>;
10920b57cec5SDimitry Andric
10930b57cec5SDimitry Andricclass SHRLV_PH_DESC : SHLL_QB_R3_DESC_BASE<"shrlv.ph", int_mips_shrl_ph,
10940b57cec5SDimitry Andric                                           NoItinerary, DSPROpnd>;
10950b57cec5SDimitry Andric
10960b57cec5SDimitry Andric// Misc
10978bcb0991SDimitry Andricclass APPEND_DESC : APPEND_DESC_BASE<"append", int_mips_append, uimm5, timmZExt5,
10980b57cec5SDimitry Andric                                     NoItinerary>;
10990b57cec5SDimitry Andric
11008bcb0991SDimitry Andricclass BALIGN_DESC : APPEND_DESC_BASE<"balign", int_mips_balign, uimm2, timmZExt2,
11010b57cec5SDimitry Andric                                     NoItinerary>;
11020b57cec5SDimitry Andric
11030b57cec5SDimitry Andricclass PREPEND_DESC : APPEND_DESC_BASE<"prepend", int_mips_prepend, uimm5,
11048bcb0991SDimitry Andric                                      timmZExt5, NoItinerary>;
11050b57cec5SDimitry Andric
11060b57cec5SDimitry Andric// Pseudos.
1107*349cc55cSDimitry Andricdef BPOSGE32_PSEUDO : BPOSGE32_PSEUDO_DESC_BASE<int_mips_bposge32>,
1108*349cc55cSDimitry Andric                      Uses<[DSPPos]>;
11090b57cec5SDimitry Andric
11100b57cec5SDimitry Andric// Instruction defs.
11110b57cec5SDimitry Andric// MIPS DSP Rev 1
11120b57cec5SDimitry Andricdef ADDU_QB : DspMMRel, ADDU_QB_ENC, ADDU_QB_DESC;
11130b57cec5SDimitry Andricdef ADDU_S_QB : DspMMRel, ADDU_S_QB_ENC, ADDU_S_QB_DESC;
11140b57cec5SDimitry Andricdef SUBU_QB : DspMMRel, SUBU_QB_ENC, SUBU_QB_DESC;
11150b57cec5SDimitry Andricdef SUBU_S_QB : DspMMRel, SUBU_S_QB_ENC, SUBU_S_QB_DESC;
11160b57cec5SDimitry Andricdef ADDQ_PH : DspMMRel, ADDQ_PH_ENC, ADDQ_PH_DESC;
11170b57cec5SDimitry Andricdef ADDQ_S_PH : DspMMRel, ADDQ_S_PH_ENC, ADDQ_S_PH_DESC;
11180b57cec5SDimitry Andricdef SUBQ_PH : DspMMRel, SUBQ_PH_ENC, SUBQ_PH_DESC;
11190b57cec5SDimitry Andricdef SUBQ_S_PH : DspMMRel, SUBQ_S_PH_ENC, SUBQ_S_PH_DESC;
11200b57cec5SDimitry Andricdef ADDQ_S_W : DspMMRel, ADDQ_S_W_ENC, ADDQ_S_W_DESC;
11210b57cec5SDimitry Andricdef SUBQ_S_W : DspMMRel, SUBQ_S_W_ENC, SUBQ_S_W_DESC;
11220b57cec5SDimitry Andricdef ADDSC : DspMMRel, ADDSC_ENC, ADDSC_DESC;
11230b57cec5SDimitry Andricdef ADDWC : DspMMRel, ADDWC_ENC, ADDWC_DESC;
11240b57cec5SDimitry Andricdef MODSUB : DspMMRel, MODSUB_ENC, MODSUB_DESC;
11250b57cec5SDimitry Andricdef RADDU_W_QB : DspMMRel, RADDU_W_QB_ENC, RADDU_W_QB_DESC;
11260b57cec5SDimitry Andricdef ABSQ_S_PH : DspMMRel, ABSQ_S_PH_ENC, ABSQ_S_PH_DESC;
11270b57cec5SDimitry Andricdef ABSQ_S_W : DspMMRel, ABSQ_S_W_ENC, ABSQ_S_W_DESC;
11280b57cec5SDimitry Andricdef PRECRQ_QB_PH : DspMMRel, PRECRQ_QB_PH_ENC, PRECRQ_QB_PH_DESC;
11290b57cec5SDimitry Andricdef PRECRQ_PH_W : DspMMRel, PRECRQ_PH_W_ENC, PRECRQ_PH_W_DESC;
11300b57cec5SDimitry Andricdef PRECRQ_RS_PH_W : DspMMRel, PRECRQ_RS_PH_W_ENC, PRECRQ_RS_PH_W_DESC;
11310b57cec5SDimitry Andricdef PRECRQU_S_QB_PH : DspMMRel, PRECRQU_S_QB_PH_ENC, PRECRQU_S_QB_PH_DESC;
11320b57cec5SDimitry Andricdef PRECEQ_W_PHL : DspMMRel, PRECEQ_W_PHL_ENC, PRECEQ_W_PHL_DESC;
11330b57cec5SDimitry Andricdef PRECEQ_W_PHR : DspMMRel, PRECEQ_W_PHR_ENC, PRECEQ_W_PHR_DESC;
11340b57cec5SDimitry Andricdef PRECEQU_PH_QBL : DspMMRel, PRECEQU_PH_QBL_ENC, PRECEQU_PH_QBL_DESC;
11350b57cec5SDimitry Andricdef PRECEQU_PH_QBR : DspMMRel, PRECEQU_PH_QBR_ENC, PRECEQU_PH_QBR_DESC;
11360b57cec5SDimitry Andricdef PRECEQU_PH_QBLA : DspMMRel, PRECEQU_PH_QBLA_ENC, PRECEQU_PH_QBLA_DESC;
11370b57cec5SDimitry Andricdef PRECEQU_PH_QBRA : DspMMRel, PRECEQU_PH_QBRA_ENC, PRECEQU_PH_QBRA_DESC;
11380b57cec5SDimitry Andricdef PRECEU_PH_QBL : DspMMRel, PRECEU_PH_QBL_ENC, PRECEU_PH_QBL_DESC;
11390b57cec5SDimitry Andricdef PRECEU_PH_QBR : DspMMRel, PRECEU_PH_QBR_ENC, PRECEU_PH_QBR_DESC;
11400b57cec5SDimitry Andricdef PRECEU_PH_QBLA : DspMMRel, PRECEU_PH_QBLA_ENC, PRECEU_PH_QBLA_DESC;
11410b57cec5SDimitry Andricdef PRECEU_PH_QBRA : DspMMRel, PRECEU_PH_QBRA_ENC, PRECEU_PH_QBRA_DESC;
11420b57cec5SDimitry Andricdef SHLL_QB : DspMMRel, SHLL_QB_ENC, SHLL_QB_DESC;
11430b57cec5SDimitry Andricdef SHLLV_QB : DspMMRel, SHLLV_QB_ENC, SHLLV_QB_DESC;
11440b57cec5SDimitry Andricdef SHRL_QB : DspMMRel, SHRL_QB_ENC, SHRL_QB_DESC;
11450b57cec5SDimitry Andricdef SHRLV_QB : DspMMRel, SHRLV_QB_ENC, SHRLV_QB_DESC;
11460b57cec5SDimitry Andricdef SHLL_PH : DspMMRel, SHLL_PH_ENC, SHLL_PH_DESC;
11470b57cec5SDimitry Andricdef SHLLV_PH : DspMMRel, SHLLV_PH_ENC, SHLLV_PH_DESC;
11480b57cec5SDimitry Andricdef SHLL_S_PH : DspMMRel, SHLL_S_PH_ENC, SHLL_S_PH_DESC;
11490b57cec5SDimitry Andricdef SHLLV_S_PH : DspMMRel, SHLLV_S_PH_ENC, SHLLV_S_PH_DESC;
11500b57cec5SDimitry Andricdef SHRA_PH : DspMMRel, SHRA_PH_ENC, SHRA_PH_DESC;
11510b57cec5SDimitry Andricdef SHRAV_PH : DspMMRel, SHRAV_PH_ENC, SHRAV_PH_DESC;
11520b57cec5SDimitry Andricdef SHRA_R_PH : DspMMRel, SHRA_R_PH_ENC, SHRA_R_PH_DESC;
11530b57cec5SDimitry Andricdef SHRAV_R_PH : DspMMRel, SHRAV_R_PH_ENC, SHRAV_R_PH_DESC;
11540b57cec5SDimitry Andricdef SHLL_S_W : DspMMRel, SHLL_S_W_ENC, SHLL_S_W_DESC;
11550b57cec5SDimitry Andricdef SHLLV_S_W : DspMMRel, SHLLV_S_W_ENC, SHLLV_S_W_DESC;
11560b57cec5SDimitry Andricdef SHRA_R_W : DspMMRel, SHRA_R_W_ENC, SHRA_R_W_DESC;
11570b57cec5SDimitry Andricdef SHRAV_R_W : DspMMRel, SHRAV_R_W_ENC, SHRAV_R_W_DESC;
11580b57cec5SDimitry Andricdef MULEU_S_PH_QBL : DspMMRel, MULEU_S_PH_QBL_ENC, MULEU_S_PH_QBL_DESC;
11590b57cec5SDimitry Andricdef MULEU_S_PH_QBR : DspMMRel, MULEU_S_PH_QBR_ENC, MULEU_S_PH_QBR_DESC;
11600b57cec5SDimitry Andricdef MULEQ_S_W_PHL : DspMMRel, MULEQ_S_W_PHL_ENC, MULEQ_S_W_PHL_DESC;
11610b57cec5SDimitry Andricdef MULEQ_S_W_PHR : DspMMRel, MULEQ_S_W_PHR_ENC, MULEQ_S_W_PHR_DESC;
11620b57cec5SDimitry Andricdef MULQ_RS_PH : DspMMRel, MULQ_RS_PH_ENC, MULQ_RS_PH_DESC;
11630b57cec5SDimitry Andricdef MULSAQ_S_W_PH : DspMMRel, MULSAQ_S_W_PH_ENC, MULSAQ_S_W_PH_DESC;
11640b57cec5SDimitry Andricdef MAQ_S_W_PHL : DspMMRel, MAQ_S_W_PHL_ENC, MAQ_S_W_PHL_DESC;
11650b57cec5SDimitry Andricdef MAQ_S_W_PHR : DspMMRel, MAQ_S_W_PHR_ENC, MAQ_S_W_PHR_DESC;
11660b57cec5SDimitry Andricdef MAQ_SA_W_PHL : DspMMRel, MAQ_SA_W_PHL_ENC, MAQ_SA_W_PHL_DESC;
11670b57cec5SDimitry Andricdef MAQ_SA_W_PHR : DspMMRel, MAQ_SA_W_PHR_ENC, MAQ_SA_W_PHR_DESC;
11680b57cec5SDimitry Andricdef MFHI_DSP : DspMMRel, MFHI_ENC, MFHI_DESC;
11690b57cec5SDimitry Andricdef MFLO_DSP : DspMMRel, MFLO_ENC, MFLO_DESC;
11700b57cec5SDimitry Andricdef MTHI_DSP : DspMMRel, MTHI_ENC, MTHI_DESC;
11710b57cec5SDimitry Andricdef MTLO_DSP : DspMMRel, MTLO_ENC, MTLO_DESC;
11720b57cec5SDimitry Andricdef DPAU_H_QBL : DspMMRel, DPAU_H_QBL_ENC, DPAU_H_QBL_DESC;
11730b57cec5SDimitry Andricdef DPAU_H_QBR : DspMMRel, DPAU_H_QBR_ENC, DPAU_H_QBR_DESC;
11740b57cec5SDimitry Andricdef DPSU_H_QBL : DspMMRel, DPSU_H_QBL_ENC, DPSU_H_QBL_DESC;
11750b57cec5SDimitry Andricdef DPSU_H_QBR : DspMMRel, DPSU_H_QBR_ENC, DPSU_H_QBR_DESC;
11760b57cec5SDimitry Andricdef DPAQ_S_W_PH : DspMMRel, DPAQ_S_W_PH_ENC, DPAQ_S_W_PH_DESC;
11770b57cec5SDimitry Andricdef DPSQ_S_W_PH : DspMMRel, DPSQ_S_W_PH_ENC, DPSQ_S_W_PH_DESC;
11780b57cec5SDimitry Andricdef DPAQ_SA_L_W : DspMMRel, DPAQ_SA_L_W_ENC, DPAQ_SA_L_W_DESC;
11790b57cec5SDimitry Andricdef DPSQ_SA_L_W : DspMMRel, DPSQ_SA_L_W_ENC, DPSQ_SA_L_W_DESC;
11800b57cec5SDimitry Andricdef MULT_DSP : DspMMRel, MULT_DSP_ENC, MULT_DSP_DESC;
11810b57cec5SDimitry Andricdef MULTU_DSP : DspMMRel, MULTU_DSP_ENC, MULTU_DSP_DESC;
11820b57cec5SDimitry Andricdef MADD_DSP : DspMMRel, MADD_DSP_ENC, MADD_DSP_DESC;
11830b57cec5SDimitry Andricdef MADDU_DSP : DspMMRel, MADDU_DSP_ENC, MADDU_DSP_DESC;
11840b57cec5SDimitry Andricdef MSUB_DSP : DspMMRel, MSUB_DSP_ENC, MSUB_DSP_DESC;
11850b57cec5SDimitry Andricdef MSUBU_DSP : DspMMRel, MSUBU_DSP_ENC, MSUBU_DSP_DESC;
11860b57cec5SDimitry Andricdef CMPU_EQ_QB : DspMMRel, CMPU_EQ_QB_ENC, CMPU_EQ_QB_DESC;
11870b57cec5SDimitry Andricdef CMPU_LT_QB : DspMMRel, CMPU_LT_QB_ENC, CMPU_LT_QB_DESC;
11880b57cec5SDimitry Andricdef CMPU_LE_QB : DspMMRel, CMPU_LE_QB_ENC, CMPU_LE_QB_DESC;
11890b57cec5SDimitry Andricdef CMPGU_EQ_QB : DspMMRel, CMPGU_EQ_QB_ENC, CMPGU_EQ_QB_DESC;
11900b57cec5SDimitry Andricdef CMPGU_LT_QB : DspMMRel, CMPGU_LT_QB_ENC, CMPGU_LT_QB_DESC;
11910b57cec5SDimitry Andricdef CMPGU_LE_QB : DspMMRel, CMPGU_LE_QB_ENC, CMPGU_LE_QB_DESC;
11920b57cec5SDimitry Andricdef CMP_EQ_PH : DspMMRel, CMP_EQ_PH_ENC, CMP_EQ_PH_DESC;
11930b57cec5SDimitry Andricdef CMP_LT_PH : DspMMRel, CMP_LT_PH_ENC, CMP_LT_PH_DESC;
11940b57cec5SDimitry Andricdef CMP_LE_PH : DspMMRel, CMP_LE_PH_ENC, CMP_LE_PH_DESC;
11950b57cec5SDimitry Andricdef BITREV : DspMMRel, BITREV_ENC, BITREV_DESC;
11960b57cec5SDimitry Andricdef PACKRL_PH : DspMMRel, PACKRL_PH_ENC, PACKRL_PH_DESC;
11970b57cec5SDimitry Andricdef REPL_QB : DspMMRel, REPL_QB_ENC, REPL_QB_DESC;
11980b57cec5SDimitry Andricdef REPL_PH : DspMMRel, REPL_PH_ENC, REPL_PH_DESC;
11990b57cec5SDimitry Andricdef REPLV_QB : DspMMRel, REPLV_QB_ENC, REPLV_QB_DESC;
12000b57cec5SDimitry Andricdef REPLV_PH : DspMMRel, REPLV_PH_ENC, REPLV_PH_DESC;
12010b57cec5SDimitry Andricdef PICK_QB : DspMMRel, PICK_QB_ENC, PICK_QB_DESC;
12020b57cec5SDimitry Andricdef PICK_PH : DspMMRel, PICK_PH_ENC, PICK_PH_DESC;
12030b57cec5SDimitry Andricdef LWX : DspMMRel, LWX_ENC, LWX_DESC;
12040b57cec5SDimitry Andricdef LHX : DspMMRel, LHX_ENC, LHX_DESC;
12050b57cec5SDimitry Andricdef LBUX : DspMMRel, LBUX_ENC, LBUX_DESC;
12060b57cec5SDimitry Andriclet AdditionalPredicates = [NotInMicroMips] in {
12070b57cec5SDimitry Andric  def BPOSGE32 : DspMMRel, BPOSGE32_ENC, BPOSGE32_DESC;
12080b57cec5SDimitry Andric}
12090b57cec5SDimitry Andricdef INSV : DspMMRel, INSV_ENC, INSV_DESC;
12100b57cec5SDimitry Andricdef EXTP : DspMMRel, EXTP_ENC, EXTP_DESC;
12110b57cec5SDimitry Andricdef EXTPV : DspMMRel, EXTPV_ENC, EXTPV_DESC;
12120b57cec5SDimitry Andricdef EXTPDP : DspMMRel, EXTPDP_ENC, EXTPDP_DESC;
12130b57cec5SDimitry Andricdef EXTPDPV : DspMMRel, EXTPDPV_ENC, EXTPDPV_DESC;
12140b57cec5SDimitry Andricdef EXTR_W : DspMMRel, EXTR_W_ENC, EXTR_W_DESC;
12150b57cec5SDimitry Andricdef EXTRV_W : DspMMRel, EXTRV_W_ENC, EXTRV_W_DESC;
12160b57cec5SDimitry Andricdef EXTR_R_W : DspMMRel, EXTR_R_W_ENC, EXTR_R_W_DESC;
12170b57cec5SDimitry Andricdef EXTRV_R_W : DspMMRel, EXTRV_R_W_ENC, EXTRV_R_W_DESC;
12180b57cec5SDimitry Andricdef EXTR_RS_W : DspMMRel, EXTR_RS_W_ENC, EXTR_RS_W_DESC;
12190b57cec5SDimitry Andricdef EXTRV_RS_W : DspMMRel, EXTRV_RS_W_ENC, EXTRV_RS_W_DESC;
12200b57cec5SDimitry Andricdef EXTR_S_H : DspMMRel, EXTR_S_H_ENC, EXTR_S_H_DESC;
12210b57cec5SDimitry Andricdef EXTRV_S_H : DspMMRel, EXTRV_S_H_ENC, EXTRV_S_H_DESC;
12220b57cec5SDimitry Andricdef SHILO : DspMMRel, SHILO_ENC, SHILO_DESC;
12230b57cec5SDimitry Andricdef SHILOV : DspMMRel, SHILOV_ENC, SHILOV_DESC;
12240b57cec5SDimitry Andricdef MTHLIP : DspMMRel, MTHLIP_ENC, MTHLIP_DESC;
12250b57cec5SDimitry Andricdef RDDSP : DspMMRel, RDDSP_ENC, RDDSP_DESC;
12260b57cec5SDimitry Andriclet AdditionalPredicates = [NotInMicroMips] in {
12270b57cec5SDimitry Andric  def WRDSP : WRDSP_ENC, WRDSP_DESC;
12280b57cec5SDimitry Andric}
12290b57cec5SDimitry Andric
12300b57cec5SDimitry Andric// MIPS DSP Rev 2
12310b57cec5SDimitry Andricdef ADDU_PH : DspMMRel, ADDU_PH_ENC, ADDU_PH_DESC, ISA_DSPR2;
12320b57cec5SDimitry Andricdef ADDU_S_PH : DspMMRel, ADDU_S_PH_ENC, ADDU_S_PH_DESC, ISA_DSPR2;
12330b57cec5SDimitry Andricdef SUBU_PH : DspMMRel, SUBU_PH_ENC, SUBU_PH_DESC, ISA_DSPR2;
12340b57cec5SDimitry Andricdef SUBU_S_PH : DspMMRel, SUBU_S_PH_ENC, SUBU_S_PH_DESC, ISA_DSPR2;
12350b57cec5SDimitry Andricdef CMPGDU_EQ_QB : DspMMRel, CMPGDU_EQ_QB_ENC, CMPGDU_EQ_QB_DESC, ISA_DSPR2;
12360b57cec5SDimitry Andricdef CMPGDU_LT_QB : DspMMRel, CMPGDU_LT_QB_ENC, CMPGDU_LT_QB_DESC, ISA_DSPR2;
12370b57cec5SDimitry Andricdef CMPGDU_LE_QB : DspMMRel, CMPGDU_LE_QB_ENC, CMPGDU_LE_QB_DESC, ISA_DSPR2;
12380b57cec5SDimitry Andricdef ABSQ_S_QB : DspMMRel, ABSQ_S_QB_ENC, ABSQ_S_QB_DESC, ISA_DSPR2;
12390b57cec5SDimitry Andricdef ADDUH_QB : DspMMRel, ADDUH_QB_ENC, ADDUH_QB_DESC, ISA_DSPR2;
12400b57cec5SDimitry Andricdef ADDUH_R_QB : DspMMRel, ADDUH_R_QB_ENC, ADDUH_R_QB_DESC, ISA_DSPR2;
12410b57cec5SDimitry Andricdef SUBUH_QB : DspMMRel, SUBUH_QB_ENC, SUBUH_QB_DESC, ISA_DSPR2;
12420b57cec5SDimitry Andricdef SUBUH_R_QB : DspMMRel, SUBUH_R_QB_ENC, SUBUH_R_QB_DESC, ISA_DSPR2;
12430b57cec5SDimitry Andricdef ADDQH_PH : DspMMRel, ADDQH_PH_ENC, ADDQH_PH_DESC, ISA_DSPR2;
12440b57cec5SDimitry Andricdef ADDQH_R_PH : DspMMRel, ADDQH_R_PH_ENC, ADDQH_R_PH_DESC, ISA_DSPR2;
12450b57cec5SDimitry Andricdef SUBQH_PH : DspMMRel, SUBQH_PH_ENC, SUBQH_PH_DESC, ISA_DSPR2;
12460b57cec5SDimitry Andricdef SUBQH_R_PH : DspMMRel, SUBQH_R_PH_ENC, SUBQH_R_PH_DESC, ISA_DSPR2;
12470b57cec5SDimitry Andricdef ADDQH_W : DspMMRel, ADDQH_W_ENC, ADDQH_W_DESC, ISA_DSPR2;
12480b57cec5SDimitry Andricdef ADDQH_R_W : DspMMRel, ADDQH_R_W_ENC, ADDQH_R_W_DESC, ISA_DSPR2;
12490b57cec5SDimitry Andricdef SUBQH_W : DspMMRel, SUBQH_W_ENC, SUBQH_W_DESC, ISA_DSPR2;
12500b57cec5SDimitry Andricdef SUBQH_R_W : DspMMRel, SUBQH_R_W_ENC, SUBQH_R_W_DESC, ISA_DSPR2;
12510b57cec5SDimitry Andricdef MUL_PH : DspMMRel, MUL_PH_ENC, MUL_PH_DESC, ISA_DSPR2;
12520b57cec5SDimitry Andricdef MUL_S_PH : DspMMRel, MUL_S_PH_ENC, MUL_S_PH_DESC, ISA_DSPR2;
12530b57cec5SDimitry Andricdef MULQ_S_W : DspMMRel, MULQ_S_W_ENC, MULQ_S_W_DESC, ISA_DSPR2;
12540b57cec5SDimitry Andricdef MULQ_RS_W : DspMMRel, MULQ_RS_W_ENC, MULQ_RS_W_DESC, ISA_DSPR2;
12550b57cec5SDimitry Andricdef MULQ_S_PH : DspMMRel, MULQ_S_PH_ENC, MULQ_S_PH_DESC, ISA_DSPR2;
12560b57cec5SDimitry Andricdef DPA_W_PH : DspMMRel, DPA_W_PH_ENC, DPA_W_PH_DESC, ISA_DSPR2;
12570b57cec5SDimitry Andricdef DPS_W_PH : DspMMRel, DPS_W_PH_ENC, DPS_W_PH_DESC, ISA_DSPR2;
12580b57cec5SDimitry Andricdef DPAQX_S_W_PH : DspMMRel, DPAQX_S_W_PH_ENC, DPAQX_S_W_PH_DESC, ISA_DSPR2;
12590b57cec5SDimitry Andricdef DPAQX_SA_W_PH : DspMMRel, DPAQX_SA_W_PH_ENC, DPAQX_SA_W_PH_DESC, ISA_DSPR2;
12600b57cec5SDimitry Andricdef DPAX_W_PH : DspMMRel, DPAX_W_PH_ENC, DPAX_W_PH_DESC, ISA_DSPR2;
12610b57cec5SDimitry Andricdef DPSX_W_PH : DspMMRel, DPSX_W_PH_ENC, DPSX_W_PH_DESC, ISA_DSPR2;
12620b57cec5SDimitry Andricdef DPSQX_S_W_PH : DspMMRel, DPSQX_S_W_PH_ENC, DPSQX_S_W_PH_DESC, ISA_DSPR2;
12630b57cec5SDimitry Andricdef DPSQX_SA_W_PH : DspMMRel, DPSQX_SA_W_PH_ENC, DPSQX_SA_W_PH_DESC, ISA_DSPR2;
12640b57cec5SDimitry Andricdef MULSA_W_PH : DspMMRel, MULSA_W_PH_ENC, MULSA_W_PH_DESC, ISA_DSPR2;
12650b57cec5SDimitry Andricdef PRECR_QB_PH : DspMMRel, PRECR_QB_PH_ENC, PRECR_QB_PH_DESC, ISA_DSPR2;
12660b57cec5SDimitry Andricdef PRECR_SRA_PH_W : DspMMRel, PRECR_SRA_PH_W_ENC, PRECR_SRA_PH_W_DESC, ISA_DSPR2;
12670b57cec5SDimitry Andricdef PRECR_SRA_R_PH_W : DspMMRel, PRECR_SRA_R_PH_W_ENC, PRECR_SRA_R_PH_W_DESC, ISA_DSPR2;
12680b57cec5SDimitry Andricdef SHRA_QB : DspMMRel, SHRA_QB_ENC, SHRA_QB_DESC, ISA_DSPR2;
12690b57cec5SDimitry Andricdef SHRAV_QB : DspMMRel, SHRAV_QB_ENC, SHRAV_QB_DESC, ISA_DSPR2;
12700b57cec5SDimitry Andricdef SHRA_R_QB : DspMMRel, SHRA_R_QB_ENC, SHRA_R_QB_DESC, ISA_DSPR2;
12710b57cec5SDimitry Andricdef SHRAV_R_QB : DspMMRel, SHRAV_R_QB_ENC, SHRAV_R_QB_DESC, ISA_DSPR2;
12720b57cec5SDimitry Andricdef SHRL_PH : DspMMRel, SHRL_PH_ENC, SHRL_PH_DESC, ISA_DSPR2;
12730b57cec5SDimitry Andricdef SHRLV_PH : DspMMRel, SHRLV_PH_ENC, SHRLV_PH_DESC, ISA_DSPR2;
12740b57cec5SDimitry Andricdef APPEND : DspMMRel, APPEND_ENC, APPEND_DESC, ISA_DSPR2;
12750b57cec5SDimitry Andricdef BALIGN : DspMMRel, BALIGN_ENC, BALIGN_DESC, ISA_DSPR2;
12760b57cec5SDimitry Andricdef PREPEND : DspMMRel, PREPEND_ENC, PREPEND_DESC, ISA_DSPR2;
12770b57cec5SDimitry Andric
12780b57cec5SDimitry Andric// Pseudos.
12790b57cec5SDimitry Andriclet isPseudo = 1, isCodeGenOnly = 1, hasNoSchedulingInfo = 1 in {
12800b57cec5SDimitry Andric  // Pseudo instructions for loading and storing accumulator registers.
12810b57cec5SDimitry Andric  def LOAD_ACC64DSP  : Load<"", ACC64DSPOpnd>;
12820b57cec5SDimitry Andric  def STORE_ACC64DSP : Store<"", ACC64DSPOpnd>;
12830b57cec5SDimitry Andric
12840b57cec5SDimitry Andric  // Pseudos for loading and storing ccond field of DSP control register.
12850b57cec5SDimitry Andric  def LOAD_CCOND_DSP  : Load<"load_ccond_dsp", DSPCC>;
12860b57cec5SDimitry Andric  def STORE_CCOND_DSP : Store<"store_ccond_dsp", DSPCC>;
12870b57cec5SDimitry Andric}
12880b57cec5SDimitry Andric
12890b57cec5SDimitry Andriclet DecoderNamespace = "MipsDSP", Arch = "dsp",
12900b57cec5SDimitry Andric    ASEPredicate = [HasDSP] in {
12910b57cec5SDimitry Andric  def LWDSP : Load<"lw", DSPROpnd, null_frag, II_LW>, DspMMRel, LW_FM<0x23>;
12920b57cec5SDimitry Andric  def SWDSP : Store<"sw", DSPROpnd, null_frag, II_SW>, DspMMRel, LW_FM<0x2b>;
12930b57cec5SDimitry Andric}
12940b57cec5SDimitry Andric
12950b57cec5SDimitry Andric// Pseudo CMP and PICK instructions.
12960b57cec5SDimitry Andricclass PseudoCMP<Instruction RealInst> :
12970b57cec5SDimitry Andric  PseudoDSP<(outs DSPCC:$cmp), (ins DSPROpnd:$rs, DSPROpnd:$rt), []>,
1298480093f4SDimitry Andric  PseudoInstExpansion<(RealInst DSPROpnd:$rs, DSPROpnd:$rt)>,
1299480093f4SDimitry Andric  NeverHasSideEffects;
13000b57cec5SDimitry Andric
13010b57cec5SDimitry Andricclass PseudoPICK<Instruction RealInst> :
13020b57cec5SDimitry Andric  PseudoDSP<(outs DSPROpnd:$rd), (ins DSPCC:$cmp, DSPROpnd:$rs, DSPROpnd:$rt), []>,
13030b57cec5SDimitry Andric  PseudoInstExpansion<(RealInst DSPROpnd:$rd, DSPROpnd:$rs, DSPROpnd:$rt)>,
13040b57cec5SDimitry Andric  NeverHasSideEffects;
13050b57cec5SDimitry Andric
13060b57cec5SDimitry Andricdef PseudoCMP_EQ_PH : PseudoCMP<CMP_EQ_PH>;
13070b57cec5SDimitry Andricdef PseudoCMP_LT_PH : PseudoCMP<CMP_LT_PH>;
13080b57cec5SDimitry Andricdef PseudoCMP_LE_PH : PseudoCMP<CMP_LE_PH>;
13090b57cec5SDimitry Andricdef PseudoCMPU_EQ_QB : PseudoCMP<CMPU_EQ_QB>;
13100b57cec5SDimitry Andricdef PseudoCMPU_LT_QB : PseudoCMP<CMPU_LT_QB>;
13110b57cec5SDimitry Andricdef PseudoCMPU_LE_QB : PseudoCMP<CMPU_LE_QB>;
13120b57cec5SDimitry Andric
13130b57cec5SDimitry Andricdef PseudoPICK_PH : PseudoPICK<PICK_PH>;
13140b57cec5SDimitry Andricdef PseudoPICK_QB : PseudoPICK<PICK_QB>;
13150b57cec5SDimitry Andric
13160b57cec5SDimitry Andriclet AdditionalPredicates = [HasDSP] in {
13170b57cec5SDimitry Andric  def PseudoMTLOHI_DSP : PseudoMTLOHI<ACC64DSP, GPR32>;
13180b57cec5SDimitry Andric}
13190b57cec5SDimitry Andric
13200b57cec5SDimitry Andric// Patterns.
13210b57cec5SDimitry Andricclass DSPPat<dag pattern, dag result, Predicate pred = HasDSP> :
13220b57cec5SDimitry Andric  Pat<pattern, result>, Requires<[pred]>;
13230b57cec5SDimitry Andric
13240b57cec5SDimitry Andricclass BitconvertPat<ValueType DstVT, ValueType SrcVT, RegisterClass DstRC,
13250b57cec5SDimitry Andric                    RegisterClass SrcRC> :
13260b57cec5SDimitry Andric   DSPPat<(DstVT (bitconvert (SrcVT SrcRC:$src))),
13270b57cec5SDimitry Andric          (COPY_TO_REGCLASS SrcRC:$src, DstRC)>;
13280b57cec5SDimitry Andric
13290b57cec5SDimitry Andricdef : BitconvertPat<i32, v2i16, GPR32, DSPR>;
13300b57cec5SDimitry Andricdef : BitconvertPat<i32, v4i8, GPR32, DSPR>;
13310b57cec5SDimitry Andricdef : BitconvertPat<v2i16, i32, DSPR, GPR32>;
13320b57cec5SDimitry Andricdef : BitconvertPat<v4i8, i32, DSPR, GPR32>;
13330b57cec5SDimitry Andricdef : BitconvertPat<f32, v2i16, FGR32, DSPR>;
13340b57cec5SDimitry Andricdef : BitconvertPat<f32, v4i8, FGR32, DSPR>;
13350b57cec5SDimitry Andricdef : BitconvertPat<v2i16, f32, DSPR, FGR32>;
13360b57cec5SDimitry Andricdef : BitconvertPat<v4i8, f32, DSPR, FGR32>;
13370b57cec5SDimitry Andric
13380b57cec5SDimitry Andricdef : DSPPat<(v2i16 (load addr:$a)),
13390b57cec5SDimitry Andric             (v2i16 (COPY_TO_REGCLASS (LW addr:$a), DSPR))>;
13400b57cec5SDimitry Andricdef : DSPPat<(v4i8 (load addr:$a)),
13410b57cec5SDimitry Andric             (v4i8 (COPY_TO_REGCLASS (LW addr:$a), DSPR))>;
13420b57cec5SDimitry Andricdef : DSPPat<(store (v2i16 DSPR:$val), addr:$a),
13430b57cec5SDimitry Andric             (SW (COPY_TO_REGCLASS DSPR:$val, GPR32), addr:$a)>;
13440b57cec5SDimitry Andricdef : DSPPat<(store (v4i8 DSPR:$val), addr:$a),
13450b57cec5SDimitry Andric             (SW (COPY_TO_REGCLASS DSPR:$val, GPR32), addr:$a)>;
13460b57cec5SDimitry Andric
13470b57cec5SDimitry Andric// Binary operations.
13480b57cec5SDimitry Andricclass DSPBinPat<Instruction Inst, ValueType ValTy, SDPatternOperator Node,
13490b57cec5SDimitry Andric                Predicate Pred = HasDSP> :
13500b57cec5SDimitry Andric  DSPPat<(Node ValTy:$a, ValTy:$b), (Inst ValTy:$a, ValTy:$b), Pred>;
13510b57cec5SDimitry Andric
13520b57cec5SDimitry Andricdef : DSPBinPat<ADDQ_PH, v2i16, int_mips_addq_ph>;
13530b57cec5SDimitry Andricdef : DSPBinPat<ADDQ_PH, v2i16, add>;
13540b57cec5SDimitry Andricdef : DSPBinPat<SUBQ_PH, v2i16, int_mips_subq_ph>;
13550b57cec5SDimitry Andricdef : DSPBinPat<SUBQ_PH, v2i16, sub>;
13560b57cec5SDimitry Andricdef : DSPBinPat<MUL_PH, v2i16, int_mips_mul_ph, HasDSPR2>;
13570b57cec5SDimitry Andricdef : DSPBinPat<MUL_PH, v2i16, mul, HasDSPR2>;
13580b57cec5SDimitry Andricdef : DSPBinPat<ADDU_QB, v4i8, int_mips_addu_qb>;
13590b57cec5SDimitry Andricdef : DSPBinPat<ADDU_QB, v4i8, add>;
13600b57cec5SDimitry Andricdef : DSPBinPat<SUBU_QB, v4i8, int_mips_subu_qb>;
13610b57cec5SDimitry Andricdef : DSPBinPat<SUBU_QB, v4i8, sub>;
13620b57cec5SDimitry Andricdef : DSPBinPat<ADDSC, i32, int_mips_addsc>;
13630b57cec5SDimitry Andricdef : DSPBinPat<ADDSC, i32, addc>;
13640b57cec5SDimitry Andricdef : DSPBinPat<ADDWC, i32, int_mips_addwc>;
13650b57cec5SDimitry Andricdef : DSPBinPat<ADDWC, i32, adde>;
13660b57cec5SDimitry Andric
13670b57cec5SDimitry Andric// Shift immediate patterns.
13680b57cec5SDimitry Andricclass DSPShiftPat<Instruction Inst, ValueType ValTy, SDPatternOperator Node,
13690b57cec5SDimitry Andric                  SDPatternOperator Imm, Predicate Pred = HasDSP> :
13700b57cec5SDimitry Andric  DSPPat<(Node ValTy:$a, Imm:$shamt), (Inst ValTy:$a, Imm:$shamt), Pred>;
13710b57cec5SDimitry Andric
13720b57cec5SDimitry Andricdef : DSPShiftPat<SHLL_PH, v2i16, MipsSHLL_DSP, imm>;
13730b57cec5SDimitry Andricdef : DSPShiftPat<SHRA_PH, v2i16, MipsSHRA_DSP, imm>;
13740b57cec5SDimitry Andricdef : DSPShiftPat<SHRL_PH, v2i16, MipsSHRL_DSP, imm, HasDSPR2>;
13750b57cec5SDimitry Andricdef : DSPShiftPat<SHLL_PH, v2i16, int_mips_shll_ph, immZExt4>;
13760b57cec5SDimitry Andricdef : DSPShiftPat<SHRA_PH, v2i16, int_mips_shra_ph, immZExt4>;
13770b57cec5SDimitry Andricdef : DSPShiftPat<SHRL_PH, v2i16, int_mips_shrl_ph, immZExt4, HasDSPR2>;
13780b57cec5SDimitry Andricdef : DSPShiftPat<SHLL_QB, v4i8, MipsSHLL_DSP, imm>;
13790b57cec5SDimitry Andricdef : DSPShiftPat<SHRA_QB, v4i8, MipsSHRA_DSP, imm, HasDSPR2>;
13800b57cec5SDimitry Andricdef : DSPShiftPat<SHRL_QB, v4i8, MipsSHRL_DSP, imm>;
13810b57cec5SDimitry Andricdef : DSPShiftPat<SHLL_QB, v4i8, int_mips_shll_qb, immZExt3>;
13820b57cec5SDimitry Andricdef : DSPShiftPat<SHRA_QB, v4i8, int_mips_shra_qb, immZExt3, HasDSPR2>;
13830b57cec5SDimitry Andricdef : DSPShiftPat<SHRL_QB, v4i8, int_mips_shrl_qb, immZExt3>;
13840b57cec5SDimitry Andric
13850b57cec5SDimitry Andric// SETCC/SELECT_CC patterns.
13860b57cec5SDimitry Andricclass DSPSetCCPat<Instruction Cmp, Instruction Pick, ValueType ValTy,
13870b57cec5SDimitry Andric                  CondCode CC> :
13880b57cec5SDimitry Andric  DSPPat<(ValTy (MipsSETCC_DSP ValTy:$a, ValTy:$b, CC)),
13890b57cec5SDimitry Andric         (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)),
13900b57cec5SDimitry Andric                      (ValTy (COPY_TO_REGCLASS (ADDiu ZERO, -1), DSPR)),
13910b57cec5SDimitry Andric                      (ValTy ZERO)))>;
13920b57cec5SDimitry Andric
13930b57cec5SDimitry Andricclass DSPSetCCPatInv<Instruction Cmp, Instruction Pick, ValueType ValTy,
13940b57cec5SDimitry Andric                     CondCode CC> :
13950b57cec5SDimitry Andric  DSPPat<(ValTy (MipsSETCC_DSP ValTy:$a, ValTy:$b, CC)),
13960b57cec5SDimitry Andric         (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)),
13970b57cec5SDimitry Andric                      (ValTy ZERO),
13980b57cec5SDimitry Andric                      (ValTy (COPY_TO_REGCLASS (ADDiu ZERO, -1), DSPR))))>;
13990b57cec5SDimitry Andric
14000b57cec5SDimitry Andricclass DSPSelectCCPat<Instruction Cmp, Instruction Pick, ValueType ValTy,
14010b57cec5SDimitry Andric                     CondCode CC> :
14020b57cec5SDimitry Andric  DSPPat<(ValTy (MipsSELECT_CC_DSP ValTy:$a, ValTy:$b, ValTy:$c, ValTy:$d, CC)),
14030b57cec5SDimitry Andric         (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)), $c, $d))>;
14040b57cec5SDimitry Andric
14050b57cec5SDimitry Andricclass DSPSelectCCPatInv<Instruction Cmp, Instruction Pick, ValueType ValTy,
14060b57cec5SDimitry Andric                        CondCode CC> :
14070b57cec5SDimitry Andric  DSPPat<(ValTy (MipsSELECT_CC_DSP ValTy:$a, ValTy:$b, ValTy:$c, ValTy:$d, CC)),
14080b57cec5SDimitry Andric         (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)), $d, $c))>;
14090b57cec5SDimitry Andric
14100b57cec5SDimitry Andricdef : DSPSetCCPat<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETEQ>;
14110b57cec5SDimitry Andricdef : DSPSetCCPat<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETLT>;
14120b57cec5SDimitry Andricdef : DSPSetCCPat<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETLE>;
14130b57cec5SDimitry Andricdef : DSPSetCCPatInv<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETNE>;
14140b57cec5SDimitry Andricdef : DSPSetCCPatInv<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETGE>;
14150b57cec5SDimitry Andricdef : DSPSetCCPatInv<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETGT>;
14160b57cec5SDimitry Andricdef : DSPSetCCPat<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETEQ>;
14170b57cec5SDimitry Andricdef : DSPSetCCPat<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETULT>;
14180b57cec5SDimitry Andricdef : DSPSetCCPat<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETULE>;
14190b57cec5SDimitry Andricdef : DSPSetCCPatInv<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETNE>;
14200b57cec5SDimitry Andricdef : DSPSetCCPatInv<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETUGE>;
14210b57cec5SDimitry Andricdef : DSPSetCCPatInv<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETUGT>;
14220b57cec5SDimitry Andric
14230b57cec5SDimitry Andricdef : DSPSelectCCPat<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETEQ>;
14240b57cec5SDimitry Andricdef : DSPSelectCCPat<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETLT>;
14250b57cec5SDimitry Andricdef : DSPSelectCCPat<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETLE>;
14260b57cec5SDimitry Andricdef : DSPSelectCCPatInv<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETNE>;
14270b57cec5SDimitry Andricdef : DSPSelectCCPatInv<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETGE>;
14280b57cec5SDimitry Andricdef : DSPSelectCCPatInv<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETGT>;
14290b57cec5SDimitry Andricdef : DSPSelectCCPat<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETEQ>;
14300b57cec5SDimitry Andricdef : DSPSelectCCPat<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETULT>;
14310b57cec5SDimitry Andricdef : DSPSelectCCPat<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETULE>;
14320b57cec5SDimitry Andricdef : DSPSelectCCPatInv<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETNE>;
14330b57cec5SDimitry Andricdef : DSPSelectCCPatInv<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETUGE>;
14340b57cec5SDimitry Andricdef : DSPSelectCCPatInv<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETUGT>;
14350b57cec5SDimitry Andric
14360b57cec5SDimitry Andric// Extr patterns.
14370b57cec5SDimitry Andricclass EXTR_W_TY1_R2_Pat<SDPatternOperator OpNode, Instruction Instr> :
14380b57cec5SDimitry Andric  DSPPat<(i32 (OpNode GPR32:$rs, ACC64DSP:$ac)),
14390b57cec5SDimitry Andric         (Instr ACC64DSP:$ac, GPR32:$rs)>;
14400b57cec5SDimitry Andric
14410b57cec5SDimitry Andricclass EXTR_W_TY1_R1_Pat<SDPatternOperator OpNode, Instruction Instr> :
14420b57cec5SDimitry Andric  DSPPat<(i32 (OpNode immZExt5:$shift, ACC64DSP:$ac)),
14430b57cec5SDimitry Andric         (Instr ACC64DSP:$ac, immZExt5:$shift)>;
14440b57cec5SDimitry Andric
14450b57cec5SDimitry Andricdef : EXTR_W_TY1_R1_Pat<MipsEXTP, EXTP>;
14460b57cec5SDimitry Andricdef : EXTR_W_TY1_R2_Pat<MipsEXTP, EXTPV>;
14470b57cec5SDimitry Andricdef : EXTR_W_TY1_R1_Pat<MipsEXTPDP, EXTPDP>;
14480b57cec5SDimitry Andricdef : EXTR_W_TY1_R2_Pat<MipsEXTPDP, EXTPDPV>;
14490b57cec5SDimitry Andricdef : EXTR_W_TY1_R1_Pat<MipsEXTR_W, EXTR_W>;
14500b57cec5SDimitry Andricdef : EXTR_W_TY1_R2_Pat<MipsEXTR_W, EXTRV_W>;
14510b57cec5SDimitry Andricdef : EXTR_W_TY1_R1_Pat<MipsEXTR_R_W, EXTR_R_W>;
14520b57cec5SDimitry Andricdef : EXTR_W_TY1_R2_Pat<MipsEXTR_R_W, EXTRV_R_W>;
14530b57cec5SDimitry Andricdef : EXTR_W_TY1_R1_Pat<MipsEXTR_RS_W, EXTR_RS_W>;
14540b57cec5SDimitry Andricdef : EXTR_W_TY1_R2_Pat<MipsEXTR_RS_W, EXTRV_RS_W>;
14550b57cec5SDimitry Andricdef : EXTR_W_TY1_R1_Pat<MipsEXTR_S_H, EXTR_S_H>;
14560b57cec5SDimitry Andricdef : EXTR_W_TY1_R2_Pat<MipsEXTR_S_H, EXTRV_S_H>;
14570b57cec5SDimitry Andric
14580b57cec5SDimitry Andric// Indexed load patterns.
14590b57cec5SDimitry Andricclass IndexedLoadPat<SDPatternOperator LoadNode, Instruction Instr> :
14600b57cec5SDimitry Andric  DSPPat<(i32 (LoadNode (add i32:$base, i32:$index))),
14610b57cec5SDimitry Andric         (Instr i32:$base, i32:$index)>;
14620b57cec5SDimitry Andric
14630b57cec5SDimitry Andriclet AddedComplexity = 20 in {
14640b57cec5SDimitry Andric  def : IndexedLoadPat<zextloadi8, LBUX>;
14650b57cec5SDimitry Andric  def : IndexedLoadPat<sextloadi16, LHX>;
14660b57cec5SDimitry Andric  def : IndexedLoadPat<load, LWX>;
14670b57cec5SDimitry Andric}
14680b57cec5SDimitry Andric
14690b57cec5SDimitry Andric// Instruction alias.
14700b57cec5SDimitry Andriclet AdditionalPredicates = [NotInMicroMips] in {
14710b57cec5SDimitry Andric  def : DSPInstAlias<"wrdsp $rt", (WRDSP GPR32Opnd:$rt, 0x1F), 1>;
14720b57cec5SDimitry Andric}
1473