@@ -2328,18 +2328,25 @@ multiclass VPseudoVCLS_V {
2328
2328
multiclass VPseudoVSQR_V {
2329
2329
foreach m = MxListF in {
2330
2330
defvar mx = m.MX;
2331
- defvar WriteVFSqrtV_MX = !cast<SchedWrite>("WriteVFSqrtV_" # mx);
2332
- defvar ReadVFSqrtV_MX = !cast<SchedRead>("ReadVFSqrtV_" # mx);
2331
+ defvar sews = SchedSEWSet<m.MX>.val;
2333
2332
2334
- let VLMul = m.value in {
2335
- def "_V_" # mx : VPseudoUnaryNoMask<m.vrclass, m.vrclass>,
2336
- Sched<[WriteVFSqrtV_MX, ReadVFSqrtV_MX, ReadVMask]>;
2337
- def "_V_" # mx # "_TU": VPseudoUnaryNoMaskTU<m.vrclass, m.vrclass>,
2338
- Sched<[WriteVFSqrtV_MX, ReadVFSqrtV_MX, ReadVMask]>;
2339
- def "_V_" # mx # "_MASK" : VPseudoUnaryMaskTA<m.vrclass, m.vrclass>,
2340
- RISCVMaskedPseudo</*MaskOpIdx*/ 2>,
2341
- Sched<[WriteVFSqrtV_MX, ReadVFSqrtV_MX, ReadVMask]>;
2342
- }
2333
+ let VLMul = m.value in
2334
+ foreach e = sews in {
2335
+ defvar suffix = "_" # mx # "_E" # e;
2336
+ defvar WriteVFSqrtV_MX_E = !cast<SchedWrite>("WriteVFSqrtV" # suffix);
2337
+ defvar ReadVFSqrtV_MX_E = !cast<SchedRead>("ReadVFSqrtV" # suffix);
2338
+
2339
+ def "_V" # suffix : VPseudoUnaryNoMask<m.vrclass, m.vrclass>,
2340
+ Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E,
2341
+ ReadVMask]>;
2342
+ def "_V" # suffix # "_TU": VPseudoUnaryNoMaskTU<m.vrclass, m.vrclass>,
2343
+ Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E,
2344
+ ReadVMask]>;
2345
+ def "_V" # suffix # "_MASK" : VPseudoUnaryMaskTA<m.vrclass, m.vrclass>,
2346
+ RISCVMaskedPseudo</*MaskOpIdx*/ 2>,
2347
+ Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E,
2348
+ ReadVMask]>;
2349
+ }
2343
2350
}
2344
2351
}
2345
2352
@@ -3835,6 +3842,23 @@ class VPatUnaryNoMask<string intrinsic_name,
3835
3842
(op2_type op2_reg_class:$rs2),
3836
3843
GPR:$vl, sew)>;
3837
3844
3845
+ class VPatUnaryNoMask_E<string intrinsic_name,
3846
+ string inst,
3847
+ string kind,
3848
+ ValueType result_type,
3849
+ ValueType op2_type,
3850
+ int log2sew,
3851
+ LMULInfo vlmul,
3852
+ int sew,
3853
+ VReg op2_reg_class> :
3854
+ Pat<(result_type (!cast<Intrinsic>(intrinsic_name)
3855
+ (result_type undef),
3856
+ (op2_type op2_reg_class:$rs2),
3857
+ VLOpFrag)),
3858
+ (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#sew)
3859
+ (op2_type op2_reg_class:$rs2),
3860
+ GPR:$vl, log2sew)>;
3861
+
3838
3862
class VPatUnaryNoMaskTU<string intrinsic_name,
3839
3863
string inst,
3840
3864
string kind,
@@ -3853,6 +3877,25 @@ class VPatUnaryNoMaskTU<string intrinsic_name,
3853
3877
(op2_type op2_reg_class:$rs2),
3854
3878
GPR:$vl, sew)>;
3855
3879
3880
+ class VPatUnaryNoMaskTU_E<string intrinsic_name,
3881
+ string inst,
3882
+ string kind,
3883
+ ValueType result_type,
3884
+ ValueType op2_type,
3885
+ int log2sew,
3886
+ LMULInfo vlmul,
3887
+ int sew,
3888
+ VReg result_reg_class,
3889
+ VReg op2_reg_class> :
3890
+ Pat<(result_type (!cast<Intrinsic>(intrinsic_name)
3891
+ (result_type result_reg_class:$merge),
3892
+ (op2_type op2_reg_class:$rs2),
3893
+ VLOpFrag)),
3894
+ (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#sew#"_TU")
3895
+ (result_type result_reg_class:$merge),
3896
+ (op2_type op2_reg_class:$rs2),
3897
+ GPR:$vl, log2sew)>;
3898
+
3856
3899
class VPatUnaryMask<string intrinsic_name,
3857
3900
string inst,
3858
3901
string kind,
@@ -3893,6 +3936,27 @@ class VPatUnaryMaskTA<string intrinsic_name,
3893
3936
(op2_type op2_reg_class:$rs2),
3894
3937
(mask_type V0), GPR:$vl, sew, (XLenVT timm:$policy))>;
3895
3938
3939
+ class VPatUnaryMaskTA_E<string intrinsic_name,
3940
+ string inst,
3941
+ string kind,
3942
+ ValueType result_type,
3943
+ ValueType op2_type,
3944
+ ValueType mask_type,
3945
+ int log2sew,
3946
+ LMULInfo vlmul,
3947
+ int sew,
3948
+ VReg result_reg_class,
3949
+ VReg op2_reg_class> :
3950
+ Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask")
3951
+ (result_type result_reg_class:$merge),
3952
+ (op2_type op2_reg_class:$rs2),
3953
+ (mask_type V0),
3954
+ VLOpFrag, (XLenVT timm:$policy))),
3955
+ (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#sew#"_MASK")
3956
+ (result_type result_reg_class:$merge),
3957
+ (op2_type op2_reg_class:$rs2),
3958
+ (mask_type V0), GPR:$vl, log2sew, (XLenVT timm:$policy))>;
3959
+
3896
3960
class VPatMaskUnaryNoMask<string intrinsic_name,
3897
3961
string inst,
3898
3962
MTypeInfo mti> :
@@ -4336,6 +4400,23 @@ multiclass VPatUnaryV_V<string intrinsic, string instruction,
4336
4400
}
4337
4401
}
4338
4402
4403
+ multiclass VPatUnaryV_V_E<string intrinsic, string instruction,
4404
+ list<VTypeInfo> vtilist> {
4405
+ foreach vti = vtilist in {
4406
+ def : VPatUnaryNoMask_E<intrinsic, instruction, "V",
4407
+ vti.Vector, vti.Vector,
4408
+ vti.Log2SEW, vti.LMul, vti.SEW, vti.RegClass>;
4409
+ def : VPatUnaryNoMaskTU_E<intrinsic, instruction, "V",
4410
+ vti.Vector, vti.Vector,
4411
+ vti.Log2SEW, vti.LMul, vti.SEW,
4412
+ vti.RegClass, vti.RegClass>;
4413
+ def : VPatUnaryMaskTA_E<intrinsic, instruction, "V",
4414
+ vti.Vector, vti.Vector, vti.Mask,
4415
+ vti.Log2SEW, vti.LMul, vti.SEW,
4416
+ vti.RegClass, vti.RegClass>;
4417
+ }
4418
+ }
4419
+
4339
4420
multiclass VPatNullaryV<string intrinsic, string instruction>
4340
4421
{
4341
4422
foreach vti = AllIntegerVectors in {
@@ -6292,7 +6373,7 @@ defm : VPatTernaryW_VV_VX<"int_riscv_vfwnmsac", "PseudoVFWNMSAC", AllWidenableFl
6292
6373
//===----------------------------------------------------------------------===//
6293
6374
// 13.8. Vector Floating-Point Square-Root Instruction
6294
6375
//===----------------------------------------------------------------------===//
6295
- defm : VPatUnaryV_V <"int_riscv_vfsqrt", "PseudoVFSQRT", AllFloatVectors>;
6376
+ defm : VPatUnaryV_V_E <"int_riscv_vfsqrt", "PseudoVFSQRT", AllFloatVectors>;
6296
6377
6297
6378
//===----------------------------------------------------------------------===//
6298
6379
// 13.9. Vector Floating-Point Reciprocal Square-Root Estimate Instruction
0 commit comments