@@ -3234,15 +3234,17 @@ multiclass VPseudoTernaryWithPolicyRoundingMode<VReg RetClass,
3234
3234
DAGOperand Op2Class,
3235
3235
LMULInfo MInfo,
3236
3236
string Constraint = "",
3237
+ int sew = 0,
3237
3238
bit Commutable = 0,
3238
3239
int TargetConstraintType = 1> {
3239
3240
let VLMul = MInfo.value in {
3241
+ defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX);
3240
3242
let isCommutable = Commutable in
3241
- def "_" # MInfo.MX :
3243
+ def suffix :
3242
3244
VPseudoTernaryNoMaskWithPolicyRoundingMode<RetClass, Op1Class,
3243
3245
Op2Class, Constraint,
3244
3246
TargetConstraintType>;
3245
- def "_" # MInfo.MX # "_MASK" :
3247
+ def suffix # "_MASK" :
3246
3248
VPseudoBinaryMaskPolicyRoundingMode<RetClass, Op1Class,
3247
3249
Op2Class, Constraint,
3248
3250
UsesVXRM_=0,
@@ -3256,9 +3258,9 @@ multiclass VPseudoTernaryV_VV_AAXA<LMULInfo m, string Constraint = ""> {
3256
3258
Constraint, Commutable=1>;
3257
3259
}
3258
3260
3259
- multiclass VPseudoTernaryV_VV_AAXA_RM<LMULInfo m, string Constraint = ""> {
3261
+ multiclass VPseudoTernaryV_VV_AAXA_RM<LMULInfo m, string Constraint = "", int sew = 0 > {
3260
3262
defm _VV : VPseudoTernaryWithPolicyRoundingMode<m.vrclass, m.vrclass, m.vrclass, m,
3261
- Constraint, Commutable=1>;
3263
+ Constraint, sew, Commutable=1>;
3262
3264
}
3263
3265
3264
3266
multiclass VPseudoTernaryV_VX_AAXA<LMULInfo m, string Constraint = ""> {
@@ -3272,10 +3274,11 @@ multiclass VPseudoTernaryV_VF_AAXA<LMULInfo m, FPR_Info f, string Constraint = "
3272
3274
Commutable=1>;
3273
3275
}
3274
3276
3275
- multiclass VPseudoTernaryV_VF_AAXA_RM<LMULInfo m, FPR_Info f, string Constraint = ""> {
3277
+ multiclass VPseudoTernaryV_VF_AAXA_RM<LMULInfo m, FPR_Info f,
3278
+ string Constraint = "", int sew = 0> {
3276
3279
defm "_V" # f.FX : VPseudoTernaryWithPolicyRoundingMode<m.vrclass, f.fprclass,
3277
3280
m.vrclass, m, Constraint,
3278
- Commutable=1>;
3281
+ sew, Commutable=1>;
3279
3282
}
3280
3283
3281
3284
multiclass VPseudoTernaryW_VV<LMULInfo m> {
@@ -3345,16 +3348,17 @@ multiclass VPseudoVMAC_VV_VX_AAXA<string Constraint = ""> {
3345
3348
3346
3349
multiclass VPseudoVMAC_VV_VF_AAXA_RM<string Constraint = ""> {
3347
3350
foreach m = MxListF in {
3348
- defm "" : VPseudoTernaryV_VV_AAXA_RM<m, Constraint>,
3349
- SchedTernary<"WriteVFMulAddV", "ReadVFMulAddV", "ReadVFMulAddV",
3350
- "ReadVFMulAddV", m.MX>;
3351
+ foreach e = SchedSEWSet<m.MX, isF=1>.val in
3352
+ defm "" : VPseudoTernaryV_VV_AAXA_RM<m, Constraint, sew=e>,
3353
+ SchedTernary<"WriteVFMulAddV", "ReadVFMulAddV", "ReadVFMulAddV",
3354
+ "ReadVFMulAddV", m.MX, e>;
3351
3355
}
3352
3356
3353
3357
foreach f = FPList in {
3354
3358
foreach m = f.MxList in {
3355
- defm "" : VPseudoTernaryV_VF_AAXA_RM<m, f, Constraint>,
3359
+ defm "" : VPseudoTernaryV_VF_AAXA_RM<m, f, Constraint, sew=f.SEW >,
3356
3360
SchedTernary<"WriteVFMulAddF", "ReadVFMulAddV", "ReadVFMulAddF",
3357
- "ReadVFMulAddV", m.MX>;
3361
+ "ReadVFMulAddV", m.MX, f.SEW >;
3358
3362
}
3359
3363
}
3360
3364
}
@@ -4461,23 +4465,26 @@ class VPatTernaryNoMaskWithPolicyRoundingMode<string intrinsic,
4461
4465
ValueType result_type,
4462
4466
ValueType op1_type,
4463
4467
ValueType op2_type,
4464
- int sew ,
4468
+ int log2sew ,
4465
4469
LMULInfo vlmul,
4466
4470
VReg result_reg_class,
4467
4471
RegisterClass op1_reg_class,
4468
- DAGOperand op2_kind> :
4472
+ DAGOperand op2_kind,
4473
+ bit isSEWAware = 0> :
4469
4474
Pat<(result_type (!cast<Intrinsic>(intrinsic)
4470
4475
(result_type result_reg_class:$rs3),
4471
4476
(op1_type op1_reg_class:$rs1),
4472
4477
(op2_type op2_kind:$rs2),
4473
4478
(XLenVT timm:$round),
4474
4479
VLOpFrag, (XLenVT timm:$policy))),
4475
- (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX)
4480
+ (!cast<Instruction>(!if(isSEWAware,
4481
+ inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew),
4482
+ inst#"_"#kind#"_"#vlmul.MX))
4476
4483
result_reg_class:$rs3,
4477
4484
(op1_type op1_reg_class:$rs1),
4478
4485
op2_kind:$rs2,
4479
4486
(XLenVT timm:$round),
4480
- GPR:$vl, sew , (XLenVT timm:$policy))>;
4487
+ GPR:$vl, log2sew , (XLenVT timm:$policy))>;
4481
4488
4482
4489
class VPatTernaryMask<string intrinsic,
4483
4490
string inst,
@@ -4536,25 +4543,28 @@ class VPatTernaryMaskPolicyRoundingMode<string intrinsic,
4536
4543
ValueType op1_type,
4537
4544
ValueType op2_type,
4538
4545
ValueType mask_type,
4539
- int sew ,
4546
+ int log2sew ,
4540
4547
LMULInfo vlmul,
4541
4548
VReg result_reg_class,
4542
4549
RegisterClass op1_reg_class,
4543
- DAGOperand op2_kind> :
4550
+ DAGOperand op2_kind,
4551
+ bit isSEWAware = 0> :
4544
4552
Pat<(result_type (!cast<Intrinsic>(intrinsic#"_mask")
4545
4553
(result_type result_reg_class:$rs3),
4546
4554
(op1_type op1_reg_class:$rs1),
4547
4555
(op2_type op2_kind:$rs2),
4548
4556
(mask_type V0),
4549
4557
(XLenVT timm:$round),
4550
4558
VLOpFrag, (XLenVT timm:$policy))),
4551
- (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX # "_MASK")
4559
+ (!cast<Instruction>(!if(isSEWAware,
4560
+ inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew) # "_MASK",
4561
+ inst#"_"#kind#"_"#vlmul.MX # "_MASK"))
4552
4562
result_reg_class:$rs3,
4553
4563
(op1_type op1_reg_class:$rs1),
4554
4564
op2_kind:$rs2,
4555
4565
(mask_type V0),
4556
4566
(XLenVT timm:$round),
4557
- GPR:$vl, sew , (XLenVT timm:$policy))>;
4567
+ GPR:$vl, log2sew , (XLenVT timm:$policy))>;
4558
4568
4559
4569
class VPatTernaryMaskTA<string intrinsic,
4560
4570
string inst,
@@ -5564,15 +5574,16 @@ multiclass VPatTernaryWithPolicyRoundingMode<string intrinsic,
5564
5574
LMULInfo vlmul,
5565
5575
VReg result_reg_class,
5566
5576
RegisterClass op1_reg_class,
5567
- DAGOperand op2_kind> {
5577
+ DAGOperand op2_kind,
5578
+ bit isSEWAware = 0> {
5568
5579
def : VPatTernaryNoMaskWithPolicyRoundingMode<intrinsic, inst, kind, result_type,
5569
5580
op1_type, op2_type, sew, vlmul,
5570
5581
result_reg_class, op1_reg_class,
5571
- op2_kind>;
5582
+ op2_kind, isSEWAware >;
5572
5583
def : VPatTernaryMaskPolicyRoundingMode<intrinsic, inst, kind, result_type, op1_type,
5573
5584
op2_type, mask_type, sew, vlmul,
5574
5585
result_reg_class, op1_reg_class,
5575
- op2_kind>;
5586
+ op2_kind, isSEWAware >;
5576
5587
}
5577
5588
5578
5589
multiclass VPatTernaryTA<string intrinsic,
@@ -5626,13 +5637,13 @@ multiclass VPatTernaryV_VV_AAXA<string intrinsic, string instruction,
5626
5637
}
5627
5638
5628
5639
multiclass VPatTernaryV_VV_AAXA_RM<string intrinsic, string instruction,
5629
- list<VTypeInfo> vtilist> {
5640
+ list<VTypeInfo> vtilist, bit isSEWAware = 0 > {
5630
5641
foreach vti = vtilist in
5631
5642
let Predicates = GetVTypePredicates<vti>.Predicates in
5632
5643
defm : VPatTernaryWithPolicyRoundingMode<intrinsic, instruction, "VV",
5633
5644
vti.Vector, vti.Vector, vti.Vector, vti.Mask,
5634
5645
vti.Log2SEW, vti.LMul, vti.RegClass,
5635
- vti.RegClass, vti.RegClass>;
5646
+ vti.RegClass, vti.RegClass, isSEWAware >;
5636
5647
}
5637
5648
5638
5649
multiclass VPatTernaryV_VX<string intrinsic, string instruction,
@@ -5657,14 +5668,14 @@ multiclass VPatTernaryV_VX_AAXA<string intrinsic, string instruction,
5657
5668
}
5658
5669
5659
5670
multiclass VPatTernaryV_VX_AAXA_RM<string intrinsic, string instruction,
5660
- list<VTypeInfo> vtilist> {
5671
+ list<VTypeInfo> vtilist, bit isSEWAware = 0 > {
5661
5672
foreach vti = vtilist in
5662
5673
let Predicates = GetVTypePredicates<vti>.Predicates in
5663
5674
defm : VPatTernaryWithPolicyRoundingMode<intrinsic, instruction,
5664
5675
"V"#vti.ScalarSuffix,
5665
5676
vti.Vector, vti.Scalar, vti.Vector, vti.Mask,
5666
5677
vti.Log2SEW, vti.LMul, vti.RegClass,
5667
- vti.ScalarRegClass, vti.RegClass>;
5678
+ vti.ScalarRegClass, vti.RegClass, isSEWAware >;
5668
5679
}
5669
5680
5670
5681
multiclass VPatTernaryV_VI<string intrinsic, string instruction,
@@ -5742,9 +5753,9 @@ multiclass VPatTernaryV_VV_VX_AAXA<string intrinsic, string instruction,
5742
5753
VPatTernaryV_VX_AAXA<intrinsic, instruction, vtilist>;
5743
5754
5744
5755
multiclass VPatTernaryV_VV_VX_AAXA_RM<string intrinsic, string instruction,
5745
- list<VTypeInfo> vtilist>
5746
- : VPatTernaryV_VV_AAXA_RM<intrinsic, instruction, vtilist>,
5747
- VPatTernaryV_VX_AAXA_RM<intrinsic, instruction, vtilist>;
5756
+ list<VTypeInfo> vtilist, bit isSEWAware = 0 >
5757
+ : VPatTernaryV_VV_AAXA_RM<intrinsic, instruction, vtilist, isSEWAware >,
5758
+ VPatTernaryV_VX_AAXA_RM<intrinsic, instruction, vtilist, isSEWAware >;
5748
5759
5749
5760
multiclass VPatTernaryV_VX_VI<string intrinsic, string instruction,
5750
5761
list<VTypeInfo> vtilist, Operand Imm_type = simm5>
@@ -7122,14 +7133,22 @@ defm : VPatBinaryW_VV_VX_RM<"int_riscv_vfwmul", "PseudoVFWMUL",
7122
7133
//===----------------------------------------------------------------------===//
7123
7134
// 13.6. Vector Single-Width Floating-Point Fused Multiply-Add Instructions
7124
7135
//===----------------------------------------------------------------------===//
7125
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmacc", "PseudoVFMACC", AllFloatVectors>;
7126
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmacc", "PseudoVFNMACC", AllFloatVectors>;
7127
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmsac", "PseudoVFMSAC", AllFloatVectors>;
7128
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmsac", "PseudoVFNMSAC", AllFloatVectors>;
7129
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmadd", "PseudoVFMADD", AllFloatVectors>;
7130
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmadd", "PseudoVFNMADD", AllFloatVectors>;
7131
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmsub", "PseudoVFMSUB", AllFloatVectors>;
7132
- defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmsub", "PseudoVFNMSUB", AllFloatVectors>;
7136
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmacc", "PseudoVFMACC",
7137
+ AllFloatVectors, isSEWAware=1>;
7138
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmacc", "PseudoVFNMACC",
7139
+ AllFloatVectors, isSEWAware=1>;
7140
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmsac", "PseudoVFMSAC",
7141
+ AllFloatVectors, isSEWAware=1>;
7142
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmsac", "PseudoVFNMSAC",
7143
+ AllFloatVectors, isSEWAware=1>;
7144
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmadd", "PseudoVFMADD",
7145
+ AllFloatVectors, isSEWAware=1>;
7146
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmadd", "PseudoVFNMADD",
7147
+ AllFloatVectors, isSEWAware=1>;
7148
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmsub", "PseudoVFMSUB",
7149
+ AllFloatVectors, isSEWAware=1>;
7150
+ defm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmsub", "PseudoVFNMSUB",
7151
+ AllFloatVectors, isSEWAware=1>;
7133
7152
7134
7153
//===----------------------------------------------------------------------===//
7135
7154
// 13.7. Vector Widening Floating-Point Fused Multiply-Add Instructions
0 commit comments