2012-02-28 15:46:26 +08:00
|
|
|
//===-- MipsCondMov.td - Describe Mips Conditional Moves --*- tablegen -*--===//
|
2012-02-17 09:23:50 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This is the Conditional Moves implementation.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-10-18 02:43:19 +08:00
|
|
|
// Conditional moves:
|
|
|
|
// These instructions are expanded in
|
|
|
|
// MipsISelLowering::EmitInstrWithCustomInserter if target does not have
|
|
|
|
// conditional move instructions.
|
|
|
|
// cond:int, data:int
|
2013-07-16 18:07:14 +08:00
|
|
|
class CMov_I_I_FT<string opstr, RegisterOperand CRC, RegisterOperand DRC,
|
2013-01-05 03:16:38 +08:00
|
|
|
InstrItinClass Itin> :
|
|
|
|
InstSE<(outs DRC:$rd), (ins DRC:$rs, CRC:$rt, DRC:$F),
|
2013-09-06 20:41:17 +08:00
|
|
|
!strconcat(opstr, "\t$rd, $rs, $rt"), [], Itin, FrmFR, opstr> {
|
2011-10-18 02:43:19 +08:00
|
|
|
let Constraints = "$F = $rd";
|
|
|
|
}
|
|
|
|
|
|
|
|
// cond:int, data:float
|
2013-07-16 18:07:14 +08:00
|
|
|
class CMov_I_F_FT<string opstr, RegisterOperand CRC, RegisterOperand DRC,
|
2012-12-13 09:41:15 +08:00
|
|
|
InstrItinClass Itin> :
|
|
|
|
InstSE<(outs DRC:$fd), (ins DRC:$fs, CRC:$rt, DRC:$F),
|
2015-05-07 18:29:52 +08:00
|
|
|
!strconcat(opstr, "\t$fd, $fs, $rt"), [], Itin, FrmFR, opstr>,
|
|
|
|
HARDFLOAT {
|
2012-12-13 09:41:15 +08:00
|
|
|
let Constraints = "$F = $fd";
|
|
|
|
}
|
|
|
|
|
2012-12-13 10:05:02 +08:00
|
|
|
// cond:float, data:int
|
2013-07-16 18:07:14 +08:00
|
|
|
class CMov_F_I_FT<string opstr, RegisterOperand RC, InstrItinClass Itin,
|
2012-12-13 09:41:15 +08:00
|
|
|
SDPatternOperator OpNode = null_frag> :
|
2013-07-30 18:12:14 +08:00
|
|
|
InstSE<(outs RC:$rd), (ins RC:$rs, FCCRegsOpnd:$fcc, RC:$F),
|
2013-07-27 04:51:20 +08:00
|
|
|
!strconcat(opstr, "\t$rd, $rs, $fcc"),
|
2013-07-30 18:12:14 +08:00
|
|
|
[(set RC:$rd, (OpNode RC:$rs, FCCRegsOpnd:$fcc, RC:$F))],
|
2015-05-07 18:29:52 +08:00
|
|
|
Itin, FrmFR, opstr>, HARDFLOAT {
|
2012-12-13 09:41:15 +08:00
|
|
|
let Constraints = "$F = $rd";
|
|
|
|
}
|
|
|
|
|
2012-12-13 10:05:02 +08:00
|
|
|
// cond:float, data:float
|
2013-07-30 18:12:14 +08:00
|
|
|
class CMov_F_F_FT<string opstr, RegisterOperand RC, InstrItinClass Itin,
|
2012-12-13 09:41:15 +08:00
|
|
|
SDPatternOperator OpNode = null_frag> :
|
2013-07-30 18:12:14 +08:00
|
|
|
InstSE<(outs RC:$fd), (ins RC:$fs, FCCRegsOpnd:$fcc, RC:$F),
|
2013-07-27 04:51:20 +08:00
|
|
|
!strconcat(opstr, "\t$fd, $fs, $fcc"),
|
2013-07-30 18:12:14 +08:00
|
|
|
[(set RC:$fd, (OpNode RC:$fs, FCCRegsOpnd:$fcc, RC:$F))],
|
2015-05-07 18:29:52 +08:00
|
|
|
Itin, FrmFR, opstr>, HARDFLOAT {
|
2012-12-13 09:41:15 +08:00
|
|
|
let Constraints = "$F = $fd";
|
|
|
|
}
|
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
// select patterns
|
|
|
|
multiclass MovzPats0<RegisterClass CRC, RegisterClass DRC,
|
|
|
|
Instruction MOVZInst, Instruction SLTOp,
|
|
|
|
Instruction SLTuOp, Instruction SLTiOp,
|
|
|
|
Instruction SLTiuOp> {
|
|
|
|
def : MipsPat<(select (i32 (setge CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTOp CRC:$lhs, CRC:$rhs), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setuge CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTuOp CRC:$lhs, CRC:$rhs), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setge CRC:$lhs, immSExt16:$rhs)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTiOp CRC:$lhs, immSExt16:$rhs), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setuge CRC:$lh, immSExt16:$rh)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTiuOp CRC:$lh, immSExt16:$rh), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setle CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTOp CRC:$rhs, CRC:$lhs), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setule CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTuOp CRC:$rhs, CRC:$lhs), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setgt CRC:$lhs, immSExt16Plus1:$rhs)),
|
|
|
|
DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTiOp CRC:$lhs, (Plus1 imm:$rhs)), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setugt CRC:$lhs, immSExt16Plus1:$rhs)),
|
|
|
|
DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (SLTiuOp CRC:$lhs, (Plus1 imm:$rhs)),
|
|
|
|
DRC:$F)>;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass MovzPats1<RegisterClass CRC, RegisterClass DRC,
|
|
|
|
Instruction MOVZInst, Instruction XOROp> {
|
|
|
|
def : MipsPat<(select (i32 (seteq CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (XOROp CRC:$lhs, CRC:$rhs), DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (seteq CRC:$lhs, 0)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, CRC:$lhs, DRC:$F)>;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass MovzPats2<RegisterClass CRC, RegisterClass DRC,
|
|
|
|
Instruction MOVZInst, Instruction XORiOp> {
|
|
|
|
def : MipsPat<
|
|
|
|
(select (i32 (seteq CRC:$lhs, immZExt16:$uimm16)), DRC:$T, DRC:$F),
|
|
|
|
(MOVZInst DRC:$T, (XORiOp CRC:$lhs, immZExt16:$uimm16), DRC:$F)>;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass MovnPats<RegisterClass CRC, RegisterClass DRC, Instruction MOVNInst,
|
|
|
|
Instruction XOROp> {
|
|
|
|
def : MipsPat<(select (i32 (setne CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F),
|
|
|
|
(MOVNInst DRC:$T, (XOROp CRC:$lhs, CRC:$rhs), DRC:$F)>;
|
|
|
|
def : MipsPat<(select CRC:$cond, DRC:$T, DRC:$F),
|
|
|
|
(MOVNInst DRC:$T, CRC:$cond, DRC:$F)>;
|
|
|
|
def : MipsPat<(select (i32 (setne CRC:$lhs, 0)),DRC:$T, DRC:$F),
|
|
|
|
(MOVNInst DRC:$T, CRC:$lhs, DRC:$F)>;
|
|
|
|
}
|
|
|
|
|
2011-10-18 02:43:19 +08:00
|
|
|
// Instantiation of instructions.
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVZ_I_I : MMRel, CMov_I_I_FT<"movz", GPR32Opnd, GPR32Opnd, II_MOVZ>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xa>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2013-08-07 07:01:10 +08:00
|
|
|
|
2014-04-30 01:04:30 +08:00
|
|
|
let isCodeGenOnly = 1 in {
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVZ_I_I64 : CMov_I_I_FT<"movz", GPR32Opnd, GPR64Opnd, II_MOVZ>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xa>, INSN_MIPS4_32_NOT_32R6_64R6;
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVZ_I64_I : CMov_I_I_FT<"movz", GPR64Opnd, GPR32Opnd, II_MOVZ>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xa>, INSN_MIPS4_32_NOT_32R6_64R6;
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVZ_I64_I64 : CMov_I_I_FT<"movz", GPR64Opnd, GPR64Opnd, II_MOVZ>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xa>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2011-10-18 02:53:29 +08:00
|
|
|
}
|
|
|
|
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVN_I_I : MMRel, CMov_I_I_FT<"movn", GPR32Opnd, GPR32Opnd, II_MOVN>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xb>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2013-08-07 07:01:10 +08:00
|
|
|
|
2014-04-30 01:04:30 +08:00
|
|
|
let isCodeGenOnly = 1 in {
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVN_I_I64 : CMov_I_I_FT<"movn", GPR32Opnd, GPR64Opnd, II_MOVN>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xb>, INSN_MIPS4_32_NOT_32R6_64R6;
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVN_I64_I : CMov_I_I_FT<"movn", GPR64Opnd, GPR32Opnd, II_MOVN>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xb>, INSN_MIPS4_32_NOT_32R6_64R6;
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVN_I64_I64 : CMov_I_I_FT<"movn", GPR64Opnd, GPR64Opnd, II_MOVN>,
|
2014-06-12 21:39:06 +08:00
|
|
|
ADD_FM<0, 0xb>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2011-10-18 02:53:29 +08:00
|
|
|
}
|
|
|
|
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVZ_I_S : MMRel, CMov_I_F_FT<"movz.s", GPR32Opnd, FGR32Opnd, II_MOVZ_S>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_I_F_FM<18, 16>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2013-08-07 07:01:10 +08:00
|
|
|
|
|
|
|
let isCodeGenOnly = 1 in
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVZ_I64_S : CMov_I_F_FT<"movz.s", GPR64Opnd, FGR32Opnd, II_MOVZ_S>,
|
2016-06-15 18:36:16 +08:00
|
|
|
CMov_I_F_FM<18, 16>, INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2011-10-18 02:53:29 +08:00
|
|
|
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVN_I_S : MMRel, CMov_I_F_FT<"movn.s", GPR32Opnd, FGR32Opnd, II_MOVN_S>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_I_F_FM<19, 16>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2013-08-07 07:01:10 +08:00
|
|
|
|
|
|
|
let isCodeGenOnly = 1 in
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVN_I64_S : CMov_I_F_FT<"movn.s", GPR64Opnd, FGR32Opnd, II_MOVN_S>,
|
2016-06-15 18:36:16 +08:00
|
|
|
CMov_I_F_FM<19, 16>, INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2011-10-18 02:43:19 +08:00
|
|
|
|
2014-05-07 22:25:43 +08:00
|
|
|
def MOVZ_I_D32 : MMRel, CMov_I_F_FT<"movz.d", GPR32Opnd, AFGR64Opnd,
|
2014-05-09 22:06:17 +08:00
|
|
|
II_MOVZ_D>, CMov_I_F_FM<18, 17>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_32;
|
2014-05-07 22:25:43 +08:00
|
|
|
def MOVN_I_D32 : MMRel, CMov_I_F_FT<"movn.d", GPR32Opnd, AFGR64Opnd,
|
2014-05-09 22:06:17 +08:00
|
|
|
II_MOVN_D>, CMov_I_F_FM<19, 17>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_32;
|
2013-08-07 07:01:10 +08:00
|
|
|
|
2014-05-07 22:25:43 +08:00
|
|
|
let DecoderNamespace = "Mips64" in {
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVZ_I_D64 : CMov_I_F_FT<"movz.d", GPR32Opnd, FGR64Opnd, II_MOVZ_D>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_I_F_FM<18, 17>, INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVN_I_D64 : CMov_I_F_FT<"movn.d", GPR32Opnd, FGR64Opnd, II_MOVN_D>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_I_F_FM<19, 17>, INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
2013-08-20 03:08:03 +08:00
|
|
|
let isCodeGenOnly = 1 in {
|
2014-06-12 21:39:06 +08:00
|
|
|
def MOVZ_I64_D64 : CMov_I_F_FT<"movz.d", GPR64Opnd, FGR64Opnd, II_MOVZ_D>,
|
|
|
|
CMov_I_F_FM<18, 17>, INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
|
|
|
def MOVN_I64_D64 : CMov_I_F_FT<"movn.d", GPR64Opnd, FGR64Opnd, II_MOVN_D>,
|
|
|
|
CMov_I_F_FM<19, 17>, INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
2013-08-20 03:08:03 +08:00
|
|
|
}
|
2011-10-18 02:53:29 +08:00
|
|
|
}
|
|
|
|
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVT_I : MMRel, CMov_F_I_FT<"movt", GPR32Opnd, II_MOVT, MipsCMovFP_T>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_F_I_FM<1>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2013-08-07 07:01:10 +08:00
|
|
|
|
|
|
|
let isCodeGenOnly = 1 in
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVT_I64 : CMov_F_I_FT<"movt", GPR64Opnd, II_MOVT, MipsCMovFP_T>,
|
2016-06-15 18:36:16 +08:00
|
|
|
CMov_F_I_FM<1>, INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2011-10-18 02:43:19 +08:00
|
|
|
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVF_I : MMRel, CMov_F_I_FT<"movf", GPR32Opnd, II_MOVF, MipsCMovFP_F>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_F_I_FM<0>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2013-08-07 07:01:10 +08:00
|
|
|
|
|
|
|
let isCodeGenOnly = 1 in
|
[mips][sched] Split IIArith in preparation for the first scheduler targeting a specific MIPS CPU.
IIArith -> II_ADD, II_ADDU, II_AND, II_CL[ZO], II_DADDIU, II_DADDU,
II_DROTR, II_DROTR32, II_DROTRV, II_DSLL, II_DSLL32, II_DSLLV,
II_DSR[AL], II_DSR[AL]32, II_DSR[AL]V, II_DSUBU, II_LUI, II_MOV[ZFNT],
II_NOR, II_OR, II_RDHWR, II_ROTR, II_ROTRV, II_SLL, II_SLLV, II_SR[AL],
II_SR[AL]V, II_SUBU, II_XOR
No functional change since the InstrItinData's have been duplicated.
This is necessary because the classes are shared between all schedulers.
Once this patch series is committed there will be an InstrItinClass for
each mnemonic with minimal grouping. This does increase the size of the
itinerary tables for each MIPS scheduler but we have a few options for dealing
with that later. These options include reducing the number of classes once
we see the best way to simplify them, or by extending tablegen to be able
to compress the table by eliminating duplicates entries, etc.
llvm-svn: 199391
2014-01-16 22:27:20 +08:00
|
|
|
def MOVF_I64 : CMov_F_I_FT<"movf", GPR64Opnd, II_MOVF, MipsCMovFP_F>,
|
2016-06-15 18:36:16 +08:00
|
|
|
CMov_F_I_FM<0>, INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2011-10-18 02:43:19 +08:00
|
|
|
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVT_S : MMRel, CMov_F_F_FT<"movt.s", FGR32Opnd, II_MOVT_S, MipsCMovFP_T>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_F_F_FM<16, 1>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVF_S : MMRel, CMov_F_F_FT<"movf.s", FGR32Opnd, II_MOVF_S, MipsCMovFP_F>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_F_F_FM<16, 0>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2011-10-18 02:53:29 +08:00
|
|
|
|
2014-05-07 22:25:43 +08:00
|
|
|
def MOVT_D32 : MMRel, CMov_F_F_FT<"movt.d", AFGR64Opnd, II_MOVT_D,
|
2014-05-09 22:06:17 +08:00
|
|
|
MipsCMovFP_T>, CMov_F_F_FM<17, 1>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_32;
|
2014-05-07 22:25:43 +08:00
|
|
|
def MOVF_D32 : MMRel, CMov_F_F_FT<"movf.d", AFGR64Opnd, II_MOVF_D,
|
2014-05-09 22:06:17 +08:00
|
|
|
MipsCMovFP_F>, CMov_F_F_FM<17, 0>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_32;
|
2013-08-20 03:08:03 +08:00
|
|
|
|
2014-05-07 22:25:43 +08:00
|
|
|
let DecoderNamespace = "Mips64" in {
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVT_D64 : CMov_F_F_FT<"movt.d", FGR64Opnd, II_MOVT_D, MipsCMovFP_T>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_F_F_FM<17, 1>, INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
2014-01-21 19:28:03 +08:00
|
|
|
def MOVF_D64 : CMov_F_F_FT<"movf.d", FGR64Opnd, II_MOVF_D, MipsCMovFP_F>,
|
2014-06-12 21:39:06 +08:00
|
|
|
CMov_F_F_FM<17, 0>, INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
2011-10-18 02:43:19 +08:00
|
|
|
}
|
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
// Instantiation of conditional move patterns.
|
|
|
|
defm : MovzPats0<GPR32, GPR32, MOVZ_I_I, SLT, SLTu, SLTi, SLTiu>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats1<GPR32, GPR32, MOVZ_I_I, XOR>, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : MovzPats2<GPR32, GPR32, MOVZ_I_I, XORi>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2014-05-07 22:25:43 +08:00
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats0<GPR32, GPR64, MOVZ_I_I64, SLT, SLTu, SLTi, SLTiu>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats0<GPR64, GPR32, MOVZ_I_I, SLT64, SLTu64, SLTi64, SLTiu64>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats0<GPR64, GPR64, MOVZ_I_I64, SLT64, SLTu64, SLTi64, SLTiu64>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats1<GPR32, GPR64, MOVZ_I_I64, XOR>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats1<GPR64, GPR32, MOVZ_I64_I, XOR64>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats1<GPR64, GPR64, MOVZ_I64_I64, XOR64>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats2<GPR32, GPR64, MOVZ_I_I64, XORi>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats2<GPR64, GPR32, MOVZ_I64_I, XORi64>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats2<GPR64, GPR64, MOVZ_I64_I64, XORi64>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovnPats<GPR32, GPR32, MOVN_I_I, XOR>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2014-06-12 21:39:06 +08:00
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovnPats<GPR32, GPR64, MOVN_I_I64, XOR>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
GPR_64;
|
|
|
|
defm : MovnPats<GPR64, GPR32, MOVN_I64_I, XOR64>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
GPR_64;
|
|
|
|
defm : MovnPats<GPR64, GPR64, MOVN_I64_I64, XOR64>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
GPR_64;
|
2011-10-18 02:43:19 +08:00
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats0<GPR32, FGR32, MOVZ_I_S, SLT, SLTu, SLTi, SLTiu>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : MovzPats1<GPR32, FGR32, MOVZ_I_S, XOR>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2014-06-12 21:39:06 +08:00
|
|
|
defm : MovnPats<GPR32, FGR32, MOVN_I_S, XOR>, INSN_MIPS4_32_NOT_32R6_64R6;
|
2011-10-18 02:43:19 +08:00
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats0<GPR64, FGR32, MOVZ_I_S, SLT64, SLTu64, SLTi64, SLTiu64>,
|
2016-03-01 18:08:01 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats1<GPR64, FGR32, MOVZ_I64_S, XOR64>, INSN_MIPS4_32_NOT_32R6_64R6,
|
2014-05-07 22:25:43 +08:00
|
|
|
GPR_64;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovnPats<GPR64, FGR32, MOVN_I64_S, XOR64>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
GPR_64;
|
|
|
|
|
|
|
|
defm : MovzPats0<GPR32, AFGR64, MOVZ_I_D32, SLT, SLTu, SLTi, SLTiu>,
|
2014-06-12 21:39:06 +08:00
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_32;
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats1<GPR32, AFGR64, MOVZ_I_D32, XOR>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
FGR_32;
|
|
|
|
defm : MovnPats<GPR32, AFGR64, MOVN_I_D32, XOR>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
FGR_32;
|
2014-05-07 22:25:43 +08:00
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
defm : MovzPats0<GPR32, FGR64, MOVZ_I_D64, SLT, SLTu, SLTi, SLTiu>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
|
|
|
defm : MovzPats0<GPR64, FGR64, MOVZ_I_D64, SLT64, SLTu64, SLTi64, SLTiu64>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
|
|
|
defm : MovzPats1<GPR32, FGR64, MOVZ_I_D64, XOR>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
FGR_64;
|
|
|
|
defm : MovzPats1<GPR64, FGR64, MOVZ_I64_D64, XOR64>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6, FGR_64;
|
|
|
|
defm : MovnPats<GPR32, FGR64, MOVN_I_D64, XOR>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
FGR_64;
|
|
|
|
defm : MovnPats<GPR64, FGR64, MOVN_I64_D64, XOR64>, INSN_MIPS4_32_NOT_32R6_64R6,
|
|
|
|
FGR_64;
|
2014-12-12 22:41:37 +08:00
|
|
|
|
2016-09-09 17:22:52 +08:00
|
|
|
multiclass FPSetccPats<Instruction MOVT, Instruction MOVF, dag ADD,
|
|
|
|
RegisterOperand RC> {
|
|
|
|
def : MipsPat<(seteq RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_EQ_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setgt RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_ULE_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setge RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_ULT_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setlt RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_OLT_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setle RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_OLE_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setne RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_UEQ_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setoeq RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_EQ_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setogt RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_ULE_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setoge RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_ULT_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setolt RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_OLT_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setole RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_OLE_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setone RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_UEQ_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(seto RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_UN_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setuo RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_UN_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setueq RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_UEQ_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setugt RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_OLE_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setuge RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_OLT_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setult RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_ULT_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setule RC:$lhs, RC:$rhs),
|
|
|
|
(MOVF ZERO, (!cast<Instruction>("C_ULE_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
def : MipsPat<(setune RC:$lhs, RC:$rhs),
|
|
|
|
(MOVT ZERO, (!cast<Instruction>("C_EQ_"#NAME) RC:$lhs, RC:$rhs),
|
|
|
|
ADD)>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let AdditionalPredicates = [NotInMicroMips] in {
|
|
|
|
defm S : FPSetccPats<MOVT_I, MOVF_I, (ADDiu ZERO, 1), FGR32Opnd>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm D32 : FPSetccPats<MOVT_I, MOVF_I, (ADDiu ZERO, 1), AFGR64Opnd>, FGR_32,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm D64 : FPSetccPats<MOVT_I, MOVF_I, (ADDiu ZERO, 1), FGR64Opnd>, FGR_64,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass FPSelectPats<RegisterOperand RC, RegisterOperand RO, string Type,
|
|
|
|
Instruction MOVT, Instruction MOVF> {
|
|
|
|
// Ordered
|
|
|
|
def : MipsPat<(select (i32 (setoeq RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_EQ_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setogt RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_ULE_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setoge RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_ULT_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setolt RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_OLT_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setole RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_OLE_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setone RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_UEQ_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (seto RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_UN_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
// Unordered
|
|
|
|
def : MipsPat<(select (i32 (setuo RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_UN_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setueq RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_UEQ_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setugt RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_ULE_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setuge RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_ULE_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setult RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_ULT_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setule RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_ULE_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setune RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_UEQ_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setuo RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_EQ_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
// Unspecified ordering - treated as ordered.
|
|
|
|
def : MipsPat<(select (i32 (seteq RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_EQ_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setgt RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_OLE_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setge RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_LT_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setlt RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_LT_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setle RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVT RO:$t, (!cast<Instruction>("C_OLE_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
def : MipsPat<(select (i32 (setne RC:$lhs, RC:$rhs)), RO:$t, RO:$f),
|
|
|
|
(MOVF RO:$t, (!cast<Instruction>("C_EQ_"#Type) RC:$lhs,
|
|
|
|
RC:$rhs),
|
|
|
|
RO:$f)>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let AdditionalPredicates = [NotInMicroMips] in {
|
|
|
|
defm : FPSelectPats<FGR32Opnd, FGR32Opnd, "S", MOVT_S, MOVF_S>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<FGR32Opnd, AFGR64Opnd, "S", MOVT_D32, MOVF_D32>,
|
|
|
|
FGR_32, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<FGR32Opnd, FGR64Opnd, "S", MOVT_D64, MOVF_D64>,
|
|
|
|
FGR_64, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
|
|
|
|
defm : FPSelectPats<AFGR64Opnd, AFGR64Opnd, "D32", MOVT_D32, MOVF_D32>,
|
|
|
|
FGR_32, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<AFGR64Opnd, FGR32Opnd, "D32", MOVT_S, MOVF_S>,
|
|
|
|
FGR_32, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
|
|
|
|
|
|
|
|
defm : FPSelectPats<FGR64Opnd, FGR64Opnd, "D64", MOVT_D64, MOVF_D64>,
|
|
|
|
FGR_64, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<FGR64Opnd, FGR32Opnd, "D64", MOVT_S, MOVF_S>,
|
|
|
|
FGR_64, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
|
|
|
|
defm : FPSelectPats<FGR32Opnd, GPR32Opnd, "S", MOVT_I, MOVF_I>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<AFGR64Opnd, GPR32Opnd, "D32", MOVT_I, MOVF_I>,
|
|
|
|
FGR_32, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<FGR64Opnd, GPR32Opnd, "D64", MOVT_I, MOVF_I>,
|
|
|
|
FGR_64, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
|
|
|
|
defm : FPSelectPats<FGR32Opnd, GPR64Opnd,"S", MOVT_I64, MOVF_I64>,
|
|
|
|
INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<AFGR64Opnd, GPR64Opnd, "D32", MOVT_I64, MOVF_I64>,
|
|
|
|
FGR_32, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
defm : FPSelectPats<FGR64Opnd, GPR64Opnd, "D64", MOVT_I64, MOVF_I64>,
|
|
|
|
FGR_64, INSN_MIPS4_32_NOT_32R6_64R6;
|
|
|
|
}
|
|
|
|
|
2014-12-12 22:41:37 +08:00
|
|
|
// For targets that don't have conditional-move instructions
|
|
|
|
// we have to match SELECT nodes with pseudo instructions.
|
|
|
|
let usesCustomInserter = 1 in {
|
2016-03-02 04:25:43 +08:00
|
|
|
class Select_Pseudo<RegisterOperand RC> :
|
2016-09-09 17:22:52 +08:00
|
|
|
PseudoSE<(outs RC:$dst), (ins RC:$T, GPR32Opnd:$cond, RC:$F),
|
2016-03-02 04:25:43 +08:00
|
|
|
[(set RC:$dst, (select GPR32Opnd:$cond, RC:$T, RC:$F))]>,
|
2014-12-12 22:41:37 +08:00
|
|
|
ISA_MIPS1_NOT_4_32;
|
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
class SelectFP_Pseudo_T<RegisterOperand RC> :
|
2016-09-09 17:22:52 +08:00
|
|
|
PseudoSE<(outs RC:$dst), (ins RC:$T, FCC:$cond, RC:$F),
|
|
|
|
[(set RC:$dst, (MipsCMovFP_T RC:$T, FCC:$cond, RC:$F))]>,
|
2014-12-12 22:41:37 +08:00
|
|
|
ISA_MIPS1_NOT_4_32;
|
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
class SelectFP_Pseudo_F<RegisterOperand RC> :
|
2016-09-09 17:22:52 +08:00
|
|
|
PseudoSE<(outs RC:$dst), (ins RC:$T, FCC:$cond, RC:$F),
|
|
|
|
[(set RC:$dst, (MipsCMovFP_F RC:$T, FCC:$cond, RC:$F))]>,
|
2014-12-12 22:41:37 +08:00
|
|
|
ISA_MIPS1_NOT_4_32;
|
|
|
|
}
|
|
|
|
|
2016-03-02 04:25:43 +08:00
|
|
|
def PseudoSELECT_I : Select_Pseudo<GPR32Opnd>;
|
|
|
|
def PseudoSELECT_I64 : Select_Pseudo<GPR64Opnd>;
|
|
|
|
def PseudoSELECT_S : Select_Pseudo<FGR32Opnd>;
|
|
|
|
def PseudoSELECT_D32 : Select_Pseudo<AFGR64Opnd>, FGR_32;
|
|
|
|
def PseudoSELECT_D64 : Select_Pseudo<FGR64Opnd>, FGR_64;
|
2014-12-12 22:41:37 +08:00
|
|
|
|
|
|
|
def PseudoSELECTFP_T_I : SelectFP_Pseudo_T<GPR32Opnd>;
|
2014-12-12 23:16:46 +08:00
|
|
|
def PseudoSELECTFP_T_I64 : SelectFP_Pseudo_T<GPR64Opnd>;
|
2014-12-12 22:41:37 +08:00
|
|
|
def PseudoSELECTFP_T_S : SelectFP_Pseudo_T<FGR32Opnd>;
|
2014-12-12 23:16:46 +08:00
|
|
|
def PseudoSELECTFP_T_D32 : SelectFP_Pseudo_T<AFGR64Opnd>, FGR_32;
|
|
|
|
def PseudoSELECTFP_T_D64 : SelectFP_Pseudo_T<FGR64Opnd>, FGR_64;
|
2014-12-12 22:41:37 +08:00
|
|
|
|
|
|
|
def PseudoSELECTFP_F_I : SelectFP_Pseudo_F<GPR32Opnd>;
|
2014-12-12 23:16:46 +08:00
|
|
|
def PseudoSELECTFP_F_I64 : SelectFP_Pseudo_F<GPR64Opnd>;
|
2014-12-12 22:41:37 +08:00
|
|
|
def PseudoSELECTFP_F_S : SelectFP_Pseudo_F<FGR32Opnd>;
|
2014-12-12 23:16:46 +08:00
|
|
|
def PseudoSELECTFP_F_D32 : SelectFP_Pseudo_F<AFGR64Opnd>, FGR_32;
|
|
|
|
def PseudoSELECTFP_F_D64 : SelectFP_Pseudo_F<FGR64Opnd>, FGR_64;
|
2016-09-09 17:22:52 +08:00
|
|
|
|
|
|
|
let AdditionalPredicates = [NotInMicroMips] in {
|
|
|
|
defm : FPSelectPats<FGR32Opnd, FGR32Opnd, "S", PseudoSELECTFP_T_S,
|
|
|
|
PseudoSELECTFP_F_S>, ISA_MIPS1_NOT_4_32;
|
|
|
|
defm : FPSelectPats<AFGR64Opnd, AFGR64Opnd, "D32", PseudoSELECTFP_T_D32,
|
|
|
|
PseudoSELECTFP_F_D32>, FGR_32, ISA_MIPS1_NOT_4_32;
|
|
|
|
defm : FPSelectPats<FGR64Opnd, FGR64Opnd, "D64", PseudoSELECTFP_T_D64,
|
|
|
|
PseudoSELECTFP_F_D64>, FGR_64, ISA_MIPS1_NOT_4_32;
|
|
|
|
}
|