2014-05-09 09:46:21 +00:00
|
|
|
//=- Mips64r6InstrInfo.td - Mips64r6 Instruction Information -*- tablegen -*-=//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes Mips64r6 instructions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Notes about removals/changes from MIPS32r6:
|
|
|
|
// Reencoded: dclo, dclz
|
|
|
|
|
2014-05-12 15:12:45 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Instruction Encodings
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-05-15 12:06:36 +00:00
|
|
|
class DALIGN_ENC : SPECIAL3_DALIGN_FM<OPCODE6_DALIGN>;
|
2014-05-15 10:27:19 +00:00
|
|
|
class DAUI_ENC : DAUI_FM;
|
|
|
|
class DAHI_ENC : REGIMM_FM<OPCODE5_DAHI>;
|
|
|
|
class DATI_ENC : REGIMM_FM<OPCODE5_DATI>;
|
2014-05-15 12:18:23 +00:00
|
|
|
class DBITSWAP_ENC : SPECIAL3_2R_FM<OPCODE6_DBITSWAP>;
|
2014-06-16 13:18:59 +00:00
|
|
|
class DCLO_R6_ENC : SPECIAL_2R_FM<OPCODE6_DCLO>;
|
|
|
|
class DCLZ_R6_ENC : SPECIAL_2R_FM<OPCODE6_DCLZ>;
|
2014-05-12 15:24:16 +00:00
|
|
|
class DDIV_ENC : SPECIAL_3R_FM<0b00010, 0b011110>;
|
|
|
|
class DDIVU_ENC : SPECIAL_3R_FM<0b00010, 0b011111>;
|
2014-06-20 09:28:09 +00:00
|
|
|
class DLSA_R6_ENC : SPECIAL_LSA_FM<OPCODE6_DLSA>;
|
2014-05-12 15:24:16 +00:00
|
|
|
class DMOD_ENC : SPECIAL_3R_FM<0b00011, 0b011110>;
|
|
|
|
class DMODU_ENC : SPECIAL_3R_FM<0b00011, 0b011111>;
|
2014-05-12 15:12:45 +00:00
|
|
|
class DMUH_ENC : SPECIAL_3R_FM<0b00011, 0b111000>;
|
|
|
|
class DMUHU_ENC : SPECIAL_3R_FM<0b00011, 0b111001>;
|
|
|
|
class DMUL_R6_ENC : SPECIAL_3R_FM<0b00010, 0b111000>;
|
|
|
|
class DMULU_ENC : SPECIAL_3R_FM<0b00010, 0b111001>;
|
2014-06-09 09:49:51 +00:00
|
|
|
class LDPC_ENC : PCREL18_FM<OPCODE3_LDPC>;
|
2014-06-16 13:13:03 +00:00
|
|
|
class LLD_R6_ENC : SPECIAL3_LL_SC_FM<OPCODE6_LLD>;
|
|
|
|
class SCD_R6_ENC : SPECIAL3_LL_SC_FM<OPCODE6_SCD>;
|
2014-05-12 15:12:45 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Instruction Descriptions
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-05-22 11:23:21 +00:00
|
|
|
class AHI_ATI_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
|
|
|
|
dag OutOperandList = (outs GPROpnd:$rs);
|
|
|
|
dag InOperandList = (ins GPROpnd:$rt, simm16:$imm);
|
|
|
|
string AsmString = !strconcat(instr_asm, "\t$rt, $imm");
|
|
|
|
string Constraints = "$rs = $rt";
|
|
|
|
}
|
|
|
|
|
2014-05-15 12:06:36 +00:00
|
|
|
class DALIGN_DESC : ALIGN_DESC_BASE<"dalign", GPR64Opnd, uimm3>;
|
2014-05-22 11:23:21 +00:00
|
|
|
class DAHI_DESC : AHI_ATI_DESC_BASE<"dahi", GPR64Opnd>;
|
|
|
|
class DATI_DESC : AHI_ATI_DESC_BASE<"dati", GPR64Opnd>;
|
2014-05-15 10:27:19 +00:00
|
|
|
class DAUI_DESC : AUI_DESC_BASE<"daui", GPR64Opnd>;
|
2014-05-15 12:18:23 +00:00
|
|
|
class DBITSWAP_DESC : BITSWAP_DESC_BASE<"dbitswap", GPR64Opnd>;
|
2014-06-16 13:18:59 +00:00
|
|
|
class DCLO_R6_DESC : CLO_R6_DESC_BASE<"dclo", GPR64Opnd>;
|
|
|
|
class DCLZ_R6_DESC : CLZ_R6_DESC_BASE<"dclz", GPR64Opnd>;
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
class DDIV_DESC : DIVMOD_DESC_BASE<"ddiv", GPR64Opnd, sdiv>;
|
|
|
|
class DDIVU_DESC : DIVMOD_DESC_BASE<"ddivu", GPR64Opnd, udiv>;
|
2014-06-20 09:28:09 +00:00
|
|
|
class DLSA_R6_DESC : LSA_R6_DESC_BASE<"dlsa", GPR64Opnd, uimm2>;
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
class DMOD_DESC : DIVMOD_DESC_BASE<"dmod", GPR64Opnd, srem>;
|
|
|
|
class DMODU_DESC : DIVMOD_DESC_BASE<"dmodu", GPR64Opnd, urem>;
|
|
|
|
class DMUH_DESC : MUL_R6_DESC_BASE<"dmuh", GPR64Opnd, mulhs>;
|
|
|
|
class DMUHU_DESC : MUL_R6_DESC_BASE<"dmuhu", GPR64Opnd, mulhu>;
|
|
|
|
class DMUL_R6_DESC : MUL_R6_DESC_BASE<"dmul", GPR64Opnd, mul>;
|
2014-05-12 15:12:45 +00:00
|
|
|
class DMULU_DESC : MUL_R6_DESC_BASE<"dmulu", GPR64Opnd>;
|
2014-06-09 09:49:51 +00:00
|
|
|
class LDPC_DESC : PCREL_DESC_BASE<"ldpc", GPR64Opnd, simm18_lsl3>;
|
2014-06-16 13:13:03 +00:00
|
|
|
class LLD_R6_DESC : LL_R6_DESC_BASE<"lld", GPR64Opnd>;
|
|
|
|
class SCD_R6_DESC : SC_R6_DESC_BASE<"scd", GPR64Opnd>;
|
2014-06-12 13:39:06 +00:00
|
|
|
class SELEQZ64_DESC : SELEQNE_Z_DESC_BASE<"seleqz", GPR64Opnd>;
|
|
|
|
class SELNEZ64_DESC : SELEQNE_Z_DESC_BASE<"selnez", GPR64Opnd>;
|
|
|
|
|
2014-05-12 15:12:45 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Instruction Definitions
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-05-15 10:27:19 +00:00
|
|
|
def DAHI : DAHI_ENC, DAHI_DESC, ISA_MIPS64R6;
|
2014-05-15 12:06:36 +00:00
|
|
|
def DALIGN : DALIGN_ENC, DALIGN_DESC, ISA_MIPS64R6;
|
2014-05-15 10:27:19 +00:00
|
|
|
def DATI : DATI_ENC, DATI_DESC, ISA_MIPS64R6;
|
|
|
|
def DAUI : DAUI_ENC, DAUI_DESC, ISA_MIPS64R6;
|
2014-05-15 12:18:23 +00:00
|
|
|
def DBITSWAP : DBITSWAP_ENC, DBITSWAP_DESC, ISA_MIPS64R6;
|
2014-06-16 13:18:59 +00:00
|
|
|
def DCLO_R6 : DCLO_R6_ENC, DCLO_R6_DESC, ISA_MIPS64R6;
|
|
|
|
def DCLZ_R6 : DCLZ_R6_ENC, DCLZ_R6_DESC, ISA_MIPS64R6;
|
2014-05-12 15:24:16 +00:00
|
|
|
def DDIV : DDIV_ENC, DDIV_DESC, ISA_MIPS64R6;
|
|
|
|
def DDIVU : DDIVU_ENC, DDIVU_DESC, ISA_MIPS64R6;
|
2014-06-20 09:28:09 +00:00
|
|
|
def DLSA_R6 : DLSA_R6_ENC, DLSA_R6_DESC, ISA_MIPS64R6;
|
2014-05-12 15:24:16 +00:00
|
|
|
def DMOD : DMOD_ENC, DMOD_DESC, ISA_MIPS64R6;
|
|
|
|
def DMODU : DMODU_ENC, DMODU_DESC, ISA_MIPS64R6;
|
2014-05-12 15:12:45 +00:00
|
|
|
def DMUH: DMUH_ENC, DMUH_DESC, ISA_MIPS64R6;
|
|
|
|
def DMUHU: DMUHU_ENC, DMUHU_DESC, ISA_MIPS64R6;
|
|
|
|
def DMUL_R6: DMUL_R6_ENC, DMUL_R6_DESC, ISA_MIPS64R6;
|
|
|
|
def DMULU: DMULU_ENC, DMULU_DESC, ISA_MIPS64R6;
|
2014-06-09 09:49:51 +00:00
|
|
|
def LDPC: LDPC_ENC, LDPC_DESC, ISA_MIPS64R6;
|
2014-06-16 13:13:03 +00:00
|
|
|
def LLD_R6 : LLD_R6_ENC, LLD_R6_DESC, ISA_MIPS32R6;
|
|
|
|
def SCD_R6 : SCD_R6_ENC, SCD_R6_DESC, ISA_MIPS32R6;
|
2014-06-12 13:39:06 +00:00
|
|
|
let DecoderNamespace = "Mips32r6_64r6_GP64" in {
|
|
|
|
def SELEQZ64 : SELEQZ_ENC, SELEQZ64_DESC, ISA_MIPS32R6, GPR_64;
|
|
|
|
def SELNEZ64 : SELNEZ_ENC, SELNEZ64_DESC, ISA_MIPS32R6, GPR_64;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Patterns and Pseudo Instructions
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// i64 selects
|
|
|
|
def : MipsPat<(select i64:$cond, i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t, i64:$cond),
|
|
|
|
(SELEQZ64 i64:$f, i64:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i64:$cond, immz)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t, i64:$cond),
|
|
|
|
(SELEQZ64 i64:$f, i64:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i64:$cond, immz)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$f, i64:$cond),
|
|
|
|
(SELEQZ64 i64:$t, i64:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i64:$cond, immZExt16_64:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t, (XORi64 i64:$cond, immZExt16_64:$imm)),
|
|
|
|
(SELEQZ64 i64:$f, (XORi64 i64:$cond, immZExt16_64:$imm)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i64:$cond, immZExt16_64:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$f, (XORi64 i64:$cond, immZExt16_64:$imm)),
|
|
|
|
(SELEQZ64 i64:$t, (XORi64 i64:$cond, immZExt16_64:$imm)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<
|
|
|
|
(select (i32 (setgt i64:$cond, immSExt16Plus1:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t,
|
|
|
|
(SUBREG_TO_REG (i64 0), (SLTi64 i64:$cond, (Plus1 imm:$imm)),
|
|
|
|
sub_32)),
|
|
|
|
(SELEQZ64 i64:$f,
|
|
|
|
(SUBREG_TO_REG (i64 0), (SLTi64 i64:$cond, (Plus1 imm:$imm)),
|
|
|
|
sub_32)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<
|
|
|
|
(select (i32 (setugt i64:$cond, immSExt16Plus1:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t,
|
|
|
|
(SUBREG_TO_REG (i64 0), (SLTiu64 i64:$cond, (Plus1 imm:$imm)),
|
|
|
|
sub_32)),
|
|
|
|
(SELEQZ64 i64:$f,
|
|
|
|
(SUBREG_TO_REG (i64 0), (SLTiu64 i64:$cond, (Plus1 imm:$imm)),
|
|
|
|
sub_32)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
|
|
|
|
def : MipsPat<(select (i32 (setne i64:$cond, immz)), i64:$t, immz),
|
|
|
|
(SELNEZ64 i64:$t, i64:$cond)>, ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i64:$cond, immz)), i64:$t, immz),
|
|
|
|
(SELEQZ64 i64:$t, i64:$cond)>, ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i64:$cond, immz)), immz, i64:$f),
|
|
|
|
(SELEQZ64 i64:$f, i64:$cond)>, ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i64:$cond, immz)), immz, i64:$f),
|
|
|
|
(SELNEZ64 i64:$f, i64:$cond)>, ISA_MIPS64R6;
|
|
|
|
|
|
|
|
// i64 selects from an i32 comparison
|
|
|
|
// One complicating factor here is that bits 32-63 of an i32 are undefined.
|
|
|
|
// FIXME: Ideally, setcc would always produce an i64 on MIPS64 targets.
|
|
|
|
// This would allow us to remove the sign-extensions here.
|
|
|
|
def : MipsPat<(select i32:$cond, i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t, (SLL64_32 i32:$cond)),
|
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 i32:$cond)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i32:$cond, immz)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t, (SLL64_32 i32:$cond)),
|
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 i32:$cond)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i32:$cond, immz)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$f, (SLL64_32 i32:$cond)),
|
|
|
|
(SELEQZ64 i64:$t, (SLL64_32 i32:$cond)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i32:$cond, immZExt16:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t, (SLL64_32 (XORi i32:$cond,
|
|
|
|
immZExt16:$imm))),
|
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 (XORi i32:$cond,
|
|
|
|
immZExt16:$imm))))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i32:$cond, immZExt16:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$f, (SLL64_32 (XORi i32:$cond,
|
|
|
|
immZExt16:$imm))),
|
|
|
|
(SELEQZ64 i64:$t, (SLL64_32 (XORi i32:$cond,
|
|
|
|
immZExt16:$imm))))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
|
|
|
|
def : MipsPat<(select i32:$cond, i64:$t, immz),
|
|
|
|
(SELNEZ64 i64:$t, (SLL64_32 i32:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i32:$cond, immz)), i64:$t, immz),
|
|
|
|
(SELNEZ64 i64:$t, (SLL64_32 i32:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i32:$cond, immz)), i64:$t, immz),
|
|
|
|
(SELEQZ64 i64:$t, (SLL64_32 i32:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select i32:$cond, immz, i64:$f),
|
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 i32:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i32:$cond, immz)), immz, i64:$f),
|
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 i32:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i32:$cond, immz)), immz, i64:$f),
|
|
|
|
(SELNEZ64 i64:$f, (SLL64_32 i32:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|