Index: lib/Target/Mips/MicroMipsR6InstrFormats.td =================================================================== --- lib/Target/Mips/MicroMipsR6InstrFormats.td +++ lib/Target/Mips/MicroMipsR6InstrFormats.td @@ -40,6 +40,33 @@ let Inst{15-0} = imm; } +class POOL32A_2R_FM_MMR6 funct> : MipsR6Inst { + bits<5> rs; + bits<5> rt; + + bits<32> Inst; + + let Inst{31-26} = 0b000000; + let Inst{25-21} = rt; + let Inst{20-16} = rs; + let Inst{15-6} = funct; + let Inst{5-0} = 0b111100; +} + +class SPECIAL_2R_FM_MMR6 funct> : MipsR6Inst { + bits<5> rs; + bits<5> rt; + + bits<32> Inst; + + let Inst{31-26} = 0b000000; + let Inst{25-21} = rs; + let Inst{20-16} = 0b00000; + let Inst{15-11} = rt; + let Inst{10-6} = 0b00001; + let Inst{5-0} = funct; +} + class POOL32A_FM_MMR6 funct> : MipsR6Inst { bits<5> rd; bits<5> rs; Index: lib/Target/Mips/MicroMipsR6InstrInfo.td =================================================================== --- lib/Target/Mips/MicroMipsR6InstrInfo.td +++ lib/Target/Mips/MicroMipsR6InstrInfo.td @@ -22,6 +22,8 @@ class ADDIUPC_MMR6_ENC : PCREL19_FM_MMR6<0b00>; class BALC_MMR6_ENC : BRANCH_OFF26_FM<0b101101>; class BC_MMR6_ENC : BRANCH_OFF26_FM<0b100101>; +class CLO_MMR6_ENC : POOL32A_2R_FM_MMR6<0b0100101100>; +class CLZ_MMR6_ENC : SPECIAL_2R_FM_MMR6<0b010000>; class JIALC_MMR6_ENC : JMP_IDX_COMPACT_FM<0b101001>; class JIC_MMR6_ENC : JMP_IDX_COMPACT_FM<0b101000>; class LWPC_MMR6_ENC : PCREL19_FM_MMR6<0b01>; @@ -70,6 +72,16 @@ } class BC_MMR6_DESC : BC_MMR6_DESC_BASE<"bc", brtarget26>; +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"); +} + +class CLO_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clo", GPR32Opnd>; +class CLZ_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clz", GPR32Opnd>; + class JMP_MMR6_IDX_COMPACT_DESC_BASE : MMR6Arch { @@ -115,6 +127,8 @@ def ADDIUPC_MMR6 : MMR6Rel, ADDIUPC_MMR6_ENC, ADDIUPC_MMR6_DESC, ISA_MICROMIPSR6; def BALC_MMR6 : MMR6Rel, BALC_MMR6_ENC, BALC_MMR6_DESC, ISA_MICROMIPSR6; def BC_MMR6 : MMR6Rel, BC_MMR6_ENC, BC_MMR6_DESC, ISA_MICROMIPSR6; +def CLO_MMR6 : MMR6Rel, CLO_MMR6_ENC, CLO_MMR6_DESC, ISA_MICROMIPSR6; +def CLZ_MMR6 : MMR6Rel, CLZ_MMR6_ENC, CLZ_MMR6_DESC, ISA_MICROMIPSR6; def JIALC_MMR6 : MMR6Rel, JIALC_MMR6_ENC, JIALC_MMR6_DESC, ISA_MICROMIPSR6; def JIC_MMR6 : MMR6Rel, JIC_MMR6_ENC, JIC_MMR6_DESC, ISA_MICROMIPSR6; def LWPC_MMR6 : MMR6Rel, LWPC_MMR6_ENC, LWPC_MMR6_DESC, ISA_MICROMIPSR6; Index: lib/Target/Mips/Mips32r6InstrInfo.td =================================================================== --- lib/Target/Mips/Mips32r6InstrInfo.td +++ lib/Target/Mips/Mips32r6InstrInfo.td @@ -613,7 +613,8 @@ class SC_R6_DESC : SC_R6_DESC_BASE<"sc", GPR32Opnd>; -class CLO_CLZ_R6_DESC_BASE { +class CLO_CLZ_R6_DESC_BASE + : Mips32r6Arch { dag OutOperandList = (outs GPROpnd:$rd); dag InOperandList = (ins GPROpnd:$rs); string AsmString = !strconcat(instr_asm, "\t$rd, $rs"); @@ -681,8 +682,8 @@ def CACHE_R6 : CACHE_ENC, CACHE_DESC, ISA_MIPS32R6; def CLASS_D : CLASS_D_ENC, CLASS_D_DESC, ISA_MIPS32R6; def CLASS_S : CLASS_S_ENC, CLASS_S_DESC, ISA_MIPS32R6; -def CLO_R6 : CLO_R6_ENC, CLO_R6_DESC, ISA_MIPS32R6; -def CLZ_R6 : CLZ_R6_ENC, CLZ_R6_DESC, ISA_MIPS32R6; +def CLO_R6 : MMR6Rel, CLO_R6_ENC, CLO_R6_DESC, ISA_MIPS32R6; +def CLZ_R6 : MMR6Rel, CLZ_R6_ENC, CLZ_R6_DESC, ISA_MIPS32R6; defm S : CMP_CC_M; defm D : CMP_CC_M; def DIV : DIV_ENC, DIV_DESC, ISA_MIPS32R6; Index: test/MC/Disassembler/Mips/micromips32r6.txt =================================================================== --- test/MC/Disassembler/Mips/micromips32r6.txt +++ test/MC/Disassembler/Mips/micromips32r6.txt @@ -15,6 +15,12 @@ # CHECK: bc 14572256 0x94 0x37 0x96 0xb8 +# CHECK: clo $11, $5 +0x01 0x65 0x4b 0x3c + +# CHECK: clz $sp, $gp +0x03 0x80 0xe8 0x50 + # CHECK: jialc $5, 256 0xa4 0x05 0x01 0x00 Index: test/MC/Mips/micromipsr6/valid.s =================================================================== --- test/MC/Mips/micromipsr6/valid.s +++ test/MC/Mips/micromipsr6/valid.s @@ -6,6 +6,8 @@ addiupc $4, 100 # CHECK: addiupc $4, 100 # encoding: [0x78,0x80,0x00,0x19] balc 14572256 # CHECK: balc 14572256 # encoding: [0xb4,0x37,0x96,0xb8] bc 14572256 # CHECK: bc 14572256 # encoding: [0x94,0x37,0x96,0xb8] + clo $11, $a1 # CHECK: clo $11, $5 # encoding: [0x01,0x65,0x4b,0x3c] + clz $sp, $gp # CHECK: clz $sp, $gp # encoding: [0x03,0x80,0xe8,0x50] jialc $5, 256 # CHECK: jialc $5, 256 # encoding: [0xa4,0x05,0x01,0x00] jic $5, 256 # CHECK: jic $5, 256 # encoding: [0xa0,0x05,0x01,0x00] lwpc $2,268 # CHECK: lwpc $2, 268 # encoding: [0x78,0x48,0x00,0x43]