@@ -344,7 +344,14 @@ def SDT_RISCVSelect_VL : SDTypeProfile<1, 4, [
344
344
]>;
345
345
346
346
def riscv_vselect_vl : SDNode<"RISCVISD::VSELECT_VL", SDT_RISCVSelect_VL>;
347
- def riscv_vp_merge_vl : SDNode<"RISCVISD::VP_MERGE_VL", SDT_RISCVSelect_VL>;
347
+
348
+ def SDT_RISCVVMERGE_VL : SDTypeProfile<1, 5, [
349
+ SDTCisVec<0>, SDTCisVec<1>, SDTCisSameNumEltsAs<0, 1>, SDTCVecEltisVT<1, i1>,
350
+ SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>, SDTCisSameAs<0, 4>,
351
+ SDTCisVT<5, XLenVT>
352
+ ]>;
353
+
354
+ def riscv_vmerge_vl : SDNode<"RISCVISD::VMERGE_VL", SDT_RISCVVMERGE_VL>;
348
355
349
356
def SDT_RISCVVMSETCLR_VL : SDTypeProfile<1, 1, [SDTCVecEltisVT<0, i1>,
350
357
SDTCisVT<1, XLenVT>]>;
@@ -675,14 +682,14 @@ multiclass VPatTiedBinaryNoMaskVL_V<SDNode vop,
675
682
op2_reg_class:$rs2,
676
683
GPR:$vl, sew, TAIL_AGNOSTIC)>;
677
684
// Tail undisturbed
678
- def : Pat<(riscv_vp_merge_vl true_mask,
685
+ def : Pat<(riscv_vmerge_vl true_mask,
679
686
(result_type (vop
680
687
result_reg_class:$rs1,
681
688
(op2_type op2_reg_class:$rs2),
682
689
srcvalue,
683
690
true_mask,
684
691
VLOpFrag)),
685
- result_reg_class:$rs1, VLOpFrag),
692
+ result_reg_class:$rs1, result_reg_class:$rs1, VLOpFrag),
686
693
(!cast<Instruction>(instruction_name#"_"#suffix#"_"# vlmul.MX#"_TIED")
687
694
result_reg_class:$rs1,
688
695
op2_reg_class:$rs2,
@@ -712,14 +719,14 @@ multiclass VPatTiedBinaryNoMaskVL_V_RM<SDNode vop,
712
719
FRM_DYN,
713
720
GPR:$vl, sew, TAIL_AGNOSTIC)>;
714
721
// Tail undisturbed
715
- def : Pat<(riscv_vp_merge_vl true_mask,
722
+ def : Pat<(riscv_vmerge_vl true_mask,
716
723
(result_type (vop
717
724
result_reg_class:$rs1,
718
725
(op2_type op2_reg_class:$rs2),
719
726
srcvalue,
720
727
true_mask,
721
728
VLOpFrag)),
722
- result_reg_class:$rs1, VLOpFrag),
729
+ result_reg_class:$rs1, result_reg_class:$rs1, VLOpFrag),
723
730
(!cast<Instruction>(instruction_name#"_"#suffix#"_"# vlmul.MX#"_TIED")
724
731
result_reg_class:$rs1,
725
732
op2_reg_class:$rs2,
@@ -1697,21 +1704,21 @@ multiclass VPatMultiplyAccVL_VV_VX<PatFrag op, string instruction_name> {
1697
1704
foreach vti = AllIntegerVectors in {
1698
1705
defvar suffix = vti.LMul.MX;
1699
1706
let Predicates = GetVTypePredicates<vti>.Predicates in {
1700
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
1707
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
1701
1708
(vti.Vector (op vti.RegClass:$rd,
1702
1709
(riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2,
1703
1710
srcvalue, (vti.Mask true_mask), VLOpFrag),
1704
1711
srcvalue, (vti.Mask true_mask), VLOpFrag)),
1705
- vti.RegClass:$rd, VLOpFrag),
1712
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
1706
1713
(!cast<Instruction>(instruction_name#"_VV_"# suffix #"_MASK")
1707
1714
vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2,
1708
1715
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
1709
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
1716
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
1710
1717
(vti.Vector (op vti.RegClass:$rd,
1711
1718
(riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2,
1712
1719
srcvalue, (vti.Mask true_mask), VLOpFrag),
1713
1720
srcvalue, (vti.Mask true_mask), VLOpFrag)),
1714
- vti.RegClass:$rd, VLOpFrag),
1721
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
1715
1722
(!cast<Instruction>(instruction_name#"_VX_"# suffix #"_MASK")
1716
1723
vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2,
1717
1724
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
@@ -1840,17 +1847,17 @@ multiclass VPatFPMulAccVL_VV_VF<PatFrag vop, string instruction_name> {
1840
1847
foreach vti = AllFloatVectors in {
1841
1848
defvar suffix = vti.LMul.MX;
1842
1849
let Predicates = GetVTypePredicates<vti>.Predicates in {
1843
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
1850
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
1844
1851
(vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2,
1845
1852
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
1846
- vti.RegClass:$rd, VLOpFrag),
1853
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
1847
1854
(!cast<Instruction>(instruction_name#"_VV_"# suffix #"_MASK")
1848
1855
vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2,
1849
1856
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
1850
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
1857
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
1851
1858
(vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2,
1852
1859
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
1853
- vti.RegClass:$rd, VLOpFrag),
1860
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
1854
1861
(!cast<Instruction>(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK")
1855
1862
vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2,
1856
1863
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
@@ -1876,21 +1883,21 @@ multiclass VPatFPMulAccVL_VV_VF_RM<PatFrag vop, string instruction_name> {
1876
1883
foreach vti = AllFloatVectors in {
1877
1884
defvar suffix = vti.LMul.MX;
1878
1885
let Predicates = GetVTypePredicates<vti>.Predicates in {
1879
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
1886
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
1880
1887
(vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2,
1881
1888
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
1882
- vti.RegClass:$rd, VLOpFrag),
1889
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
1883
1890
(!cast<Instruction>(instruction_name#"_VV_"# suffix #"_MASK")
1884
1891
vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2,
1885
1892
(vti.Mask V0),
1886
1893
// Value to indicate no rounding mode change in
1887
1894
// RISCVInsertReadWriteCSR
1888
1895
FRM_DYN,
1889
1896
GPR:$vl, vti.Log2SEW, TU_MU)>;
1890
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
1897
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
1891
1898
(vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2,
1892
1899
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
1893
- vti.RegClass:$rd, VLOpFrag),
1900
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
1894
1901
(!cast<Instruction>(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK")
1895
1902
vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2,
1896
1903
(vti.Mask V0),
@@ -2273,29 +2280,32 @@ foreach vti = AllIntegerVectors in {
2273
2280
(vti.Vector (IMPLICIT_DEF)),
2274
2281
vti.RegClass:$rs2, simm5:$rs1, (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
2275
2282
2276
- def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0),
2277
- vti.RegClass:$rs1,
2278
- vti.RegClass:$rs2,
2279
- VLOpFrag)),
2283
+ def : Pat<(vti.Vector (riscv_vmerge_vl (vti.Mask V0),
2284
+ vti.RegClass:$rs1,
2285
+ vti.RegClass:$rs2,
2286
+ vti.RegClass:$merge,
2287
+ VLOpFrag)),
2280
2288
(!cast<Instruction>("PseudoVMERGE_VVM_"#vti.LMul.MX)
2281
- vti.RegClass:$rs2 , vti.RegClass:$rs2, vti.RegClass:$rs1,
2282
- (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
2289
+ vti.RegClass:$merge , vti.RegClass:$rs2, vti.RegClass:$rs1,
2290
+ (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
2283
2291
2284
- def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0),
2285
- (SplatPat XLenVT:$rs1),
2286
- vti.RegClass:$rs2,
2287
- VLOpFrag)),
2292
+ def : Pat<(vti.Vector (riscv_vmerge_vl (vti.Mask V0),
2293
+ (SplatPat XLenVT:$rs1),
2294
+ vti.RegClass:$rs2,
2295
+ vti.RegClass:$merge,
2296
+ VLOpFrag)),
2288
2297
(!cast<Instruction>("PseudoVMERGE_VXM_"#vti.LMul.MX)
2289
- vti.RegClass:$rs2, vti.RegClass:$rs2, GPR:$rs1,
2290
- (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
2291
-
2292
- def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0),
2293
- (SplatPat_simm5 simm5:$rs1),
2294
- vti.RegClass:$rs2,
2295
- VLOpFrag)),
2298
+ vti.RegClass:$merge, vti.RegClass:$rs2, GPR:$rs1,
2299
+ (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
2300
+
2301
+ def : Pat<(vti.Vector (riscv_vmerge_vl (vti.Mask V0),
2302
+ (SplatPat_simm5 simm5:$rs1),
2303
+ vti.RegClass:$rs2,
2304
+ vti.RegClass:$merge,
2305
+ VLOpFrag)),
2296
2306
(!cast<Instruction>("PseudoVMERGE_VIM_"#vti.LMul.MX)
2297
- vti.RegClass:$rs2 , vti.RegClass:$rs2, simm5:$rs1,
2298
- (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
2307
+ vti.RegClass:$merge , vti.RegClass:$rs2, simm5:$rs1,
2308
+ (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
2299
2309
}
2300
2310
}
2301
2311
@@ -2493,21 +2503,23 @@ foreach fvti = AllFloatVectors in {
2493
2503
(fvti.Vector (IMPLICIT_DEF)),
2494
2504
fvti.RegClass:$rs2, 0, (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>;
2495
2505
2496
- def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0),
2497
- fvti.RegClass:$rs1,
2498
- fvti.RegClass:$rs2,
2499
- VLOpFrag)),
2500
- (!cast<Instruction>("PseudoVMERGE_VVM_"#fvti.LMul.MX)
2501
- fvti.RegClass:$rs2, fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0),
2502
- GPR:$vl, fvti.Log2SEW)>;
2503
-
2504
- def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0),
2505
- (SplatFPOp (fvti.Scalar fpimm0)),
2506
- fvti.RegClass:$rs2,
2507
- VLOpFrag)),
2508
- (!cast<Instruction>("PseudoVMERGE_VIM_"#fvti.LMul.MX)
2509
- fvti.RegClass:$rs2, fvti.RegClass:$rs2, 0, (fvti.Mask V0),
2510
- GPR:$vl, fvti.Log2SEW)>;
2506
+ def : Pat<(fvti.Vector (riscv_vmerge_vl (fvti.Mask V0),
2507
+ fvti.RegClass:$rs1,
2508
+ fvti.RegClass:$rs2,
2509
+ fvti.RegClass:$merge,
2510
+ VLOpFrag)),
2511
+ (!cast<Instruction>("PseudoVMERGE_VVM_"#fvti.LMul.MX)
2512
+ fvti.RegClass:$merge, fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0),
2513
+ GPR:$vl, fvti.Log2SEW)>;
2514
+
2515
+ def : Pat<(fvti.Vector (riscv_vmerge_vl (fvti.Mask V0),
2516
+ (SplatFPOp (fvti.Scalar fpimm0)),
2517
+ fvti.RegClass:$rs2,
2518
+ fvti.RegClass:$merge,
2519
+ VLOpFrag)),
2520
+ (!cast<Instruction>("PseudoVMERGE_VIM_"#fvti.LMul.MX)
2521
+ fvti.RegClass:$merge, fvti.RegClass:$rs2, 0, (fvti.Mask V0),
2522
+ GPR:$vl, fvti.Log2SEW)>;
2511
2523
}
2512
2524
2513
2525
let Predicates = GetVTypePredicates<fvti>.Predicates in {
@@ -2521,12 +2533,13 @@ foreach fvti = AllFloatVectors in {
2521
2533
(fvti.Scalar fvti.ScalarRegClass:$rs1),
2522
2534
(fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>;
2523
2535
2524
- def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0),
2525
- (SplatFPOp fvti.ScalarRegClass:$rs1),
2526
- fvti.RegClass:$rs2,
2527
- VLOpFrag)),
2536
+ def : Pat<(fvti.Vector (riscv_vmerge_vl (fvti.Mask V0),
2537
+ (SplatFPOp fvti.ScalarRegClass:$rs1),
2538
+ fvti.RegClass:$rs2,
2539
+ fvti.RegClass:$merge,
2540
+ VLOpFrag)),
2528
2541
(!cast<Instruction>("PseudoVFMERGE_V"#fvti.ScalarSuffix#"M_"#fvti.LMul.MX)
2529
- fvti.RegClass:$rs2 , fvti.RegClass:$rs2,
2542
+ fvti.RegClass:$merge , fvti.RegClass:$rs2,
2530
2543
(fvti.Scalar fvti.ScalarRegClass:$rs1),
2531
2544
(fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>;
2532
2545
0 commit comments