@@ -783,6 +783,15 @@ class GetVTypePredicates<VTypeInfo vti> {
783
783
true : [HasVInstructions]);
784
784
}
785
785
786
+ class GetVTypeMinimalPredicates<VTypeInfo vti> {
787
+ list<Predicate> Predicates = !cond(!eq(vti.Scalar, f16) : [HasVInstructionsF16Minimal],
788
+ !eq(vti.Scalar, bf16) : [HasVInstructionsBF16Minimal],
789
+ !eq(vti.Scalar, f32) : [HasVInstructionsAnyF],
790
+ !eq(vti.Scalar, f64) : [HasVInstructionsF64],
791
+ !eq(vti.SEW, 64) : [HasVInstructionsI64],
792
+ true : [HasVInstructions]);
793
+ }
794
+
786
795
class VPseudoUSLoadNoMask<VReg RetClass,
787
796
int EEW,
788
797
DAGOperand sewop = sew> :
@@ -4568,7 +4577,7 @@ multiclass VPatUnaryS_M<string intrinsic_name,
4568
4577
multiclass VPatUnaryV_V_AnyMask<string intrinsic, string instruction,
4569
4578
list<VTypeInfo> vtilist> {
4570
4579
foreach vti = vtilist in {
4571
- let Predicates = GetVTypePredicates <vti>.Predicates in
4580
+ let Predicates = GetVTypeMinimalPredicates <vti>.Predicates in
4572
4581
def : VPatUnaryAnyMask<intrinsic, instruction, "VM",
4573
4582
vti.Vector, vti.Vector, vti.Mask,
4574
4583
vti.Log2SEW, vti.LMul, vti.RegClass, vti.RegClass>;
@@ -4887,7 +4896,7 @@ multiclass VPatBinaryV_VV_INT<string intrinsic, string instruction,
4887
4896
list<VTypeInfo> vtilist> {
4888
4897
foreach vti = vtilist in {
4889
4898
defvar ivti = GetIntVTypeInfo<vti>.Vti;
4890
- let Predicates = GetVTypePredicates <vti>.Predicates in
4899
+ let Predicates = GetVTypeMinimalPredicates <vti>.Predicates in
4891
4900
defm : VPatBinary<intrinsic,
4892
4901
instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW,
4893
4902
vti.Vector, vti.Vector, ivti.Vector, vti.Mask,
@@ -4950,7 +4959,7 @@ multiclass VPatBinaryV_VX_RM<string intrinsic, string instruction,
4950
4959
multiclass VPatBinaryV_VX_INT<string intrinsic, string instruction,
4951
4960
list<VTypeInfo> vtilist> {
4952
4961
foreach vti = vtilist in
4953
- let Predicates = GetVTypePredicates <vti>.Predicates in
4962
+ let Predicates = GetVTypeMinimalPredicates <vti>.Predicates in
4954
4963
defm : VPatBinary<intrinsic, instruction # "_VX_" # vti.LMul.MX,
4955
4964
vti.Vector, vti.Vector, XLenVT, vti.Mask,
4956
4965
vti.Log2SEW, vti.RegClass,
@@ -4979,6 +4988,16 @@ multiclass VPatBinaryV_VI_RM<string intrinsic, string instruction,
4979
4988
vti.RegClass, imm_type>;
4980
4989
}
4981
4990
4991
+ multiclass VPatBinaryV_VI_INT<string intrinsic, string instruction,
4992
+ list<VTypeInfo> vtilist, Operand imm_type> {
4993
+ foreach vti = vtilist in
4994
+ let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
4995
+ defm : VPatBinary<intrinsic, instruction # "_VI_" # vti.LMul.MX,
4996
+ vti.Vector, vti.Vector, XLenVT, vti.Mask,
4997
+ vti.Log2SEW, vti.RegClass,
4998
+ vti.RegClass, imm_type>;
4999
+ }
5000
+
4982
5001
multiclass VPatBinaryM_MM<string intrinsic, string instruction> {
4983
5002
foreach mti = AllMasks in
4984
5003
let Predicates = [HasVInstructions] in
@@ -5709,7 +5728,7 @@ multiclass VPatBinaryV_VV_VX_VI_INT<string intrinsic, string instruction,
5709
5728
list<VTypeInfo> vtilist, Operand ImmType>
5710
5729
: VPatBinaryV_VV_INT<intrinsic#"_vv", instruction, vtilist>,
5711
5730
VPatBinaryV_VX_INT<intrinsic#"_vx", instruction, vtilist>,
5712
- VPatBinaryV_VI <intrinsic#"_vx", instruction, vtilist, ImmType>;
5731
+ VPatBinaryV_VI_INT <intrinsic#"_vx", instruction, vtilist, ImmType>;
5713
5732
5714
5733
multiclass VPatReductionV_VS<string intrinsic, string instruction, bit IsFloat = 0> {
5715
5734
foreach vti = !if(IsFloat, NoGroupFloatVectors, NoGroupIntegerVectors) in {
@@ -5887,12 +5906,11 @@ multiclass VPatConversionWF_VF<string intrinsic, string instruction,
5887
5906
defvar fvti = fvtiToFWti.Vti;
5888
5907
defvar fwti = fvtiToFWti.Wti;
5889
5908
// Define vfwcvt.f.f.v for f16 when Zvfhmin is enable.
5890
- let Predicates = !if(!eq(fvti.Scalar, f16), [HasVInstructionsF16Minimal],
5891
- !listconcat(GetVTypePredicates<fvti>.Predicates,
5892
- GetVTypePredicates<fwti>.Predicates)) in
5893
- defm : VPatConversion<intrinsic, instruction, "V",
5894
- fwti.Vector, fvti.Vector, fwti.Mask, fvti.Log2SEW,
5895
- fvti.LMul, fwti.RegClass, fvti.RegClass, isSEWAware>;
5909
+ let Predicates = !listconcat(GetVTypeMinimalPredicates<fvti>.Predicates,
5910
+ GetVTypeMinimalPredicates<fwti>.Predicates) in
5911
+ defm : VPatConversion<intrinsic, instruction, "V",
5912
+ fwti.Vector, fvti.Vector, fwti.Mask, fvti.Log2SEW,
5913
+ fvti.LMul, fwti.RegClass, fvti.RegClass, isSEWAware>;
5896
5914
}
5897
5915
}
5898
5916
@@ -5979,8 +5997,9 @@ multiclass VPatConversionVF_WF_RM<string intrinsic, string instruction,
5979
5997
foreach fvtiToFWti = wlist in {
5980
5998
defvar fvti = fvtiToFWti.Vti;
5981
5999
defvar fwti = fvtiToFWti.Wti;
5982
- let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates,
5983
- GetVTypePredicates<fwti>.Predicates) in
6000
+ // Define vfncvt.f.f.w for f16 when Zvfhmin is enable.
6001
+ let Predicates = !listconcat(GetVTypeMinimalPredicates<fvti>.Predicates,
6002
+ GetVTypeMinimalPredicates<fwti>.Predicates) in
5984
6003
defm : VPatConversionRoundingMode<intrinsic, instruction, "W",
5985
6004
fvti.Vector, fwti.Vector, fvti.Mask, fvti.Log2SEW,
5986
6005
fvti.LMul, fvti.RegClass, fwti.RegClass,
@@ -6999,8 +7018,7 @@ defm : VPatBinaryV_VM_XM_IM<"int_riscv_vmerge", "PseudoVMERGE">;
6999
7018
// 11.16. Vector Integer Move Instructions
7000
7019
//===----------------------------------------------------------------------===//
7001
7020
foreach vti = AllVectors in {
7002
- let Predicates = !if(!eq(vti.Scalar, f16), [HasVInstructionsF16Minimal],
7003
- GetVTypePredicates<vti>.Predicates) in {
7021
+ let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in {
7004
7022
def : Pat<(vti.Vector (int_riscv_vmv_v_v (vti.Vector vti.RegClass:$passthru),
7005
7023
(vti.Vector vti.RegClass:$rs1),
7006
7024
VLOpFrag)),
@@ -7195,8 +7213,7 @@ defm : VPatConversionVI_VF<"int_riscv_vfclass", "PseudoVFCLASS">;
7195
7213
// NOTE: Clang previously used int_riscv_vfmerge for vector-vector, but now uses
7196
7214
// int_riscv_vmerge. Support both for compatibility.
7197
7215
foreach vti = AllFloatVectors in {
7198
- let Predicates = !if(!eq(vti.Scalar, f16), [HasVInstructionsF16Minimal],
7199
- GetVTypePredicates<vti>.Predicates) in
7216
+ let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
7200
7217
defm : VPatBinaryCarryInTAIL<"int_riscv_vmerge", "PseudoVMERGE", "VVM",
7201
7218
vti.Vector,
7202
7219
vti.Vector, vti.Vector, vti.Mask,
@@ -7275,16 +7292,8 @@ defm : VPatConversionVF_WI_RM<"int_riscv_vfncvt_f_xu_w", "PseudoVFNCVT_F_XU",
7275
7292
isSEWAware=1>;
7276
7293
defm : VPatConversionVF_WI_RM<"int_riscv_vfncvt_f_x_w", "PseudoVFNCVT_F_X",
7277
7294
isSEWAware=1>;
7278
- defvar WidenableFloatVectorsExceptF16 = !filter(fvtiToFWti, AllWidenableFloatVectors,
7279
- !ne(fvtiToFWti.Vti.Scalar, f16));
7280
- defm : VPatConversionVF_WF_RM<"int_riscv_vfncvt_f_f_w", "PseudoVFNCVT_F_F",
7281
- WidenableFloatVectorsExceptF16, isSEWAware=1>;
7282
- // Define vfncvt.f.f.w for f16 when Zvfhmin is enable.
7283
- defvar F16WidenableFloatVectors = !filter(fvtiToFWti, AllWidenableFloatVectors,
7284
- !eq(fvtiToFWti.Vti.Scalar, f16));
7285
- let Predicates = [HasVInstructionsF16Minimal] in
7286
7295
defm : VPatConversionVF_WF_RM<"int_riscv_vfncvt_f_f_w", "PseudoVFNCVT_F_F",
7287
- F16WidenableFloatVectors , isSEWAware=1>;
7296
+ AllWidenableFloatVectors , isSEWAware=1>;
7288
7297
defm : VPatConversionVF_WF_BF_RM<"int_riscv_vfncvtbf16_f_f_w",
7289
7298
"PseudoVFNCVTBF16_F_F", isSEWAware=1>;
7290
7299
defm : VPatConversionVF_WF<"int_riscv_vfncvt_rod_f_f_w", "PseudoVFNCVT_ROD_F_F",
@@ -7419,10 +7428,7 @@ defm : VPatBinaryV_VV_INT_EEW<"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16",
7419
7428
eew=16, vtilist=AllIntegerVectors>;
7420
7429
7421
7430
defm : VPatBinaryV_VV_VX_VI_INT<"int_riscv_vrgather", "PseudoVRGATHER",
7422
- AllFloatVectorsExceptFP16, uimm5>;
7423
- let Predicates = [HasVInstructionsF16Minimal] in
7424
- defm : VPatBinaryV_VV_VX_VI_INT<"int_riscv_vrgather", "PseudoVRGATHER",
7425
- AllFP16Vectors, uimm5>;
7431
+ AllFloatVectors, uimm5>;
7426
7432
defm : VPatBinaryV_VV_VX_VI_INT<"int_riscv_vrgather", "PseudoVRGATHER",
7427
7433
AllBFloatVectors, uimm5>;
7428
7434
defm : VPatBinaryV_VV_INT_EEW<"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16",
@@ -7431,9 +7437,7 @@ defm : VPatBinaryV_VV_INT_EEW<"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16",
7431
7437
// 16.5. Vector Compress Instruction
7432
7438
//===----------------------------------------------------------------------===//
7433
7439
defm : VPatUnaryV_V_AnyMask<"int_riscv_vcompress", "PseudoVCOMPRESS", AllIntegerVectors>;
7434
- defm : VPatUnaryV_V_AnyMask<"int_riscv_vcompress", "PseudoVCOMPRESS", AllFloatVectorsExceptFP16>;
7435
- let Predicates = [HasVInstructionsF16Minimal] in
7436
- defm : VPatUnaryV_V_AnyMask<"int_riscv_vcompress", "PseudoVCOMPRESS", AllFP16Vectors>;
7440
+ defm : VPatUnaryV_V_AnyMask<"int_riscv_vcompress", "PseudoVCOMPRESS", AllFloatVectors>;
7437
7441
defm : VPatUnaryV_V_AnyMask<"int_riscv_vcompress", "PseudoVCOMPRESS", AllBFloatVectors>;
7438
7442
7439
7443
// Include the non-intrinsic ISel patterns
0 commit comments