diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td @@ -861,7 +861,7 @@ foreach vtiTowti = AllWidenableIntVectors in { defvar vti = vtiTowti.Vti; defvar wti = vtiTowti.Wti; - def : Pat<(wti.Vector + def : Pat<(wti.Vector (riscv_add_vl wti.RegClass:$rd, (op1 vti.RegClass:$rs1, (vti.Vector vti.RegClass:$rs2), @@ -882,6 +882,23 @@ } } +multiclass VPatNarrowShiftSplat_WX_WI { + foreach vtiTowti = AllWidenableIntVectors in { + defvar vti = vtiTowti.Vti; + defvar wti = vtiTowti.Wti; + def : Pat<(vti.Vector (riscv_trunc_vector_vl + (wti.Vector (op wti.RegClass:$rs1, (SplatPat XLenVT:$rs2), + true_mask, VLOpFrag)), true_mask, VLOpFrag)), + (!cast(instruction_name#"_WX_"#vti.LMul.MX) + wti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; + def : Pat<(vti.Vector (riscv_trunc_vector_vl + (wti.Vector (op wti.RegClass:$rs1, (SplatPat_uimm5 uimm5:$rs2), + true_mask, VLOpFrag)), true_mask, VLOpFrag)), + (!cast(instruction_name#"_WI_"#vti.LMul.MX) + wti.RegClass:$rs1, uimm5:$rs2, GPR:$vl, vti.Log2SEW)>; + } +} + //===----------------------------------------------------------------------===// // Patterns. //===----------------------------------------------------------------------===// @@ -952,6 +969,13 @@ defm : VPatBinarySDNode_V_WV_WX_WI; defm : VPatBinarySDNode_V_WV_WX_WI; +defm : VPatNarrowShiftSplat_WX_WI; +defm : VPatNarrowShiftSplat_WX_WI; +defm : VPatNarrowShiftSplatExt_WX; +defm : VPatNarrowShiftSplatExt_WX; +defm : VPatNarrowShiftSplatExt_WX; +defm : VPatNarrowShiftSplatExt_WX; + foreach vtiTowti = AllWidenableIntVectors in { defvar vti = vtiTowti.Vti; defvar wti = vtiTowti.Wti; @@ -966,39 +990,6 @@ (!cast("PseudoVNSRL_WX_"#vti.LMul.MX#"_MASK") (vti.Vector (IMPLICIT_DEF)), wti.RegClass:$rs1, X0, (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - - def : Pat<(vti.Vector - (riscv_trunc_vector_vl - (wti.Vector - (riscv_sra_vl wti.RegClass:$rs1, (SplatPat XLenVT:$rs2), - true_mask, VLOpFrag)), true_mask, VLOpFrag)), - (!cast("PseudoVNSRA_WX_"#vti.LMul.MX) - wti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; - defm : VPatNarrowShiftSplatExt_WX; - defm : VPatNarrowShiftSplatExt_WX; - def : Pat<(vti.Vector - (riscv_trunc_vector_vl - (wti.Vector - (riscv_sra_vl wti.RegClass:$rs1, (SplatPat_uimm5 uimm5:$rs2), - true_mask, VLOpFrag)), true_mask, VLOpFrag)), - (!cast("PseudoVNSRA_WI_"#vti.LMul.MX) - wti.RegClass:$rs1, uimm5:$rs2, GPR:$vl, vti.Log2SEW)>; - def : Pat<(vti.Vector - (riscv_trunc_vector_vl - (wti.Vector - (riscv_srl_vl wti.RegClass:$rs1, (SplatPat XLenVT:$rs2), - true_mask, VLOpFrag)), true_mask, VLOpFrag)), - (!cast("PseudoVNSRL_WX_"#vti.LMul.MX) - wti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; - defm : VPatNarrowShiftSplatExt_WX; - defm : VPatNarrowShiftSplatExt_WX; - def : Pat<(vti.Vector - (riscv_trunc_vector_vl - (wti.Vector - (riscv_srl_vl wti.RegClass:$rs1, (SplatPat_uimm5 uimm5:$rs2), - true_mask, VLOpFrag)), true_mask, VLOpFrag)), - (!cast("PseudoVNSRL_WI_"#vti.LMul.MX) - wti.RegClass:$rs1, uimm5:$rs2, GPR:$vl, vti.Log2SEW)>; } // 12.8. Vector Integer Comparison Instructions