diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -528,6 +528,14 @@ // SEW = 0 is used to denote that the Pseudo is not SEW specific (or unknown). bits<8> SEW = 0; bit NeedBeInPseudoTable = 1; + // TargetOverlapConstraintType indicates that these instructions can + // overlap between source operands and destination operands. + // 1 -> default value, remain current constraint + // 2 -> narrow case + // 3 -> widen case + // TODO: Add TargetOverlapConstraintType into PseudosTable for further + // query. + bits<2> TargetOverlapConstraintType = 1; } // The actual table. @@ -866,7 +874,8 @@ int EEW, bits<3> LMUL, bit Ordered, - bit EarlyClobber> : + bit EarlyClobber, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$dest, GPRMem:$rs1, IdxClass:$rs2, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -879,6 +888,7 @@ let HasSEWOp = 1; let HasVecPolicyOp = 1; let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd, $rd = $dest", "$rd = $dest"); + let TargetOverlapConstraintType = TargetConstraintType; } class VPseudoILoadMask LMUL, bit Ordered, - bit EarlyClobber> : + bit EarlyClobber, + int TargetConstraintType = 1> : Pseudo<(outs GetVRegNoV0.R:$rd), (ins GetVRegNoV0.R:$merge, GPRMem:$rs1, IdxClass:$rs2, @@ -897,6 +908,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd, $rd = $merge", "$rd = $merge"); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1006,7 +1018,8 @@ class VPseudoUnaryNoMask : + string Constraint = "", + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, OpClass:$rs2, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1015,6 +1028,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1022,7 +1036,8 @@ class VPseudoUnaryNoMaskRoundingMode : + string Constraint = "", + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, OpClass:$rs2, ixlenimm:$rm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1031,6 +1046,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1040,7 +1056,8 @@ class VPseudoUnaryMask : + string Constraint = "", + int TargetConstraintType = 1> : Pseudo<(outs GetVRegNoV0.R:$rd), (ins GetVRegNoV0.R:$merge, OpClass:$rs2, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1049,6 +1066,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1168,7 +1186,8 @@ class VPseudoBinaryNoMask : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew), []>, RISCVVPseudo { @@ -1176,6 +1195,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = Constraint; + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; } @@ -1183,7 +1203,8 @@ class VPseudoBinaryNoMaskTU : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1192,6 +1213,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1201,7 +1223,8 @@ VReg Op1Class, DAGOperand Op2Class, string Constraint, - int UsesVXRM_ = 1> : + int UsesVXRM_ = 1, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, Op1Class:$rs2, Op2Class:$rs1, ixlenimm:$rm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1209,6 +1232,7 @@ let mayLoad = 0; let mayStore = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1220,7 +1244,8 @@ RegisterClass Op1Class, DAGOperand Op2Class, string Constraint, - int UsesVXRM_> : + int UsesVXRM_, + int TargetConstraintType = 1> : Pseudo<(outs GetVRegNoV0.R:$rd), (ins GetVRegNoV0.R:$merge, Op1Class:$rs2, Op2Class:$rs1, @@ -1230,6 +1255,7 @@ let mayLoad = 0; let mayStore = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1243,7 +1269,8 @@ // This allows maskedoff and rs2 to be the same register. class VPseudoTiedBinaryNoMask : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1252,6 +1279,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $rs2"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1261,7 +1289,8 @@ class VPseudoTiedBinaryNoMaskRoundingMode : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$rs2, Op2Class:$rs1, ixlenimm:$rm, @@ -1272,6 +1301,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $rs2"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1329,7 +1359,8 @@ class VPseudoBinaryMaskPolicy : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs GetVRegNoV0.R:$rd), (ins GetVRegNoV0.R:$merge, Op1Class:$rs2, Op2Class:$rs1, @@ -1339,6 +1370,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1389,7 +1421,8 @@ class VPseudoBinaryMOutNoMask : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew), []>, RISCVVPseudo { @@ -1397,6 +1430,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = Constraint; + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; } @@ -1405,7 +1439,8 @@ class VPseudoBinaryMOutMask : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, Op1Class:$rs2, Op2Class:$rs1, @@ -1415,6 +1450,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let UsesMaskPolicy = 1; @@ -1425,7 +1461,8 @@ // This allows maskedoff and rs2 to be the same register. class VPseudoTiedBinaryMask : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs GetVRegNoV0.R:$rd), (ins GetVRegNoV0.R:$merge, Op2Class:$rs1, @@ -1435,6 +1472,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1444,7 +1482,8 @@ class VPseudoTiedBinaryMaskRoundingMode : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs GetVRegNoV0.R:$rd), (ins GetVRegNoV0.R:$merge, Op2Class:$rs1, @@ -1456,6 +1495,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $merge"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let HasVecPolicyOp = 1; @@ -1470,7 +1510,8 @@ DAGOperand Op2Class, LMULInfo MInfo, bit CarryIn, - string Constraint> : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), !if(CarryIn, (ins Op1Class:$rs2, Op2Class:$rs1, @@ -1482,6 +1523,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = Constraint; + let TargetOverlapConstraintType = TargetConstraintType; let HasVLOp = 1; let HasSEWOp = 1; let VLMul = MInfo.value; @@ -1529,7 +1571,8 @@ class VPseudoTernaryNoMaskWithPolicy : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$rs3, Op1Class:$rs1, Op2Class:$rs2, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1538,6 +1581,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $rs3"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVecPolicyOp = 1; let HasVLOp = 1; let HasSEWOp = 1; @@ -1546,7 +1590,8 @@ class VPseudoTernaryNoMaskWithPolicyRoundingMode : + string Constraint, + int TargetConstraintType = 1> : Pseudo<(outs RetClass:$rd), (ins RetClass:$rs3, Op1Class:$rs1, Op2Class:$rs2, ixlenimm:$rm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, @@ -1555,6 +1600,7 @@ let mayStore = 0; let hasSideEffects = 0; let Constraints = !interleave([Constraint, "$rd = $rs3"], ","); + let TargetOverlapConstraintType = TargetConstraintType; let HasVecPolicyOp = 1; let HasVLOp = 1; let HasSEWOp = 1; @@ -1888,12 +1934,14 @@ defvar Vreg = dataEMUL.vrclass; defvar IdxVreg = idxEMUL.vrclass; defvar HasConstraint = !ne(dataEEW, idxEEW); + defvar TypeConstraints = + !if(!eq(dataEEW, idxEEW), 1, !if(!gt(dataEEW, idxEEW), !if(!ge(idxEMULOctuple, 8), 3, 1), 2)); let VLMul = dataEMUL.value in { def "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo : - VPseudoILoadNoMask, + VPseudoILoadNoMask, VLXSched; def "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo # "_MASK" : - VPseudoILoadMask, + VPseudoILoadMask, RISCVMaskedPseudo, VLXSched; } @@ -2071,13 +2119,14 @@ DAGOperand Op2Class, LMULInfo MInfo, string Constraint = "", - int sew = 0> { + int sew = 0, + int TargetConstraintType = 1> { let VLMul = MInfo.value, SEW=sew in { defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); def suffix : VPseudoBinaryNoMaskTU; + Constraint, TargetConstraintType>; def suffix # "_MASK" : VPseudoBinaryMaskPolicy, + Constraint, TargetConstraintType>, RISCVMaskedPseudo; } } @@ -2101,16 +2150,19 @@ LMULInfo MInfo, string Constraint = "", int sew = 0, - int UsesVXRM = 1> { + int UsesVXRM = 1, + int TargetConstraintType = 1> { let VLMul = MInfo.value, SEW=sew in { defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); def suffix : VPseudoBinaryNoMaskRoundingMode; + Constraint, UsesVXRM, + TargetConstraintType>; def suffix # "_MASK" : VPseudoBinaryMaskPolicyRoundingMode, + UsesVXRM, + TargetConstraintType>, RISCVMaskedPseudo; } } @@ -2120,13 +2172,14 @@ VReg Op1Class, DAGOperand Op2Class, LMULInfo MInfo, - string Constraint = ""> { + string Constraint = "", + int TargetConstraintType = 1> { let VLMul = MInfo.value in { def "_" # MInfo.MX : VPseudoBinaryMOutNoMask; + Constraint, TargetConstraintType>; let ForceTailAgnostic = true in def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMOutMask, + Op2Class, Constraint, TargetConstraintType>, RISCVMaskedPseudo; } } @@ -2151,24 +2204,26 @@ multiclass VPseudoTiedBinary { + string Constraint = "", + int TargetConstraintType = 1> { let VLMul = MInfo.value in { def "_" # MInfo.MX # "_TIED": VPseudoTiedBinaryNoMask; + Constraint, TargetConstraintType>; def "_" # MInfo.MX # "_MASK_TIED" : VPseudoTiedBinaryMask; + Constraint, TargetConstraintType>; } } multiclass VPseudoTiedBinaryRoundingMode { + string Constraint = "", + int TargetConstraintType = 1> { let VLMul = MInfo.value in { def "_" # MInfo.MX # "_TIED": - VPseudoTiedBinaryNoMaskRoundingMode; + VPseudoTiedBinaryNoMaskRoundingMode; def "_" # MInfo.MX # "_MASK_TIED" : - VPseudoTiedBinaryMaskRoundingMode; + VPseudoTiedBinaryMaskRoundingMode; } } @@ -2280,22 +2335,23 @@ // destination register group is legal. Otherwise, it is illegal. multiclass VPseudoBinaryW_VV { defm _VV : VPseudoBinary; + "@earlyclobber $rd", TargetConstraintType=3>; } multiclass VPseudoBinaryW_VV_RM { defm _VV : VPseudoBinaryRoundingMode; + "@earlyclobber $rd", UsesVXRM=0, + TargetConstraintType=3>; } multiclass VPseudoBinaryW_VX { defm "_VX" : VPseudoBinary; + "@earlyclobber $rd", TargetConstraintType=3>; } multiclass VPseudoBinaryW_VI { defm "_VI" : VPseudoBinary; + "@earlyclobber $rd", TargetConstraintType=3>; } multiclass VPseudoBinaryW_VF { @@ -2308,36 +2364,40 @@ defm "_V" # f.FX : VPseudoBinaryRoundingMode; + UsesVXRM=0, + TargetConstraintType=3>; } multiclass VPseudoBinaryW_WV { defm _WV : VPseudoBinary; + "@earlyclobber $rd", TargetConstraintType=3>; defm _WV : VPseudoTiedBinary; + "@earlyclobber $rd", TargetConstraintType=3>; } multiclass VPseudoBinaryW_WV_RM { defm _WV : VPseudoBinaryRoundingMode; + "@earlyclobber $rd", UsesVXRM=0, TargetConstraintType=3>; defm _WV : VPseudoTiedBinaryRoundingMode; + "@earlyclobber $rd", TargetConstraintType=3>; } multiclass VPseudoBinaryW_WX { - defm "_WX" : VPseudoBinary; + defm "_WX" : VPseudoBinary; } -multiclass VPseudoBinaryW_WF { +multiclass VPseudoBinaryW_WF { defm "_W" # f.FX : VPseudoBinary; + f.fprclass, m, /*Constraint*/ "", TargetConstraintType=TargetConstraintType>; } multiclass VPseudoBinaryW_WF_RM { defm "_W" # f.FX : VPseudoBinaryRoundingMode; + Constraint="", + sew=0, + UsesVXRM=0, + TargetConstraintType=3>; } // Narrowing instructions like vnsrl/vnsra/vnclip(u) don't need @earlyclobber @@ -2345,9 +2405,9 @@ // exception from the spec. // "The destination EEW is smaller than the source EEW and the overlap is in the // lowest-numbered part of the source register group." -multiclass VPseudoBinaryV_WV { +multiclass VPseudoBinaryV_WV { defm _WV : VPseudoBinary; + !if(!ge(m.octuple, 8), "@earlyclobber $rd", ""), TargetConstraintType=TargetConstraintType>; } multiclass VPseudoBinaryV_WV_RM { @@ -2356,9 +2416,9 @@ "@earlyclobber $rd", "")>; } -multiclass VPseudoBinaryV_WX { +multiclass VPseudoBinaryV_WX { defm _WX : VPseudoBinary; + !if(!ge(m.octuple, 8), "@earlyclobber $rd", ""), TargetConstraintType=TargetConstraintType>; } multiclass VPseudoBinaryV_WX_RM { @@ -2367,9 +2427,9 @@ "@earlyclobber $rd", "")>; } -multiclass VPseudoBinaryV_WI { +multiclass VPseudoBinaryV_WI { defm _WI : VPseudoBinary; + !if(!ge(m.octuple, 8), "@earlyclobber $rd", ""), TargetConstraintType=TargetConstraintType>; } multiclass VPseudoBinaryV_WI_RM { @@ -2383,13 +2443,14 @@ // For vadc and vsbc, CarryIn == 1 and CarryOut == 0 multiclass VPseudoBinaryV_VM { + bit Commutable = 0, + int TargetConstraintType = 1> { let isCommutable = Commutable in def "_VV" # !if(CarryIn, "M", "") # "_" # m.MX : VPseudoBinaryCarryIn.R, m.vrclass)), - m.vrclass, m.vrclass, m, CarryIn, Constraint>; + m.vrclass, m.vrclass, m, CarryIn, Constraint, TargetConstraintType>; } multiclass VPseudoTiedBinaryV_VM { @@ -2399,12 +2460,12 @@ } multiclass VPseudoBinaryV_XM { + string Constraint = "", int TargetConstraintType = 1> { def "_VX" # !if(CarryIn, "M", "") # "_" # m.MX : VPseudoBinaryCarryIn.R, m.vrclass)), - m.vrclass, GPR, m, CarryIn, Constraint>; + m.vrclass, GPR, m, CarryIn, Constraint, TargetConstraintType>; } multiclass VPseudoTiedBinaryV_XM { @@ -2428,12 +2489,12 @@ } multiclass VPseudoBinaryV_IM { + string Constraint = "", int TargetConstraintType = 1> { def "_VI" # !if(CarryIn, "M", "") # "_" # m.MX : VPseudoBinaryCarryIn.R, m.vrclass)), - m.vrclass, simm5, m, CarryIn, Constraint>; + m.vrclass, simm5, m, CarryIn, Constraint, TargetConstraintType>; } multiclass VPseudoTiedBinaryV_IM { @@ -2541,45 +2602,45 @@ } } -multiclass PseudoVEXT_VF2 { +multiclass PseudoVEXT_VF2 { defvar constraints = "@earlyclobber $rd"; foreach m = MxListVF2 in { defvar mx = m.MX; let VLMul = m.value in { - def "_" # mx : VPseudoUnaryNoMask, + def "_" # mx : VPseudoUnaryNoMask, SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; def "_" # mx # "_MASK" : - VPseudoUnaryMask, + VPseudoUnaryMask, RISCVMaskedPseudo, SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; } } } -multiclass PseudoVEXT_VF4 { +multiclass PseudoVEXT_VF4 { defvar constraints = "@earlyclobber $rd"; foreach m = MxListVF4 in { defvar mx = m.MX; let VLMul = m.value in { - def "_" # mx : VPseudoUnaryNoMask, + def "_" # mx : VPseudoUnaryNoMask, SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; def "_" # mx # "_MASK" : - VPseudoUnaryMask, + VPseudoUnaryMask, RISCVMaskedPseudo, SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; } } } -multiclass PseudoVEXT_VF8 { +multiclass PseudoVEXT_VF8 { defvar constraints = "@earlyclobber $rd"; foreach m = MxListVF8 in { defvar mx = m.MX; let VLMul = m.value in { - def "_" # mx : VPseudoUnaryNoMask, + def "_" # mx : VPseudoUnaryNoMask, SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; def "_" # mx # "_MASK" : - VPseudoUnaryMask, + VPseudoUnaryMask, RISCVMaskedPseudo, SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; } @@ -2597,26 +2658,26 @@ // lowest-numbered part of the source register group". // With LMUL<=1 the source and dest occupy a single register so any overlap // is in the lowest-numbered part. -multiclass VPseudoBinaryM_VV { +multiclass VPseudoBinaryM_VV { defm _VV : VPseudoBinaryM; + !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>; } -multiclass VPseudoBinaryM_VX { +multiclass VPseudoBinaryM_VX { defm "_VX" : VPseudoBinaryM; + !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>; } -multiclass VPseudoBinaryM_VF { +multiclass VPseudoBinaryM_VF { defm "_V" # f.FX : VPseudoBinaryM; + !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>; } -multiclass VPseudoBinaryM_VI { +multiclass VPseudoBinaryM_VI { defm _VI : VPseudoBinaryM; + !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>; } multiclass VPseudoVGTR_VV_VX_VI { @@ -2922,7 +2983,7 @@ defm "" : VPseudoBinaryW_VV, SchedBinary<"WriteVIWALUV", "ReadVIWALUV", "ReadVIWALUV", mx, forceMergeOpRead=true>; - defm "" : VPseudoBinaryW_VX, + defm "" : VPseudoBinaryW_VX, SchedBinary<"WriteVIWALUX", "ReadVIWALUV", "ReadVIWALUX", mx, forceMergeOpRead=true>; } @@ -3057,13 +3118,13 @@ foreach m = MxList in { defvar mx = m.MX; defm "" : VPseudoBinaryV_VM, + Commutable=1, TargetConstraintType=2>, SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, forceMasked=1, forceMergeOpRead=true>; - defm "" : VPseudoBinaryV_XM, + defm "" : VPseudoBinaryV_XM, SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, forceMasked=1, forceMergeOpRead=true>; - defm "" : VPseudoBinaryV_IM, + defm "" : VPseudoBinaryV_IM, SchedUnary<"WriteVICALUI", "ReadVICALUV", mx, forceMasked=1, forceMergeOpRead=true>; } @@ -3072,10 +3133,10 @@ multiclass VPseudoVCALUM_VM_XM { foreach m = MxList in { defvar mx = m.MX; - defm "" : VPseudoBinaryV_VM, + defm "" : VPseudoBinaryV_VM, SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, forceMasked=1, forceMergeOpRead=true>; - defm "" : VPseudoBinaryV_XM, + defm "" : VPseudoBinaryV_XM, SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, forceMasked=1, forceMergeOpRead=true>; } @@ -3085,10 +3146,10 @@ foreach m = MxList in { defvar mx = m.MX; defm "" : VPseudoBinaryV_VM, + Commutable=1, TargetConstraintType=2>, SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, forceMergeOpRead=true>; - defm "" : VPseudoBinaryV_XM, + defm "" : VPseudoBinaryV_XM, SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, forceMergeOpRead=true>; defm "" : VPseudoBinaryV_IM, @@ -3100,10 +3161,10 @@ multiclass VPseudoVCALUM_V_X { foreach m = MxList in { defvar mx = m.MX; - defm "" : VPseudoBinaryV_VM, + defm "" : VPseudoBinaryV_VM, SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, forceMergeOpRead=true>; - defm "" : VPseudoBinaryV_XM, + defm "" : VPseudoBinaryV_XM, SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, forceMergeOpRead=true>; } @@ -3127,13 +3188,13 @@ multiclass VPseudoVNSHT_WV_WX_WI { foreach m = MxListW in { defvar mx = m.MX; - defm "" : VPseudoBinaryV_WV, + defm "" : VPseudoBinaryV_WV, SchedBinary<"WriteVNShiftV", "ReadVNShiftV", "ReadVNShiftV", mx, forceMergeOpRead=true>; - defm "" : VPseudoBinaryV_WX, + defm "" : VPseudoBinaryV_WX, SchedBinary<"WriteVNShiftX", "ReadVNShiftV", "ReadVNShiftX", mx, forceMergeOpRead=true>; - defm "" : VPseudoBinaryV_WI, + defm "" : VPseudoBinaryV_WI, SchedUnary<"WriteVNShiftI", "ReadVNShiftV", mx, forceMergeOpRead=true>; } @@ -3178,11 +3239,12 @@ DAGOperand Op2Class, LMULInfo MInfo, string Constraint = "", - bit Commutable = 0> { + bit Commutable = 0, + int TargetConstraintType = 1> { let VLMul = MInfo.value in { let isCommutable = Commutable in - def "_" # MInfo.MX : VPseudoTernaryNoMaskWithPolicy; - def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMaskPolicy, + def "_" # MInfo.MX : VPseudoTernaryNoMaskWithPolicy; + def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMaskPolicy, RISCVMaskedPseudo; } } @@ -3192,16 +3254,19 @@ DAGOperand Op2Class, LMULInfo MInfo, string Constraint = "", - bit Commutable = 0> { + bit Commutable = 0, + int TargetConstraintType = 1> { let VLMul = MInfo.value in { let isCommutable = Commutable in def "_" # MInfo.MX : VPseudoTernaryNoMaskWithPolicyRoundingMode; + Op2Class, Constraint, + TargetConstraintType>; def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMaskPolicyRoundingMode, + UsesVXRM_=0, + TargetConstraintType=TargetConstraintType>, RISCVMaskedPseudo; } } @@ -3236,31 +3301,34 @@ multiclass VPseudoTernaryW_VV { defvar constraint = "@earlyclobber $rd"; defm _VV : VPseudoTernaryWithPolicy; + constraint, /*Commutable*/ 0, TargetConstraintType=3>; } multiclass VPseudoTernaryW_VV_RM { defvar constraint = "@earlyclobber $rd"; defm _VV : VPseudoTernaryWithPolicyRoundingMode; + constraint, /* Commutable */ 0, + TargetConstraintType=3>; } multiclass VPseudoTernaryW_VX { defvar constraint = "@earlyclobber $rd"; defm "_VX" : VPseudoTernaryWithPolicy; + constraint, /*Commutable*/ 0, TargetConstraintType=3>; } -multiclass VPseudoTernaryW_VF { +multiclass VPseudoTernaryW_VF { defvar constraint = "@earlyclobber $rd"; defm "_V" # f.FX : VPseudoTernaryWithPolicy; + m.vrclass, m, constraint, /*Commutable*/ 0, TargetConstraintType>; } multiclass VPseudoTernaryW_VF_RM { defvar constraint = "@earlyclobber $rd"; defm "_V" # f.FX : VPseudoTernaryWithPolicyRoundingMode; + m.vrclass, m, constraint, + /* Commutable */ 0, + TargetConstraintType=3>; } multiclass VPseudoVSLDVWithPolicy, + defm "" : VPseudoBinaryM_VV, SchedBinary<"WriteVICmpV", "ReadVICmpV", "ReadVICmpV", mx>; - defm "" : VPseudoBinaryM_VX, + defm "" : VPseudoBinaryM_VX, SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>; - defm "" : VPseudoBinaryM_VI, + defm "" : VPseudoBinaryM_VI, SchedUnary<"WriteVICmpI", "ReadVICmpV", mx>; } } @@ -3407,22 +3475,22 @@ multiclass VPseudoVCMPM_VV_VX { foreach m = MxList in { defvar mx = m.MX; - defm "" : VPseudoBinaryM_VV, + defm "" : VPseudoBinaryM_VV, SchedBinary<"WriteVICmpV", "ReadVICmpV", "ReadVICmpV", mx>; - defm "" : VPseudoBinaryM_VX, + defm "" : VPseudoBinaryM_VX, SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>; } } multiclass VPseudoVCMPM_VV_VF { foreach m = MxListF in { - defm "" : VPseudoBinaryM_VV, + defm "" : VPseudoBinaryM_VV, SchedBinary<"WriteVFCmpV", "ReadVFCmpV", "ReadVFCmpV", m.MX>; } foreach f = FPList in { foreach m = f.MxList in { - defm "" : VPseudoBinaryM_VF, + defm "" : VPseudoBinaryM_VF, SchedBinary<"WriteVFCmpF", "ReadVFCmpV", "ReadVFCmpF", m.MX>; } } @@ -3431,7 +3499,7 @@ multiclass VPseudoVCMPM_VF { foreach f = FPList in { foreach m = f.MxList in { - defm "" : VPseudoBinaryM_VF, + defm "" : VPseudoBinaryM_VF, SchedBinary<"WriteVFCmpF", "ReadVFCmpV", "ReadVFCmpF", m.MX>; } } @@ -3440,9 +3508,9 @@ multiclass VPseudoVCMPM_VX_VI { foreach m = MxList in { defvar mx = m.MX; - defm "" : VPseudoBinaryM_VX, + defm "" : VPseudoBinaryM_VX, SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>; - defm "" : VPseudoBinaryM_VI, + defm "" : VPseudoBinaryM_VI, SchedUnary<"WriteVICmpI", "ReadVICmpV", mx>; } } @@ -3537,11 +3605,12 @@ multiclass VPseudoConversion { + string Constraint = "", + int TargetConstraintType = 1> { let VLMul = MInfo.value in { - def "_" # MInfo.MX : VPseudoUnaryNoMask; + def "_" # MInfo.MX : VPseudoUnaryNoMask; def "_" # MInfo.MX # "_MASK" : VPseudoUnaryMask, + Constraint, TargetConstraintType>, RISCVMaskedPseudo; } } @@ -3549,9 +3618,10 @@ multiclass VPseudoConversionRoundingMode { + string Constraint = "", + int TargetConstraintType = 1> { let VLMul = MInfo.value in { - def "_" # MInfo.MX : VPseudoUnaryNoMaskRoundingMode; + def "_" # MInfo.MX : VPseudoUnaryNoMaskRoundingMode; def "_" # MInfo.MX # "_MASK" : VPseudoUnaryMaskRoundingMode, RISCVMaskedPseudo; @@ -3632,7 +3702,7 @@ multiclass VPseudoVWCVTI_V { defvar constraint = "@earlyclobber $rd"; foreach m = MxListFW in { - defm _V : VPseudoConversion, + defm _V : VPseudoConversion, SchedUnary<"WriteVFWCvtFToIV", "ReadVFWCvtFToIV", m.MX, forceMergeOpRead=true>; } @@ -3641,7 +3711,7 @@ multiclass VPseudoVWCVTI_V_RM { defvar constraint = "@earlyclobber $rd"; foreach m = MxListFW in { - defm _V : VPseudoConversionRoundingMode, + defm _V : VPseudoConversionRoundingMode, SchedUnary<"WriteVFWCvtFToIV", "ReadVFWCvtFToIV", m.MX, forceMergeOpRead=true>; } @@ -3659,7 +3729,7 @@ multiclass VPseudoVWCVTF_V { defvar constraint = "@earlyclobber $rd"; foreach m = MxListW in { - defm _V : VPseudoConversion, + defm _V : VPseudoConversion, SchedUnary<"WriteVFWCvtIToFV", "ReadVFWCvtIToFV", m.MX, forceMergeOpRead=true>; } @@ -3668,7 +3738,7 @@ multiclass VPseudoVWCVTD_V { defvar constraint = "@earlyclobber $rd"; foreach m = MxListFW in { - defm _V : VPseudoConversion, + defm _V : VPseudoConversion, SchedUnary<"WriteVFWCvtFToFV", "ReadVFWCvtFToFV", m.MX, forceMergeOpRead=true>; } @@ -3677,7 +3747,7 @@ multiclass VPseudoVNCVTI_W { defvar constraint = "@earlyclobber $rd"; foreach m = MxListW in { - defm _W : VPseudoConversion, + defm _W : VPseudoConversion, SchedUnary<"WriteVFNCvtFToIV", "ReadVFNCvtFToIV", m.MX, forceMergeOpRead=true>; } @@ -3686,7 +3756,7 @@ multiclass VPseudoVNCVTI_W_RM { defvar constraint = "@earlyclobber $rd"; foreach m = MxListW in { - defm _W : VPseudoConversionRoundingMode, + defm _W : VPseudoConversionRoundingMode, SchedUnary<"WriteVFNCvtFToIV", "ReadVFNCvtFToIV", m.MX, forceMergeOpRead=true>; } @@ -3704,7 +3774,7 @@ multiclass VPseudoVNCVTF_W_RM { defvar constraint = "@earlyclobber $rd"; foreach m = MxListFW in { - defm _W : VPseudoConversionRoundingMode, + defm _W : VPseudoConversionRoundingMode, SchedUnary<"WriteVFNCvtIToFV", "ReadVFNCvtIToFV", m.MX, forceMergeOpRead=true>; } @@ -3722,7 +3792,7 @@ multiclass VPseudoVNCVTD_W { defvar constraint = "@earlyclobber $rd"; foreach m = MxListFW in { - defm _W : VPseudoConversion, + defm _W : VPseudoConversion, SchedUnary<"WriteVFNCvtFToFV", "ReadVFNCvtFToFV", m.MX, forceMergeOpRead=true>; } @@ -3731,7 +3801,7 @@ multiclass VPseudoVNCVTD_W_RM { defvar constraint = "@earlyclobber $rd"; foreach m = MxListFW in { - defm _W : VPseudoConversionRoundingMode, + defm _W : VPseudoConversionRoundingMode, SchedUnary<"WriteVFNCvtFToFV", "ReadVFNCvtFToFV", m.MX, forceMergeOpRead=true>; }