1//===- MipsDSPInstrInfo.td - DSP ASE instructions -*- tablegen ------------*-=// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file describes Mips DSP ASE instructions. 11// 12//===----------------------------------------------------------------------===// 13 14// ImmLeaf 15def immZExt1 : ImmLeaf<i32, [{return isUInt<1>(Imm);}]>; 16def immZExt2 : ImmLeaf<i32, [{return isUInt<2>(Imm);}]>; 17def immZExt3 : ImmLeaf<i32, [{return isUInt<3>(Imm);}]>; 18def immZExt4 : ImmLeaf<i32, [{return isUInt<4>(Imm);}]>; 19def immZExt7 : ImmLeaf<i32, [{return isUInt<7>(Imm);}]>; 20def immZExt8 : ImmLeaf<i32, [{return isUInt<8>(Imm);}]>; 21def immZExt10 : ImmLeaf<i32, [{return isUInt<10>(Imm);}]>; 22def immSExt6 : ImmLeaf<i32, [{return isInt<6>(Imm);}]>; 23 24// Mips-specific dsp nodes 25def SDT_MipsExtr : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisSameAs<0, 1>, 26 SDTCisVT<2, untyped>]>; 27def SDT_MipsShilo : SDTypeProfile<1, 2, [SDTCisVT<0, untyped>, 28 SDTCisSameAs<0, 2>, SDTCisVT<1, i32>]>; 29def SDT_MipsDPA : SDTypeProfile<1, 3, [SDTCisVT<0, untyped>, SDTCisSameAs<0, 3>, 30 SDTCisVT<1, i32>, SDTCisSameAs<1, 2>]>; 31def SDT_MipsSHIFT_DSP : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>, 32 SDTCisVT<2, i32>]>; 33 34class MipsDSPBase<string Opc, SDTypeProfile Prof> : 35 SDNode<!strconcat("MipsISD::", Opc), Prof>; 36 37class MipsDSPSideEffectBase<string Opc, SDTypeProfile Prof> : 38 SDNode<!strconcat("MipsISD::", Opc), Prof, [SDNPHasChain, SDNPSideEffect]>; 39 40def MipsEXTP : MipsDSPSideEffectBase<"EXTP", SDT_MipsExtr>; 41def MipsEXTPDP : MipsDSPSideEffectBase<"EXTPDP", SDT_MipsExtr>; 42def MipsEXTR_S_H : MipsDSPSideEffectBase<"EXTR_S_H", SDT_MipsExtr>; 43def MipsEXTR_W : MipsDSPSideEffectBase<"EXTR_W", SDT_MipsExtr>; 44def MipsEXTR_R_W : MipsDSPSideEffectBase<"EXTR_R_W", SDT_MipsExtr>; 45def MipsEXTR_RS_W : MipsDSPSideEffectBase<"EXTR_RS_W", SDT_MipsExtr>; 46 47def MipsSHILO : MipsDSPBase<"SHILO", SDT_MipsShilo>; 48def MipsMTHLIP : MipsDSPSideEffectBase<"MTHLIP", SDT_MipsShilo>; 49 50def MipsMULSAQ_S_W_PH : MipsDSPSideEffectBase<"MULSAQ_S_W_PH", SDT_MipsDPA>; 51def MipsMAQ_S_W_PHL : MipsDSPSideEffectBase<"MAQ_S_W_PHL", SDT_MipsDPA>; 52def MipsMAQ_S_W_PHR : MipsDSPSideEffectBase<"MAQ_S_W_PHR", SDT_MipsDPA>; 53def MipsMAQ_SA_W_PHL : MipsDSPSideEffectBase<"MAQ_SA_W_PHL", SDT_MipsDPA>; 54def MipsMAQ_SA_W_PHR : MipsDSPSideEffectBase<"MAQ_SA_W_PHR", SDT_MipsDPA>; 55 56def MipsDPAU_H_QBL : MipsDSPBase<"DPAU_H_QBL", SDT_MipsDPA>; 57def MipsDPAU_H_QBR : MipsDSPBase<"DPAU_H_QBR", SDT_MipsDPA>; 58def MipsDPSU_H_QBL : MipsDSPBase<"DPSU_H_QBL", SDT_MipsDPA>; 59def MipsDPSU_H_QBR : MipsDSPBase<"DPSU_H_QBR", SDT_MipsDPA>; 60def MipsDPAQ_S_W_PH : MipsDSPSideEffectBase<"DPAQ_S_W_PH", SDT_MipsDPA>; 61def MipsDPSQ_S_W_PH : MipsDSPSideEffectBase<"DPSQ_S_W_PH", SDT_MipsDPA>; 62def MipsDPAQ_SA_L_W : MipsDSPSideEffectBase<"DPAQ_SA_L_W", SDT_MipsDPA>; 63def MipsDPSQ_SA_L_W : MipsDSPSideEffectBase<"DPSQ_SA_L_W", SDT_MipsDPA>; 64 65def MipsDPA_W_PH : MipsDSPBase<"DPA_W_PH", SDT_MipsDPA>; 66def MipsDPS_W_PH : MipsDSPBase<"DPS_W_PH", SDT_MipsDPA>; 67def MipsDPAQX_S_W_PH : MipsDSPSideEffectBase<"DPAQX_S_W_PH", SDT_MipsDPA>; 68def MipsDPAQX_SA_W_PH : MipsDSPSideEffectBase<"DPAQX_SA_W_PH", SDT_MipsDPA>; 69def MipsDPAX_W_PH : MipsDSPBase<"DPAX_W_PH", SDT_MipsDPA>; 70def MipsDPSX_W_PH : MipsDSPBase<"DPSX_W_PH", SDT_MipsDPA>; 71def MipsDPSQX_S_W_PH : MipsDSPSideEffectBase<"DPSQX_S_W_PH", SDT_MipsDPA>; 72def MipsDPSQX_SA_W_PH : MipsDSPSideEffectBase<"DPSQX_SA_W_PH", SDT_MipsDPA>; 73def MipsMULSA_W_PH : MipsDSPBase<"MULSA_W_PH", SDT_MipsDPA>; 74 75def MipsMULT : MipsDSPBase<"MULT", SDT_MipsDPA>; 76def MipsMULTU : MipsDSPBase<"MULTU", SDT_MipsDPA>; 77def MipsMADD_DSP : MipsDSPBase<"MADD_DSP", SDT_MipsDPA>; 78def MipsMADDU_DSP : MipsDSPBase<"MADDU_DSP", SDT_MipsDPA>; 79def MipsMSUB_DSP : MipsDSPBase<"MSUB_DSP", SDT_MipsDPA>; 80def MipsMSUBU_DSP : MipsDSPBase<"MSUBU_DSP", SDT_MipsDPA>; 81def MipsSHLL_DSP : MipsDSPBase<"SHLL_DSP", SDT_MipsSHIFT_DSP>; 82def MipsSHRA_DSP : MipsDSPBase<"SHRA_DSP", SDT_MipsSHIFT_DSP>; 83def MipsSHRL_DSP : MipsDSPBase<"SHRL_DSP", SDT_MipsSHIFT_DSP>; 84def MipsSETCC_DSP : MipsDSPBase<"SETCC_DSP", SDTSetCC>; 85def MipsSELECT_CC_DSP : MipsDSPBase<"SELECT_CC_DSP", SDTSelectCC>; 86 87// Flags. 88class Uses<list<Register> Regs> { 89 list<Register> Uses = Regs; 90} 91 92class Defs<list<Register> Regs> { 93 list<Register> Defs = Regs; 94} 95 96// Instruction encoding. 97class ADDU_QB_ENC : ADDU_QB_FMT<0b00000>; 98class ADDU_S_QB_ENC : ADDU_QB_FMT<0b00100>; 99class SUBU_QB_ENC : ADDU_QB_FMT<0b00001>; 100class SUBU_S_QB_ENC : ADDU_QB_FMT<0b00101>; 101class ADDQ_PH_ENC : ADDU_QB_FMT<0b01010>; 102class ADDQ_S_PH_ENC : ADDU_QB_FMT<0b01110>; 103class SUBQ_PH_ENC : ADDU_QB_FMT<0b01011>; 104class SUBQ_S_PH_ENC : ADDU_QB_FMT<0b01111>; 105class ADDQ_S_W_ENC : ADDU_QB_FMT<0b10110>; 106class SUBQ_S_W_ENC : ADDU_QB_FMT<0b10111>; 107class ADDSC_ENC : ADDU_QB_FMT<0b10000>; 108class ADDWC_ENC : ADDU_QB_FMT<0b10001>; 109class MODSUB_ENC : ADDU_QB_FMT<0b10010>; 110class RADDU_W_QB_ENC : RADDU_W_QB_FMT<0b10100>; 111class ABSQ_S_PH_ENC : ABSQ_S_PH_R2_FMT<0b01001>; 112class ABSQ_S_W_ENC : ABSQ_S_PH_R2_FMT<0b10001>; 113class PRECRQ_QB_PH_ENC : CMP_EQ_QB_R3_FMT<0b01100>; 114class PRECRQ_PH_W_ENC : CMP_EQ_QB_R3_FMT<0b10100>; 115class PRECRQ_RS_PH_W_ENC : CMP_EQ_QB_R3_FMT<0b10101>; 116class PRECRQU_S_QB_PH_ENC : CMP_EQ_QB_R3_FMT<0b01111>; 117class PRECEQ_W_PHL_ENC : ABSQ_S_PH_R2_FMT<0b01100>; 118class PRECEQ_W_PHR_ENC : ABSQ_S_PH_R2_FMT<0b01101>; 119class PRECEQU_PH_QBL_ENC : ABSQ_S_PH_R2_FMT<0b00100>; 120class PRECEQU_PH_QBR_ENC : ABSQ_S_PH_R2_FMT<0b00101>; 121class PRECEQU_PH_QBLA_ENC : ABSQ_S_PH_R2_FMT<0b00110>; 122class PRECEQU_PH_QBRA_ENC : ABSQ_S_PH_R2_FMT<0b00111>; 123class PRECEU_PH_QBL_ENC : ABSQ_S_PH_R2_FMT<0b11100>; 124class PRECEU_PH_QBR_ENC : ABSQ_S_PH_R2_FMT<0b11101>; 125class PRECEU_PH_QBLA_ENC : ABSQ_S_PH_R2_FMT<0b11110>; 126class PRECEU_PH_QBRA_ENC : ABSQ_S_PH_R2_FMT<0b11111>; 127class SHLL_QB_ENC : SHLL_QB_FMT<0b00000>; 128class SHLLV_QB_ENC : SHLL_QB_FMT<0b00010>; 129class SHRL_QB_ENC : SHLL_QB_FMT<0b00001>; 130class SHRLV_QB_ENC : SHLL_QB_FMT<0b00011>; 131class SHLL_PH_ENC : SHLL_QB_FMT<0b01000>; 132class SHLLV_PH_ENC : SHLL_QB_FMT<0b01010>; 133class SHLL_S_PH_ENC : SHLL_QB_FMT<0b01100>; 134class SHLLV_S_PH_ENC : SHLL_QB_FMT<0b01110>; 135class SHRA_PH_ENC : SHLL_QB_FMT<0b01001>; 136class SHRAV_PH_ENC : SHLL_QB_FMT<0b01011>; 137class SHRA_R_PH_ENC : SHLL_QB_FMT<0b01101>; 138class SHRAV_R_PH_ENC : SHLL_QB_FMT<0b01111>; 139class SHLL_S_W_ENC : SHLL_QB_FMT<0b10100>; 140class SHLLV_S_W_ENC : SHLL_QB_FMT<0b10110>; 141class SHRA_R_W_ENC : SHLL_QB_FMT<0b10101>; 142class SHRAV_R_W_ENC : SHLL_QB_FMT<0b10111>; 143class MULEU_S_PH_QBL_ENC : ADDU_QB_FMT<0b00110>; 144class MULEU_S_PH_QBR_ENC : ADDU_QB_FMT<0b00111>; 145class MULEQ_S_W_PHL_ENC : ADDU_QB_FMT<0b11100>; 146class MULEQ_S_W_PHR_ENC : ADDU_QB_FMT<0b11101>; 147class MULQ_RS_PH_ENC : ADDU_QB_FMT<0b11111>; 148class MULSAQ_S_W_PH_ENC : DPA_W_PH_FMT<0b00110>; 149class MAQ_S_W_PHL_ENC : DPA_W_PH_FMT<0b10100>; 150class MAQ_S_W_PHR_ENC : DPA_W_PH_FMT<0b10110>; 151class MAQ_SA_W_PHL_ENC : DPA_W_PH_FMT<0b10000>; 152class MAQ_SA_W_PHR_ENC : DPA_W_PH_FMT<0b10010>; 153class MFHI_ENC : MFHI_FMT<0b010000>; 154class MFLO_ENC : MFHI_FMT<0b010010>; 155class MTHI_ENC : MTHI_FMT<0b010001>; 156class MTLO_ENC : MTHI_FMT<0b010011>; 157class DPAU_H_QBL_ENC : DPA_W_PH_FMT<0b00011>; 158class DPAU_H_QBR_ENC : DPA_W_PH_FMT<0b00111>; 159class DPSU_H_QBL_ENC : DPA_W_PH_FMT<0b01011>; 160class DPSU_H_QBR_ENC : DPA_W_PH_FMT<0b01111>; 161class DPAQ_S_W_PH_ENC : DPA_W_PH_FMT<0b00100>; 162class DPSQ_S_W_PH_ENC : DPA_W_PH_FMT<0b00101>; 163class DPAQ_SA_L_W_ENC : DPA_W_PH_FMT<0b01100>; 164class DPSQ_SA_L_W_ENC : DPA_W_PH_FMT<0b01101>; 165class MULT_DSP_ENC : MULT_FMT<0b000000, 0b011000>; 166class MULTU_DSP_ENC : MULT_FMT<0b000000, 0b011001>; 167class MADD_DSP_ENC : MULT_FMT<0b011100, 0b000000>; 168class MADDU_DSP_ENC : MULT_FMT<0b011100, 0b000001>; 169class MSUB_DSP_ENC : MULT_FMT<0b011100, 0b000100>; 170class MSUBU_DSP_ENC : MULT_FMT<0b011100, 0b000101>; 171class CMPU_EQ_QB_ENC : CMP_EQ_QB_R2_FMT<0b00000>; 172class CMPU_LT_QB_ENC : CMP_EQ_QB_R2_FMT<0b00001>; 173class CMPU_LE_QB_ENC : CMP_EQ_QB_R2_FMT<0b00010>; 174class CMPGU_EQ_QB_ENC : CMP_EQ_QB_R3_FMT<0b00100>; 175class CMPGU_LT_QB_ENC : CMP_EQ_QB_R3_FMT<0b00101>; 176class CMPGU_LE_QB_ENC : CMP_EQ_QB_R3_FMT<0b00110>; 177class CMP_EQ_PH_ENC : CMP_EQ_QB_R2_FMT<0b01000>; 178class CMP_LT_PH_ENC : CMP_EQ_QB_R2_FMT<0b01001>; 179class CMP_LE_PH_ENC : CMP_EQ_QB_R2_FMT<0b01010>; 180class BITREV_ENC : ABSQ_S_PH_R2_FMT<0b11011>; 181class PACKRL_PH_ENC : CMP_EQ_QB_R3_FMT<0b01110>; 182class REPL_QB_ENC : REPL_FMT<0b00010>; 183class REPL_PH_ENC : REPL_FMT<0b01010>; 184class REPLV_QB_ENC : ABSQ_S_PH_R2_FMT<0b00011>; 185class REPLV_PH_ENC : ABSQ_S_PH_R2_FMT<0b01011>; 186class PICK_QB_ENC : CMP_EQ_QB_R3_FMT<0b00011>; 187class PICK_PH_ENC : CMP_EQ_QB_R3_FMT<0b01011>; 188class LWX_ENC : LX_FMT<0b00000>; 189class LHX_ENC : LX_FMT<0b00100>; 190class LBUX_ENC : LX_FMT<0b00110>; 191class BPOSGE32_ENC : BPOSGE32_FMT<0b11100>; 192class INSV_ENC : INSV_FMT<0b001100>; 193 194class EXTP_ENC : EXTR_W_TY1_FMT<0b00010>; 195class EXTPV_ENC : EXTR_W_TY1_FMT<0b00011>; 196class EXTPDP_ENC : EXTR_W_TY1_FMT<0b01010>; 197class EXTPDPV_ENC : EXTR_W_TY1_FMT<0b01011>; 198class EXTR_W_ENC : EXTR_W_TY1_FMT<0b00000>; 199class EXTRV_W_ENC : EXTR_W_TY1_FMT<0b00001>; 200class EXTR_R_W_ENC : EXTR_W_TY1_FMT<0b00100>; 201class EXTRV_R_W_ENC : EXTR_W_TY1_FMT<0b00101>; 202class EXTR_RS_W_ENC : EXTR_W_TY1_FMT<0b00110>; 203class EXTRV_RS_W_ENC : EXTR_W_TY1_FMT<0b00111>; 204class EXTR_S_H_ENC : EXTR_W_TY1_FMT<0b01110>; 205class EXTRV_S_H_ENC : EXTR_W_TY1_FMT<0b01111>; 206class SHILO_ENC : SHILO_R1_FMT<0b11010>; 207class SHILOV_ENC : SHILO_R2_FMT<0b11011>; 208class MTHLIP_ENC : SHILO_R2_FMT<0b11111>; 209 210class RDDSP_ENC : RDDSP_FMT<0b10010>; 211class WRDSP_ENC : WRDSP_FMT<0b10011>; 212class ADDU_PH_ENC : ADDU_QB_FMT<0b01000>; 213class ADDU_S_PH_ENC : ADDU_QB_FMT<0b01100>; 214class SUBU_PH_ENC : ADDU_QB_FMT<0b01001>; 215class SUBU_S_PH_ENC : ADDU_QB_FMT<0b01101>; 216class CMPGDU_EQ_QB_ENC : CMP_EQ_QB_R3_FMT<0b11000>; 217class CMPGDU_LT_QB_ENC : CMP_EQ_QB_R3_FMT<0b11001>; 218class CMPGDU_LE_QB_ENC : CMP_EQ_QB_R3_FMT<0b11010>; 219class ABSQ_S_QB_ENC : ABSQ_S_PH_R2_FMT<0b00001>; 220class ADDUH_QB_ENC : ADDUH_QB_FMT<0b00000>; 221class ADDUH_R_QB_ENC : ADDUH_QB_FMT<0b00010>; 222class SUBUH_QB_ENC : ADDUH_QB_FMT<0b00001>; 223class SUBUH_R_QB_ENC : ADDUH_QB_FMT<0b00011>; 224class ADDQH_PH_ENC : ADDUH_QB_FMT<0b01000>; 225class ADDQH_R_PH_ENC : ADDUH_QB_FMT<0b01010>; 226class SUBQH_PH_ENC : ADDUH_QB_FMT<0b01001>; 227class SUBQH_R_PH_ENC : ADDUH_QB_FMT<0b01011>; 228class ADDQH_W_ENC : ADDUH_QB_FMT<0b10000>; 229class ADDQH_R_W_ENC : ADDUH_QB_FMT<0b10010>; 230class SUBQH_W_ENC : ADDUH_QB_FMT<0b10001>; 231class SUBQH_R_W_ENC : ADDUH_QB_FMT<0b10011>; 232class MUL_PH_ENC : ADDUH_QB_FMT<0b01100>; 233class MUL_S_PH_ENC : ADDUH_QB_FMT<0b01110>; 234class MULQ_S_W_ENC : ADDUH_QB_FMT<0b10110>; 235class MULQ_RS_W_ENC : ADDUH_QB_FMT<0b10111>; 236class MULQ_S_PH_ENC : ADDU_QB_FMT<0b11110>; 237class DPA_W_PH_ENC : DPA_W_PH_FMT<0b00000>; 238class DPS_W_PH_ENC : DPA_W_PH_FMT<0b00001>; 239class DPAQX_S_W_PH_ENC : DPA_W_PH_FMT<0b11000>; 240class DPAQX_SA_W_PH_ENC : DPA_W_PH_FMT<0b11010>; 241class DPAX_W_PH_ENC : DPA_W_PH_FMT<0b01000>; 242class DPSX_W_PH_ENC : DPA_W_PH_FMT<0b01001>; 243class DPSQX_S_W_PH_ENC : DPA_W_PH_FMT<0b11001>; 244class DPSQX_SA_W_PH_ENC : DPA_W_PH_FMT<0b11011>; 245class MULSA_W_PH_ENC : DPA_W_PH_FMT<0b00010>; 246class PRECR_QB_PH_ENC : CMP_EQ_QB_R3_FMT<0b01101>; 247class PRECR_SRA_PH_W_ENC : PRECR_SRA_PH_W_FMT<0b11110>; 248class PRECR_SRA_R_PH_W_ENC : PRECR_SRA_PH_W_FMT<0b11111>; 249class SHRA_QB_ENC : SHLL_QB_FMT<0b00100>; 250class SHRAV_QB_ENC : SHLL_QB_FMT<0b00110>; 251class SHRA_R_QB_ENC : SHLL_QB_FMT<0b00101>; 252class SHRAV_R_QB_ENC : SHLL_QB_FMT<0b00111>; 253class SHRL_PH_ENC : SHLL_QB_FMT<0b11001>; 254class SHRLV_PH_ENC : SHLL_QB_FMT<0b11011>; 255class APPEND_ENC : APPEND_FMT<0b00000>; 256class BALIGN_ENC : APPEND_FMT<0b10000>; 257class PREPEND_ENC : APPEND_FMT<0b00001>; 258 259// Instruction desc. 260class ADDU_QB_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 261 InstrItinClass itin, RegisterOperand ROD, 262 RegisterOperand ROS, RegisterOperand ROT = ROS> { 263 dag OutOperandList = (outs ROD:$rd); 264 dag InOperandList = (ins ROS:$rs, ROT:$rt); 265 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt"); 266 list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs, ROT:$rt))]; 267 InstrItinClass Itinerary = itin; 268 string BaseOpcode = instr_asm; 269} 270 271class RADDU_W_QB_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 272 InstrItinClass itin, RegisterOperand ROD, 273 RegisterOperand ROS = ROD> { 274 dag OutOperandList = (outs ROD:$rd); 275 dag InOperandList = (ins ROS:$rs); 276 string AsmString = !strconcat(instr_asm, "\t$rd, $rs"); 277 list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs))]; 278 InstrItinClass Itinerary = itin; 279 string BaseOpcode = instr_asm; 280} 281 282class CMP_EQ_QB_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 283 InstrItinClass itin, RegisterOperand ROS, 284 RegisterOperand ROT = ROS> { 285 dag OutOperandList = (outs); 286 dag InOperandList = (ins ROS:$rs, ROT:$rt); 287 string AsmString = !strconcat(instr_asm, "\t$rs, $rt"); 288 list<dag> Pattern = [(OpNode ROS:$rs, ROT:$rt)]; 289 InstrItinClass Itinerary = itin; 290} 291 292class CMP_EQ_QB_R3_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 293 InstrItinClass itin, RegisterOperand ROD, 294 RegisterOperand ROS, RegisterOperand ROT = ROS> { 295 dag OutOperandList = (outs ROD:$rd); 296 dag InOperandList = (ins ROS:$rs, ROT:$rt); 297 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt"); 298 list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs, ROT:$rt))]; 299 InstrItinClass Itinerary = itin; 300 string BaseOpcode = instr_asm; 301} 302 303class PRECR_SRA_PH_W_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 304 InstrItinClass itin, RegisterOperand ROT, 305 RegisterOperand ROS = ROT> { 306 dag OutOperandList = (outs ROT:$rt); 307 dag InOperandList = (ins ROS:$rs, uimm5:$sa, ROS:$src); 308 string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $sa"); 309 list<dag> Pattern = [(set ROT:$rt, (OpNode ROS:$src, ROS:$rs, immZExt5:$sa))]; 310 InstrItinClass Itinerary = itin; 311 string Constraints = "$src = $rt"; 312 string BaseOpcode = instr_asm; 313} 314 315class ABSQ_S_PH_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 316 InstrItinClass itin, RegisterOperand ROD, 317 RegisterOperand ROT = ROD> { 318 dag OutOperandList = (outs ROD:$rd); 319 dag InOperandList = (ins ROT:$rt); 320 string AsmString = !strconcat(instr_asm, "\t$rd, $rt"); 321 list<dag> Pattern = [(set ROD:$rd, (OpNode ROT:$rt))]; 322 InstrItinClass Itinerary = itin; 323 string BaseOpcode = instr_asm; 324} 325 326class REPL_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 327 ImmLeaf immPat, InstrItinClass itin, RegisterOperand RO> { 328 dag OutOperandList = (outs RO:$rd); 329 dag InOperandList = (ins uimm16:$imm); 330 string AsmString = !strconcat(instr_asm, "\t$rd, $imm"); 331 list<dag> Pattern = [(set RO:$rd, (OpNode immPat:$imm))]; 332 InstrItinClass Itinerary = itin; 333 string BaseOpcode = instr_asm; 334} 335 336class SHLL_QB_R3_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 337 InstrItinClass itin, RegisterOperand RO> { 338 dag OutOperandList = (outs RO:$rd); 339 dag InOperandList = (ins RO:$rt, GPR32Opnd:$rs_sa); 340 string AsmString = !strconcat(instr_asm, "\t$rd, $rt, $rs_sa"); 341 list<dag> Pattern = [(set RO:$rd, (OpNode RO:$rt, GPR32Opnd:$rs_sa))]; 342 InstrItinClass Itinerary = itin; 343 string BaseOpcode = instr_asm; 344} 345 346class SHLL_QB_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 347 SDPatternOperator ImmPat, InstrItinClass itin, 348 RegisterOperand RO, Operand ImmOpnd> { 349 dag OutOperandList = (outs RO:$rd); 350 dag InOperandList = (ins RO:$rt, ImmOpnd:$rs_sa); 351 string AsmString = !strconcat(instr_asm, "\t$rd, $rt, $rs_sa"); 352 list<dag> Pattern = [(set RO:$rd, (OpNode RO:$rt, ImmPat:$rs_sa))]; 353 InstrItinClass Itinerary = itin; 354 bit hasSideEffects = 1; 355 string BaseOpcode = instr_asm; 356} 357 358class LX_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 359 InstrItinClass itin> { 360 dag OutOperandList = (outs GPR32Opnd:$rd); 361 dag InOperandList = (ins PtrRC:$base, PtrRC:$index); 362 string AsmString = !strconcat(instr_asm, "\t$rd, ${index}(${base})"); 363 list<dag> Pattern = [(set GPR32Opnd:$rd, (OpNode iPTR:$base, iPTR:$index))]; 364 InstrItinClass Itinerary = itin; 365 bit mayLoad = 1; 366 string BaseOpcode = instr_asm; 367} 368 369class ADDUH_QB_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 370 InstrItinClass itin, RegisterOperand ROD, 371 RegisterOperand ROS = ROD, RegisterOperand ROT = ROD> { 372 dag OutOperandList = (outs ROD:$rd); 373 dag InOperandList = (ins ROS:$rs, ROT:$rt); 374 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt"); 375 list<dag> Pattern = [(set ROD:$rd, (OpNode ROS:$rs, ROT:$rt))]; 376 InstrItinClass Itinerary = itin; 377 string BaseOpcode = instr_asm; 378} 379 380class APPEND_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 381 Operand ImmOp, SDPatternOperator Imm, InstrItinClass itin> { 382 dag OutOperandList = (outs GPR32Opnd:$rt); 383 dag InOperandList = (ins GPR32Opnd:$rs, ImmOp:$sa, GPR32Opnd:$src); 384 string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $sa"); 385 list<dag> Pattern = [(set GPR32Opnd:$rt, 386 (OpNode GPR32Opnd:$src, GPR32Opnd:$rs, Imm:$sa))]; 387 InstrItinClass Itinerary = itin; 388 string Constraints = "$src = $rt"; 389 string BaseOpcode = instr_asm; 390} 391 392class EXTR_W_TY1_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 393 InstrItinClass itin> { 394 dag OutOperandList = (outs GPR32Opnd:$rt); 395 dag InOperandList = (ins ACC64DSPOpnd:$ac, GPR32Opnd:$shift_rs); 396 string AsmString = !strconcat(instr_asm, "\t$rt, $ac, $shift_rs"); 397 InstrItinClass Itinerary = itin; 398 string BaseOpcode = instr_asm; 399} 400 401class EXTR_W_TY1_R1_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 402 InstrItinClass itin> { 403 dag OutOperandList = (outs GPR32Opnd:$rt); 404 dag InOperandList = (ins ACC64DSPOpnd:$ac, uimm16:$shift_rs); 405 string AsmString = !strconcat(instr_asm, "\t$rt, $ac, $shift_rs"); 406 InstrItinClass Itinerary = itin; 407 string BaseOpcode = instr_asm; 408} 409 410class SHILO_R1_DESC_BASE<string instr_asm, SDPatternOperator OpNode> { 411 dag OutOperandList = (outs ACC64DSPOpnd:$ac); 412 dag InOperandList = (ins simm6:$shift, ACC64DSPOpnd:$acin); 413 string AsmString = !strconcat(instr_asm, "\t$ac, $shift"); 414 list<dag> Pattern = [(set ACC64DSPOpnd:$ac, 415 (OpNode immSExt6:$shift, ACC64DSPOpnd:$acin))]; 416 string Constraints = "$acin = $ac"; 417 string BaseOpcode = instr_asm; 418} 419 420class SHILO_R2_DESC_BASE<string instr_asm, SDPatternOperator OpNode> { 421 dag OutOperandList = (outs ACC64DSPOpnd:$ac); 422 dag InOperandList = (ins GPR32Opnd:$rs, ACC64DSPOpnd:$acin); 423 string AsmString = !strconcat(instr_asm, "\t$ac, $rs"); 424 list<dag> Pattern = [(set ACC64DSPOpnd:$ac, 425 (OpNode GPR32Opnd:$rs, ACC64DSPOpnd:$acin))]; 426 string Constraints = "$acin = $ac"; 427 string BaseOpcode = instr_asm; 428} 429 430class MTHLIP_DESC_BASE<string instr_asm, SDPatternOperator OpNode> { 431 dag OutOperandList = (outs ACC64DSPOpnd:$ac); 432 dag InOperandList = (ins GPR32Opnd:$rs, ACC64DSPOpnd:$acin); 433 string AsmString = !strconcat(instr_asm, "\t$rs, $ac"); 434 list<dag> Pattern = [(set ACC64DSPOpnd:$ac, 435 (OpNode GPR32Opnd:$rs, ACC64DSPOpnd:$acin))]; 436 string Constraints = "$acin = $ac"; 437 string BaseOpcode = instr_asm; 438} 439 440class RDDSP_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 441 InstrItinClass itin> { 442 dag OutOperandList = (outs GPR32Opnd:$rd); 443 dag InOperandList = (ins uimm16:$mask); 444 string AsmString = !strconcat(instr_asm, "\t$rd, $mask"); 445 list<dag> Pattern = [(set GPR32Opnd:$rd, (OpNode immZExt10:$mask))]; 446 InstrItinClass Itinerary = itin; 447 string BaseOpcode = instr_asm; 448} 449 450class WRDSP_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 451 InstrItinClass itin> { 452 dag OutOperandList = (outs); 453 dag InOperandList = (ins GPR32Opnd:$rs, uimm10:$mask); 454 string AsmString = !strconcat(instr_asm, "\t$rs, $mask"); 455 list<dag> Pattern = [(OpNode GPR32Opnd:$rs, immZExt10:$mask)]; 456 InstrItinClass Itinerary = itin; 457 string BaseOpcode = instr_asm; 458} 459 460class DPA_W_PH_DESC_BASE<string instr_asm, SDPatternOperator OpNode> { 461 dag OutOperandList = (outs ACC64DSPOpnd:$ac); 462 dag InOperandList = (ins GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin); 463 string AsmString = !strconcat(instr_asm, "\t$ac, $rs, $rt"); 464 list<dag> Pattern = [(set ACC64DSPOpnd:$ac, 465 (OpNode GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin))]; 466 string Constraints = "$acin = $ac"; 467 string BaseOpcode = instr_asm; 468} 469 470class MULT_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 471 InstrItinClass itin> { 472 dag OutOperandList = (outs ACC64DSPOpnd:$ac); 473 dag InOperandList = (ins GPR32Opnd:$rs, GPR32Opnd:$rt); 474 string AsmString = !strconcat(instr_asm, "\t$ac, $rs, $rt"); 475 list<dag> Pattern = [(set ACC64DSPOpnd:$ac, (OpNode GPR32Opnd:$rs, GPR32Opnd:$rt))]; 476 InstrItinClass Itinerary = itin; 477 bit isCommutable = 1; 478 string BaseOpcode = instr_asm; 479} 480 481class MADD_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 482 InstrItinClass itin> { 483 dag OutOperandList = (outs ACC64DSPOpnd:$ac); 484 dag InOperandList = (ins GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin); 485 string AsmString = !strconcat(instr_asm, "\t$ac, $rs, $rt"); 486 list<dag> Pattern = [(set ACC64DSPOpnd:$ac, 487 (OpNode GPR32Opnd:$rs, GPR32Opnd:$rt, ACC64DSPOpnd:$acin))]; 488 InstrItinClass Itinerary = itin; 489 string Constraints = "$acin = $ac"; 490 string BaseOpcode = instr_asm; 491} 492 493class MFHI_DESC_BASE<string instr_asm, RegisterOperand RO, SDNode OpNode, 494 InstrItinClass itin> { 495 dag OutOperandList = (outs GPR32Opnd:$rd); 496 dag InOperandList = (ins RO:$ac); 497 string AsmString = !strconcat(instr_asm, "\t$rd, $ac"); 498 list<dag> Pattern = [(set GPR32Opnd:$rd, (OpNode RO:$ac))]; 499 InstrItinClass Itinerary = itin; 500 string BaseOpcode = instr_asm; 501} 502 503class MTHI_DESC_BASE<string instr_asm, RegisterOperand RO, InstrItinClass itin> { 504 dag OutOperandList = (outs RO:$ac); 505 dag InOperandList = (ins GPR32Opnd:$rs); 506 string AsmString = !strconcat(instr_asm, "\t$rs, $ac"); 507 InstrItinClass Itinerary = itin; 508 string BaseOpcode = instr_asm; 509} 510 511class BPOSGE32_PSEUDO_DESC_BASE<SDPatternOperator OpNode, InstrItinClass itin> : 512 MipsPseudo<(outs GPR32Opnd:$dst), (ins), [(set GPR32Opnd:$dst, (OpNode))]> { 513 bit usesCustomInserter = 1; 514} 515 516class BPOSGE32_DESC_BASE<string instr_asm, InstrItinClass itin> { 517 dag OutOperandList = (outs); 518 dag InOperandList = (ins brtarget:$offset); 519 string AsmString = !strconcat(instr_asm, "\t$offset"); 520 InstrItinClass Itinerary = itin; 521 bit isBranch = 1; 522 bit isTerminator = 1; 523 bit hasDelaySlot = 1; 524} 525 526class INSV_DESC_BASE<string instr_asm, SDPatternOperator OpNode, 527 InstrItinClass itin> { 528 dag OutOperandList = (outs GPR32Opnd:$rt); 529 dag InOperandList = (ins GPR32Opnd:$src, GPR32Opnd:$rs); 530 string AsmString = !strconcat(instr_asm, "\t$rt, $rs"); 531 list<dag> Pattern = [(set GPR32Opnd:$rt, (OpNode GPR32Opnd:$src, GPR32Opnd:$rs))]; 532 InstrItinClass Itinerary = itin; 533 string Constraints = "$src = $rt"; 534 string BaseOpcode = instr_asm; 535} 536 537//===----------------------------------------------------------------------===// 538// MIPS DSP Rev 1 539//===----------------------------------------------------------------------===// 540 541// Addition/subtraction 542class ADDU_QB_DESC : ADDU_QB_DESC_BASE<"addu.qb", null_frag, NoItinerary, 543 DSPROpnd, DSPROpnd>, IsCommutable, 544 Defs<[DSPOutFlag20]>; 545 546class ADDU_S_QB_DESC : ADDU_QB_DESC_BASE<"addu_s.qb", int_mips_addu_s_qb, 547 NoItinerary, DSPROpnd, DSPROpnd>, 548 IsCommutable, Defs<[DSPOutFlag20]>; 549 550class SUBU_QB_DESC : ADDU_QB_DESC_BASE<"subu.qb", null_frag, NoItinerary, 551 DSPROpnd, DSPROpnd>, 552 Defs<[DSPOutFlag20]>; 553 554class SUBU_S_QB_DESC : ADDU_QB_DESC_BASE<"subu_s.qb", int_mips_subu_s_qb, 555 NoItinerary, DSPROpnd, DSPROpnd>, 556 Defs<[DSPOutFlag20]>; 557 558class ADDQ_PH_DESC : ADDU_QB_DESC_BASE<"addq.ph", null_frag, NoItinerary, 559 DSPROpnd, DSPROpnd>, IsCommutable, 560 Defs<[DSPOutFlag20]>; 561 562class ADDQ_S_PH_DESC : ADDU_QB_DESC_BASE<"addq_s.ph", int_mips_addq_s_ph, 563 NoItinerary, DSPROpnd, DSPROpnd>, 564 IsCommutable, Defs<[DSPOutFlag20]>; 565 566class SUBQ_PH_DESC : ADDU_QB_DESC_BASE<"subq.ph", null_frag, NoItinerary, 567 DSPROpnd, DSPROpnd>, 568 Defs<[DSPOutFlag20]>; 569 570class SUBQ_S_PH_DESC : ADDU_QB_DESC_BASE<"subq_s.ph", int_mips_subq_s_ph, 571 NoItinerary, DSPROpnd, DSPROpnd>, 572 Defs<[DSPOutFlag20]>; 573 574class ADDQ_S_W_DESC : ADDU_QB_DESC_BASE<"addq_s.w", int_mips_addq_s_w, 575 NoItinerary, GPR32Opnd, GPR32Opnd>, 576 IsCommutable, Defs<[DSPOutFlag20]>; 577 578class SUBQ_S_W_DESC : ADDU_QB_DESC_BASE<"subq_s.w", int_mips_subq_s_w, 579 NoItinerary, GPR32Opnd, GPR32Opnd>, 580 Defs<[DSPOutFlag20]>; 581 582class ADDSC_DESC : ADDU_QB_DESC_BASE<"addsc", null_frag, NoItinerary, 583 GPR32Opnd, GPR32Opnd>, IsCommutable, 584 Defs<[DSPCarry]>; 585 586class ADDWC_DESC : ADDU_QB_DESC_BASE<"addwc", null_frag, NoItinerary, 587 GPR32Opnd, GPR32Opnd>, 588 IsCommutable, Uses<[DSPCarry]>, Defs<[DSPOutFlag20]>; 589 590class MODSUB_DESC : ADDU_QB_DESC_BASE<"modsub", int_mips_modsub, NoItinerary, 591 GPR32Opnd, GPR32Opnd>; 592 593class RADDU_W_QB_DESC : RADDU_W_QB_DESC_BASE<"raddu.w.qb", int_mips_raddu_w_qb, 594 NoItinerary, GPR32Opnd, DSPROpnd>; 595 596// Absolute value 597class ABSQ_S_PH_DESC : ABSQ_S_PH_R2_DESC_BASE<"absq_s.ph", int_mips_absq_s_ph, 598 NoItinerary, DSPROpnd>, 599 Defs<[DSPOutFlag20]>; 600 601class ABSQ_S_W_DESC : ABSQ_S_PH_R2_DESC_BASE<"absq_s.w", int_mips_absq_s_w, 602 NoItinerary, GPR32Opnd>, 603 Defs<[DSPOutFlag20]>; 604 605// Precision reduce/expand 606class PRECRQ_QB_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrq.qb.ph", 607 int_mips_precrq_qb_ph, 608 NoItinerary, DSPROpnd, DSPROpnd>; 609 610class PRECRQ_PH_W_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrq.ph.w", 611 int_mips_precrq_ph_w, 612 NoItinerary, DSPROpnd, GPR32Opnd>; 613 614class PRECRQ_RS_PH_W_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrq_rs.ph.w", 615 int_mips_precrq_rs_ph_w, 616 NoItinerary, DSPROpnd, 617 GPR32Opnd>, 618 Defs<[DSPOutFlag22]>; 619 620class PRECRQU_S_QB_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"precrqu_s.qb.ph", 621 int_mips_precrqu_s_qb_ph, 622 NoItinerary, DSPROpnd, 623 DSPROpnd>, 624 Defs<[DSPOutFlag22]>; 625 626class PRECEQ_W_PHL_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceq.w.phl", 627 int_mips_preceq_w_phl, 628 NoItinerary, GPR32Opnd, DSPROpnd>; 629 630class PRECEQ_W_PHR_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceq.w.phr", 631 int_mips_preceq_w_phr, 632 NoItinerary, GPR32Opnd, DSPROpnd>; 633 634class PRECEQU_PH_QBL_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbl", 635 int_mips_precequ_ph_qbl, 636 NoItinerary, DSPROpnd>; 637 638class PRECEQU_PH_QBR_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbr", 639 int_mips_precequ_ph_qbr, 640 NoItinerary, DSPROpnd>; 641 642class PRECEQU_PH_QBLA_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbla", 643 int_mips_precequ_ph_qbla, 644 NoItinerary, DSPROpnd>; 645 646class PRECEQU_PH_QBRA_DESC : ABSQ_S_PH_R2_DESC_BASE<"precequ.ph.qbra", 647 int_mips_precequ_ph_qbra, 648 NoItinerary, DSPROpnd>; 649 650class PRECEU_PH_QBL_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbl", 651 int_mips_preceu_ph_qbl, 652 NoItinerary, DSPROpnd>; 653 654class PRECEU_PH_QBR_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbr", 655 int_mips_preceu_ph_qbr, 656 NoItinerary, DSPROpnd>; 657 658class PRECEU_PH_QBLA_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbla", 659 int_mips_preceu_ph_qbla, 660 NoItinerary, DSPROpnd>; 661 662class PRECEU_PH_QBRA_DESC : ABSQ_S_PH_R2_DESC_BASE<"preceu.ph.qbra", 663 int_mips_preceu_ph_qbra, 664 NoItinerary, DSPROpnd>; 665 666// Shift 667class SHLL_QB_DESC : SHLL_QB_R2_DESC_BASE<"shll.qb", null_frag, immZExt3, 668 NoItinerary, DSPROpnd, uimm3>, 669 Defs<[DSPOutFlag22]>; 670 671class SHLLV_QB_DESC : SHLL_QB_R3_DESC_BASE<"shllv.qb", int_mips_shll_qb, 672 NoItinerary, DSPROpnd>, 673 Defs<[DSPOutFlag22]>; 674 675class SHRL_QB_DESC : SHLL_QB_R2_DESC_BASE<"shrl.qb", null_frag, immZExt3, 676 NoItinerary, DSPROpnd, uimm3>; 677 678class SHRLV_QB_DESC : SHLL_QB_R3_DESC_BASE<"shrlv.qb", int_mips_shrl_qb, 679 NoItinerary, DSPROpnd>; 680 681class SHLL_PH_DESC : SHLL_QB_R2_DESC_BASE<"shll.ph", null_frag, immZExt4, 682 NoItinerary, DSPROpnd, uimm4>, 683 Defs<[DSPOutFlag22]>; 684 685class SHLLV_PH_DESC : SHLL_QB_R3_DESC_BASE<"shllv.ph", int_mips_shll_ph, 686 NoItinerary, DSPROpnd>, 687 Defs<[DSPOutFlag22]>; 688 689class SHLL_S_PH_DESC : SHLL_QB_R2_DESC_BASE<"shll_s.ph", int_mips_shll_s_ph, 690 immZExt4, NoItinerary, DSPROpnd, 691 uimm4>, 692 Defs<[DSPOutFlag22]>; 693 694class SHLLV_S_PH_DESC : SHLL_QB_R3_DESC_BASE<"shllv_s.ph", int_mips_shll_s_ph, 695 NoItinerary, DSPROpnd>, 696 Defs<[DSPOutFlag22]>; 697 698class SHRA_PH_DESC : SHLL_QB_R2_DESC_BASE<"shra.ph", null_frag, immZExt4, 699 NoItinerary, DSPROpnd, uimm4>; 700 701class SHRAV_PH_DESC : SHLL_QB_R3_DESC_BASE<"shrav.ph", int_mips_shra_ph, 702 NoItinerary, DSPROpnd>; 703 704class SHRA_R_PH_DESC : SHLL_QB_R2_DESC_BASE<"shra_r.ph", int_mips_shra_r_ph, 705 immZExt4, NoItinerary, DSPROpnd, 706 uimm4>; 707 708class SHRAV_R_PH_DESC : SHLL_QB_R3_DESC_BASE<"shrav_r.ph", int_mips_shra_r_ph, 709 NoItinerary, DSPROpnd>; 710 711class SHLL_S_W_DESC : SHLL_QB_R2_DESC_BASE<"shll_s.w", int_mips_shll_s_w, 712 immZExt5, NoItinerary, GPR32Opnd, 713 uimm5>, 714 Defs<[DSPOutFlag22]>; 715 716class SHLLV_S_W_DESC : SHLL_QB_R3_DESC_BASE<"shllv_s.w", int_mips_shll_s_w, 717 NoItinerary, GPR32Opnd>, 718 Defs<[DSPOutFlag22]>; 719 720class SHRA_R_W_DESC : SHLL_QB_R2_DESC_BASE<"shra_r.w", int_mips_shra_r_w, 721 immZExt5, NoItinerary, GPR32Opnd, 722 uimm5>; 723 724class SHRAV_R_W_DESC : SHLL_QB_R3_DESC_BASE<"shrav_r.w", int_mips_shra_r_w, 725 NoItinerary, GPR32Opnd>; 726 727// Multiplication 728class MULEU_S_PH_QBL_DESC : ADDU_QB_DESC_BASE<"muleu_s.ph.qbl", 729 int_mips_muleu_s_ph_qbl, 730 NoItinerary, DSPROpnd, DSPROpnd>, 731 Defs<[DSPOutFlag21]>; 732 733class MULEU_S_PH_QBR_DESC : ADDU_QB_DESC_BASE<"muleu_s.ph.qbr", 734 int_mips_muleu_s_ph_qbr, 735 NoItinerary, DSPROpnd, DSPROpnd>, 736 Defs<[DSPOutFlag21]>; 737 738class MULEQ_S_W_PHL_DESC : ADDU_QB_DESC_BASE<"muleq_s.w.phl", 739 int_mips_muleq_s_w_phl, 740 NoItinerary, GPR32Opnd, DSPROpnd>, 741 IsCommutable, Defs<[DSPOutFlag21]>; 742 743class MULEQ_S_W_PHR_DESC : ADDU_QB_DESC_BASE<"muleq_s.w.phr", 744 int_mips_muleq_s_w_phr, 745 NoItinerary, GPR32Opnd, DSPROpnd>, 746 IsCommutable, Defs<[DSPOutFlag21]>; 747 748class MULQ_RS_PH_DESC : ADDU_QB_DESC_BASE<"mulq_rs.ph", int_mips_mulq_rs_ph, 749 NoItinerary, DSPROpnd, DSPROpnd>, 750 IsCommutable, Defs<[DSPOutFlag21]>; 751 752class MULSAQ_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"mulsaq_s.w.ph", 753 MipsMULSAQ_S_W_PH>, 754 Defs<[DSPOutFlag16_19]>; 755 756class MAQ_S_W_PHL_DESC : DPA_W_PH_DESC_BASE<"maq_s.w.phl", MipsMAQ_S_W_PHL>, 757 Defs<[DSPOutFlag16_19]>; 758 759class MAQ_S_W_PHR_DESC : DPA_W_PH_DESC_BASE<"maq_s.w.phr", MipsMAQ_S_W_PHR>, 760 Defs<[DSPOutFlag16_19]>; 761 762class MAQ_SA_W_PHL_DESC : DPA_W_PH_DESC_BASE<"maq_sa.w.phl", MipsMAQ_SA_W_PHL>, 763 Defs<[DSPOutFlag16_19]>; 764 765class MAQ_SA_W_PHR_DESC : DPA_W_PH_DESC_BASE<"maq_sa.w.phr", MipsMAQ_SA_W_PHR>, 766 Defs<[DSPOutFlag16_19]>; 767 768// Move from/to hi/lo. 769class MFHI_DESC : MFHI_DESC_BASE<"mfhi", ACC64DSPOpnd, MipsMFHI, NoItinerary>; 770class MFLO_DESC : MFHI_DESC_BASE<"mflo", ACC64DSPOpnd, MipsMFLO, NoItinerary>; 771class MTHI_DESC : MTHI_DESC_BASE<"mthi", HI32DSPOpnd, NoItinerary>; 772class MTLO_DESC : MTHI_DESC_BASE<"mtlo", LO32DSPOpnd, NoItinerary>; 773 774// Dot product with accumulate/subtract 775class DPAU_H_QBL_DESC : DPA_W_PH_DESC_BASE<"dpau.h.qbl", MipsDPAU_H_QBL>; 776 777class DPAU_H_QBR_DESC : DPA_W_PH_DESC_BASE<"dpau.h.qbr", MipsDPAU_H_QBR>; 778 779class DPSU_H_QBL_DESC : DPA_W_PH_DESC_BASE<"dpsu.h.qbl", MipsDPSU_H_QBL>; 780 781class DPSU_H_QBR_DESC : DPA_W_PH_DESC_BASE<"dpsu.h.qbr", MipsDPSU_H_QBR>; 782 783class DPAQ_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpaq_s.w.ph", MipsDPAQ_S_W_PH>, 784 Defs<[DSPOutFlag16_19]>; 785 786class DPSQ_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsq_s.w.ph", MipsDPSQ_S_W_PH>, 787 Defs<[DSPOutFlag16_19]>; 788 789class DPAQ_SA_L_W_DESC : DPA_W_PH_DESC_BASE<"dpaq_sa.l.w", MipsDPAQ_SA_L_W>, 790 Defs<[DSPOutFlag16_19]>; 791 792class DPSQ_SA_L_W_DESC : DPA_W_PH_DESC_BASE<"dpsq_sa.l.w", MipsDPSQ_SA_L_W>, 793 Defs<[DSPOutFlag16_19]>; 794 795class MULT_DSP_DESC : MULT_DESC_BASE<"mult", MipsMult, NoItinerary>; 796class MULTU_DSP_DESC : MULT_DESC_BASE<"multu", MipsMultu, NoItinerary>; 797class MADD_DSP_DESC : MADD_DESC_BASE<"madd", MipsMAdd, NoItinerary>; 798class MADDU_DSP_DESC : MADD_DESC_BASE<"maddu", MipsMAddu, NoItinerary>; 799class MSUB_DSP_DESC : MADD_DESC_BASE<"msub", MipsMSub, NoItinerary>; 800class MSUBU_DSP_DESC : MADD_DESC_BASE<"msubu", MipsMSubu, NoItinerary>; 801 802// Comparison 803class CMPU_EQ_QB_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmpu.eq.qb", 804 int_mips_cmpu_eq_qb, NoItinerary, 805 DSPROpnd>, 806 IsCommutable, Defs<[DSPCCond]>; 807 808class CMPU_LT_QB_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmpu.lt.qb", 809 int_mips_cmpu_lt_qb, NoItinerary, 810 DSPROpnd>, Defs<[DSPCCond]>; 811 812class CMPU_LE_QB_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmpu.le.qb", 813 int_mips_cmpu_le_qb, NoItinerary, 814 DSPROpnd>, Defs<[DSPCCond]>; 815 816class CMPGU_EQ_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgu.eq.qb", 817 int_mips_cmpgu_eq_qb, 818 NoItinerary, GPR32Opnd, DSPROpnd>, 819 IsCommutable; 820 821class CMPGU_LT_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgu.lt.qb", 822 int_mips_cmpgu_lt_qb, 823 NoItinerary, GPR32Opnd, DSPROpnd>; 824 825class CMPGU_LE_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgu.le.qb", 826 int_mips_cmpgu_le_qb, 827 NoItinerary, GPR32Opnd, DSPROpnd>; 828 829class CMP_EQ_PH_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmp.eq.ph", int_mips_cmp_eq_ph, 830 NoItinerary, DSPROpnd>, 831 IsCommutable, Defs<[DSPCCond]>; 832 833class CMP_LT_PH_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmp.lt.ph", int_mips_cmp_lt_ph, 834 NoItinerary, DSPROpnd>, 835 Defs<[DSPCCond]>; 836 837class CMP_LE_PH_DESC : CMP_EQ_QB_R2_DESC_BASE<"cmp.le.ph", int_mips_cmp_le_ph, 838 NoItinerary, DSPROpnd>, 839 Defs<[DSPCCond]>; 840 841// Misc 842class BITREV_DESC : ABSQ_S_PH_R2_DESC_BASE<"bitrev", int_mips_bitrev, 843 NoItinerary, GPR32Opnd>; 844 845class PACKRL_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"packrl.ph", int_mips_packrl_ph, 846 NoItinerary, DSPROpnd, DSPROpnd>; 847 848class REPL_QB_DESC : REPL_DESC_BASE<"repl.qb", int_mips_repl_qb, immZExt8, 849 NoItinerary, DSPROpnd>; 850 851class REPL_PH_DESC : REPL_DESC_BASE<"repl.ph", int_mips_repl_ph, immZExt10, 852 NoItinerary, DSPROpnd>; 853 854class REPLV_QB_DESC : ABSQ_S_PH_R2_DESC_BASE<"replv.qb", int_mips_repl_qb, 855 NoItinerary, DSPROpnd, GPR32Opnd>; 856 857class REPLV_PH_DESC : ABSQ_S_PH_R2_DESC_BASE<"replv.ph", int_mips_repl_ph, 858 NoItinerary, DSPROpnd, GPR32Opnd>; 859 860class PICK_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"pick.qb", int_mips_pick_qb, 861 NoItinerary, DSPROpnd, DSPROpnd>, 862 Uses<[DSPCCond]>; 863 864class PICK_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"pick.ph", int_mips_pick_ph, 865 NoItinerary, DSPROpnd, DSPROpnd>, 866 Uses<[DSPCCond]>; 867 868class LWX_DESC : LX_DESC_BASE<"lwx", int_mips_lwx, NoItinerary>; 869 870class LHX_DESC : LX_DESC_BASE<"lhx", int_mips_lhx, NoItinerary>; 871 872class LBUX_DESC : LX_DESC_BASE<"lbux", int_mips_lbux, NoItinerary>; 873 874class BPOSGE32_DESC : BPOSGE32_DESC_BASE<"bposge32", NoItinerary>; 875 876// Extr 877class EXTP_DESC : EXTR_W_TY1_R1_DESC_BASE<"extp", MipsEXTP, NoItinerary>, 878 Uses<[DSPPos]>, Defs<[DSPEFI]>; 879 880class EXTPV_DESC : EXTR_W_TY1_R2_DESC_BASE<"extpv", MipsEXTP, NoItinerary>, 881 Uses<[DSPPos]>, Defs<[DSPEFI]>; 882 883class EXTPDP_DESC : EXTR_W_TY1_R1_DESC_BASE<"extpdp", MipsEXTPDP, NoItinerary>, 884 Uses<[DSPPos]>, Defs<[DSPPos, DSPEFI]>; 885 886class EXTPDPV_DESC : EXTR_W_TY1_R2_DESC_BASE<"extpdpv", MipsEXTPDP, 887 NoItinerary>, 888 Uses<[DSPPos]>, Defs<[DSPPos, DSPEFI]>; 889 890class EXTR_W_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr.w", MipsEXTR_W, NoItinerary>, 891 Defs<[DSPOutFlag23]>; 892 893class EXTRV_W_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv.w", MipsEXTR_W, 894 NoItinerary>, Defs<[DSPOutFlag23]>; 895 896class EXTR_R_W_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr_r.w", MipsEXTR_R_W, 897 NoItinerary>, 898 Defs<[DSPOutFlag23]>; 899 900class EXTRV_R_W_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv_r.w", MipsEXTR_R_W, 901 NoItinerary>, 902 Defs<[DSPOutFlag23]>; 903 904class EXTR_RS_W_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr_rs.w", MipsEXTR_RS_W, 905 NoItinerary>, 906 Defs<[DSPOutFlag23]>; 907 908class EXTRV_RS_W_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv_rs.w", MipsEXTR_RS_W, 909 NoItinerary>, 910 Defs<[DSPOutFlag23]>; 911 912class EXTR_S_H_DESC : EXTR_W_TY1_R1_DESC_BASE<"extr_s.h", MipsEXTR_S_H, 913 NoItinerary>, 914 Defs<[DSPOutFlag23]>; 915 916class EXTRV_S_H_DESC : EXTR_W_TY1_R2_DESC_BASE<"extrv_s.h", MipsEXTR_S_H, 917 NoItinerary>, 918 Defs<[DSPOutFlag23]>; 919 920class SHILO_DESC : SHILO_R1_DESC_BASE<"shilo", MipsSHILO>; 921 922class SHILOV_DESC : SHILO_R2_DESC_BASE<"shilov", MipsSHILO>; 923 924class MTHLIP_DESC : MTHLIP_DESC_BASE<"mthlip", MipsMTHLIP>, Defs<[DSPPos]>; 925 926class RDDSP_DESC : RDDSP_DESC_BASE<"rddsp", int_mips_rddsp, NoItinerary>; 927 928class WRDSP_DESC : WRDSP_DESC_BASE<"wrdsp", int_mips_wrdsp, NoItinerary>; 929 930class INSV_DESC : INSV_DESC_BASE<"insv", int_mips_insv, NoItinerary>, 931 Uses<[DSPPos, DSPSCount]>; 932 933//===----------------------------------------------------------------------===// 934// MIPS DSP Rev 2 935// Addition/subtraction 936class ADDU_PH_DESC : ADDU_QB_DESC_BASE<"addu.ph", int_mips_addu_ph, NoItinerary, 937 DSPROpnd, DSPROpnd>, IsCommutable, 938 Defs<[DSPOutFlag20]>; 939 940class ADDU_S_PH_DESC : ADDU_QB_DESC_BASE<"addu_s.ph", int_mips_addu_s_ph, 941 NoItinerary, DSPROpnd, DSPROpnd>, 942 IsCommutable, Defs<[DSPOutFlag20]>; 943 944class SUBU_PH_DESC : ADDU_QB_DESC_BASE<"subu.ph", int_mips_subu_ph, NoItinerary, 945 DSPROpnd, DSPROpnd>, 946 Defs<[DSPOutFlag20]>; 947 948class SUBU_S_PH_DESC : ADDU_QB_DESC_BASE<"subu_s.ph", int_mips_subu_s_ph, 949 NoItinerary, DSPROpnd, DSPROpnd>, 950 Defs<[DSPOutFlag20]>; 951 952class ADDUH_QB_DESC : ADDUH_QB_DESC_BASE<"adduh.qb", int_mips_adduh_qb, 953 NoItinerary, DSPROpnd>, IsCommutable; 954 955class ADDUH_R_QB_DESC : ADDUH_QB_DESC_BASE<"adduh_r.qb", int_mips_adduh_r_qb, 956 NoItinerary, DSPROpnd>, IsCommutable; 957 958class SUBUH_QB_DESC : ADDUH_QB_DESC_BASE<"subuh.qb", int_mips_subuh_qb, 959 NoItinerary, DSPROpnd>; 960 961class SUBUH_R_QB_DESC : ADDUH_QB_DESC_BASE<"subuh_r.qb", int_mips_subuh_r_qb, 962 NoItinerary, DSPROpnd>; 963 964class ADDQH_PH_DESC : ADDUH_QB_DESC_BASE<"addqh.ph", int_mips_addqh_ph, 965 NoItinerary, DSPROpnd>, IsCommutable; 966 967class ADDQH_R_PH_DESC : ADDUH_QB_DESC_BASE<"addqh_r.ph", int_mips_addqh_r_ph, 968 NoItinerary, DSPROpnd>, IsCommutable; 969 970class SUBQH_PH_DESC : ADDUH_QB_DESC_BASE<"subqh.ph", int_mips_subqh_ph, 971 NoItinerary, DSPROpnd>; 972 973class SUBQH_R_PH_DESC : ADDUH_QB_DESC_BASE<"subqh_r.ph", int_mips_subqh_r_ph, 974 NoItinerary, DSPROpnd>; 975 976class ADDQH_W_DESC : ADDUH_QB_DESC_BASE<"addqh.w", int_mips_addqh_w, 977 NoItinerary, GPR32Opnd>, IsCommutable; 978 979class ADDQH_R_W_DESC : ADDUH_QB_DESC_BASE<"addqh_r.w", int_mips_addqh_r_w, 980 NoItinerary, GPR32Opnd>, IsCommutable; 981 982class SUBQH_W_DESC : ADDUH_QB_DESC_BASE<"subqh.w", int_mips_subqh_w, 983 NoItinerary, GPR32Opnd>; 984 985class SUBQH_R_W_DESC : ADDUH_QB_DESC_BASE<"subqh_r.w", int_mips_subqh_r_w, 986 NoItinerary, GPR32Opnd>; 987 988// Comparison 989class CMPGDU_EQ_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgdu.eq.qb", 990 int_mips_cmpgdu_eq_qb, 991 NoItinerary, GPR32Opnd, DSPROpnd>, 992 IsCommutable, Defs<[DSPCCond]>; 993 994class CMPGDU_LT_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgdu.lt.qb", 995 int_mips_cmpgdu_lt_qb, 996 NoItinerary, GPR32Opnd, DSPROpnd>, 997 Defs<[DSPCCond]>; 998 999class CMPGDU_LE_QB_DESC : CMP_EQ_QB_R3_DESC_BASE<"cmpgdu.le.qb", 1000 int_mips_cmpgdu_le_qb, 1001 NoItinerary, GPR32Opnd, DSPROpnd>, 1002 Defs<[DSPCCond]>; 1003 1004// Absolute 1005class ABSQ_S_QB_DESC : ABSQ_S_PH_R2_DESC_BASE<"absq_s.qb", int_mips_absq_s_qb, 1006 NoItinerary, DSPROpnd>, 1007 Defs<[DSPOutFlag20]>; 1008 1009// Multiplication 1010class MUL_PH_DESC : ADDUH_QB_DESC_BASE<"mul.ph", null_frag, NoItinerary, 1011 DSPROpnd>, IsCommutable, 1012 Defs<[DSPOutFlag21]>; 1013 1014class MUL_S_PH_DESC : ADDUH_QB_DESC_BASE<"mul_s.ph", int_mips_mul_s_ph, 1015 NoItinerary, DSPROpnd>, IsCommutable, 1016 Defs<[DSPOutFlag21]>; 1017 1018class MULQ_S_W_DESC : ADDUH_QB_DESC_BASE<"mulq_s.w", int_mips_mulq_s_w, 1019 NoItinerary, GPR32Opnd>, IsCommutable, 1020 Defs<[DSPOutFlag21]>; 1021 1022class MULQ_RS_W_DESC : ADDUH_QB_DESC_BASE<"mulq_rs.w", int_mips_mulq_rs_w, 1023 NoItinerary, GPR32Opnd>, IsCommutable, 1024 Defs<[DSPOutFlag21]>; 1025 1026class MULQ_S_PH_DESC : ADDU_QB_DESC_BASE<"mulq_s.ph", int_mips_mulq_s_ph, 1027 NoItinerary, DSPROpnd, DSPROpnd>, 1028 IsCommutable, Defs<[DSPOutFlag21]>; 1029 1030// Dot product with accumulate/subtract 1031class DPA_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpa.w.ph", MipsDPA_W_PH>; 1032 1033class DPS_W_PH_DESC : DPA_W_PH_DESC_BASE<"dps.w.ph", MipsDPS_W_PH>; 1034 1035class DPAQX_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpaqx_s.w.ph", MipsDPAQX_S_W_PH>, 1036 Defs<[DSPOutFlag16_19]>; 1037 1038class DPAQX_SA_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpaqx_sa.w.ph", 1039 MipsDPAQX_SA_W_PH>, 1040 Defs<[DSPOutFlag16_19]>; 1041 1042class DPAX_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpax.w.ph", MipsDPAX_W_PH>; 1043 1044class DPSX_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsx.w.ph", MipsDPSX_W_PH>; 1045 1046class DPSQX_S_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsqx_s.w.ph", MipsDPSQX_S_W_PH>, 1047 Defs<[DSPOutFlag16_19]>; 1048 1049class DPSQX_SA_W_PH_DESC : DPA_W_PH_DESC_BASE<"dpsqx_sa.w.ph", 1050 MipsDPSQX_SA_W_PH>, 1051 Defs<[DSPOutFlag16_19]>; 1052 1053class MULSA_W_PH_DESC : DPA_W_PH_DESC_BASE<"mulsa.w.ph", MipsMULSA_W_PH>; 1054 1055// Precision reduce/expand 1056class PRECR_QB_PH_DESC : CMP_EQ_QB_R3_DESC_BASE<"precr.qb.ph", 1057 int_mips_precr_qb_ph, 1058 NoItinerary, DSPROpnd, DSPROpnd>; 1059 1060class PRECR_SRA_PH_W_DESC : PRECR_SRA_PH_W_DESC_BASE<"precr_sra.ph.w", 1061 int_mips_precr_sra_ph_w, 1062 NoItinerary, DSPROpnd, 1063 GPR32Opnd>; 1064 1065class PRECR_SRA_R_PH_W_DESC : PRECR_SRA_PH_W_DESC_BASE<"precr_sra_r.ph.w", 1066 int_mips_precr_sra_r_ph_w, 1067 NoItinerary, DSPROpnd, 1068 GPR32Opnd>; 1069 1070// Shift 1071class SHRA_QB_DESC : SHLL_QB_R2_DESC_BASE<"shra.qb", null_frag, immZExt3, 1072 NoItinerary, DSPROpnd, uimm3>; 1073 1074class SHRAV_QB_DESC : SHLL_QB_R3_DESC_BASE<"shrav.qb", int_mips_shra_qb, 1075 NoItinerary, DSPROpnd>; 1076 1077class SHRA_R_QB_DESC : SHLL_QB_R2_DESC_BASE<"shra_r.qb", int_mips_shra_r_qb, 1078 immZExt3, NoItinerary, DSPROpnd, 1079 uimm3>; 1080 1081class SHRAV_R_QB_DESC : SHLL_QB_R3_DESC_BASE<"shrav_r.qb", int_mips_shra_r_qb, 1082 NoItinerary, DSPROpnd>; 1083 1084class SHRL_PH_DESC : SHLL_QB_R2_DESC_BASE<"shrl.ph", null_frag, immZExt4, 1085 NoItinerary, DSPROpnd, uimm4>; 1086 1087class SHRLV_PH_DESC : SHLL_QB_R3_DESC_BASE<"shrlv.ph", int_mips_shrl_ph, 1088 NoItinerary, DSPROpnd>; 1089 1090// Misc 1091class APPEND_DESC : APPEND_DESC_BASE<"append", int_mips_append, uimm5, immZExt5, 1092 NoItinerary>; 1093 1094class BALIGN_DESC : APPEND_DESC_BASE<"balign", int_mips_balign, uimm2, immZExt2, 1095 NoItinerary>; 1096 1097class PREPEND_DESC : APPEND_DESC_BASE<"prepend", int_mips_prepend, uimm5, 1098 immZExt5, NoItinerary>; 1099 1100// Pseudos. 1101def BPOSGE32_PSEUDO : BPOSGE32_PSEUDO_DESC_BASE<int_mips_bposge32, 1102 NoItinerary>, Uses<[DSPPos]>; 1103 1104// Instruction defs. 1105// MIPS DSP Rev 1 1106def ADDU_QB : DspMMRel, ADDU_QB_ENC, ADDU_QB_DESC; 1107def ADDU_S_QB : DspMMRel, ADDU_S_QB_ENC, ADDU_S_QB_DESC; 1108def SUBU_QB : DspMMRel, SUBU_QB_ENC, SUBU_QB_DESC; 1109def SUBU_S_QB : DspMMRel, SUBU_S_QB_ENC, SUBU_S_QB_DESC; 1110def ADDQ_PH : DspMMRel, ADDQ_PH_ENC, ADDQ_PH_DESC; 1111def ADDQ_S_PH : DspMMRel, ADDQ_S_PH_ENC, ADDQ_S_PH_DESC; 1112def SUBQ_PH : DspMMRel, SUBQ_PH_ENC, SUBQ_PH_DESC; 1113def SUBQ_S_PH : DspMMRel, SUBQ_S_PH_ENC, SUBQ_S_PH_DESC; 1114def ADDQ_S_W : DspMMRel, ADDQ_S_W_ENC, ADDQ_S_W_DESC; 1115def SUBQ_S_W : DspMMRel, SUBQ_S_W_ENC, SUBQ_S_W_DESC; 1116def ADDSC : DspMMRel, ADDSC_ENC, ADDSC_DESC; 1117def ADDWC : DspMMRel, ADDWC_ENC, ADDWC_DESC; 1118def MODSUB : MODSUB_ENC, MODSUB_DESC; 1119def RADDU_W_QB : DspMMRel, RADDU_W_QB_ENC, RADDU_W_QB_DESC; 1120def ABSQ_S_PH : DspMMRel, ABSQ_S_PH_ENC, ABSQ_S_PH_DESC; 1121def ABSQ_S_W : DspMMRel, ABSQ_S_W_ENC, ABSQ_S_W_DESC; 1122def PRECRQ_QB_PH : DspMMRel, PRECRQ_QB_PH_ENC, PRECRQ_QB_PH_DESC; 1123def PRECRQ_PH_W : DspMMRel, PRECRQ_PH_W_ENC, PRECRQ_PH_W_DESC; 1124def PRECRQ_RS_PH_W : DspMMRel, PRECRQ_RS_PH_W_ENC, PRECRQ_RS_PH_W_DESC; 1125def PRECRQU_S_QB_PH : DspMMRel, PRECRQU_S_QB_PH_ENC, PRECRQU_S_QB_PH_DESC; 1126def PRECEQ_W_PHL : DspMMRel, PRECEQ_W_PHL_ENC, PRECEQ_W_PHL_DESC; 1127def PRECEQ_W_PHR : DspMMRel, PRECEQ_W_PHR_ENC, PRECEQ_W_PHR_DESC; 1128def PRECEQU_PH_QBL : DspMMRel, PRECEQU_PH_QBL_ENC, PRECEQU_PH_QBL_DESC; 1129def PRECEQU_PH_QBR : DspMMRel, PRECEQU_PH_QBR_ENC, PRECEQU_PH_QBR_DESC; 1130def PRECEQU_PH_QBLA : DspMMRel, PRECEQU_PH_QBLA_ENC, PRECEQU_PH_QBLA_DESC; 1131def PRECEQU_PH_QBRA : DspMMRel, PRECEQU_PH_QBRA_ENC, PRECEQU_PH_QBRA_DESC; 1132def PRECEU_PH_QBL : DspMMRel, PRECEU_PH_QBL_ENC, PRECEU_PH_QBL_DESC; 1133def PRECEU_PH_QBR : DspMMRel, PRECEU_PH_QBR_ENC, PRECEU_PH_QBR_DESC; 1134def PRECEU_PH_QBLA : DspMMRel, PRECEU_PH_QBLA_ENC, PRECEU_PH_QBLA_DESC; 1135def PRECEU_PH_QBRA : DspMMRel, PRECEU_PH_QBRA_ENC, PRECEU_PH_QBRA_DESC; 1136def SHLL_QB : DspMMRel, SHLL_QB_ENC, SHLL_QB_DESC; 1137def SHLLV_QB : DspMMRel, SHLLV_QB_ENC, SHLLV_QB_DESC; 1138def SHRL_QB : DspMMRel, SHRL_QB_ENC, SHRL_QB_DESC; 1139def SHRLV_QB : DspMMRel, SHRLV_QB_ENC, SHRLV_QB_DESC; 1140def SHLL_PH : DspMMRel, SHLL_PH_ENC, SHLL_PH_DESC; 1141def SHLLV_PH : DspMMRel, SHLLV_PH_ENC, SHLLV_PH_DESC; 1142def SHLL_S_PH : DspMMRel, SHLL_S_PH_ENC, SHLL_S_PH_DESC; 1143def SHLLV_S_PH : DspMMRel, SHLLV_S_PH_ENC, SHLLV_S_PH_DESC; 1144def SHRA_PH : DspMMRel, SHRA_PH_ENC, SHRA_PH_DESC; 1145def SHRAV_PH : DspMMRel, SHRAV_PH_ENC, SHRAV_PH_DESC; 1146def SHRA_R_PH : DspMMRel, SHRA_R_PH_ENC, SHRA_R_PH_DESC; 1147def SHRAV_R_PH : DspMMRel, SHRAV_R_PH_ENC, SHRAV_R_PH_DESC; 1148def SHLL_S_W : DspMMRel, SHLL_S_W_ENC, SHLL_S_W_DESC; 1149def SHLLV_S_W : DspMMRel, SHLLV_S_W_ENC, SHLLV_S_W_DESC; 1150def SHRA_R_W : DspMMRel, SHRA_R_W_ENC, SHRA_R_W_DESC; 1151def SHRAV_R_W : DspMMRel, SHRAV_R_W_ENC, SHRAV_R_W_DESC; 1152def MULEU_S_PH_QBL : DspMMRel, MULEU_S_PH_QBL_ENC, MULEU_S_PH_QBL_DESC; 1153def MULEU_S_PH_QBR : DspMMRel, MULEU_S_PH_QBR_ENC, MULEU_S_PH_QBR_DESC; 1154def MULEQ_S_W_PHL : DspMMRel, MULEQ_S_W_PHL_ENC, MULEQ_S_W_PHL_DESC; 1155def MULEQ_S_W_PHR : DspMMRel, MULEQ_S_W_PHR_ENC, MULEQ_S_W_PHR_DESC; 1156def MULQ_RS_PH : DspMMRel, MULQ_RS_PH_ENC, MULQ_RS_PH_DESC; 1157def MULSAQ_S_W_PH : MULSAQ_S_W_PH_ENC, MULSAQ_S_W_PH_DESC; 1158def MAQ_S_W_PHL : DspMMRel, MAQ_S_W_PHL_ENC, MAQ_S_W_PHL_DESC; 1159def MAQ_S_W_PHR : DspMMRel, MAQ_S_W_PHR_ENC, MAQ_S_W_PHR_DESC; 1160def MAQ_SA_W_PHL : DspMMRel, MAQ_SA_W_PHL_ENC, MAQ_SA_W_PHL_DESC; 1161def MAQ_SA_W_PHR : DspMMRel, MAQ_SA_W_PHR_ENC, MAQ_SA_W_PHR_DESC; 1162def MFHI_DSP : DspMMRel, MFHI_ENC, MFHI_DESC; 1163def MFLO_DSP : DspMMRel, MFLO_ENC, MFLO_DESC; 1164def MTHI_DSP : DspMMRel, MTHI_ENC, MTHI_DESC; 1165def MTLO_DSP : DspMMRel, MTLO_ENC, MTLO_DESC; 1166def DPAU_H_QBL : DspMMRel, DPAU_H_QBL_ENC, DPAU_H_QBL_DESC; 1167def DPAU_H_QBR : DspMMRel, DPAU_H_QBR_ENC, DPAU_H_QBR_DESC; 1168def DPSU_H_QBL : DspMMRel, DPSU_H_QBL_ENC, DPSU_H_QBL_DESC; 1169def DPSU_H_QBR : DspMMRel, DPSU_H_QBR_ENC, DPSU_H_QBR_DESC; 1170def DPAQ_S_W_PH : DspMMRel, DPAQ_S_W_PH_ENC, DPAQ_S_W_PH_DESC; 1171def DPSQ_S_W_PH : DspMMRel, DPSQ_S_W_PH_ENC, DPSQ_S_W_PH_DESC; 1172def DPAQ_SA_L_W : DspMMRel, DPAQ_SA_L_W_ENC, DPAQ_SA_L_W_DESC; 1173def DPSQ_SA_L_W : DspMMRel, DPSQ_SA_L_W_ENC, DPSQ_SA_L_W_DESC; 1174def MULT_DSP : DspMMRel, MULT_DSP_ENC, MULT_DSP_DESC; 1175def MULTU_DSP : DspMMRel, MULTU_DSP_ENC, MULTU_DSP_DESC; 1176def MADD_DSP : DspMMRel, MADD_DSP_ENC, MADD_DSP_DESC; 1177def MADDU_DSP : DspMMRel, MADDU_DSP_ENC, MADDU_DSP_DESC; 1178def MSUB_DSP : DspMMRel, MSUB_DSP_ENC, MSUB_DSP_DESC; 1179def MSUBU_DSP : DspMMRel, MSUBU_DSP_ENC, MSUBU_DSP_DESC; 1180def CMPU_EQ_QB : CMPU_EQ_QB_ENC, CMPU_EQ_QB_DESC; 1181def CMPU_LT_QB : CMPU_LT_QB_ENC, CMPU_LT_QB_DESC; 1182def CMPU_LE_QB : CMPU_LE_QB_ENC, CMPU_LE_QB_DESC; 1183def CMPGU_EQ_QB : CMPGU_EQ_QB_ENC, CMPGU_EQ_QB_DESC; 1184def CMPGU_LT_QB : CMPGU_LT_QB_ENC, CMPGU_LT_QB_DESC; 1185def CMPGU_LE_QB : CMPGU_LE_QB_ENC, CMPGU_LE_QB_DESC; 1186def CMP_EQ_PH : CMP_EQ_PH_ENC, CMP_EQ_PH_DESC; 1187def CMP_LT_PH : CMP_LT_PH_ENC, CMP_LT_PH_DESC; 1188def CMP_LE_PH : CMP_LE_PH_ENC, CMP_LE_PH_DESC; 1189def BITREV : BITREV_ENC, BITREV_DESC; 1190def PACKRL_PH : DspMMRel, PACKRL_PH_ENC, PACKRL_PH_DESC; 1191def REPL_QB : DspMMRel, REPL_QB_ENC, REPL_QB_DESC; 1192def REPL_PH : DspMMRel, REPL_PH_ENC, REPL_PH_DESC; 1193def REPLV_QB : DspMMRel, REPLV_QB_ENC, REPLV_QB_DESC; 1194def REPLV_PH : DspMMRel, REPLV_PH_ENC, REPLV_PH_DESC; 1195def PICK_QB : DspMMRel, PICK_QB_ENC, PICK_QB_DESC; 1196def PICK_PH : DspMMRel, PICK_PH_ENC, PICK_PH_DESC; 1197def LWX : DspMMRel, LWX_ENC, LWX_DESC; 1198def LHX : DspMMRel, LHX_ENC, LHX_DESC; 1199def LBUX : DspMMRel, LBUX_ENC, LBUX_DESC; 1200def BPOSGE32 : BPOSGE32_ENC, BPOSGE32_DESC; 1201def INSV : DspMMRel, INSV_ENC, INSV_DESC; 1202def EXTP : DspMMRel, EXTP_ENC, EXTP_DESC; 1203def EXTPV : DspMMRel, EXTPV_ENC, EXTPV_DESC; 1204def EXTPDP : DspMMRel, EXTPDP_ENC, EXTPDP_DESC; 1205def EXTPDPV : DspMMRel, EXTPDPV_ENC, EXTPDPV_DESC; 1206def EXTR_W : DspMMRel, EXTR_W_ENC, EXTR_W_DESC; 1207def EXTRV_W : DspMMRel, EXTRV_W_ENC, EXTRV_W_DESC; 1208def EXTR_R_W : DspMMRel, EXTR_R_W_ENC, EXTR_R_W_DESC; 1209def EXTRV_R_W : DspMMRel, EXTRV_R_W_ENC, EXTRV_R_W_DESC; 1210def EXTR_RS_W : DspMMRel, EXTR_RS_W_ENC, EXTR_RS_W_DESC; 1211def EXTRV_RS_W : DspMMRel, EXTRV_RS_W_ENC, EXTRV_RS_W_DESC; 1212def EXTR_S_H : DspMMRel, EXTR_S_H_ENC, EXTR_S_H_DESC; 1213def EXTRV_S_H : DspMMRel, EXTRV_S_H_ENC, EXTRV_S_H_DESC; 1214def SHILO : DspMMRel, SHILO_ENC, SHILO_DESC; 1215def SHILOV : DspMMRel, SHILOV_ENC, SHILOV_DESC; 1216def MTHLIP : DspMMRel, MTHLIP_ENC, MTHLIP_DESC; 1217def RDDSP : DspMMRel, RDDSP_ENC, RDDSP_DESC; 1218let AdditionalPredicates = [NotInMicroMips] in { 1219 def WRDSP : WRDSP_ENC, WRDSP_DESC; 1220} 1221 1222// MIPS DSP Rev 2 1223def ADDU_PH : DspMMRel, ADDU_PH_ENC, ADDU_PH_DESC, ISA_DSPR2; 1224def ADDU_S_PH : DspMMRel, ADDU_S_PH_ENC, ADDU_S_PH_DESC, ISA_DSPR2; 1225def SUBU_PH : DspMMRel, SUBU_PH_ENC, SUBU_PH_DESC, ISA_DSPR2; 1226def SUBU_S_PH : DspMMRel, SUBU_S_PH_ENC, SUBU_S_PH_DESC, ISA_DSPR2; 1227def CMPGDU_EQ_QB : CMPGDU_EQ_QB_ENC, CMPGDU_EQ_QB_DESC, ISA_DSPR2; 1228def CMPGDU_LT_QB : CMPGDU_LT_QB_ENC, CMPGDU_LT_QB_DESC, ISA_DSPR2; 1229def CMPGDU_LE_QB : CMPGDU_LE_QB_ENC, CMPGDU_LE_QB_DESC, ISA_DSPR2; 1230def ABSQ_S_QB : DspMMRel, ABSQ_S_QB_ENC, ABSQ_S_QB_DESC, ISA_DSPR2; 1231def ADDUH_QB : DspMMRel, ADDUH_QB_ENC, ADDUH_QB_DESC, ISA_DSPR2; 1232def ADDUH_R_QB : DspMMRel, ADDUH_R_QB_ENC, ADDUH_R_QB_DESC, ISA_DSPR2; 1233def SUBUH_QB : DspMMRel, SUBUH_QB_ENC, SUBUH_QB_DESC, ISA_DSPR2; 1234def SUBUH_R_QB : DspMMRel, SUBUH_R_QB_ENC, SUBUH_R_QB_DESC, ISA_DSPR2; 1235def ADDQH_PH : DspMMRel, ADDQH_PH_ENC, ADDQH_PH_DESC, ISA_DSPR2; 1236def ADDQH_R_PH : DspMMRel, ADDQH_R_PH_ENC, ADDQH_R_PH_DESC, ISA_DSPR2; 1237def SUBQH_PH : DspMMRel, SUBQH_PH_ENC, SUBQH_PH_DESC, ISA_DSPR2; 1238def SUBQH_R_PH : DspMMRel, SUBQH_R_PH_ENC, SUBQH_R_PH_DESC, ISA_DSPR2; 1239def ADDQH_W : DspMMRel, ADDQH_W_ENC, ADDQH_W_DESC, ISA_DSPR2; 1240def ADDQH_R_W : DspMMRel, ADDQH_R_W_ENC, ADDQH_R_W_DESC, ISA_DSPR2; 1241def SUBQH_W : DspMMRel, SUBQH_W_ENC, SUBQH_W_DESC, ISA_DSPR2; 1242def SUBQH_R_W : DspMMRel, SUBQH_R_W_ENC, SUBQH_R_W_DESC, ISA_DSPR2; 1243def MUL_PH : DspMMRel, MUL_PH_ENC, MUL_PH_DESC, ISA_DSPR2; 1244def MUL_S_PH : DspMMRel, MUL_S_PH_ENC, MUL_S_PH_DESC, ISA_DSPR2; 1245def MULQ_S_W : DspMMRel, MULQ_S_W_ENC, MULQ_S_W_DESC, ISA_DSPR2; 1246def MULQ_RS_W : DspMMRel, MULQ_RS_W_ENC, MULQ_RS_W_DESC, ISA_DSPR2; 1247def MULQ_S_PH : DspMMRel, MULQ_S_PH_ENC, MULQ_S_PH_DESC, ISA_DSPR2; 1248def DPA_W_PH : DspMMRel, DPA_W_PH_ENC, DPA_W_PH_DESC, ISA_DSPR2; 1249def DPS_W_PH : DspMMRel, DPS_W_PH_ENC, DPS_W_PH_DESC, ISA_DSPR2; 1250def DPAQX_S_W_PH : DspMMRel, DPAQX_S_W_PH_ENC, DPAQX_S_W_PH_DESC, ISA_DSPR2; 1251def DPAQX_SA_W_PH : DspMMRel, DPAQX_SA_W_PH_ENC, DPAQX_SA_W_PH_DESC, ISA_DSPR2; 1252def DPAX_W_PH : DspMMRel, DPAX_W_PH_ENC, DPAX_W_PH_DESC, ISA_DSPR2; 1253def DPSX_W_PH : DspMMRel, DPSX_W_PH_ENC, DPSX_W_PH_DESC, ISA_DSPR2; 1254def DPSQX_S_W_PH : DspMMRel, DPSQX_S_W_PH_ENC, DPSQX_S_W_PH_DESC, ISA_DSPR2; 1255def DPSQX_SA_W_PH : DspMMRel, DPSQX_SA_W_PH_ENC, DPSQX_SA_W_PH_DESC, ISA_DSPR2; 1256def MULSA_W_PH : MULSA_W_PH_ENC, MULSA_W_PH_DESC, ISA_DSPR2; 1257def PRECR_QB_PH : DspMMRel, PRECR_QB_PH_ENC, PRECR_QB_PH_DESC, ISA_DSPR2; 1258def PRECR_SRA_PH_W : DspMMRel, PRECR_SRA_PH_W_ENC, PRECR_SRA_PH_W_DESC, ISA_DSPR2; 1259def PRECR_SRA_R_PH_W : DspMMRel, PRECR_SRA_R_PH_W_ENC, PRECR_SRA_R_PH_W_DESC, ISA_DSPR2; 1260def SHRA_QB : DspMMRel, SHRA_QB_ENC, SHRA_QB_DESC, ISA_DSPR2; 1261def SHRAV_QB : DspMMRel, SHRAV_QB_ENC, SHRAV_QB_DESC, ISA_DSPR2; 1262def SHRA_R_QB : DspMMRel, SHRA_R_QB_ENC, SHRA_R_QB_DESC, ISA_DSPR2; 1263def SHRAV_R_QB : DspMMRel, SHRAV_R_QB_ENC, SHRAV_R_QB_DESC, ISA_DSPR2; 1264def SHRL_PH : DspMMRel, SHRL_PH_ENC, SHRL_PH_DESC, ISA_DSPR2; 1265def SHRLV_PH : DspMMRel, SHRLV_PH_ENC, SHRLV_PH_DESC, ISA_DSPR2; 1266def APPEND : APPEND_ENC, APPEND_DESC, ISA_DSPR2; 1267def BALIGN : BALIGN_ENC, BALIGN_DESC, ISA_DSPR2; 1268def PREPEND : DspMMRel, PREPEND_ENC, PREPEND_DESC, ISA_DSPR2; 1269 1270// Pseudos. 1271let isPseudo = 1, isCodeGenOnly = 1 in { 1272 // Pseudo instructions for loading and storing accumulator registers. 1273 def LOAD_ACC64DSP : Load<"", ACC64DSPOpnd>; 1274 def STORE_ACC64DSP : Store<"", ACC64DSPOpnd>; 1275 1276 // Pseudos for loading and storing ccond field of DSP control register. 1277 def LOAD_CCOND_DSP : Load<"load_ccond_dsp", DSPCC>; 1278 def STORE_CCOND_DSP : Store<"store_ccond_dsp", DSPCC>; 1279} 1280 1281// Pseudo CMP and PICK instructions. 1282class PseudoCMP<Instruction RealInst> : 1283 PseudoDSP<(outs DSPCC:$cmp), (ins DSPROpnd:$rs, DSPROpnd:$rt), []>, 1284 PseudoInstExpansion<(RealInst DSPROpnd:$rs, DSPROpnd:$rt)>, NeverHasSideEffects; 1285 1286class PseudoPICK<Instruction RealInst> : 1287 PseudoDSP<(outs DSPROpnd:$rd), (ins DSPCC:$cmp, DSPROpnd:$rs, DSPROpnd:$rt), []>, 1288 PseudoInstExpansion<(RealInst DSPROpnd:$rd, DSPROpnd:$rs, DSPROpnd:$rt)>, 1289 NeverHasSideEffects; 1290 1291def PseudoCMP_EQ_PH : PseudoCMP<CMP_EQ_PH>; 1292def PseudoCMP_LT_PH : PseudoCMP<CMP_LT_PH>; 1293def PseudoCMP_LE_PH : PseudoCMP<CMP_LE_PH>; 1294def PseudoCMPU_EQ_QB : PseudoCMP<CMPU_EQ_QB>; 1295def PseudoCMPU_LT_QB : PseudoCMP<CMPU_LT_QB>; 1296def PseudoCMPU_LE_QB : PseudoCMP<CMPU_LE_QB>; 1297 1298def PseudoPICK_PH : PseudoPICK<PICK_PH>; 1299def PseudoPICK_QB : PseudoPICK<PICK_QB>; 1300 1301def PseudoMTLOHI_DSP : PseudoMTLOHI<ACC64DSP, GPR32>; 1302 1303// Patterns. 1304class DSPPat<dag pattern, dag result, Predicate pred = HasDSP> : 1305 Pat<pattern, result>, Requires<[pred]>; 1306 1307class BitconvertPat<ValueType DstVT, ValueType SrcVT, RegisterClass DstRC, 1308 RegisterClass SrcRC> : 1309 DSPPat<(DstVT (bitconvert (SrcVT SrcRC:$src))), 1310 (COPY_TO_REGCLASS SrcRC:$src, DstRC)>; 1311 1312def : BitconvertPat<i32, v2i16, GPR32, DSPR>; 1313def : BitconvertPat<i32, v4i8, GPR32, DSPR>; 1314def : BitconvertPat<v2i16, i32, DSPR, GPR32>; 1315def : BitconvertPat<v4i8, i32, DSPR, GPR32>; 1316 1317def : DSPPat<(v2i16 (load addr:$a)), 1318 (v2i16 (COPY_TO_REGCLASS (LW addr:$a), DSPR))>; 1319def : DSPPat<(v4i8 (load addr:$a)), 1320 (v4i8 (COPY_TO_REGCLASS (LW addr:$a), DSPR))>; 1321def : DSPPat<(store (v2i16 DSPR:$val), addr:$a), 1322 (SW (COPY_TO_REGCLASS DSPR:$val, GPR32), addr:$a)>; 1323def : DSPPat<(store (v4i8 DSPR:$val), addr:$a), 1324 (SW (COPY_TO_REGCLASS DSPR:$val, GPR32), addr:$a)>; 1325 1326// Binary operations. 1327class DSPBinPat<Instruction Inst, ValueType ValTy, SDPatternOperator Node, 1328 Predicate Pred = HasDSP> : 1329 DSPPat<(Node ValTy:$a, ValTy:$b), (Inst ValTy:$a, ValTy:$b), Pred>; 1330 1331def : DSPBinPat<ADDQ_PH, v2i16, int_mips_addq_ph>; 1332def : DSPBinPat<ADDQ_PH, v2i16, add>; 1333def : DSPBinPat<SUBQ_PH, v2i16, int_mips_subq_ph>; 1334def : DSPBinPat<SUBQ_PH, v2i16, sub>; 1335def : DSPBinPat<MUL_PH, v2i16, int_mips_mul_ph, HasDSPR2>; 1336def : DSPBinPat<MUL_PH, v2i16, mul, HasDSPR2>; 1337def : DSPBinPat<ADDU_QB, v4i8, int_mips_addu_qb>; 1338def : DSPBinPat<ADDU_QB, v4i8, add>; 1339def : DSPBinPat<SUBU_QB, v4i8, int_mips_subu_qb>; 1340def : DSPBinPat<SUBU_QB, v4i8, sub>; 1341def : DSPBinPat<ADDSC, i32, int_mips_addsc>; 1342def : DSPBinPat<ADDSC, i32, addc>; 1343def : DSPBinPat<ADDWC, i32, int_mips_addwc>; 1344def : DSPBinPat<ADDWC, i32, adde>; 1345 1346// Shift immediate patterns. 1347class DSPShiftPat<Instruction Inst, ValueType ValTy, SDPatternOperator Node, 1348 SDPatternOperator Imm, Predicate Pred = HasDSP> : 1349 DSPPat<(Node ValTy:$a, Imm:$shamt), (Inst ValTy:$a, Imm:$shamt), Pred>; 1350 1351def : DSPShiftPat<SHLL_PH, v2i16, MipsSHLL_DSP, imm>; 1352def : DSPShiftPat<SHRA_PH, v2i16, MipsSHRA_DSP, imm>; 1353def : DSPShiftPat<SHRL_PH, v2i16, MipsSHRL_DSP, imm, HasDSPR2>; 1354def : DSPShiftPat<SHLL_PH, v2i16, int_mips_shll_ph, immZExt4>; 1355def : DSPShiftPat<SHRA_PH, v2i16, int_mips_shra_ph, immZExt4>; 1356def : DSPShiftPat<SHRL_PH, v2i16, int_mips_shrl_ph, immZExt4, HasDSPR2>; 1357def : DSPShiftPat<SHLL_QB, v4i8, MipsSHLL_DSP, imm>; 1358def : DSPShiftPat<SHRA_QB, v4i8, MipsSHRA_DSP, imm, HasDSPR2>; 1359def : DSPShiftPat<SHRL_QB, v4i8, MipsSHRL_DSP, imm>; 1360def : DSPShiftPat<SHLL_QB, v4i8, int_mips_shll_qb, immZExt3>; 1361def : DSPShiftPat<SHRA_QB, v4i8, int_mips_shra_qb, immZExt3, HasDSPR2>; 1362def : DSPShiftPat<SHRL_QB, v4i8, int_mips_shrl_qb, immZExt3>; 1363 1364// SETCC/SELECT_CC patterns. 1365class DSPSetCCPat<Instruction Cmp, Instruction Pick, ValueType ValTy, 1366 CondCode CC> : 1367 DSPPat<(ValTy (MipsSETCC_DSP ValTy:$a, ValTy:$b, CC)), 1368 (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)), 1369 (ValTy (COPY_TO_REGCLASS (ADDiu ZERO, -1), DSPR)), 1370 (ValTy ZERO)))>; 1371 1372class DSPSetCCPatInv<Instruction Cmp, Instruction Pick, ValueType ValTy, 1373 CondCode CC> : 1374 DSPPat<(ValTy (MipsSETCC_DSP ValTy:$a, ValTy:$b, CC)), 1375 (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)), 1376 (ValTy ZERO), 1377 (ValTy (COPY_TO_REGCLASS (ADDiu ZERO, -1), DSPR))))>; 1378 1379class DSPSelectCCPat<Instruction Cmp, Instruction Pick, ValueType ValTy, 1380 CondCode CC> : 1381 DSPPat<(ValTy (MipsSELECT_CC_DSP ValTy:$a, ValTy:$b, ValTy:$c, ValTy:$d, CC)), 1382 (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)), $c, $d))>; 1383 1384class DSPSelectCCPatInv<Instruction Cmp, Instruction Pick, ValueType ValTy, 1385 CondCode CC> : 1386 DSPPat<(ValTy (MipsSELECT_CC_DSP ValTy:$a, ValTy:$b, ValTy:$c, ValTy:$d, CC)), 1387 (ValTy (Pick (ValTy (Cmp ValTy:$a, ValTy:$b)), $d, $c))>; 1388 1389def : DSPSetCCPat<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETEQ>; 1390def : DSPSetCCPat<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETLT>; 1391def : DSPSetCCPat<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETLE>; 1392def : DSPSetCCPatInv<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETNE>; 1393def : DSPSetCCPatInv<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETGE>; 1394def : DSPSetCCPatInv<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETGT>; 1395def : DSPSetCCPat<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETEQ>; 1396def : DSPSetCCPat<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETULT>; 1397def : DSPSetCCPat<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETULE>; 1398def : DSPSetCCPatInv<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETNE>; 1399def : DSPSetCCPatInv<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETUGE>; 1400def : DSPSetCCPatInv<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETUGT>; 1401 1402def : DSPSelectCCPat<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETEQ>; 1403def : DSPSelectCCPat<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETLT>; 1404def : DSPSelectCCPat<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETLE>; 1405def : DSPSelectCCPatInv<PseudoCMP_EQ_PH, PseudoPICK_PH, v2i16, SETNE>; 1406def : DSPSelectCCPatInv<PseudoCMP_LT_PH, PseudoPICK_PH, v2i16, SETGE>; 1407def : DSPSelectCCPatInv<PseudoCMP_LE_PH, PseudoPICK_PH, v2i16, SETGT>; 1408def : DSPSelectCCPat<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETEQ>; 1409def : DSPSelectCCPat<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETULT>; 1410def : DSPSelectCCPat<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETULE>; 1411def : DSPSelectCCPatInv<PseudoCMPU_EQ_QB, PseudoPICK_QB, v4i8, SETNE>; 1412def : DSPSelectCCPatInv<PseudoCMPU_LT_QB, PseudoPICK_QB, v4i8, SETUGE>; 1413def : DSPSelectCCPatInv<PseudoCMPU_LE_QB, PseudoPICK_QB, v4i8, SETUGT>; 1414 1415// Extr patterns. 1416class EXTR_W_TY1_R2_Pat<SDPatternOperator OpNode, Instruction Instr> : 1417 DSPPat<(i32 (OpNode GPR32:$rs, ACC64DSP:$ac)), 1418 (Instr ACC64DSP:$ac, GPR32:$rs)>; 1419 1420class EXTR_W_TY1_R1_Pat<SDPatternOperator OpNode, Instruction Instr> : 1421 DSPPat<(i32 (OpNode immZExt5:$shift, ACC64DSP:$ac)), 1422 (Instr ACC64DSP:$ac, immZExt5:$shift)>; 1423 1424def : EXTR_W_TY1_R1_Pat<MipsEXTP, EXTP>; 1425def : EXTR_W_TY1_R2_Pat<MipsEXTP, EXTPV>; 1426def : EXTR_W_TY1_R1_Pat<MipsEXTPDP, EXTPDP>; 1427def : EXTR_W_TY1_R2_Pat<MipsEXTPDP, EXTPDPV>; 1428def : EXTR_W_TY1_R1_Pat<MipsEXTR_W, EXTR_W>; 1429def : EXTR_W_TY1_R2_Pat<MipsEXTR_W, EXTRV_W>; 1430def : EXTR_W_TY1_R1_Pat<MipsEXTR_R_W, EXTR_R_W>; 1431def : EXTR_W_TY1_R2_Pat<MipsEXTR_R_W, EXTRV_R_W>; 1432def : EXTR_W_TY1_R1_Pat<MipsEXTR_RS_W, EXTR_RS_W>; 1433def : EXTR_W_TY1_R2_Pat<MipsEXTR_RS_W, EXTRV_RS_W>; 1434def : EXTR_W_TY1_R1_Pat<MipsEXTR_S_H, EXTR_S_H>; 1435def : EXTR_W_TY1_R2_Pat<MipsEXTR_S_H, EXTRV_S_H>; 1436 1437// Indexed load patterns. 1438class IndexedLoadPat<SDPatternOperator LoadNode, Instruction Instr> : 1439 DSPPat<(i32 (LoadNode (add i32:$base, i32:$index))), 1440 (Instr i32:$base, i32:$index)>; 1441 1442let AddedComplexity = 20 in { 1443 def : IndexedLoadPat<zextloadi8, LBUX>; 1444 def : IndexedLoadPat<sextloadi16, LHX>; 1445 def : IndexedLoadPat<load, LWX>; 1446} 1447 1448// Instruction alias. 1449let AdditionalPredicates = [NotInMicroMips] in { 1450 def : DSPInstAlias<"wrdsp $rt", (WRDSP GPR32Opnd:$rt, 0x1F), 1>; 1451} 1452