2014-05-09 17:46:21 +08: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 23:12:45 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Instruction Encodings
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-05-15 20:06:36 +08:00
|
|
|
class DALIGN_ENC : SPECIAL3_DALIGN_FM<OPCODE6_DALIGN>;
|
2014-05-15 18:27:19 +08:00
|
|
|
class DAUI_ENC : DAUI_FM;
|
|
|
|
class DAHI_ENC : REGIMM_FM<OPCODE5_DAHI>;
|
|
|
|
class DATI_ENC : REGIMM_FM<OPCODE5_DATI>;
|
2014-05-15 20:18:23 +08:00
|
|
|
class DBITSWAP_ENC : SPECIAL3_2R_FM<OPCODE6_DBITSWAP>;
|
2014-06-16 21:18:59 +08:00
|
|
|
class DCLO_R6_ENC : SPECIAL_2R_FM<OPCODE6_DCLO>;
|
|
|
|
class DCLZ_R6_ENC : SPECIAL_2R_FM<OPCODE6_DCLZ>;
|
2014-05-12 23:24:16 +08:00
|
|
|
class DDIV_ENC : SPECIAL_3R_FM<0b00010, 0b011110>;
|
|
|
|
class DDIVU_ENC : SPECIAL_3R_FM<0b00010, 0b011111>;
|
2014-06-20 17:28:09 +08:00
|
|
|
class DLSA_R6_ENC : SPECIAL_LSA_FM<OPCODE6_DLSA>;
|
2014-05-12 23:24:16 +08:00
|
|
|
class DMOD_ENC : SPECIAL_3R_FM<0b00011, 0b011110>;
|
|
|
|
class DMODU_ENC : SPECIAL_3R_FM<0b00011, 0b011111>;
|
2014-07-04 18:08:27 +08:00
|
|
|
class DMUH_ENC : SPECIAL_3R_FM<0b00011, 0b011100>;
|
|
|
|
class DMUHU_ENC : SPECIAL_3R_FM<0b00011, 0b011101>;
|
|
|
|
class DMUL_R6_ENC : SPECIAL_3R_FM<0b00010, 0b011100>;
|
|
|
|
class DMULU_ENC : SPECIAL_3R_FM<0b00010, 0b011101>;
|
2014-06-09 17:49:51 +08:00
|
|
|
class LDPC_ENC : PCREL18_FM<OPCODE3_LDPC>;
|
2014-06-16 21:13:03 +08:00
|
|
|
class LLD_R6_ENC : SPECIAL3_LL_SC_FM<OPCODE6_LLD>;
|
|
|
|
class SCD_R6_ENC : SPECIAL3_LL_SC_FM<OPCODE6_SCD>;
|
2014-05-12 23:12:45 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Instruction Descriptions
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 21:05:06 +08:00
|
|
|
class AHI_ATI_DESC_BASE<string instr_asm, RegisterOperand GPROpnd, InstrItinClass itin> {
|
2014-05-22 19:23:21 +08:00
|
|
|
dag OutOperandList = (outs GPROpnd:$rs);
|
2016-10-14 17:31:42 +08:00
|
|
|
dag InOperandList = (ins GPROpnd:$rt, uimm16_altrelaxed:$imm);
|
|
|
|
string AsmString = !strconcat(instr_asm, "\t$rs, $rt, $imm");
|
2014-05-22 19:23:21 +08:00
|
|
|
string Constraints = "$rs = $rt";
|
2016-03-11 21:05:06 +08:00
|
|
|
InstrItinClass Itinerary = itin;
|
2014-05-22 19:23:21 +08:00
|
|
|
}
|
|
|
|
|
2016-03-11 21:05:06 +08:00
|
|
|
class DALIGN_DESC : ALIGN_DESC_BASE<"dalign", GPR64Opnd, uimm3, II_DALIGN>;
|
|
|
|
class DAHI_DESC : AHI_ATI_DESC_BASE<"dahi", GPR64Opnd, II_DAHI>;
|
|
|
|
class DATI_DESC : AHI_ATI_DESC_BASE<"dati", GPR64Opnd, II_DATI>;
|
|
|
|
class DAUI_DESC : AUI_DESC_BASE<"daui", GPR64Opnd, II_DAUI>;
|
|
|
|
class DBITSWAP_DESC : BITSWAP_DESC_BASE<"dbitswap", GPR64Opnd, II_DBITSWAP>;
|
|
|
|
class DCLO_R6_DESC : CLO_R6_DESC_BASE<"dclo", GPR64Opnd, II_DCLO>;
|
|
|
|
class DCLZ_R6_DESC : CLZ_R6_DESC_BASE<"dclz", GPR64Opnd, II_DCLZ>;
|
|
|
|
class DDIV_DESC : DIVMOD_DESC_BASE<"ddiv", GPR64Opnd, II_DDIV, sdiv>;
|
|
|
|
class DDIVU_DESC : DIVMOD_DESC_BASE<"ddivu", GPR64Opnd, II_DDIVU, udiv>;
|
|
|
|
class DLSA_R6_DESC : LSA_R6_DESC_BASE<"dlsa", GPR64Opnd, uimm2_plus1, II_DLSA>;
|
|
|
|
class DMOD_DESC : DIVMOD_DESC_BASE<"dmod", GPR64Opnd, II_DMOD, srem>;
|
|
|
|
class DMODU_DESC : DIVMOD_DESC_BASE<"dmodu", GPR64Opnd, II_DMODU, urem>;
|
|
|
|
class DMUH_DESC : MUL_R6_DESC_BASE<"dmuh", GPR64Opnd, II_DMUH, mulhs>;
|
|
|
|
class DMUHU_DESC : MUL_R6_DESC_BASE<"dmuhu", GPR64Opnd, II_DMUHU, mulhu>;
|
|
|
|
class DMUL_R6_DESC : MUL_R6_DESC_BASE<"dmul", GPR64Opnd, II_DMUL, mul>;
|
|
|
|
class DMULU_DESC : MUL_R6_DESC_BASE<"dmulu", GPR64Opnd, II_DMUL>;
|
|
|
|
class LDPC_DESC : PCREL_DESC_BASE<"ldpc", GPR64Opnd, simm18_lsl3, II_LDPC>;
|
2016-06-27 16:23:28 +08:00
|
|
|
class LLD_R6_DESC : LL_R6_DESC_BASE<"lld", GPR64Opnd, mem_simm16, II_LLD>;
|
2016-03-11 21:05:06 +08:00
|
|
|
class SCD_R6_DESC : SC_R6_DESC_BASE<"scd", GPR64Opnd, II_SCD>;
|
2014-06-12 21:39:06 +08:00
|
|
|
class SELEQZ64_DESC : SELEQNE_Z_DESC_BASE<"seleqz", GPR64Opnd>;
|
|
|
|
class SELNEZ64_DESC : SELEQNE_Z_DESC_BASE<"selnez", GPR64Opnd>;
|
|
|
|
|
2016-07-26 18:25:07 +08:00
|
|
|
class BGEC64_DESC : CMP_BC_DESC_BASE<"bgec", brtarget, GPR64Opnd>;
|
|
|
|
class BGEUC64_DESC : CMP_BC_DESC_BASE<"bgeuc", brtarget, GPR64Opnd>;
|
|
|
|
class BEQC64_DESC : CMP_BC_DESC_BASE<"beqc", brtarget, GPR64Opnd>;
|
|
|
|
class BNEC64_DESC : CMP_BC_DESC_BASE<"bnec", brtarget, GPR64Opnd>;
|
|
|
|
class BLTC64_DESC : CMP_BC_DESC_BASE<"bltc", brtarget, GPR64Opnd>;
|
|
|
|
class BLTUC64_DESC : CMP_BC_DESC_BASE<"bltuc", brtarget, GPR64Opnd>;
|
|
|
|
class BLTZC64_DESC : CMP_CBR_RT_Z_DESC_BASE<"bltzc", brtarget, GPR64Opnd>;
|
|
|
|
class BGEZC64_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgezc", brtarget, GPR64Opnd>;
|
|
|
|
class BLEZC64_DESC : CMP_CBR_RT_Z_DESC_BASE<"blezc", brtarget, GPR64Opnd>;
|
|
|
|
class BGTZC64_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgtzc", brtarget, GPR64Opnd>;
|
|
|
|
class BEQZC64_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"beqzc", brtarget21, GPR64Opnd>;
|
|
|
|
class BNEZC64_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"bnezc", brtarget21, GPR64Opnd>;
|
|
|
|
|
2016-04-05 20:50:29 +08:00
|
|
|
class JIALC64_DESC : JMP_IDX_COMPACT_DESC_BASE<"jialc", calloffset16,
|
2016-08-24 21:00:47 +08:00
|
|
|
GPR64Opnd, II_JIALC> {
|
2016-04-05 20:50:29 +08:00
|
|
|
bit isCall = 1;
|
|
|
|
list<Register> Defs = [RA];
|
|
|
|
}
|
|
|
|
|
2016-08-24 21:00:47 +08:00
|
|
|
class JIC64_DESC : JMP_IDX_COMPACT_DESC_BASE<"jic", jmpoffset16, GPR64Opnd,
|
|
|
|
II_JIC> {
|
2016-04-05 20:50:29 +08:00
|
|
|
bit isBarrier = 1;
|
|
|
|
bit isTerminator = 1;
|
|
|
|
list<Register> Defs = [AT];
|
|
|
|
}
|
|
|
|
|
2016-06-27 16:23:28 +08:00
|
|
|
class LL64_R6_DESC : LL_R6_DESC_BASE<"ll", GPR32Opnd, mem_simm9, II_LL>;
|
2016-06-14 19:29:28 +08:00
|
|
|
class SC64_R6_DESC : SC_R6_DESC_BASE<"sc", GPR32Opnd, II_SC>;
|
2014-05-12 23:12:45 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Instruction Definitions
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-08-12 20:45:16 +08:00
|
|
|
let AdditionalPredicates = [NotInMicroMips] in {
|
2016-10-14 17:31:42 +08:00
|
|
|
let DecoderMethod = "DecodeDAHIDATI" in {
|
|
|
|
def DATI : DATI_ENC, DATI_DESC, ISA_MIPS64R6;
|
|
|
|
def DAHI : DAHI_ENC, DAHI_DESC, ISA_MIPS64R6;
|
|
|
|
}
|
2015-08-12 20:45:16 +08:00
|
|
|
def DAUI : DAUI_ENC, DAUI_DESC, ISA_MIPS64R6;
|
|
|
|
def DALIGN : DALIGN_ENC, DALIGN_DESC, ISA_MIPS64R6;
|
2016-09-08 15:41:43 +08:00
|
|
|
def DBITSWAP : R6MMR6Rel, DBITSWAP_ENC, DBITSWAP_DESC, ISA_MIPS64R6;
|
2016-06-16 15:06:25 +08:00
|
|
|
def DCLO_R6 : R6MMR6Rel, DCLO_R6_ENC, DCLO_R6_DESC, ISA_MIPS64R6;
|
|
|
|
def DCLZ_R6 : R6MMR6Rel, DCLZ_R6_ENC, DCLZ_R6_DESC, ISA_MIPS64R6;
|
2016-04-13 16:02:26 +08:00
|
|
|
def DDIV : DDIV_ENC, DDIV_DESC, ISA_MIPS64R6;
|
|
|
|
def DDIVU : DDIVU_ENC, DDIVU_DESC, ISA_MIPS64R6;
|
|
|
|
def DMOD : DMOD_ENC, DMOD_DESC, ISA_MIPS64R6;
|
|
|
|
def DMODU : DMODU_ENC, DMODU_DESC, ISA_MIPS64R6;
|
2016-09-08 15:41:43 +08:00
|
|
|
def DLSA_R6 : R6MMR6Rel, DLSA_R6_ENC, DLSA_R6_DESC, ISA_MIPS64R6;
|
2016-05-06 16:24:14 +08: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;
|
2016-06-27 16:23:28 +08:00
|
|
|
def LLD_R6 : R6MMR6Rel, LLD_R6_ENC, LLD_R6_DESC, ISA_MIPS64R6;
|
2016-05-06 16:24:14 +08:00
|
|
|
}
|
2016-04-21 22:32:12 +08:00
|
|
|
def LDPC: R6MMR6Rel, LDPC_ENC, LDPC_DESC, ISA_MIPS64R6;
|
2016-03-02 04:25:43 +08:00
|
|
|
def SCD_R6 : SCD_R6_ENC, SCD_R6_DESC, ISA_MIPS32R6;
|
|
|
|
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;
|
2014-06-12 21:39:06 +08:00
|
|
|
}
|
2016-06-14 19:29:28 +08:00
|
|
|
let AdditionalPredicates = [NotInMicroMips],
|
|
|
|
DecoderNamespace = "Mips32r6_64r6_PTR64" in {
|
|
|
|
def LL64_R6 : LL_R6_ENC, LL64_R6_DESC, PTR_64, ISA_MIPS64R6;
|
|
|
|
def SC64_R6 : SC_R6_ENC, SC64_R6_DESC, PTR_64, ISA_MIPS64R6;
|
|
|
|
}
|
2016-07-26 18:25:07 +08:00
|
|
|
|
|
|
|
let DecoderNamespace = "Mips32r6_64r6_GP64" in {
|
|
|
|
// Jump and Branch Instructions
|
|
|
|
def JIALC64 : JIALC_ENC, JIALC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def JIC64 : JIC_ENC, JIC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
|
|
|
|
def BEQC64 : BEQC_ENC, BEQC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BEQZC64 : BEQZC_ENC, BEQZC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BGEC64 : BGEC_ENC, BGEC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BGEUC64 : BGEUC_ENC, BGEUC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BGTZC64 : BGTZC_ENC, BGTZC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BLEZC64 : BLEZC_ENC, BLEZC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BLTC64 : BLTC_ENC, BLTC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BLTUC64 : BLTUC_ENC, BLTUC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BNEC64 : BNEC_ENC, BNEC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BNEZC64 : BNEZC_ENC, BNEZC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
}
|
|
|
|
let DecoderNamespace = "Mips32r6_64r6_BranchZero" in {
|
|
|
|
def BLTZC64 : BLTZC_ENC, BLTZC64_DESC, ISA_MIPS64R6, GPR_64;
|
|
|
|
def BGEZC64 : BGEZC_ENC, BGEZC64_DESC, ISA_MIPS64R6, GPR_64;
|
2016-04-05 20:50:29 +08:00
|
|
|
}
|
2016-07-26 18:25:07 +08:00
|
|
|
|
2014-06-12 21:39:06 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
[mips][mips64r6] Use JALR for returns instead of JR (which is not available on MIPS32r6/MIPS64r6)
Summary:
RET, and RET_MM have been replaced by a pseudo named PseudoReturn.
In addition a version with a 64-bit GPR named PseudoReturn64 has been
added.
Instruction selection for a return matches RetRA, which is expanded post
register allocation to PseudoReturn/PseudoReturn64. During MipsAsmPrinter,
this PseudoReturn/PseudoReturn64 are emitted as:
- (JALR64 $zero, $rs) on MIPS64r6
- (JALR $zero, $rs) on MIPS32r6
- (JR_MM $rs) on microMIPS
- (JR $rs) otherwise
On MIPS32r6/MIPS64r6, 'jr $rs' is an alias for 'jalr $zero, $rs'. To aid
development and review (specifically, to ensure all cases of jr are
updated), these aliases are temporarily named 'r6.jr' instead of 'jr'.
A follow up patch will change them back to the correct mnemonic.
Added (JALR $zero, $rs) to MipsNaClELFStreamer's definition of an indirect
jump, and removed it from its definition of a call.
Note: I haven't accounted for MIPS64 in MipsNaClELFStreamer since it's
doesn't appear to account for any MIPS64-specifics.
The return instruction created as part of eh_return expansion is now expanded
using expandRetRA() so we use the right return instruction on MIPS32r6/MIPS64r6
('jalr $zero, $rs').
Also, fixed a misuse of isABI_N64() to detect 64-bit wide registers in
expandEhReturn().
Reviewers: jkolek, vmedic, mseaborn, zoran.jovanovic, dsanders
Reviewed By: dsanders
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D4268
llvm-svn: 212604
2014-07-09 18:16:07 +08:00
|
|
|
// Instruction Aliases
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def : MipsInstAlias<"jr $rs", (JALR64 ZERO_64, GPR64Opnd:$rs), 1>, ISA_MIPS64R6;
|
|
|
|
|
2016-04-14 21:43:17 +08:00
|
|
|
def : MipsInstAlias<"jrc $rs", (JIC64 GPR64Opnd:$rs, 0), 1>, ISA_MIPS64R6;
|
|
|
|
|
|
|
|
def : MipsInstAlias<"jalrc $rs", (JIALC64 GPR64Opnd:$rs, 0), 1>, ISA_MIPS64R6;
|
[mips][mips64r6] Use JALR for returns instead of JR (which is not available on MIPS32r6/MIPS64r6)
Summary:
RET, and RET_MM have been replaced by a pseudo named PseudoReturn.
In addition a version with a 64-bit GPR named PseudoReturn64 has been
added.
Instruction selection for a return matches RetRA, which is expanded post
register allocation to PseudoReturn/PseudoReturn64. During MipsAsmPrinter,
this PseudoReturn/PseudoReturn64 are emitted as:
- (JALR64 $zero, $rs) on MIPS64r6
- (JALR $zero, $rs) on MIPS32r6
- (JR_MM $rs) on microMIPS
- (JR $rs) otherwise
On MIPS32r6/MIPS64r6, 'jr $rs' is an alias for 'jalr $zero, $rs'. To aid
development and review (specifically, to ensure all cases of jr are
updated), these aliases are temporarily named 'r6.jr' instead of 'jr'.
A follow up patch will change them back to the correct mnemonic.
Added (JALR $zero, $rs) to MipsNaClELFStreamer's definition of an indirect
jump, and removed it from its definition of a call.
Note: I haven't accounted for MIPS64 in MipsNaClELFStreamer since it's
doesn't appear to account for any MIPS64-specifics.
The return instruction created as part of eh_return expansion is now expanded
using expandRetRA() so we use the right return instruction on MIPS32r6/MIPS64r6
('jalr $zero, $rs').
Also, fixed a misuse of isABI_N64() to detect 64-bit wide registers in
expandEhReturn().
Reviewers: jkolek, vmedic, mseaborn, zoran.jovanovic, dsanders
Reviewed By: dsanders
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D4268
llvm-svn: 212604
2014-07-09 18:16:07 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2014-06-12 21:39:06 +08:00
|
|
|
// 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))>,
|
2016-03-02 04:25:43 +08:00
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i64:$cond, immz)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELEQZ64 i64:$t, i64:$cond),
|
|
|
|
(SELNEZ64 i64:$f, i64:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i64:$cond, immz)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELNEZ64 i64:$t, i64:$cond),
|
|
|
|
(SELEQZ64 i64:$f, i64:$cond))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i64:$cond, immZExt16_64:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELEQZ64 i64:$t, (XORi64 i64:$cond, immZExt16_64:$imm)),
|
|
|
|
(SELNEZ64 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:$t, (XORi64 i64:$cond, immZExt16_64:$imm)),
|
|
|
|
(SELEQZ64 i64:$f, (XORi64 i64:$cond, immZExt16_64:$imm)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<
|
|
|
|
(select (i32 (setgt i64:$cond, immSExt16Plus1:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELEQZ64 i64:$t,
|
|
|
|
(SUBREG_TO_REG (i64 0), (SLTi64 i64:$cond, (Plus1 imm:$imm)),
|
|
|
|
sub_32)),
|
|
|
|
(SELNEZ64 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 (SELEQZ64 i64:$t,
|
|
|
|
(SUBREG_TO_REG (i64 0), (SLTiu64 i64:$cond, (Plus1 imm:$imm)),
|
|
|
|
sub_32)),
|
|
|
|
(SELNEZ64 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;
|
2014-06-12 21:39:06 +08:00
|
|
|
|
|
|
|
// i64 selects from an i32 comparison
|
2016-03-02 04:25:43 +08:00
|
|
|
// 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.
|
2014-06-12 21:39:06 +08:00
|
|
|
def : MipsPat<(select i32:$cond, i64:$t, i64:$f),
|
2016-03-02 04:25:43 +08:00
|
|
|
(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 (SELEQZ64 i64:$t, (SLL64_32 i32:$cond)),
|
|
|
|
(SELNEZ64 i64:$f, (SLL64_32 i32:$cond)))>,
|
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne 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 (seteq i32:$cond, immZExt16:$imm)), i64:$t, i64:$f),
|
|
|
|
(OR64 (SELEQZ64 i64:$t, (SLL64_32 (XORi i32:$cond,
|
|
|
|
immZExt16:$imm))),
|
|
|
|
(SELNEZ64 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:$t, (SLL64_32 (XORi i32:$cond,
|
|
|
|
immZExt16:$imm))),
|
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 (XORi i32:$cond,
|
|
|
|
immZExt16:$imm))))>,
|
|
|
|
ISA_MIPS64R6;
|
2014-06-12 21:39:06 +08:00
|
|
|
|
|
|
|
def : MipsPat<(select i32:$cond, i64:$t, immz),
|
|
|
|
(SELNEZ64 i64:$t, (SLL64_32 i32:$cond))>,
|
2016-03-02 04:25:43 +08:00
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i32:$cond, immz)), i64:$t, immz),
|
2014-06-12 21:39:06 +08:00
|
|
|
(SELNEZ64 i64:$t, (SLL64_32 i32:$cond))>,
|
2016-03-02 04:25:43 +08:00
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i32:$cond, immz)), i64:$t, immz),
|
2014-06-12 21:39:06 +08:00
|
|
|
(SELEQZ64 i64:$t, (SLL64_32 i32:$cond))>,
|
2016-03-02 04:25:43 +08:00
|
|
|
ISA_MIPS64R6;
|
2014-06-12 21:39:06 +08:00
|
|
|
def : MipsPat<(select i32:$cond, immz, i64:$f),
|
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 i32:$cond))>,
|
2016-03-02 04:25:43 +08:00
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (setne i32:$cond, immz)), immz, i64:$f),
|
2014-06-12 21:39:06 +08:00
|
|
|
(SELEQZ64 i64:$f, (SLL64_32 i32:$cond))>,
|
2016-03-02 04:25:43 +08:00
|
|
|
ISA_MIPS64R6;
|
|
|
|
def : MipsPat<(select (i32 (seteq i32:$cond, immz)), immz, i64:$f),
|
2014-06-12 21:39:06 +08:00
|
|
|
(SELNEZ64 i64:$f, (SLL64_32 i32:$cond))>,
|
2016-03-02 04:25:43 +08:00
|
|
|
ISA_MIPS64R6;
|