diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td index f73d85787b67bb..d92d3975d12f53 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td @@ -2045,6 +2045,56 @@ multiclass VPatWidenFPMulAccVL_VV_VF_RM { } } +multiclass VPatSlideVL_VX_VI { + foreach vti = AllVectors in { + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (vop (vti.Vector vti.RegClass:$rd), + (vti.Vector vti.RegClass:$rs1), + uimm5:$rs2, (vti.Mask V0), + VLOpFrag, (XLenVT timm:$policy))), + (!cast(instruction_name#"_VI_"#vti.LMul.MX#"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, uimm5:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, + (XLenVT timm:$policy))>; + + def : Pat<(vti.Vector (vop (vti.Vector vti.RegClass:$rd), + (vti.Vector vti.RegClass:$rs1), + GPR:$rs2, (vti.Mask V0), + VLOpFrag, (XLenVT timm:$policy))), + (!cast(instruction_name#"_VX_"#vti.LMul.MX#"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, GPR:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, + (XLenVT timm:$policy))>; + } + } +} + +multiclass VPatSlide1VL_VX { + foreach vti = AllIntegerVectors in { + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (vop (vti.Vector vti.RegClass:$rs3), + (vti.Vector vti.RegClass:$rs1), + GPR:$rs2, (vti.Mask V0), VLOpFrag)), + (!cast(instruction_name#"_VX_"#vti.LMul.MX#"_MASK") + vti.RegClass:$rs3, vti.RegClass:$rs1, GPR:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>; + } + } +} + +multiclass VPatSlide1VL_VF { + foreach vti = AllFloatVectors in { + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (vop (vti.Vector vti.RegClass:$rs3), + (vti.Vector vti.RegClass:$rs1), + vti.Scalar:$rs2, (vti.Mask V0), VLOpFrag)), + (!cast(instruction_name#"_V"#vti.ScalarSuffix#"_"#vti.LMul.MX#"_MASK") + vti.RegClass:$rs3, vti.RegClass:$rs1, vti.Scalar:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>; + } + } +} + //===----------------------------------------------------------------------===// // Patterns. //===----------------------------------------------------------------------===// @@ -2937,70 +2987,12 @@ foreach vti = AllIntegerVectors in { (!cast("PseudoVID_V_"#vti.LMul.MX#"_MASK") (vti.Vector (IMPLICIT_DEF)), (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(vti.Vector (riscv_slide1up_vl (vti.Vector vti.RegClass:$rd), - (vti.Vector vti.RegClass:$rs1), - GPR:$rs2, (vti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVSLIDE1UP_VX_"#vti.LMul.MX) - vti.RegClass:$rd, vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW, TU_MU)>; - def : Pat<(vti.Vector (riscv_slide1down_vl (vti.Vector vti.RegClass:$rd), - (vti.Vector vti.RegClass:$rs1), - GPR:$rs2, (vti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVSLIDE1DOWN_VX_"#vti.LMul.MX) - vti.RegClass:$rd, vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW, TU_MU)>; } } -foreach vti = AllFloatVectors in { - let Predicates = GetVTypePredicates.Predicates in { - def : Pat<(vti.Vector (riscv_fslide1up_vl (vti.Vector vti.RegClass:$rd), - (vti.Vector vti.RegClass:$rs1), - vti.Scalar:$rs2, (vti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVFSLIDE1UP_V"#vti.ScalarSuffix#"_"#vti.LMul.MX) - vti.RegClass:$rd, vti.RegClass:$rs1, vti.ScalarRegClass:$rs2, GPR:$vl, vti.Log2SEW, TU_MU)>; - def : Pat<(vti.Vector (riscv_fslide1down_vl (vti.Vector vti.RegClass:$rd), - (vti.Vector vti.RegClass:$rs1), - vti.Scalar:$rs2, (vti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVFSLIDE1DOWN_V"#vti.ScalarSuffix#"_"#vti.LMul.MX) - vti.RegClass:$rd, vti.RegClass:$rs1, vti.ScalarRegClass:$rs2, GPR:$vl, vti.Log2SEW, TU_MU)>; - } -} - -foreach vti = AllVectors in { - let Predicates = GetVTypePredicates.Predicates in { - def : Pat<(vti.Vector (riscv_slideup_vl (vti.Vector vti.RegClass:$rs3), - (vti.Vector vti.RegClass:$rs1), - uimm5:$rs2, (vti.Mask true_mask), - VLOpFrag, (XLenVT timm:$policy))), - (!cast("PseudoVSLIDEUP_VI_"#vti.LMul.MX) - vti.RegClass:$rs3, vti.RegClass:$rs1, uimm5:$rs2, - GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; - - def : Pat<(vti.Vector (riscv_slideup_vl (vti.Vector vti.RegClass:$rs3), - (vti.Vector vti.RegClass:$rs1), - GPR:$rs2, (vti.Mask true_mask), - VLOpFrag, (XLenVT timm:$policy))), - (!cast("PseudoVSLIDEUP_VX_"#vti.LMul.MX) - vti.RegClass:$rs3, vti.RegClass:$rs1, GPR:$rs2, - GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; - - def : Pat<(vti.Vector (riscv_slidedown_vl (vti.Vector vti.RegClass:$rs3), - (vti.Vector vti.RegClass:$rs1), - uimm5:$rs2, (vti.Mask true_mask), - VLOpFrag, (XLenVT timm:$policy))), - (!cast("PseudoVSLIDEDOWN_VI_"#vti.LMul.MX) - vti.RegClass:$rs3, vti.RegClass:$rs1, uimm5:$rs2, - GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; - - def : Pat<(vti.Vector (riscv_slidedown_vl (vti.Vector vti.RegClass:$rs3), - (vti.Vector vti.RegClass:$rs1), - GPR:$rs2, (vti.Mask true_mask), - VLOpFrag, (XLenVT timm:$policy))), - (!cast("PseudoVSLIDEDOWN_VX_"#vti.LMul.MX) - vti.RegClass:$rs3, vti.RegClass:$rs1, GPR:$rs2, - GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; - } -} +defm : VPatSlideVL_VX_VI; +defm : VPatSlideVL_VX_VI; +defm : VPatSlide1VL_VX; +defm : VPatSlide1VL_VF; +defm : VPatSlide1VL_VX; +defm : VPatSlide1VL_VF;