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 @@ -655,30 +655,35 @@ (mask_type V0), GPR:$vl, log2sew, TAIL_AGNOSTIC)>; } -multiclass VPatBinaryVL_VV_VX { - foreach vti = AllIntegerVectors in { - defm : VPatBinaryVL_V; - defm : VPatBinaryVL_XI; +multiclass VPatBinaryVL_VV_VX vtilist = AllIntegerVectors> { + foreach vti = vtilist in { + let Predicates = GetVTypePredicates.Predicates in { + defm : VPatBinaryVL_V; + defm : VPatBinaryVL_XI; + } } } multiclass VPatBinaryVL_VV_VX_E { foreach vti = AllIntegerVectors in { - defm : VPatBinaryVL_V_E; - defm : VPatBinaryVL_XI_E; + let Predicates = GetVTypePredicates.Predicates in { + defm : VPatBinaryVL_V_E; + defm : VPatBinaryVL_XI_E; + } } } @@ -686,6 +691,7 @@ Operand ImmType = simm5> : VPatBinaryVL_VV_VX { foreach vti = AllIntegerVectors in { + let Predicates = GetVTypePredicates.Predicates in defm : VPatBinaryVL_XI; - defm : VPatBinaryVL_XI; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + defm : VPatBinaryVL_V; + defm : VPatBinaryVL_XI; + } } } multiclass VPatBinaryWVL_VV_VX_WV_WX; - defm : VPatBinaryVL_V; - defm : VPatBinaryVL_XI; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + defm : VPatTiedBinaryNoMaskVL_V; + defm : VPatBinaryVL_V; + defm : VPatBinaryVL_XI; + } } } @@ -732,19 +744,22 @@ foreach VtiToWti = AllWidenableIntVectors in { defvar vti = VtiToWti.Vti; defvar wti = VtiToWti.Wti; - defm : VPatBinaryVL_V; - defm : VPatBinaryVL_XI; - defm : VPatBinaryVL_XI(SplatPat#_#uimm5), - uimm5>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + defm : VPatBinaryVL_V; + defm : VPatBinaryVL_XI; + defm : VPatBinaryVL_XI(SplatPat#_#uimm5), + uimm5>; + } } } @@ -795,33 +810,38 @@ multiclass VPatBinaryFPVL_VV_VF { foreach vti = AllFloatVectors in { - defm : VPatBinaryVL_V; - defm : VPatBinaryVL_VF; + let Predicates = GetVTypePredicates.Predicates in { + defm : VPatBinaryVL_V; + defm : VPatBinaryVL_VF; + } } } multiclass VPatBinaryFPVL_VV_VF_E { foreach vti = AllFloatVectors in { - defm : VPatBinaryVL_V_E; - defm : VPatBinaryVL_VF_E; + let Predicates = GetVTypePredicates.Predicates in { + defm : VPatBinaryVL_V_E; + defm : VPatBinaryVL_VF_E; + } } } multiclass VPatBinaryFPVL_R_VF { foreach fvti = AllFloatVectors in { + let Predicates = GetVTypePredicates.Predicates in def : Pat<(fvti.Vector (vop (SplatFPOp fvti.ScalarRegClass:$rs2), fvti.RegClass:$rs1, (fvti.Vector fvti.RegClass:$merge), @@ -837,6 +857,7 @@ multiclass VPatBinaryFPVL_R_VF_E { foreach fvti = AllFloatVectors in { + let Predicates = GetVTypePredicates.Predicates in def : Pat<(fvti.Vector (vop (SplatFPOp fvti.ScalarRegClass:$rs2), fvti.RegClass:$rs1, (fvti.Vector fvti.RegClass:$merge), @@ -948,36 +969,38 @@ string inst_name, string swapped_op_inst_name> { foreach fvti = AllFloatVectors in { - def : Pat<(fvti.Mask (vop (fvti.Vector fvti.RegClass:$rs1), - fvti.RegClass:$rs2, - cc, - VR:$merge, - (fvti.Mask V0), - VLOpFrag)), - (!cast(inst_name#"_VV_"#fvti.LMul.MX#"_MASK") - VR:$merge, fvti.RegClass:$rs1, - fvti.RegClass:$rs2, (fvti.Mask V0), - GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fvti.Mask (vop (fvti.Vector fvti.RegClass:$rs1), - (SplatFPOp fvti.ScalarRegClass:$rs2), - cc, - VR:$merge, - (fvti.Mask V0), - VLOpFrag)), - (!cast(inst_name#"_V"#fvti.ScalarSuffix#"_"#fvti.LMul.MX#"_MASK") - VR:$merge, fvti.RegClass:$rs1, - fvti.ScalarRegClass:$rs2, (fvti.Mask V0), - GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fvti.Mask (vop (SplatFPOp fvti.ScalarRegClass:$rs2), - (fvti.Vector fvti.RegClass:$rs1), - cc, - VR:$merge, - (fvti.Mask V0), - VLOpFrag)), - (!cast(swapped_op_inst_name#"_V"#fvti.ScalarSuffix#"_"#fvti.LMul.MX#"_MASK") - VR:$merge, fvti.RegClass:$rs1, - fvti.ScalarRegClass:$rs2, (fvti.Mask V0), - GPR:$vl, fvti.Log2SEW)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(fvti.Mask (vop (fvti.Vector fvti.RegClass:$rs1), + fvti.RegClass:$rs2, + cc, + VR:$merge, + (fvti.Mask V0), + VLOpFrag)), + (!cast(inst_name#"_VV_"#fvti.LMul.MX#"_MASK") + VR:$merge, fvti.RegClass:$rs1, + fvti.RegClass:$rs2, (fvti.Mask V0), + GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fvti.Mask (vop (fvti.Vector fvti.RegClass:$rs1), + (SplatFPOp fvti.ScalarRegClass:$rs2), + cc, + VR:$merge, + (fvti.Mask V0), + VLOpFrag)), + (!cast(inst_name#"_V"#fvti.ScalarSuffix#"_"#fvti.LMul.MX#"_MASK") + VR:$merge, fvti.RegClass:$rs1, + fvti.ScalarRegClass:$rs2, (fvti.Mask V0), + GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fvti.Mask (vop (SplatFPOp fvti.ScalarRegClass:$rs2), + (fvti.Vector fvti.RegClass:$rs1), + cc, + VR:$merge, + (fvti.Mask V0), + VLOpFrag)), + (!cast(swapped_op_inst_name#"_V"#fvti.ScalarSuffix#"_"#fvti.LMul.MX#"_MASK") + VR:$merge, fvti.RegClass:$rs1, + fvti.ScalarRegClass:$rs2, (fvti.Mask V0), + GPR:$vl, fvti.Log2SEW)>; + } } } @@ -986,6 +1009,8 @@ foreach vtiTofti = fraction_list in { defvar vti = vtiTofti.Vti; defvar fti = vtiTofti.Fti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(vti.Vector (vop (fti.Vector fti.RegClass:$rs2), (fti.Mask V0), VLOpFrag)), (!cast(inst_name#"_"#suffix#"_"#vti.LMul.MX#"_MASK") @@ -1000,6 +1025,8 @@ multiclass VPatConvertFP2IVL_V { foreach fvti = AllFloatVectors in { defvar ivti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(ivti.Vector (vop (fvti.Vector fvti.RegClass:$rs1), (fvti.Mask V0), VLOpFrag)), @@ -1012,6 +1039,8 @@ multiclass VPatConvertFP2I_RM_VL_V { foreach fvti = AllFloatVectors in { defvar ivti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(ivti.Vector (vop (fvti.Vector fvti.RegClass:$rs1), (fvti.Mask V0), (XLenVT timm:$frm), VLOpFrag)), @@ -1025,6 +1054,8 @@ multiclass VPatConvertI2FPVL_V { foreach fvti = AllFloatVectors in { defvar ivti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(fvti.Vector (vop (ivti.Vector ivti.RegClass:$rs1), (ivti.Mask V0), VLOpFrag)), @@ -1037,6 +1068,8 @@ multiclass VPatConvertI2FP_RM_VL_V { foreach fvti = AllFloatVectors in { defvar ivti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(fvti.Vector (vop (ivti.Vector ivti.RegClass:$rs1), (ivti.Mask V0), (XLenVT timm:$frm), VLOpFrag)), @@ -1052,6 +1085,8 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar iwti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(iwti.Vector (vop (fvti.Vector fvti.RegClass:$rs1), (fvti.Mask V0), VLOpFrag)), @@ -1065,6 +1100,8 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar iwti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(iwti.Vector (vop (fvti.Vector fvti.RegClass:$rs1), (fvti.Mask V0), (XLenVT timm:$frm), VLOpFrag)), @@ -1079,6 +1116,8 @@ foreach vtiToWti = AllWidenableIntToFloatVectors in { defvar ivti = vtiToWti.Vti; defvar fwti = vtiToWti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(fwti.Vector (vop (ivti.Vector ivti.RegClass:$rs1), (ivti.Mask V0), VLOpFrag)), @@ -1092,6 +1131,8 @@ foreach vtiToWti = AllWidenableIntToFloatVectors in { defvar ivti = vtiToWti.Vti; defvar fwti = vtiToWti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(fwti.Vector (vop (ivti.Vector ivti.RegClass:$rs1), (ivti.Mask V0), (XLenVT timm:$frm), VLOpFrag)), @@ -1110,6 +1151,8 @@ foreach vtiToWti = AllWidenableIntToFloatVectors in { defvar vti = vtiToWti.Vti; defvar fwti = vtiToWti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(vti.Vector (vop (fwti.Vector fwti.RegClass:$rs1), (fwti.Mask V0), VLOpFrag)), @@ -1123,6 +1166,8 @@ foreach vtiToWti = AllWidenableIntToFloatVectors in { defvar vti = vtiToWti.Vti; defvar fwti = vtiToWti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(vti.Vector (vop (fwti.Vector fwti.RegClass:$rs1), (fwti.Mask V0), (XLenVT timm:$frm), VLOpFrag)), @@ -1137,6 +1182,8 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar iwti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(fvti.Vector (vop (iwti.Vector iwti.RegClass:$rs1), (iwti.Mask V0), VLOpFrag)), @@ -1150,6 +1197,8 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar iwti = GetIntVTypeInfo.Vti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(fvti.Vector (vop (iwti.Vector iwti.RegClass:$rs1), (iwti.Mask V0), (XLenVT timm:$frm), VLOpFrag)), @@ -1162,25 +1211,27 @@ multiclass VPatReductionVL { foreach vti = !if(is_float, AllFloatVectors, AllIntegerVectors) in { defvar vti_m1 = !cast(!if(is_float, "VF", "VI") # vti.SEW # "M1"); - def: Pat<(vti_m1.Vector (vop (vti_m1.Vector VR:$merge), - (vti.Vector vti.RegClass:$rs1), VR:$rs2, - (vti.Mask true_mask), VLOpFrag, - (XLenVT timm:$policy))), - (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW) - (vti_m1.Vector VR:$merge), - (vti.Vector vti.RegClass:$rs1), - (vti_m1.Vector VR:$rs2), - GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; - - def: Pat<(vti_m1.Vector (vop (vti_m1.Vector VR:$merge), - (vti.Vector vti.RegClass:$rs1), VR:$rs2, - (vti.Mask V0), VLOpFrag, - (XLenVT timm:$policy))), - (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW#"_MASK") - (vti_m1.Vector VR:$merge), - (vti.Vector vti.RegClass:$rs1), - (vti_m1.Vector VR:$rs2), - (vti.Mask V0), GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; + let Predicates = GetVTypePredicates.Predicates in { + def: Pat<(vti_m1.Vector (vop (vti_m1.Vector VR:$merge), + (vti.Vector vti.RegClass:$rs1), VR:$rs2, + (vti.Mask true_mask), VLOpFrag, + (XLenVT timm:$policy))), + (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW) + (vti_m1.Vector VR:$merge), + (vti.Vector vti.RegClass:$rs1), + (vti_m1.Vector VR:$rs2), + GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; + + def: Pat<(vti_m1.Vector (vop (vti_m1.Vector VR:$merge), + (vti.Vector vti.RegClass:$rs1), VR:$rs2, + (vti.Mask V0), VLOpFrag, + (XLenVT timm:$policy))), + (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW#"_MASK") + (vti_m1.Vector VR:$merge), + (vti.Vector vti.RegClass:$rs1), + (vti_m1.Vector VR:$rs2), + (vti.Mask V0), GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; + } } } @@ -1189,24 +1240,27 @@ foreach vtiToWti = AllWidenableIntVectors in { defvar vti = vtiToWti.Vti; defvar wti = vtiToWti.Wti; - def : Pat< - (vti.Vector - (riscv_trunc_vector_vl - (op (wti.Vector wti.RegClass:$rs2), - (wti.Vector (extop (vti.Vector vti.RegClass:$rs1)))), - (vti.Mask true_mask), - VLOpFrag)), - (!cast(instruction_name#"_WV_"#vti.LMul.MX) - wti.RegClass:$rs2, vti.RegClass:$rs1, GPR:$vl, vti.Log2SEW)>; - def : Pat< - (vti.Vector - (riscv_trunc_vector_vl - (op (wti.Vector wti.RegClass:$rs2), - (wti.Vector (extop (vti.Vector (SplatPat GPR:$rs1))))), - (vti.Mask true_mask), - VLOpFrag)), - (!cast(instruction_name#"_WX_"#vti.LMul.MX) - wti.RegClass:$rs2, GPR:$rs1, GPR:$vl, vti.Log2SEW)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat< + (vti.Vector + (riscv_trunc_vector_vl + (op (wti.Vector wti.RegClass:$rs2), + (wti.Vector (extop (vti.Vector vti.RegClass:$rs1)))), + (vti.Mask true_mask), + VLOpFrag)), + (!cast(instruction_name#"_WV_"#vti.LMul.MX) + wti.RegClass:$rs2, vti.RegClass:$rs1, GPR:$vl, vti.Log2SEW)>; + def : Pat< + (vti.Vector + (riscv_trunc_vector_vl + (op (wti.Vector wti.RegClass:$rs2), + (wti.Vector (extop (vti.Vector (SplatPat GPR:$rs1))))), + (vti.Mask true_mask), + VLOpFrag)), + (!cast(instruction_name#"_WX_"#vti.LMul.MX) + wti.RegClass:$rs2, GPR:$rs1, GPR:$vl, vti.Log2SEW)>; + } } } @@ -1216,6 +1270,8 @@ foreach vtiToWti = AllWidenableIntVectors in { defvar vti = vtiToWti.Vti; defvar wti = vtiToWti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat< (vti.Vector (riscv_trunc_vector_vl @@ -1232,22 +1288,25 @@ defvar vti = vtiToWti.Vti; defvar wti = vtiToWti.Wti; defvar wti_m1 = !cast(!if(is_float, "VF", "VI") # wti.SEW # "M1"); - def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), - (wti.Vector (extop (vti.Vector vti.RegClass:$rs1))), - VR:$rs2, (vti.Mask true_mask), VLOpFrag, - (XLenVT timm:$policy))), - (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW) - (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), - (wti_m1.Vector VR:$rs2), GPR:$vl, vti.Log2SEW, - (XLenVT timm:$policy))>; - def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), - (wti.Vector (extop (vti.Vector vti.RegClass:$rs1))), - VR:$rs2, (vti.Mask V0), VLOpFrag, - (XLenVT timm:$policy))), - (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW#"_MASK") - (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), - (wti_m1.Vector VR:$rs2), (vti.Mask V0), GPR:$vl, vti.Log2SEW, - (XLenVT timm:$policy))>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), + (wti.Vector (extop (vti.Vector vti.RegClass:$rs1))), + VR:$rs2, (vti.Mask true_mask), VLOpFrag, + (XLenVT timm:$policy))), + (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW) + (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), + (wti_m1.Vector VR:$rs2), GPR:$vl, vti.Log2SEW, + (XLenVT timm:$policy))>; + def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), + (wti.Vector (extop (vti.Vector vti.RegClass:$rs1))), + VR:$rs2, (vti.Mask V0), VLOpFrag, + (XLenVT timm:$policy))), + (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW#"_MASK") + (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), + (wti_m1.Vector VR:$rs2), (vti.Mask V0), GPR:$vl, vti.Log2SEW, + (XLenVT timm:$policy))>; + } } } @@ -1256,22 +1315,25 @@ defvar vti = vtiToWti.Vti; defvar wti = vtiToWti.Wti; defvar wti_m1 = !cast(!if(is_float, "VF", "VI") # wti.SEW # "M1"); - def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), - (wti.Vector (extop (vti.Vector vti.RegClass:$rs1), (vti.Mask true_mask), VLOpFrag)), - VR:$rs2, (vti.Mask true_mask), VLOpFrag, - (XLenVT timm:$policy))), - (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW) - (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), - (wti_m1.Vector VR:$rs2), GPR:$vl, vti.Log2SEW, - (XLenVT timm:$policy))>; - def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), - (wti.Vector (extop (vti.Vector vti.RegClass:$rs1), (vti.Mask true_mask), VLOpFrag)), - VR:$rs2, (vti.Mask V0), VLOpFrag, - (XLenVT timm:$policy))), - (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW#"_MASK") - (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), - (wti_m1.Vector VR:$rs2), (vti.Mask V0), GPR:$vl, vti.Log2SEW, - (XLenVT timm:$policy))>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), + (wti.Vector (extop (vti.Vector vti.RegClass:$rs1), (vti.Mask true_mask), VLOpFrag)), + VR:$rs2, (vti.Mask true_mask), VLOpFrag, + (XLenVT timm:$policy))), + (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW) + (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), + (wti_m1.Vector VR:$rs2), GPR:$vl, vti.Log2SEW, + (XLenVT timm:$policy))>; + def: Pat<(wti_m1.Vector (vop (wti_m1.Vector VR:$merge), + (wti.Vector (extop (vti.Vector vti.RegClass:$rs1), (vti.Mask true_mask), VLOpFrag)), + VR:$rs2, (vti.Mask V0), VLOpFrag, + (XLenVT timm:$policy))), + (!cast(instruction_name#"_VS_"#vti.LMul.MX#"_E"#vti.SEW#"_MASK") + (wti_m1.Vector VR:$merge), (vti.Vector vti.RegClass:$rs1), + (wti_m1.Vector VR:$rs2), (vti.Mask V0), GPR:$vl, vti.Log2SEW, + (XLenVT timm:$policy))>; + } } } @@ -1279,22 +1341,25 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar fwti = fvtiToFWti.Wti; - def : Pat<(fwti.Vector (op (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs2), - (fvti.Mask true_mask), VLOpFrag)), - (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs1), - (fvti.Mask true_mask), VLOpFrag)), - srcvalue, (fwti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_VV_"#fvti.LMul.MX) - fvti.RegClass:$rs2, fvti.RegClass:$rs1, - GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fwti.Vector (op (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs2), - (fvti.Mask true_mask), VLOpFrag)), - (fwti.Vector (extop (fvti.Vector (SplatFPOp fvti.ScalarRegClass:$rs1)), - (fvti.Mask true_mask), VLOpFrag)), - srcvalue, (fwti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_V"#fvti.ScalarSuffix#"_"#fvti.LMul.MX) - fvti.RegClass:$rs2, fvti.ScalarRegClass:$rs1, - GPR:$vl, fvti.Log2SEW)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat<(fwti.Vector (op (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs2), + (fvti.Mask true_mask), VLOpFrag)), + (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs1), + (fvti.Mask true_mask), VLOpFrag)), + srcvalue, (fwti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_VV_"#fvti.LMul.MX) + fvti.RegClass:$rs2, fvti.RegClass:$rs1, + GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fwti.Vector (op (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs2), + (fvti.Mask true_mask), VLOpFrag)), + (fwti.Vector (extop (fvti.Vector (SplatFPOp fvti.ScalarRegClass:$rs1)), + (fvti.Mask true_mask), VLOpFrag)), + srcvalue, (fwti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_V"#fvti.ScalarSuffix#"_"#fvti.LMul.MX) + fvti.RegClass:$rs2, fvti.ScalarRegClass:$rs1, + GPR:$vl, fvti.Log2SEW)>; + } } } @@ -1302,20 +1367,23 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar fwti = fvtiToFWti.Wti; - def : Pat<(fwti.Vector (op (fwti.Vector fwti.RegClass:$rs2), - (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs1), - (fvti.Mask true_mask), VLOpFrag)), - srcvalue, (fwti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_WV_"#fvti.LMul.MX#"_TIED") - fwti.RegClass:$rs2, fvti.RegClass:$rs1, - GPR:$vl, fvti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(fwti.Vector (op (fwti.Vector fwti.RegClass:$rs2), - (fwti.Vector (extop (fvti.Vector (SplatFPOp fvti.ScalarRegClass:$rs1)), - (fvti.Mask true_mask), VLOpFrag)), - srcvalue, (fwti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_W"#fvti.ScalarSuffix#"_"#fvti.LMul.MX) - fwti.RegClass:$rs2, fvti.ScalarRegClass:$rs1, - GPR:$vl, fvti.Log2SEW)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat<(fwti.Vector (op (fwti.Vector fwti.RegClass:$rs2), + (fwti.Vector (extop (fvti.Vector fvti.RegClass:$rs1), + (fvti.Mask true_mask), VLOpFrag)), + srcvalue, (fwti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_WV_"#fvti.LMul.MX#"_TIED") + fwti.RegClass:$rs2, fvti.RegClass:$rs1, + GPR:$vl, fvti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(fwti.Vector (op (fwti.Vector fwti.RegClass:$rs2), + (fwti.Vector (extop (fvti.Vector (SplatFPOp fvti.ScalarRegClass:$rs1)), + (fvti.Mask true_mask), VLOpFrag)), + srcvalue, (fwti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_W"#fvti.ScalarSuffix#"_"#fvti.LMul.MX) + fwti.RegClass:$rs2, fvti.ScalarRegClass:$rs1, + GPR:$vl, fvti.Log2SEW)>; + } } } @@ -1327,6 +1395,8 @@ foreach vtiToWti = AllWidenableIntVectors in { defvar vti = vtiToWti.Vti; defvar wti = vtiToWti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat< (vti.Vector (riscv_trunc_vector_vl @@ -1343,88 +1413,92 @@ multiclass VPatMultiplyAddVL_VV_VX { foreach vti = AllIntegerVectors in { defvar suffix = vti.LMul.MX; - // NOTE: We choose VMADD because it has the most commuting freedom. So it - // works best with how TwoAddressInstructionPass tries commuting. - def : Pat<(vti.Vector - (op vti.RegClass:$rs2, - (riscv_mul_vl_oneuse vti.RegClass:$rs1, - vti.RegClass:$rd, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_VV_"# suffix) - vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - // The choice of VMADD here is arbitrary, vmadd.vx and vmacc.vx are equally - // commutable. - def : Pat<(vti.Vector - (op vti.RegClass:$rs2, - (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), - vti.RegClass:$rd, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_VX_" # suffix) - vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + let Predicates = GetVTypePredicates.Predicates in { + // NOTE: We choose VMADD because it has the most commuting freedom. So it + // works best with how TwoAddressInstructionPass tries commuting. + def : Pat<(vti.Vector + (op vti.RegClass:$rs2, + (riscv_mul_vl_oneuse vti.RegClass:$rs1, + vti.RegClass:$rd, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_VV_"# suffix) + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + // The choice of VMADD here is arbitrary, vmadd.vx and vmacc.vx are equally + // commutable. + def : Pat<(vti.Vector + (op vti.RegClass:$rs2, + (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), + vti.RegClass:$rd, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_VX_" # suffix) + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + } } } multiclass VPatMultiplyAccVL_VV_VX { foreach vti = AllIntegerVectors in { defvar suffix = vti.LMul.MX; - def : Pat<(riscv_vp_merge_vl (vti.Mask true_mask), - (vti.Vector (op vti.RegClass:$rd, - (riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VV_"# suffix) - vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; - def : Pat<(riscv_vp_merge_vl (vti.Mask V0), - (vti.Vector (op vti.RegClass:$rd, - (riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VV_"# suffix #"_MASK") - vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; - def : Pat<(riscv_vp_merge_vl (vti.Mask true_mask), - (vti.Vector (op vti.RegClass:$rd, - (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VX_"# suffix) - vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; - def : Pat<(riscv_vp_merge_vl (vti.Mask V0), - (vti.Vector (op vti.RegClass:$rd, - (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VX_"# suffix #"_MASK") - vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; - def : Pat<(riscv_vselect_vl (vti.Mask V0), - (vti.Vector (op vti.RegClass:$rd, - (riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VV_"# suffix #"_MASK") - vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(riscv_vselect_vl (vti.Mask V0), - (vti.Vector (op vti.RegClass:$rd, - (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2, - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VX_"# suffix #"_MASK") - vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(riscv_vp_merge_vl (vti.Mask true_mask), + (vti.Vector (op vti.RegClass:$rd, + (riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VV_"# suffix) + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; + def : Pat<(riscv_vp_merge_vl (vti.Mask V0), + (vti.Vector (op vti.RegClass:$rd, + (riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; + def : Pat<(riscv_vp_merge_vl (vti.Mask true_mask), + (vti.Vector (op vti.RegClass:$rd, + (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VX_"# suffix) + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; + def : Pat<(riscv_vp_merge_vl (vti.Mask V0), + (vti.Vector (op vti.RegClass:$rd, + (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VX_"# suffix #"_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; + def : Pat<(riscv_vselect_vl (vti.Mask V0), + (vti.Vector (op vti.RegClass:$rd, + (riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(riscv_vselect_vl (vti.Mask V0), + (vti.Vector (op vti.RegClass:$rd, + (riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2, + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VX_"# suffix #"_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + } } } @@ -1432,24 +1506,27 @@ foreach vtiTowti = AllWidenableIntVectors in { defvar vti = vtiTowti.Vti; defvar wti = vtiTowti.Wti; - def : Pat<(wti.Vector - (riscv_add_vl wti.RegClass:$rd, - (op1 vti.RegClass:$rs1, - (vti.Vector vti.RegClass:$rs2), - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_VV_" # vti.LMul.MX) - wti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(wti.Vector - (riscv_add_vl wti.RegClass:$rd, - (op1 (SplatPat XLenVT:$rs1), - (vti.Vector vti.RegClass:$rs2), - srcvalue, (vti.Mask true_mask), VLOpFrag), - srcvalue, (vti.Mask true_mask), VLOpFrag)), - (!cast(instruction_name#"_VX_" # vti.LMul.MX) - wti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat<(wti.Vector + (riscv_add_vl wti.RegClass:$rd, + (op1 vti.RegClass:$rs1, + (vti.Vector vti.RegClass:$rs2), + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_VV_" # vti.LMul.MX) + wti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(wti.Vector + (riscv_add_vl wti.RegClass:$rd, + (op1 (SplatPat XLenVT:$rs1), + (vti.Vector vti.RegClass:$rs2), + srcvalue, (vti.Mask true_mask), VLOpFrag), + srcvalue, (vti.Mask true_mask), VLOpFrag)), + (!cast(instruction_name#"_VX_" # vti.LMul.MX) + wti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + } } } @@ -1457,70 +1534,77 @@ 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), - srcvalue, 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), - srcvalue, true_mask, VLOpFrag)), true_mask, VLOpFrag)), - (!cast(instruction_name#"_WI_"#vti.LMul.MX) - wti.RegClass:$rs1, uimm5:$rs2, GPR:$vl, vti.Log2SEW)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat<(vti.Vector (riscv_trunc_vector_vl + (wti.Vector (op wti.RegClass:$rs1, (SplatPat XLenVT:$rs2), + srcvalue, 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), + srcvalue, true_mask, VLOpFrag)), true_mask, VLOpFrag)), + (!cast(instruction_name#"_WI_"#vti.LMul.MX) + wti.RegClass:$rs1, uimm5:$rs2, GPR:$vl, vti.Log2SEW)>; + } } } multiclass VPatFPMulAddVL_VV_VF { foreach vti = AllFloatVectors in { defvar suffix = vti.LMul.MX; - def : Pat<(vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rd, - vti.RegClass:$rs2, (vti.Mask V0), - VLOpFrag)), - (!cast(instruction_name#"_VV_"# suffix #"_MASK") - vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rd, + vti.RegClass:$rs2, (vti.Mask V0), + VLOpFrag)), + (!cast(instruction_name#"_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; - def : Pat<(vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), - vti.RegClass:$rd, vti.RegClass:$rs2, - (vti.Mask V0), - VLOpFrag)), - (!cast(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") - vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + def : Pat<(vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), + vti.RegClass:$rd, vti.RegClass:$rs2, + (vti.Mask V0), + VLOpFrag)), + (!cast(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + } } } multiclass VPatFPMulAccVL_VV_VF { foreach vti = AllFloatVectors in { defvar suffix = vti.LMul.MX; - def : Pat<(riscv_vp_merge_vl (vti.Mask V0), - (vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2, - vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VV_"# suffix #"_MASK") - vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; - def : Pat<(riscv_vp_merge_vl (vti.Mask V0), - (vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2, - vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") - vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; - def : Pat<(riscv_vselect_vl (vti.Mask V0), - (vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2, - vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_VV_"# suffix #"_MASK") - vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(riscv_vselect_vl (vti.Mask V0), - (vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2, - vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), - vti.RegClass:$rd, VLOpFrag), - (!cast(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") - vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(riscv_vp_merge_vl (vti.Mask V0), + (vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2, + vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; + def : Pat<(riscv_vp_merge_vl (vti.Mask V0), + (vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2, + vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_UNDISTURBED_MASK_UNDISTURBED)>; + def : Pat<(riscv_vselect_vl (vti.Mask V0), + (vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2, + vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(riscv_vselect_vl (vti.Mask V0), + (vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2, + vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)), + vti.RegClass:$rd, VLOpFrag), + (!cast(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + } } } @@ -1528,20 +1612,23 @@ foreach vtiToWti = AllWidenableFloatVectors in { defvar vti = vtiToWti.Vti; defvar wti = vtiToWti.Wti; - def : Pat<(vop (vti.Vector vti.RegClass:$rs1), - (vti.Vector vti.RegClass:$rs2), - (wti.Vector wti.RegClass:$rd), (vti.Mask V0), - VLOpFrag), - (!cast(instruction_name#"_VV_"#vti.LMul.MX #"_MASK") - wti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; - def : Pat<(vop (vti.Vector (SplatFPOp vti.ScalarRegClass:$rs1)), - (vti.Vector vti.RegClass:$rs2), - (wti.Vector wti.RegClass:$rd), (vti.Mask V0), - VLOpFrag), - (!cast(instruction_name#"_V"#vti.ScalarSuffix#"_"#vti.LMul.MX #"_MASK") - wti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat<(vop (vti.Vector vti.RegClass:$rs1), + (vti.Vector vti.RegClass:$rs2), + (wti.Vector wti.RegClass:$rd), (vti.Mask V0), + VLOpFrag), + (!cast(instruction_name#"_VV_"#vti.LMul.MX #"_MASK") + wti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + def : Pat<(vop (vti.Vector (SplatFPOp vti.ScalarRegClass:$rs1)), + (vti.Vector vti.RegClass:$rs2), + (wti.Vector wti.RegClass:$rd), (vti.Mask V0), + VLOpFrag), + (!cast(instruction_name#"_V"#vti.ScalarSuffix#"_"#vti.LMul.MX #"_MASK") + wti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + } } } @@ -1549,8 +1636,6 @@ // Patterns. //===----------------------------------------------------------------------===// -let Predicates = [HasVInstructions] in { - // 11. Vector Integer Arithmetic Instructions // 11.1. Vector Single-Width Integer Add and Subtract @@ -1559,18 +1644,20 @@ // Handle VRSUB specially since it's the only integer binary op with reversed // pattern operands foreach vti = AllIntegerVectors in { - def : Pat<(riscv_sub_vl (vti.Vector (SplatPat (XLenVT GPR:$rs2))), - (vti.Vector vti.RegClass:$rs1), - vti.RegClass:$merge, (vti.Mask V0), VLOpFrag), - (!cast("PseudoVRSUB_VX_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs1, GPR:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(riscv_sub_vl (vti.Vector (SplatPat_simm5 simm5:$rs2)), - (vti.Vector vti.RegClass:$rs1), - vti.RegClass:$merge, (vti.Mask V0), VLOpFrag), - (!cast("PseudoVRSUB_VI_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs1, simm5:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(riscv_sub_vl (vti.Vector (SplatPat (XLenVT GPR:$rs2))), + (vti.Vector vti.RegClass:$rs1), + vti.RegClass:$merge, (vti.Mask V0), VLOpFrag), + (!cast("PseudoVRSUB_VX_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs1, GPR:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(riscv_sub_vl (vti.Vector (SplatPat_simm5 simm5:$rs2)), + (vti.Vector vti.RegClass:$rs1), + vti.RegClass:$merge, (vti.Mask V0), VLOpFrag), + (!cast("PseudoVRSUB_VI_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs1, simm5:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + } } // 11.2. Vector Widening Integer Add/Subtract @@ -1605,6 +1692,7 @@ foreach vti = AllIntegerVectors in { // Emit shift by 1 as an add since it might be faster. + let Predicates = GetVTypePredicates.Predicates in def : Pat<(riscv_shl_vl (vti.Vector vti.RegClass:$rs1), (riscv_vmv_v_x_vl (vti.Vector undef), 1, (XLenVT srcvalue)), srcvalue, (vti.Mask true_mask), VLOpFrag), @@ -1628,6 +1716,8 @@ foreach vtiTowti = AllWidenableIntVectors in { defvar vti = vtiTowti.Vti; defvar wti = vtiTowti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(vti.Vector (riscv_trunc_vector_vl (wti.Vector wti.RegClass:$rs1), (vti.Mask V0), VLOpFrag)), @@ -1638,39 +1728,41 @@ // 11.8. Vector Integer Comparison Instructions foreach vti = AllIntegerVectors in { - defm : VPatIntegerSetCCVL_VV; - defm : VPatIntegerSetCCVL_VV; - - defm : VPatIntegerSetCCVL_VV_Swappable; - defm : VPatIntegerSetCCVL_VV_Swappable; - defm : VPatIntegerSetCCVL_VV_Swappable; - defm : VPatIntegerSetCCVL_VV_Swappable; - - defm : VPatIntegerSetCCVL_VX_Swappable; - defm : VPatIntegerSetCCVL_VX_Swappable; - defm : VPatIntegerSetCCVL_VX_Swappable; - defm : VPatIntegerSetCCVL_VX_Swappable; - defm : VPatIntegerSetCCVL_VX_Swappable; - defm : VPatIntegerSetCCVL_VX_Swappable; - defm : VPatIntegerSetCCVL_VX_Swappable; - defm : VPatIntegerSetCCVL_VX_Swappable; - // There is no VMSGE(U)_VX instruction - - defm : VPatIntegerSetCCVL_VI_Swappable; - defm : VPatIntegerSetCCVL_VI_Swappable; - defm : VPatIntegerSetCCVL_VI_Swappable; - defm : VPatIntegerSetCCVL_VI_Swappable; - defm : VPatIntegerSetCCVL_VI_Swappable; - defm : VPatIntegerSetCCVL_VI_Swappable; - - defm : VPatIntegerSetCCVL_VIPlus1_Swappable; - defm : VPatIntegerSetCCVL_VIPlus1_Swappable; - defm : VPatIntegerSetCCVL_VIPlus1_Swappable; - defm : VPatIntegerSetCCVL_VIPlus1_Swappable; + let Predicates = GetVTypePredicates.Predicates in { + defm : VPatIntegerSetCCVL_VV; + defm : VPatIntegerSetCCVL_VV; + + defm : VPatIntegerSetCCVL_VV_Swappable; + defm : VPatIntegerSetCCVL_VV_Swappable; + defm : VPatIntegerSetCCVL_VV_Swappable; + defm : VPatIntegerSetCCVL_VV_Swappable; + + defm : VPatIntegerSetCCVL_VX_Swappable; + defm : VPatIntegerSetCCVL_VX_Swappable; + defm : VPatIntegerSetCCVL_VX_Swappable; + defm : VPatIntegerSetCCVL_VX_Swappable; + defm : VPatIntegerSetCCVL_VX_Swappable; + defm : VPatIntegerSetCCVL_VX_Swappable; + defm : VPatIntegerSetCCVL_VX_Swappable; + defm : VPatIntegerSetCCVL_VX_Swappable; + // There is no VMSGE(U)_VX instruction + + defm : VPatIntegerSetCCVL_VI_Swappable; + defm : VPatIntegerSetCCVL_VI_Swappable; + defm : VPatIntegerSetCCVL_VI_Swappable; + defm : VPatIntegerSetCCVL_VI_Swappable; + defm : VPatIntegerSetCCVL_VI_Swappable; + defm : VPatIntegerSetCCVL_VI_Swappable; + + defm : VPatIntegerSetCCVL_VIPlus1_Swappable; + defm : VPatIntegerSetCCVL_VIPlus1_Swappable; + defm : VPatIntegerSetCCVL_VIPlus1_Swappable; + defm : VPatIntegerSetCCVL_VIPlus1_Swappable; + } } // foreach vti = AllIntegerVectors // 11.9. Vector Integer Min/Max Instructions @@ -1681,8 +1773,13 @@ // 11.10. Vector Single-Width Integer Multiply Instructions defm : VPatBinaryVL_VV_VX; -defm : VPatBinaryVL_VV_VX; -defm : VPatBinaryVL_VV_VX; +defm : VPatBinaryVL_VV_VX; +defm : VPatBinaryVL_VV_VX; +// vsmul.vv and vsmul.vx are not included in EEW=64 in Zve64*. +let Predicates = [HasVInstructionsFullMultiply] in { + defm : VPatBinaryVL_VV_VX; + defm : VPatBinaryVL_VV_VX; +} // 11.11. Vector Integer Divide Instructions defm : VPatBinaryVL_VV_VX_E; @@ -1708,6 +1805,8 @@ foreach vtiTowti = AllWidenableIntVectors in { defvar vti = vtiTowti.Vti; defvar wti = vtiTowti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(wti.Vector (riscv_add_vl wti.RegClass:$rd, (riscv_vwmulsu_vl_oneuse (vti.Vector vti.RegClass:$rs1), @@ -1723,71 +1822,75 @@ // 11.15. Vector Integer Merge Instructions foreach vti = AllIntegerVectors in { - def : Pat<(vti.Vector (riscv_vselect_vl (vti.Mask V0), - vti.RegClass:$rs1, - vti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VVM_"#vti.LMul.MX) - vti.RegClass:$rs2, vti.RegClass:$rs1, (vti.Mask V0), - GPR:$vl, vti.Log2SEW)>; - - def : Pat<(vti.Vector (riscv_vselect_vl (vti.Mask V0), - (SplatPat XLenVT:$rs1), - vti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VXM_"#vti.LMul.MX) - vti.RegClass:$rs2, GPR:$rs1, (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; - - def : Pat<(vti.Vector (riscv_vselect_vl (vti.Mask V0), - (SplatPat_simm5 simm5:$rs1), - vti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VIM_"#vti.LMul.MX) - vti.RegClass:$rs2, simm5:$rs1, (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; - - def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0), - vti.RegClass:$rs1, - vti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VVM_"#vti.LMul.MX#"_TU") - vti.RegClass:$rs2, vti.RegClass:$rs2, vti.RegClass:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; - - def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0), - (SplatPat XLenVT:$rs1), - vti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VXM_"#vti.LMul.MX#"_TU") - vti.RegClass:$rs2, vti.RegClass:$rs2, GPR:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; - - def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0), - (SplatPat_simm5 simm5:$rs1), - vti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VIM_"#vti.LMul.MX#"_TU") - vti.RegClass:$rs2, vti.RegClass:$rs2, simm5:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (riscv_vselect_vl (vti.Mask V0), + vti.RegClass:$rs1, + vti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VVM_"#vti.LMul.MX) + vti.RegClass:$rs2, vti.RegClass:$rs1, (vti.Mask V0), + GPR:$vl, vti.Log2SEW)>; + + def : Pat<(vti.Vector (riscv_vselect_vl (vti.Mask V0), + (SplatPat XLenVT:$rs1), + vti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VXM_"#vti.LMul.MX) + vti.RegClass:$rs2, GPR:$rs1, (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; + + def : Pat<(vti.Vector (riscv_vselect_vl (vti.Mask V0), + (SplatPat_simm5 simm5:$rs1), + vti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VIM_"#vti.LMul.MX) + vti.RegClass:$rs2, simm5:$rs1, (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; + + def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0), + vti.RegClass:$rs1, + vti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VVM_"#vti.LMul.MX#"_TU") + vti.RegClass:$rs2, vti.RegClass:$rs2, vti.RegClass:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; + + def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0), + (SplatPat XLenVT:$rs1), + vti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VXM_"#vti.LMul.MX#"_TU") + vti.RegClass:$rs2, vti.RegClass:$rs2, GPR:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; + + def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0), + (SplatPat_simm5 simm5:$rs1), + vti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VIM_"#vti.LMul.MX#"_TU") + vti.RegClass:$rs2, vti.RegClass:$rs2, simm5:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; + } } // 11.16. Vector Integer Move Instructions foreach vti = AllIntegerVectors in { - def : Pat<(vti.Vector (riscv_vmv_v_x_vl (vti.Vector undef), GPR:$rs2, VLOpFrag)), - (!cast("PseudoVMV_V_X_"#vti.LMul.MX) - $rs2, GPR:$vl, vti.Log2SEW)>; - def : Pat<(vti.Vector (riscv_vmv_v_x_vl vti.Vector:$passthru, GPR:$rs2, VLOpFrag)), - (!cast("PseudoVMV_V_X_"#vti.LMul.MX#"_TU") - $passthru, $rs2, GPR:$vl, vti.Log2SEW)>; - defvar ImmPat = !cast("sew"#vti.SEW#"simm5"); - def : Pat<(vti.Vector (riscv_vmv_v_x_vl (vti.Vector undef), (ImmPat XLenVT:$imm5), - VLOpFrag)), - (!cast("PseudoVMV_V_I_"#vti.LMul.MX) - XLenVT:$imm5, GPR:$vl, vti.Log2SEW)>; - def : Pat<(vti.Vector (riscv_vmv_v_x_vl vti.Vector:$passthru, (ImmPat XLenVT:$imm5), - VLOpFrag)), - (!cast("PseudoVMV_V_I_"#vti.LMul.MX#"_TU") - $passthru, XLenVT:$imm5, GPR:$vl, vti.Log2SEW)>; -} + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (riscv_vmv_v_x_vl (vti.Vector undef), GPR:$rs2, VLOpFrag)), + (!cast("PseudoVMV_V_X_"#vti.LMul.MX) + $rs2, GPR:$vl, vti.Log2SEW)>; + def : Pat<(vti.Vector (riscv_vmv_v_x_vl vti.Vector:$passthru, GPR:$rs2, VLOpFrag)), + (!cast("PseudoVMV_V_X_"#vti.LMul.MX#"_TU") + $passthru, $rs2, GPR:$vl, vti.Log2SEW)>; + defvar ImmPat = !cast("sew"#vti.SEW#"simm5"); + def : Pat<(vti.Vector (riscv_vmv_v_x_vl (vti.Vector undef), (ImmPat XLenVT:$imm5), + VLOpFrag)), + (!cast("PseudoVMV_V_I_"#vti.LMul.MX) + XLenVT:$imm5, GPR:$vl, vti.Log2SEW)>; + def : Pat<(vti.Vector (riscv_vmv_v_x_vl vti.Vector:$passthru, (ImmPat XLenVT:$imm5), + VLOpFrag)), + (!cast("PseudoVMV_V_I_"#vti.LMul.MX#"_TU") + $passthru, XLenVT:$imm5, GPR:$vl, vti.Log2SEW)>; + } +} // 12. Vector Fixed-Point Arithmetic Instructions @@ -1797,12 +1900,8 @@ defm : VPatBinaryVL_VV_VX; defm : VPatBinaryVL_VV_VX; -} // Predicates = [HasVInstructions] - // 13. Vector Floating-Point Instructions -let Predicates = [HasVInstructionsAnyF] in { - // 13.2. Vector Single-Width Floating-Point Add/Subtract Instructions defm : VPatBinaryFPVL_VV_VF; defm : VPatBinaryFPVL_VV_VF; @@ -1859,159 +1958,163 @@ "PseudoVMFLE", "PseudoVMFGE">; foreach vti = AllFloatVectors in { - // 13.8. Vector Floating-Point Square-Root Instruction - def : Pat<(any_riscv_fsqrt_vl (vti.Vector vti.RegClass:$rs2), (vti.Mask V0), - VLOpFrag), - (!cast("PseudoVFSQRT_V_"# vti.LMul.MX # "_E" # vti.SEW # "_MASK") - (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs2, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; - - // 13.12. Vector Floating-Point Sign-Injection Instructions - def : Pat<(riscv_fabs_vl (vti.Vector vti.RegClass:$rs), (vti.Mask V0), - VLOpFrag), - (!cast("PseudoVFSGNJX_VV_"# vti.LMul.MX #"_MASK") - (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs, - vti.RegClass:$rs, (vti.Mask V0), GPR:$vl, vti.Log2SEW, - TA_MA)>; - // Handle fneg with VFSGNJN using the same input for both operands. - def : Pat<(riscv_fneg_vl (vti.Vector vti.RegClass:$rs), (vti.Mask V0), - VLOpFrag), - (!cast("PseudoVFSGNJN_VV_"# vti.LMul.MX #"_MASK") - (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs, - vti.RegClass:$rs, (vti.Mask V0), GPR:$vl, vti.Log2SEW, - TA_MA)>; - - def : Pat<(riscv_fcopysign_vl (vti.Vector vti.RegClass:$rs1), - (vti.Vector vti.RegClass:$rs2), - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag), - (!cast("PseudoVFSGNJ_VV_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs1, - vti.RegClass:$rs2, (vti.Mask V0), GPR:$vl, vti.Log2SEW, - TAIL_AGNOSTIC)>; - - def : Pat<(riscv_fcopysign_vl (vti.Vector vti.RegClass:$rs1), - (riscv_fneg_vl vti.RegClass:$rs2, - (vti.Mask true_mask), - VLOpFrag), - srcvalue, - (vti.Mask true_mask), - VLOpFrag), - (!cast("PseudoVFSGNJN_VV_"# vti.LMul.MX) - vti.RegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW)>; - - def : Pat<(riscv_fcopysign_vl (vti.Vector vti.RegClass:$rs1), - (SplatFPOp vti.ScalarRegClass:$rs2), - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag), - (!cast("PseudoVFSGNJ_V"#vti.ScalarSuffix#"_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs1, - vti.ScalarRegClass:$rs2, (vti.Mask V0), GPR:$vl, vti.Log2SEW, - TAIL_AGNOSTIC)>; - - // Rounding without exception to implement nearbyint. - def : Pat<(any_riscv_vfround_noexcept_vl (vti.Vector vti.RegClass:$rs1), - (vti.Mask V0), VLOpFrag), - (!cast("PseudoVFROUND_NOEXCEPT_V_" # vti.LMul.MX #"_MASK") - (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + let Predicates = GetVTypePredicates.Predicates in { + // 13.8. Vector Floating-Point Square-Root Instruction + def : Pat<(any_riscv_fsqrt_vl (vti.Vector vti.RegClass:$rs2), (vti.Mask V0), + VLOpFrag), + (!cast("PseudoVFSQRT_V_"# vti.LMul.MX # "_E" # vti.SEW # "_MASK") + (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + + // 13.12. Vector Floating-Point Sign-Injection Instructions + def : Pat<(riscv_fabs_vl (vti.Vector vti.RegClass:$rs), (vti.Mask V0), + VLOpFrag), + (!cast("PseudoVFSGNJX_VV_"# vti.LMul.MX #"_MASK") + (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs, + vti.RegClass:$rs, (vti.Mask V0), GPR:$vl, vti.Log2SEW, + TA_MA)>; + // Handle fneg with VFSGNJN using the same input for both operands. + def : Pat<(riscv_fneg_vl (vti.Vector vti.RegClass:$rs), (vti.Mask V0), + VLOpFrag), + (!cast("PseudoVFSGNJN_VV_"# vti.LMul.MX #"_MASK") + (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs, + vti.RegClass:$rs, (vti.Mask V0), GPR:$vl, vti.Log2SEW, + TA_MA)>; + + def : Pat<(riscv_fcopysign_vl (vti.Vector vti.RegClass:$rs1), + (vti.Vector vti.RegClass:$rs2), + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag), + (!cast("PseudoVFSGNJ_VV_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs1, + vti.RegClass:$rs2, (vti.Mask V0), GPR:$vl, vti.Log2SEW, + TAIL_AGNOSTIC)>; + + def : Pat<(riscv_fcopysign_vl (vti.Vector vti.RegClass:$rs1), + (riscv_fneg_vl vti.RegClass:$rs2, + (vti.Mask true_mask), + VLOpFrag), + srcvalue, + (vti.Mask true_mask), + VLOpFrag), + (!cast("PseudoVFSGNJN_VV_"# vti.LMul.MX) + vti.RegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW)>; + + def : Pat<(riscv_fcopysign_vl (vti.Vector vti.RegClass:$rs1), + (SplatFPOp vti.ScalarRegClass:$rs2), + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag), + (!cast("PseudoVFSGNJ_V"#vti.ScalarSuffix#"_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs1, + vti.ScalarRegClass:$rs2, (vti.Mask V0), GPR:$vl, vti.Log2SEW, + TAIL_AGNOSTIC)>; + + // Rounding without exception to implement nearbyint. + def : Pat<(any_riscv_vfround_noexcept_vl (vti.Vector vti.RegClass:$rs1), + (vti.Mask V0), VLOpFrag), + (!cast("PseudoVFROUND_NOEXCEPT_V_" # vti.LMul.MX #"_MASK") + (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TA_MA)>; + } } foreach fvti = AllFloatVectors in { // Floating-point vselects: // 11.15. Vector Integer Merge Instructions // 13.15. Vector Floating-Point Merge Instruction - def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), - fvti.RegClass:$rs1, - fvti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VVM_"#fvti.LMul.MX) - fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0), - GPR:$vl, fvti.Log2SEW)>; - - def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), - (SplatFPOp fvti.ScalarRegClass:$rs1), - fvti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVFMERGE_V"#fvti.ScalarSuffix#"M_"#fvti.LMul.MX) - fvti.RegClass:$rs2, - (fvti.Scalar fvti.ScalarRegClass:$rs1), - (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; - - def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), - (SplatFPOp (SelectFPImm (XLenVT GPR:$imm))), - fvti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VXM_"#fvti.LMul.MX) - fvti.RegClass:$rs2, - GPR:$imm, - (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; - - def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), - (SplatFPOp (fvti.Scalar fpimm0)), - fvti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VIM_"#fvti.LMul.MX) - fvti.RegClass:$rs2, 0, (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; - - def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0), - fvti.RegClass:$rs1, - fvti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VVM_"#fvti.LMul.MX#"_TU") - fvti.RegClass:$rs2, fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0), - GPR:$vl, fvti.Log2SEW)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), + fvti.RegClass:$rs1, + fvti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VVM_"#fvti.LMul.MX) + fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0), + GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0), - (SplatFPOp fvti.ScalarRegClass:$rs1), - fvti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVFMERGE_V"#fvti.ScalarSuffix#"M_"#fvti.LMul.MX#"_TU") - fvti.RegClass:$rs2, fvti.RegClass:$rs2, - (fvti.Scalar fvti.ScalarRegClass:$rs1), - (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; - - def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0), - (SplatFPOp (fvti.Scalar fpimm0)), - fvti.RegClass:$rs2, - VLOpFrag)), - (!cast("PseudoVMERGE_VIM_"#fvti.LMul.MX#"_TU") - fvti.RegClass:$rs2, fvti.RegClass:$rs2, 0, (fvti.Mask V0), - GPR:$vl, fvti.Log2SEW)>; - - // 13.16. Vector Floating-Point Move Instruction - // If we're splatting fpimm0, use vmv.v.x vd, x0. - def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl - (fvti.Vector undef), (fvti.Scalar (fpimm0)), VLOpFrag)), - (!cast("PseudoVMV_V_I_"#fvti.LMul.MX) - 0, GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl - fvti.Vector:$passthru, (fvti.Scalar (fpimm0)), VLOpFrag)), - (!cast("PseudoVMV_V_I_"#fvti.LMul.MX#"_TU") - $passthru, 0, GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl - (fvti.Vector undef), (fvti.Scalar (SelectFPImm (XLenVT GPR:$imm))), VLOpFrag)), - (!cast("PseudoVMV_V_X_"#fvti.LMul.MX) - GPR:$imm, GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl - fvti.Vector:$passthru, (fvti.Scalar (SelectFPImm (XLenVT GPR:$imm))), VLOpFrag)), - (!cast("PseudoVMV_V_X_"#fvti.LMul.MX#"_TU") - $passthru, GPR:$imm, GPR:$vl, fvti.Log2SEW)>; - - def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl - (fvti.Vector undef), (fvti.Scalar fvti.ScalarRegClass:$rs2), VLOpFrag)), - (!cast("PseudoVFMV_V_" # fvti.ScalarSuffix # "_" # - fvti.LMul.MX) - (fvti.Scalar fvti.ScalarRegClass:$rs2), - GPR:$vl, fvti.Log2SEW)>; - def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl - fvti.Vector:$passthru, (fvti.Scalar fvti.ScalarRegClass:$rs2), VLOpFrag)), - (!cast("PseudoVFMV_V_" # fvti.ScalarSuffix # "_" # - fvti.LMul.MX # "_TU") - $passthru, (fvti.Scalar fvti.ScalarRegClass:$rs2), - GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), + (SplatFPOp fvti.ScalarRegClass:$rs1), + fvti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVFMERGE_V"#fvti.ScalarSuffix#"M_"#fvti.LMul.MX) + fvti.RegClass:$rs2, + (fvti.Scalar fvti.ScalarRegClass:$rs1), + (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; + + def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), + (SplatFPOp (SelectFPImm (XLenVT GPR:$imm))), + fvti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VXM_"#fvti.LMul.MX) + fvti.RegClass:$rs2, + GPR:$imm, + (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; + + def : Pat<(fvti.Vector (riscv_vselect_vl (fvti.Mask V0), + (SplatFPOp (fvti.Scalar fpimm0)), + fvti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VIM_"#fvti.LMul.MX) + fvti.RegClass:$rs2, 0, (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; + + def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0), + fvti.RegClass:$rs1, + fvti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VVM_"#fvti.LMul.MX#"_TU") + fvti.RegClass:$rs2, fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0), + GPR:$vl, fvti.Log2SEW)>; + + def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0), + (SplatFPOp fvti.ScalarRegClass:$rs1), + fvti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVFMERGE_V"#fvti.ScalarSuffix#"M_"#fvti.LMul.MX#"_TU") + fvti.RegClass:$rs2, fvti.RegClass:$rs2, + (fvti.Scalar fvti.ScalarRegClass:$rs1), + (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; + + def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0), + (SplatFPOp (fvti.Scalar fpimm0)), + fvti.RegClass:$rs2, + VLOpFrag)), + (!cast("PseudoVMERGE_VIM_"#fvti.LMul.MX#"_TU") + fvti.RegClass:$rs2, fvti.RegClass:$rs2, 0, (fvti.Mask V0), + GPR:$vl, fvti.Log2SEW)>; + + // 13.16. Vector Floating-Point Move Instruction + // If we're splatting fpimm0, use vmv.v.x vd, x0. + def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl + (fvti.Vector undef), (fvti.Scalar (fpimm0)), VLOpFrag)), + (!cast("PseudoVMV_V_I_"#fvti.LMul.MX) + 0, GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl + fvti.Vector:$passthru, (fvti.Scalar (fpimm0)), VLOpFrag)), + (!cast("PseudoVMV_V_I_"#fvti.LMul.MX#"_TU") + $passthru, 0, GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl + (fvti.Vector undef), (fvti.Scalar (SelectFPImm (XLenVT GPR:$imm))), VLOpFrag)), + (!cast("PseudoVMV_V_X_"#fvti.LMul.MX) + GPR:$imm, GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl + fvti.Vector:$passthru, (fvti.Scalar (SelectFPImm (XLenVT GPR:$imm))), VLOpFrag)), + (!cast("PseudoVMV_V_X_"#fvti.LMul.MX#"_TU") + $passthru, GPR:$imm, GPR:$vl, fvti.Log2SEW)>; + + def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl + (fvti.Vector undef), (fvti.Scalar fvti.ScalarRegClass:$rs2), VLOpFrag)), + (!cast("PseudoVFMV_V_" # fvti.ScalarSuffix # "_" # + fvti.LMul.MX) + (fvti.Scalar fvti.ScalarRegClass:$rs2), + GPR:$vl, fvti.Log2SEW)>; + def : Pat<(fvti.Vector (riscv_vfmv_v_f_vl + fvti.Vector:$passthru, (fvti.Scalar fvti.ScalarRegClass:$rs2), VLOpFrag)), + (!cast("PseudoVFMV_V_" # fvti.ScalarSuffix # "_" # + fvti.LMul.MX # "_TU") + $passthru, (fvti.Scalar fvti.ScalarRegClass:$rs2), + GPR:$vl, fvti.Log2SEW)>; + } } // 13.17. Vector Single-Width Floating-Point/Integer Type-Convert Instructions @@ -2047,6 +2150,8 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar fwti = fvtiToFWti.Wti; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(fwti.Vector (any_riscv_fpextend_vl (fvti.Vector fvti.RegClass:$rs1), (fvti.Mask V0), @@ -2074,27 +2179,27 @@ foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar fwti = fvtiToFWti.Wti; - def : Pat<(fvti.Vector (any_riscv_fpround_vl - (fwti.Vector fwti.RegClass:$rs1), - (fwti.Mask V0), VLOpFrag)), - (!cast("PseudoVFNCVT_F_F_W_"#fvti.LMul.MX#"_MASK") - (fvti.Vector (IMPLICIT_DEF)), fwti.RegClass:$rs1, - (fwti.Mask V0), GPR:$vl, fvti.Log2SEW, TA_MA)>; - - def : Pat<(fvti.Vector (any_riscv_fncvt_rod_vl - (fwti.Vector fwti.RegClass:$rs1), - (fwti.Mask V0), VLOpFrag)), - (!cast("PseudoVFNCVT_ROD_F_F_W_"#fvti.LMul.MX#"_MASK") - (fvti.Vector (IMPLICIT_DEF)), fwti.RegClass:$rs1, - (fwti.Mask V0), GPR:$vl, fvti.Log2SEW, TA_MA)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat<(fvti.Vector (any_riscv_fpround_vl + (fwti.Vector fwti.RegClass:$rs1), + (fwti.Mask V0), VLOpFrag)), + (!cast("PseudoVFNCVT_F_F_W_"#fvti.LMul.MX#"_MASK") + (fvti.Vector (IMPLICIT_DEF)), fwti.RegClass:$rs1, + (fwti.Mask V0), GPR:$vl, fvti.Log2SEW, TA_MA)>; + + def : Pat<(fvti.Vector (any_riscv_fncvt_rod_vl + (fwti.Vector fwti.RegClass:$rs1), + (fwti.Mask V0), VLOpFrag)), + (!cast("PseudoVFNCVT_ROD_F_F_W_"#fvti.LMul.MX#"_MASK") + (fvti.Vector (IMPLICIT_DEF)), fwti.RegClass:$rs1, + (fwti.Mask V0), GPR:$vl, fvti.Log2SEW, TA_MA)>; + } } -} // Predicates = [HasVInstructionsAnyF] - // 14. Vector Reduction Operations // 14.1. Vector Single-Width Integer Reduction Instructions -let Predicates = [HasVInstructions] in { defm : VPatReductionVL; defm : VPatReductionVL; defm : VPatReductionVL; @@ -2110,10 +2215,8 @@ defm : VPatWidenReductionVL_Ext_VL; defm : VPatWidenReductionVL; defm : VPatWidenReductionVL_Ext_VL; -} // Predicates = [HasVInstructions] // 14.3. Vector Single-Width Floating-Point Reduction Instructions -let Predicates = [HasVInstructionsAnyF] in { defm : VPatReductionVL; defm : VPatReductionVL; defm : VPatReductionVL; @@ -2124,126 +2227,124 @@ defm : VPatWidenReductionVL_Ext_VL; defm : VPatWidenReductionVL; defm : VPatWidenReductionVL_Ext_VL; -} // Predicates = [HasVInstructionsAnyF] // 15. Vector Mask Instructions -let Predicates = [HasVInstructions] in { - foreach mti = AllMasks in { - // 15.1 Vector Mask-Register Logical Instructions - def : Pat<(mti.Mask (riscv_vmset_vl VLOpFrag)), - (!cast("PseudoVMSET_M_" # mti.BX) GPR:$vl, mti.Log2SEW)>; - def : Pat<(mti.Mask (riscv_vmclr_vl VLOpFrag)), - (!cast("PseudoVMCLR_M_" # mti.BX) GPR:$vl, mti.Log2SEW)>; - - def : Pat<(mti.Mask (riscv_vmand_vl VR:$rs1, VR:$rs2, VLOpFrag)), - (!cast("PseudoVMAND_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - def : Pat<(mti.Mask (riscv_vmor_vl VR:$rs1, VR:$rs2, VLOpFrag)), - (!cast("PseudoVMOR_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - def : Pat<(mti.Mask (riscv_vmxor_vl VR:$rs1, VR:$rs2, VLOpFrag)), - (!cast("PseudoVMXOR_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - - def : Pat<(mti.Mask (riscv_vmand_vl VR:$rs1, - (riscv_vmnot_vl VR:$rs2, VLOpFrag), + let Predicates = [HasVInstructions] in { + // 15.1 Vector Mask-Register Logical Instructions + def : Pat<(mti.Mask (riscv_vmset_vl VLOpFrag)), + (!cast("PseudoVMSET_M_" # mti.BX) GPR:$vl, mti.Log2SEW)>; + def : Pat<(mti.Mask (riscv_vmclr_vl VLOpFrag)), + (!cast("PseudoVMCLR_M_" # mti.BX) GPR:$vl, mti.Log2SEW)>; + + def : Pat<(mti.Mask (riscv_vmand_vl VR:$rs1, VR:$rs2, VLOpFrag)), + (!cast("PseudoVMAND_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + def : Pat<(mti.Mask (riscv_vmor_vl VR:$rs1, VR:$rs2, VLOpFrag)), + (!cast("PseudoVMOR_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + def : Pat<(mti.Mask (riscv_vmxor_vl VR:$rs1, VR:$rs2, VLOpFrag)), + (!cast("PseudoVMXOR_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + + def : Pat<(mti.Mask (riscv_vmand_vl VR:$rs1, + (riscv_vmnot_vl VR:$rs2, VLOpFrag), + VLOpFrag)), + (!cast("PseudoVMANDN_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + def : Pat<(mti.Mask (riscv_vmor_vl VR:$rs1, + (riscv_vmnot_vl VR:$rs2, VLOpFrag), + VLOpFrag)), + (!cast("PseudoVMORN_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + // XOR is associative so we need 2 patterns for VMXNOR. + def : Pat<(mti.Mask (riscv_vmxor_vl (riscv_vmnot_vl VR:$rs1, + VLOpFrag), + VR:$rs2, VLOpFrag)), + (!cast("PseudoVMXNOR_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + + def : Pat<(mti.Mask (riscv_vmnot_vl (riscv_vmand_vl VR:$rs1, VR:$rs2, + VLOpFrag), + VLOpFrag)), + (!cast("PseudoVMNAND_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + def : Pat<(mti.Mask (riscv_vmnot_vl (riscv_vmor_vl VR:$rs1, VR:$rs2, + VLOpFrag), + VLOpFrag)), + (!cast("PseudoVMNOR_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + def : Pat<(mti.Mask (riscv_vmnot_vl (riscv_vmxor_vl VR:$rs1, VR:$rs2, + VLOpFrag), + VLOpFrag)), + (!cast("PseudoVMXNOR_MM_" # mti.LMul.MX) + VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; + + // Match the not idiom to the vmnot.m pseudo. + def : Pat<(mti.Mask (riscv_vmnot_vl VR:$rs, VLOpFrag)), + (!cast("PseudoVMNAND_MM_" # mti.LMul.MX) + VR:$rs, VR:$rs, GPR:$vl, mti.Log2SEW)>; + + // 15.2 Vector count population in mask vcpop.m + def : Pat<(XLenVT (riscv_vcpop_vl (mti.Mask VR:$rs2), (mti.Mask true_mask), VLOpFrag)), - (!cast("PseudoVMANDN_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - def : Pat<(mti.Mask (riscv_vmor_vl VR:$rs1, - (riscv_vmnot_vl VR:$rs2, VLOpFrag), - VLOpFrag)), - (!cast("PseudoVMORN_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - // XOR is associative so we need 2 patterns for VMXNOR. - def : Pat<(mti.Mask (riscv_vmxor_vl (riscv_vmnot_vl VR:$rs1, - VLOpFrag), - VR:$rs2, VLOpFrag)), - (!cast("PseudoVMXNOR_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - - def : Pat<(mti.Mask (riscv_vmnot_vl (riscv_vmand_vl VR:$rs1, VR:$rs2, - VLOpFrag), + (!cast("PseudoVCPOP_M_" # mti.BX) + VR:$rs2, GPR:$vl, mti.Log2SEW)>; + def : Pat<(XLenVT (riscv_vcpop_vl (mti.Mask VR:$rs2), (mti.Mask V0), VLOpFrag)), - (!cast("PseudoVMNAND_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - def : Pat<(mti.Mask (riscv_vmnot_vl (riscv_vmor_vl VR:$rs1, VR:$rs2, - VLOpFrag), + (!cast("PseudoVCPOP_M_" # mti.BX # "_MASK") + VR:$rs2, (mti.Mask V0), GPR:$vl, mti.Log2SEW)>; + + // 15.3 vfirst find-first-set mask bit + def : Pat<(XLenVT (riscv_vfirst_vl (mti.Mask VR:$rs2), (mti.Mask true_mask), VLOpFrag)), - (!cast("PseudoVMNOR_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - def : Pat<(mti.Mask (riscv_vmnot_vl (riscv_vmxor_vl VR:$rs1, VR:$rs2, - VLOpFrag), + (!cast("PseudoVFIRST_M_" # mti.BX) + VR:$rs2, GPR:$vl, mti.Log2SEW)>; + def : Pat<(XLenVT (riscv_vfirst_vl (mti.Mask VR:$rs2), (mti.Mask V0), VLOpFrag)), - (!cast("PseudoVMXNOR_MM_" # mti.LMul.MX) - VR:$rs1, VR:$rs2, GPR:$vl, mti.Log2SEW)>; - - // Match the not idiom to the vmnot.m pseudo. - def : Pat<(mti.Mask (riscv_vmnot_vl VR:$rs, VLOpFrag)), - (!cast("PseudoVMNAND_MM_" # mti.LMul.MX) - VR:$rs, VR:$rs, GPR:$vl, mti.Log2SEW)>; - - // 15.2 Vector count population in mask vcpop.m - def : Pat<(XLenVT (riscv_vcpop_vl (mti.Mask VR:$rs2), (mti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVCPOP_M_" # mti.BX) - VR:$rs2, GPR:$vl, mti.Log2SEW)>; - def : Pat<(XLenVT (riscv_vcpop_vl (mti.Mask VR:$rs2), (mti.Mask V0), - VLOpFrag)), - (!cast("PseudoVCPOP_M_" # mti.BX # "_MASK") - VR:$rs2, (mti.Mask V0), GPR:$vl, mti.Log2SEW)>; - - // 15.3 vfirst find-first-set mask bit - def : Pat<(XLenVT (riscv_vfirst_vl (mti.Mask VR:$rs2), (mti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVFIRST_M_" # mti.BX) - VR:$rs2, GPR:$vl, mti.Log2SEW)>; - def : Pat<(XLenVT (riscv_vfirst_vl (mti.Mask VR:$rs2), (mti.Mask V0), - VLOpFrag)), - (!cast("PseudoVFIRST_M_" # mti.BX # "_MASK") - VR:$rs2, (mti.Mask V0), GPR:$vl, mti.Log2SEW)>; -} - -} // Predicates = [HasVInstructions] + (!cast("PseudoVFIRST_M_" # mti.BX # "_MASK") + VR:$rs2, (mti.Mask V0), GPR:$vl, mti.Log2SEW)>; + } +} // 16. Vector Permutation Instructions -let Predicates = [HasVInstructions] in { // 16.1. Integer Scalar Move Instructions // 16.4. Vector Register Gather Instruction foreach vti = AllIntegerVectors in { - def : Pat<(vti.Vector (riscv_vmv_s_x_vl (vti.Vector vti.RegClass:$merge), - vti.ScalarRegClass:$rs1, - VLOpFrag)), - (!cast("PseudoVMV_S_X_"#vti.LMul.MX) - vti.RegClass:$merge, - (vti.Scalar vti.ScalarRegClass:$rs1), GPR:$vl, vti.Log2SEW)>; - - def : Pat<(vti.Vector (riscv_vrgather_vv_vl vti.RegClass:$rs2, - vti.RegClass:$rs1, - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag)), - (!cast("PseudoVRGATHER_VV_"# vti.LMul.MX#"_E"# vti.SEW#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs2, vti.RegClass:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(vti.Vector (riscv_vrgather_vx_vl vti.RegClass:$rs2, GPR:$rs1, - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag)), - (!cast("PseudoVRGATHER_VX_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs2, GPR:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(vti.Vector (riscv_vrgather_vx_vl vti.RegClass:$rs2, - uimm5:$imm, - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag)), - (!cast("PseudoVRGATHER_VI_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs2, uimm5:$imm, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (riscv_vmv_s_x_vl (vti.Vector vti.RegClass:$merge), + vti.ScalarRegClass:$rs1, + VLOpFrag)), + (!cast("PseudoVMV_S_X_"#vti.LMul.MX) + vti.RegClass:$merge, + (vti.Scalar vti.ScalarRegClass:$rs1), GPR:$vl, vti.Log2SEW)>; + + def : Pat<(vti.Vector (riscv_vrgather_vv_vl vti.RegClass:$rs2, + vti.RegClass:$rs1, + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVRGATHER_VV_"# vti.LMul.MX#"_E"# vti.SEW#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs2, vti.RegClass:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_vrgather_vx_vl vti.RegClass:$rs2, GPR:$rs1, + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVRGATHER_VX_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs2, GPR:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_vrgather_vx_vl vti.RegClass:$rs2, + uimm5:$imm, + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVRGATHER_VI_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs2, uimm5:$imm, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + } // emul = lmul * 16 / sew defvar vlmul = vti.LMul; @@ -2253,7 +2354,7 @@ defvar emul_str = octuple_to_str.ret; defvar ivti = !cast("VI16" # emul_str); defvar inst = "PseudoVRGATHEREI16_VV_" # vti.LMul.MX # "_E" # vti.SEW # "_" # emul_str; - + let Predicates = GetVTypePredicates.Predicates in def : Pat<(vti.Vector (riscv_vrgatherei16_vv_vl vti.RegClass:$rs2, (ivti.Vector ivti.RegClass:$rs1), @@ -2266,55 +2367,55 @@ } } -} // Predicates = [HasVInstructions] - -let Predicates = [HasVInstructionsAnyF] in { - // 16.2. Floating-Point Scalar Move Instructions foreach vti = AllFloatVectors in { - def : Pat<(vti.Vector (riscv_vfmv_s_f_vl (vti.Vector vti.RegClass:$merge), - (vti.Scalar (fpimm0)), - VLOpFrag)), - (!cast("PseudoVMV_S_X_"#vti.LMul.MX) - vti.RegClass:$merge, X0, GPR:$vl, vti.Log2SEW)>; - def : Pat<(vti.Vector (riscv_vfmv_s_f_vl (vti.Vector vti.RegClass:$merge), - (vti.Scalar (SelectFPImm (XLenVT GPR:$imm))), - VLOpFrag)), - (!cast("PseudoVMV_S_X_"#vti.LMul.MX) - vti.RegClass:$merge, GPR:$imm, GPR:$vl, vti.Log2SEW)>; - def : Pat<(vti.Vector (riscv_vfmv_s_f_vl (vti.Vector vti.RegClass:$merge), - vti.ScalarRegClass:$rs1, - VLOpFrag)), - (!cast("PseudoVFMV_S_"#vti.ScalarSuffix#"_"#vti.LMul.MX) - vti.RegClass:$merge, - (vti.Scalar vti.ScalarRegClass:$rs1), GPR:$vl, vti.Log2SEW)>; + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (riscv_vfmv_s_f_vl (vti.Vector vti.RegClass:$merge), + (vti.Scalar (fpimm0)), + VLOpFrag)), + (!cast("PseudoVMV_S_X_"#vti.LMul.MX) + vti.RegClass:$merge, X0, GPR:$vl, vti.Log2SEW)>; + def : Pat<(vti.Vector (riscv_vfmv_s_f_vl (vti.Vector vti.RegClass:$merge), + (vti.Scalar (SelectFPImm (XLenVT GPR:$imm))), + VLOpFrag)), + (!cast("PseudoVMV_S_X_"#vti.LMul.MX) + vti.RegClass:$merge, GPR:$imm, GPR:$vl, vti.Log2SEW)>; + def : Pat<(vti.Vector (riscv_vfmv_s_f_vl (vti.Vector vti.RegClass:$merge), + vti.ScalarRegClass:$rs1, + VLOpFrag)), + (!cast("PseudoVFMV_S_"#vti.ScalarSuffix#"_"#vti.LMul.MX) + vti.RegClass:$merge, + (vti.Scalar vti.ScalarRegClass:$rs1), GPR:$vl, vti.Log2SEW)>; + } defvar ivti = GetIntVTypeInfo.Vti; - - def : Pat<(vti.Vector - (riscv_vrgather_vv_vl vti.RegClass:$rs2, - (ivti.Vector vti.RegClass:$rs1), - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag)), - (!cast("PseudoVRGATHER_VV_"# vti.LMul.MX#"_E"# vti.SEW#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs2, vti.RegClass:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(vti.Vector (riscv_vrgather_vx_vl vti.RegClass:$rs2, GPR:$rs1, - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag)), - (!cast("PseudoVRGATHER_VX_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs2, GPR:$rs1, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(vti.Vector - (riscv_vrgather_vx_vl vti.RegClass:$rs2, - uimm5:$imm, - vti.RegClass:$merge, - (vti.Mask V0), - VLOpFrag)), - (!cast("PseudoVRGATHER_VI_"# vti.LMul.MX#"_MASK") - vti.RegClass:$merge, vti.RegClass:$rs2, uimm5:$imm, - (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in { + def : Pat<(vti.Vector + (riscv_vrgather_vv_vl vti.RegClass:$rs2, + (ivti.Vector vti.RegClass:$rs1), + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVRGATHER_VV_"# vti.LMul.MX#"_E"# vti.SEW#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs2, vti.RegClass:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_vrgather_vx_vl vti.RegClass:$rs2, GPR:$rs1, + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVRGATHER_VX_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs2, GPR:$rs1, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector + (riscv_vrgather_vx_vl vti.RegClass:$rs2, + uimm5:$imm, + vti.RegClass:$merge, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVRGATHER_VI_"# vti.LMul.MX#"_MASK") + vti.RegClass:$merge, vti.RegClass:$rs2, uimm5:$imm, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + } defvar vlmul = vti.LMul; defvar octuple_lmul = vlmul.octuple; @@ -2323,7 +2424,8 @@ defvar emul_str = octuple_to_str.ret; defvar ivti = !cast("VI16" # emul_str); defvar inst = "PseudoVRGATHEREI16_VV_" # vti.LMul.MX # "_E" # vti.SEW # "_" # emul_str; - + let Predicates = !listconcat(GetVTypePredicates.Predicates, + GetVTypePredicates.Predicates) in def : Pat<(vti.Vector (riscv_vrgatherei16_vv_vl vti.RegClass:$rs2, (ivti.Vector ivti.RegClass:$rs1), @@ -2336,8 +2438,6 @@ } } -} // Predicates = [HasVInstructionsAnyF] - //===----------------------------------------------------------------------===// // Miscellaneous RISCVISD SDNodes //===----------------------------------------------------------------------===// @@ -2362,71 +2462,71 @@ def riscv_slidedown_vl : SDNode<"RISCVISD::VSLIDEDOWN_VL", SDTRVVSlide, []>; def riscv_slide1down_vl : SDNode<"RISCVISD::VSLIDE1DOWN_VL", SDTRVVSlide1, []>; -let Predicates = [HasVInstructions] in { - foreach vti = AllIntegerVectors in { - def : Pat<(vti.Vector (riscv_vid_vl (vti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVID_V_"#vti.LMul.MX) GPR:$vl, vti.Log2SEW)>; - - def : Pat<(vti.Vector (riscv_slide1up_vl (vti.Vector undef), - (vti.Vector vti.RegClass:$rs1), - GPR:$rs2, (vti.Mask true_mask), - VLOpFrag)), - (!cast("PseudoVSLIDE1UP_VX_"#vti.LMul.MX) - vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; - 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#"_TU") - vti.RegClass:$rd, vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; - def : Pat<(vti.Vector (riscv_slide1down_vl (vti.Vector undef), + let Predicates = GetVTypePredicates.Predicates in { + def : Pat<(vti.Vector (riscv_vid_vl (vti.Mask true_mask), + VLOpFrag)), + (!cast("PseudoVID_V_"#vti.LMul.MX) GPR:$vl, vti.Log2SEW)>; + + def : Pat<(vti.Vector (riscv_slide1up_vl (vti.Vector undef), (vti.Vector vti.RegClass:$rs1), GPR:$rs2, (vti.Mask true_mask), VLOpFrag)), - (!cast("PseudoVSLIDE1DOWN_VX_"#vti.LMul.MX) - vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; - def : Pat<(vti.Vector (riscv_slide1down_vl (vti.Vector vti.RegClass:$rd), + (!cast("PseudoVSLIDE1UP_VX_"#vti.LMul.MX) + vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; + 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("PseudoVSLIDE1DOWN_VX_"#vti.LMul.MX#"_TU") - vti.RegClass:$rd, vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; + (!cast("PseudoVSLIDE1UP_VX_"#vti.LMul.MX#"_TU") + vti.RegClass:$rd, vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; + def : Pat<(vti.Vector (riscv_slide1down_vl (vti.Vector undef), + (vti.Vector vti.RegClass:$rs1), + GPR:$rs2, (vti.Mask true_mask), + VLOpFrag)), + (!cast("PseudoVSLIDE1DOWN_VX_"#vti.LMul.MX) + vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; + 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#"_TU") + vti.RegClass:$rd, vti.RegClass:$rs1, GPR:$rs2, GPR:$vl, vti.Log2SEW)>; + } } foreach vti = AllVectors 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), + 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("PseudoVSLIDEDOWN_VI_"#vti.LMul.MX) - vti.RegClass:$rs3, vti.RegClass:$rs1, uimm5:$rs2, - GPR:$vl, vti.Log2SEW, (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_slidedown_vl (vti.Vector vti.RegClass:$rs3), + 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("PseudoVSLIDEDOWN_VX_"#vti.LMul.MX) - vti.RegClass:$rs3, vti.RegClass:$rs1, GPR:$rs2, - GPR:$vl, vti.Log2SEW, (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))>; + } } - -} // Predicates = [HasVInstructions]