@@ -2577,29 +2577,33 @@ multiclass VPseudoVSQR_V_RM {
2577
2577
multiclass VPseudoVRCP_V {
2578
2578
foreach m = MxListF in {
2579
2579
defvar mx = m.MX;
2580
- let VLMul = m.value in {
2581
- def "_V_" # mx
2582
- : VPseudoUnaryNoMask<m.vrclass, m.vrclass>,
2583
- SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, forceMergeOpRead=true>;
2584
- def "_V_" # mx # "_MASK"
2585
- : VPseudoUnaryMask<m.vrclass, m.vrclass>,
2586
- RISCVMaskedPseudo<MaskIdx = 2>,
2587
- SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, forceMergeOpRead=true>;
2580
+ foreach e = SchedSEWSet<mx, isF=1>.val in {
2581
+ let VLMul = m.value in {
2582
+ def "_V_" # mx # "_E" # e
2583
+ : VPseudoUnaryNoMask<m.vrclass, m.vrclass>,
2584
+ SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>;
2585
+ def "_V_" # mx # "_E" # e # "_MASK"
2586
+ : VPseudoUnaryMask<m.vrclass, m.vrclass>,
2587
+ RISCVMaskedPseudo<MaskIdx = 2>,
2588
+ SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>;
2589
+ }
2588
2590
}
2589
2591
}
2590
2592
}
2591
2593
2592
2594
multiclass VPseudoVRCP_V_RM {
2593
2595
foreach m = MxListF in {
2594
2596
defvar mx = m.MX;
2595
- let VLMul = m.value in {
2596
- def "_V_" # mx
2597
- : VPseudoUnaryNoMaskRoundingMode<m.vrclass, m.vrclass>,
2598
- SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, forceMergeOpRead=true>;
2599
- def "_V_" # mx # "_MASK"
2600
- : VPseudoUnaryMaskRoundingMode<m.vrclass, m.vrclass>,
2601
- RISCVMaskedPseudo<MaskIdx = 2>,
2602
- SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, forceMergeOpRead=true>;
2597
+ foreach e = SchedSEWSet<mx, isF=1>.val in {
2598
+ let VLMul = m.value in {
2599
+ def "_V_" # mx # "_E" # e
2600
+ : VPseudoUnaryNoMaskRoundingMode<m.vrclass, m.vrclass>,
2601
+ SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>;
2602
+ def "_V_" # mx # "_E" # e # "_MASK"
2603
+ : VPseudoUnaryMaskRoundingMode<m.vrclass, m.vrclass>,
2604
+ RISCVMaskedPseudo<MaskIdx = 2>,
2605
+ SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>;
2606
+ }
2603
2607
}
2604
2608
}
2605
2609
}
@@ -3939,12 +3943,16 @@ class VPatUnaryNoMask<string intrinsic_name,
3939
3943
int log2sew,
3940
3944
LMULInfo vlmul,
3941
3945
VReg result_reg_class,
3942
- VReg op2_reg_class> :
3946
+ VReg op2_reg_class,
3947
+ bit isSEWAware = 0> :
3943
3948
Pat<(result_type (!cast<Intrinsic>(intrinsic_name)
3944
3949
(result_type result_reg_class:$merge),
3945
3950
(op2_type op2_reg_class:$rs2),
3946
3951
VLOpFrag)),
3947
- (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX)
3952
+ (!cast<Instruction>(
3953
+ !if(isSEWAware,
3954
+ inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew),
3955
+ inst#"_"#kind#"_"#vlmul.MX))
3948
3956
(result_type result_reg_class:$merge),
3949
3957
(op2_type op2_reg_class:$rs2),
3950
3958
GPR:$vl, log2sew, TU_MU)>;
@@ -3983,13 +3991,17 @@ class VPatUnaryMask<string intrinsic_name,
3983
3991
int log2sew,
3984
3992
LMULInfo vlmul,
3985
3993
VReg result_reg_class,
3986
- VReg op2_reg_class> :
3994
+ VReg op2_reg_class,
3995
+ bit isSEWAware = 0> :
3987
3996
Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask")
3988
3997
(result_type result_reg_class:$merge),
3989
3998
(op2_type op2_reg_class:$rs2),
3990
3999
(mask_type V0),
3991
4000
VLOpFrag, (XLenVT timm:$policy))),
3992
- (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_MASK")
4001
+ (!cast<Instruction>(
4002
+ !if(isSEWAware,
4003
+ inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)#"_MASK",
4004
+ inst#"_"#kind#"_"#vlmul.MX#"_MASK"))
3993
4005
(result_type result_reg_class:$merge),
3994
4006
(op2_type op2_reg_class:$rs2),
3995
4007
(mask_type V0), GPR:$vl, log2sew, (XLenVT timm:$policy))>;
@@ -4681,15 +4693,15 @@ multiclass VPatUnaryV_VF<string intrinsic, string instruction, string suffix,
4681
4693
}
4682
4694
4683
4695
multiclass VPatUnaryV_V<string intrinsic, string instruction,
4684
- list<VTypeInfo> vtilist> {
4696
+ list<VTypeInfo> vtilist, bit isSEWAware = 0 > {
4685
4697
foreach vti = vtilist in {
4686
4698
let Predicates = GetVTypePredicates<vti>.Predicates in {
4687
4699
def : VPatUnaryNoMask<intrinsic, instruction, "V",
4688
4700
vti.Vector, vti.Vector, vti.Log2SEW,
4689
- vti.LMul, vti.RegClass, vti.RegClass>;
4701
+ vti.LMul, vti.RegClass, vti.RegClass, isSEWAware >;
4690
4702
def : VPatUnaryMask<intrinsic, instruction, "V",
4691
4703
vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW,
4692
- vti.LMul, vti.RegClass, vti.RegClass>;
4704
+ vti.LMul, vti.RegClass, vti.RegClass, isSEWAware >;
4693
4705
}
4694
4706
}
4695
4707
}
@@ -7175,12 +7187,12 @@ defm : VPatUnaryV_V_RM<"int_riscv_vfsqrt", "PseudoVFSQRT", AllFloatVectors, isSE
7175
7187
//===----------------------------------------------------------------------===//
7176
7188
// 13.9. Vector Floating-Point Reciprocal Square-Root Estimate Instruction
7177
7189
//===----------------------------------------------------------------------===//
7178
- defm : VPatUnaryV_V<"int_riscv_vfrsqrt7", "PseudoVFRSQRT7", AllFloatVectors>;
7190
+ defm : VPatUnaryV_V<"int_riscv_vfrsqrt7", "PseudoVFRSQRT7", AllFloatVectors, isSEWAware=1 >;
7179
7191
7180
7192
//===----------------------------------------------------------------------===//
7181
7193
// 13.10. Vector Floating-Point Reciprocal Estimate Instruction
7182
7194
//===----------------------------------------------------------------------===//
7183
- defm : VPatUnaryV_V_RM<"int_riscv_vfrec7", "PseudoVFREC7", AllFloatVectors>;
7195
+ defm : VPatUnaryV_V_RM<"int_riscv_vfrec7", "PseudoVFREC7", AllFloatVectors, isSEWAware=1 >;
7184
7196
7185
7197
//===----------------------------------------------------------------------===//
7186
7198
// 13.11. Vector Floating-Point Min/Max Instructions
0 commit comments