mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
[mips][microMIPSr6] Implement SELEQZ and SELNEZ instructions
This patch implements SELEQZ and SELNEZ instructions using mapping. Differential Revision: http://reviews.llvm.org/D8497 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -94,3 +94,18 @@ class PCREL16_FM_MMR6<bits<5> funct> : MipsR6Inst {
|
|||||||
let Inst{20-16} = funct;
|
let Inst{20-16} = funct;
|
||||||
let Inst{15-0} = imm;
|
let Inst{15-0} = imm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class POOL32A_FM_MMR6<bits<10> funct> : MipsR6Inst {
|
||||||
|
bits<5> rd;
|
||||||
|
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-11} = rd;
|
||||||
|
let Inst{10} = 0;
|
||||||
|
let Inst{9-0} = funct;
|
||||||
|
}
|
||||||
|
@@ -34,6 +34,8 @@ class MUH_MMR6_ENC : ARITH_FM_MMR6<"muh", 0x58>;
|
|||||||
class MULU_MMR6_ENC : ARITH_FM_MMR6<"mulu", 0x98>;
|
class MULU_MMR6_ENC : ARITH_FM_MMR6<"mulu", 0x98>;
|
||||||
class MUHU_MMR6_ENC : ARITH_FM_MMR6<"muhu", 0xd8>;
|
class MUHU_MMR6_ENC : ARITH_FM_MMR6<"muhu", 0xd8>;
|
||||||
class PREF_MMR6_ENC : CACHE_PREF_FM_MMR6<0b011000, 0b0010>;
|
class PREF_MMR6_ENC : CACHE_PREF_FM_MMR6<0b011000, 0b0010>;
|
||||||
|
class SELEQZ_MMR6_ENC : POOL32A_FM_MMR6<0b0101000000>;
|
||||||
|
class SELNEZ_MMR6_ENC : POOL32A_FM_MMR6<0b0110000000>;
|
||||||
class SUB_MMR6_ENC : ARITH_FM_MMR6<"sub", 0x190>;
|
class SUB_MMR6_ENC : ARITH_FM_MMR6<"sub", 0x190>;
|
||||||
class SUBU_MMR6_ENC : ARITH_FM_MMR6<"subu", 0x1d0>;
|
class SUBU_MMR6_ENC : ARITH_FM_MMR6<"subu", 0x1d0>;
|
||||||
|
|
||||||
@@ -133,6 +135,17 @@ class PCREL_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
|
|||||||
class ADDIUPC_MMR6_DESC : PCREL_MMR6_DESC_BASE<"addiupc", GPR32Opnd, simm19_lsl2>;
|
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 LWPC_MMR6_DESC: PCREL_MMR6_DESC_BASE<"lwpc", GPR32Opnd, simm19_lsl2>;
|
||||||
|
|
||||||
|
class SELEQNE_Z_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd>
|
||||||
|
: MMR6Arch<instr_asm> {
|
||||||
|
dag OutOperandList = (outs GPROpnd:$rd);
|
||||||
|
dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
|
||||||
|
string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
|
||||||
|
list<dag> Pattern = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SELEQZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"seleqz", GPR32Opnd>;
|
||||||
|
class SELNEZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"selnez", GPR32Opnd>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// Instruction Definitions
|
// Instruction Definitions
|
||||||
@@ -161,6 +174,10 @@ def MUH_MMR6 : R6MMR6Rel, MUH_MMR6_DESC, MUH_MMR6_ENC, ISA_MICROMIPS32R6;
|
|||||||
def MULU_MMR6 : R6MMR6Rel, MULU_MMR6_DESC, MULU_MMR6_ENC, ISA_MICROMIPS32R6;
|
def MULU_MMR6 : R6MMR6Rel, MULU_MMR6_DESC, MULU_MMR6_ENC, ISA_MICROMIPS32R6;
|
||||||
def MUHU_MMR6 : R6MMR6Rel, MUHU_MMR6_DESC, MUHU_MMR6_ENC, ISA_MICROMIPS32R6;
|
def MUHU_MMR6 : R6MMR6Rel, MUHU_MMR6_DESC, MUHU_MMR6_ENC, ISA_MICROMIPS32R6;
|
||||||
def PREF_MMR6 : R6MMR6Rel, PREF_MMR6_ENC, PREF_MMR6_DESC, ISA_MICROMIPS32R6;
|
def PREF_MMR6 : R6MMR6Rel, PREF_MMR6_ENC, PREF_MMR6_DESC, ISA_MICROMIPS32R6;
|
||||||
|
def SELEQZ_MMR6 : R6MMR6Rel, SELEQZ_MMR6_ENC, SELEQZ_MMR6_DESC,
|
||||||
|
ISA_MICROMIPS32R6;
|
||||||
|
def SELNEZ_MMR6 : R6MMR6Rel, SELNEZ_MMR6_ENC, SELNEZ_MMR6_DESC,
|
||||||
|
ISA_MICROMIPS32R6;
|
||||||
def SUB_MMR6 : StdMMR6Rel, SUB_MMR6_DESC, SUB_MMR6_ENC, ISA_MICROMIPS32R6;
|
def SUB_MMR6 : StdMMR6Rel, SUB_MMR6_DESC, SUB_MMR6_ENC, ISA_MICROMIPS32R6;
|
||||||
def SUBU_MMR6 : StdMMR6Rel, SUBU_MMR6_DESC, SUBU_MMR6_ENC, ISA_MICROMIPS32R6;
|
def SUBU_MMR6 : StdMMR6Rel, SUBU_MMR6_DESC, SUBU_MMR6_ENC, ISA_MICROMIPS32R6;
|
||||||
}
|
}
|
||||||
|
@@ -483,7 +483,8 @@ class SEL_D_DESC : COP1_SEL_DESC_BASE<"sel.d", FGR64Opnd> {
|
|||||||
}
|
}
|
||||||
class SEL_S_DESC : COP1_SEL_DESC_BASE<"sel.s", FGR32Opnd>;
|
class SEL_S_DESC : COP1_SEL_DESC_BASE<"sel.s", FGR32Opnd>;
|
||||||
|
|
||||||
class SELEQNE_Z_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
|
class SELEQNE_Z_DESC_BASE<string instr_asm, RegisterOperand GPROpnd>
|
||||||
|
: MipsR6Arch<instr_asm> {
|
||||||
dag OutOperandList = (outs GPROpnd:$rd);
|
dag OutOperandList = (outs GPROpnd:$rd);
|
||||||
dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
|
dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
|
||||||
string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
|
string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
|
||||||
@@ -722,10 +723,10 @@ def RINT_S : RINT_S_ENC, RINT_S_DESC, ISA_MIPS32R6, HARDFLOAT;
|
|||||||
def SC_R6 : SC_R6_ENC, SC_R6_DESC, ISA_MIPS32R6;
|
def SC_R6 : SC_R6_ENC, SC_R6_DESC, ISA_MIPS32R6;
|
||||||
def SDBBP_R6 : SDBBP_R6_ENC, SDBBP_R6_DESC, ISA_MIPS32R6;
|
def SDBBP_R6 : SDBBP_R6_ENC, SDBBP_R6_DESC, ISA_MIPS32R6;
|
||||||
def SDC2_R6 : SDC2_R6_ENC, SDC2_R6_DESC, ISA_MIPS32R6;
|
def SDC2_R6 : SDC2_R6_ENC, SDC2_R6_DESC, ISA_MIPS32R6;
|
||||||
def SELEQZ : SELEQZ_ENC, SELEQZ_DESC, ISA_MIPS32R6, GPR_32;
|
def SELEQZ : R6MMR6Rel, SELEQZ_ENC, SELEQZ_DESC, ISA_MIPS32R6, GPR_32;
|
||||||
def SELEQZ_D : SELEQZ_D_ENC, SELEQZ_D_DESC, ISA_MIPS32R6, HARDFLOAT;
|
def SELEQZ_D : SELEQZ_D_ENC, SELEQZ_D_DESC, ISA_MIPS32R6, HARDFLOAT;
|
||||||
def SELEQZ_S : SELEQZ_S_ENC, SELEQZ_S_DESC, ISA_MIPS32R6, HARDFLOAT;
|
def SELEQZ_S : SELEQZ_S_ENC, SELEQZ_S_DESC, ISA_MIPS32R6, HARDFLOAT;
|
||||||
def SELNEZ : SELNEZ_ENC, SELNEZ_DESC, ISA_MIPS32R6, GPR_32;
|
def SELNEZ : R6MMR6Rel, SELNEZ_ENC, SELNEZ_DESC, ISA_MIPS32R6, GPR_32;
|
||||||
def SELNEZ_D : SELNEZ_D_ENC, SELNEZ_D_DESC, ISA_MIPS32R6, HARDFLOAT;
|
def SELNEZ_D : SELNEZ_D_ENC, SELNEZ_D_DESC, ISA_MIPS32R6, HARDFLOAT;
|
||||||
def SELNEZ_S : SELNEZ_S_ENC, SELNEZ_S_DESC, ISA_MIPS32R6, HARDFLOAT;
|
def SELNEZ_S : SELNEZ_S_ENC, SELNEZ_S_DESC, ISA_MIPS32R6, HARDFLOAT;
|
||||||
def SEL_D : SEL_D_ENC, SEL_D_DESC, ISA_MIPS32R6, HARDFLOAT;
|
def SEL_D : SEL_D_ENC, SEL_D_DESC, ISA_MIPS32R6, HARDFLOAT;
|
||||||
|
@@ -41,6 +41,10 @@
|
|||||||
# CHECK: pref 1, 8($5)
|
# CHECK: pref 1, 8($5)
|
||||||
0x60 0x25 0x20 0x08
|
0x60 0x25 0x20 0x08
|
||||||
|
|
||||||
|
0x00 0x83 0x11 0x40 # CHECK: seleqz $2, $3, $4
|
||||||
|
|
||||||
|
0x00 0x83 0x11 0x80 # CHECK: selnez $2, $3, $4
|
||||||
|
|
||||||
0x00 0xa4 0x19 0x90 # CHECK: sub $3, $4, $5
|
0x00 0xa4 0x19 0x90 # CHECK: sub $3, $4, $5
|
||||||
|
|
||||||
0x00 0xa4 0x19 0xd0 # CHECK: subu $3, $4, $5
|
0x00 0xa4 0x19 0xd0 # CHECK: subu $3, $4, $5
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
mulu $3, $4, $5 # CHECK mulu $3, $4, $5 # encoding: [0x00,0xa4,0x18,0x98]
|
mulu $3, $4, $5 # CHECK mulu $3, $4, $5 # encoding: [0x00,0xa4,0x18,0x98]
|
||||||
muhu $3, $4, $5 # CHECK muhu $3, $4, $5 # encoding: [0x00,0xa4,0x18,0xd8]
|
muhu $3, $4, $5 # CHECK muhu $3, $4, $5 # encoding: [0x00,0xa4,0x18,0xd8]
|
||||||
pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0x60,0x25,0x20,0x08]
|
pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0x60,0x25,0x20,0x08]
|
||||||
|
seleqz $2,$3,$4 # CHECK: seleqz $2, $3, $4 # encoding: [0x00,0x83,0x11,0x40]
|
||||||
|
selnez $2,$3,$4 # CHECK: selnez $2, $3, $4 # encoding: [0x00,0x83,0x11,0x80]
|
||||||
sub $3, $4, $5 # CHECK: sub $3, $4, $5 # encoding: [0x00,0xa4,0x19,0x90]
|
sub $3, $4, $5 # CHECK: sub $3, $4, $5 # encoding: [0x00,0xa4,0x19,0x90]
|
||||||
subu $3, $4, $5 # CHECK: subu $3, $4, $5 # encoding: [0x00,0xa4,0x19,0xd0]
|
subu $3, $4, $5 # CHECK: subu $3, $4, $5 # encoding: [0x00,0xa4,0x19,0xd0]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user