Index: lib/Target/Mips/MicroMips32r6InstrInfo.td =================================================================== --- lib/Target/Mips/MicroMips32r6InstrInfo.td +++ lib/Target/Mips/MicroMips32r6InstrInfo.td @@ -237,6 +237,7 @@ dag OutOperandList = (outs); string AsmString = !strconcat(instr_asm, "\t$rt, $offset"); list Defs = [AT]; + InstrItinClass Itinerary = II_BCCZC; } class BEQZALC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"beqzalc", brtarget_mm, @@ -275,6 +276,7 @@ dag OutOperandList = (outs); string AsmString = !strconcat(instr_asm, "\t$rs, $rt, $offset"); list Defs = [AT]; + InstrItinClass Itinerary = II_BCCC; } class BGEC_MMR6_DESC : CMP_CBR_2R_MMR6_DESC_BASE<"bgec", brtarget_mm, @@ -333,27 +335,28 @@ // //===----------------------------------------------------------------------===// -class ADD_MMR6_DESC : ArithLogicR<"add", GPR32Opnd>; +class ADD_MMR6_DESC : ArithLogicR<"add", GPR32Opnd, 1, II_ADD>; class ADDIU_MMR6_DESC : ArithLogicI<"addiu", simm16, GPR32Opnd, II_ADDIU, immSExt16, add>; -class ADDU_MMR6_DESC : ArithLogicR<"addu", GPR32Opnd>; +class ADDU_MMR6_DESC : ArithLogicR<"addu", GPR32Opnd, 1, II_ADDU>; class MUL_MMR6_DESC : ArithLogicR<"mul", GPR32Opnd, 1, II_MUL, mul>; class MUH_MMR6_DESC : ArithLogicR<"muh", GPR32Opnd, 1, II_MUH, mulhs>; class MULU_MMR6_DESC : ArithLogicR<"mulu", GPR32Opnd, 1, II_MULU>; class MUHU_MMR6_DESC : ArithLogicR<"muhu", GPR32Opnd, 1, II_MUHU, mulhu>; -class BC_MMR6_DESC_BASE +class BC_MMR6_DESC_BASE : BRANCH_DESC_BASE, MMR6Arch { dag InOperandList = (ins opnd:$offset); dag OutOperandList = (outs); string AsmString = !strconcat(instr_asm, "\t$offset"); bit isBarrier = 1; + InstrItinClass Itinerary = Itin; } -class BALC_MMR6_DESC : BC_MMR6_DESC_BASE<"balc", brtarget26_mm> { +class BALC_MMR6_DESC : BC_MMR6_DESC_BASE<"balc", brtarget26_mm, II_BALC> { bit isCall = 1; list Defs = [RA]; } -class BC_MMR6_DESC : BC_MMR6_DESC_BASE<"bc", brtarget26_mm>; +class BC_MMR6_DESC : BC_MMR6_DESC_BASE<"bc", brtarget26_mm, II_BC>; class BC16_MMR6_DESC : MicroMipsInst16<(outs), (ins brtarget10_mm:$offset), !strconcat("bc16", "\t$offset"), [], @@ -377,8 +380,8 @@ class BEQZC16_MMR6_DESC : BEQZC_BNEZC_MM16R6_DESC_BASE<"beqzc16">; class BNEZC16_MMR6_DESC : BEQZC_BNEZC_MM16R6_DESC_BASE<"bnezc16">; -class SUB_MMR6_DESC : ArithLogicR<"sub", GPR32Opnd>; -class SUBU_MMR6_DESC : ArithLogicR<"subu", GPR32Opnd>; +class SUB_MMR6_DESC : ArithLogicR<"sub", GPR32Opnd, 0, II_SUB>; +class SUBU_MMR6_DESC : ArithLogicR<"subu", GPR32Opnd, 0,II_SUBU>; class BITSWAP_MMR6_DESC_BASE : MMR6Arch { @@ -386,6 +389,7 @@ dag InOperandList = (ins GPROpnd:$rt); string AsmString = !strconcat(instr_asm, "\t$rd, $rt"); list Pattern = []; + InstrItinClass Itinerary = II_BITSWAP; } class BITSWAP_MMR6_DESC : BITSWAP_MMR6_DESC_BASE<"bitswap", GPR32Opnd>; @@ -393,63 +397,74 @@ class BRK_MMR6_DESC : BRK_FT<"break">; class CACHE_HINT_MMR6_DESC : MMR6Arch { + RegisterOperand GPROpnd, InstrItinClass Itin> + : MMR6Arch { dag OutOperandList = (outs); dag InOperandList = (ins MemOpnd:$addr, uimm5:$hint); string AsmString = !strconcat(instr_asm, "\t$hint, $addr"); list Pattern = []; string DecoderMethod = "DecodeCacheOpMM"; + InstrItinClass Itinerary = Itin; } -class CACHE_MMR6_DESC : CACHE_HINT_MMR6_DESC<"cache", mem_mm_12, GPR32Opnd>; -class PREF_MMR6_DESC : CACHE_HINT_MMR6_DESC<"pref", mem_mm_12, GPR32Opnd>; +class CACHE_MMR6_DESC : CACHE_HINT_MMR6_DESC<"cache", mem_mm_12, GPR32Opnd, + II_CACHE>; +class PREF_MMR6_DESC : CACHE_HINT_MMR6_DESC<"pref", mem_mm_12, GPR32Opnd, + II_PREF>; class PREFE_CACHEE_MMR6_DESC_BASE : - CACHE_HINT_MMR6_DESC { + RegisterOperand GPROpnd, InstrItinClass Itin> + : CACHE_HINT_MMR6_DESC { string DecoderMethod = "DecodePrefeOpMM"; } -class PREFE_MMR6_DESC : PREFE_CACHEE_MMR6_DESC_BASE<"prefe", mem_mm_9, GPR32Opnd>; -class CACHEE_MMR6_DESC : PREFE_CACHEE_MMR6_DESC_BASE<"cachee", mem_mm_9, GPR32Opnd>; +class PREFE_MMR6_DESC : PREFE_CACHEE_MMR6_DESC_BASE<"prefe", mem_mm_9, + GPR32Opnd, II_PREFE>; +class CACHEE_MMR6_DESC : PREFE_CACHEE_MMR6_DESC_BASE<"cachee", mem_mm_9, + GPR32Opnd, II_CACHEE>; class LB_LBU_MMR6_DESC_BASE : MMR6Arch { + RegisterOperand GPROpnd, InstrItinClass Itin> + : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rt); dag InOperandList = (ins MemOpnd:$addr); string AsmString = !strconcat(instr_asm, "\t$rt, $addr"); string DecoderMethod = "DecodeLoadByte15"; bit mayLoad = 1; + InstrItinClass Itinerary = Itin; } -class LB_MMR6_DESC : LB_LBU_MMR6_DESC_BASE<"lb", mem_mm_16, GPR32Opnd>; -class LBU_MMR6_DESC : LB_LBU_MMR6_DESC_BASE<"lbu", mem_mm_16, GPR32Opnd>; +class LB_MMR6_DESC : LB_LBU_MMR6_DESC_BASE<"lb", mem_mm_16, GPR32Opnd, II_LB>; +class LBU_MMR6_DESC : LB_LBU_MMR6_DESC_BASE<"lbu", mem_mm_16, GPR32Opnd, + II_LBU>; class LBE_LBUE_MMR6_DESC_BASE - : LB_LBU_MMR6_DESC_BASE { + RegisterOperand GPROpnd, InstrItinClass Itin> + : LB_LBU_MMR6_DESC_BASE { let DecoderMethod = "DecodeLoadByte9"; } -class LBE_MMR6_DESC : LBE_LBUE_MMR6_DESC_BASE<"lbe", mem_mm_9, GPR32Opnd>; -class LBUE_MMR6_DESC : LBE_LBUE_MMR6_DESC_BASE<"lbue", mem_mm_9, GPR32Opnd>; +class LBE_MMR6_DESC : LBE_LBUE_MMR6_DESC_BASE<"lbe", mem_mm_9, GPR32Opnd, + II_LBE>; +class LBUE_MMR6_DESC : LBE_LBUE_MMR6_DESC_BASE<"lbue", mem_mm_9, GPR32Opnd, + II_LBUE>; -class CLO_CLZ_MMR6_DESC_BASE - : MMR6Arch { +class CLO_CLZ_MMR6_DESC_BASE : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rt); dag InOperandList = (ins GPROpnd:$rs); string AsmString = !strconcat(instr_asm, "\t$rt, $rs"); + InstrItinClass Itinerary = Itin; } -class CLO_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clo", GPR32Opnd>; -class CLZ_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clz", GPR32Opnd>; +class CLO_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clo", GPR32Opnd, II_CLO>; +class CLZ_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clz", GPR32Opnd, II_CLZ>; -class EHB_MMR6_DESC : Barrier<"ehb">; -class EI_MMR6_DESC : DEI_FT<"ei", GPR32Opnd>; -class DI_MMR6_DESC : DEI_FT<"di", GPR32Opnd>; +class EHB_MMR6_DESC : Barrier<"ehb", II_EHB>; +class EI_MMR6_DESC : DEI_FT<"ei", GPR32Opnd, II_EI>; +class DI_MMR6_DESC : DEI_FT<"di", GPR32Opnd, II_DI>; -class ERET_MMR6_DESC : ER_FT<"eret">; -class DERET_MMR6_DESC : ER_FT<"deret">; -class ERETNC_MMR6_DESC : ER_FT<"eretnc">; +class ERET_MMR6_DESC : ER_FT<"eret", II_ERET>; +class DERET_MMR6_DESC : ER_FT<"deret", II_DERET>; +class ERETNC_MMR6_DESC : ER_FT<"eretnc", II_ERETNC>; class JALRC16_MMR6_DESC_BASE : MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"), @@ -462,23 +477,25 @@ class JALRC16_MMR6_DESC : JALRC16_MMR6_DESC_BASE<"jalr", GPR32Opnd>; class JMP_MMR6_IDX_COMPACT_DESC_BASE + RegisterOperand GPROpnd, + InstrItinClass Itin> : MMR6Arch { dag InOperandList = (ins GPROpnd:$rt, opnd:$offset); string AsmString = !strconcat(opstr, "\t$rt, $offset"); list Pattern = []; bit isTerminator = 1; bit hasDelaySlot = 0; + InstrItinClass Itinerary = Itin; } class JIALC_MMR6_DESC : JMP_MMR6_IDX_COMPACT_DESC_BASE<"jialc", calloffset16, - GPR32Opnd> { + GPR32Opnd, II_JIALC> { bit isCall = 1; list Defs = [RA]; } class JIC_MMR6_DESC : JMP_MMR6_IDX_COMPACT_DESC_BASE<"jic", jmpoffset16, - GPR32Opnd> { + GPR32Opnd, II_JIC> { bit isBarrier = 1; list Defs = [AT]; } @@ -505,65 +522,76 @@ } class ALIGN_MMR6_DESC_BASE : MMR6Arch { + Operand ImmOpnd, InstrItinClass Itin> + : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rd); dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$bp); string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt, $bp"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class ALIGN_MMR6_DESC : ALIGN_MMR6_DESC_BASE<"align", GPR32Opnd, uimm2>; +class ALIGN_MMR6_DESC : ALIGN_MMR6_DESC_BASE<"align", GPR32Opnd, uimm2, + II_ALIGN>; -class AUI_MMR6_DESC_BASE - : MMR6Arch { +class AUI_MMR6_DESC_BASE : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rt); dag InOperandList = (ins GPROpnd:$rs, simm16:$imm); string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $imm"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class AUI_MMR6_DESC : AUI_MMR6_DESC_BASE<"aui", GPR32Opnd>; +class AUI_MMR6_DESC : AUI_MMR6_DESC_BASE<"aui", GPR32Opnd, II_AUI>; class SEB_MMR6_DESC : SignExtInReg<"seb", i8, GPR32Opnd, II_SEB>; class SEH_MMR6_DESC : SignExtInReg<"seh", i16, GPR32Opnd, II_SEH>; -class ALUIPC_MMR6_DESC_BASE - : MMR6Arch { +class ALUIPC_MMR6_DESC_BASE : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rt); dag InOperandList = (ins simm16:$imm); string AsmString = !strconcat(instr_asm, "\t$rt, $imm"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class ALUIPC_MMR6_DESC : ALUIPC_MMR6_DESC_BASE<"aluipc", GPR32Opnd>; -class AUIPC_MMR6_DESC : ALUIPC_MMR6_DESC_BASE<"auipc", GPR32Opnd>; +class ALUIPC_MMR6_DESC : ALUIPC_MMR6_DESC_BASE<"aluipc", GPR32Opnd, II_ALUIPC>; +class AUIPC_MMR6_DESC : ALUIPC_MMR6_DESC_BASE<"auipc", GPR32Opnd, II_AUIPC>; class LSA_MMR6_DESC_BASE : MMR6Arch { + Operand ImmOpnd, InstrItinClass Itin> + : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rd); dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$imm2); string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $rd, $imm2"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class LSA_MMR6_DESC : LSA_MMR6_DESC_BASE<"lsa", GPR32Opnd, uimm2_plus1>; +class LSA_MMR6_DESC : LSA_MMR6_DESC_BASE<"lsa", GPR32Opnd, uimm2_plus1, II_LSA>; class PCREL_MMR6_DESC_BASE : MMR6Arch { + Operand ImmOpnd, InstrItinClass Itin> + : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rt); dag InOperandList = (ins ImmOpnd:$imm); string AsmString = !strconcat(instr_asm, "\t$rt, $imm"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class ADDIUPC_MMR6_DESC : PCREL_MMR6_DESC_BASE<"addiupc", GPR32Opnd, simm19_lsl2>; -class LWPC_MMR6_DESC: PCREL_MMR6_DESC_BASE<"lwpc", GPR32Opnd, simm19_lsl2>; +class ADDIUPC_MMR6_DESC : PCREL_MMR6_DESC_BASE<"addiupc", GPR32Opnd, + simm19_lsl2, II_ADDIUPC>; +class LWPC_MMR6_DESC: PCREL_MMR6_DESC_BASE<"lwpc", GPR32Opnd, simm19_lsl2, + II_LWPC>; class LWP_MMR6_DESC : MMR6Arch<"lwp"> { dag OutOperandList = (outs regpair:$rd); dag InOperandList = (ins mem_simm12:$addr); string AsmString = !strconcat("lwp", "\t$rd, $addr"); list Pattern = []; - InstrItinClass Itin = NoItinerary; + InstrItinClass Itinerary = II_LWP; ComplexPattern Addr = addr; Format f = FrmI; string BaseOpcode = "lwp"; @@ -576,7 +604,7 @@ dag InOperandList = (ins regpair:$rd, mem_simm12:$addr); string AsmString = !strconcat("swp", "\t$rd, $addr"); list Pattern = []; - InstrItinClass Itin = NoItinerary; + InstrItinClass Itinerary = II_SWP; ComplexPattern Addr = addr; Format f = FrmI; string BaseOpcode = "swp"; @@ -584,17 +612,20 @@ bit mayStore = 1; } -class SELEQNE_Z_MMR6_DESC_BASE - : MMR6Arch { +class SELEQNE_Z_MMR6_DESC_BASE : MMR6Arch { dag OutOperandList = (outs GPROpnd:$rd); dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt); string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class SELEQZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"seleqz", GPR32Opnd>; -class SELNEZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"selnez", GPR32Opnd>; -class PAUSE_MMR6_DESC : Barrier<"pause">; +class SELEQZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"seleqz", GPR32Opnd, + II_SELCCZ>; +class SELNEZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"selnez", GPR32Opnd, + II_SELCCZ>; +class PAUSE_MMR6_DESC : Barrier<"pause", II_PAUSE>; class RDHWR_MMR6_DESC : MMR6Arch<"rdhwr">, MipsR6Inst { dag OutOperandList = (outs GPR32Opnd:$rt); dag InOperandList = (ins HWRegsOpnd:$rs, uimm3:$sel); @@ -605,10 +636,14 @@ } class WAIT_MMR6_DESC : WaitMM<"wait">; -class SSNOP_MMR6_DESC : Barrier<"ssnop">; +// FIXME: ssnop should not be defined for R6. Per MD000582 microMIPS32 6.03: +// Assemblers targeting specifically Release 6 should reject the SSNOP +// instruction with an error. +class SSNOP_MMR6_DESC : Barrier<"ssnop", II_SSNOP>; class SLL_MMR6_DESC : shift_rotate_imm<"sll", uimm5, GPR32Opnd, II_SLL>; class DIVMOD_MMR6_DESC_BASE : MipsR6Inst { dag OutOperandList = (outs GPROpnd:$rd); @@ -619,15 +654,16 @@ Format f = FrmR; let isCommutable = 0; let isReMaterializable = 1; + InstrItinClass Itinerary = Itin; // This instruction doesn't trap division by zero itself. We must insert // teq instructions as well. bit usesCustomInserter = 1; } -class DIV_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"div", GPR32Opnd, sdiv>; -class DIVU_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"divu", GPR32Opnd, udiv>; -class MOD_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"mod", GPR32Opnd, srem>; -class MODU_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"modu", GPR32Opnd, urem>; +class DIV_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"div", GPR32Opnd, II_DIV, sdiv>; +class DIVU_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"divu", GPR32Opnd, II_DIVU, udiv>; +class MOD_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"mod", GPR32Opnd, II_MOD, srem>; +class MODU_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"modu", GPR32Opnd, II_MODU, urem>; class AND_MMR6_DESC : ArithLogicR<"and", GPR32Opnd, 1, II_AND, and>; class ANDI_MMR6_DESC : ArithLogicI<"andi", uimm16, GPR32Opnd, II_ANDI>; class NOR_MMR6_DESC : LogicNOR<"nor", GPR32Opnd>; @@ -641,19 +677,21 @@ immZExt16, xor>; class SWE_MMR6_DESC_BASE : InstSE<(outs), (ins RO:$rt, MO:$addr), !strconcat(opstr, "\t$rt, $addr"), [(OpNode RO:$rt, Addr:$addr)], Itin, FrmI, opstr> { let DecoderMethod = "DecodeMem"; let mayStore = 1; } -class SW_MMR6_DESC : Store<"sw", GPR32Opnd>; -class SWE_MMR6_DESC : SWE_MMR6_DESC_BASE<"swe", GPR32Opnd, mem_simm9>; +class SW_MMR6_DESC : Store<"sw", GPR32Opnd> { + InstrItinClass Itinerary = II_SW; +} +class SWE_MMR6_DESC : SWE_MMR6_DESC_BASE<"swe", GPR32Opnd, mem_simm9, II_SWE>; -class WRPGPR_WSBH_MMR6_DESC_BASE - : MMR6Arch { +class WRPGPR_WSBH_MMR6_DESC_BASE : MMR6Arch { dag InOperandList = (ins RO:$rs); dag OutOperandList = (outs RO:$rt); string AsmString = !strconcat(instr_asm, "\t$rt, $rs"); @@ -661,18 +699,21 @@ Format f = FrmR; string BaseOpcode = instr_asm; bit hasSideEffects = 0; + InstrItinClass Itinerary = Itin; } -class WRPGPR_MMR6_DESC : WRPGPR_WSBH_MMR6_DESC_BASE<"wrpgpr", GPR32Opnd>; -class WSBH_MMR6_DESC : WRPGPR_WSBH_MMR6_DESC_BASE<"wsbh", GPR32Opnd>; +class WRPGPR_MMR6_DESC : WRPGPR_WSBH_MMR6_DESC_BASE<"wrpgpr", GPR32Opnd, + II_WRPGPR>; +class WSBH_MMR6_DESC : WRPGPR_WSBH_MMR6_DESC_BASE<"wsbh", GPR32Opnd, II_WSBH>; class MTC0_MMR6_DESC_BASE { + RegisterOperand SrcRC, InstrItinClass Itin> { dag InOperandList = (ins SrcRC:$rt, uimm3:$sel); dag OutOperandList = (outs DstRC:$rs); string AsmString = !strconcat(opstr, "\t$rt, $rs, $sel"); list Pattern = []; Format f = FrmFR; string BaseOpcode = opstr; + InstrItinClass Itinerary = Itin; } class MTC1_MMR6_DESC_BASE< string opstr, RegisterOperand DstRC, RegisterOperand SrcRC, @@ -701,34 +742,42 @@ let Constraints = "$fs = $fs_in"; } class MTC2_MMR6_DESC_BASE { + RegisterOperand SrcRC, InstrItinClass Itin> { dag InOperandList = (ins SrcRC:$rt); dag OutOperandList = (outs DstRC:$impl); string AsmString = !strconcat(opstr, "\t$rt, $impl"); list Pattern = []; Format f = FrmFR; string BaseOpcode = opstr; + InstrItinClass Itinerary = Itin; } -class MTC0_MMR6_DESC : MTC0_MMR6_DESC_BASE<"mtc0", COP0Opnd, GPR32Opnd>; +class MTC0_MMR6_DESC : MTC0_MMR6_DESC_BASE<"mtc0", COP0Opnd, GPR32Opnd, + II_MTC0>; class MTC1_MMR6_DESC : MTC1_MMR6_DESC_BASE<"mtc1", FGR32Opnd, GPR32Opnd, II_MTC1, bitconvert>, HARDFLOAT; -class MTC2_MMR6_DESC : MTC2_MMR6_DESC_BASE<"mtc2", COP2Opnd, GPR32Opnd>; -class MTHC0_MMR6_DESC : MTC0_MMR6_DESC_BASE<"mthc0", COP0Opnd, GPR32Opnd>; -class MTHC1_D32_MMR6_DESC : MTC1_64_MMR6_DESC_BASE<"mthc1", AFGR64Opnd, GPR32Opnd>, +class MTC2_MMR6_DESC : MTC2_MMR6_DESC_BASE<"mtc2", COP2Opnd, GPR32Opnd, + II_MTC2>; +class MTHC0_MMR6_DESC : MTC0_MMR6_DESC_BASE<"mthc0", COP0Opnd, GPR32Opnd, + II_MTC0>; +class MTHC1_D32_MMR6_DESC : MTC1_64_MMR6_DESC_BASE<"mthc1", AFGR64Opnd, + GPR32Opnd, II_MTC1>, HARDFLOAT, FGR_32; -class MTHC1_D64_MMR6_DESC : MTC1_64_MMR6_DESC_BASE<"mthc1", FGR64Opnd, GPR32Opnd>, +class MTHC1_D64_MMR6_DESC : MTC1_64_MMR6_DESC_BASE<"mthc1", FGR64Opnd, + GPR32Opnd, II_MTC1>, HARDFLOAT, FGR_64; -class MTHC2_MMR6_DESC : MTC2_MMR6_DESC_BASE<"mthc2", COP2Opnd, GPR32Opnd>; +class MTHC2_MMR6_DESC : MTC2_MMR6_DESC_BASE<"mthc2", COP2Opnd, GPR32Opnd, + II_MTC2>; class MFC0_MMR6_DESC_BASE { + RegisterOperand SrcRC, InstrItinClass Itin> { dag InOperandList = (ins SrcRC:$rs, uimm3:$sel); dag OutOperandList = (outs DstRC:$rt); string AsmString = !strconcat(opstr, "\t$rt, $rs, $sel"); list Pattern = []; Format f = FrmFR; string BaseOpcode = opstr; + InstrItinClass Itinerary = Itin; } class MFC1_MMR6_DESC_BASE { + RegisterOperand SrcRC, InstrItinClass Itin> { dag InOperandList = (ins SrcRC:$impl); dag OutOperandList = (outs DstRC:$rt); string AsmString = !strconcat(opstr, "\t$rt, $impl"); list Pattern = []; Format f = FrmFR; string BaseOpcode = opstr; + InstrItinClass Itinerary = Itin; } -class MFC0_MMR6_DESC : MFC0_MMR6_DESC_BASE<"mfc0", GPR32Opnd, COP0Opnd>; +class MFC0_MMR6_DESC : MFC0_MMR6_DESC_BASE<"mfc0", GPR32Opnd, COP0Opnd, + II_MFC0>; class MFC1_MMR6_DESC : MFC1_MMR6_DESC_BASE<"mfc1", GPR32Opnd, FGR32Opnd, II_MFC1, bitconvert>, HARDFLOAT; -class MFC2_MMR6_DESC : MFC2_MMR6_DESC_BASE<"mfc2", GPR32Opnd, COP2Opnd>; -class MFHC0_MMR6_DESC : MFC0_MMR6_DESC_BASE<"mfhc0", GPR32Opnd, COP0Opnd>; +class MFC2_MMR6_DESC : MFC2_MMR6_DESC_BASE<"mfc2", GPR32Opnd, COP2Opnd, + II_MFC2>; +class MFHC0_MMR6_DESC : MFC0_MMR6_DESC_BASE<"mfhc0", GPR32Opnd, COP0Opnd, + II_MFC0>; class MFHC1_D32_MMR6_DESC : MFC1_MMR6_DESC_BASE<"mfhc1", GPR32Opnd, AFGR64Opnd, II_MFHC1>, HARDFLOAT, FGR_32; class MFHC1_D64_MMR6_DESC : MFC1_MMR6_DESC_BASE<"mfhc1", GPR32Opnd, FGR64Opnd, II_MFHC1>, HARDFLOAT, FGR_64; -class MFHC2_MMR6_DESC : MFC2_MMR6_DESC_BASE<"mfhc2", GPR32Opnd, COP2Opnd>; +class MFHC2_MMR6_DESC : MFC2_MMR6_DESC_BASE<"mfhc2", GPR32Opnd, COP2Opnd, + II_MFC2>; class LDC1_D64_MMR6_DESC : MipsR6Inst, HARDFLOAT, FGR_64 { dag InOperandList = (ins mem_mm_16:$addr); @@ -786,33 +840,33 @@ let DecoderMethod = "DecodeFMemMMR2"; } -class LDC2_LWC2_MMR6_DESC_BASE { +class LDC2_LWC2_MMR6_DESC_BASE { dag OutOperandList = (outs COP2Opnd:$rt); dag InOperandList = (ins mem_mm_11:$addr); string AsmString = !strconcat(opstr, "\t$rt, $addr"); list Pattern = [(set COP2Opnd:$rt, (load addrimm11:$addr))]; Format f = FrmFI; - InstrItinClass Itinerary = NoItinerary; + InstrItinClass Itinerary = itin; string BaseOpcode = opstr; bit mayLoad = 1; string DecoderMethod = "DecodeFMemCop2MMR6"; } -class LDC2_MMR6_DESC : LDC2_LWC2_MMR6_DESC_BASE<"ldc2">; -class LWC2_MMR6_DESC : LDC2_LWC2_MMR6_DESC_BASE<"lwc2">; +class LDC2_MMR6_DESC : LDC2_LWC2_MMR6_DESC_BASE<"ldc2", II_LDC2>; +class LWC2_MMR6_DESC : LDC2_LWC2_MMR6_DESC_BASE<"lwc2", II_LWC2>; -class SDC2_SWC2_MMR6_DESC_BASE { +class SDC2_SWC2_MMR6_DESC_BASE { dag OutOperandList = (outs); dag InOperandList = (ins COP2Opnd:$rt, mem_mm_11:$addr); string AsmString = !strconcat(opstr, "\t$rt, $addr"); list Pattern = [(store COP2Opnd:$rt, addrimm11:$addr)]; Format f = FrmFI; - InstrItinClass Itinerary = NoItinerary; + InstrItinClass Itinerary = itin; string BaseOpcode = opstr; bit mayStore = 1; string DecoderMethod = "DecodeFMemCop2MMR6"; } -class SDC2_MMR6_DESC : SDC2_SWC2_MMR6_DESC_BASE<"sdc2">; -class SWC2_MMR6_DESC : SDC2_SWC2_MMR6_DESC_BASE<"swc2">; +class SDC2_MMR6_DESC : SDC2_SWC2_MMR6_DESC_BASE<"sdc2", II_SDC2>; +class SWC2_MMR6_DESC : SDC2_SWC2_MMR6_DESC_BASE<"swc2", II_SWC2>; /// Floating Point Instructions class FARITH_MMR6_DESC_BASE; class FDIV_D_MMR6_DESC : FARITH_MMR6_DESC_BASE<"div.d", AFGR64Opnd, II_DIV_D, 0, fdiv>; -class MADDF_S_MMR6_DESC : COP1_4R_DESC_BASE<"maddf.s", FGR32Opnd>, HARDFLOAT; -class MADDF_D_MMR6_DESC : COP1_4R_DESC_BASE<"maddf.d", FGR64Opnd>, HARDFLOAT; -class MSUBF_S_MMR6_DESC : COP1_4R_DESC_BASE<"msubf.s", FGR32Opnd>, HARDFLOAT; -class MSUBF_D_MMR6_DESC : COP1_4R_DESC_BASE<"msubf.d", FGR64Opnd>, HARDFLOAT; +class MADDF_S_MMR6_DESC : COP1_4R_DESC_BASE<"maddf.s", FGR32Opnd, + II_MADDF_S>, HARDFLOAT; +class MADDF_D_MMR6_DESC : COP1_4R_DESC_BASE<"maddf.d", FGR64Opnd, + II_MADDF_D>, HARDFLOAT; +class MSUBF_S_MMR6_DESC : COP1_4R_DESC_BASE<"msubf.s", FGR32Opnd, + II_MSUBF_S>, HARDFLOAT; +class MSUBF_D_MMR6_DESC : COP1_4R_DESC_BASE<"msubf.d", FGR64Opnd, + II_MSUBF_D>, HARDFLOAT; class FMOV_FNEG_MMR6_DESC_BASE; -class MAX_S_MMR6_DESC : MAX_MIN_DESC_BASE<"max.s", FGR32Opnd>, HARDFLOAT; -class MAX_D_MMR6_DESC : MAX_MIN_DESC_BASE<"max.d", FGR64Opnd>, HARDFLOAT; -class MIN_S_MMR6_DESC : MAX_MIN_DESC_BASE<"min.s", FGR32Opnd>, HARDFLOAT; -class MIN_D_MMR6_DESC : MAX_MIN_DESC_BASE<"min.d", FGR64Opnd>, HARDFLOAT; - -class MAXA_S_MMR6_DESC : MAX_MIN_DESC_BASE<"maxa.s", FGR32Opnd>, HARDFLOAT; -class MAXA_D_MMR6_DESC : MAX_MIN_DESC_BASE<"maxa.d", FGR64Opnd>, HARDFLOAT; -class MINA_S_MMR6_DESC : MAX_MIN_DESC_BASE<"mina.s", FGR32Opnd>, HARDFLOAT; -class MINA_D_MMR6_DESC : MAX_MIN_DESC_BASE<"mina.d", FGR64Opnd>, HARDFLOAT; +class MAX_S_MMR6_DESC : MAX_MIN_DESC_BASE<"max.s", FGR32Opnd, II_MAX_S>, + HARDFLOAT; +class MAX_D_MMR6_DESC : MAX_MIN_DESC_BASE<"max.d", FGR64Opnd, II_MAX_D>, + HARDFLOAT; +class MIN_S_MMR6_DESC : MAX_MIN_DESC_BASE<"min.s", FGR32Opnd, II_MIN_S>, + HARDFLOAT; +class MIN_D_MMR6_DESC : MAX_MIN_DESC_BASE<"min.d", FGR64Opnd, II_MIN_D>, + HARDFLOAT; + +class MAXA_S_MMR6_DESC : MAX_MIN_DESC_BASE<"maxa.s", FGR32Opnd, II_MAXA_S>, + HARDFLOAT; +class MAXA_D_MMR6_DESC : MAX_MIN_DESC_BASE<"maxa.d", FGR64Opnd, II_MAXA_D>, + HARDFLOAT; +class MINA_S_MMR6_DESC : MAX_MIN_DESC_BASE<"mina.s", FGR32Opnd, II_MINA_S>, + HARDFLOAT; +class MINA_D_MMR6_DESC : MAX_MIN_DESC_BASE<"mina.d", FGR64Opnd, II_MINA_D>, + HARDFLOAT; class CVT_MMR6_DESC_BASE< string instr_asm, RegisterOperand DstRC, RegisterOperand SrcRC, @@ -910,70 +976,70 @@ II_CVT>, FGR_64; multiclass CMP_CC_MMR6 format, string Typestr, - RegisterOperand FGROpnd> { + RegisterOperand FGROpnd, InstrItinClass Itin> { def CMP_AF_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.af.", Typestr), format, FIELD_CMP_COND_AF>, - CMP_CONDN_DESC_BASE<"af", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"af", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_UN_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.un.", Typestr), format, FIELD_CMP_COND_UN>, - CMP_CONDN_DESC_BASE<"un", Typestr, FGROpnd, setuo>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"un", Typestr, FGROpnd, Itin, setuo>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_EQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.eq.", Typestr), format, FIELD_CMP_COND_EQ>, - CMP_CONDN_DESC_BASE<"eq", Typestr, FGROpnd, setoeq>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"eq", Typestr, FGROpnd, Itin, setoeq>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_UEQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.ueq.", Typestr), format, FIELD_CMP_COND_UEQ>, - CMP_CONDN_DESC_BASE<"ueq", Typestr, FGROpnd, setueq>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"ueq", Typestr, FGROpnd, Itin, setueq>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_LT_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.lt.", Typestr), format, FIELD_CMP_COND_LT>, - CMP_CONDN_DESC_BASE<"lt", Typestr, FGROpnd, setolt>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"lt", Typestr, FGROpnd, Itin, setolt>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_ULT_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.ult.", Typestr), format, FIELD_CMP_COND_ULT>, - CMP_CONDN_DESC_BASE<"ult", Typestr, FGROpnd, setult>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"ult", Typestr, FGROpnd, Itin, setult>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_LE_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.le.", Typestr), format, FIELD_CMP_COND_LE>, - CMP_CONDN_DESC_BASE<"le", Typestr, FGROpnd, setole>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"le", Typestr, FGROpnd, Itin, setole>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_ULE_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.ule.", Typestr), format, FIELD_CMP_COND_ULE>, - CMP_CONDN_DESC_BASE<"ule", Typestr, FGROpnd, setule>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"ule", Typestr, FGROpnd, Itin, setule>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SAF_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.saf.", Typestr), format, FIELD_CMP_COND_SAF>, - CMP_CONDN_DESC_BASE<"saf", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"saf", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SUN_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.sun.", Typestr), format, FIELD_CMP_COND_SUN>, - CMP_CONDN_DESC_BASE<"sun", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"sun", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SEQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.seq.", Typestr), format, FIELD_CMP_COND_SEQ>, - CMP_CONDN_DESC_BASE<"seq", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"seq", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SUEQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.sueq.", Typestr), format, FIELD_CMP_COND_SUEQ>, - CMP_CONDN_DESC_BASE<"sueq", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"sueq", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SLT_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.slt.", Typestr), format, FIELD_CMP_COND_SLT>, - CMP_CONDN_DESC_BASE<"slt", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"slt", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SULT_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.sult.", Typestr), format, FIELD_CMP_COND_SULT>, - CMP_CONDN_DESC_BASE<"sult", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"sult", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SLE_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.sle.", Typestr), format, FIELD_CMP_COND_SLE>, - CMP_CONDN_DESC_BASE<"sle", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"sle", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; def CMP_SULE_#NAME : R6MMR6Rel, POOL32F_CMP_FM< !strconcat("cmp.sule.", Typestr), format, FIELD_CMP_COND_SULE>, - CMP_CONDN_DESC_BASE<"sule", Typestr, FGROpnd>, HARDFLOAT, + CMP_CONDN_DESC_BASE<"sule", Typestr, FGROpnd, Itin>, HARDFLOAT, ISA_MICROMIPS32R6; } @@ -1039,49 +1105,63 @@ class ROUND_W_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"round.w.d", FGR64Opnd, FGR64Opnd, II_ROUND>; -class SEL_S_MMR6_DESC : COP1_SEL_DESC_BASE<"sel.s", FGR32Opnd>; -class SEL_D_MMR6_DESC : COP1_SEL_DESC_BASE<"sel.d", FGR64Opnd> { +class SEL_S_MMR6_DESC : COP1_SEL_DESC_BASE<"sel.s", FGR32Opnd, II_SEL_S>; +class SEL_D_MMR6_DESC : COP1_SEL_DESC_BASE<"sel.d", FGR64Opnd, II_SEL_D> { // We must insert a SUBREG_TO_REG around $fd_in bit usesCustomInserter = 1; } -class SELEQZ_S_MMR6_DESC : SELEQNEZ_DESC_BASE<"seleqz.s", FGR32Opnd>; -class SELEQZ_D_MMR6_DESC : SELEQNEZ_DESC_BASE<"seleqz.d", FGR64Opnd>; -class SELNEZ_S_MMR6_DESC : SELEQNEZ_DESC_BASE<"selnez.s", FGR32Opnd>; -class SELNEZ_D_MMR6_DESC : SELEQNEZ_DESC_BASE<"selnez.d", FGR64Opnd>; -class RINT_S_MMR6_DESC : CLASS_RINT_DESC_BASE<"rint.s", FGR32Opnd>; -class RINT_D_MMR6_DESC : CLASS_RINT_DESC_BASE<"rint.d", FGR64Opnd>; -class CLASS_S_MMR6_DESC : CLASS_RINT_DESC_BASE<"class.s", FGR32Opnd>; -class CLASS_D_MMR6_DESC : CLASS_RINT_DESC_BASE<"class.d", FGR64Opnd>; - -class STORE_MMR6_DESC_BASE +class SELEQZ_S_MMR6_DESC : SELEQNEZ_DESC_BASE<"seleqz.s", FGR32Opnd, + II_SELCCZ_S>; +class SELEQZ_D_MMR6_DESC : SELEQNEZ_DESC_BASE<"seleqz.d", FGR64Opnd, + II_SELCCZ_D>; +class SELNEZ_S_MMR6_DESC : SELEQNEZ_DESC_BASE<"selnez.s", FGR32Opnd, + II_SELCCZ_S>; +class SELNEZ_D_MMR6_DESC : SELEQNEZ_DESC_BASE<"selnez.d", FGR64Opnd, + II_SELCCZ_D>; +class RINT_S_MMR6_DESC : CLASS_RINT_DESC_BASE<"rint.s", FGR32Opnd, + II_RINT_S>; +class RINT_D_MMR6_DESC : CLASS_RINT_DESC_BASE<"rint.d", FGR64Opnd, + II_RINT_S>; +class CLASS_S_MMR6_DESC : CLASS_RINT_DESC_BASE<"class.s", FGR32Opnd, + II_CLASS_S>; +class CLASS_D_MMR6_DESC : CLASS_RINT_DESC_BASE<"class.d", FGR64Opnd, + II_CLASS_S>; + +class STORE_MMR6_DESC_BASE : Store, MMR6Arch { let DecoderMethod = "DecodeMemMMImm16"; + InstrItinClass Itinerary = Itin; } -class SB_MMR6_DESC : STORE_MMR6_DESC_BASE<"sb", GPR32Opnd>; +class SB_MMR6_DESC : STORE_MMR6_DESC_BASE<"sb", GPR32Opnd, II_SB>; -class STORE_EVA_MMR6_DESC_BASE +class STORE_EVA_MMR6_DESC_BASE : MMR6Arch, MipsR6Inst { dag OutOperandList = (outs); dag InOperandList = (ins RO:$rt, mem_simm9:$addr); string AsmString = !strconcat(instr_asm, "\t$rt, $addr"); string DecoderMethod = "DecodeStoreEvaOpMM"; bit mayStore = 1; + InstrItinClass Itinerary = Itin; } -class SBE_MMR6_DESC : STORE_EVA_MMR6_DESC_BASE<"sbe", GPR32Opnd>; -class SCE_MMR6_DESC : STORE_EVA_MMR6_DESC_BASE<"sce", GPR32Opnd>; -class SH_MMR6_DESC : STORE_MMR6_DESC_BASE<"sh", GPR32Opnd>; -class SHE_MMR6_DESC : STORE_EVA_MMR6_DESC_BASE<"she", GPR32Opnd>; -class LOAD_WORD_EVA_MMR6_DESC_BASE : - MMR6Arch, MipsR6Inst { +class SBE_MMR6_DESC : STORE_EVA_MMR6_DESC_BASE<"sbe", GPR32Opnd, II_SBE>; +class SCE_MMR6_DESC : STORE_EVA_MMR6_DESC_BASE<"sce", GPR32Opnd, II_SCE>; +class SH_MMR6_DESC : STORE_MMR6_DESC_BASE<"sh", GPR32Opnd, II_SH>; +class SHE_MMR6_DESC : STORE_EVA_MMR6_DESC_BASE<"she", GPR32Opnd, II_SHE>; +class LOAD_WORD_EVA_MMR6_DESC_BASE + : MMR6Arch, MipsR6Inst { dag OutOperandList = (outs RO:$rt); dag InOperandList = (ins mem_simm9:$addr); string AsmString = !strconcat(instr_asm, "\t$rt, $addr"); string DecoderMethod = "DecodeMemMMImm9"; bit mayLoad = 1; + InstrItinClass Itinerary = Itin; } -class LLE_MMR6_DESC : LOAD_WORD_EVA_MMR6_DESC_BASE<"lle", GPR32Opnd>; -class LWE_MMR6_DESC : LOAD_WORD_EVA_MMR6_DESC_BASE<"lwe", GPR32Opnd>; +class LLE_MMR6_DESC : LOAD_WORD_EVA_MMR6_DESC_BASE<"lle", GPR32Opnd, II_LLE>; +class LWE_MMR6_DESC : LOAD_WORD_EVA_MMR6_DESC_BASE<"lwe", GPR32Opnd, II_LWE>; class ADDU16_MMR6_DESC : ArithRMM16<"addu16", GPRMM16Opnd, 1, II_ADDU, add>, MMR6Arch<"addu16"> { int AddedComplexity = 1; @@ -1103,13 +1183,13 @@ MMR6Arch<"sll16">; class SRL16_MMR6_DESC : ShiftIMM16<"srl16", uimm3_shift, GPRMM16Opnd, II_SRL>, MMR6Arch<"srl16">; -class BREAK16_MMR6_DESC : BrkSdbbp16MM<"break16">, MMR6Arch<"break16">, +class BREAK16_MMR6_DESC : BrkSdbbp16MM<"break16", II_BREAK>, MMR6Arch<"break16">, MicroMipsR6Inst16; class LI16_MMR6_DESC : LoadImmMM16<"li16", li16_imm, GPRMM16Opnd>, MMR6Arch<"li16">, MicroMipsR6Inst16, IsAsCheapAsAMove; class MOVE16_MMR6_DESC : MoveMM16<"move16", GPR32Opnd>, MMR6Arch<"move16">, MicroMipsR6Inst16; -class SDBBP16_MMR6_DESC : BrkSdbbp16MM<"sdbbp16">, MMR6Arch<"sdbbp16">, +class SDBBP16_MMR6_DESC : BrkSdbbp16MM<"sdbbp16", II_SDBBP>, MMR6Arch<"sdbbp16">, MicroMipsR6Inst16; class SUBU16_MMR6_DESC : ArithRMM16<"subu16", GPRMM16Opnd, 0, II_SUBU, sub>, MMR6Arch<"subu16">, MicroMipsR6Inst16 { @@ -1147,7 +1227,7 @@ dag InOperandList = (ins uimm5:$stype); string AsmString = !strconcat("sync", "\t$stype"); list Pattern = [(MipsSync immZExt5:$stype)]; - InstrItinClass Itinerary = NoItinerary; + InstrItinClass Itinerary = II_SYNC; bit HasSideEffects = 1; } @@ -1159,6 +1239,7 @@ dag OutOperandList = (outs GPR32Opnd:$rt); dag InOperandList = (ins GPR32Opnd:$rd); string AsmString = !strconcat("rdpgpr", "\t$rt, $rd"); + InstrItinClass Itinerary = II_RDPGPR; } class SDBBP_MMR6_DESC : MipsR6Inst { @@ -1166,27 +1247,26 @@ dag InOperandList = (ins uimm20:$code_); string AsmString = !strconcat("sdbbp", "\t$code_"); list Pattern = []; + InstrItinClass Itinerary = II_SDBBP; } class LWM16_MMR6_DESC : MicroMipsInst16<(outs reglist16:$rt), (ins mem_mm_4sp:$addr), !strconcat("lwm16", "\t$rt, $addr"), [], - NoItinerary, FrmI>, + II_LWM, FrmI>, MMR6Arch<"lwm16">, MicroMipsR6Inst16 { let DecoderMethod = "DecodeMemMMReglistImm4Lsl2"; let mayLoad = 1; - InstrItinClass Itin = NoItinerary; ComplexPattern Addr = addr; } class SWM16_MMR6_DESC : MicroMipsInst16<(outs), (ins reglist16:$rt, mem_mm_4sp:$addr), !strconcat("swm16", "\t$rt, $addr"), [], - NoItinerary, FrmI>, + II_SWM, FrmI>, MMR6Arch<"swm16">, MicroMipsR6Inst16 { let DecoderMethod = "DecodeMemMMReglistImm4Lsl2"; let mayStore = 1; - InstrItinClass Itin = NoItinerary; ComplexPattern Addr = addr; } @@ -1219,31 +1299,33 @@ dag InOperandList = (ins GPR32Opnd:$rs); string AsmString = !strconcat("jalrc.hb", "\t$rt, $rs"); list Pattern = []; - InstrItinClass Itinerary = NoItinerary; + InstrItinClass Itinerary = II_JALR_HB; Format Form = FrmJ; bit isIndirectBranch = 1; bit hasDelaySlot = 0; } -class TLBINV_MMR6_DESC_BASE { +class TLBINV_MMR6_DESC_BASE { dag OutOperandList = (outs); dag InOperandList = (ins); string AsmString = opstr; list Pattern = []; + InstrItinClass Itinerary = Itin; } -class TLBINV_MMR6_DESC : TLBINV_MMR6_DESC_BASE<"tlbinv">; -class TLBINVF_MMR6_DESC : TLBINV_MMR6_DESC_BASE<"tlbinvf">; +class TLBINV_MMR6_DESC : TLBINV_MMR6_DESC_BASE<"tlbinv", II_TLBINV>; +class TLBINVF_MMR6_DESC : TLBINV_MMR6_DESC_BASE<"tlbinvf", II_TLBINVF>; -class DVPEVP_MMR6_DESC_BASE { +class DVPEVP_MMR6_DESC_BASE { dag OutOperandList = (outs); dag InOperandList = (ins GPR32Opnd:$rs); string AsmString = !strconcat(opstr, "\t$rs"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class DVP_MMR6_DESC : DVPEVP_MMR6_DESC_BASE<"dvp">; -class EVP_MMR6_DESC : DVPEVP_MMR6_DESC_BASE<"evp">; +class DVP_MMR6_DESC : DVPEVP_MMR6_DESC_BASE<"dvp", II_DVP>; +class EVP_MMR6_DESC : DVPEVP_MMR6_DESC_BASE<"evp", II_EVP>; class BEQZC_MMR6_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"beqzc", brtarget21_mm, GPR32Opnd>, @@ -1262,15 +1344,17 @@ class BC1EQZC_MMR6_DESC : BRANCH_COP1_MMR6_DESC_BASE<"bc1eqzc">; class BC1NEZC_MMR6_DESC : BRANCH_COP1_MMR6_DESC_BASE<"bc1nezc">; -class BRANCH_COP2_MMR6_DESC_BASE : BRANCH_DESC_BASE { +class BRANCH_COP2_MMR6_DESC_BASE + : BRANCH_DESC_BASE { dag InOperandList = (ins COP2Opnd:$rt, brtarget_mm:$offset); dag OutOperandList = (outs); string AsmString = !strconcat(opstr, "\t$rt, $offset"); list Defs = [AT]; + InstrItinClass Itinerary = Itin; } -class BC2EQZC_MMR6_DESC : BRANCH_COP2_MMR6_DESC_BASE<"bc2eqzc">; -class BC2NEZC_MMR6_DESC : BRANCH_COP2_MMR6_DESC_BASE<"bc2nezc">; +class BC2EQZC_MMR6_DESC : BRANCH_COP2_MMR6_DESC_BASE<"bc2eqzc", II_BC2CCZ>; +class BC2NEZC_MMR6_DESC : BRANCH_COP2_MMR6_DESC_BASE<"bc2nezc", II_BC2CCZ>; class EXT_MMR6_DESC { dag OutOperandList = (outs GPR32Opnd:$rt); @@ -1314,6 +1398,7 @@ dag OutOperandList = (outs); string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $offset"); list Defs = [AT]; + InstrItinClass Itinerary = II_BCCC; } class BOVC_MMR6_DESC : BOVC_BNVC_MMR6_DESC_BASE<"bovc", brtargetr6, GPR32Opnd>; @@ -1517,8 +1602,8 @@ ISA_MICROMIPS32R6; def CVT_S_L_MMR6 : StdMMR6Rel, CVT_S_L_MMR6_ENC, CVT_S_L_MMR6_DESC, ISA_MICROMIPS32R6; -defm S_MMR6 : CMP_CC_MMR6<0b000101, "s", FGR32Opnd>; -defm D_MMR6 : CMP_CC_MMR6<0b010101, "d", FGR64Opnd>; +defm S_MMR6 : CMP_CC_MMR6<0b000101, "s", FGR32Opnd, II_CMP_CC_S>; +defm D_MMR6 : CMP_CC_MMR6<0b010101, "d", FGR64Opnd, II_CMP_CC_D>; def ABS_S_MMR6 : StdMMR6Rel, ABS_S_MMR6_ENC, ABS_S_MMR6_DESC, ISA_MICROMIPS32R6; def ABS_D_MMR6 : StdMMR6Rel, ABS_D_MMR6_ENC, ABS_D_MMR6_DESC, ISA_MICROMIPS32R6; def FLOOR_L_S_MMR6 : StdMMR6Rel, FLOOR_L_S_MMR6_ENC, FLOOR_L_S_MMR6_DESC, Index: lib/Target/Mips/MicroMips64r6InstrInfo.td =================================================================== --- lib/Target/Mips/MicroMips64r6InstrInfo.td +++ lib/Target/Mips/MicroMips64r6InstrInfo.td @@ -74,24 +74,28 @@ // //===----------------------------------------------------------------------===// -class DAUI_MMR6_DESC_BASE +class DAUI_MMR6_DESC_BASE : MMR6Arch, MipsR6Inst { dag OutOperandList = (outs GPROpnd:$rt); dag InOperandList = (ins GPROpnd:$rs, simm16:$imm); string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $imm"); list Pattern = []; + InstrItinClass Itinerary = Itin; } -class DAUI_MMR6_DESC : DAUI_MMR6_DESC_BASE<"daui", GPR64Opnd>; +class DAUI_MMR6_DESC : DAUI_MMR6_DESC_BASE<"daui", GPR64Opnd, II_DAUI>; -class DAHI_DATI_DESC_BASE +class DAHI_DATI_DESC_BASE : MMR6Arch, MipsR6Inst { dag OutOperandList = (outs GPROpnd:$rs); dag InOperandList = (ins GPROpnd:$rt, simm16:$imm); string AsmString = !strconcat(instr_asm, "\t$rt, $imm"); string Constraints = "$rs = $rt"; + InstrItinClass Itinerary = Itin; } -class DAHI_MMR6_DESC : DAHI_DATI_DESC_BASE<"dahi", GPR64Opnd>; -class DATI_MMR6_DESC : DAHI_DATI_DESC_BASE<"dati", GPR64Opnd>; +class DAHI_MMR6_DESC : DAHI_DATI_DESC_BASE<"dahi", GPR64Opnd, II_DAHI>; +class DATI_MMR6_DESC : DAHI_DATI_DESC_BASE<"dati", GPR64Opnd, II_DATI>; class EXTBITS_DESC_BASE @@ -115,26 +119,33 @@ uimm5_plus1, MipsExt>; class DALIGN_DESC_BASE : MMR6Arch, MipsR6Inst { + Operand ImmOpnd, InstrItinClass itin> + : MMR6Arch, MipsR6Inst { dag OutOperandList = (outs GPROpnd:$rd); dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$bp); string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt, $bp"); list Pattern = []; + InstrItinClass Itinerary = itin; } -class DALIGN_MMR6_DESC : DALIGN_DESC_BASE<"dalign", GPR64Opnd, uimm3>; +class DALIGN_MMR6_DESC : DALIGN_DESC_BASE<"dalign", GPR64Opnd, uimm3, + II_DALIGN>; -class DDIV_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"ddiv", GPR64Opnd, sdiv>; -class DMOD_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"dmod", GPR64Opnd, srem>; -class DDIVU_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"ddivu", GPR64Opnd, udiv>; -class DMODU_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"dmodu", GPR64Opnd, urem>; +class DDIV_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"ddiv", GPR64Opnd, II_DDIV, + sdiv>; +class DMOD_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"dmod", GPR64Opnd, II_DMOD, + srem>; +class DDIVU_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"ddivu", GPR64Opnd, II_DDIVU, + udiv>; +class DMODU_MM64R6_DESC : DIVMOD_MMR6_DESC_BASE<"dmodu", GPR64Opnd, II_DMODU, + urem>; class DCLO_MM64R6_DESC { dag OutOperandList = (outs GPR64Opnd:$rt); dag InOperandList = (ins GPR64Opnd:$rs); string AsmString = !strconcat("dclo", "\t$rt, $rs"); list Pattern = [(set GPR64Opnd:$rt, (ctlz (not GPR64Opnd:$rs)))]; - InstrItinClass Itinerary = II_CLO; + InstrItinClass Itinerary = II_DCLO; Format Form = FrmR; string BaseOpcode = "dclo"; } @@ -144,7 +155,7 @@ dag InOperandList = (ins GPR64Opnd:$rs); string AsmString = !strconcat("dclz", "\t$rt, $rs"); list Pattern = [(set GPR64Opnd:$rt, (ctlz GPR64Opnd:$rs))]; - InstrItinClass Itinerary = II_CLZ; + InstrItinClass Itinerary = II_DCLZ; Format Form = FrmR; string BaseOpcode = "dclz"; } @@ -154,16 +165,18 @@ class DINSM_MM64R6_DESC : InsBase<"dinsm", GPR64Opnd, uimm5, uimm_range_2_64>; class DINS_MM64R6_DESC : InsBase<"dins", GPR64Opnd, uimm5, uimm5_inssize_plus1, MipsIns>; -class DMTC0_MM64R6_DESC : MTC0_MMR6_DESC_BASE<"dmtc0", COP0Opnd, GPR64Opnd>; +class DMTC0_MM64R6_DESC : MTC0_MMR6_DESC_BASE<"dmtc0", COP0Opnd, GPR64Opnd, + II_DMTC0>; class DMTC1_MM64R6_DESC : MTC1_MMR6_DESC_BASE<"dmtc1", FGR64Opnd, GPR64Opnd, II_DMTC1, bitconvert>; -class DMTC2_MM64R6_DESC : MTC2_MMR6_DESC_BASE<"dmtc2", COP2Opnd, GPR64Opnd>; - -class DMFC0_MM64R6_DESC : MFC0_MMR6_DESC_BASE<"dmfc0", GPR64Opnd, COP0Opnd>; +class DMTC2_MM64R6_DESC : MTC2_MMR6_DESC_BASE<"dmtc2", COP2Opnd, GPR64Opnd, + II_DMTC2>; +class DMFC0_MM64R6_DESC : MFC0_MMR6_DESC_BASE<"dmfc0", GPR64Opnd, COP0Opnd, + II_DMFC0>; class DMFC1_MM64R6_DESC : MFC1_MMR6_DESC_BASE<"dmfc1", GPR64Opnd, FGR64Opnd, II_DMFC1, bitconvert>; -class DMFC2_MM64R6_DESC : MFC2_MMR6_DESC_BASE<"dmfc2", GPR64Opnd, COP2Opnd>; - +class DMFC2_MM64R6_DESC : MFC2_MMR6_DESC_BASE<"dmfc2", GPR64Opnd, COP2Opnd, + II_DMFC2>; class DADD_MM64R6_DESC : ArithLogicR<"dadd", GPR64Opnd, 1, II_DADD>; class DADDIU_MM64R6_DESC : ArithLogicI<"daddiu", simm16_64, GPR64Opnd, II_DADDIU, immSExt16, add>, @@ -188,7 +201,8 @@ class DSUB_MM64R6_DESC : DSUB_DESC_BASE<"dsub", GPR64Opnd, II_DSUB>; class DSUBU_MM64R6_DESC : DSUB_DESC_BASE<"dsubu", GPR64Opnd, II_DSUBU, sub>; -class LDPC_MM64R6_DESC : PCREL_MMR6_DESC_BASE<"ldpc", GPR64Opnd, simm18_lsl3>; +class LDPC_MM64R6_DESC : PCREL_MMR6_DESC_BASE<"ldpc", GPR64Opnd, simm18_lsl3, + II_LDPC>; class MUL_MM64R6_DESC_BASE; -class DSBH_DSHD_DESC_BASE { +class DSBH_DSHD_DESC_BASE { dag OutOperandList = (outs GPROpnd:$rt); dag InOperandList = (ins GPROpnd:$rs); string AsmString = !strconcat(instr_asm, "\t$rt, $rs"); bit hasSideEffects = 0; list Pattern = []; - InstrItinClass Itinerary = NoItinerary; + InstrItinClass Itinerary = Itin; Format Form = FrmR; string BaseOpcode = instr_asm; } -class DSBH_MM64R6_DESC : DSBH_DSHD_DESC_BASE<"dsbh", GPR64Opnd>; -class DSHD_MM64R6_DESC : DSBH_DSHD_DESC_BASE<"dshd", GPR64Opnd>; +class DSBH_MM64R6_DESC : DSBH_DSHD_DESC_BASE<"dsbh", GPR64Opnd, II_DSBH>; +class DSHD_MM64R6_DESC : DSBH_DSHD_DESC_BASE<"dshd", GPR64Opnd, II_DSHD>; class SHIFT_ROTATE_IMM_MM64R6 : + Operand MemOpnd, InstrItinClass Itin> : InstSE<(outs RO:$rt), (ins MemOpnd:$addr, RO:$src), !strconcat(opstr, "\t$rt, $addr"), [(set RO:$rt, (OpNode addrimm12:$addr, RO:$src))], - NoItinerary, FrmI> { + Itin, FrmI> { let DecoderMethod = "DecodeMemMMImm12"; string Constraints = "$src = $rt"; } class StoreLeftRightMM: + Operand MemOpnd, InstrItinClass Itin>: InstSE<(outs), (ins RO:$rt, MemOpnd:$addr), !strconcat(opstr, "\t$rt, $addr"), - [(OpNode RO:$rt, addrimm12:$addr)], NoItinerary, FrmI> { + [(OpNode RO:$rt, addrimm12:$addr)], Itin, FrmI> { let DecoderMethod = "DecodeMemMMImm12"; } @@ -248,39 +248,37 @@ let MIOperandInfo = (ops ptr_rc, ptr_rc); } -class StorePairMM : - InstSE<(outs), (ins regpair:$rt, mem_simm12:$addr), - !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI, opstr> { +class StorePairMM + : InstSE<(outs), (ins regpair:$rt, mem_simm12:$addr), + !strconcat(opstr, "\t$rt, $addr"), [], II_SWP, FrmI, opstr> { let DecoderMethod = "DecodeMemMMImm12"; let mayStore = 1; } -class LoadPairMM : - InstSE<(outs regpair:$rt), (ins mem_simm12:$addr), - !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI, opstr> { +class LoadPairMM + : InstSE<(outs regpair:$rt), (ins mem_simm12:$addr), + !strconcat(opstr, "\t$rt, $addr"), [], II_LWP, FrmI, opstr> { let DecoderMethod = "DecodeMemMMImm12"; let mayLoad = 1; } class LLBaseMM : InstSE<(outs RO:$rt), (ins mem_mm_12:$addr), - !strconcat(opstr, "\t$rt, $addr"), [], NoItinerary, FrmI> { + !strconcat(opstr, "\t$rt, $addr"), [], II_LL, FrmI> { let DecoderMethod = "DecodeMemMMImm12"; let mayLoad = 1; } class LLEBaseMM : InstSE<(outs RO:$rt), (ins mem_simm9:$addr), - !strconcat(opstr, "\t$rt, $addr"), [], NoItinerary, FrmI> { + !strconcat(opstr, "\t$rt, $addr"), [], II_LLE, FrmI> { let DecoderMethod = "DecodeMemMMImm9"; let mayLoad = 1; } class SCBaseMM : InstSE<(outs RO:$dst), (ins RO:$rt, mem_mm_12:$addr), - !strconcat(opstr, "\t$rt, $addr"), [], NoItinerary, FrmI> { + !strconcat(opstr, "\t$rt, $addr"), [], II_SC, FrmI> { let DecoderMethod = "DecodeMemMMImm12"; let mayStore = 1; let Constraints = "$rt = $dst"; @@ -288,7 +286,7 @@ class SCEBaseMM : InstSE<(outs RO:$dst), (ins RO:$rt, mem_simm9:$addr), - !strconcat(opstr, "\t$rt, $addr"), [], NoItinerary, FrmI> { + !strconcat(opstr, "\t$rt, $addr"), [], II_SCE, FrmI> { let DecoderMethod = "DecodeMemMMImm9"; let mayStore = 1; let Constraints = "$rt = $dst"; @@ -331,7 +329,7 @@ class NotMM16 : MicroMipsInst16<(outs RO:$rt), (ins RO:$rs), !strconcat(opstr, "\t$rt, $rs"), - [(set RO:$rt, (not RO:$rs))], NoItinerary, FrmR>; + [(set RO:$rt, (not RO:$rs))], II_NOT, FrmR>; class ShiftIMM16 : @@ -385,23 +383,23 @@ class AddImmUR2 : MicroMipsInst16<(outs RO:$rd), (ins RO:$rs, simm3_lsa2:$imm), !strconcat(opstr, "\t$rd, $rs, $imm"), - [], NoItinerary, FrmR> { + [], II_ADDIU, FrmR> { let isCommutable = 1; } class AddImmUS5 : MicroMipsInst16<(outs RO:$dst), (ins RO:$rd, simm4:$imm), - !strconcat(opstr, "\t$rd, $imm"), [], NoItinerary, FrmR> { + !strconcat(opstr, "\t$rd, $imm"), [], II_ADDIU, FrmR> { let Constraints = "$rd = $dst"; } class AddImmUR1SP : MicroMipsInst16<(outs RO:$rd), (ins uimm6_lsl2:$imm), - !strconcat(opstr, "\t$rd, $imm"), [], NoItinerary, FrmR>; + !strconcat(opstr, "\t$rd, $imm"), [], II_ADDIU, FrmR>; class AddImmUSP : MicroMipsInst16<(outs), (ins simm9_addiusp:$imm), - !strconcat(opstr, "\t$imm"), [], NoItinerary, FrmI>; + !strconcat(opstr, "\t$imm"), [], II_ADDIU, FrmI>; class MoveFromHILOMM : MicroMipsInst16<(outs RO:$rd), (ins), !strconcat(opstr, "\t$rd"), @@ -410,17 +408,15 @@ let hasSideEffects = 0; } -class MoveMM16 : - MicroMipsInst16<(outs RO:$rd), (ins RO:$rs), - !strconcat(opstr, "\t$rd, $rs"), [], Itin, FrmR> { - let isCommutable = isComm; +class MoveMM16 + : MicroMipsInst16<(outs RO:$rd), (ins RO:$rs), + !strconcat(opstr, "\t$rd, $rs"), [], II_MOVE, FrmR> { let isReMaterializable = 1; } class LoadImmMM16 : MicroMipsInst16<(outs RO:$rd), (ins Od:$imm), - !strconcat(opstr, "\t$rd, $imm"), [], NoItinerary, FrmI> { + !strconcat(opstr, "\t$rd, $imm"), [], II_LI, FrmI> { let isReMaterializable = 1; } @@ -484,10 +480,10 @@ } // Break16 and Sdbbp16 -class BrkSdbbp16MM : +class BrkSdbbp16MM : MicroMipsInst16<(outs), (ins uimm4:$code_), !strconcat(opstr, "\t$code_"), - [], NoItinerary, FrmOther>; + [], Itin, FrmOther>; class CBranchZeroMM : MicroMipsInst16<(outs), (ins RO:$rs, opnd:$offset), @@ -517,18 +513,17 @@ } class LoadWordIndexedScaledMM : InstSE<(outs RO:$rd), (ins PtrRC:$base, PtrRC:$index), - !strconcat(opstr, "\t$rd, ${index}(${base})"), [], Itin, FrmFI>; + !strconcat(opstr, "\t$rd, ${index}(${base})"), [], II_LWXS, FrmFI>; class PrefetchIndexed : InstSE<(outs), (ins PtrRC:$base, PtrRC:$index, uimm5:$hint), - !strconcat(opstr, "\t$hint, ${index}(${base})"), [], NoItinerary, FrmOther>; + !strconcat(opstr, "\t$hint, ${index}(${base})"), [], II_PREF, FrmOther>; class AddImmUPC : InstSE<(outs RO:$rs), (ins simm23_lsl2:$imm), - !strconcat(opstr, "\t$rs, $imm"), [], NoItinerary, FrmR>; + !strconcat(opstr, "\t$rs, $imm"), [], II_ADDIU, FrmR>; /// A list of registers used by load/store multiple instructions. def RegListAsmOperand : AsmOperandClass { @@ -662,16 +657,16 @@ def BNEZ16_MM : CBranchZeroMM<"bnez16", brtarget7_mm, GPRMM16Opnd>, BEQNEZ_FM_MM16<0x2b>; def B16_MM : UncondBranchMM16<"b16">, B16_FM; -def BREAK16_MM : BrkSdbbp16MM<"break16">, BRKSDBBP16_FM_MM<0x28>, +def BREAK16_MM : BrkSdbbp16MM<"break16", II_BREAK>, BRKSDBBP16_FM_MM<0x28>, ISA_MICROMIPS_NOT_32R6_64R6; -def SDBBP16_MM : BrkSdbbp16MM<"sdbbp16">, BRKSDBBP16_FM_MM<0x2C>, +def SDBBP16_MM : BrkSdbbp16MM<"sdbbp16", II_SDBBP>, BRKSDBBP16_FM_MM<0x2C>, ISA_MICROMIPS_NOT_32R6_64R6; let DecoderNamespace = "MicroMips" in { /// Load and Store Instructions - multiple - def SWM16_MM : StoreMultMM16<"swm16">, LWM_FM_MM16<0x5>, + def SWM16_MM : StoreMultMM16<"swm16", II_SWM>, LWM_FM_MM16<0x5>, ISA_MICROMIPS32_NOT_MIPS32R6; - def LWM16_MM : LoadMultMM16<"lwm16">, LWM_FM_MM16<0x4>, + def LWM16_MM : LoadMultMM16<"lwm16", II_LWM>, LWM_FM_MM16<0x4>, ISA_MICROMIPS32_NOT_MIPS32R6; let AdditionalPredicates = [InMicroMips] in { def CFC2_MM : InstSE<(outs GPR32Opnd:$rt), (ins COP2Opnd:$impl), @@ -685,7 +680,7 @@ class WaitMM : InstSE<(outs), (ins uimm10:$code_), !strconcat(opstr, "\t$code_"), [], - NoItinerary, FrmOther, opstr>; + II_WAIT, FrmOther, opstr>; let DecoderNamespace = "MicroMips", Predicates = [InMicroMips] in { /// Compact Branch Instructions @@ -695,15 +690,15 @@ COMPACT_BRANCH_FM_MM<0x5>; /// Arithmetic Instructions (ALU Immediate) - def ADDiu_MM : MMRel, ArithLogicI<"addiu", simm16, GPR32Opnd>, + def ADDiu_MM : MMRel, ArithLogicI<"addiu", simm16, GPR32Opnd, II_ADDIU>, ADDI_FM_MM<0xc>; - def ADDi_MM : MMRel, ArithLogicI<"addi", simm16, GPR32Opnd>, + def ADDi_MM : MMRel, ArithLogicI<"addi", simm16, GPR32Opnd, II_ADDI>, ADDI_FM_MM<0x4>; def SLTi_MM : MMRel, SetCC_I<"slti", setlt, simm16, immSExt16, GPR32Opnd>, SLTI_FM_MM<0x24>; def SLTiu_MM : MMRel, SetCC_I<"sltiu", setult, simm16, immSExt16, GPR32Opnd>, SLTI_FM_MM<0x2c>; - def ANDi_MM : MMRel, ArithLogicI<"andi", uimm16, GPR32Opnd>, + def ANDi_MM : MMRel, ArithLogicI<"andi", uimm16, GPR32Opnd, II_ANDI>, ADDI_FM_MM<0x34>; def ORi_MM : MMRel, ArithLogicI<"ori", uimm16, GPR32Opnd, II_ORI, immZExt16, or>, ADDI_FM_MM<0x14>; @@ -719,9 +714,12 @@ ADD_FM_MM<0, 0x150>; def SUBu_MM : MMRel, ArithLogicR<"subu", GPR32Opnd, 0, II_SUBU, sub>, ADD_FM_MM<0, 0x1d0>; - def MUL_MM : MMRel, ArithLogicR<"mul", GPR32Opnd>, ADD_FM_MM<0, 0x210>; - def ADD_MM : MMRel, ArithLogicR<"add", GPR32Opnd>, ADD_FM_MM<0, 0x110>; - def SUB_MM : MMRel, ArithLogicR<"sub", GPR32Opnd>, ADD_FM_MM<0, 0x190>; + def MUL_MM : MMRel, ArithLogicR<"mul", GPR32Opnd, 1, II_MUL>, + ADD_FM_MM<0, 0x210>; + def ADD_MM : MMRel, ArithLogicR<"add", GPR32Opnd, 1, II_ADD>, + ADD_FM_MM<0, 0x110>; + def SUB_MM : MMRel, ArithLogicR<"sub", GPR32Opnd, 0, II_SUB>, + ADD_FM_MM<0, 0x190>; def SLT_MM : MMRel, SetCC_R<"slt", setlt, GPR32Opnd>, ADD_FM_MM<0, 0x350>; def SLTu_MM : MMRel, SetCC_R<"sltu", setult, GPR32Opnd>, ADD_FM_MM<0, 0x390>; @@ -770,60 +768,69 @@ /// Load and Store Instructions - aligned let DecoderMethod = "DecodeMemMMImm16" in { - def LB_MM : LoadMemory<"lb", GPR32Opnd, mem_mm_16>, MMRel, LW_FM_MM<0x7>; - def LBu_MM : LoadMemory<"lbu", GPR32Opnd, mem_mm_16>, MMRel, LW_FM_MM<0x5>; + def LB_MM : LoadMemory<"lb", GPR32Opnd, mem_mm_16, null_frag, II_LB>, + MMRel, LW_FM_MM<0x7>; + def LBu_MM : LoadMemory<"lbu", GPR32Opnd, mem_mm_16, null_frag, II_LBU>, + MMRel, LW_FM_MM<0x5>; def LH_MM : LoadMemory<"lh", GPR32Opnd, mem_simm16, sextloadi16, II_LH, addrDefault>, MMRel, LW_FM_MM<0xf>; def LHu_MM : LoadMemory<"lhu", GPR32Opnd, mem_simm16, zextloadi16, II_LHU>, MMRel, LW_FM_MM<0xd>; - def LW_MM : Load<"lw", GPR32Opnd>, MMRel, LW_FM_MM<0x3f>; - def SB_MM : Store<"sb", GPR32Opnd>, MMRel, LW_FM_MM<0x6>; - def SH_MM : Store<"sh", GPR32Opnd>, MMRel, LW_FM_MM<0xe>; - def SW_MM : Store<"sw", GPR32Opnd>, MMRel, LW_FM_MM<0x3e>; + def LW_MM : Load<"lw", GPR32Opnd, null_frag, II_LW>, MMRel, LW_FM_MM<0x3f>; + def SB_MM : Store<"sb", GPR32Opnd, null_frag, II_SB>, MMRel, + LW_FM_MM<0x6>; + def SH_MM : Store<"sh", GPR32Opnd, null_frag, II_SH>, MMRel, + LW_FM_MM<0xe>; + def SW_MM : Store<"sw", GPR32Opnd, null_frag, II_SW>, MMRel, + LW_FM_MM<0x3e>; } let DecoderMethod = "DecodeMemMMImm9" in { - def LBE_MM : Load<"lbe", GPR32Opnd>, POOL32C_LHUE_FM_MM<0x18, 0x6, 0x4>; - def LBuE_MM : Load<"lbue", GPR32Opnd>, POOL32C_LHUE_FM_MM<0x18, 0x6, 0x0>; - def LHE_MM : LoadMemory<"lhe", GPR32Opnd, mem_simm9>, + def LBE_MM : Load<"lbe", GPR32Opnd, null_frag, II_LBE>, + POOL32C_LHUE_FM_MM<0x18, 0x6, 0x4>; + def LBuE_MM : Load<"lbue", GPR32Opnd, null_frag, II_LBUE>, + POOL32C_LHUE_FM_MM<0x18, 0x6, 0x0>; + def LHE_MM : LoadMemory<"lhe", GPR32Opnd, mem_simm9, null_frag, II_LHE>, POOL32C_LHUE_FM_MM<0x18, 0x6, 0x5>; - def LHuE_MM : LoadMemory<"lhue", GPR32Opnd, mem_simm9>, + def LHuE_MM : LoadMemory<"lhue", GPR32Opnd, mem_simm9, null_frag, II_LHUE>, POOL32C_LHUE_FM_MM<0x18, 0x6, 0x1>; - def LWE_MM : LoadMemory<"lwe", GPR32Opnd, mem_simm9>, + def LWE_MM : LoadMemory<"lwe", GPR32Opnd, mem_simm9, null_frag, II_LWE>, POOL32C_LHUE_FM_MM<0x18, 0x6, 0x7>; - def SBE_MM : StoreMemory<"sbe", GPR32Opnd, mem_simm9>, + def SBE_MM : StoreMemory<"sbe", GPR32Opnd, mem_simm9, null_frag, II_SBE>, POOL32C_LHUE_FM_MM<0x18, 0xa, 0x4>; - def SHE_MM : StoreMemory<"she", GPR32Opnd, mem_simm9>, + def SHE_MM : StoreMemory<"she", GPR32Opnd, mem_simm9, null_frag, II_SHE>, POOL32C_LHUE_FM_MM<0x18, 0xa, 0x5>; - def SWE_MM : StoreMemory<"swe", GPR32Opnd, mem_simm9>, + def SWE_MM : StoreMemory<"swe", GPR32Opnd, mem_simm9, null_frag, II_SWE>, POOL32C_LHUE_FM_MM<0x18, 0xa, 0x7>; } def LWXS_MM : LoadWordIndexedScaledMM<"lwxs", GPR32Opnd>, LWXS_FM_MM<0x118>; /// Load and Store Instructions - unaligned - def LWL_MM : LoadLeftRightMM<"lwl", MipsLWL, GPR32Opnd, mem_mm_12>, + def LWL_MM : LoadLeftRightMM<"lwl", MipsLWL, GPR32Opnd, mem_mm_12, II_LWL>, LWL_FM_MM<0x0>; - def LWR_MM : LoadLeftRightMM<"lwr", MipsLWR, GPR32Opnd, mem_mm_12>, + def LWR_MM : LoadLeftRightMM<"lwr", MipsLWR, GPR32Opnd, mem_mm_12, II_LWR>, LWL_FM_MM<0x1>; - def SWL_MM : StoreLeftRightMM<"swl", MipsSWL, GPR32Opnd, mem_mm_12>, + def SWL_MM : StoreLeftRightMM<"swl", MipsSWL, GPR32Opnd, mem_mm_12, II_SWL>, LWL_FM_MM<0x8>; - def SWR_MM : StoreLeftRightMM<"swr", MipsSWR, GPR32Opnd, mem_mm_12>, + def SWR_MM : StoreLeftRightMM<"swr", MipsSWR, GPR32Opnd, mem_mm_12, II_SWR>, LWL_FM_MM<0x9>; let DecoderMethod = "DecodeMemMMImm9" in { - def LWLE_MM : LoadLeftRightMM<"lwle", MipsLWL, GPR32Opnd, mem_mm_9>, - POOL32C_STEVA_LDEVA_FM_MM<0x6, 0x2>; - def LWRE_MM : LoadLeftRightMM<"lwre", MipsLWR, GPR32Opnd, mem_mm_9>, - POOL32C_STEVA_LDEVA_FM_MM<0x6, 0x3>; - def SWLE_MM : StoreLeftRightMM<"swle", MipsSWL, GPR32Opnd, mem_mm_9>, + def LWLE_MM : LoadLeftRightMM<"lwle", MipsLWL, GPR32Opnd, mem_mm_9, + II_LWLE>, POOL32C_STEVA_LDEVA_FM_MM<0x6, 0x2>; + def LWRE_MM : LoadLeftRightMM<"lwre", MipsLWR, GPR32Opnd, mem_mm_9, + II_LWRE>, POOL32C_STEVA_LDEVA_FM_MM<0x6, 0x3>; + def SWLE_MM : StoreLeftRightMM<"swle", MipsSWL, GPR32Opnd, mem_mm_9, + II_SWLE>, POOL32C_STEVA_LDEVA_FM_MM<0xa, 0x0>; - def SWRE_MM : StoreLeftRightMM<"swre", MipsSWR, GPR32Opnd, mem_mm_9>, + def SWRE_MM : StoreLeftRightMM<"swre", MipsSWR, GPR32Opnd, mem_mm_9, + II_SWRE>, POOL32C_STEVA_LDEVA_FM_MM<0xa, 0x1>, ISA_MIPS1_NOT_32R6_64R6; } /// Load and Store Instructions - multiple - def SWM32_MM : StoreMultMM<"swm32">, LWM_FM_MM<0xd>; - def LWM32_MM : LoadMultMM<"lwm32">, LWM_FM_MM<0x5>; + def SWM32_MM : StoreMultMM<"swm32", II_SWM>, LWM_FM_MM<0xd>; + def LWM32_MM : LoadMultMM<"lwm32", II_LWM>, LWM_FM_MM<0x5>; /// Load and Store Pair Instructions def SWP_MM : StorePairMM<"swp">, LWM_FM_MM<0x9>; @@ -869,9 +876,9 @@ def MSUBU_MM : MMRel, MArithR<"msubu", II_MSUBU>, MULT_FM_MM<0x3ec>; /// Count Leading - def CLZ_MM : MMRel, CountLeading0<"clz", GPR32Opnd>, CLO_FM_MM<0x16c>, + def CLZ_MM : MMRel, CountLeading0<"clz", GPR32Opnd, II_CLZ>, CLO_FM_MM<0x16c>, ISA_MIPS32; - def CLO_MM : MMRel, CountLeading1<"clo", GPR32Opnd>, CLO_FM_MM<0x12c>, + def CLO_MM : MMRel, CountLeading1<"clo", GPR32Opnd, II_CLO>, CLO_FM_MM<0x12c>, ISA_MIPS32; /// Sign Ext In Register Instructions. @@ -931,29 +938,33 @@ /// Control Instructions def SYNC_MM : MMRel, SYNC_FT<"sync">, SYNC_FM_MM; def BREAK_MM : MMRel, BRK_FT<"break">, BRK_FM_MM; - def SYSCALL_MM : MMRel, SYS_FT<"syscall", uimm10>, SYS_FM_MM; + def SYSCALL_MM : MMRel, SYS_FT<"syscall", uimm10, II_SYSCALL>, SYS_FM_MM; def WAIT_MM : WaitMM<"wait">, WAIT_FM_MM; - def ERET_MM : MMRel, ER_FT<"eret">, ER_FM_MM<0x3cd>; - def DERET_MM : MMRel, ER_FT<"deret">, ER_FM_MM<0x38d>; - def EI_MM : MMRel, DEI_FT<"ei", GPR32Opnd>, EI_FM_MM<0x15d>, + def ERET_MM : MMRel, ER_FT<"eret", II_ERET>, ER_FM_MM<0x3cd>; + def DERET_MM : MMRel, ER_FT<"deret", II_DERET>, ER_FM_MM<0x38d>; + def EI_MM : MMRel, DEI_FT<"ei", GPR32Opnd, II_EI>, EI_FM_MM<0x15d>, ISA_MIPS32R2; - def DI_MM : MMRel, DEI_FT<"di", GPR32Opnd>, EI_FM_MM<0x11d>, + def DI_MM : MMRel, DEI_FT<"di", GPR32Opnd, II_DI>, EI_FM_MM<0x11d>, ISA_MIPS32R2; /// Trap Instructions - def TEQ_MM : MMRel, TEQ_FT<"teq", GPR32Opnd, uimm4>, TEQ_FM_MM<0x0>; - def TGE_MM : MMRel, TEQ_FT<"tge", GPR32Opnd, uimm4>, TEQ_FM_MM<0x08>; - def TGEU_MM : MMRel, TEQ_FT<"tgeu", GPR32Opnd, uimm4>, TEQ_FM_MM<0x10>; - def TLT_MM : MMRel, TEQ_FT<"tlt", GPR32Opnd, uimm4>, TEQ_FM_MM<0x20>; - def TLTU_MM : MMRel, TEQ_FT<"tltu", GPR32Opnd, uimm4>, TEQ_FM_MM<0x28>; - def TNE_MM : MMRel, TEQ_FT<"tne", GPR32Opnd, uimm4>, TEQ_FM_MM<0x30>; - - def TEQI_MM : MMRel, TEQI_FT<"teqi", GPR32Opnd>, TEQI_FM_MM<0x0e>; - def TGEI_MM : MMRel, TEQI_FT<"tgei", GPR32Opnd>, TEQI_FM_MM<0x09>; - def TGEIU_MM : MMRel, TEQI_FT<"tgeiu", GPR32Opnd>, TEQI_FM_MM<0x0b>; - def TLTI_MM : MMRel, TEQI_FT<"tlti", GPR32Opnd>, TEQI_FM_MM<0x08>; - def TLTIU_MM : MMRel, TEQI_FT<"tltiu", GPR32Opnd>, TEQI_FM_MM<0x0a>; - def TNEI_MM : MMRel, TEQI_FT<"tnei", GPR32Opnd>, TEQI_FM_MM<0x0c>; + def TEQ_MM : MMRel, TEQ_FT<"teq", GPR32Opnd, uimm4, II_TEQ>, TEQ_FM_MM<0x0>; + def TGE_MM : MMRel, TEQ_FT<"tge", GPR32Opnd, uimm4, II_TGE>, TEQ_FM_MM<0x08>; + def TGEU_MM : MMRel, TEQ_FT<"tgeu", GPR32Opnd, uimm4, II_TGEU>, + TEQ_FM_MM<0x10>; + def TLT_MM : MMRel, TEQ_FT<"tlt", GPR32Opnd, uimm4, II_TLT>, TEQ_FM_MM<0x20>; + def TLTU_MM : MMRel, TEQ_FT<"tltu", GPR32Opnd, uimm4, II_TLTU>, + TEQ_FM_MM<0x28>; + def TNE_MM : MMRel, TEQ_FT<"tne", GPR32Opnd, uimm4, II_TNE>, TEQ_FM_MM<0x30>; + + def TEQI_MM : MMRel, TEQI_FT<"teqi", GPR32Opnd, II_TEQI>, TEQI_FM_MM<0x0e>; + def TGEI_MM : MMRel, TEQI_FT<"tgei", GPR32Opnd, II_TGEI>, TEQI_FM_MM<0x09>; + def TGEIU_MM : MMRel, TEQI_FT<"tgeiu", GPR32Opnd, II_TGEIU>, + TEQI_FM_MM<0x0b>; + def TLTI_MM : MMRel, TEQI_FT<"tlti", GPR32Opnd, II_TLTI>, TEQI_FM_MM<0x08>; + def TLTIU_MM : MMRel, TEQI_FT<"tltiu", GPR32Opnd, II_TTLTIU>, + TEQI_FM_MM<0x0a>; + def TNEI_MM : MMRel, TEQI_FT<"tnei", GPR32Opnd, II_TNEI>, TEQI_FM_MM<0x0c>; /// Load-linked, Store-conditional def LL_MM : LLBaseMM<"ll", GPR32Opnd>, LL_FM_MM<0x3>; @@ -963,28 +974,28 @@ def SCE_MM : SCEBaseMM<"sce", GPR32Opnd>, LLE_FM_MM<0xA>; let DecoderMethod = "DecodeCacheOpMM" in { - def CACHE_MM : MMRel, CacheOp<"cache", mem_mm_12>, + def CACHE_MM : MMRel, CacheOp<"cache", mem_mm_12, II_CACHE>, CACHE_PREF_FM_MM<0x08, 0x6>; - def PREF_MM : MMRel, CacheOp<"pref", mem_mm_12>, + def PREF_MM : MMRel, CacheOp<"pref", mem_mm_12, II_PREF>, CACHE_PREF_FM_MM<0x18, 0x2>; } let DecoderMethod = "DecodePrefeOpMM" in { - def PREFE_MM : MMRel, CacheOp<"prefe", mem_mm_9>, + def PREFE_MM : MMRel, CacheOp<"prefe", mem_mm_9, II_PREFE>, CACHE_PREFE_FM_MM<0x18, 0x2>; - def CACHEE_MM : MMRel, CacheOp<"cachee", mem_mm_9>, + def CACHEE_MM : MMRel, CacheOp<"cachee", mem_mm_9, II_CACHEE>, CACHE_PREFE_FM_MM<0x18, 0x3>; } - def SSNOP_MM : MMRel, Barrier<"ssnop">, BARRIER_FM_MM<0x1>; - def EHB_MM : MMRel, Barrier<"ehb">, BARRIER_FM_MM<0x3>; - def PAUSE_MM : MMRel, Barrier<"pause">, BARRIER_FM_MM<0x5>; + def SSNOP_MM : MMRel, Barrier<"ssnop", II_SSNOP>, BARRIER_FM_MM<0x1>; + def EHB_MM : MMRel, Barrier<"ehb", II_EHB>, BARRIER_FM_MM<0x3>; + def PAUSE_MM : MMRel, Barrier<"pause", II_PAUSE>, BARRIER_FM_MM<0x5>; - def TLBP_MM : MMRel, TLB<"tlbp">, COP0_TLB_FM_MM<0x0d>; - def TLBR_MM : MMRel, TLB<"tlbr">, COP0_TLB_FM_MM<0x4d>; - def TLBWI_MM : MMRel, TLB<"tlbwi">, COP0_TLB_FM_MM<0x8d>; - def TLBWR_MM : MMRel, TLB<"tlbwr">, COP0_TLB_FM_MM<0xcd>; + def TLBP_MM : MMRel, TLB<"tlbp", II_TLBP>, COP0_TLB_FM_MM<0x0d>; + def TLBR_MM : MMRel, TLB<"tlbr", II_TLBR>, COP0_TLB_FM_MM<0x4d>; + def TLBWI_MM : MMRel, TLB<"tlbwi", II_TLBWI>, COP0_TLB_FM_MM<0x8d>; + def TLBWR_MM : MMRel, TLB<"tlbwr", II_TLBWR>, COP0_TLB_FM_MM<0xcd>; - def SDBBP_MM : MMRel, SYS_FT<"sdbbp", uimm10>, SDBBP_FM_MM; + def SDBBP_MM : MMRel, SYS_FT<"sdbbp", uimm10, II_SDBBP>, SDBBP_FM_MM; def PREFX_MM : PrefetchIndexed<"prefx">, POOL32F_PREFX_FM_MM<0x15, 0x1A0>; } Index: lib/Target/Mips/Mips16ISelDAGToDAG.cpp =================================================================== --- lib/Target/Mips/Mips16ISelDAGToDAG.cpp +++ lib/Target/Mips/Mips16ISelDAGToDAG.cpp @@ -80,9 +80,10 @@ V1 = RegInfo.createVirtualRegister(RC); V2 = RegInfo.createVirtualRegister(RC); - BuildMI(MBB, I, DL, TII.get(Mips::GotPrologue16), V0) - .addReg(V1, RegState::Define) - .addExternalSymbol("_gp_disp", MipsII::MO_ABS_HI) + + BuildMI(MBB, I, DL, TII.get(Mips::LiRxImmX16), V0) + .addExternalSymbol("_gp_disp", MipsII::MO_ABS_HI); + BuildMI(MBB, I, DL, TII.get(Mips::AddiuRxPcImmX16), V1) .addExternalSymbol("_gp_disp", MipsII::MO_ABS_LO); BuildMI(MBB, I, DL, TII.get(Mips::SllX16), V2).addReg(V0).addImm(16); Index: lib/Target/Mips/Mips32r6InstrInfo.td =================================================================== --- lib/Target/Mips/Mips32r6InstrInfo.td +++ lib/Target/Mips/Mips32r6InstrInfo.td @@ -177,90 +177,98 @@ class CMP_CONDN_DESC_BASE { dag OutOperandList = (outs FGRCCOpnd:$fd); dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft); string AsmString = !strconcat("cmp.", CondStr, ".", Typestr, "\t$fd, $fs, $ft"); list Pattern = [(set FGRCCOpnd:$fd, (Op FGROpnd:$fs, FGROpnd:$ft))]; bit isCTI = 1; + InstrItinClass Itinerary = Itin; } multiclass CMP_CC_M { + RegisterOperand FGROpnd, InstrItinClass Itin>{ let AdditionalPredicates = [NotInMicroMips] in { def CMP_F_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"af", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"af", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_UN_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"un", Typestr, FGROpnd, setuo>, + CMP_CONDN_DESC_BASE<"un", Typestr, FGROpnd, Itin, setuo>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_EQ_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"eq", Typestr, FGROpnd, setoeq>, + CMP_CONDN_DESC_BASE<"eq", Typestr, FGROpnd, Itin, + setoeq>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_UEQ_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"ueq", Typestr, FGROpnd, setueq>, + CMP_CONDN_DESC_BASE<"ueq", Typestr, FGROpnd, Itin, + setueq>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_LT_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"lt", Typestr, FGROpnd, setolt>, + CMP_CONDN_DESC_BASE<"lt", Typestr, FGROpnd, Itin, + setolt>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_ULT_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"ult", Typestr, FGROpnd, setult>, + CMP_CONDN_DESC_BASE<"ult", Typestr, FGROpnd, Itin, + setult>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_LE_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"le", Typestr, FGROpnd, setole>, + CMP_CONDN_DESC_BASE<"le", Typestr, FGROpnd, Itin, + setole>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_ULE_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"ule", Typestr, FGROpnd, setule>, + CMP_CONDN_DESC_BASE<"ule", Typestr, FGROpnd, Itin, + setule>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SAF_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"saf", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"saf", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SUN_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"sun", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"sun", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SEQ_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"seq", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"seq", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SUEQ_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"sueq", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"sueq", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SLT_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"slt", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"slt", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SULT_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"sult", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"sult", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SLE_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"sle", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"sle", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; def CMP_SULE_#NAME : R6MMR6Rel, COP1_CMP_CONDN_FM, - CMP_CONDN_DESC_BASE<"sule", Typestr, FGROpnd>, + CMP_CONDN_DESC_BASE<"sule", Typestr, FGROpnd, Itin>, MipsR6Arch, ISA_MIPS32R6, HARDFLOAT; } @@ -426,6 +434,7 @@ string AsmString = instr_asm; bit hasDelaySlot = 1; bit isCTI = 1; + InstrItinClass Itinerary = II_BC2CCZ; } class BC2EQZ_DESC : COP2_BCCZ_DESC_BASE<"bc2eqz $ct, $offset">; @@ -468,6 +477,7 @@ bit isTerminator=1; bit isBarrier=1; bit isCTI = 1; + InstrItinClass Itinerary = II_JR_HB; } class BITSWAP_DESC_BASE; class MULU_DESC : MUL_R6_DESC_BASE<"mulu", GPR32Opnd, II_MULU>; -class COP1_SEL_DESC_BASE { +class COP1_SEL_DESC_BASE { dag OutOperandList = (outs FGROpnd:$fd); dag InOperandList = (ins FGRCCOpnd:$fd_in, FGROpnd:$fs, FGROpnd:$ft); string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft"); @@ -548,13 +559,16 @@ FGROpnd:$ft, FGROpnd:$fs))]; string Constraints = "$fd_in = $fd"; + InstrItinClass Itinerary = itin; } -class SEL_D_DESC : COP1_SEL_DESC_BASE<"sel.d", FGR64Opnd>, MipsR6Arch<"sel.d"> { +class SEL_D_DESC : COP1_SEL_DESC_BASE<"sel.d", FGR64Opnd, II_SEL_D>, + MipsR6Arch<"sel.d"> { // We must insert a SUBREG_TO_REG around $fd_in bit usesCustomInserter = 1; } -class SEL_S_DESC : COP1_SEL_DESC_BASE<"sel.s", FGR32Opnd>, MipsR6Arch<"sel.s">; +class SEL_S_DESC : COP1_SEL_DESC_BASE<"sel.s", FGR32Opnd, II_SEL_S>, + MipsR6Arch<"sel.s">; class SELEQNE_Z_DESC_BASE : MipsR6Arch { @@ -583,86 +597,98 @@ class MSUBF_S_DESC : COP1_4R_DESC_BASE<"msubf.s", FGR32Opnd, II_MSUBF_S>; class MSUBF_D_DESC : COP1_4R_DESC_BASE<"msubf.d", FGR64Opnd, II_MSUBF_D>; -class MAX_MIN_DESC_BASE { +class MAX_MIN_DESC_BASE { dag OutOperandList = (outs FGROpnd:$fd); dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft); string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft"); list Pattern = []; + InstrItinClass Itinerary = itin; } -class MAX_S_DESC : MAX_MIN_DESC_BASE<"max.s", FGR32Opnd>; -class MAX_D_DESC : MAX_MIN_DESC_BASE<"max.d", FGR64Opnd>; -class MIN_S_DESC : MAX_MIN_DESC_BASE<"min.s", FGR32Opnd>; -class MIN_D_DESC : MAX_MIN_DESC_BASE<"min.d", FGR64Opnd>; +class MAX_S_DESC : MAX_MIN_DESC_BASE<"max.s", FGR32Opnd, II_MAX_S>; +class MAX_D_DESC : MAX_MIN_DESC_BASE<"max.d", FGR64Opnd, II_MAX_D>; +class MIN_S_DESC : MAX_MIN_DESC_BASE<"min.s", FGR32Opnd, II_MIN_S>; +class MIN_D_DESC : MAX_MIN_DESC_BASE<"min.d", FGR64Opnd, II_MIN_D>; -class MAXA_S_DESC : MAX_MIN_DESC_BASE<"maxa.s", FGR32Opnd>; -class MAXA_D_DESC : MAX_MIN_DESC_BASE<"maxa.d", FGR64Opnd>; -class MINA_S_DESC : MAX_MIN_DESC_BASE<"mina.s", FGR32Opnd>; -class MINA_D_DESC : MAX_MIN_DESC_BASE<"mina.d", FGR64Opnd>; +class MAXA_S_DESC : MAX_MIN_DESC_BASE<"maxa.s", FGR32Opnd, II_MAX_S>; +class MAXA_D_DESC : MAX_MIN_DESC_BASE<"maxa.d", FGR64Opnd, II_MAX_D>; +class MINA_S_DESC : MAX_MIN_DESC_BASE<"mina.s", FGR32Opnd, II_MIN_D>; +class MINA_D_DESC : MAX_MIN_DESC_BASE<"mina.d", FGR64Opnd, II_MIN_S>; -class SELEQNEZ_DESC_BASE { +class SELEQNEZ_DESC_BASE { dag OutOperandList = (outs FGROpnd:$fd); dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft); string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft"); list Pattern = []; + InstrItinClass Itinerary = itin; } -class SELEQZ_S_DESC : SELEQNEZ_DESC_BASE<"seleqz.s", FGR32Opnd>, +class SELEQZ_S_DESC : SELEQNEZ_DESC_BASE<"seleqz.s", FGR32Opnd, II_SELCCZ_S>, MipsR6Arch<"seleqz.s">; -class SELEQZ_D_DESC : SELEQNEZ_DESC_BASE<"seleqz.d", FGR64Opnd>, +class SELEQZ_D_DESC : SELEQNEZ_DESC_BASE<"seleqz.d", FGR64Opnd, II_SELCCZ_D>, MipsR6Arch<"seleqz.d">; -class SELNEZ_S_DESC : SELEQNEZ_DESC_BASE<"selnez.s", FGR32Opnd>, +class SELNEZ_S_DESC : SELEQNEZ_DESC_BASE<"selnez.s", FGR32Opnd, II_SELCCZ_S>, MipsR6Arch<"selnez.s">; -class SELNEZ_D_DESC : SELEQNEZ_DESC_BASE<"selnez.d", FGR64Opnd>, +class SELNEZ_D_DESC : SELEQNEZ_DESC_BASE<"selnez.d", FGR64Opnd, II_SELCCZ_D>, MipsR6Arch<"selnez.d">; -class CLASS_RINT_DESC_BASE { +class CLASS_RINT_DESC_BASE { dag OutOperandList = (outs FGROpnd:$fd); dag InOperandList = (ins FGROpnd:$fs); string AsmString = !strconcat(instr_asm, "\t$fd, $fs"); list Pattern = []; + InstrItinClass Itinerary = itin; } -class RINT_S_DESC : CLASS_RINT_DESC_BASE<"rint.s", FGR32Opnd>; -class RINT_D_DESC : CLASS_RINT_DESC_BASE<"rint.d", FGR64Opnd>; -class CLASS_S_DESC : CLASS_RINT_DESC_BASE<"class.s", FGR32Opnd>; -class CLASS_D_DESC : CLASS_RINT_DESC_BASE<"class.d", FGR64Opnd>; +class RINT_S_DESC : CLASS_RINT_DESC_BASE<"rint.s", FGR32Opnd, II_RINT_S>; +class RINT_D_DESC : CLASS_RINT_DESC_BASE<"rint.d", FGR64Opnd, II_RINT_D>; +class CLASS_S_DESC : CLASS_RINT_DESC_BASE<"class.s", FGR32Opnd, II_CLASS_S>; +class CLASS_D_DESC : CLASS_RINT_DESC_BASE<"class.d", FGR64Opnd, II_CLASS_D>; class CACHE_HINT_DESC : MipsR6Arch { + RegisterOperand GPROpnd, InstrItinClass itin> + : MipsR6Arch { dag OutOperandList = (outs); dag InOperandList = (ins MemOpnd:$addr, uimm5:$hint); string AsmString = !strconcat(instr_asm, "\t$hint, $addr"); list Pattern = []; string DecoderMethod = "DecodeCacheeOp_CacheOpR6"; + InstrItinClass Itinerary = itin; } -class CACHE_DESC : CACHE_HINT_DESC<"cache", mem_simm9, GPR32Opnd>; -class PREF_DESC : CACHE_HINT_DESC<"pref", mem_simm9, GPR32Opnd>; +class CACHE_DESC : CACHE_HINT_DESC<"cache", mem_simm9, GPR32Opnd, II_CACHE>; +class PREF_DESC : CACHE_HINT_DESC<"pref", mem_simm9, GPR32Opnd, II_PREF>; -class COP2LD_DESC_BASE { +class COP2LD_DESC_BASE { dag OutOperandList = (outs COPOpnd:$rt); dag InOperandList = (ins mem_simm11:$addr); string AsmString = !strconcat(instr_asm, "\t$rt, $addr"); list Pattern = []; bit mayLoad = 1; string DecoderMethod = "DecodeFMemCop2R6"; + InstrItinClass Itinerary = itin; } -class LDC2_R6_DESC : COP2LD_DESC_BASE<"ldc2", COP2Opnd>; -class LWC2_R6_DESC : COP2LD_DESC_BASE<"lwc2", COP2Opnd>; +class LDC2_R6_DESC : COP2LD_DESC_BASE<"ldc2", COP2Opnd, II_LDC2>; +class LWC2_R6_DESC : COP2LD_DESC_BASE<"lwc2", COP2Opnd, II_LWC2>; -class COP2ST_DESC_BASE { +class COP2ST_DESC_BASE { dag OutOperandList = (outs); dag InOperandList = (ins COPOpnd:$rt, mem_simm11:$addr); string AsmString = !strconcat(instr_asm, "\t$rt, $addr"); list Pattern = []; bit mayStore = 1; string DecoderMethod = "DecodeFMemCop2R6"; + InstrItinClass Itinerary = itin; } -class SDC2_R6_DESC : COP2ST_DESC_BASE<"sdc2", COP2Opnd>; -class SWC2_R6_DESC : COP2ST_DESC_BASE<"swc2", COP2Opnd>; +class SDC2_R6_DESC : COP2ST_DESC_BASE<"sdc2", COP2Opnd, II_SDC2>; +class SWC2_R6_DESC : COP2ST_DESC_BASE<"swc2", COP2Opnd, II_SWC2>; class LSA_R6_DESC_BASE @@ -732,6 +758,7 @@ string AsmString = "sdbbp\t$code_"; list Pattern = []; bit isCTI = 1; + InstrItinClass Itinerary = II_SDBBP; } //===----------------------------------------------------------------------===// @@ -784,8 +811,8 @@ } def CLO_R6 : R6MMR6Rel, CLO_R6_ENC, CLO_R6_DESC, ISA_MIPS32R6; def CLZ_R6 : R6MMR6Rel, CLZ_R6_ENC, CLZ_R6_DESC, ISA_MIPS32R6; -defm S : CMP_CC_M; -defm D : CMP_CC_M; +defm S : CMP_CC_M; +defm D : CMP_CC_M; let AdditionalPredicates = [NotInMicroMips] in { def DIV : R6MMR6Rel, DIV_ENC, DIV_DESC, ISA_MIPS32R6; def DIVU : R6MMR6Rel, DIVU_ENC, DIVU_DESC, ISA_MIPS32R6; Index: lib/Target/Mips/Mips64InstrInfo.td =================================================================== --- lib/Target/Mips/Mips64InstrInfo.td +++ lib/Target/Mips/Mips64InstrInfo.td @@ -295,14 +295,16 @@ /// Count Leading let AdditionalPredicates = [NotInMicroMips] in { - def DCLZ : StdMMR6Rel, CountLeading0<"dclz", GPR64Opnd>, CLO_FM<0x24>, - ISA_MIPS64_NOT_64R6; - def DCLO : StdMMR6Rel, CountLeading1<"dclo", GPR64Opnd>, CLO_FM<0x25>, - ISA_MIPS64_NOT_64R6; + def DCLZ : StdMMR6Rel, CountLeading0<"dclz", GPR64Opnd, II_DCLZ>, + CLO_FM<0x24>, ISA_MIPS64_NOT_64R6; + def DCLO : StdMMR6Rel, CountLeading1<"dclo", GPR64Opnd, II_DCLO>, + CLO_FM<0x25>, ISA_MIPS64_NOT_64R6; /// Double Word Swap Bytes/HalfWords - def DSBH : SubwordSwap<"dsbh", GPR64Opnd>, SEB_FM<2, 0x24>, ISA_MIPS64R2; - def DSHD : SubwordSwap<"dshd", GPR64Opnd>, SEB_FM<5, 0x24>, ISA_MIPS64R2; + def DSBH : SubwordSwap<"dsbh", GPR64Opnd, II_DSBH>, SEB_FM<2, 0x24>, + ISA_MIPS64R2; + def DSHD : SubwordSwap<"dshd", GPR64Opnd, II_DSHD>, SEB_FM<5, 0x24>, + ISA_MIPS64R2; } def LEA_ADDiu64 : EffectiveAddress<"daddiu", GPR64Opnd>, LW_FM<0x19>; @@ -359,11 +361,12 @@ let TwoOperandAliasConstraint = "$rd = $rs"; } -class ExtsCins: +class ExtsCins: InstSE<(outs GPR64Opnd:$rt), (ins GPR64Opnd:$rs, uimm5:$pos, uimm5:$lenm1), !strconcat(opstr, " $rt, $rs, $pos, $lenm1"), [(set GPR64Opnd:$rt, (Op GPR64Opnd:$rs, imm:$pos, imm:$lenm1))], - NoItinerary, FrmR, opstr> { + itin, FrmR, opstr> { let TwoOperandAliasConstraint = "$rt = $rs"; } @@ -397,9 +400,9 @@ let Defs = [AT]; } -class MFC2OP : +class MFC2OP : InstSE<(outs RO:$rt, uimm16:$imm16), (ins), - !strconcat(asmstr, "\t$rt, $imm16"), [], NoItinerary, FrmFR>; + !strconcat(asmstr, "\t$rt, $imm16"), [], itin, FrmFR>; // Unsigned Byte Add def BADDu : ArithLogicR<"baddu", GPR64Opnd, 1, II_BADDU>, @@ -427,12 +430,12 @@ } // Extract a signed bit field /+32 -def EXTS : ExtsCins<"exts">, EXTS_FM<0x3a>, ASE_CNMIPS; -def EXTS32: ExtsCins<"exts32">, EXTS_FM<0x3b>, ASE_CNMIPS; +def EXTS : ExtsCins<"exts", II_EXT>, EXTS_FM<0x3a>, ASE_CNMIPS; +def EXTS32: ExtsCins<"exts32", II_EXT>, EXTS_FM<0x3b>, ASE_CNMIPS; // Clear and insert a bit field /+32 -def CINS : ExtsCins<"cins">, EXTS_FM<0x32>, ASE_CNMIPS; -def CINS32: ExtsCins<"cins32">, EXTS_FM<0x33>, ASE_CNMIPS; +def CINS : ExtsCins<"cins", II_INS>, EXTS_FM<0x32>, ASE_CNMIPS; +def CINS32: ExtsCins<"cins32", II_INS>, EXTS_FM<0x33>, ASE_CNMIPS; // Move to multiplier/product register def MTM0 : MoveToLOHI<"mtm0", GPR64Opnd, [MPL0, P0, P1, P2]>, MTMR_FM<0x08>, @@ -474,8 +477,10 @@ } // Move between CPU and coprocessor registers -def DMFC2_OCTEON : MFC2OP<"dmfc2", GPR64Opnd>, MFC2OP_FM<0x12, 1>, ASE_CNMIPS; -def DMTC2_OCTEON : MFC2OP<"dmtc2", GPR64Opnd>, MFC2OP_FM<0x12, 5>, ASE_CNMIPS; +def DMFC2_OCTEON : MFC2OP<"dmfc2", GPR64Opnd, II_DMFC2>, MFC2OP_FM<0x12, 1>, + ASE_CNMIPS; +def DMTC2_OCTEON : MFC2OP<"dmtc2", GPR64Opnd, II_DMTC2>, MFC2OP_FM<0x12, 5>, + ASE_CNMIPS; } } Index: lib/Target/Mips/Mips64r6InstrInfo.td =================================================================== --- lib/Target/Mips/Mips64r6InstrInfo.td +++ lib/Target/Mips/Mips64r6InstrInfo.td @@ -90,12 +90,13 @@ class BNEZC64_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"bnezc", brtarget21, GPR64Opnd>; class JIALC64_DESC : JMP_IDX_COMPACT_DESC_BASE<"jialc", calloffset16, - GPR64Opnd> { + GPR64Opnd, II_JIALC> { bit isCall = 1; list Defs = [RA]; } -class JIC64_DESC : JMP_IDX_COMPACT_DESC_BASE<"jic", jmpoffset16, GPR64Opnd> { +class JIC64_DESC : JMP_IDX_COMPACT_DESC_BASE<"jic", jmpoffset16, GPR64Opnd, + II_JIC> { bit isBarrier = 1; bit isTerminator = 1; list Defs = [AT]; Index: lib/Target/Mips/MipsSchedule.td =================================================================== --- lib/Target/Mips/MipsSchedule.td +++ lib/Target/Mips/MipsSchedule.td @@ -44,6 +44,7 @@ def II_BC1T : InstrItinClass; def II_BC1TL : InstrItinClass; def II_BC1CCZ : InstrItinClass; +def II_BC2CCZ : InstrItinClass; def II_BCC : InstrItinClass; // beq and bne def II_BCCZ : InstrItinClass; // b[gl][et]z def II_BCCC : InstrItinClass; // bc @@ -61,6 +62,10 @@ def II_CVT : InstrItinClass; def II_C_CC_D : InstrItinClass; // Any c..d instruction def II_C_CC_S : InstrItinClass; // Any c..s instruction +def II_CMP_CC_D : InstrItinClass; // Any cmp..d instruction +def II_CMP_CC_S : InstrItinClass; // Any cmp..s instruction +def II_CLASS_D : InstrItinClass; +def II_CLASS_S : InstrItinClass; def II_DADDIU : InstrItinClass; def II_DADDU : InstrItinClass; def II_DADDI : InstrItinClass; @@ -174,6 +179,7 @@ def II_LHU : InstrItinClass; def II_LHUE : InstrItinClass; def II_LL : InstrItinClass; +def II_LI : InstrItinClass; def II_LLD : InstrItinClass; def II_LUI : InstrItinClass; def II_LUXC1 : InstrItinClass; @@ -182,14 +188,17 @@ def II_LWC1 : InstrItinClass; def II_LWC2 : InstrItinClass; def II_LWC3 : InstrItinClass; +def II_LWM : InstrItinClass; def II_LWL : InstrItinClass; def II_LWLE : InstrItinClass; def II_LWPC : InstrItinClass; +def II_LWP : InstrItinClass; def II_LWR : InstrItinClass; def II_LWRE : InstrItinClass; def II_LWU : InstrItinClass; def II_LWUPC : InstrItinClass; def II_LWXC1 : InstrItinClass; +def II_LWXS : InstrItinClass; def II_LSA : InstrItinClass; def II_DLSA : InstrItinClass; def II_MADD : InstrItinClass; @@ -198,6 +207,14 @@ def II_MADD_S : InstrItinClass; def II_MADDF_D : InstrItinClass; def II_MADDF_S : InstrItinClass; +def II_MAX_D : InstrItinClass; +def II_MAX_S : InstrItinClass; +def II_MAXA_D : InstrItinClass; +def II_MAXA_S : InstrItinClass; +def II_MIN_D : InstrItinClass; +def II_MIN_S : InstrItinClass; +def II_MINA_D : InstrItinClass; +def II_MINA_S : InstrItinClass; def II_MFC0 : InstrItinClass; def II_MFC1 : InstrItinClass; def II_MFHC1 : InstrItinClass; @@ -205,6 +222,7 @@ def II_MFHI_MFLO : InstrItinClass; // mfhi and mflo def II_MOD : InstrItinClass; def II_MODU : InstrItinClass; +def II_MOVE : InstrItinClass; def II_MOVF : InstrItinClass; def II_MOVF_D : InstrItinClass; def II_MOVF_S : InstrItinClass; @@ -244,11 +262,14 @@ def II_NMSUB_D : InstrItinClass; def II_NMSUB_S : InstrItinClass; def II_NOR : InstrItinClass; +def II_NOT : InstrItinClass; def II_OR : InstrItinClass; def II_ORI : InstrItinClass; def II_POP : InstrItinClass; def II_RDHWR : InstrItinClass; def II_RESTORE : InstrItinClass; +def II_RINT_S : InstrItinClass; +def II_RINT_D : InstrItinClass; def II_ROTR : InstrItinClass; def II_ROTRV : InstrItinClass; def II_ROUND : InstrItinClass; @@ -267,6 +288,8 @@ def II_SEB : InstrItinClass; def II_SEH : InstrItinClass; def II_SELCCZ : InstrItinClass; +def II_SELCCZ_D : InstrItinClass; +def II_SELCCZ_S : InstrItinClass; def II_SEQ_SNE : InstrItinClass; // seq and sne def II_SEQI_SNEI : InstrItinClass; // seqi and snei def II_SH : InstrItinClass; @@ -277,6 +300,8 @@ def II_SLT_SLTU : InstrItinClass; // slt and sltu def II_SQRT_D : InstrItinClass; def II_SQRT_S : InstrItinClass; +def II_SEL_D : InstrItinClass; +def II_SEL_S : InstrItinClass; def II_SRA : InstrItinClass; def II_SRAV : InstrItinClass; def II_SRL : InstrItinClass; @@ -293,6 +318,8 @@ def II_SWC3 : InstrItinClass; def II_SWL : InstrItinClass; def II_SWLE : InstrItinClass; +def II_SWM : InstrItinClass; +def II_SWP : InstrItinClass; def II_SWR : InstrItinClass; def II_SWRE : InstrItinClass; def II_SWXC1 : InstrItinClass; @@ -308,6 +335,10 @@ def II_SCE : InstrItinClass; def II_TLBINV : InstrItinClass; def II_TLBINVF : InstrItinClass; +def II_WRPGPR : InstrItinClass; +def II_RDPGPR : InstrItinClass; +def II_DVP : InstrItinClass; +def II_EVP : InstrItinClass; //===----------------------------------------------------------------------===// // Mips Generic instruction itineraries. @@ -370,6 +401,7 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -377,6 +409,7 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -394,6 +427,8 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -404,6 +439,7 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -411,15 +447,18 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, - InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -433,12 +472,15 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -495,6 +537,14 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -533,6 +583,8 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -553,8 +605,12 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -567,6 +623,7 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, @@ -597,5 +654,9 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, - InstrItinData]> + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]> ]>; Index: test/CodeGen/Mips/llvm-ir/add.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/add.ll +++ test/CodeGen/Mips/llvm-ir/add.ll @@ -154,13 +154,13 @@ ; MM32: lw $[[T3:[0-9]+]], 24($sp) ; MM32: addu $[[T4:[0-9]+]], $[[T2]], $[[T3]] ; MM32: addu $[[T5:[0-9]+]], $6, $[[T4]] - ; MM32: sltu $[[T6:[0-9]+]], $[[T5]], $[[T3]] + ; MM32: lw $[[T6:[0-9]+]], 16($sp) ; MM32: lw $[[T7:[0-9]+]], 20($sp) - ; MM32: addu $[[T8:[0-9]+]], $[[T6]], $[[T7]] - ; MM32: addu $[[T9:[0-9]+]], $5, $[[T8]] - ; MM32: lw $[[T10:[0-9]+]], 16($sp) - ; MM32: sltu $[[T11:[0-9]+]], $[[T9]], $[[T7]] - ; MM32: addu $[[T12:[0-9]+]], $[[T11]], $[[T10]] + ; MM32: sltu $[[T8:[0-9]+]], $[[T5]], $[[T3]] + ; MM32: addu $[[T9:[0-9]+]], $[[T8]], $[[T7]] + ; MM32: addu $[[T10:[0-9]+]], $5, $[[T9]] + ; MM32: sltu $[[T11:[0-6]+]], $[[T9]], $[[T7]] + ; MM32: addu $[[T12:[0-6]+]], $[[T11]], $[[T6]] ; MM32: addu $[[T13:[0-9]+]], $4, $[[T12]] ; MM32: move $4, $[[T5]] ; MM32: move $5, $[[T1]] Index: test/CodeGen/Mips/llvm-ir/and.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/and.ll +++ test/CodeGen/Mips/llvm-ir/and.ll @@ -131,13 +131,13 @@ ; GP64: and $2, $4, $6 ; GP64: and $3, $5, $7 - ; MM32: lw $[[T0:[0-9]+]], 20($sp) - ; MM32: lw $[[T1:[0-9]+]], 16($sp) - ; MM32: and16 $[[T1]], $4 - ; MM32: and16 $[[T0]], $5 + ; MM32: lw $[[T0:[0-9]+]], 32($sp) + ; MM32: lw $[[T1:[0-9]+]], 28($sp) ; MM32: lw $[[T2:[0-9]+]], 24($sp) - ; MM32: and16 $[[T2]], $6 - ; MM32: lw $[[T3:[0-9]+]], 28($sp) + ; MM32: and16 $[[T2]], $4 + ; MM32: and16 $[[T1]], $5 + ; MM32: and16 $[[T0]], $6 + ; MM32: lw $[[T3:[0-9]+]], 36($sp) ; MM32: and16 $[[T3]], $7 ; MM64: and $2, $4, $6 Index: test/CodeGen/Mips/llvm-ir/ashr.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/ashr.ll +++ test/CodeGen/Mips/llvm-ir/ashr.ll @@ -129,9 +129,9 @@ ; GP64: dsrav $2, $4, $5 ; MMR3: srlv $[[T0:[0-9]+]], $5, $7 - ; MMR3: sll16 $[[T1:[0-9]+]], $4, 1 - ; MMR3: not16 $[[T2:[0-9]+]], $7 - ; MMR3: sllv $[[T3:[0-9]+]], $[[T1]], $[[T2]] + ; MMR3: not16 $[[T1:[0-9]+]], $7 + ; MMR3: sll16 $[[T2:[0-9]+]], $4, 1 + ; MMR3: sllv $[[T3:[0-9]+]], $[[T2]], $[[T1]] ; MMR3: or16 $[[T4:[0-9]+]], $[[T0]] ; MMR3: srav $[[T5:[0-9]+]], $4, $7 ; MMR3: andi16 $[[T6:[0-9]+]], $7, 32 @@ -146,9 +146,9 @@ ; MMR6: selnez $[[T4:[0-9]+]], $[[T3]], $[[T1]] ; MMR6: or $[[T5:[0-9]+]], $[[T4]], $[[T2]] ; MMR6: srlv $[[T6:[0-9]+]], $5, $7 - ; MMR6: sll16 $[[T7:[0-9]+]], $4, 1 - ; MMR6: not16 $[[T8:[0-9]+]], $7 - ; MMR6: sllv $[[T9:[0-9]+]], $[[T7]], $[[T8]] + ; MMR6: not16 $[[T7:[0-9]+]], $7 + ; MMR6: sll16 $[[T8:[0-9]+]], $4, 1 + ; MMR6: sllv $[[T9:[0-9]+]], $[[T8]], $[[T7]] ; MMR6: or16 $[[T10:[0-9]+]], $[[T6]] ; MMR6: seleqz $[[T11:[0-9]+]], $[[T10]], $[[T1]] ; MMR6: selnez $[[T12:[0-9]+]], $[[T0]], $[[T1]] Index: test/CodeGen/Mips/llvm-ir/lshr.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/lshr.ll +++ test/CodeGen/Mips/llvm-ir/lshr.ll @@ -123,9 +123,9 @@ ; GP64: dsrlv $2, $4, $5 ; MMR3: srlv $[[T0:[0-9]+]], $5, $7 - ; MMR3: sll16 $[[T1:[0-9]+]], $4, 1 - ; MMR3: not16 $[[T2:[0-9]+]], $7 - ; MMR3: sllv $[[T3:[0-9]+]], $[[T1]], $[[T2]] + ; MMR3: not16 $[[T1:[0-9]+]], $7 + ; MMR3: sll16 $[[T2:[0-9]+]], $4, 1 + ; MMR3: sllv $[[T3:[0-9]+]], $[[T2]], $[[T1]] ; MMR3: or16 $[[T4:[0-9]+]], $[[T0]] ; MMR3: srlv $[[T5:[0-9]+]], $4, $7 ; MMR3: andi16 $[[T6:[0-9]+]], $7, 32 @@ -134,9 +134,9 @@ ; MMR3: movn $2, $[[T8]], $[[T6]] ; MMR6: srlv $[[T0:[0-9]+]], $5, $7 - ; MMR6: sll16 $[[T1:[0-9]+]], $4, 1 - ; MMR6: not16 $[[T2:[0-9]+]], $7 - ; MMR6: sllv $[[T3:[0-9]+]], $[[T1]], $[[T2]] + ; MMR6: not16 $[[T1:[0-9]+]], $7 + ; MMR6: sll16 $[[T2:[0-9]+]], $4, 1 + ; MMR6: sllv $[[T3:[0-9]+]], $[[T2]], $[[T1]] ; MMR6: or16 $[[T4:[0-9]+]], $[[T0]] ; MMR6: andi16 $[[T5:[0-9]+]], $7, 32 ; MMR6: seleqz $[[T6:[0-9]+]], $[[T4]], $[[T5]] Index: test/CodeGen/Mips/llvm-ir/mul.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/mul.ll +++ test/CodeGen/Mips/llvm-ir/mul.ll @@ -247,7 +247,7 @@ ; 64R6: daddu $[[T3:[0-9]+]], $[[T2]], $[[T1]] ; 64R6: daddu $2, $[[T1]], $[[T0]] - ; MM32: lw $25, %call16(__multi3)($2) + ; MM32: lw $25, %call16(__multi3)($16) %r = mul i128 %a, %b ret i128 %r Index: test/CodeGen/Mips/llvm-ir/not.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/not.ll +++ test/CodeGen/Mips/llvm-ir/not.ll @@ -221,12 +221,12 @@ ; GP64: nor $2, $6, $4 ; GP64: nor $3, $7, $5 - ; MM32: lw $[[T0:[0-9]+]], 20($sp) - ; MM32: lw $[[T1:[0-9]+]], 16($sp) - ; MM32: nor $2, $[[T1]], $4 - ; MM32: nor $3, $[[T0]], $5 - ; MM32: lw $[[T2:[0-9]+]], 24($sp) - ; MM32: nor $4, $[[T2]], $6 + ; MM32: lw $[[T0:[0-9]+]], 24($sp) + ; MM32: lw $[[T1:[0-9]+]], 20($sp) + ; MM32: lw $[[T2:[0-9]+]], 16($sp) + ; MM32: nor $2, $[[T2]], $4 + ; MM32: nor $3, $[[T1]], $5 + ; MM32: nor $4, $[[T0]], $6 ; MM32: lw $[[T3:[0-9]+]], 28($sp) ; MM32: nor $5, $[[T3]], $7 Index: test/CodeGen/Mips/llvm-ir/or.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/or.ll +++ test/CodeGen/Mips/llvm-ir/or.ll @@ -119,13 +119,13 @@ ; GP64: or $2, $4, $6 ; GP64: or $3, $5, $7 - ; MM32: lw $[[T0:[0-9]+]], 20($sp) - ; MM32: lw $[[T1:[0-9]+]], 16($sp) - ; MM32: or16 $[[T1]], $4 - ; MM32: or16 $[[T0]], $5 + ; MM32: lw $[[T0:[0-9]+]], 32($sp) + ; MM32: lw $[[T1:[0-9]+]], 28($sp) ; MM32: lw $[[T2:[0-9]+]], 24($sp) - ; MM32: or16 $[[T2]], $6 - ; MM32: lw $[[T3:[0-9]+]], 28($sp) + ; MM32: or16 $[[T2]], $4 + ; MM32: or16 $[[T1]], $5 + ; MM32: or16 $[[T0]], $6 + ; MM32: lw $[[T3:[0-9]+]], 36($sp) ; MM32: or16 $[[T3]], $7 ; MM64: or $2, $4, $6 Index: test/CodeGen/Mips/llvm-ir/sdiv.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/sdiv.ll +++ test/CodeGen/Mips/llvm-ir/sdiv.ll @@ -188,7 +188,7 @@ ; GP64-NOT-R6: ld $25, %call16(__divti3)($gp) ; 64R6: ld $25, %call16(__divti3)($gp) - ; MM32: lw $25, %call16(__divti3)($2) + ; MM32: lw $25, %call16(__divti3)($16) ; MM64: ld $25, %call16(__divti3)($2) Index: test/CodeGen/Mips/llvm-ir/select-int.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/select-int.ll +++ test/CodeGen/Mips/llvm-ir/select-int.ll @@ -198,13 +198,13 @@ ; MM32R3: movn $3, $7, $[[T0]] ; MM32R6: andi16 $[[T0:[0-9]+]], $4, 1 - ; MM32R6: lw $[[T1:[0-9]+]], 16($sp) - ; MM32R6: seleqz $[[T2:[0-9]+]], $[[T1]], $[[T0]] - ; MM32R6: selnez $[[T3:[0-9]+]], $6, $[[T0]] - ; MM32R6: or $2, $[[T3]], $[[T2]] + ; MM32R6: selnez $[[T1:[0-9]+]], $6, $[[T0]] + ; MM32R6: lw $[[T2:[0-9]+]], 16($sp) + ; MM32R6: seleqz $[[T3:[0-9]+]], $[[T2]], $[[T0]] + ; MM32R6: or $2, $[[T1]], $[[T3]] + ; MM32R6: selnez $[[T6:[0-9]+]], $7, $[[T0]] ; MM32R6: lw $[[T4:[0-9]+]], 20($sp) ; MM32R6: seleqz $[[T5:[0-9]+]], $[[T4]], $[[T0]] - ; MM32R6: selnez $[[T6:[0-9]+]], $7, $[[T0]] ; MM32R6: or $3, $[[T6]], $[[T5]] %r = select i1 %s, i64 %x, i64 %y Index: test/CodeGen/Mips/llvm-ir/shl.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/shl.ll +++ test/CodeGen/Mips/llvm-ir/shl.ll @@ -139,9 +139,9 @@ ; GP64: dsllv $2, $4, $5 ; MMR3: sllv $[[T0:[0-9]+]], $4, $7 - ; MMR3: srl16 $[[T1:[0-9]+]], $5, 1 - ; MMR3: not16 $[[T2:[0-9]+]], $7 - ; MMR3: srlv $[[T3:[0-9]+]], $[[T1]], $[[T2]] + ; MMR3: not16 $[[T1:[0-9]+]], $7 + ; MMR3: srl16 $[[T2:[0-9]+]], $5, 1 + ; MMR3: srlv $[[T3:[0-9]+]], $[[T2]], $[[T1]] ; MMR3: or16 $[[T4:[0-9]+]], $[[T0]] ; MMR3: sllv $[[T5:[0-9]+]], $5, $7 ; MMR3: andi16 $[[T6:[0-9]+]], $7, 32 @@ -150,9 +150,9 @@ ; MMR3: movn $3, $[[T8]], $[[T6]] ; MMR6: sllv $[[T0:[0-9]+]], $4, $7 - ; MMR6: srl16 $[[T1:[0-9]+]], $5, 1 - ; MMR6: not16 $[[T2:[0-9]+]], $7 - ; MMR6: srlv $[[T3:[0-9]+]], $[[T1]], $[[T2]] + ; MMR6: not16 $[[T1:[0-9]+]], $7 + ; MMR6: srl16 $[[T2:[0-9]+]], $5, 1 + ; MMR6: srlv $[[T3:[0-9]+]], $[[T2]], $[[T1]] ; MMR6: or16 $[[T4:[0-9]+]], $[[T0]] ; MMR6: andi16 $[[T5:[0-9]+]], $7, 32 ; MMR6: seleqz $[[T6:[0-9]+]], $[[T4]], $[[T5]] Index: test/CodeGen/Mips/llvm-ir/srem.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/srem.ll +++ test/CodeGen/Mips/llvm-ir/srem.ll @@ -180,7 +180,7 @@ ; GP64-NOT-R6: ld $25, %call16(__modti3)($gp) ; 64R6: ld $25, %call16(__modti3)($gp) - ; MM32: lw $25, %call16(__modti3)($2) + ; MM32: lw $25, %call16(__modti3)($16) ; MM64: ld $25, %call16(__modti3)($2) Index: test/CodeGen/Mips/llvm-ir/sub.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/sub.ll +++ test/CodeGen/Mips/llvm-ir/sub.ll @@ -134,16 +134,16 @@ ; GP32-MM: sltu $[[T1:[0-9]+]], $[[T2:[0-9]+]], $[[T0]] ; GP32-MM: lw $[[T3:[0-9]+]], 16($sp) ; GP32-MM: addu $[[T3]], $[[T1]], $[[T3]] + ; GP32-MM: lw $[[T5:[0-9]+]], 24($sp) ; GP32-MM: lw $[[T4:[0-9]+]], 28($sp) ; GP32-MM: subu $[[T1]], $7, $[[T4]] - ; GP32-MM: subu $[[T3]], $[[T5:[0-9]+]], $[[T3]] - ; GP32-MM: lw $[[T5]], 24($sp) + ; GP32-MM: subu $[[T3]], $4, $[[T3]] ; GP32-MM: sltu $[[T6:[0-9]+]], $6, $[[T5]] ; GP32-MM: addu $[[T0]], $[[T6]], $[[T0]] ; GP32-MM: subu $[[T0]], $5, $[[T0]] - ; GP32-MM: sltu $[[T2]], $7, $[[T4]] - ; GP32-MM: addu $[[T5]], $[[T2]], $[[T5]] - ; GP32-MM: subu $[[T5]], $6, $[[T5]] + ; GP32-MM: sltu $[[T7:[0-9]+]], $7, $[[T4]] + ; GP32-MM: addu $[[T8:[0-8]+]], $[[T7]], $[[T5]] + ; GP32-MM: subu $[[T9:[0-9]+]], $6, $[[T8]] ; GP32-MM: move $[[T2]], $[[T1]] ; GP64: dsubu $3, $5, $7 Index: test/CodeGen/Mips/llvm-ir/udiv.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/udiv.ll +++ test/CodeGen/Mips/llvm-ir/udiv.ll @@ -152,7 +152,7 @@ ; GP64-NOT-R6: ld $25, %call16(__udivti3)($gp) ; 64-R6: ld $25, %call16(__udivti3)($gp) - ; MM32: lw $25, %call16(__udivti3)($2) + ; MM32: lw $25, %call16(__udivti3)($16) ; MM64: ld $25, %call16(__udivti3)($2) Index: test/CodeGen/Mips/llvm-ir/urem.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/urem.ll +++ test/CodeGen/Mips/llvm-ir/urem.ll @@ -208,7 +208,7 @@ ; GP64-NOT-R6: ld $25, %call16(__umodti3)($gp) ; 64R6: ld $25, %call16(__umodti3)($gp) - ; MM32: lw $25, %call16(__umodti3)($2) + ; MM32: lw $25, %call16(__umodti3)($16) ; MM64: ld $25, %call16(__umodti3)($2) Index: test/CodeGen/Mips/llvm-ir/xor.ll =================================================================== --- test/CodeGen/Mips/llvm-ir/xor.ll +++ test/CodeGen/Mips/llvm-ir/xor.ll @@ -129,13 +129,13 @@ ; GP64: xor $2, $4, $6 ; GP64: xor $3, $5, $7 - ; MM32: lw $[[T0:[0-9]+]], 20($sp) - ; MM32: lw $[[T1:[0-9]+]], 16($sp) - ; MM32: xor16 $[[T1]], $4 - ; MM32: xor16 $[[T0]], $5 + ; MM32: lw $[[T0:[0-9]+]], 32($sp) + ; MM32: lw $[[T1:[0-9]+]], 28($sp) ; MM32: lw $[[T2:[0-9]+]], 24($sp) - ; MM32: xor16 $[[T2]], $6 - ; MM32: lw $[[T3:[0-9]+]], 28($sp) + ; MM32: xor16 $[[T2]], $4 + ; MM32: xor16 $[[T1]], $5 + ; MM32: xor16 $[[T0]], $6 + ; MM32: lw $[[T3:[0-9]+]], 36($sp) ; MM32: xor16 $[[T3]], $7 ; MM64: xor $2, $4, $6