diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h @@ -64,12 +64,8 @@ VLMulShift = ConstraintShift + 3, VLMulMask = 0b111 << VLMulShift, - // Do we need to add a dummy mask op when converting RVV Pseudo to MCInst. - HasDummyMaskOpShift = VLMulShift + 3, - HasDummyMaskOpMask = 1 << HasDummyMaskOpShift, - // Force a tail agnostic policy even this instruction has a tied destination. - ForceTailAgnosticShift = HasDummyMaskOpShift + 1, + ForceTailAgnosticShift = VLMulShift + 3, ForceTailAgnosticMask = 1 << ForceTailAgnosticShift, // Does this instruction have a merge operand that must be removed when diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormats.td b/llvm/lib/Target/RISCV/RISCVInstrFormats.td --- a/llvm/lib/Target/RISCV/RISCVInstrFormats.td +++ b/llvm/lib/Target/RISCV/RISCVInstrFormats.td @@ -187,36 +187,33 @@ bits<3> VLMul = 0; let TSFlags{10-8} = VLMul; - bit HasDummyMask = 0; - let TSFlags{11} = HasDummyMask; - bit ForceTailAgnostic = false; - let TSFlags{12} = ForceTailAgnostic; + let TSFlags{11} = ForceTailAgnostic; bit HasMergeOp = 0; - let TSFlags{13} = HasMergeOp; + let TSFlags{12} = HasMergeOp; bit HasSEWOp = 0; - let TSFlags{14} = HasSEWOp; + let TSFlags{13} = HasSEWOp; bit HasVLOp = 0; - let TSFlags{15} = HasVLOp; + let TSFlags{14} = HasVLOp; bit HasVecPolicyOp = 0; - let TSFlags{16} = HasVecPolicyOp; + let TSFlags{15} = HasVecPolicyOp; bit IsRVVWideningReduction = 0; - let TSFlags{17} = IsRVVWideningReduction; + let TSFlags{16} = IsRVVWideningReduction; bit UsesMaskPolicy = 0; - let TSFlags{18} = UsesMaskPolicy; + let TSFlags{17} = UsesMaskPolicy; // Indicates that the result can be considered sign extended from bit 31. Some // instructions with this flag aren't W instructions, but are either sign // extended from a smaller size, always outputs a small integer, or put zeros // in bits 63:31. Used by the SExtWRemoval pass. bit IsSignExtendingOpW = 0; - let TSFlags{19} = IsSignExtendingOpW; + let TSFlags{18} = IsSignExtendingOpW; } // Pseudo instructions 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 @@ -689,7 +689,7 @@ true : [HasVInstructions]); } -class VPseudoUSLoadNoMask : +class VPseudoUSLoadNoMask : Pseudo<(outs RetClass:$rd), (ins GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, @@ -699,7 +699,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = DummyMask; } class VPseudoUSLoadNoMaskTU : @@ -712,7 +711,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -735,7 +733,7 @@ let UsesMaskPolicy = 1; } -class VPseudoUSLoadFFNoMask : +class VPseudoUSLoadFFNoMask : Pseudo<(outs RetClass:$rd, GPR:$vl), (ins GPRMem:$rs1, AVL:$avl, ixlenimm:$sew),[]>, RISCVVPseudo, @@ -745,7 +743,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = DummyMask; } class VPseudoUSLoadFFNoMaskTU : @@ -758,7 +755,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -791,7 +787,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSLoadNoMaskTU: @@ -804,7 +799,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -839,7 +833,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd", ""); } @@ -855,7 +848,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd, $rd = $dest", "$rd = $dest"); } @@ -879,7 +871,7 @@ let UsesMaskPolicy = 1; } -class VPseudoUSStoreNoMask: +class VPseudoUSStoreNoMask: Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, @@ -889,7 +881,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = DummyMask; } class VPseudoUSStoreMask: @@ -914,7 +905,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSStoreMask: @@ -929,33 +919,6 @@ let HasSEWOp = 1; } -// Unary instruction that is never masked so HasDummyMask=0. -class VPseudoUnaryNoDummyMask : - Pseudo<(outs RetClass:$rd), - (ins Op2Class:$rs1, AVL:$vl, ixlenimm:$sew), []>, - RISCVVPseudo { - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; - let HasVLOp = 1; - let HasSEWOp = 1; -} - -class VPseudoUnaryNoDummyMaskTU : - Pseudo<(outs RetClass:$rd), - (ins RetClass:$dest, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew), []>, - RISCVVPseudo { - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; - let HasVLOp = 1; - let HasSEWOp = 1; - let HasMergeOp = 1; - let Constraints = "$rd = $dest"; -} - class VPseudoNullaryNoMask: Pseudo<(outs RegClass:$rd), (ins AVL:$vl, ixlenimm:$sew), @@ -965,7 +928,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoNullaryNoMaskTU: @@ -978,7 +940,6 @@ let Constraints = "$rd = $merge"; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; } @@ -1013,7 +974,8 @@ } // RetClass could be GPR or VReg. -class VPseudoUnaryNoMask : +class VPseudoUnaryNoMask : Pseudo<(outs RetClass:$rd), (ins OpClass:$rs2, AVL:$vl, ixlenimm:$sew), []>, RISCVVPseudo { @@ -1023,11 +985,11 @@ let Constraints = Constraint; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } // RetClass could be GPR or VReg. -class VPseudoUnaryNoMaskTU : +class VPseudoUnaryNoMaskTU : Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, OpClass:$rs2, AVL:$vl, ixlenimm:$sew), []>, RISCVVPseudo { @@ -1037,7 +999,6 @@ let Constraints = Join<[Constraint, "$rd = $merge"], ",">.ret; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; } @@ -1137,8 +1098,7 @@ class VPseudoBinaryNoMask : + string Constraint> : Pseudo<(outs RetClass:$rd), (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew), []>, RISCVVPseudo { @@ -1148,7 +1108,6 @@ let Constraints = Constraint; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = DummyMask; } class VPseudoBinaryNoMaskTU.ret; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; } @@ -1184,7 +1142,6 @@ let Constraints = Join<[Constraint, "$rd = $rs2"], ",">.ret; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasVecPolicyOp = 1; let isConvertibleToThreeAddress = 1; } @@ -1200,7 +1157,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoIStoreMask LMUL, @@ -1376,7 +1332,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasMergeOp = 1; - let HasDummyMask = 1; } class VPseudoTernaryNoMaskWithPolicy NF>: @@ -1409,7 +1363,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoUSSegLoadNoMaskTU NF>: @@ -1422,7 +1375,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -1454,7 +1406,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoUSSegLoadFFNoMaskTU NF>: @@ -1467,7 +1418,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -1499,7 +1449,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSSegLoadNoMaskTU NF>: @@ -1512,7 +1461,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $merge"; } @@ -1549,7 +1497,6 @@ let Constraints = "@earlyclobber $rd"; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoISegLoadNoMaskTU LMUL, @@ -1566,7 +1513,6 @@ let Constraints = "@earlyclobber $rd, $rd = $merge"; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; } @@ -1601,7 +1547,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoUSSegStoreMask NF>: @@ -1627,7 +1572,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSSegStoreMask NF>: @@ -1655,7 +1599,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoISegStoreMask LMUL, @@ -1719,7 +1662,7 @@ defvar mx = mti.LMul.MX; defvar WriteVLDM_MX = !cast("WriteVLDM_" # mx); let VLMul = mti.LMul.value in { - def "_V_" # mti.BX : VPseudoUSLoadNoMask, + def "_V_" # mti.BX : VPseudoUSLoadNoMask, Sched<[WriteVLDM_MX, ReadVLDX]>; } } @@ -1798,7 +1741,7 @@ defvar mx = mti.LMul.MX; defvar WriteVSTM_MX = !cast("WriteVSTM_" # mx); let VLMul = mti.LMul.value in { - def "_V_" # mti.BX : VPseudoUSStoreNoMask, + def "_V_" # mti.BX : VPseudoUSStoreNoMask, Sched<[WriteVSTM_MX, ReadVSTX]>; } } @@ -2153,7 +2096,7 @@ defvar ReadVMALUV_MX = !cast("ReadVMALUV_" # mx); let VLMul = m.value in { - def "_MM_" # mx : VPseudoBinaryNoMask, + def "_MM_" # mx : VPseudoBinaryNoMask, Sched<[WriteVMALUV_MX, ReadVMALUV_MX, ReadVMALUV_MX]>; } } @@ -2307,17 +2250,17 @@ defvar ReadVIMovX_MX = !cast("ReadVIMovX_" # mx); let VLMul = m.value in { - def "_V_" # mx : VPseudoUnaryNoDummyMask, + def "_V_" # mx : VPseudoUnaryNoMask, Sched<[WriteVIMovV_MX, ReadVIMovV_MX]>; - def "_X_" # mx : VPseudoUnaryNoDummyMask, + def "_X_" # mx : VPseudoUnaryNoMask, Sched<[WriteVIMovX_MX, ReadVIMovX_MX]>; - def "_I_" # mx : VPseudoUnaryNoDummyMask, + def "_I_" # mx : VPseudoUnaryNoMask, Sched<[WriteVIMovI_MX]>; - def "_V_" # mx # "_TU": VPseudoUnaryNoDummyMaskTU, + def "_V_" # mx # "_TU": VPseudoUnaryNoMaskTU, Sched<[WriteVIMovV_MX, ReadVIMovV_MX]>; - def "_X_" # mx # "_TU": VPseudoUnaryNoDummyMaskTU, + def "_X_" # mx # "_TU": VPseudoUnaryNoMaskTU, Sched<[WriteVIMovX_MX, ReadVIMovX_MX]>; - def "_I_" # mx # "_TU": VPseudoUnaryNoDummyMaskTU, + def "_I_" # mx # "_TU": VPseudoUnaryNoMaskTU, Sched<[WriteVIMovI_MX]>; } } @@ -2333,10 +2276,10 @@ let VLMul = m.value in { def "_" # f.FX # "_" # mx : - VPseudoUnaryNoDummyMask, + VPseudoUnaryNoMask, Sched<[WriteVFMovV_MX, ReadVFMovF_MX]>; def "_" # f.FX # "_" # mx # "_TU": - VPseudoUnaryNoDummyMaskTU, + VPseudoUnaryNoMaskTU, Sched<[WriteVFMovV_MX, ReadVFMovF_MX]>; } }