mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
This is a resubmittal. For some reason it broke the bots yesterday
but I cannot reproduce the problem and have scrubed my sources and even tested with llvm-lit -v --vg. Removal of redundant code and formatting fixes. Contributers: Jack Carter/Vladimir Medic llvm-svn: 172842
This commit is contained in:
parent
c3319a35d0
commit
2737a54489
@ -117,8 +117,9 @@ def DSRA32 : shift_rotate_imm<"dsra32", shamt, CPU64RegsOpnd>, SRA_FM<0x3f, 0>;
|
||||
let Predicates = [HasMips64r2, HasStdEnc],
|
||||
DecoderNamespace = "Mips64" in {
|
||||
def DROTR : shift_rotate_imm<"drotr", shamt, CPU64RegsOpnd, rotr, immZExt6>,
|
||||
SRA_FM<0x3a, 1>;
|
||||
def DROTRV : shift_rotate_reg<"drotrv", CPU64RegsOpnd, rotr>, SRLV_FM<0x16, 1>;
|
||||
SRA_FM<0x3a, 1>;
|
||||
def DROTRV : shift_rotate_reg<"drotrv", CPU64RegsOpnd, rotr>,
|
||||
SRLV_FM<0x16, 1>;
|
||||
}
|
||||
|
||||
let DecoderNamespace = "Mips64" in {
|
||||
@ -173,8 +174,10 @@ def TAILCALL64_R : JumpFR<CPU64Regs, MipsTailCall>, MTLO_FM<8>, IsTailCall;
|
||||
|
||||
let DecoderNamespace = "Mips64" in {
|
||||
/// Multiply and Divide Instructions.
|
||||
def DMULT : Mult<"dmult", IIImul, CPU64RegsOpnd, [HI64, LO64]>, MULT_FM<0, 0x1c>;
|
||||
def DMULTu : Mult<"dmultu", IIImul, CPU64RegsOpnd, [HI64, LO64]>, MULT_FM<0, 0x1d>;
|
||||
def DMULT : Mult<"dmult", IIImul, CPU64RegsOpnd, [HI64, LO64]>,
|
||||
MULT_FM<0, 0x1c>;
|
||||
def DMULTu : Mult<"dmultu", IIImul, CPU64RegsOpnd, [HI64, LO64]>,
|
||||
MULT_FM<0, 0x1d>;
|
||||
def DSDIV : Div<MipsDivRem, "ddiv", IIIdiv, CPU64RegsOpnd, [HI64, LO64]>,
|
||||
MULT_FM<0, 0x1e>;
|
||||
def DUDIV : Div<MipsDivRemU, "ddivu", IIIdiv, CPU64RegsOpnd, [HI64, LO64]>,
|
||||
@ -305,20 +308,21 @@ def : MipsPat<(bswap CPU64Regs:$rt), (DSHD (DSBH CPU64Regs:$rt))>;
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Instruction aliases
|
||||
//===----------------------------------------------------------------------===//
|
||||
def : InstAlias<"move $dst,$src", (DADDu CPU64RegsOpnd:$dst,
|
||||
def : InstAlias<"move $dst, $src", (DADDu CPU64RegsOpnd:$dst,
|
||||
CPU64RegsOpnd:$src,ZERO_64)>,
|
||||
Requires<[HasMips64]>;
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"and $rs, $rt, $imm",
|
||||
(DANDi CPU64RegsOpnd:$rs, CPU64RegsOpnd:$rt, uimm16_64:$imm)>,
|
||||
Requires<[HasMips64]>;
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"slt $rs, $rt, $imm",
|
||||
(SLTi64 CPURegsOpnd:$rs, CPU64Regs:$rt, simm16_64:$imm)>,
|
||||
Requires<[HasMips64]>;
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"xor $rs, $rt, $imm",
|
||||
(XORi64 CPU64RegsOpnd:$rs, CPU64RegsOpnd:$rt, uimm16_64:$imm)>,
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"not $rt, $rs", (NOR64 CPU64RegsOpnd:$rt, CPU64RegsOpnd:$rs, ZERO_64)>,
|
||||
Requires<[HasMips64]>;
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"not $rt, $rs",
|
||||
(NOR64 CPU64RegsOpnd:$rt, CPU64RegsOpnd:$rs, ZERO_64)>,
|
||||
Requires<[HasMips64]>;
|
||||
def : InstAlias<"j $rs", (JR64 CPU64Regs:$rs)>, Requires<[HasMips64]>;
|
||||
def : InstAlias<"daddu $rs, $rt, $imm",
|
||||
(DADDiu CPU64RegsOpnd:$rs, CPU64RegsOpnd:$rt, simm16_64:$imm)>;
|
||||
@ -326,35 +330,29 @@ def : InstAlias<"dadd $rs, $rt, $imm",
|
||||
(DADDi CPU64RegsOpnd:$rs, CPU64RegsOpnd:$rt, simm16_64:$imm)>;
|
||||
|
||||
/// Move between CPU and coprocessor registers
|
||||
|
||||
let DecoderNamespace = "Mips64" in {
|
||||
def MFC0_3OP64 : MFC3OP<(outs CPU64Regs:$rt), (ins CPU64Regs:$rd, uimm16:$sel),
|
||||
"mfc0\t$rt, $rd, $sel">, MFC3OP_FM<0x10, 0>;
|
||||
def MTC0_3OP64 : MFC3OP<(outs CPU64Regs:$rd, uimm16:$sel), (ins CPU64Regs:$rt),
|
||||
"mtc0\t$rt, $rd, $sel">, MFC3OP_FM<0x10, 4>;
|
||||
def MFC2_3OP64 : MFC3OP<(outs CPU64Regs:$rt), (ins CPU64Regs:$rd, uimm16:$sel),
|
||||
"mfc2\t$rt, $rd, $sel">, MFC3OP_FM<0x12, 0>;
|
||||
def MTC2_3OP64 : MFC3OP<(outs CPU64Regs:$rd, uimm16:$sel), (ins CPU64Regs:$rt),
|
||||
"mtc2\t$rt, $rd, $sel">, MFC3OP_FM<0x12, 4>;
|
||||
def DMFC0_3OP64 : MFC3OP<(outs CPU64Regs:$rt), (ins CPU64Regs:$rd, uimm16:$sel),
|
||||
def DMFC0_3OP64 : MFC3OP<(outs CPU64RegsOpnd:$rt),
|
||||
(ins CPU64RegsOpnd:$rd, uimm16:$sel),
|
||||
"dmfc0\t$rt, $rd, $sel">, MFC3OP_FM<0x10, 1>;
|
||||
def DMTC0_3OP64 : MFC3OP<(outs CPU64Regs:$rd, uimm16:$sel), (ins CPU64Regs:$rt),
|
||||
def DMTC0_3OP64 : MFC3OP<(outs CPU64RegsOpnd:$rd, uimm16:$sel),
|
||||
(ins CPU64RegsOpnd:$rt),
|
||||
"dmtc0\t$rt, $rd, $sel">, MFC3OP_FM<0x10, 5>;
|
||||
def DMFC2_3OP64 : MFC3OP<(outs CPU64Regs:$rt), (ins CPU64Regs:$rd, uimm16:$sel),
|
||||
def DMFC2_3OP64 : MFC3OP<(outs CPU64RegsOpnd:$rt),
|
||||
(ins CPU64RegsOpnd:$rd, uimm16:$sel),
|
||||
"dmfc2\t$rt, $rd, $sel">, MFC3OP_FM<0x12, 1>;
|
||||
def DMTC2_3OP64 : MFC3OP<(outs CPU64Regs:$rd, uimm16:$sel), (ins CPU64Regs:$rt),
|
||||
def DMTC2_3OP64 : MFC3OP<(outs CPU64RegsOpnd:$rd, uimm16:$sel),
|
||||
(ins CPU64RegsOpnd:$rt),
|
||||
"dmtc2\t$rt, $rd, $sel">, MFC3OP_FM<0x12, 5>;
|
||||
}
|
||||
// Two operand (implicit 0 selector) versions:
|
||||
def : InstAlias<"mfc0 $rt, $rd", (MFC0_3OP64 CPU64Regs:$rt, CPU64Regs:$rd, 0)>;
|
||||
def : InstAlias<"mtc0 $rt, $rd", (MTC0_3OP64 CPU64Regs:$rd, 0, CPU64Regs:$rt)>;
|
||||
def : InstAlias<"mfc2 $rt, $rd", (MFC2_3OP64 CPU64Regs:$rt, CPU64Regs:$rd, 0)>;
|
||||
def : InstAlias<"mtc2 $rt, $rd", (MTC2_3OP64 CPU64Regs:$rd, 0, CPU64Regs:$rt)>;
|
||||
def : InstAlias<"dmfc0 $rt, $rd",
|
||||
(DMFC0_3OP64 CPU64Regs:$rt, CPU64Regs:$rd, 0)>;
|
||||
def : InstAlias<"dmtc0 $rt, $rd",
|
||||
(DMTC0_3OP64 CPU64Regs:$rd, 0, CPU64Regs:$rt)>;
|
||||
def : InstAlias<"dmfc2 $rt, $rd",
|
||||
(DMFC2_3OP64 CPU64Regs:$rt, CPU64Regs:$rd, 0)>;
|
||||
def : InstAlias<"dmtc2 $rt, $rd",
|
||||
(DMTC2_3OP64 CPU64Regs:$rd, 0, CPU64Regs:$rt)>;
|
||||
|
||||
// Two operand (implicit 0 selector) versions:
|
||||
def : InstAlias<"dmfc0 $rt, $rd",
|
||||
(DMFC0_3OP64 CPU64RegsOpnd:$rt, CPU64RegsOpnd:$rd, 0)>;
|
||||
def : InstAlias<"dmtc0 $rt, $rd",
|
||||
(DMTC0_3OP64 CPU64RegsOpnd:$rd, 0, CPU64RegsOpnd:$rt)>;
|
||||
def : InstAlias<"dmfc2 $rt, $rd",
|
||||
(DMFC2_3OP64 CPU64RegsOpnd:$rt, CPU64RegsOpnd:$rd, 0)>;
|
||||
def : InstAlias<"dmtc2 $rt, $rd",
|
||||
(DMTC2_3OP64 CPU64RegsOpnd:$rd, 0, CPU64RegsOpnd:$rt)>;
|
||||
|
||||
|
@ -506,7 +506,8 @@ class SetCC_I<string opstr, PatFrag cond_op, Operand Od, PatLeaf imm_type,
|
||||
RegisterClass RC>:
|
||||
InstSE<(outs CPURegsOpnd:$rt), (ins RC:$rs, Od:$imm16),
|
||||
!strconcat(opstr, "\t$rt, $rs, $imm16"),
|
||||
[(set CPURegsOpnd:$rt, (cond_op RC:$rs, imm_type:$imm16))], IIAlu, FrmI>;
|
||||
[(set CPURegsOpnd:$rt, (cond_op RC:$rs, imm_type:$imm16))],
|
||||
IIAlu, FrmI>;
|
||||
|
||||
// Jump
|
||||
class JumpFJ<DAGOperand opnd, string opstr, SDPatternOperator operator,
|
||||
@ -774,9 +775,12 @@ def ADDiu : ArithLogicI<"addiu", simm16, CPURegsOpnd, immSExt16, add>,
|
||||
def ADDi : ArithLogicI<"addi", simm16, CPURegsOpnd>, ADDI_FM<0x8>;
|
||||
def SLTi : SetCC_I<"slti", setlt, simm16, immSExt16, CPURegs>, SLTI_FM<0xa>;
|
||||
def SLTiu : SetCC_I<"sltiu", setult, simm16, immSExt16, CPURegs>, SLTI_FM<0xb>;
|
||||
def ANDi : ArithLogicI<"andi", uimm16, CPURegsOpnd, immZExt16, and>, ADDI_FM<0xc>;
|
||||
def ORi : ArithLogicI<"ori", uimm16, CPURegsOpnd, immZExt16, or>, ADDI_FM<0xd>;
|
||||
def XORi : ArithLogicI<"xori", uimm16, CPURegsOpnd, immZExt16, xor>, ADDI_FM<0xe>;
|
||||
def ANDi : ArithLogicI<"andi", uimm16, CPURegsOpnd, immZExt16, and>,
|
||||
ADDI_FM<0xc>;
|
||||
def ORi : ArithLogicI<"ori", uimm16, CPURegsOpnd, immZExt16, or>,
|
||||
ADDI_FM<0xd>;
|
||||
def XORi : ArithLogicI<"xori", uimm16, CPURegsOpnd, immZExt16, xor>,
|
||||
ADDI_FM<0xe>;
|
||||
def LUi : LoadUpper<"lui", CPURegs, uimm16>, LUI_FM;
|
||||
|
||||
/// Arithmetic Instructions (3-Operand, R-Type)
|
||||
@ -793,9 +797,12 @@ def XOR : ArithLogicR<"xor", CPURegsOpnd, 1, IIAlu, xor>, ADD_FM<0, 0x26>;
|
||||
def NOR : LogicNOR<"nor", CPURegsOpnd>, ADD_FM<0, 0x27>;
|
||||
|
||||
/// Shift Instructions
|
||||
def SLL : shift_rotate_imm<"sll", shamt, CPURegsOpnd, shl, immZExt5>, SRA_FM<0, 0>;
|
||||
def SRL : shift_rotate_imm<"srl", shamt, CPURegsOpnd, srl, immZExt5>, SRA_FM<2, 0>;
|
||||
def SRA : shift_rotate_imm<"sra", shamt, CPURegsOpnd, sra, immZExt5>, SRA_FM<3, 0>;
|
||||
def SLL : shift_rotate_imm<"sll", shamt, CPURegsOpnd, shl, immZExt5>,
|
||||
SRA_FM<0, 0>;
|
||||
def SRL : shift_rotate_imm<"srl", shamt, CPURegsOpnd, srl, immZExt5>,
|
||||
SRA_FM<2, 0>;
|
||||
def SRA : shift_rotate_imm<"sra", shamt, CPURegsOpnd, sra, immZExt5>,
|
||||
SRA_FM<3, 0>;
|
||||
def SLLV : shift_rotate_reg<"sllv", CPURegsOpnd, shl>, SRLV_FM<4, 0>;
|
||||
def SRLV : shift_rotate_reg<"srlv", CPURegsOpnd, srl>, SRLV_FM<6, 0>;
|
||||
def SRAV : shift_rotate_reg<"srav", CPURegsOpnd, sra>, SRLV_FM<7, 0>;
|
||||
@ -863,7 +870,8 @@ def RET : RetBase<CPURegs>, MTLO_FM<8>;
|
||||
/// Multiply and Divide Instructions.
|
||||
def MULT : Mult<"mult", IIImul, CPURegsOpnd, [HI, LO]>, MULT_FM<0, 0x18>;
|
||||
def MULTu : Mult<"multu", IIImul, CPURegsOpnd, [HI, LO]>, MULT_FM<0, 0x19>;
|
||||
def SDIV : Div<MipsDivRem, "div", IIIdiv, CPURegsOpnd, [HI, LO]>, MULT_FM<0, 0x1a>;
|
||||
def SDIV : Div<MipsDivRem, "div", IIIdiv, CPURegsOpnd, [HI, LO]>,
|
||||
MULT_FM<0, 0x1a>;
|
||||
def UDIV : Div<MipsDivRemU, "divu", IIIdiv, CPURegsOpnd, [HI, LO]>,
|
||||
MULT_FM<0, 0x1b>;
|
||||
|
||||
@ -905,16 +913,20 @@ def EXT : ExtBase<"ext", CPURegsOpnd>, EXT_FM<0>;
|
||||
def INS : InsBase<"ins", CPURegsOpnd>, EXT_FM<4>;
|
||||
|
||||
/// Move Control Registers From/To CPU Registers
|
||||
def MFC0_3OP : MFC3OP<(outs CPURegs:$rt), (ins CPURegs:$rd, uimm16:$sel),
|
||||
def MFC0_3OP : MFC3OP<(outs CPURegsOpnd:$rt),
|
||||
(ins CPURegsOpnd:$rd, uimm16:$sel),
|
||||
"mfc0\t$rt, $rd, $sel">, MFC3OP_FM<0x10, 0>;
|
||||
|
||||
def MTC0_3OP : MFC3OP<(outs CPURegs:$rd, uimm16:$sel), (ins CPURegs:$rt),
|
||||
def MTC0_3OP : MFC3OP<(outs CPURegsOpnd:$rd, uimm16:$sel),
|
||||
(ins CPURegsOpnd:$rt),
|
||||
"mtc0\t$rt, $rd, $sel">, MFC3OP_FM<0x10, 4>;
|
||||
|
||||
def MFC2_3OP : MFC3OP<(outs CPURegs:$rt), (ins CPURegs:$rd, uimm16:$sel),
|
||||
def MFC2_3OP : MFC3OP<(outs CPURegsOpnd:$rt),
|
||||
(ins CPURegsOpnd:$rd, uimm16:$sel),
|
||||
"mfc2\t$rt, $rd, $sel">, MFC3OP_FM<0x12, 0>;
|
||||
|
||||
def MTC2_3OP : MFC3OP<(outs CPURegs:$rd, uimm16:$sel), (ins CPURegs:$rt),
|
||||
def MTC2_3OP : MFC3OP<(outs CPURegsOpnd:$rd, uimm16:$sel),
|
||||
(ins CPURegsOpnd:$rt),
|
||||
"mtc2\t$rt, $rd, $sel">, MFC3OP_FM<0x12, 4>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -939,10 +951,10 @@ def : InstAlias<"slt $rs, $rt, $imm",
|
||||
def : InstAlias<"xor $rs, $rt, $imm",
|
||||
(XORi CPURegsOpnd:$rs, CPURegsOpnd:$rt, simm16:$imm)>,
|
||||
Requires<[NotMips64]>;
|
||||
def : InstAlias<"mfc0 $rt, $rd", (MFC0_3OP CPURegs:$rt, CPURegs:$rd, 0)>;
|
||||
def : InstAlias<"mtc0 $rt, $rd", (MTC0_3OP CPURegs:$rd, 0, CPURegs:$rt)>;
|
||||
def : InstAlias<"mfc2 $rt, $rd", (MFC2_3OP CPURegs:$rt, CPURegs:$rd, 0)>;
|
||||
def : InstAlias<"mtc2 $rt, $rd", (MTC2_3OP CPURegs:$rd, 0, CPURegs:$rt)>;
|
||||
def : InstAlias<"mfc0 $rt, $rd", (MFC0_3OP CPURegsOpnd:$rt, CPURegsOpnd:$rd, 0)>;
|
||||
def : InstAlias<"mtc0 $rt, $rd", (MTC0_3OP CPURegsOpnd:$rd, 0, CPURegsOpnd:$rt)>;
|
||||
def : InstAlias<"mfc2 $rt, $rd", (MFC2_3OP CPURegsOpnd:$rt, CPURegsOpnd:$rd, 0)>;
|
||||
def : InstAlias<"mtc2 $rt, $rd", (MTC2_3OP CPURegsOpnd:$rd, 0, CPURegsOpnd:$rt)>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Assembler Pseudo Instructions
|
||||
|
@ -1,4 +1,5 @@
|
||||
# RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding | FileCheck --check-prefix=MIPS64 %s
|
||||
# RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding \
|
||||
# RUN:| FileCheck --check-prefix=MIPS64 %s
|
||||
|
||||
# MIPS64: dmtc0 $12, $16, 2 # encoding: [0x40,0xac,0x80,0x02]
|
||||
# MIPS64: dmtc0 $12, $16, 0 # encoding: [0x40,0xac,0x80,0x00]
|
||||
|
Loading…
Reference in New Issue
Block a user