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 @@ -685,7 +685,7 @@ true : [HasVInstructions]); } -class VPseudoUSLoadNoMask : +class VPseudoUSLoadNoMask : Pseudo<(outs RetClass:$rd), (ins GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, @@ -695,7 +695,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = DummyMask; } class VPseudoUSLoadNoMaskTU : @@ -708,7 +707,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -731,7 +729,7 @@ let UsesMaskPolicy = 1; } -class VPseudoUSLoadFFNoMask : +class VPseudoUSLoadFFNoMask : Pseudo<(outs RetClass:$rd, GPR:$vl), (ins GPRMem:$rs1, AVL:$avl, ixlenimm:$sew),[]>, RISCVVPseudo, @@ -741,7 +739,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = DummyMask; } class VPseudoUSLoadFFNoMaskTU : @@ -754,7 +751,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -787,7 +783,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSLoadNoMaskTU: @@ -800,7 +795,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -835,7 +829,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd", ""); } @@ -851,7 +844,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"); } @@ -875,7 +867,7 @@ let UsesMaskPolicy = 1; } -class VPseudoUSStoreNoMask: +class VPseudoUSStoreNoMask: Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, @@ -885,7 +877,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = DummyMask; } class VPseudoUSStoreMask: @@ -910,7 +901,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSStoreMask: @@ -925,33 +915,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), @@ -961,7 +924,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoNullaryNoMaskTU: @@ -974,7 +936,6 @@ let Constraints = "$rd = $merge"; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; } @@ -1009,7 +970,8 @@ } // RetClass could be GPR or VReg. -class VPseudoUnaryNoMask : +class VPseudoUnaryNoMask : Pseudo<(outs RetClass:$rd), (ins OpClass:$rs2, AVL:$vl, ixlenimm:$sew), []>, RISCVVPseudo { @@ -1019,11 +981,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 { @@ -1033,7 +995,6 @@ let Constraints = Join<[Constraint, "$rd = $merge"], ",">.ret; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; } @@ -1133,8 +1094,7 @@ class VPseudoBinaryNoMask : + string Constraint> : Pseudo<(outs RetClass:$rd), (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew), []>, RISCVVPseudo { @@ -1144,7 +1104,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; } @@ -1180,7 +1138,6 @@ let Constraints = Join<[Constraint, "$rd = $rs2"], ",">.ret; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasVecPolicyOp = 1; let isConvertibleToThreeAddress = 1; } @@ -1196,7 +1153,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoIStoreMask LMUL, @@ -1372,7 +1328,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasMergeOp = 1; - let HasDummyMask = 1; } class VPseudoTernaryNoMaskWithPolicy NF>: @@ -1405,7 +1359,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoUSSegLoadNoMaskTU NF>: @@ -1418,7 +1371,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -1450,7 +1402,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoUSSegLoadFFNoMaskTU NF>: @@ -1463,7 +1414,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; } @@ -1495,7 +1445,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSSegLoadNoMaskTU NF>: @@ -1508,7 +1457,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $merge"; } @@ -1545,7 +1493,6 @@ let Constraints = "@earlyclobber $rd"; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoISegLoadNoMaskTU LMUL, @@ -1562,7 +1509,6 @@ let Constraints = "@earlyclobber $rd, $rd = $merge"; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; let HasMergeOp = 1; } @@ -1597,7 +1543,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoUSSegStoreMask NF>: @@ -1623,7 +1568,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoSSegStoreMask NF>: @@ -1651,7 +1595,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let HasDummyMask = 1; } class VPseudoISegStoreMask LMUL, @@ -1715,7 +1658,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]>; } } @@ -1794,7 +1737,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]>; } } @@ -2098,7 +2041,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]>; } } @@ -2252,17 +2195,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]>; } } @@ -2278,10 +2221,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]>; } }