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