xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/MicroMipsInstrInfo.td (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
10b57cec5SDimitry Andric//===--- MicroMipsInstrFormats.td - microMIPS Inst Defs -*- tablegen -*----===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric//
95ffd83dbSDimitry Andric// This files describes the definitions of the microMIPSr3 instructions.
100b57cec5SDimitry Andric//
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andricdef addrimm11 : ComplexPattern<iPTR, 2, "selectIntAddr11MM", [frameindex]>;
140b57cec5SDimitry Andricdef addrimm12 : ComplexPattern<iPTR, 2, "selectIntAddr12MM", [frameindex]>;
150b57cec5SDimitry Andricdef addrimm16 : ComplexPattern<iPTR, 2, "selectIntAddr16MM", [frameindex]>;
160b57cec5SDimitry Andricdef addrimm4lsl2 : ComplexPattern<iPTR, 2, "selectIntAddrLSL2MM", [frameindex]>;
170b57cec5SDimitry Andric
180b57cec5SDimitry Andricdef simm9_addiusp : Operand<i32> {
190b57cec5SDimitry Andric  let EncoderMethod = "getSImm9AddiuspValue";
200b57cec5SDimitry Andric  let DecoderMethod = "DecodeSimm9SP";
210b57cec5SDimitry Andric}
220b57cec5SDimitry Andric
230b57cec5SDimitry Andricdef uimm3_shift : Operand<i32> {
240b57cec5SDimitry Andric  let EncoderMethod = "getUImm3Mod8Encoding";
250b57cec5SDimitry Andric  let DecoderMethod = "DecodePOOL16BEncodedField";
260b57cec5SDimitry Andric}
270b57cec5SDimitry Andric
280b57cec5SDimitry Andricdef simm3_lsa2 : Operand<i32> {
290b57cec5SDimitry Andric  let EncoderMethod = "getSImm3Lsa2Value";
300b57cec5SDimitry Andric  let DecoderMethod = "DecodeAddiur2Simm7";
310b57cec5SDimitry Andric}
320b57cec5SDimitry Andric
330b57cec5SDimitry Andricdef uimm4_andi : Operand<i32> {
340b57cec5SDimitry Andric  let EncoderMethod = "getUImm4AndValue";
350b57cec5SDimitry Andric  let DecoderMethod = "DecodeANDI16Imm";
360b57cec5SDimitry Andric}
370b57cec5SDimitry Andric
380b57cec5SDimitry Andricdef immSExtAddiur2 : ImmLeaf<i32, [{return Imm == 1 || Imm == -1 ||
390b57cec5SDimitry Andric                                           ((Imm % 4 == 0) &&
400b57cec5SDimitry Andric                                            Imm < 28 && Imm > 0);}]>;
410b57cec5SDimitry Andric
420b57cec5SDimitry Andricdef immSExtAddius5 : ImmLeaf<i32, [{return Imm >= -8 && Imm <= 7;}]>;
430b57cec5SDimitry Andric
440b57cec5SDimitry Andricdef immZExtAndi16 : ImmLeaf<i32,
450b57cec5SDimitry Andric  [{return (Imm == 128 || (Imm >= 1 && Imm <= 4) || Imm == 7 || Imm == 8 ||
460b57cec5SDimitry Andric            Imm == 15 || Imm == 16 || Imm == 31 || Imm == 32 || Imm == 63 ||
470b57cec5SDimitry Andric            Imm == 64 || Imm == 255 || Imm == 32768 || Imm == 65535 );}]>;
480b57cec5SDimitry Andric
490b57cec5SDimitry Andricdef immZExt2Shift : ImmLeaf<i32, [{return Imm >= 1 && Imm <= 8;}]>;
500b57cec5SDimitry Andric
510b57cec5SDimitry Andricdef immLi16 : ImmLeaf<i32, [{return Imm >= -1 && Imm <= 126;}]>;
520b57cec5SDimitry Andric
530b57cec5SDimitry Andricdef MicroMipsMemGPRMM16AsmOperand : AsmOperandClass {
540b57cec5SDimitry Andric  let Name = "MicroMipsMem";
550b57cec5SDimitry Andric  let RenderMethod = "addMicroMipsMemOperands";
560b57cec5SDimitry Andric  let ParserMethod = "parseMemOperand";
570b57cec5SDimitry Andric  let PredicateMethod = "isMemWithGRPMM16Base";
580b57cec5SDimitry Andric}
590b57cec5SDimitry Andric
600b57cec5SDimitry Andric// Define the classes of pointers used by microMIPS.
610b57cec5SDimitry Andric// The numbers must match those in MipsRegisterInfo::MipsPtrClass.
620b57cec5SDimitry Andricdef ptr_gpr16mm_rc : PointerLikeRegClass<1>;
630b57cec5SDimitry Andricdef ptr_sp_rc : PointerLikeRegClass<2>;
640b57cec5SDimitry Andricdef ptr_gp_rc : PointerLikeRegClass<3>;
650b57cec5SDimitry Andric
660b57cec5SDimitry Andricclass mem_mm_4_generic : Operand<i32> {
670b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
680b57cec5SDimitry Andric  let MIOperandInfo = (ops ptr_gpr16mm_rc, simm4);
690b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
700b57cec5SDimitry Andric  let ParserMatchClass = MicroMipsMemGPRMM16AsmOperand;
710b57cec5SDimitry Andric}
720b57cec5SDimitry Andric
730b57cec5SDimitry Andricdef mem_mm_4 : mem_mm_4_generic {
740b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm4";
750b57cec5SDimitry Andric}
760b57cec5SDimitry Andric
770b57cec5SDimitry Andricdef mem_mm_4_lsl1 : mem_mm_4_generic {
780b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm4Lsl1";
790b57cec5SDimitry Andric}
800b57cec5SDimitry Andric
810b57cec5SDimitry Andricdef mem_mm_4_lsl2 : mem_mm_4_generic {
820b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm4Lsl2";
830b57cec5SDimitry Andric}
840b57cec5SDimitry Andric
850b57cec5SDimitry Andricdef MicroMipsMemSPAsmOperand : AsmOperandClass {
860b57cec5SDimitry Andric  let Name = "MicroMipsMemSP";
870b57cec5SDimitry Andric  let RenderMethod = "addMemOperands";
880b57cec5SDimitry Andric  let ParserMethod = "parseMemOperand";
890b57cec5SDimitry Andric  let PredicateMethod = "isMemWithUimmWordAlignedOffsetSP<7>";
900b57cec5SDimitry Andric}
910b57cec5SDimitry Andric
920b57cec5SDimitry Andricdef MicroMipsMemGPAsmOperand : AsmOperandClass {
930b57cec5SDimitry Andric  let Name = "MicroMipsMemGP";
940b57cec5SDimitry Andric  let RenderMethod = "addMemOperands";
950b57cec5SDimitry Andric  let ParserMethod = "parseMemOperand";
960b57cec5SDimitry Andric  let PredicateMethod = "isMemWithSimmWordAlignedOffsetGP<9>";
970b57cec5SDimitry Andric}
980b57cec5SDimitry Andric
990b57cec5SDimitry Andricdef mem_mm_sp_imm5_lsl2 : Operand<i32> {
1000b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
1010b57cec5SDimitry Andric  let MIOperandInfo = (ops ptr_sp_rc:$base, simm5:$offset);
1020b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
1030b57cec5SDimitry Andric  let ParserMatchClass = MicroMipsMemSPAsmOperand;
1040b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMSPImm5Lsl2";
1050b57cec5SDimitry Andric}
1060b57cec5SDimitry Andric
1070b57cec5SDimitry Andricdef mem_mm_gp_simm7_lsl2 : Operand<i32> {
1080b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
1090b57cec5SDimitry Andric  let MIOperandInfo = (ops ptr_gp_rc:$base, simm7_lsl2:$offset);
1100b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
1110b57cec5SDimitry Andric  let ParserMatchClass = MicroMipsMemGPAsmOperand;
1120b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMGPImm7Lsl2";
1130b57cec5SDimitry Andric}
1140b57cec5SDimitry Andric
1150b57cec5SDimitry Andricdef mem_mm_9 : Operand<i32> {
1160b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
1170b57cec5SDimitry Andric  let MIOperandInfo = (ops ptr_rc, simm9);
1180b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm9";
119480093f4SDimitry Andric  let ParserMatchClass = MipsMemSimmAsmOperand<9>;
1200b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
1210b57cec5SDimitry Andric}
1220b57cec5SDimitry Andric
1230b57cec5SDimitry Andricdef mem_mm_11 : Operand<i32> {
1240b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
1250b57cec5SDimitry Andric  let MIOperandInfo = (ops GPR32, simm11);
1260b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm11";
127480093f4SDimitry Andric  let ParserMatchClass = MipsMemSimmAsmOperand<11>;
1280b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
1290b57cec5SDimitry Andric}
1300b57cec5SDimitry Andric
1310b57cec5SDimitry Andricdef mem_mm_12 : Operand<i32> {
1320b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
1330b57cec5SDimitry Andric  let MIOperandInfo = (ops ptr_rc, simm12);
1340b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm12";
1350b57cec5SDimitry Andric  let ParserMatchClass = MipsMemAsmOperand;
1360b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
1370b57cec5SDimitry Andric}
1380b57cec5SDimitry Andric
1390b57cec5SDimitry Andricdef mem_mm_16 : Operand<i32> {
1400b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
1410b57cec5SDimitry Andric  let MIOperandInfo = (ops ptr_rc, simm16);
1420b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm16";
1430b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm16";
144480093f4SDimitry Andric  let ParserMatchClass = MipsMemSimmAsmOperand<16>;
1450b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
1460b57cec5SDimitry Andric}
1470b57cec5SDimitry Andric
1480b57cec5SDimitry Andricdef MipsMemUimm4AsmOperand : AsmOperandClass {
1490b57cec5SDimitry Andric  let Name = "MemOffsetUimm4";
1500b57cec5SDimitry Andric  let SuperClasses = [MipsMemAsmOperand];
1510b57cec5SDimitry Andric  let RenderMethod = "addMemOperands";
1520b57cec5SDimitry Andric  let ParserMethod = "parseMemOperand";
1530b57cec5SDimitry Andric  let PredicateMethod = "isMemWithUimmOffsetSP<6>";
1540b57cec5SDimitry Andric}
1550b57cec5SDimitry Andric
1560b57cec5SDimitry Andricdef mem_mm_4sp : Operand<i32> {
1570b57cec5SDimitry Andric  let PrintMethod = "printMemOperand";
1580b57cec5SDimitry Andric  let MIOperandInfo = (ops ptr_sp_rc, uimm8);
1590b57cec5SDimitry Andric  let EncoderMethod = "getMemEncodingMMImm4sp";
1600b57cec5SDimitry Andric  let ParserMatchClass = MipsMemUimm4AsmOperand;
1610b57cec5SDimitry Andric  let OperandType = "OPERAND_MEMORY";
1620b57cec5SDimitry Andric}
1630b57cec5SDimitry Andric
1640b57cec5SDimitry Andricdef jmptarget_mm : Operand<OtherVT> {
1650b57cec5SDimitry Andric  let EncoderMethod = "getJumpTargetOpValueMM";
166*81ad6265SDimitry Andric  let PrintMethod = "printJumpOperand";
1670b57cec5SDimitry Andric}
1680b57cec5SDimitry Andric
1690b57cec5SDimitry Andricdef calltarget_mm : Operand<iPTR> {
1700b57cec5SDimitry Andric  let EncoderMethod = "getJumpTargetOpValueMM";
171*81ad6265SDimitry Andric  let PrintMethod = "printJumpOperand";
1720b57cec5SDimitry Andric}
1730b57cec5SDimitry Andric
1740b57cec5SDimitry Andricdef brtarget7_mm : Operand<OtherVT> {
1750b57cec5SDimitry Andric  let EncoderMethod = "getBranchTarget7OpValueMM";
1760b57cec5SDimitry Andric  let OperandType   = "OPERAND_PCREL";
1770b57cec5SDimitry Andric  let DecoderMethod = "DecodeBranchTarget7MM";
1780b57cec5SDimitry Andric  let ParserMatchClass = MipsJumpTargetAsmOperand;
179*81ad6265SDimitry Andric  let PrintMethod = "printBranchOperand";
1800b57cec5SDimitry Andric}
1810b57cec5SDimitry Andric
1820b57cec5SDimitry Andricdef brtarget10_mm : Operand<OtherVT> {
1830b57cec5SDimitry Andric  let EncoderMethod = "getBranchTargetOpValueMMPC10";
1840b57cec5SDimitry Andric  let OperandType   = "OPERAND_PCREL";
1850b57cec5SDimitry Andric  let DecoderMethod = "DecodeBranchTarget10MM";
1860b57cec5SDimitry Andric  let ParserMatchClass = MipsJumpTargetAsmOperand;
187*81ad6265SDimitry Andric  let PrintMethod = "printBranchOperand";
1880b57cec5SDimitry Andric}
1890b57cec5SDimitry Andric
1900b57cec5SDimitry Andricdef brtarget_mm : Operand<OtherVT> {
1910b57cec5SDimitry Andric  let EncoderMethod = "getBranchTargetOpValueMM";
1920b57cec5SDimitry Andric  let OperandType   = "OPERAND_PCREL";
1930b57cec5SDimitry Andric  let DecoderMethod = "DecodeBranchTargetMM";
1940b57cec5SDimitry Andric  let ParserMatchClass = MipsJumpTargetAsmOperand;
195*81ad6265SDimitry Andric  let PrintMethod = "printBranchOperand";
1960b57cec5SDimitry Andric}
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andricdef simm23_lsl2 : Operand<i32> {
1990b57cec5SDimitry Andric  let EncoderMethod = "getSimm23Lsl2Encoding";
2000b57cec5SDimitry Andric  let DecoderMethod = "DecodeSimm23Lsl2";
2010b57cec5SDimitry Andric}
2020b57cec5SDimitry Andric
203349cc55cSDimitry Andricclass CompactBranchMM<string opstr, DAGOperand opnd, RegisterOperand RO> :
2040b57cec5SDimitry Andric  InstSE<(outs), (ins RO:$rs, opnd:$offset),
2050b57cec5SDimitry Andric         !strconcat(opstr, "\t$rs, $offset"), [], II_BCCZC, FrmI> {
2060b57cec5SDimitry Andric  let isBranch = 1;
2070b57cec5SDimitry Andric  let isTerminator = 1;
2080b57cec5SDimitry Andric  let hasDelaySlot = 0;
2090b57cec5SDimitry Andric  let Defs = [AT];
2100b57cec5SDimitry Andric}
2110b57cec5SDimitry Andric
2120b57cec5SDimitry Andriclet canFoldAsLoad = 1 in
2130b57cec5SDimitry Andricclass LoadLeftRightMM<string opstr, SDNode OpNode, RegisterOperand RO,
2140b57cec5SDimitry Andric                      Operand MemOpnd, InstrItinClass Itin> :
2150b57cec5SDimitry Andric  InstSE<(outs RO:$rt), (ins MemOpnd:$addr, RO:$src),
2160b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"),
2170b57cec5SDimitry Andric         [(set RO:$rt, (OpNode addrimm12:$addr, RO:$src))],
2180b57cec5SDimitry Andric         Itin, FrmI> {
2190b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
2200b57cec5SDimitry Andric  string Constraints = "$src = $rt";
2210b57cec5SDimitry Andric  let BaseOpcode = opstr;
2220b57cec5SDimitry Andric  bit mayLoad = 1;
2230b57cec5SDimitry Andric  bit mayStore = 0;
2240b57cec5SDimitry Andric}
2250b57cec5SDimitry Andric
2260b57cec5SDimitry Andricclass StoreLeftRightMM<string opstr, SDNode OpNode, RegisterOperand RO,
2270b57cec5SDimitry Andric                       Operand MemOpnd, InstrItinClass Itin>:
2280b57cec5SDimitry Andric  InstSE<(outs), (ins RO:$rt, MemOpnd:$addr),
2290b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"),
2300b57cec5SDimitry Andric         [(OpNode RO:$rt, addrimm12:$addr)], Itin, FrmI> {
2310b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
2320b57cec5SDimitry Andric  let BaseOpcode = opstr;
2330b57cec5SDimitry Andric  bit mayLoad = 0;
2340b57cec5SDimitry Andric  bit mayStore = 1;
2350b57cec5SDimitry Andric}
2360b57cec5SDimitry Andric
2370b57cec5SDimitry Andricclass MovePMM16<string opstr, RegisterOperand RO1, RegisterOperand RO2,
2380b57cec5SDimitry Andric                RegisterOperand RO3> :
2390b57cec5SDimitry AndricMicroMipsInst16<(outs RO1:$rd1, RO2:$rd2), (ins RO3:$rs, RO3:$rt),
2400b57cec5SDimitry Andric                 !strconcat(opstr, "\t$rd1, $rd2, $rs, $rt"), [],
2410b57cec5SDimitry Andric                 NoItinerary, FrmR> {
2420b57cec5SDimitry Andric  let isReMaterializable = 1;
2430b57cec5SDimitry Andric  let isMoveReg = 1;
2440b57cec5SDimitry Andric  let DecoderMethod = "DecodeMovePOperands";
2450b57cec5SDimitry Andric}
2460b57cec5SDimitry Andric
247349cc55cSDimitry Andricclass StorePairMM<string opstr>
2480b57cec5SDimitry Andric    :  InstSE<(outs), (ins GPR32Opnd:$rt, GPR32Opnd:$rt2, mem_simm12:$addr),
2490b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"), [], II_SWP, FrmI, opstr> {
2500b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
2510b57cec5SDimitry Andric  let mayStore = 1;
2520b57cec5SDimitry Andric  let AsmMatchConverter = "ConvertXWPOperands";
2530b57cec5SDimitry Andric}
2540b57cec5SDimitry Andric
255349cc55cSDimitry Andricclass LoadPairMM<string opstr>
2560b57cec5SDimitry Andric    : InstSE<(outs GPR32Opnd:$rt, GPR32Opnd:$rt2), (ins mem_simm12:$addr),
2570b57cec5SDimitry Andric          !strconcat(opstr, "\t$rt, $addr"), [], II_LWP, FrmI, opstr> {
2580b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
2590b57cec5SDimitry Andric  let mayLoad = 1;
2600b57cec5SDimitry Andric  let AsmMatchConverter = "ConvertXWPOperands";
2610b57cec5SDimitry Andric}
2620b57cec5SDimitry Andric
2630b57cec5SDimitry Andricclass LLBaseMM<string opstr, RegisterOperand RO> :
2640b57cec5SDimitry Andric  InstSE<(outs RO:$rt), (ins mem_mm_12:$addr),
2650b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"), [], II_LL, FrmI> {
2660b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
2670b57cec5SDimitry Andric  let mayLoad = 1;
2680b57cec5SDimitry Andric}
2690b57cec5SDimitry Andric
2700b57cec5SDimitry Andricclass LLEBaseMM<string opstr, RegisterOperand RO> :
2710b57cec5SDimitry Andric  InstSE<(outs RO:$rt), (ins mem_simm9:$addr),
2720b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"), [], II_LLE, FrmI> {
2730b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm9";
2740b57cec5SDimitry Andric  string BaseOpcode = opstr;
2750b57cec5SDimitry Andric  let mayLoad = 1;
2760b57cec5SDimitry Andric}
2770b57cec5SDimitry Andric
2780b57cec5SDimitry Andricclass SCBaseMM<string opstr, RegisterOperand RO> :
2790b57cec5SDimitry Andric  InstSE<(outs RO:$dst), (ins RO:$rt, mem_mm_12:$addr),
2800b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"), [], II_SC, FrmI> {
2810b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
2820b57cec5SDimitry Andric  let mayStore = 1;
2830b57cec5SDimitry Andric  let Constraints = "$rt = $dst";
2840b57cec5SDimitry Andric}
2850b57cec5SDimitry Andric
2860b57cec5SDimitry Andricclass SCEBaseMM<string opstr, RegisterOperand RO> :
2870b57cec5SDimitry Andric  InstSE<(outs RO:$dst), (ins RO:$rt, mem_simm9:$addr),
2880b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"), [], II_SCE, FrmI> {
2890b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm9";
2900b57cec5SDimitry Andric  string BaseOpcode = opstr;
2910b57cec5SDimitry Andric  let mayStore = 1;
2920b57cec5SDimitry Andric  let Constraints = "$rt = $dst";
2930b57cec5SDimitry Andric}
2940b57cec5SDimitry Andric
2950b57cec5SDimitry Andricclass LoadMM<string opstr, DAGOperand RO, SDPatternOperator OpNode = null_frag,
2960b57cec5SDimitry Andric             InstrItinClass Itin = NoItinerary, DAGOperand MO = mem_mm_12> :
2970b57cec5SDimitry Andric  InstSE<(outs RO:$rt), (ins MO:$addr),
2980b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"),
2990b57cec5SDimitry Andric         [(set RO:$rt, (OpNode addrimm12:$addr))], Itin, FrmI, opstr> {
3000b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
3010b57cec5SDimitry Andric  let canFoldAsLoad = 1;
3020b57cec5SDimitry Andric  let mayLoad = 1;
3030b57cec5SDimitry Andric}
3040b57cec5SDimitry Andric
3050b57cec5SDimitry Andricclass ArithRMM16<string opstr, RegisterOperand RO, bit isComm = 0,
3060b57cec5SDimitry Andric                 InstrItinClass Itin = NoItinerary,
3070b57cec5SDimitry Andric                 SDPatternOperator OpNode = null_frag> :
3080b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rd), (ins RO:$rs, RO:$rt),
3090b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rd, $rs, $rt"),
3100b57cec5SDimitry Andric                  [(set RO:$rd, (OpNode RO:$rs, RO:$rt))], Itin, FrmR> {
3110b57cec5SDimitry Andric  let isCommutable = isComm;
3120b57cec5SDimitry Andric}
3130b57cec5SDimitry Andric
3140b57cec5SDimitry Andricclass AndImmMM16<string opstr, RegisterOperand RO,
3150b57cec5SDimitry Andric                 InstrItinClass Itin = NoItinerary> :
3160b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rd), (ins RO:$rs, uimm4_andi:$imm),
3170b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rd, $rs, $imm"), [], Itin, FrmI>;
3180b57cec5SDimitry Andric
3190b57cec5SDimitry Andricclass LogicRMM16<string opstr, RegisterOperand RO,
3200b57cec5SDimitry Andric                 InstrItinClass Itin = NoItinerary,
3210b57cec5SDimitry Andric                 SDPatternOperator OpNode = null_frag> :
3220b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$dst), (ins RO:$rs, RO:$rt),
3230b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $rs"),
3240b57cec5SDimitry Andric         [(set RO:$dst, (OpNode RO:$rs, RO:$rt))], Itin, FrmR> {
3250b57cec5SDimitry Andric  let isCommutable = 1;
3260b57cec5SDimitry Andric  let Constraints = "$rt = $dst";
3270b57cec5SDimitry Andric}
3280b57cec5SDimitry Andric
3290b57cec5SDimitry Andricclass NotMM16<string opstr, RegisterOperand RO> :
3300b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rt), (ins RO:$rs),
3310b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $rs"),
3320b57cec5SDimitry Andric         [(set RO:$rt, (not RO:$rs))], II_NOT, FrmR>;
3330b57cec5SDimitry Andric
3340b57cec5SDimitry Andricclass ShiftIMM16<string opstr, Operand ImmOpnd, RegisterOperand RO,
3350b57cec5SDimitry Andric                 InstrItinClass Itin = NoItinerary> :
3360b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rd), (ins RO:$rt, ImmOpnd:$shamt),
3370b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rd, $rt, $shamt"), [], Itin, FrmR>;
3380b57cec5SDimitry Andric
339349cc55cSDimitry Andricclass LoadMM16<string opstr, DAGOperand RO,
3400b57cec5SDimitry Andric               InstrItinClass Itin, Operand MemOpnd> :
3410b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rt), (ins MemOpnd:$addr),
3420b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI> {
3430b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm4";
3440b57cec5SDimitry Andric  let canFoldAsLoad = 1;
3450b57cec5SDimitry Andric  let mayLoad = 1;
3460b57cec5SDimitry Andric}
3470b57cec5SDimitry Andric
348349cc55cSDimitry Andricclass StoreMM16<string opstr, DAGOperand RTOpnd, InstrItinClass Itin,
3490b57cec5SDimitry Andric                Operand MemOpnd> :
3500b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins RTOpnd:$rt, MemOpnd:$addr),
3510b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI> {
3520b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm4";
3530b57cec5SDimitry Andric  let mayStore = 1;
3540b57cec5SDimitry Andric}
3550b57cec5SDimitry Andric
3560b57cec5SDimitry Andricclass LoadSPMM16<string opstr, DAGOperand RO, InstrItinClass Itin,
3570b57cec5SDimitry Andric                 Operand MemOpnd> :
3580b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rt), (ins MemOpnd:$offset),
3590b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rt, $offset"), [], Itin, FrmI> {
3600b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMSPImm5Lsl2";
3610b57cec5SDimitry Andric  let canFoldAsLoad = 1;
3620b57cec5SDimitry Andric  let mayLoad = 1;
3630b57cec5SDimitry Andric}
3640b57cec5SDimitry Andric
3650b57cec5SDimitry Andricclass StoreSPMM16<string opstr, DAGOperand RO, InstrItinClass Itin,
3660b57cec5SDimitry Andric                  Operand MemOpnd> :
3670b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins RO:$rt, MemOpnd:$offset),
3680b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rt, $offset"), [], Itin, FrmI> {
3690b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMSPImm5Lsl2";
3700b57cec5SDimitry Andric  let mayStore = 1;
3710b57cec5SDimitry Andric}
3720b57cec5SDimitry Andric
3730b57cec5SDimitry Andricclass LoadGPMM16<string opstr, DAGOperand RO, InstrItinClass Itin,
3740b57cec5SDimitry Andric                 Operand MemOpnd> :
3750b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rt), (ins MemOpnd:$offset),
3760b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rt, $offset"), [], Itin, FrmI> {
3770b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMGPImm7Lsl2";
3780b57cec5SDimitry Andric  let canFoldAsLoad = 1;
3790b57cec5SDimitry Andric  let mayLoad = 1;
3800b57cec5SDimitry Andric}
3810b57cec5SDimitry Andric
3820b57cec5SDimitry Andricclass AddImmUR2<string opstr, RegisterOperand RO> :
3830b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rd), (ins RO:$rs, simm3_lsa2:$imm),
3840b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rd, $rs, $imm"),
3850b57cec5SDimitry Andric                  [], II_ADDIU, FrmR> {
3860b57cec5SDimitry Andric  let isCommutable = 1;
3870b57cec5SDimitry Andric}
3880b57cec5SDimitry Andric
3890b57cec5SDimitry Andricclass AddImmUS5<string opstr, RegisterOperand RO> :
3900b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$dst), (ins RO:$rd, simm4:$imm),
3910b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rd, $imm"), [], II_ADDIU, FrmR> {
3920b57cec5SDimitry Andric  let Constraints = "$rd = $dst";
3930b57cec5SDimitry Andric}
3940b57cec5SDimitry Andric
3950b57cec5SDimitry Andricclass AddImmUR1SP<string opstr, RegisterOperand RO> :
3960b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rd), (ins uimm6_lsl2:$imm),
3970b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rd, $imm"), [], II_ADDIU, FrmR>;
3980b57cec5SDimitry Andric
3990b57cec5SDimitry Andricclass AddImmUSP<string opstr> :
4000b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins simm9_addiusp:$imm),
4010b57cec5SDimitry Andric                  !strconcat(opstr, "\t$imm"), [], II_ADDIU, FrmI>;
4020b57cec5SDimitry Andric
4030b57cec5SDimitry Andricclass MoveFromHILOMM<string opstr, RegisterOperand RO, Register UseReg> :
4040b57cec5SDimitry Andric      MicroMipsInst16<(outs RO:$rd), (ins), !strconcat(opstr, "\t$rd"),
4050b57cec5SDimitry Andric  [], II_MFHI_MFLO, FrmR> {
4060b57cec5SDimitry Andric  let Uses = [UseReg];
4070b57cec5SDimitry Andric  let hasSideEffects = 0;
4080b57cec5SDimitry Andric  let isMoveReg = 1;
4090b57cec5SDimitry Andric}
4100b57cec5SDimitry Andric
4110b57cec5SDimitry Andricclass MoveMM16<string opstr, RegisterOperand RO>
4120b57cec5SDimitry Andric    :  MicroMipsInst16<(outs RO:$rd), (ins RO:$rs),
4130b57cec5SDimitry Andric                       !strconcat(opstr, "\t$rd, $rs"), [], II_MOVE, FrmR> {
4140b57cec5SDimitry Andric  let isReMaterializable = 1;
4150b57cec5SDimitry Andric  let isMoveReg = 1;
4160b57cec5SDimitry Andric}
4170b57cec5SDimitry Andric
4180b57cec5SDimitry Andricclass LoadImmMM16<string opstr, Operand Od, RegisterOperand RO> :
4190b57cec5SDimitry Andric  MicroMipsInst16<(outs RO:$rd), (ins Od:$imm),
4200b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rd, $imm"), [], II_LI, FrmI> {
4210b57cec5SDimitry Andric  let isReMaterializable = 1;
4220b57cec5SDimitry Andric}
4230b57cec5SDimitry Andric
4240b57cec5SDimitry Andric// 16-bit Jump and Link (Call)
4250b57cec5SDimitry Andricclass JumpLinkRegMM16<string opstr, RegisterOperand RO> :
4260b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"),
4270b57cec5SDimitry Andric           [(MipsJmpLink RO:$rs)], II_JALR, FrmR> {
4280b57cec5SDimitry Andric  let isCall = 1;
4290b57cec5SDimitry Andric  let hasDelaySlot = 1;
4300b57cec5SDimitry Andric  let Defs = [RA];
4310b57cec5SDimitry Andric  let hasPostISelHook = 1;
4320b57cec5SDimitry Andric}
4330b57cec5SDimitry Andric
4340b57cec5SDimitry Andric// 16-bit Jump Reg
4350b57cec5SDimitry Andricclass JumpRegMM16<string opstr, RegisterOperand RO> :
4360b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"),
4370b57cec5SDimitry Andric           [], II_JR, FrmR> {
4380b57cec5SDimitry Andric  let hasDelaySlot = 1;
4390b57cec5SDimitry Andric  let isBranch = 1;
4400b57cec5SDimitry Andric  let isIndirectBranch = 1;
4410b57cec5SDimitry Andric}
4420b57cec5SDimitry Andric
4430b57cec5SDimitry Andric// Base class for JRADDIUSP instruction.
4440b57cec5SDimitry Andricclass JumpRAddiuStackMM16 :
4450b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins uimm5_lsl2:$imm), "jraddiusp\t$imm",
4460b57cec5SDimitry Andric                  [], II_JRADDIUSP, FrmR> {
4470b57cec5SDimitry Andric  let isTerminator = 1;
4480b57cec5SDimitry Andric  let isBarrier = 1;
4490b57cec5SDimitry Andric  let isBranch = 1;
4500b57cec5SDimitry Andric  let isIndirectBranch = 1;
4510b57cec5SDimitry Andric}
4520b57cec5SDimitry Andric
4530b57cec5SDimitry Andric// 16-bit Jump and Link (Call) - Short Delay Slot
4540b57cec5SDimitry Andricclass JumpLinkRegSMM16<string opstr, RegisterOperand RO> :
4550b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"),
4560b57cec5SDimitry Andric           [], II_JALRS, FrmR> {
4570b57cec5SDimitry Andric  let isCall = 1;
4580b57cec5SDimitry Andric  let hasDelaySlot = 1;
4590b57cec5SDimitry Andric  let Defs = [RA];
4600b57cec5SDimitry Andric}
4610b57cec5SDimitry Andric
4620b57cec5SDimitry Andric// 16-bit Jump Register Compact - No delay slot
4630b57cec5SDimitry Andricclass JumpRegCMM16<string opstr, RegisterOperand RO> :
4640b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"),
4650b57cec5SDimitry Andric                  [], II_JRC, FrmR> {
4660b57cec5SDimitry Andric  let isTerminator = 1;
4670b57cec5SDimitry Andric  let isBarrier = 1;
4680b57cec5SDimitry Andric  let isBranch = 1;
4690b57cec5SDimitry Andric  let isIndirectBranch = 1;
4700b57cec5SDimitry Andric}
4710b57cec5SDimitry Andric
4720b57cec5SDimitry Andric// Break16 and Sdbbp16
4730b57cec5SDimitry Andricclass BrkSdbbp16MM<string opstr, InstrItinClass Itin> :
4740b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins uimm4:$code_),
4750b57cec5SDimitry Andric                  !strconcat(opstr, "\t$code_"),
4760b57cec5SDimitry Andric                  [], Itin, FrmOther>;
4770b57cec5SDimitry Andric
4780b57cec5SDimitry Andricclass CBranchZeroMM<string opstr, DAGOperand opnd, RegisterOperand RO> :
4790b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins RO:$rs, opnd:$offset),
4800b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rs, $offset"), [], II_BCCZ, FrmI> {
4810b57cec5SDimitry Andric  let isBranch = 1;
4820b57cec5SDimitry Andric  let isTerminator = 1;
4830b57cec5SDimitry Andric  let hasDelaySlot = 1;
4840b57cec5SDimitry Andric  let Defs = [AT];
4850b57cec5SDimitry Andric}
4860b57cec5SDimitry Andric
4870b57cec5SDimitry Andric// MicroMIPS Jump and Link (Call) - Short Delay Slot
4880b57cec5SDimitry Andriclet isCall = 1, hasDelaySlot = 1, Defs = [RA] in {
4890b57cec5SDimitry Andric  class JumpLinkMM<string opstr, DAGOperand opnd> :
4900b57cec5SDimitry Andric    InstSE<(outs), (ins opnd:$target), !strconcat(opstr, "\t$target"),
4910b57cec5SDimitry Andric           [], II_JALS, FrmJ, opstr> {
4920b57cec5SDimitry Andric    let DecoderMethod = "DecodeJumpTargetMM";
4930b57cec5SDimitry Andric  }
4940b57cec5SDimitry Andric
4950b57cec5SDimitry Andric  class JumpLinkRegMM<string opstr, RegisterOperand RO>:
4960b57cec5SDimitry Andric    InstSE<(outs RO:$rd), (ins RO:$rs), !strconcat(opstr, "\t$rd, $rs"),
4970b57cec5SDimitry Andric            [], II_JALRS, FrmR>;
4980b57cec5SDimitry Andric
4990b57cec5SDimitry Andric  class BranchCompareToZeroLinkMM<string opstr, DAGOperand opnd,
5000b57cec5SDimitry Andric                                  RegisterOperand RO> :
5010b57cec5SDimitry Andric    InstSE<(outs), (ins RO:$rs, opnd:$offset),
5020b57cec5SDimitry Andric           !strconcat(opstr, "\t$rs, $offset"), [], II_BCCZALS, FrmI, opstr>;
5030b57cec5SDimitry Andric}
5040b57cec5SDimitry Andric
505349cc55cSDimitry Andricclass LoadWordIndexedScaledMM<string opstr, RegisterOperand RO> :
5060b57cec5SDimitry Andric  InstSE<(outs RO:$rd), (ins PtrRC:$base, PtrRC:$index),
5070b57cec5SDimitry Andric         !strconcat(opstr, "\t$rd, ${index}(${base})"), [], II_LWXS, FrmFI>;
5080b57cec5SDimitry Andric
5090b57cec5SDimitry Andricclass PrefetchIndexed<string opstr> :
5100b57cec5SDimitry Andric  InstSE<(outs), (ins PtrRC:$base, PtrRC:$index, uimm5:$hint),
511480093f4SDimitry Andric         !strconcat(opstr, "\t$hint, ${index}(${base})"),
512480093f4SDimitry Andric         [], II_PREF, FrmOther>;
5130b57cec5SDimitry Andric
5140b57cec5SDimitry Andricclass AddImmUPC<string opstr, RegisterOperand RO> :
5150b57cec5SDimitry Andric  InstSE<(outs RO:$rs), (ins simm23_lsl2:$imm),
5160b57cec5SDimitry Andric         !strconcat(opstr, "\t$rs, $imm"), [], II_ADDIU, FrmR>;
5170b57cec5SDimitry Andric
5180b57cec5SDimitry Andric/// A list of registers used by load/store multiple instructions.
5190b57cec5SDimitry Andricdef RegListAsmOperand : AsmOperandClass {
5200b57cec5SDimitry Andric  let Name = "RegList";
5210b57cec5SDimitry Andric  let ParserMethod = "parseRegisterList";
5220b57cec5SDimitry Andric}
5230b57cec5SDimitry Andric
5240b57cec5SDimitry Andricdef reglist : Operand<i32> {
5250b57cec5SDimitry Andric  let EncoderMethod = "getRegisterListOpValue";
5260b57cec5SDimitry Andric  let ParserMatchClass = RegListAsmOperand;
5270b57cec5SDimitry Andric  let PrintMethod = "printRegisterList";
5280b57cec5SDimitry Andric  let DecoderMethod = "DecodeRegListOperand";
5290b57cec5SDimitry Andric}
5300b57cec5SDimitry Andric
5310b57cec5SDimitry Andricdef RegList16AsmOperand : AsmOperandClass {
5320b57cec5SDimitry Andric  let Name = "RegList16";
5330b57cec5SDimitry Andric  let ParserMethod = "parseRegisterList";
5340b57cec5SDimitry Andric  let PredicateMethod = "isRegList16";
5350b57cec5SDimitry Andric  let RenderMethod = "addRegListOperands";
5360b57cec5SDimitry Andric}
5370b57cec5SDimitry Andric
5380b57cec5SDimitry Andricdef reglist16 : Operand<i32> {
5390b57cec5SDimitry Andric  let EncoderMethod = "getRegisterListOpValue16";
5400b57cec5SDimitry Andric  let DecoderMethod = "DecodeRegListOperand16";
5410b57cec5SDimitry Andric  let PrintMethod = "printRegisterList";
5420b57cec5SDimitry Andric  let ParserMatchClass = RegList16AsmOperand;
5430b57cec5SDimitry Andric}
5440b57cec5SDimitry Andric
545349cc55cSDimitry Andricclass StoreMultMM<string opstr, InstrItinClass Itin> :
5460b57cec5SDimitry Andric  InstSE<(outs), (ins reglist:$rt, mem_mm_12:$addr),
5470b57cec5SDimitry Andric         !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI, opstr> {
5480b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
5490b57cec5SDimitry Andric  let mayStore = 1;
5500b57cec5SDimitry Andric}
5510b57cec5SDimitry Andric
552349cc55cSDimitry Andricclass LoadMultMM<string opstr, InstrItinClass Itin> :
5530b57cec5SDimitry Andric  InstSE<(outs reglist:$rt), (ins mem_mm_12:$addr),
5540b57cec5SDimitry Andric          !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI, opstr> {
5550b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm12";
5560b57cec5SDimitry Andric  let mayLoad = 1;
5570b57cec5SDimitry Andric}
5580b57cec5SDimitry Andric
559349cc55cSDimitry Andricclass StoreMultMM16<string opstr, InstrItinClass Itin> :
5600b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins reglist16:$rt, mem_mm_4sp:$addr),
5610b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI> {
5620b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMReglistImm4Lsl2";
5630b57cec5SDimitry Andric  let mayStore = 1;
5640b57cec5SDimitry Andric}
5650b57cec5SDimitry Andric
566349cc55cSDimitry Andricclass LoadMultMM16<string opstr, InstrItinClass Itin> :
5670b57cec5SDimitry Andric  MicroMipsInst16<(outs reglist16:$rt), (ins mem_mm_4sp:$addr),
5680b57cec5SDimitry Andric                  !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI> {
5690b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMReglistImm4Lsl2";
5700b57cec5SDimitry Andric  let mayLoad = 1;
5710b57cec5SDimitry Andric}
5720b57cec5SDimitry Andric
5730b57cec5SDimitry Andricclass UncondBranchMM16<string opstr> :
5740b57cec5SDimitry Andric  MicroMipsInst16<(outs), (ins brtarget10_mm:$offset),
5750b57cec5SDimitry Andric                  !strconcat(opstr, "\t$offset"),
5760b57cec5SDimitry Andric                  [], II_B, FrmI> {
5770b57cec5SDimitry Andric  let isBranch = 1;
5780b57cec5SDimitry Andric  let isTerminator = 1;
5790b57cec5SDimitry Andric  let isBarrier = 1;
5800b57cec5SDimitry Andric  let hasDelaySlot = 1;
5810b57cec5SDimitry Andric  let Predicates = [RelocPIC, InMicroMips];
5820b57cec5SDimitry Andric  let Defs = [AT];
5830b57cec5SDimitry Andric}
5840b57cec5SDimitry Andric
5850b57cec5SDimitry Andricclass HypcallMM<string opstr> :
5860b57cec5SDimitry Andric  InstSE<(outs), (ins uimm10:$code_),
5870b57cec5SDimitry Andric          !strconcat(opstr, "\t$code_"), [], II_HYPCALL, FrmOther> {
5880b57cec5SDimitry Andric  let BaseOpcode = opstr;
5890b57cec5SDimitry Andric}
5900b57cec5SDimitry Andric
5910b57cec5SDimitry Andricclass TLBINVMM<string opstr, InstrItinClass Itin> :
5920b57cec5SDimitry Andric  InstSE<(outs), (ins), opstr, [], Itin, FrmOther> {
5930b57cec5SDimitry Andric  let BaseOpcode = opstr;
5940b57cec5SDimitry Andric}
5950b57cec5SDimitry Andric
5960b57cec5SDimitry Andricclass MfCop0MM<string opstr, RegisterOperand DstRC,
5970b57cec5SDimitry Andric               RegisterOperand SrcRC, InstrItinClass Itin> :
5980b57cec5SDimitry Andric  InstSE<(outs DstRC:$rt), (ins SrcRC:$rs, uimm3:$sel),
5990b57cec5SDimitry Andric          !strconcat(opstr, "\t$rt, $rs, $sel"), [], Itin, FrmR> {
6000b57cec5SDimitry Andric  let BaseOpcode = opstr;
6010b57cec5SDimitry Andric}
6020b57cec5SDimitry Andric
6030b57cec5SDimitry Andricclass MtCop0MM<string opstr, RegisterOperand DstRC,
6040b57cec5SDimitry Andric               RegisterOperand SrcRC, InstrItinClass Itin> :
6050b57cec5SDimitry Andric  InstSE<(outs DstRC:$rs), (ins SrcRC:$rt, uimm3:$sel),
6060b57cec5SDimitry Andric          !strconcat(opstr, "\t$rt, $rs, $sel"), [], Itin, FrmR> {
6070b57cec5SDimitry Andric  let BaseOpcode = opstr;
6080b57cec5SDimitry Andric}
6090b57cec5SDimitry Andric
6100b57cec5SDimitry Andriclet FastISelShouldIgnore = 1 in {
6110b57cec5SDimitry Andric  def ADDU16_MM : ArithRMM16<"addu16", GPRMM16Opnd, 1, II_ADDU, add>,
6120b57cec5SDimitry Andric      ARITH_FM_MM16<0>, ISA_MICROMIPS32_NOT_MIPS32R6;
6130b57cec5SDimitry Andric  def AND16_MM : LogicRMM16<"and16", GPRMM16Opnd, II_AND, and>,
6140b57cec5SDimitry Andric      LOGIC_FM_MM16<0x2>, ISA_MICROMIPS32_NOT_MIPS32R6;
6150b57cec5SDimitry Andric}
6160b57cec5SDimitry Andric
6170b57cec5SDimitry Andricdef ANDI16_MM : AndImmMM16<"andi16", GPRMM16Opnd, II_AND>, ANDI_FM_MM16<0x0b>,
6180b57cec5SDimitry Andric                ISA_MICROMIPS32_NOT_MIPS32R6;
6190b57cec5SDimitry Andricdef NOT16_MM : NotMM16<"not16", GPRMM16Opnd>, LOGIC_FM_MM16<0x0>,
6200b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
6210b57cec5SDimitry Andriclet FastISelShouldIgnore = 1 in
6220b57cec5SDimitry Andric  def OR16_MM : LogicRMM16<"or16", GPRMM16Opnd, II_OR, or>, LOGIC_FM_MM16<0x3>,
6230b57cec5SDimitry Andric                ISA_MICROMIPS32_NOT_MIPS32R6;
6240b57cec5SDimitry Andricdef SLL16_MM : ShiftIMM16<"sll16", uimm3_shift, GPRMM16Opnd, II_SLL>,
6250b57cec5SDimitry Andric    SHIFT_FM_MM16<0>, ISA_MICROMIPS32_NOT_MIPS32R6;
6260b57cec5SDimitry Andricdef SRL16_MM : ShiftIMM16<"srl16", uimm3_shift, GPRMM16Opnd, II_SRL>,
6270b57cec5SDimitry Andric    SHIFT_FM_MM16<1>, ISA_MICROMIPS32_NOT_MIPS32R6;
6280b57cec5SDimitry Andric
6290b57cec5SDimitry Andriclet FastISelShouldIgnore = 1 in {
6300b57cec5SDimitry Andric  def SUBU16_MM : ArithRMM16<"subu16", GPRMM16Opnd, 0, II_SUBU, sub>,
6310b57cec5SDimitry Andric                  ARITH_FM_MM16<1>, ISA_MICROMIPS32_NOT_MIPS32R6;
6320b57cec5SDimitry Andric  def XOR16_MM : LogicRMM16<"xor16", GPRMM16Opnd, II_XOR, xor>,
6330b57cec5SDimitry Andric                 LOGIC_FM_MM16<0x1>, ISA_MICROMIPS32_NOT_MIPS32R6;
6340b57cec5SDimitry Andric}
635349cc55cSDimitry Andricdef LBU16_MM : LoadMM16<"lbu16", GPRMM16Opnd, II_LBU, mem_mm_4>,
636349cc55cSDimitry Andric               LOAD_STORE_FM_MM16<0x02>, ISA_MICROMIPS;
637349cc55cSDimitry Andricdef LHU16_MM : LoadMM16<"lhu16", GPRMM16Opnd, II_LHU, mem_mm_4_lsl1>,
638349cc55cSDimitry Andric               LOAD_STORE_FM_MM16<0x0a>, ISA_MICROMIPS;
639349cc55cSDimitry Andricdef LW16_MM : LoadMM16<"lw16", GPRMM16Opnd, II_LW, mem_mm_4_lsl2>,
6400b57cec5SDimitry Andric                      LOAD_STORE_FM_MM16<0x1a>, ISA_MICROMIPS;
641349cc55cSDimitry Andricdef SB16_MM : StoreMM16<"sb16", GPRMM16OpndZero, II_SB, mem_mm_4>,
642349cc55cSDimitry Andric              LOAD_STORE_FM_MM16<0x22>,
6430b57cec5SDimitry Andric              ISA_MICROMIPS32_NOT_MIPS32R6;
644349cc55cSDimitry Andricdef SH16_MM : StoreMM16<"sh16", GPRMM16OpndZero, II_SH, mem_mm_4_lsl1>,
645349cc55cSDimitry Andric              LOAD_STORE_FM_MM16<0x2a>,
646349cc55cSDimitry Andric              ISA_MICROMIPS32_NOT_MIPS32R6;
647349cc55cSDimitry Andricdef SW16_MM : StoreMM16<"sw16", GPRMM16OpndZero, II_SW, mem_mm_4_lsl2>,
648349cc55cSDimitry Andric              LOAD_STORE_FM_MM16<0x3a>,
6490b57cec5SDimitry Andric              ISA_MICROMIPS32_NOT_MIPS32R6;
6500b57cec5SDimitry Andricdef LWGP_MM : LoadGPMM16<"lw", GPRMM16Opnd, II_LW, mem_mm_gp_simm7_lsl2>,
6510b57cec5SDimitry Andric                         LOAD_GP_FM_MM16<0x19>, ISA_MICROMIPS;
6520b57cec5SDimitry Andricdef LWSP_MM : LoadSPMM16<"lw", GPR32Opnd, II_LW, mem_mm_sp_imm5_lsl2>,
6530b57cec5SDimitry Andric              LOAD_STORE_SP_FM_MM16<0x12>, ISA_MICROMIPS;
6540b57cec5SDimitry Andricdef SWSP_MM : StoreSPMM16<"swsp", GPR32Opnd, II_SW, mem_mm_sp_imm5_lsl2>,
6550b57cec5SDimitry Andric              LOAD_STORE_SP_FM_MM16<0x32>, ISA_MICROMIPS32_NOT_MIPS32R6;
6560b57cec5SDimitry Andricdef ADDIUR1SP_MM : AddImmUR1SP<"addiur1sp", GPRMM16Opnd>, ADDIUR1SP_FM_MM16,
6570b57cec5SDimitry Andric                   ISA_MICROMIPS;
6580b57cec5SDimitry Andricdef ADDIUR2_MM : AddImmUR2<"addiur2", GPRMM16Opnd>, ADDIUR2_FM_MM16,
6590b57cec5SDimitry Andric                 ISA_MICROMIPS;
6600b57cec5SDimitry Andricdef ADDIUS5_MM : AddImmUS5<"addius5", GPR32Opnd>, ADDIUS5_FM_MM16,
6610b57cec5SDimitry Andric                 ISA_MICROMIPS;
6620b57cec5SDimitry Andricdef ADDIUSP_MM : AddImmUSP<"addiusp">, ADDIUSP_FM_MM16, ISA_MICROMIPS;
6630b57cec5SDimitry Andricdef MFHI16_MM : MoveFromHILOMM<"mfhi16", GPR32Opnd, AC0>,
6640b57cec5SDimitry Andric                MFHILO_FM_MM16<0x10>, ISA_MICROMIPS32_NOT_MIPS32R6;
6650b57cec5SDimitry Andricdef MFLO16_MM : MoveFromHILOMM<"mflo16", GPR32Opnd, AC0>,
6660b57cec5SDimitry Andric                MFHILO_FM_MM16<0x12>, ISA_MICROMIPS32_NOT_MIPS32R6;
6670b57cec5SDimitry Andricdef MOVE16_MM : MoveMM16<"move", GPR32Opnd>, MOVE_FM_MM16<0x03>,
6680b57cec5SDimitry Andric                ISA_MICROMIPS32_NOT_MIPS32R6;
6690b57cec5SDimitry Andricdef MOVEP_MM : MovePMM16<"movep", GPRMM16OpndMovePPairFirst,
6700b57cec5SDimitry Andric                         GPRMM16OpndMovePPairSecond, GPRMM16OpndMoveP>,
6710b57cec5SDimitry Andric               MOVEP_FM_MM16, ISA_MICROMIPS32_NOT_MIPS32R6;
6720b57cec5SDimitry Andricdef LI16_MM : LoadImmMM16<"li16", li16_imm, GPRMM16Opnd>, LI_FM_MM16,
6730b57cec5SDimitry Andric              IsAsCheapAsAMove, ISA_MICROMIPS32_NOT_MIPS32R6;
6740b57cec5SDimitry Andricdef JALR16_MM : JumpLinkRegMM16<"jalr", GPR32Opnd>, JALR_FM_MM16<0x0e>,
6750b57cec5SDimitry Andric                ISA_MICROMIPS32_NOT_MIPS32R6;
6760b57cec5SDimitry Andricdef JALRS16_MM : JumpLinkRegSMM16<"jalrs16", GPR32Opnd>, JALR_FM_MM16<0x0f>,
6770b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
6780b57cec5SDimitry Andricdef JRC16_MM : JumpRegCMM16<"jrc", GPR32Opnd>, JALR_FM_MM16<0x0d>,
6790b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
6800b57cec5SDimitry Andricdef JRADDIUSP : JumpRAddiuStackMM16, JRADDIUSP_FM_MM16<0x18>,
6810b57cec5SDimitry Andric                ISA_MICROMIPS32_NOT_MIPS32R6;
6820b57cec5SDimitry Andricdef JR16_MM : JumpRegMM16<"jr16", GPR32Opnd>, JALR_FM_MM16<0x0c>,
6830b57cec5SDimitry Andric              ISA_MICROMIPS32_NOT_MIPS32R6;
6840b57cec5SDimitry Andricdef BEQZ16_MM : CBranchZeroMM<"beqz16", brtarget7_mm, GPRMM16Opnd>,
6850b57cec5SDimitry Andric                BEQNEZ_FM_MM16<0x23>, ISA_MICROMIPS32_NOT_MIPS32R6;
6860b57cec5SDimitry Andricdef BNEZ16_MM : CBranchZeroMM<"bnez16", brtarget7_mm, GPRMM16Opnd>,
6870b57cec5SDimitry Andric                BEQNEZ_FM_MM16<0x2b>, ISA_MICROMIPS32_NOT_MIPS32R6;
6880b57cec5SDimitry Andricdef B16_MM : UncondBranchMM16<"b16">, B16_FM, ISA_MICROMIPS32_NOT_MIPS32R6;
6890b57cec5SDimitry Andricdef BREAK16_MM : BrkSdbbp16MM<"break16", II_BREAK>, BRKSDBBP16_FM_MM<0x28>,
6900b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
6910b57cec5SDimitry Andricdef SDBBP16_MM : BrkSdbbp16MM<"sdbbp16", II_SDBBP>, BRKSDBBP16_FM_MM<0x2C>,
6920b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
6930b57cec5SDimitry Andric
6940b57cec5SDimitry Andricclass WaitMM<string opstr> :
6950b57cec5SDimitry Andric  InstSE<(outs), (ins uimm10:$code_), !strconcat(opstr, "\t$code_"), [],
6960b57cec5SDimitry Andric         II_WAIT, FrmOther, opstr>;
6970b57cec5SDimitry Andric
6980b57cec5SDimitry Andriclet DecoderNamespace = "MicroMips" in {
6990b57cec5SDimitry Andric  /// Load and Store Instructions - multiple
7000b57cec5SDimitry Andric  def SWM16_MM : StoreMultMM16<"swm16", II_SWM>, LWM_FM_MM16<0x5>,
7010b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
7020b57cec5SDimitry Andric  def LWM16_MM : LoadMultMM16<"lwm16", II_LWM>, LWM_FM_MM16<0x4>,
7030b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
7040b57cec5SDimitry Andric  def CFC2_MM : InstSE<(outs GPR32Opnd:$rt), (ins COP2Opnd:$impl),
7050b57cec5SDimitry Andric                       "cfc2\t$rt, $impl", [], II_CFC2, FrmFR, "cfc2">,
7060b57cec5SDimitry Andric                POOL32A_CFTC2_FM_MM<0b1100110100>, ISA_MICROMIPS;
7070b57cec5SDimitry Andric  def CTC2_MM : InstSE<(outs COP2Opnd:$impl), (ins GPR32Opnd:$rt),
7080b57cec5SDimitry Andric                       "ctc2\t$rt, $impl", [], II_CTC2, FrmFR, "ctc2">,
7090b57cec5SDimitry Andric                POOL32A_CFTC2_FM_MM<0b1101110100>, ISA_MICROMIPS;
7100b57cec5SDimitry Andric
7110b57cec5SDimitry Andric  /// Compact Branch Instructions
712349cc55cSDimitry Andric  def BEQZC_MM : CompactBranchMM<"beqzc", brtarget_mm, GPR32Opnd>,
7130b57cec5SDimitry Andric                 COMPACT_BRANCH_FM_MM<0x7>, ISA_MICROMIPS32_NOT_MIPS32R6;
714349cc55cSDimitry Andric  def BNEZC_MM : CompactBranchMM<"bnezc", brtarget_mm, GPR32Opnd>,
7150b57cec5SDimitry Andric                 COMPACT_BRANCH_FM_MM<0x5>, ISA_MICROMIPS32_NOT_MIPS32R6;
7160b57cec5SDimitry Andric
7170b57cec5SDimitry Andric  /// Arithmetic Instructions (ALU Immediate)
7180b57cec5SDimitry Andric  def ADDiu_MM : MMRel, ArithLogicI<"addiu", simm16, GPR32Opnd, II_ADDIU>,
7190b57cec5SDimitry Andric                 ADDI_FM_MM<0xc>, ISA_MICROMIPS32_NOT_MIPS32R6;
7200b57cec5SDimitry Andric  def ADDi_MM  : MMRel, ArithLogicI<"addi", simm16, GPR32Opnd, II_ADDI>,
7210b57cec5SDimitry Andric                 ADDI_FM_MM<0x4>, ISA_MICROMIPS32_NOT_MIPS32R6;
7220b57cec5SDimitry Andric  def SLTi_MM  : MMRel, SetCC_I<"slti", setlt, simm16, immSExt16, GPR32Opnd>,
7230b57cec5SDimitry Andric                 SLTI_FM_MM<0x24>, ISA_MICROMIPS;
7240b57cec5SDimitry Andric  def SLTiu_MM : MMRel, SetCC_I<"sltiu", setult, simm16, immSExt16, GPR32Opnd>,
7250b57cec5SDimitry Andric                 SLTI_FM_MM<0x2c>, ISA_MICROMIPS;
7260b57cec5SDimitry Andric  def ANDi_MM  : MMRel, ArithLogicI<"andi", uimm16, GPR32Opnd, II_ANDI>,
7270b57cec5SDimitry Andric                 ADDI_FM_MM<0x34>, ISA_MICROMIPS32_NOT_MIPS32R6;
7280b57cec5SDimitry Andric  def ORi_MM   : MMRel, ArithLogicI<"ori", uimm16, GPR32Opnd, II_ORI, immZExt16,
7290b57cec5SDimitry Andric                                    or>, ADDI_FM_MM<0x14>,
7300b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
7310b57cec5SDimitry Andric  def XORi_MM  : MMRel, ArithLogicI<"xori", uimm16, GPR32Opnd, II_XORI,
7320b57cec5SDimitry Andric                                    immZExt16, xor>, ADDI_FM_MM<0x1c>,
7330b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
7340b57cec5SDimitry Andric  def LUi_MM   : MMRel, LoadUpper<"lui", GPR32Opnd, uimm16_relaxed>, LUI_FM_MM,
7350b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
7360b57cec5SDimitry Andric
7370b57cec5SDimitry Andric  def LEA_ADDiu_MM : MMRel, EffectiveAddress<"addiu", GPR32Opnd>,
7380b57cec5SDimitry Andric                     LW_FM_MM<0xc>, ISA_MICROMIPS;
7390b57cec5SDimitry Andric
7400b57cec5SDimitry Andric  /// Arithmetic Instructions (3-Operand, R-Type)
7410b57cec5SDimitry Andric  def ADDu_MM  : MMRel, ArithLogicR<"addu", GPR32Opnd, 1, II_ADDU, add>,
7420b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x150>, ISA_MICROMIPS32_NOT_MIPS32R6;
7430b57cec5SDimitry Andric  def SUBu_MM  : MMRel, ArithLogicR<"subu", GPR32Opnd, 0, II_SUBU, sub>,
7440b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x1d0>, ISA_MICROMIPS32_NOT_MIPS32R6;
7450b57cec5SDimitry Andric  let Defs = [HI0, LO0] in
7460b57cec5SDimitry Andric    def MUL_MM   : MMRel, ArithLogicR<"mul", GPR32Opnd, 1, II_MUL, mul>,
7470b57cec5SDimitry Andric                   ADD_FM_MM<0, 0x210>, ISA_MICROMIPS32_NOT_MIPS32R6;
7480b57cec5SDimitry Andric  def ADD_MM   : MMRel, ArithLogicR<"add", GPR32Opnd, 1, II_ADD>,
7490b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x110>, ISA_MICROMIPS32_NOT_MIPS32R6;
7500b57cec5SDimitry Andric  def SUB_MM   : MMRel, ArithLogicR<"sub", GPR32Opnd, 0, II_SUB>,
7510b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x190>, ISA_MICROMIPS32_NOT_MIPS32R6;
7520b57cec5SDimitry Andric  def SLT_MM   : MMRel, SetCC_R<"slt", setlt, GPR32Opnd>, ADD_FM_MM<0, 0x350>,
7530b57cec5SDimitry Andric                 ISA_MICROMIPS;
7540b57cec5SDimitry Andric  def SLTu_MM  : MMRel, SetCC_R<"sltu", setult, GPR32Opnd>,
7550b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x390>, ISA_MICROMIPS;
7560b57cec5SDimitry Andric  def AND_MM   : MMRel, ArithLogicR<"and", GPR32Opnd, 1, II_AND, and>,
7570b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x250>, ISA_MICROMIPS32_NOT_MIPS32R6;
7580b57cec5SDimitry Andric  def OR_MM    : MMRel, ArithLogicR<"or", GPR32Opnd, 1, II_OR, or>,
7590b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x290>, ISA_MICROMIPS32_NOT_MIPS32R6;
7600b57cec5SDimitry Andric  def XOR_MM   : MMRel, ArithLogicR<"xor", GPR32Opnd, 1, II_XOR, xor>,
7610b57cec5SDimitry Andric                 ADD_FM_MM<0, 0x310>, ISA_MICROMIPS32_NOT_MIPS32R6;
7620b57cec5SDimitry Andric  def NOR_MM   : MMRel, LogicNOR<"nor", GPR32Opnd>, ADD_FM_MM<0, 0x2d0>,
7630b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
7640b57cec5SDimitry Andric  def MULT_MM  : MMRel, Mult<"mult", II_MULT, GPR32Opnd, [HI0, LO0]>,
7650b57cec5SDimitry Andric                 MULT_FM_MM<0x22c>, ISA_MICROMIPS32_NOT_MIPS32R6;
7660b57cec5SDimitry Andric  def MULTu_MM : MMRel, Mult<"multu", II_MULTU, GPR32Opnd, [HI0, LO0]>,
7670b57cec5SDimitry Andric                 MULT_FM_MM<0x26c>, ISA_MICROMIPS32_NOT_MIPS32R6;
7680b57cec5SDimitry Andric  def SDIV_MM  : MMRel, Div<"div", II_DIV, GPR32Opnd, [HI0, LO0]>,
7690b57cec5SDimitry Andric                 MULT_FM_MM<0x2ac>, ISA_MICROMIPS32_NOT_MIPS32R6;
7700b57cec5SDimitry Andric  def UDIV_MM  : MMRel, Div<"divu", II_DIVU, GPR32Opnd, [HI0, LO0]>,
7710b57cec5SDimitry Andric                 MULT_FM_MM<0x2ec>, ISA_MICROMIPS32_NOT_MIPS32R6;
7720b57cec5SDimitry Andric
7730b57cec5SDimitry Andric  /// Arithmetic Instructions with PC and Immediate
7740b57cec5SDimitry Andric  def ADDIUPC_MM : AddImmUPC<"addiupc", GPRMM16Opnd>, ADDIUPC_FM_MM,
7750b57cec5SDimitry Andric                   ISA_MICROMIPS32_NOT_MIPS32R6;
7760b57cec5SDimitry Andric
7770b57cec5SDimitry Andric  /// Shift Instructions
7780b57cec5SDimitry Andric  def SLL_MM   : MMRel, shift_rotate_imm<"sll", uimm5, GPR32Opnd, II_SLL>,
7790b57cec5SDimitry Andric                 SRA_FM_MM<0, 0>, ISA_MICROMIPS;
7800b57cec5SDimitry Andric  def SRL_MM   : MMRel, shift_rotate_imm<"srl", uimm5, GPR32Opnd, II_SRL>,
7810b57cec5SDimitry Andric                 SRA_FM_MM<0x40, 0>, ISA_MICROMIPS;
7820b57cec5SDimitry Andric  def SRA_MM   : MMRel, shift_rotate_imm<"sra", uimm5, GPR32Opnd, II_SRA>,
7830b57cec5SDimitry Andric                 SRA_FM_MM<0x80, 0>, ISA_MICROMIPS;
7840b57cec5SDimitry Andric  def SLLV_MM  : MMRel, shift_rotate_reg<"sllv", GPR32Opnd, II_SLLV>,
7850b57cec5SDimitry Andric                 SRLV_FM_MM<0x10, 0>, ISA_MICROMIPS;
7860b57cec5SDimitry Andric  def SRLV_MM  : MMRel, shift_rotate_reg<"srlv", GPR32Opnd, II_SRLV>,
7870b57cec5SDimitry Andric                 SRLV_FM_MM<0x50, 0>, ISA_MICROMIPS;
7880b57cec5SDimitry Andric  def SRAV_MM  : MMRel, shift_rotate_reg<"srav", GPR32Opnd, II_SRAV>,
7890b57cec5SDimitry Andric                 SRLV_FM_MM<0x90, 0>, ISA_MICROMIPS;
7900b57cec5SDimitry Andric  def ROTR_MM  : MMRel, shift_rotate_imm<"rotr", uimm5, GPR32Opnd, II_ROTR>,
7910b57cec5SDimitry Andric                 SRA_FM_MM<0xc0, 0>, ISA_MICROMIPS {
7920b57cec5SDimitry Andric    list<dag> Pattern = [(set GPR32Opnd:$rd,
7930b57cec5SDimitry Andric                          (rotr GPR32Opnd:$rt, immZExt5:$shamt))];
7940b57cec5SDimitry Andric  }
7950b57cec5SDimitry Andric  def ROTRV_MM : MMRel, shift_rotate_reg<"rotrv", GPR32Opnd, II_ROTRV>,
7960b57cec5SDimitry Andric                 SRLV_FM_MM<0xd0, 0>, ISA_MICROMIPS {
7970b57cec5SDimitry Andric    list<dag> Pattern = [(set GPR32Opnd:$rd,
7980b57cec5SDimitry Andric                          (rotr GPR32Opnd:$rt, GPR32Opnd:$rs))];
7990b57cec5SDimitry Andric  }
8000b57cec5SDimitry Andric
8010b57cec5SDimitry Andric  /// Load and Store Instructions - aligned
8020b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm16" in {
8030b57cec5SDimitry Andric    def LB_MM  : LoadMemory<"lb", GPR32Opnd, mem_mm_16, sextloadi8, II_LB>,
8040b57cec5SDimitry Andric                 MMRel, LW_FM_MM<0x7>, ISA_MICROMIPS;
8050b57cec5SDimitry Andric    def LBu_MM : LoadMemory<"lbu", GPR32Opnd, mem_mm_16, zextloadi8, II_LBU>,
8060b57cec5SDimitry Andric                 MMRel, LW_FM_MM<0x5>, ISA_MICROMIPS;
8070b57cec5SDimitry Andric    def LH_MM  : LoadMemory<"lh", GPR32Opnd, mem_simmptr, sextloadi16, II_LH,
8080b57cec5SDimitry Andric                            addrDefault>, MMRel, LW_FM_MM<0xf>, ISA_MICROMIPS;
8090b57cec5SDimitry Andric    def LHu_MM : LoadMemory<"lhu", GPR32Opnd, mem_simmptr, zextloadi16, II_LHU>,
8100b57cec5SDimitry Andric                 MMRel, LW_FM_MM<0xd>, ISA_MICROMIPS;
8110b57cec5SDimitry Andric    def LW_MM  : Load<"lw", GPR32Opnd, null_frag, II_LW>, MMRel, LW_FM_MM<0x3f>,
8120b57cec5SDimitry Andric                 ISA_MICROMIPS;
8130b57cec5SDimitry Andric    def SB_MM  : Store<"sb", GPR32Opnd, truncstorei8, II_SB>, MMRel,
8140b57cec5SDimitry Andric                 LW_FM_MM<0x6>, ISA_MICROMIPS;
8150b57cec5SDimitry Andric    def SH_MM  : Store<"sh", GPR32Opnd, truncstorei16, II_SH>, MMRel,
8160b57cec5SDimitry Andric                 LW_FM_MM<0xe>, ISA_MICROMIPS;
8170b57cec5SDimitry Andric    def SW_MM  : Store<"sw", GPR32Opnd, null_frag, II_SW>, MMRel,
8180b57cec5SDimitry Andric                 LW_FM_MM<0x3e>, ISA_MICROMIPS;
8190b57cec5SDimitry Andric  }
8200b57cec5SDimitry Andric
8210b57cec5SDimitry Andric  let DecoderMethod = "DecodeMemMMImm9" in {
8220b57cec5SDimitry Andric    def LBE_MM  : MMRel, Load<"lbe", GPR32Opnd, null_frag, II_LBE>,
8230b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0x6, 0x4>, ISA_MICROMIPS, ASE_EVA;
8240b57cec5SDimitry Andric    def LBuE_MM : MMRel, Load<"lbue", GPR32Opnd, null_frag, II_LBUE>,
8250b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0x6, 0x0>, ISA_MICROMIPS, ASE_EVA;
8260b57cec5SDimitry Andric    def LHE_MM  : MMRel, LoadMemory<"lhe", GPR32Opnd, mem_simm9, null_frag,
8270b57cec5SDimitry Andric                                    II_LHE>,
8280b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0x6, 0x5>, ISA_MICROMIPS, ASE_EVA;
8290b57cec5SDimitry Andric    def LHuE_MM : MMRel, LoadMemory<"lhue", GPR32Opnd, mem_simm9, null_frag,
8300b57cec5SDimitry Andric                                    II_LHUE>,
8310b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0x6, 0x1>, ISA_MICROMIPS, ASE_EVA;
8320b57cec5SDimitry Andric    def LWE_MM  : MMRel, LoadMemory<"lwe", GPR32Opnd, mem_simm9, null_frag,
8330b57cec5SDimitry Andric                                    II_LWE>,
8340b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0x6, 0x7>, ISA_MICROMIPS, ASE_EVA;
8350b57cec5SDimitry Andric    def SBE_MM  : MMRel, StoreMemory<"sbe", GPR32Opnd, mem_simm9, null_frag,
8360b57cec5SDimitry Andric                                     II_SBE>,
8370b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0xa, 0x4>, ISA_MICROMIPS, ASE_EVA;
8380b57cec5SDimitry Andric    def SHE_MM  : MMRel, StoreMemory<"she", GPR32Opnd, mem_simm9, null_frag,
8390b57cec5SDimitry Andric                                     II_SHE>,
8400b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0xa, 0x5>, ISA_MICROMIPS, ASE_EVA;
8410b57cec5SDimitry Andric    def SWE_MM  : MMRel, StoreMemory<"swe", GPR32Opnd, mem_simm9, null_frag,
8420b57cec5SDimitry Andric                                     II_SWE>,
8430b57cec5SDimitry Andric                  POOL32C_LHUE_FM_MM<0x18, 0xa, 0x7>, ISA_MICROMIPS, ASE_EVA;
8440b57cec5SDimitry Andric    def LWLE_MM : MMRel, LoadLeftRightMM<"lwle", MipsLWL, GPR32Opnd, mem_mm_9,
8450b57cec5SDimitry Andric                                         II_LWLE>,
8460b57cec5SDimitry Andric                  POOL32C_STEVA_LDEVA_FM_MM<0x6, 0x2>,
8470b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6, ASE_EVA;
8480b57cec5SDimitry Andric    def LWRE_MM : MMRel, LoadLeftRightMM<"lwre", MipsLWR, GPR32Opnd, mem_mm_9,
8490b57cec5SDimitry Andric                                         II_LWRE>,
8500b57cec5SDimitry Andric                  POOL32C_STEVA_LDEVA_FM_MM<0x6, 0x3>,
8510b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6, ASE_EVA;
8520b57cec5SDimitry Andric    def SWLE_MM : MMRel, StoreLeftRightMM<"swle", MipsSWL, GPR32Opnd, mem_mm_9,
8530b57cec5SDimitry Andric                                          II_SWLE>,
8540b57cec5SDimitry Andric                  POOL32C_STEVA_LDEVA_FM_MM<0xa, 0x0>,
8550b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6, ASE_EVA;
8560b57cec5SDimitry Andric    def SWRE_MM : MMRel, StoreLeftRightMM<"swre", MipsSWR, GPR32Opnd, mem_mm_9,
8570b57cec5SDimitry Andric                                          II_SWRE>,
8580b57cec5SDimitry Andric                  POOL32C_STEVA_LDEVA_FM_MM<0xa, 0x1>,
8590b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6, ASE_EVA;
8600b57cec5SDimitry Andric  }
8610b57cec5SDimitry Andric
8620b57cec5SDimitry Andric  def LWXS_MM : LoadWordIndexedScaledMM<"lwxs", GPR32Opnd>, LWXS_FM_MM<0x118>,
8630b57cec5SDimitry Andric                ISA_MICROMIPS;
8640b57cec5SDimitry Andric
8650b57cec5SDimitry Andric  /// Load and Store Instructions - unaligned
8660b57cec5SDimitry Andric  def LWL_MM : MMRel, LoadLeftRightMM<"lwl", MipsLWL, GPR32Opnd, mem_mm_12,
8670b57cec5SDimitry Andric                                      II_LWL>, LWL_FM_MM<0x0>,
8680b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
8690b57cec5SDimitry Andric  def LWR_MM : MMRel, LoadLeftRightMM<"lwr", MipsLWR, GPR32Opnd, mem_mm_12,
8700b57cec5SDimitry Andric                                      II_LWR>, LWL_FM_MM<0x1>,
8710b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
8720b57cec5SDimitry Andric  def SWL_MM : MMRel, StoreLeftRightMM<"swl", MipsSWL, GPR32Opnd, mem_mm_12,
8730b57cec5SDimitry Andric                                       II_SWL>, LWL_FM_MM<0x8>,
8740b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
8750b57cec5SDimitry Andric  def SWR_MM : MMRel, StoreLeftRightMM<"swr", MipsSWR, GPR32Opnd, mem_mm_12,
8760b57cec5SDimitry Andric                                       II_SWR>, LWL_FM_MM<0x9>,
8770b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
8780b57cec5SDimitry Andric
8790b57cec5SDimitry Andric  /// Load and Store Instructions - multiple
8800b57cec5SDimitry Andric  def SWM32_MM  : StoreMultMM<"swm32", II_SWM>, LWM_FM_MM<0xd>, ISA_MICROMIPS;
8810b57cec5SDimitry Andric  def LWM32_MM  : LoadMultMM<"lwm32", II_LWM>, LWM_FM_MM<0x5>, ISA_MICROMIPS;
8820b57cec5SDimitry Andric
8830b57cec5SDimitry Andric  /// Load and Store Pair Instructions
8840b57cec5SDimitry Andric  def SWP_MM  : StorePairMM<"swp">, LWM_FM_MM<0x9>, ISA_MICROMIPS;
8850b57cec5SDimitry Andric  def LWP_MM  : LoadPairMM<"lwp">, LWM_FM_MM<0x1>, ISA_MICROMIPS;
8860b57cec5SDimitry Andric
8870b57cec5SDimitry Andric  /// Load and Store multiple pseudo Instructions
8880b57cec5SDimitry Andric  class LoadWordMultMM<string instr_asm > :
8890b57cec5SDimitry Andric    MipsAsmPseudoInst<(outs reglist:$rt), (ins mem_mm_12:$addr),
8900b57cec5SDimitry Andric                      !strconcat(instr_asm, "\t$rt, $addr")> ;
8910b57cec5SDimitry Andric
8920b57cec5SDimitry Andric  class StoreWordMultMM<string instr_asm > :
8930b57cec5SDimitry Andric    MipsAsmPseudoInst<(outs), (ins reglist:$rt, mem_mm_12:$addr),
8940b57cec5SDimitry Andric                      !strconcat(instr_asm, "\t$rt, $addr")> ;
8950b57cec5SDimitry Andric
8960b57cec5SDimitry Andric
8970b57cec5SDimitry Andric  def SWM_MM  : StoreWordMultMM<"swm">, ISA_MICROMIPS;
8980b57cec5SDimitry Andric  def LWM_MM  : LoadWordMultMM<"lwm">, ISA_MICROMIPS;
8990b57cec5SDimitry Andric
9000b57cec5SDimitry Andric  /// Move Conditional
9010b57cec5SDimitry Andric  def MOVZ_I_MM : MMRel, CMov_I_I_FT<"movz", GPR32Opnd, GPR32Opnd,
9020b57cec5SDimitry Andric                                     II_MOVZ>, ADD_FM_MM<0, 0x58>,
9030b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6;
9040b57cec5SDimitry Andric  def MOVN_I_MM : MMRel, CMov_I_I_FT<"movn", GPR32Opnd, GPR32Opnd,
9050b57cec5SDimitry Andric                                     II_MOVN>, ADD_FM_MM<0, 0x18>,
9060b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6;
9070b57cec5SDimitry Andric  def MOVT_I_MM : MMRel, CMov_F_I_FT<"movt", GPR32Opnd, II_MOVT, MipsCMovFP_T>,
9080b57cec5SDimitry Andric                  CMov_F_I_FM_MM<0x25>, ISA_MICROMIPS32_NOT_MIPS32R6;
9090b57cec5SDimitry Andric  def MOVF_I_MM : MMRel, CMov_F_I_FT<"movf", GPR32Opnd, II_MOVF, MipsCMovFP_F>,
9100b57cec5SDimitry Andric                  CMov_F_I_FM_MM<0x5>, ISA_MICROMIPS32_NOT_MIPS32R6;
9110b57cec5SDimitry Andric  /// Move to/from HI/LO
9120b57cec5SDimitry Andric  def MTHI_MM : MMRel, MoveToLOHI<"mthi", GPR32Opnd, [HI0]>,
9130b57cec5SDimitry Andric                MTLO_FM_MM<0x0b5>, ISA_MICROMIPS32_NOT_MIPS32R6;
9140b57cec5SDimitry Andric  def MTLO_MM : MMRel, MoveToLOHI<"mtlo", GPR32Opnd, [LO0]>,
9150b57cec5SDimitry Andric                MTLO_FM_MM<0x0f5>, ISA_MICROMIPS32_NOT_MIPS32R6;
9160b57cec5SDimitry Andric  def MFHI_MM : MMRel, MoveFromLOHI<"mfhi", GPR32Opnd, AC0>,
9170b57cec5SDimitry Andric                MFLO_FM_MM<0x035>, ISA_MICROMIPS32_NOT_MIPS32R6;
9180b57cec5SDimitry Andric  def MFLO_MM : MMRel, MoveFromLOHI<"mflo", GPR32Opnd, AC0>,
9190b57cec5SDimitry Andric                MFLO_FM_MM<0x075>, ISA_MICROMIPS32_NOT_MIPS32R6;
9200b57cec5SDimitry Andric
9210b57cec5SDimitry Andric  /// Multiply Add/Sub Instructions
9220b57cec5SDimitry Andric  def MADD_MM  : MMRel, MArithR<"madd", II_MADD, 1>, MULT_FM_MM<0x32c>,
9230b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
9240b57cec5SDimitry Andric  def MADDU_MM : MMRel, MArithR<"maddu", II_MADDU, 1>, MULT_FM_MM<0x36c>,
9250b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
9260b57cec5SDimitry Andric  def MSUB_MM  : MMRel, MArithR<"msub", II_MSUB>, MULT_FM_MM<0x3ac>,
9270b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
9280b57cec5SDimitry Andric  def MSUBU_MM : MMRel, MArithR<"msubu", II_MSUBU>, MULT_FM_MM<0x3ec>,
9290b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
9300b57cec5SDimitry Andric
9310b57cec5SDimitry Andric  /// Count Leading
9320b57cec5SDimitry Andric  def CLZ_MM : MMRel, CountLeading0<"clz", GPR32Opnd, II_CLZ>, CLO_FM_MM<0x16c>,
9330b57cec5SDimitry Andric               ISA_MICROMIPS;
9340b57cec5SDimitry Andric  def CLO_MM : MMRel, CountLeading1<"clo", GPR32Opnd, II_CLO>, CLO_FM_MM<0x12c>,
9350b57cec5SDimitry Andric               ISA_MICROMIPS;
9360b57cec5SDimitry Andric
9370b57cec5SDimitry Andric  /// Sign Ext In Register Instructions.
9380b57cec5SDimitry Andric  def SEB_MM : MMRel, SignExtInReg<"seb", i8, GPR32Opnd, II_SEB>,
9390b57cec5SDimitry Andric               SEB_FM_MM<0x0ac>, ISA_MICROMIPS;
9400b57cec5SDimitry Andric  def SEH_MM : MMRel, SignExtInReg<"seh", i16, GPR32Opnd, II_SEH>,
9410b57cec5SDimitry Andric               SEB_FM_MM<0x0ec>, ISA_MICROMIPS;
9420b57cec5SDimitry Andric
9430b57cec5SDimitry Andric  /// Word Swap Bytes Within Halfwords
9440b57cec5SDimitry Andric  def WSBH_MM : MMRel, SubwordSwap<"wsbh", GPR32Opnd, II_WSBH>,
9450b57cec5SDimitry Andric                SEB_FM_MM<0x1ec>, ISA_MICROMIPS;
9460b57cec5SDimitry Andric  // TODO: Add '0 < pos+size <= 32' constraint check to ext instruction
9470b57cec5SDimitry Andric  def EXT_MM : MMRel, ExtBase<"ext", GPR32Opnd, uimm5, uimm5_plus1, immZExt5,
9480b57cec5SDimitry Andric                              immZExt5Plus1, MipsExt>, EXT_FM_MM<0x2c>,
9490b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
9500b57cec5SDimitry Andric  def INS_MM : MMRel, InsBase<"ins", GPR32Opnd, uimm5, uimm5_inssize_plus1,
9510b57cec5SDimitry Andric                              immZExt5, immZExt5Plus1>,
9520b57cec5SDimitry Andric               EXT_FM_MM<0x0c>, ISA_MICROMIPS32_NOT_MIPS32R6;
9530b57cec5SDimitry Andric
9540b57cec5SDimitry Andric  /// Jump Instructions
9558bcb0991SDimitry Andric  let DecoderMethod = "DecodeJumpTargetMM" in {
9560b57cec5SDimitry Andric    def J_MM          : MMRel, JumpFJ<jmptarget_mm, "j", br, bb, "j">,
9570b57cec5SDimitry Andric                        J_FM_MM<0x35>, AdditionalRequires<[RelocNotPIC]>,
9580b57cec5SDimitry Andric                        IsBranch, ISA_MICROMIPS32_NOT_MIPS32R6;
9590b57cec5SDimitry Andric    def JAL_MM      : MMRel, JumpLink<"jal", calltarget_mm>, J_FM_MM<0x3d>,
9600b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
9618bcb0991SDimitry Andric  }
9628bcb0991SDimitry Andric
9638bcb0991SDimitry Andric  let DecoderMethod = "DecodeJumpTargetXMM" in
9640b57cec5SDimitry Andric    def JALX_MM     : MMRel, JumpLink<"jalx", calltarget>, J_FM_MM<0x3c>,
9650b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
9668bcb0991SDimitry Andric
9670b57cec5SDimitry Andric  def JR_MM : MMRel, IndirectBranch<"jr", GPR32Opnd>, JR_FM_MM<0x3c>,
9680b57cec5SDimitry Andric              ISA_MICROMIPS32_NOT_MIPS32R6;
9690b57cec5SDimitry Andric  def JALR_MM : JumpLinkReg<"jalr", GPR32Opnd>, JALR_FM_MM<0x03c>,
9700b57cec5SDimitry Andric                ISA_MICROMIPS32_NOT_MIPS32R6;
9710b57cec5SDimitry Andric
9720b57cec5SDimitry Andric  /// Jump Instructions - Short Delay Slot
9730b57cec5SDimitry Andric  def JALS_MM   : JumpLinkMM<"jals", calltarget_mm>, J_FM_MM<0x1d>,
9740b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6;
9750b57cec5SDimitry Andric  def JALRS_MM  : JumpLinkRegMM<"jalrs", GPR32Opnd>, JALR_FM_MM<0x13c>,
9760b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6;
9770b57cec5SDimitry Andric
9780b57cec5SDimitry Andric  /// Branch Instructions
9790b57cec5SDimitry Andric  def BEQ_MM  : MMRel, CBranch<"beq", brtarget_mm, seteq, GPR32Opnd>,
9800b57cec5SDimitry Andric                BEQ_FM_MM<0x25>, ISA_MICROMIPS32_NOT_MIPS32R6;
9810b57cec5SDimitry Andric  def BNE_MM  : MMRel, CBranch<"bne", brtarget_mm, setne, GPR32Opnd>,
9820b57cec5SDimitry Andric                BEQ_FM_MM<0x2d>, ISA_MICROMIPS32_NOT_MIPS32R6;
9830b57cec5SDimitry Andric  def BGEZ_MM : MMRel, CBranchZero<"bgez", brtarget_mm, setge, GPR32Opnd>,
9840b57cec5SDimitry Andric                BGEZ_FM_MM<0x2>, ISA_MICROMIPS32_NOT_MIPS32R6;
9850b57cec5SDimitry Andric  def BGTZ_MM : MMRel, CBranchZero<"bgtz", brtarget_mm, setgt, GPR32Opnd>,
9860b57cec5SDimitry Andric                BGEZ_FM_MM<0x6>, ISA_MICROMIPS32_NOT_MIPS32R6;
9870b57cec5SDimitry Andric  def BLEZ_MM : MMRel, CBranchZero<"blez", brtarget_mm, setle, GPR32Opnd>,
9880b57cec5SDimitry Andric                BGEZ_FM_MM<0x4>, ISA_MICROMIPS32_NOT_MIPS32R6;
9890b57cec5SDimitry Andric  def BLTZ_MM : MMRel, CBranchZero<"bltz", brtarget_mm, setlt, GPR32Opnd>,
9900b57cec5SDimitry Andric                BGEZ_FM_MM<0x0>, ISA_MICROMIPS32_NOT_MIPS32R6;
9910b57cec5SDimitry Andric  def BGEZAL_MM : MMRel, BGEZAL_FT<"bgezal", brtarget_mm, GPR32Opnd>,
9920b57cec5SDimitry Andric                  BGEZAL_FM_MM<0x03>, ISA_MICROMIPS32_NOT_MIPS32R6;
9930b57cec5SDimitry Andric  def BLTZAL_MM : MMRel, BGEZAL_FT<"bltzal", brtarget_mm, GPR32Opnd>,
9940b57cec5SDimitry Andric                  BGEZAL_FM_MM<0x01>, ISA_MICROMIPS32_NOT_MIPS32R6;
9950b57cec5SDimitry Andric  def BAL_BR_MM : BAL_BR_Pseudo<BGEZAL_MM, brtarget_mm>,
9960b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6;
9970b57cec5SDimitry Andric
9980b57cec5SDimitry Andric  /// Branch Instructions - Short Delay Slot
9990b57cec5SDimitry Andric  def BGEZALS_MM : BranchCompareToZeroLinkMM<"bgezals", brtarget_mm,
10000b57cec5SDimitry Andric                                             GPR32Opnd>, BGEZAL_FM_MM<0x13>,
10010b57cec5SDimitry Andric                   ISA_MICROMIPS32_NOT_MIPS32R6;
10020b57cec5SDimitry Andric  def BLTZALS_MM : BranchCompareToZeroLinkMM<"bltzals", brtarget_mm,
10030b57cec5SDimitry Andric                                             GPR32Opnd>, BGEZAL_FM_MM<0x11>,
10040b57cec5SDimitry Andric                   ISA_MICROMIPS32_NOT_MIPS32R6;
10050b57cec5SDimitry Andric  def B_MM    : UncondBranch<BEQ_MM, brtarget_mm>, IsBranch,
10060b57cec5SDimitry Andric                ISA_MICROMIPS32_NOT_MIPS32R6;
10070b57cec5SDimitry Andric
10080b57cec5SDimitry Andric  /// Control Instructions
10090b57cec5SDimitry Andric  def SYNC_MM    : MMRel, SYNC_FT<"sync">, SYNC_FM_MM, ISA_MICROMIPS;
10100b57cec5SDimitry Andric  let DecoderMethod = "DecodeSyncI_MM" in
10110b57cec5SDimitry Andric    def SYNCI_MM   : MMRel, SYNCI_FT<"synci", mem_mm_16>, SYNCI_FM_MM,
10120b57cec5SDimitry Andric                     ISA_MICROMIPS32_NOT_MIPS32R6;
10130b57cec5SDimitry Andric  def BREAK_MM   : MMRel, BRK_FT<"break">, BRK_FM_MM, ISA_MICROMIPS;
10140b57cec5SDimitry Andric  def SYSCALL_MM : MMRel, SYS_FT<"syscall", uimm10, II_SYSCALL>, SYS_FM_MM,
10150b57cec5SDimitry Andric                   ISA_MICROMIPS;
10160b57cec5SDimitry Andric  def WAIT_MM    : MMRel, WaitMM<"wait">, WAIT_FM_MM, ISA_MICROMIPS;
10170b57cec5SDimitry Andric  def ERET_MM    : MMRel, ER_FT<"eret", II_ERET>, ER_FM_MM<0x3cd>,
10180b57cec5SDimitry Andric                   ISA_MICROMIPS;
10190b57cec5SDimitry Andric  def DERET_MM   : MMRel, ER_FT<"deret", II_DERET>, ER_FM_MM<0x38d>,
10200b57cec5SDimitry Andric                   ISA_MICROMIPS;
10210b57cec5SDimitry Andric  def EI_MM      : MMRel, DEI_FT<"ei", GPR32Opnd, II_EI>, EI_FM_MM<0x15d>,
10220b57cec5SDimitry Andric                   ISA_MICROMIPS;
10230b57cec5SDimitry Andric  def DI_MM      : MMRel, DEI_FT<"di", GPR32Opnd, II_DI>, EI_FM_MM<0x11d>,
10240b57cec5SDimitry Andric                   ISA_MICROMIPS;
10250b57cec5SDimitry Andric  def TRAP_MM    : TrapBase<BREAK_MM>, ISA_MICROMIPS;
10260b57cec5SDimitry Andric
10270b57cec5SDimitry Andric  /// Trap Instructions
10280b57cec5SDimitry Andric  def TEQ_MM  : MMRel, TEQ_FT<"teq", GPR32Opnd, uimm4, II_TEQ>, TEQ_FM_MM<0x0>,
10290b57cec5SDimitry Andric                ISA_MICROMIPS;
10300b57cec5SDimitry Andric  def TGE_MM  : MMRel, TEQ_FT<"tge", GPR32Opnd, uimm4, II_TGE>, TEQ_FM_MM<0x08>,
10310b57cec5SDimitry Andric                ISA_MICROMIPS;
10320b57cec5SDimitry Andric  def TGEU_MM : MMRel, TEQ_FT<"tgeu", GPR32Opnd, uimm4, II_TGEU>,
10330b57cec5SDimitry Andric                TEQ_FM_MM<0x10>, ISA_MICROMIPS;
10340b57cec5SDimitry Andric  def TLT_MM  : MMRel, TEQ_FT<"tlt", GPR32Opnd, uimm4, II_TLT>, TEQ_FM_MM<0x20>,
10350b57cec5SDimitry Andric                ISA_MICROMIPS;
10360b57cec5SDimitry Andric  def TLTU_MM : MMRel, TEQ_FT<"tltu", GPR32Opnd, uimm4, II_TLTU>,
10370b57cec5SDimitry Andric                TEQ_FM_MM<0x28>, ISA_MICROMIPS;
10380b57cec5SDimitry Andric  def TNE_MM  : MMRel, TEQ_FT<"tne", GPR32Opnd, uimm4, II_TNE>, TEQ_FM_MM<0x30>,
10390b57cec5SDimitry Andric                ISA_MICROMIPS;
10400b57cec5SDimitry Andric
10410b57cec5SDimitry Andric  def TEQI_MM  : MMRel, TEQI_FT<"teqi", GPR32Opnd, II_TEQI>, TEQI_FM_MM<0x0e>,
10420b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
10430b57cec5SDimitry Andric  def TGEI_MM  : MMRel, TEQI_FT<"tgei", GPR32Opnd, II_TGEI>, TEQI_FM_MM<0x09>,
10440b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
10450b57cec5SDimitry Andric  def TGEIU_MM : MMRel, TEQI_FT<"tgeiu", GPR32Opnd, II_TGEIU>,
10460b57cec5SDimitry Andric                 TEQI_FM_MM<0x0b>, ISA_MICROMIPS32_NOT_MIPS32R6;
10470b57cec5SDimitry Andric  def TLTI_MM  : MMRel, TEQI_FT<"tlti", GPR32Opnd, II_TLTI>, TEQI_FM_MM<0x08>,
10480b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
10490b57cec5SDimitry Andric  def TLTIU_MM : MMRel, TEQI_FT<"tltiu", GPR32Opnd, II_TTLTIU>,
10500b57cec5SDimitry Andric                 TEQI_FM_MM<0x0a>, ISA_MICROMIPS32_NOT_MIPS32R6;
10510b57cec5SDimitry Andric  def TNEI_MM  : MMRel, TEQI_FT<"tnei", GPR32Opnd, II_TNEI>, TEQI_FM_MM<0x0c>,
10520b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
10530b57cec5SDimitry Andric
10540b57cec5SDimitry Andric  /// Load-linked, Store-conditional
10550b57cec5SDimitry Andric  def LL_MM : LLBaseMM<"ll", GPR32Opnd>, LL_FM_MM<0x3>,
10560b57cec5SDimitry Andric              ISA_MICROMIPS32_NOT_MIPS32R6;
10570b57cec5SDimitry Andric  def SC_MM : SCBaseMM<"sc", GPR32Opnd>, LL_FM_MM<0xb>,
10580b57cec5SDimitry Andric              ISA_MICROMIPS32_NOT_MIPS32R6;
10590b57cec5SDimitry Andric
10600b57cec5SDimitry Andric  def LLE_MM : MMRel, LLEBaseMM<"lle", GPR32Opnd>, LLE_FM_MM<0x6>,
10610b57cec5SDimitry Andric               ISA_MICROMIPS, ASE_EVA;
10620b57cec5SDimitry Andric  def SCE_MM : MMRel, SCEBaseMM<"sce", GPR32Opnd>, LLE_FM_MM<0xA>,
10630b57cec5SDimitry Andric               ISA_MICROMIPS, ASE_EVA;
10640b57cec5SDimitry Andric
10650b57cec5SDimitry Andric  let DecoderMethod = "DecodeCacheOpMM" in {
10660b57cec5SDimitry Andric    def CACHE_MM : MMRel, CacheOp<"cache", mem_mm_12, II_CACHE>,
10670b57cec5SDimitry Andric                   CACHE_PREF_FM_MM<0x08, 0x6>, ISA_MICROMIPS32_NOT_MIPS32R6;
10680b57cec5SDimitry Andric    def PREF_MM  : MMRel, CacheOp<"pref", mem_mm_12, II_PREF>,
10690b57cec5SDimitry Andric                   CACHE_PREF_FM_MM<0x18, 0x2>, ISA_MICROMIPS32_NOT_MIPS32R6;
10700b57cec5SDimitry Andric  }
10710b57cec5SDimitry Andric
10720b57cec5SDimitry Andric  let DecoderMethod = "DecodePrefeOpMM" in {
10730b57cec5SDimitry Andric    def PREFE_MM  : MMRel, CacheOp<"prefe", mem_mm_9, II_PREFE>,
10740b57cec5SDimitry Andric                    CACHE_PREFE_FM_MM<0x18, 0x2>, ISA_MICROMIPS, ASE_EVA;
10750b57cec5SDimitry Andric    def CACHEE_MM : MMRel, CacheOp<"cachee", mem_mm_9, II_CACHEE>,
10760b57cec5SDimitry Andric                    CACHE_PREFE_FM_MM<0x18, 0x3>, ISA_MICROMIPS, ASE_EVA;
10770b57cec5SDimitry Andric  }
10780b57cec5SDimitry Andric  def SSNOP_MM : MMRel, Barrier<"ssnop", II_SSNOP>, BARRIER_FM_MM<0x1>,
10790b57cec5SDimitry Andric                 ISA_MICROMIPS;
10800b57cec5SDimitry Andric  def EHB_MM   : MMRel, Barrier<"ehb", II_EHB>, BARRIER_FM_MM<0x3>,
10810b57cec5SDimitry Andric                 ISA_MICROMIPS;
10820b57cec5SDimitry Andric  def PAUSE_MM : MMRel, Barrier<"pause", II_PAUSE>, BARRIER_FM_MM<0x5>,
10830b57cec5SDimitry Andric                 ISA_MICROMIPS;
10840b57cec5SDimitry Andric
10850b57cec5SDimitry Andric  def TLBP_MM : MMRel, TLB<"tlbp", II_TLBP>, COP0_TLB_FM_MM<0x0d>,
10860b57cec5SDimitry Andric                ISA_MICROMIPS;
10870b57cec5SDimitry Andric  def TLBR_MM : MMRel, TLB<"tlbr", II_TLBR>, COP0_TLB_FM_MM<0x4d>,
10880b57cec5SDimitry Andric                ISA_MICROMIPS;
10890b57cec5SDimitry Andric  def TLBWI_MM : MMRel, TLB<"tlbwi", II_TLBWI>, COP0_TLB_FM_MM<0x8d>,
10900b57cec5SDimitry Andric                 ISA_MICROMIPS;
10910b57cec5SDimitry Andric  def TLBWR_MM : MMRel, TLB<"tlbwr", II_TLBWR>, COP0_TLB_FM_MM<0xcd>,
10920b57cec5SDimitry Andric                 ISA_MICROMIPS;
10930b57cec5SDimitry Andric
10940b57cec5SDimitry Andric  def SDBBP_MM : MMRel, SYS_FT<"sdbbp", uimm10, II_SDBBP>, SDBBP_FM_MM,
10950b57cec5SDimitry Andric                 ISA_MICROMIPS;
10960b57cec5SDimitry Andric
10970b57cec5SDimitry Andric  def PREFX_MM : PrefetchIndexed<"prefx">, POOL32F_PREFX_FM_MM<0x15, 0x1A0>,
10980b57cec5SDimitry Andric                 ISA_MICROMIPS32_NOT_MIPS32R6;
10990b57cec5SDimitry Andric}
11000b57cec5SDimitry Andric
11010b57cec5SDimitry Andriclet AdditionalPredicates = [NotDSP] in {
11020b57cec5SDimitry Andric  def PseudoMULT_MM : MultDivPseudo<MULT, ACC64, GPR32Opnd, MipsMult, II_MULT>,
11030b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
11040b57cec5SDimitry Andric  def PseudoMULTu_MM : MultDivPseudo<MULTu, ACC64, GPR32Opnd, MipsMultu, II_MULTU>,
11050b57cec5SDimitry Andric                       ISA_MICROMIPS32_NOT_MIPS32R6;
11060b57cec5SDimitry Andric  def PseudoMFHI_MM : PseudoMFLOHI<GPR32, ACC64, MipsMFHI>,
11070b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
11080b57cec5SDimitry Andric  def PseudoMFLO_MM : PseudoMFLOHI<GPR32, ACC64, MipsMFLO>,
11090b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
11100b57cec5SDimitry Andric  def PseudoMTLOHI_MM : PseudoMTLOHI<ACC64, GPR32>,
11110b57cec5SDimitry Andric                        ISA_MICROMIPS32_NOT_MIPS32R6;
11120b57cec5SDimitry Andric  def PseudoMADD_MM : MAddSubPseudo<MADD, MipsMAdd, II_MADD>,
11130b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
11140b57cec5SDimitry Andric  def PseudoMADDU_MM : MAddSubPseudo<MADDU, MipsMAddu, II_MADDU>,
11150b57cec5SDimitry Andric                       ISA_MICROMIPS32_NOT_MIPS32R6;
11160b57cec5SDimitry Andric  def PseudoMSUB_MM : MAddSubPseudo<MSUB, MipsMSub, II_MSUB>,
11170b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
11180b57cec5SDimitry Andric  def PseudoMSUBU_MM : MAddSubPseudo<MSUBU, MipsMSubu, II_MSUBU>,
11190b57cec5SDimitry Andric                       ISA_MICROMIPS32_NOT_MIPS32R6;
11200b57cec5SDimitry Andric}
11210b57cec5SDimitry Andric
11220b57cec5SDimitry Andricdef TAILCALL_MM : TailCall<J_MM, jmptarget_mm>,
11230b57cec5SDimitry Andric                  ISA_MICROMIPS32_NOT_MIPS32R6;
11240b57cec5SDimitry Andric
11250b57cec5SDimitry Andricdef TAILCALLREG_MM  : TailCallReg<JRC16_MM, GPR32Opnd>,
11260b57cec5SDimitry Andric                      ISA_MICROMIPS32_NOT_MIPS32R6;
11270b57cec5SDimitry Andric
11280b57cec5SDimitry Andricdef PseudoIndirectBranch_MM : PseudoIndirectBranchBase<JR_MM, GPR32Opnd>,
11290b57cec5SDimitry Andric                              ISA_MICROMIPS32_NOT_MIPS32R6;
11300b57cec5SDimitry Andric
11310b57cec5SDimitry Andriclet DecoderNamespace = "MicroMips" in {
11320b57cec5SDimitry Andric  def RDHWR_MM : MMRel, R6MMR6Rel, ReadHardware<GPR32Opnd, HWRegsOpnd>,
11330b57cec5SDimitry Andric                 RDHWR_FM_MM, ISA_MICROMIPS32_NOT_MIPS32R6;
11340b57cec5SDimitry Andric  def LWU_MM : MMRel, LoadMM<"lwu", GPR32Opnd, zextloadi32, II_LWU,
11350b57cec5SDimitry Andric                             mem_simm12>, LL_FM_MM<0xe>,
11360b57cec5SDimitry Andric               ISA_MICROMIPS32_NOT_MIPS32R6;
11370b57cec5SDimitry Andric
11380b57cec5SDimitry Andric  def MFGC0_MM    : MMRel, MfCop0MM<"mfgc0", GPR32Opnd, COP0Opnd, II_MFGC0>,
11390b57cec5SDimitry Andric                    POOL32A_MFTC0_FM_MM<0b10011, 0b111100>,
11400b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
11410b57cec5SDimitry Andric  def MFHGC0_MM   : MMRel, MfCop0MM<"mfhgc0", GPR32Opnd, COP0Opnd, II_MFHGC0>,
11420b57cec5SDimitry Andric                    POOL32A_MFTC0_FM_MM<0b10011, 0b110100>,
11430b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
11440b57cec5SDimitry Andric  def MTGC0_MM    : MMRel, MtCop0MM<"mtgc0", COP0Opnd, GPR32Opnd, II_MTGC0>,
11450b57cec5SDimitry Andric                    POOL32A_MFTC0_FM_MM<0b11011, 0b111100>,
11460b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
11470b57cec5SDimitry Andric  def MTHGC0_MM   : MMRel, MtCop0MM<"mthgc0", COP0Opnd, GPR32Opnd, II_MTHGC0>,
11480b57cec5SDimitry Andric                    POOL32A_MFTC0_FM_MM<0b11011, 0b110100>,
11490b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
11500b57cec5SDimitry Andric  def HYPCALL_MM  : MMRel, HypcallMM<"hypcall">, POOL32A_HYPCALL_FM_MM,
11510b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
11520b57cec5SDimitry Andric  def TLBGINV_MM  : MMRel, TLBINVMM<"tlbginv", II_TLBGINV>,
11530b57cec5SDimitry Andric                    POOL32A_TLBINV_FM_MM<0x105>, ISA_MICROMIPS32R5, ASE_VIRT;
11540b57cec5SDimitry Andric  def TLBGINVF_MM : MMRel, TLBINVMM<"tlbginvf", II_TLBGINVF>,
11550b57cec5SDimitry Andric                    POOL32A_TLBINV_FM_MM<0x145>, ISA_MICROMIPS32R5, ASE_VIRT;
11560b57cec5SDimitry Andric  def TLBGP_MM    : MMRel, TLBINVMM<"tlbgp", II_TLBGP>,
11570b57cec5SDimitry Andric                    POOL32A_TLBINV_FM_MM<0x5>, ISA_MICROMIPS32R5, ASE_VIRT;
11580b57cec5SDimitry Andric  def TLBGR_MM    : MMRel, TLBINVMM<"tlbgr", II_TLBGR>,
11590b57cec5SDimitry Andric                    POOL32A_TLBINV_FM_MM<0x45>, ISA_MICROMIPS32R5, ASE_VIRT;
11600b57cec5SDimitry Andric  def TLBGWI_MM   : MMRel, TLBINVMM<"tlbgwi", II_TLBGWI>,
11610b57cec5SDimitry Andric                    POOL32A_TLBINV_FM_MM<0x85>, ISA_MICROMIPS32R5, ASE_VIRT;
11620b57cec5SDimitry Andric  def TLBGWR_MM   : MMRel, TLBINVMM<"tlbgwr", II_TLBGWR>,
11630b57cec5SDimitry Andric                    POOL32A_TLBINV_FM_MM<0xc5>, ISA_MICROMIPS32R5, ASE_VIRT;
11640b57cec5SDimitry Andric}
11650b57cec5SDimitry Andric
11660b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11670b57cec5SDimitry Andric// MicroMips arbitrary patterns that map to one or more instructions
11680b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11690b57cec5SDimitry Andric
11700b57cec5SDimitry Andricdefm : MipsHiLoRelocs<LUi_MM, ADDiu_MM, ZERO, GPR32Opnd>, ISA_MICROMIPS;
11710b57cec5SDimitry Andric
11720b57cec5SDimitry Andricdef : MipsPat<(MipsGotHi tglobaladdr:$in), (LUi_MM tglobaladdr:$in)>,
11730b57cec5SDimitry Andric      ISA_MICROMIPS;
11740b57cec5SDimitry Andricdef : MipsPat<(MipsGotHi texternalsym:$in), (LUi_MM texternalsym:$in)>,
11750b57cec5SDimitry Andric      ISA_MICROMIPS;
11760b57cec5SDimitry Andric
11770b57cec5SDimitry Andricdef : MipsPat<(MipsTlsHi tglobaltlsaddr:$in), (LUi_MM tglobaltlsaddr:$in)>,
11780b57cec5SDimitry Andric      ISA_MICROMIPS;
11790b57cec5SDimitry Andric
11800b57cec5SDimitry Andric// gp_rel relocs
11810b57cec5SDimitry Andricdef : MipsPat<(add GPR32:$gp, (MipsGPRel tglobaladdr:$in)),
11820b57cec5SDimitry Andric              (ADDiu_MM GPR32:$gp, tglobaladdr:$in)>, ISA_MICROMIPS;
11830b57cec5SDimitry Andricdef : MipsPat<(add GPR32:$gp, (MipsGPRel tconstpool:$in)),
11840b57cec5SDimitry Andric              (ADDiu_MM GPR32:$gp, tconstpool:$in)>, ISA_MICROMIPS;
11850b57cec5SDimitry Andric
11860b57cec5SDimitry Andricdef : WrapperPat<tglobaladdr, ADDiu_MM, GPR32>, ISA_MICROMIPS;
11870b57cec5SDimitry Andricdef : WrapperPat<tconstpool, ADDiu_MM, GPR32>, ISA_MICROMIPS;
11880b57cec5SDimitry Andricdef : WrapperPat<texternalsym, ADDiu_MM, GPR32>, ISA_MICROMIPS;
11890b57cec5SDimitry Andricdef : WrapperPat<tblockaddress, ADDiu_MM, GPR32>, ISA_MICROMIPS;
11900b57cec5SDimitry Andricdef : WrapperPat<tjumptable, ADDiu_MM, GPR32>, ISA_MICROMIPS;
11910b57cec5SDimitry Andricdef : WrapperPat<tglobaltlsaddr, ADDiu_MM, GPR32>, ISA_MICROMIPS;
11920b57cec5SDimitry Andric
11930b57cec5SDimitry Andricdef : MipsPat<(atomic_load_8 addr:$a), (LB_MM addr:$a)>, ISA_MICROMIPS;
11940b57cec5SDimitry Andricdef : MipsPat<(atomic_load_16 addr:$a), (LH_MM addr:$a)>, ISA_MICROMIPS;
11950b57cec5SDimitry Andricdef : MipsPat<(atomic_load_32 addr:$a), (LW_MM addr:$a)>, ISA_MICROMIPS;
11960b57cec5SDimitry Andric
11970b57cec5SDimitry Andricdef : MipsPat<(i32 immLi16:$imm),
11980b57cec5SDimitry Andric              (LI16_MM immLi16:$imm)>, ISA_MICROMIPS;
11990b57cec5SDimitry Andric
12000b57cec5SDimitry Andricdefm : MaterializeImms<i32, ZERO, ADDiu_MM, LUi_MM, ORi_MM>, ISA_MICROMIPS;
12010b57cec5SDimitry Andric
12020b57cec5SDimitry Andricdef : MipsPat<(not GPRMM16:$in),
12030b57cec5SDimitry Andric              (NOT16_MM GPRMM16:$in)>, ISA_MICROMIPS;
12040b57cec5SDimitry Andricdef : MipsPat<(not GPR32:$in),
12050b57cec5SDimitry Andric              (NOR_MM GPR32Opnd:$in, ZERO)>, ISA_MICROMIPS;
12060b57cec5SDimitry Andric
12070b57cec5SDimitry Andricdef : MipsPat<(add GPRMM16:$src, immSExtAddiur2:$imm),
12080b57cec5SDimitry Andric              (ADDIUR2_MM GPRMM16:$src, immSExtAddiur2:$imm)>, ISA_MICROMIPS;
12090b57cec5SDimitry Andricdef : MipsPat<(add GPR32:$src, immSExtAddius5:$imm),
12100b57cec5SDimitry Andric              (ADDIUS5_MM GPR32:$src, immSExtAddius5:$imm)>, ISA_MICROMIPS;
12110b57cec5SDimitry Andricdef : MipsPat<(add GPR32:$src, immSExt16:$imm),
12120b57cec5SDimitry Andric              (ADDiu_MM GPR32:$src, immSExt16:$imm)>, ISA_MICROMIPS;
12130b57cec5SDimitry Andric
12140b57cec5SDimitry Andricdef : MipsPat<(and GPRMM16:$src, immZExtAndi16:$imm),
12150b57cec5SDimitry Andric              (ANDI16_MM GPRMM16:$src, immZExtAndi16:$imm)>, ISA_MICROMIPS;
12160b57cec5SDimitry Andricdef : MipsPat<(and GPR32:$src, immZExt16:$imm),
12170b57cec5SDimitry Andric              (ANDi_MM GPR32:$src, immZExt16:$imm)>, ISA_MICROMIPS;
12180b57cec5SDimitry Andric
12190b57cec5SDimitry Andricdef : MipsPat<(shl GPRMM16:$src, immZExt2Shift:$imm),
12200b57cec5SDimitry Andric              (SLL16_MM GPRMM16:$src, immZExt2Shift:$imm)>, ISA_MICROMIPS;
12210b57cec5SDimitry Andricdef : MipsPat<(shl GPR32:$src, immZExt5:$imm),
12220b57cec5SDimitry Andric              (SLL_MM GPR32:$src, immZExt5:$imm)>, ISA_MICROMIPS;
12230b57cec5SDimitry Andricdef : MipsPat<(shl GPR32:$lhs, GPR32:$rhs),
12240b57cec5SDimitry Andric              (SLLV_MM GPR32:$lhs, GPR32:$rhs)>, ISA_MICROMIPS;
12250b57cec5SDimitry Andric
12260b57cec5SDimitry Andricdef : MipsPat<(srl GPRMM16:$src, immZExt2Shift:$imm),
12270b57cec5SDimitry Andric              (SRL16_MM GPRMM16:$src, immZExt2Shift:$imm)>, ISA_MICROMIPS;
12280b57cec5SDimitry Andricdef : MipsPat<(srl GPR32:$src, immZExt5:$imm),
12290b57cec5SDimitry Andric              (SRL_MM GPR32:$src, immZExt5:$imm)>, ISA_MICROMIPS;
12300b57cec5SDimitry Andricdef : MipsPat<(srl GPR32:$lhs, GPR32:$rhs),
12310b57cec5SDimitry Andric              (SRLV_MM GPR32:$lhs, GPR32:$rhs)>, ISA_MICROMIPS;
12320b57cec5SDimitry Andric
12330b57cec5SDimitry Andricdef : MipsPat<(sra GPR32:$src, immZExt5:$imm),
12340b57cec5SDimitry Andric              (SRA_MM GPR32:$src, immZExt5:$imm)>, ISA_MICROMIPS;
12350b57cec5SDimitry Andricdef : MipsPat<(sra GPR32:$lhs, GPR32:$rhs),
12360b57cec5SDimitry Andric              (SRAV_MM GPR32:$lhs, GPR32:$rhs)>, ISA_MICROMIPS;
12370b57cec5SDimitry Andric
12380b57cec5SDimitry Andricdef : MipsPat<(store GPRMM16:$src, addrimm4lsl2:$addr),
12390b57cec5SDimitry Andric              (SW16_MM GPRMM16:$src, addrimm4lsl2:$addr)>, ISA_MICROMIPS;
12400b57cec5SDimitry Andricdef : MipsPat<(store GPR32:$src, addr:$addr),
12410b57cec5SDimitry Andric              (SW_MM GPR32:$src, addr:$addr)>, ISA_MICROMIPS;
12420b57cec5SDimitry Andric
12430b57cec5SDimitry Andricdef : MipsPat<(load addrimm4lsl2:$addr),
12440b57cec5SDimitry Andric              (LW16_MM addrimm4lsl2:$addr)>, ISA_MICROMIPS;
12450b57cec5SDimitry Andricdef : MipsPat<(load addr:$addr),
12460b57cec5SDimitry Andric              (LW_MM addr:$addr)>, ISA_MICROMIPS;
12470b57cec5SDimitry Andricdef : MipsPat<(subc GPR32:$lhs, GPR32:$rhs),
12480b57cec5SDimitry Andric              (SUBu_MM GPR32:$lhs, GPR32:$rhs)>, ISA_MICROMIPS;
12490b57cec5SDimitry Andric
12500b57cec5SDimitry Andricdef : MipsPat<(i32 (extloadi1  addr:$src)), (LBu_MM addr:$src)>,
12510b57cec5SDimitry Andric      ISA_MICROMIPS;
12520b57cec5SDimitry Andric
12530b57cec5SDimitry Andricdef : MipsPat<(i32 (extloadi8  addr:$src)), (LBu_MM addr:$src)>,
12540b57cec5SDimitry Andric      ISA_MICROMIPS;
12550b57cec5SDimitry Andric
12560b57cec5SDimitry Andricdef : MipsPat<(i32 (extloadi16 addr:$src)), (LHu_MM addr:$src)>,
12570b57cec5SDimitry Andric      ISA_MICROMIPS;
12580b57cec5SDimitry Andric
12590b57cec5SDimitry Andriclet AddedComplexity = 40 in
12600b57cec5SDimitry Andric  def : MipsPat<(i32 (sextloadi16 addrRegImm:$a)),
12610b57cec5SDimitry Andric                (LH_MM addrRegImm:$a)>, ISA_MICROMIPS;
12620b57cec5SDimitry Andric
12630b57cec5SDimitry Andric
12640b57cec5SDimitry Andricdef : MipsPat<(bswap GPR32:$rt), (ROTR_MM (WSBH_MM GPR32:$rt), 16)>,
12650b57cec5SDimitry Andric      ISA_MICROMIPS;
12660b57cec5SDimitry Andric
12670b57cec5SDimitry Andricdef : MipsPat<(MipsJmpLink (i32 texternalsym:$dst)),
12680b57cec5SDimitry Andric              (JAL_MM texternalsym:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6;
12690b57cec5SDimitry Andricdef : MipsPat<(MipsTailCall (iPTR tglobaladdr:$dst)),
12700b57cec5SDimitry Andric              (TAILCALL_MM tglobaladdr:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6;
12710b57cec5SDimitry Andricdef : MipsPat<(MipsTailCall (iPTR texternalsym:$dst)),
12720b57cec5SDimitry Andric              (TAILCALL_MM texternalsym:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6;
12730b57cec5SDimitry Andric
12740b57cec5SDimitry Andricdefm : BrcondPats<GPR32, BEQ_MM, BEQ_MM, BNE_MM, SLT_MM, SLTu_MM, SLTi_MM,
12750b57cec5SDimitry Andric                  SLTiu_MM, ZERO>, ISA_MICROMIPS32_NOT_MIPS32R6;
12760b57cec5SDimitry Andric
12770b57cec5SDimitry Andricdef : MipsPat<(brcond (i32 (setlt i32:$lhs, 1)), bb:$dst),
12780b57cec5SDimitry Andric              (BLEZ_MM i32:$lhs, bb:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6;
12790b57cec5SDimitry Andricdef : MipsPat<(brcond (i32 (setgt i32:$lhs, -1)), bb:$dst),
12800b57cec5SDimitry Andric              (BGEZ_MM i32:$lhs, bb:$dst)>, ISA_MICROMIPS32_NOT_MIPS32R6;
12810b57cec5SDimitry Andric
12820b57cec5SDimitry Andricdefm : SeteqPats<GPR32, SLTiu_MM, XOR_MM, SLTu_MM, ZERO>, ISA_MICROMIPS;
12830b57cec5SDimitry Andricdefm : SetlePats<GPR32, XORi_MM, SLT_MM, SLTu_MM>, ISA_MICROMIPS;
12840b57cec5SDimitry Andricdefm : SetgtPats<GPR32, SLT_MM, SLTu_MM>, ISA_MICROMIPS;
12850b57cec5SDimitry Andricdefm : SetgePats<GPR32, XORi_MM, SLT_MM, SLTu_MM>, ISA_MICROMIPS;
12860b57cec5SDimitry Andricdefm : SetgeImmPats<GPR32, XORi_MM, SLTi_MM, SLTiu_MM>, ISA_MICROMIPS;
12870b57cec5SDimitry Andric
12880b57cec5SDimitry Andric// Select patterns
12890b57cec5SDimitry Andric
12900b57cec5SDimitry Andric// Instantiation of conditional move patterns.
12910b57cec5SDimitry Andricdefm : MovzPats0<GPR32, GPR32, MOVZ_I_MM, SLT_MM, SLTu_MM, SLTi_MM, SLTiu_MM>,
12920b57cec5SDimitry Andric       ISA_MICROMIPS32_NOT_MIPS32R6;
12930b57cec5SDimitry Andricdefm : MovzPats1<GPR32, GPR32, MOVZ_I_MM, XOR_MM>,
12940b57cec5SDimitry Andric       ISA_MICROMIPS32_NOT_MIPS32R6;
12950b57cec5SDimitry Andricdefm : MovzPats2<GPR32, GPR32, MOVZ_I_MM, XORi_MM>,
12960b57cec5SDimitry Andric       ISA_MICROMIPS32_NOT_MIPS32R6;
12970b57cec5SDimitry Andric
12980b57cec5SDimitry Andric
12990b57cec5SDimitry Andricdefm : MovnPats<GPR32, GPR32, MOVN_I_MM, XOR_MM>, INSN_MIPS4_32_NOT_32R6_64R6;
13000b57cec5SDimitry Andric
13010b57cec5SDimitry Andric// Instantiation of conditional move patterns.
13020b57cec5SDimitry Andricdefm : MovzPats0<GPR32, GPR32, MOVZ_I_MM, SLT_MM, SLTu_MM, SLTi_MM, SLTiu_MM>,
13030b57cec5SDimitry Andric       ISA_MICROMIPS32_NOT_MIPS32R6;
13040b57cec5SDimitry Andricdefm : MovzPats1<GPR32, GPR32, MOVZ_I_MM, XOR_MM>,
13050b57cec5SDimitry Andric       ISA_MICROMIPS32_NOT_MIPS32R6;
13060b57cec5SDimitry Andricdefm : MovzPats2<GPR32, GPR32, MOVZ_I_MM, XORi_MM>,
13070b57cec5SDimitry Andric       ISA_MICROMIPS32_NOT_MIPS32R6;
13080b57cec5SDimitry Andric
13090b57cec5SDimitry Andricdefm : MovnPats<GPR32, GPR32, MOVN_I_MM, XOR_MM>, ISA_MICROMIPS32_NOT_MIPS32R6;
13100b57cec5SDimitry Andric
13110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
13120b57cec5SDimitry Andric// MicroMips instruction aliases
13130b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
13140b57cec5SDimitry Andric
13150b57cec5SDimitry Andricclass UncondBranchMMPseudo<string opstr> :
13160b57cec5SDimitry Andric  MipsAsmPseudoInst<(outs), (ins brtarget_mm:$offset),
13170b57cec5SDimitry Andric                    !strconcat(opstr, "\t$offset")>;
13180b57cec5SDimitry Andric
13190b57cec5SDimitry Andricdef B_MM_Pseudo : UncondBranchMMPseudo<"b">, ISA_MICROMIPS;
13200b57cec5SDimitry Andric
13210b57cec5SDimitry Andriclet EncodingPredicates = [InMicroMips] in {
13220b57cec5SDimitry Andric  def SDIV_MM_Pseudo : MultDivPseudo<SDIV_MM, ACC64, GPR32Opnd, MipsDivRem,
13230b57cec5SDimitry Andric                                     II_DIV, 0, 1, 1>, ISA_MIPS1_NOT_32R6_64R6;
13240b57cec5SDimitry Andric  def UDIV_MM_Pseudo : MultDivPseudo<UDIV_MM, ACC64, GPR32Opnd, MipsDivRemU,
13250b57cec5SDimitry Andric                                     II_DIVU, 0, 1, 1>, ISA_MIPS1_NOT_32R6_64R6;
13260b57cec5SDimitry Andric
13270b57cec5SDimitry Andric  def : MipsInstAlias<"wait", (WAIT_MM 0x0), 1>, ISA_MICROMIPS;
13280b57cec5SDimitry Andric  def : MipsInstAlias<"nop", (SLL_MM ZERO, ZERO, 0), 1>, ISA_MICROMIPS;
13290b57cec5SDimitry Andric  def : MipsInstAlias<"nop", (MOVE16_MM ZERO, ZERO), 1>, ISA_MICROMIPS;
13300b57cec5SDimitry Andric  def : MipsInstAlias<"ei", (EI_MM ZERO), 1>, ISA_MICROMIPS;
13310b57cec5SDimitry Andric  def : MipsInstAlias<"di", (DI_MM ZERO), 1>, ISA_MICROMIPS;
13320b57cec5SDimitry Andric  def : MipsInstAlias<"neg $rt, $rs",
13330b57cec5SDimitry Andric                      (SUB_MM GPR32Opnd:$rt, ZERO, GPR32Opnd:$rs), 1>,
13340b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
13350b57cec5SDimitry Andric  def : MipsInstAlias<"neg $rt",
13360b57cec5SDimitry Andric                      (SUB_MM GPR32Opnd:$rt, ZERO, GPR32Opnd:$rt), 1>,
13370b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
13380b57cec5SDimitry Andric  def : MipsInstAlias<"negu $rt, $rs",
13390b57cec5SDimitry Andric                      (SUBu_MM GPR32Opnd:$rt, ZERO, GPR32Opnd:$rs), 1>,
13400b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
13410b57cec5SDimitry Andric  def : MipsInstAlias<"negu $rt",
13420b57cec5SDimitry Andric                      (SUBu_MM GPR32Opnd:$rt, ZERO, GPR32Opnd:$rt), 1>,
13430b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
13440b57cec5SDimitry Andric  def : MipsInstAlias<"teq $rs, $rt",
13450b57cec5SDimitry Andric                      (TEQ_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
13460b57cec5SDimitry Andric  def : MipsInstAlias<"tge $rs, $rt",
13470b57cec5SDimitry Andric                      (TGE_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
13480b57cec5SDimitry Andric  def : MipsInstAlias<"tgeu $rs, $rt",
13490b57cec5SDimitry Andric                      (TGEU_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
13500b57cec5SDimitry Andric  def : MipsInstAlias<"tlt $rs, $rt",
13510b57cec5SDimitry Andric                      (TLT_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
13520b57cec5SDimitry Andric  def : MipsInstAlias<"tltu $rs, $rt",
13530b57cec5SDimitry Andric                      (TLTU_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
13540b57cec5SDimitry Andric  def : MipsInstAlias<"tne $rs, $rt",
13550b57cec5SDimitry Andric                      (TNE_MM GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>;
13560b57cec5SDimitry Andric  def : MipsInstAlias<
13570b57cec5SDimitry Andric          "sgt $rd, $rs, $rt",
13580b57cec5SDimitry Andric          (SLT_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
13590b57cec5SDimitry Andric  def : MipsInstAlias<
13600b57cec5SDimitry Andric          "sgt $rs, $rt",
13610b57cec5SDimitry Andric          (SLT_MM GPR32Opnd:$rs, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
13620b57cec5SDimitry Andric  def : MipsInstAlias<
13630b57cec5SDimitry Andric          "sgtu $rd, $rs, $rt",
13640b57cec5SDimitry Andric          (SLTu_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
13650b57cec5SDimitry Andric  def : MipsInstAlias<
13660b57cec5SDimitry Andric          "sgtu $rs, $rt",
13670b57cec5SDimitry Andric          (SLTu_MM GPR32Opnd:$rs, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
13680b57cec5SDimitry Andric  def : MipsInstAlias<"sll $rd, $rt, $rs",
13690b57cec5SDimitry Andric                      (SLLV_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
13700b57cec5SDimitry Andric  def : MipsInstAlias<"sra $rd, $rt, $rs",
13710b57cec5SDimitry Andric                      (SRAV_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
13720b57cec5SDimitry Andric  def : MipsInstAlias<"srl $rd, $rt, $rs",
13730b57cec5SDimitry Andric                      (SRLV_MM GPR32Opnd:$rd, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>;
13740b57cec5SDimitry Andric  def : MipsInstAlias<"sll $rd, $rt",
13750b57cec5SDimitry Andric                      (SLLV_MM GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rt), 0>;
13760b57cec5SDimitry Andric  def : MipsInstAlias<"sra $rd, $rt",
13770b57cec5SDimitry Andric                      (SRAV_MM GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rt), 0>;
13780b57cec5SDimitry Andric  def : MipsInstAlias<"srl $rd, $rt",
13790b57cec5SDimitry Andric                      (SRLV_MM GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rt), 0>;
13800b57cec5SDimitry Andric  def : MipsInstAlias<"sll $rd, $shamt",
13810b57cec5SDimitry Andric                      (SLL_MM GPR32Opnd:$rd, GPR32Opnd:$rd, uimm5:$shamt), 0>;
13820b57cec5SDimitry Andric  def : MipsInstAlias<"sra $rd, $shamt",
13830b57cec5SDimitry Andric                      (SRA_MM GPR32Opnd:$rd, GPR32Opnd:$rd, uimm5:$shamt), 0>;
13840b57cec5SDimitry Andric  def : MipsInstAlias<"srl $rd, $shamt",
13850b57cec5SDimitry Andric                      (SRL_MM GPR32Opnd:$rd, GPR32Opnd:$rd, uimm5:$shamt), 0>;
13860b57cec5SDimitry Andric  def : MipsInstAlias<"rotr $rt, $imm",
13870b57cec5SDimitry Andric                      (ROTR_MM GPR32Opnd:$rt, GPR32Opnd:$rt, uimm5:$imm), 0>;
13880b57cec5SDimitry Andric  def : MipsInstAlias<"syscall", (SYSCALL_MM 0), 1>, ISA_MICROMIPS;
13890b57cec5SDimitry Andric
13900b57cec5SDimitry Andric  def : MipsInstAlias<"sync", (SYNC_MM 0), 1>, ISA_MICROMIPS;
13910b57cec5SDimitry Andric
13920b57cec5SDimitry Andric  defm : OneOrTwoOperandMacroImmediateAlias<"add", ADDi_MM>, ISA_MICROMIPS;
13930b57cec5SDimitry Andric
13940b57cec5SDimitry Andric  defm : OneOrTwoOperandMacroImmediateAlias<"addu", ADDiu_MM>, ISA_MICROMIPS;
13950b57cec5SDimitry Andric
13960b57cec5SDimitry Andric  defm : OneOrTwoOperandMacroImmediateAlias<"and", ANDi_MM>, ISA_MICROMIPS;
13970b57cec5SDimitry Andric
13980b57cec5SDimitry Andric  defm : OneOrTwoOperandMacroImmediateAlias<"or", ORi_MM>, ISA_MICROMIPS;
13990b57cec5SDimitry Andric
14000b57cec5SDimitry Andric  defm : OneOrTwoOperandMacroImmediateAlias<"xor", XORi_MM>, ISA_MICROMIPS;
14010b57cec5SDimitry Andric
14020b57cec5SDimitry Andric  defm : OneOrTwoOperandMacroImmediateAlias<"slt", SLTi_MM>, ISA_MICROMIPS;
14030b57cec5SDimitry Andric
14040b57cec5SDimitry Andric  defm : OneOrTwoOperandMacroImmediateAlias<"sltu", SLTiu_MM>, ISA_MICROMIPS;
14050b57cec5SDimitry Andric
14060b57cec5SDimitry Andric  def : MipsInstAlias<"not $rt, $rs",
14070b57cec5SDimitry Andric                      (NOR_MM GPR32Opnd:$rt, GPR32Opnd:$rs, ZERO), 0>,
14080b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
14090b57cec5SDimitry Andric  def : MipsInstAlias<"not $rt",
14100b57cec5SDimitry Andric                      (NOR_MM GPR32Opnd:$rt, GPR32Opnd:$rt, ZERO), 0>,
14110b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
14120b57cec5SDimitry Andric  def : MipsInstAlias<"bnez $rs,$offset",
14130b57cec5SDimitry Andric                      (BNE_MM GPR32Opnd:$rs, ZERO, brtarget:$offset), 0>,
14140b57cec5SDimitry Andric        ISA_MICROMIPS;
14150b57cec5SDimitry Andric  def : MipsInstAlias<"beqz $rs,$offset",
14160b57cec5SDimitry Andric                      (BEQ_MM GPR32Opnd:$rs, ZERO, brtarget:$offset), 0>,
14170b57cec5SDimitry Andric        ISA_MICROMIPS;
14180b57cec5SDimitry Andric  def : MipsInstAlias<"seh $rd", (SEH_MM GPR32Opnd:$rd, GPR32Opnd:$rd), 0>,
14190b57cec5SDimitry Andric                     ISA_MICROMIPS;
14200b57cec5SDimitry Andric  def : MipsInstAlias<"seb $rd", (SEB_MM GPR32Opnd:$rd, GPR32Opnd:$rd), 0>,
14210b57cec5SDimitry Andric                     ISA_MICROMIPS;
14220b57cec5SDimitry Andric  def : MipsInstAlias<"break", (BREAK_MM 0, 0), 1>, ISA_MICROMIPS;
14230b57cec5SDimitry Andric  def : MipsInstAlias<"break $imm", (BREAK_MM uimm10:$imm, 0), 1>,
14240b57cec5SDimitry Andric        ISA_MICROMIPS;
14250b57cec5SDimitry Andric  def : MipsInstAlias<"bal $offset", (BGEZAL_MM ZERO, brtarget_mm:$offset), 1>,
14260b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
14270b57cec5SDimitry Andric
14280b57cec5SDimitry Andric  def : MipsInstAlias<"j $rs", (JR_MM GPR32Opnd:$rs), 0>,
14290b57cec5SDimitry Andric        ISA_MICROMIPS32_NOT_MIPS32R6;
14300b57cec5SDimitry Andric}
14310b57cec5SDimitry Andricdef : MipsInstAlias<"rdhwr $rt, $rs",
14320b57cec5SDimitry Andric                    (RDHWR_MM GPR32Opnd:$rt, HWRegsOpnd:$rs, 0), 1>,
14330b57cec5SDimitry Andric      ISA_MICROMIPS32_NOT_MIPS32R6;
14340b57cec5SDimitry Andric
14350b57cec5SDimitry Andricdef : MipsInstAlias<"hypcall", (HYPCALL_MM 0), 1>,
14360b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
14370b57cec5SDimitry Andricdef : MipsInstAlias<"mfgc0 $rt, $rs",
14380b57cec5SDimitry Andric                    (MFGC0_MM GPR32Opnd:$rt, COP0Opnd:$rs, 0), 0>,
14390b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
14400b57cec5SDimitry Andricdef : MipsInstAlias<"mfhgc0 $rt, $rs",
14410b57cec5SDimitry Andric                    (MFHGC0_MM GPR32Opnd:$rt, COP0Opnd:$rs, 0), 0>,
14420b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
14430b57cec5SDimitry Andricdef : MipsInstAlias<"mtgc0 $rt, $rs",
14440b57cec5SDimitry Andric                    (MTGC0_MM COP0Opnd:$rs, GPR32Opnd:$rt, 0), 0>,
14450b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
14460b57cec5SDimitry Andricdef : MipsInstAlias<"mthgc0 $rt, $rs",
14470b57cec5SDimitry Andric                    (MTHGC0_MM COP0Opnd:$rs, GPR32Opnd:$rt, 0), 0>,
14480b57cec5SDimitry Andric                    ISA_MICROMIPS32R5, ASE_VIRT;
14490b57cec5SDimitry Andricdef : MipsInstAlias<"sw $rt, $offset",
14500b57cec5SDimitry Andric                    (SWSP_MM GPR32Opnd:$rt, mem_mm_sp_imm5_lsl2:$offset), 1>,
14510b57cec5SDimitry Andric                    ISA_MICROMIPS;
1452