// Conditional moves: // These instructions are expanded in // MipsISelLowering::EmitInstrWithCustomInserter if target does not have // conditional move instructions. // cond:int, data:int class CondMovIntInt funct, string instr_asm> : FR<0, funct, (outs DRC:$rd), (ins DRC:$rs, CRC:$rt, DRC:$F), !strconcat(instr_asm, "\t$rd, $rs, $rt"), [], NoItinerary> { let shamt = 0; let Constraints = "$F = $rd"; } // cond:int, data:float class CondMovIntFP fmt, bits<6> func, string instr_asm> : FFR<0x11, func, fmt, (outs DRC:$fd), (ins DRC:$fs, CRC:$rt, DRC:$F), !strconcat(instr_asm, "\t$fd, $fs, $rt"), []> { bits<5> rt; let ft = rt; let Constraints = "$F = $fd"; } // cond:float, data:int class CondMovFPInt tf, string instr_asm> : FCMOV { let cc = 0; let Uses = [FCR31]; let Constraints = "$F = $rd"; } // cond:float, data:float class CondMovFPFP fmt, bits<1> tf, string instr_asm> : FFCMOV { let cc = 0; let Uses = [FCR31]; let Constraints = "$F = $fd"; } // select patterns multiclass MovzPats0 { def : Pat<(select (i32 (setge CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, (SLTOp CRC:$lhs, CRC:$rhs), DRC:$F)>; def : Pat<(select (i32 (setuge CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, (SLTuOp CRC:$lhs, CRC:$rhs), DRC:$F)>; def : Pat<(select (i32 (setge CRC:$lhs, immSExt16:$rhs)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, (SLTiOp CRC:$lhs, immSExt16:$rhs), DRC:$F)>; def : Pat<(select (i32 (setuge CRC:$lh, immSExt16:$rh)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, (SLTiuOp CRC:$lh, immSExt16:$rh), DRC:$F)>; def : Pat<(select (i32 (setle CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, (SLTOp CRC:$rhs, CRC:$lhs), DRC:$F)>; def : Pat<(select (i32 (setule CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, (SLTuOp CRC:$rhs, CRC:$lhs), DRC:$F)>; } multiclass MovzPats1 { def : Pat<(select (i32 (seteq CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, (XOROp CRC:$lhs, CRC:$rhs), DRC:$F)>; def : Pat<(select (i32 (seteq CRC:$lhs, 0)), DRC:$T, DRC:$F), (MOVZInst DRC:$T, CRC:$lhs, DRC:$F)>; } multiclass MovnPats { def : Pat<(select (i32 (setne CRC:$lhs, CRC:$rhs)), DRC:$T, DRC:$F), (MOVNInst DRC:$T, (XOROp CRC:$lhs, CRC:$rhs), DRC:$F)>; def : Pat<(select CRC:$cond, DRC:$T, DRC:$F), (MOVNInst DRC:$T, CRC:$cond, DRC:$F)>; def : Pat<(select (i32 (setne CRC:$lhs, 0)),DRC:$T, DRC:$F), (MOVNInst DRC:$T, CRC:$lhs, DRC:$F)>; } // Instantiation of instructions. def MOVZ_I_I : CondMovIntInt; let Predicates = [HasMips64] in { def MOVZ_I_I64 : CondMovIntInt; def MOVZ_I64_I : CondMovIntInt; def MOVZ_I64_I64 : CondMovIntInt; } def MOVN_I_I : CondMovIntInt; let Predicates = [HasMips64] in { def MOVN_I_I64 : CondMovIntInt; def MOVN_I64_I : CondMovIntInt; def MOVN_I64_I64 : CondMovIntInt; } def MOVZ_I_S : CondMovIntFP; def MOVZ_I64_S : CondMovIntFP, Requires<[HasMips64]>; def MOVN_I_S : CondMovIntFP; def MOVN_I64_S : CondMovIntFP, Requires<[HasMips64]>; let Predicates = [NotFP64bit] in { def MOVZ_I_D32 : CondMovIntFP; def MOVN_I_D32 : CondMovIntFP; } let Predicates = [IsFP64bit] in { def MOVZ_I_D64 : CondMovIntFP; def MOVZ_I64_D64 : CondMovIntFP; def MOVN_I_D64 : CondMovIntFP; def MOVN_I64_D64 : CondMovIntFP; } def MOVT_I : CondMovFPInt; def MOVT_I64 : CondMovFPInt, Requires<[HasMips64]>; def MOVF_I : CondMovFPInt; def MOVF_I64 : CondMovFPInt, Requires<[HasMips64]>; def MOVT_S : CondMovFPFP; def MOVF_S : CondMovFPFP; let Predicates = [NotFP64bit] in { def MOVT_D32 : CondMovFPFP; def MOVF_D32 : CondMovFPFP; } let Predicates = [IsFP64bit] in { def MOVT_D64 : CondMovFPFP; def MOVF_D64 : CondMovFPFP; } // Instantiation of conditional move patterns. defm : MovzPats0; defm : MovzPats1; let Predicates = [HasMips64] in { defm : MovzPats0; defm : MovzPats0; defm : MovzPats0; defm : MovzPats1; defm : MovzPats1; defm : MovzPats1; } defm : MovnPats; let Predicates = [HasMips64] in { defm : MovnPats; defm : MovnPats; defm : MovnPats; } defm : MovzPats0; defm : MovzPats1; defm : MovnPats; let Predicates = [HasMips64] in { defm : MovzPats0; defm : MovzPats1; defm : MovnPats; } let Predicates = [NotFP64bit] in { defm : MovzPats0; defm : MovzPats1; defm : MovnPats; } let Predicates = [IsFP64bit] in { defm : MovzPats0; defm : MovzPats0; defm : MovzPats1; defm : MovzPats1; defm : MovnPats; defm : MovnPats; }