@@ -132,9 +132,6 @@ def riscv_uaddsat_vl : SDNode<"RISCVISD::UADDSAT_VL", SDT_RISCVIntBinOp_VL, [S
132
132
def riscv_ssubsat_vl : SDNode<"RISCVISD::SSUBSAT_VL", SDT_RISCVIntBinOp_VL>;
133
133
def riscv_usubsat_vl : SDNode<"RISCVISD::USUBSAT_VL", SDT_RISCVIntBinOp_VL>;
134
134
135
- def riscv_vnclipu_vl : SDNode<"RISCVISD::VNCLIPU_VL", SDT_RISCVVNBinOp_RM_VL>;
136
- def riscv_vnclip_vl : SDNode<"RISCVISD::VNCLIP_VL", SDT_RISCVVNBinOp_RM_VL>;
137
-
138
135
def riscv_fadd_vl : SDNode<"RISCVISD::FADD_VL", SDT_RISCVFPBinOp_VL, [SDNPCommutative]>;
139
136
def riscv_fsub_vl : SDNode<"RISCVISD::FSUB_VL", SDT_RISCVFPBinOp_VL>;
140
137
def riscv_fmul_vl : SDNode<"RISCVISD::FMUL_VL", SDT_RISCVFPBinOp_VL, [SDNPCommutative]>;
@@ -408,12 +405,17 @@ def riscv_ext_vl : PatFrags<(ops node:$A, node:$B, node:$C),
408
405
[(riscv_sext_vl node:$A, node:$B, node:$C),
409
406
(riscv_zext_vl node:$A, node:$B, node:$C)]>;
410
407
408
+ def SDT_RISCVVTRUNCATE_VL : SDTypeProfile<1, 3, [SDTCisVec<0>,
409
+ SDTCisSameNumEltsAs<0, 1>,
410
+ SDTCisSameNumEltsAs<0, 2>,
411
+ SDTCVecEltisVT<2, i1>,
412
+ SDTCisVT<3, XLenVT>]>;
411
413
def riscv_trunc_vector_vl : SDNode<"RISCVISD::TRUNCATE_VECTOR_VL",
412
- SDTypeProfile<1, 3, [SDTCisVec<0>,
413
- SDTCisSameNumEltsAs<0, 1> ,
414
- SDTCisSameNumEltsAs<0, 2>,
415
- SDTCVecEltisVT<2, i1> ,
416
- SDTCisVT<3, XLenVT>]> >;
414
+ SDT_RISCVVTRUNCATE_VL>;
415
+ def riscv_trunc_vector_vl_ssat : SDNode<"RISCVISD::TRUNCATE_VECTOR_VL_SSAT" ,
416
+ SDT_RISCVVTRUNCATE_VL>;
417
+ def riscv_trunc_vector_vl_usat : SDNode<"RISCVISD::TRUNCATE_VECTOR_VL_USAT" ,
418
+ SDT_RISCVVTRUNCATE_VL >;
417
419
418
420
def SDT_RISCVVWIntBinOp_VL : SDTypeProfile<1, 5, [SDTCisVec<0>, SDTCisInt<0>,
419
421
SDTCisInt<1>,
@@ -650,34 +652,6 @@ class VPatBinaryVL_V<SDPatternOperator vop,
650
652
op2_reg_class:$rs2,
651
653
(mask_type V0), GPR:$vl, log2sew, TAIL_AGNOSTIC)>;
652
654
653
- multiclass VPatBinaryRM_VL_V<SDNode vop,
654
- string instruction_name,
655
- string suffix,
656
- ValueType result_type,
657
- ValueType op1_type,
658
- ValueType op2_type,
659
- ValueType mask_type,
660
- int sew,
661
- LMULInfo vlmul,
662
- VReg result_reg_class,
663
- VReg op1_reg_class,
664
- VReg op2_reg_class> {
665
- def : Pat<(result_type (vop
666
- (op1_type op1_reg_class:$rs1),
667
- (op2_type op2_reg_class:$rs2),
668
- (result_type result_reg_class:$merge),
669
- (mask_type V0),
670
- (XLenVT timm:$roundmode),
671
- VLOpFrag)),
672
- (!cast<Instruction>(instruction_name#"_"#suffix#"_"# vlmul.MX#"_MASK")
673
- result_reg_class:$merge,
674
- op1_reg_class:$rs1,
675
- op2_reg_class:$rs2,
676
- (mask_type V0),
677
- (XLenVT timm:$roundmode),
678
- GPR:$vl, sew, TAIL_AGNOSTIC)>;
679
- }
680
-
681
655
class VPatBinaryVL_V_RM<SDPatternOperator vop,
682
656
string instruction_name,
683
657
string suffix,
@@ -838,35 +812,6 @@ class VPatBinaryVL_XI<SDPatternOperator vop,
838
812
xop_kind:$rs2,
839
813
(mask_type V0), GPR:$vl, log2sew, TAIL_AGNOSTIC)>;
840
814
841
- multiclass VPatBinaryRM_VL_XI<SDNode vop,
842
- string instruction_name,
843
- string suffix,
844
- ValueType result_type,
845
- ValueType vop1_type,
846
- ValueType vop2_type,
847
- ValueType mask_type,
848
- int sew,
849
- LMULInfo vlmul,
850
- VReg result_reg_class,
851
- VReg vop_reg_class,
852
- ComplexPattern SplatPatKind,
853
- DAGOperand xop_kind> {
854
- def : Pat<(result_type (vop
855
- (vop1_type vop_reg_class:$rs1),
856
- (vop2_type (SplatPatKind (XLenVT xop_kind:$rs2))),
857
- (result_type result_reg_class:$merge),
858
- (mask_type V0),
859
- (XLenVT timm:$roundmode),
860
- VLOpFrag)),
861
- (!cast<Instruction>(instruction_name#_#suffix#_# vlmul.MX#"_MASK")
862
- result_reg_class:$merge,
863
- vop_reg_class:$rs1,
864
- xop_kind:$rs2,
865
- (mask_type V0),
866
- (XLenVT timm:$roundmode),
867
- GPR:$vl, sew, TAIL_AGNOSTIC)>;
868
- }
869
-
870
815
multiclass VPatBinaryVL_VV_VX<SDPatternOperator vop, string instruction_name,
871
816
list<VTypeInfo> vtilist = AllIntegerVectors,
872
817
bit isSEWAware = 0> {
@@ -965,24 +910,6 @@ multiclass VPatBinaryNVL_WV_WX_WI<SDPatternOperator vop, string instruction_name
965
910
}
966
911
}
967
912
968
- multiclass VPatBinaryRM_NVL_WV_WX_WI<SDNode vop, string instruction_name> {
969
- foreach VtiToWti = AllWidenableIntVectors in {
970
- defvar vti = VtiToWti.Vti;
971
- defvar wti = VtiToWti.Wti;
972
- defm : VPatBinaryRM_VL_V<vop, instruction_name, "WV",
973
- vti.Vector, wti.Vector, vti.Vector, vti.Mask,
974
- vti.Log2SEW, vti.LMul, vti.RegClass, wti.RegClass, vti.RegClass>;
975
- defm : VPatBinaryRM_VL_XI<vop, instruction_name, "WX",
976
- vti.Vector, wti.Vector, vti.Vector, vti.Mask,
977
- vti.Log2SEW, vti.LMul, vti.RegClass, wti.RegClass, SplatPat, GPR>;
978
- defm : VPatBinaryRM_VL_XI<vop, instruction_name, "WI",
979
- vti.Vector, wti.Vector, vti.Vector, vti.Mask,
980
- vti.Log2SEW, vti.LMul, vti.RegClass, wti.RegClass,
981
- !cast<ComplexPattern>(SplatPat#_#uimm5),
982
- uimm5>;
983
- }
984
- }
985
-
986
913
class VPatBinaryVL_VF<SDPatternOperator vop,
987
914
string instruction_name,
988
915
ValueType result_type,
@@ -2468,8 +2395,26 @@ defm : VPatAVGADDVL_VV_VX_RM<riscv_avgceils_vl, 0b00>;
2468
2395
defm : VPatAVGADDVL_VV_VX_RM<riscv_avgceilu_vl, 0b00, suffix="U">;
2469
2396
2470
2397
// 12.5. Vector Narrowing Fixed-Point Clip Instructions
2471
- defm : VPatBinaryRM_NVL_WV_WX_WI<riscv_vnclip_vl, "PseudoVNCLIP">;
2472
- defm : VPatBinaryRM_NVL_WV_WX_WI<riscv_vnclipu_vl, "PseudoVNCLIPU">;
2398
+ foreach vtiTowti = AllWidenableIntVectors in {
2399
+ defvar vti = vtiTowti.Vti;
2400
+ defvar wti = vtiTowti.Wti;
2401
+ let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates,
2402
+ GetVTypePredicates<wti>.Predicates) in {
2403
+ // Rounding mode here is arbitrary since we aren't shifting out any bits.
2404
+ def : Pat<(vti.Vector (riscv_trunc_vector_vl_ssat (wti.Vector wti.RegClass:$rs1),
2405
+ (vti.Mask V0),
2406
+ VLOpFrag)),
2407
+ (!cast<Instruction>("PseudoVNCLIP_WI_"#vti.LMul.MX#"_MASK")
2408
+ (vti.Vector (IMPLICIT_DEF)), wti.RegClass:$rs1, 0,
2409
+ (vti.Mask V0), /*RNU*/0, GPR:$vl, vti.Log2SEW, TA_MA)>;
2410
+ def : Pat<(vti.Vector (riscv_trunc_vector_vl_usat (wti.Vector wti.RegClass:$rs1),
2411
+ (vti.Mask V0),
2412
+ VLOpFrag)),
2413
+ (!cast<Instruction>("PseudoVNCLIPU_WI_"#vti.LMul.MX#"_MASK")
2414
+ (vti.Vector (IMPLICIT_DEF)), wti.RegClass:$rs1, 0,
2415
+ (vti.Mask V0), /*RNU*/0, GPR:$vl, vti.Log2SEW, TA_MA)>;
2416
+ }
2417
+ }
2473
2418
2474
2419
// 13. Vector Floating-Point Instructions
2475
2420
0 commit comments