Index: llvm/trunk/lib/Target/Mips/MicroMips32r6InstrInfo.td =================================================================== --- llvm/trunk/lib/Target/Mips/MicroMips32r6InstrInfo.td +++ llvm/trunk/lib/Target/Mips/MicroMips32r6InstrInfo.td @@ -1692,6 +1692,14 @@ def : MipsInstAlias<"negu $rt", (SUBU_MMR6 GPR32Opnd:$rt, ZERO, GPR32Opnd:$rt), 1>, ISA_MICROMIPS32R6; +def : MipsInstAlias<"beqz16 $rs, $offset", (BEQZC16_MMR6 GPRMM16Opnd:$rs, + brtarget7_mm:$offset), + 0>, ISA_MICROMIPS32R6; +def : MipsInstAlias<"bnez16 $rs, $offset", (BNEZC16_MMR6 GPRMM16Opnd:$rs, + brtarget7_mm:$offset), + 0>, ISA_MICROMIPS32R6; +def : MipsInstAlias<"b16 $offset", (BC16_MMR6 brtarget10_mm:$offset), 0>, + ISA_MICROMIPS32R6; //===----------------------------------------------------------------------===// // Index: llvm/trunk/lib/Target/Mips/MicroMipsInstrInfo.td =================================================================== --- llvm/trunk/lib/Target/Mips/MicroMipsInstrInfo.td +++ llvm/trunk/lib/Target/Mips/MicroMipsInstrInfo.td @@ -636,48 +636,58 @@ LOGIC_FM_MM16<0x1>, ISA_MICROMIPS32_NOT_MIPS32R6; } def LBU16_MM : LoadMM16<"lbu16", GPRMM16Opnd, zextloadi8, II_LBU, - mem_mm_4>, LOAD_STORE_FM_MM16<0x02>; + mem_mm_4>, LOAD_STORE_FM_MM16<0x02>, ISA_MICROMIPS; def LHU16_MM : LoadMM16<"lhu16", GPRMM16Opnd, zextloadi16, II_LHU, - mem_mm_4_lsl1>, LOAD_STORE_FM_MM16<0x0a>; + mem_mm_4_lsl1>, LOAD_STORE_FM_MM16<0x0a>, ISA_MICROMIPS; def LW16_MM : LoadMM16<"lw16", GPRMM16Opnd, load, II_LW, mem_mm_4_lsl2>, - LOAD_STORE_FM_MM16<0x1a>; + LOAD_STORE_FM_MM16<0x1a>, ISA_MICROMIPS; def SB16_MM : StoreMM16<"sb16", GPRMM16OpndZero, GPRMM16Opnd, truncstorei8, - II_SB, mem_mm_4>, LOAD_STORE_FM_MM16<0x22>; + II_SB, mem_mm_4>, LOAD_STORE_FM_MM16<0x22>, + ISA_MICROMIPS32_NOT_MIPS32R6; def SH16_MM : StoreMM16<"sh16", GPRMM16OpndZero, GPRMM16Opnd, truncstorei16, II_SH, mem_mm_4_lsl1>, - LOAD_STORE_FM_MM16<0x2a>; + LOAD_STORE_FM_MM16<0x2a>, ISA_MICROMIPS32_NOT_MIPS32R6; def SW16_MM : StoreMM16<"sw16", GPRMM16OpndZero, GPRMM16Opnd, store, II_SW, - mem_mm_4_lsl2>, LOAD_STORE_FM_MM16<0x3a>; + mem_mm_4_lsl2>, LOAD_STORE_FM_MM16<0x3a>, + ISA_MICROMIPS32_NOT_MIPS32R6; def LWGP_MM : LoadGPMM16<"lw", GPRMM16Opnd, II_LW, mem_mm_gp_simm7_lsl2>, - LOAD_GP_FM_MM16<0x19>; + LOAD_GP_FM_MM16<0x19>, ISA_MICROMIPS; def LWSP_MM : LoadSPMM16<"lw", GPR32Opnd, II_LW, mem_mm_sp_imm5_lsl2>, - LOAD_STORE_SP_FM_MM16<0x12>; + LOAD_STORE_SP_FM_MM16<0x12>, ISA_MICROMIPS; def SWSP_MM : StoreSPMM16<"sw", GPR32Opnd, II_SW, mem_mm_sp_imm5_lsl2>, - LOAD_STORE_SP_FM_MM16<0x32>; -def ADDIUR1SP_MM : AddImmUR1SP<"addiur1sp", GPRMM16Opnd>, ADDIUR1SP_FM_MM16; -def ADDIUR2_MM : AddImmUR2<"addiur2", GPRMM16Opnd>, ADDIUR2_FM_MM16; -def ADDIUS5_MM : AddImmUS5<"addius5", GPR32Opnd>, ADDIUS5_FM_MM16; -def ADDIUSP_MM : AddImmUSP<"addiusp">, ADDIUSP_FM_MM16; + LOAD_STORE_SP_FM_MM16<0x32>, ISA_MICROMIPS32_NOT_MIPS32R6; +def ADDIUR1SP_MM : AddImmUR1SP<"addiur1sp", GPRMM16Opnd>, ADDIUR1SP_FM_MM16, + ISA_MICROMIPS; +def ADDIUR2_MM : AddImmUR2<"addiur2", GPRMM16Opnd>, ADDIUR2_FM_MM16, + ISA_MICROMIPS; +def ADDIUS5_MM : AddImmUS5<"addius5", GPR32Opnd>, ADDIUS5_FM_MM16, + ISA_MICROMIPS; +def ADDIUSP_MM : AddImmUSP<"addiusp">, ADDIUSP_FM_MM16, ISA_MICROMIPS; def MFHI16_MM : MoveFromHILOMM<"mfhi16", GPR32Opnd, AC0>, MFHILO_FM_MM16<0x10>, ISA_MICROMIPS32_NOT_MIPS32R6; def MFLO16_MM : MoveFromHILOMM<"mflo16", GPR32Opnd, AC0>, MFHILO_FM_MM16<0x12>, ISA_MICROMIPS32_NOT_MIPS32R6; -def MOVE16_MM : MoveMM16<"move", GPR32Opnd>, MOVE_FM_MM16<0x03>; +def MOVE16_MM : MoveMM16<"move", GPR32Opnd>, MOVE_FM_MM16<0x03>, + ISA_MICROMIPS32_NOT_MIPS32R6; def MOVEP_MM : MovePMM16<"movep", GPRMM16OpndMoveP>, MOVEP_FM_MM16, ISA_MICROMIPS32_NOT_MIPS32R6; def LI16_MM : LoadImmMM16<"li16", li16_imm, GPRMM16Opnd>, LI_FM_MM16, - IsAsCheapAsAMove; + IsAsCheapAsAMove, ISA_MICROMIPS32_NOT_MIPS32R6; def JALR16_MM : JumpLinkRegMM16<"jalr", GPR32Opnd>, JALR_FM_MM16<0x0e>, ISA_MICROMIPS32_NOT_MIPS32R6; -def JALRS16_MM : JumpLinkRegSMM16<"jalrs16", GPR32Opnd>, JALR_FM_MM16<0x0f>; -def JRC16_MM : JumpRegCMM16<"jrc", GPR32Opnd>, JALR_FM_MM16<0x0d>; -def JRADDIUSP : JumpRAddiuStackMM16, JRADDIUSP_FM_MM16<0x18>; -def JR16_MM : JumpRegMM16<"jr16", GPR32Opnd>, JALR_FM_MM16<0x0c>; +def JALRS16_MM : JumpLinkRegSMM16<"jalrs16", GPR32Opnd>, JALR_FM_MM16<0x0f>, + ISA_MICROMIPS32_NOT_MIPS32R6; +def JRC16_MM : JumpRegCMM16<"jrc", GPR32Opnd>, JALR_FM_MM16<0x0d>, + ISA_MICROMIPS32_NOT_MIPS32R6; +def JRADDIUSP : JumpRAddiuStackMM16, JRADDIUSP_FM_MM16<0x18>, + ISA_MICROMIPS32_NOT_MIPS32R6; +def JR16_MM : JumpRegMM16<"jr16", GPR32Opnd>, JALR_FM_MM16<0x0c>, + ISA_MICROMIPS32_NOT_MIPS32R6; def BEQZ16_MM : CBranchZeroMM<"beqz16", brtarget7_mm, GPRMM16Opnd>, - BEQNEZ_FM_MM16<0x23>; + BEQNEZ_FM_MM16<0x23>, ISA_MICROMIPS32_NOT_MIPS32R6; def BNEZ16_MM : CBranchZeroMM<"bnez16", brtarget7_mm, GPRMM16Opnd>, - BEQNEZ_FM_MM16<0x2b>; -def B16_MM : UncondBranchMM16<"b16">, B16_FM; + BEQNEZ_FM_MM16<0x2b>, ISA_MICROMIPS32_NOT_MIPS32R6; +def B16_MM : UncondBranchMM16<"b16">, B16_FM, ISA_MICROMIPS32_NOT_MIPS32R6; def BREAK16_MM : BrkSdbbp16MM<"break16", II_BREAK>, BRKSDBBP16_FM_MM<0x28>, ISA_MICROMIPS32_NOT_MIPS32R6; def SDBBP16_MM : BrkSdbbp16MM<"sdbbp16", II_SDBBP>, BRKSDBBP16_FM_MM<0x2C>, Index: llvm/trunk/test/MC/Mips/micromips-neg-offset.s =================================================================== --- llvm/trunk/test/MC/Mips/micromips-neg-offset.s +++ llvm/trunk/test/MC/Mips/micromips-neg-offset.s @@ -5,8 +5,8 @@ # RUN: | llvm-objdump -d -mattr=micromips - | FileCheck %s # CHECK: 0: 8f 7e beqzc16 $6, -4 -# CHECK: 6: cf fe bc16 -4 -# CHECK: c: b7 ff ff fe balc -4 +# CHECK: 2: cf fe bc16 -4 +# CHECK: 4: b7 ff ff fe balc -4 beqz16 $6, -4 b16 -4 Index: llvm/trunk/test/MC/Mips/micromips/valid.s =================================================================== --- llvm/trunk/test/MC/Mips/micromips/valid.s +++ llvm/trunk/test/MC/Mips/micromips/valid.s @@ -2,53 +2,99 @@ .set noat addiusp -16 # CHECK: addiusp -16 # encoding: [0x4f,0xf9] + # CHECK: #