@@ -123,7 +123,7 @@ class VPatBinarySDNode_XI<SDPatternOperator vop,
123
123
avl, log2sew, TA_MA)>;
124
124
125
125
multiclass VPatBinarySDNode_VV_VX<SDPatternOperator vop, string instruction_name,
126
- list<VTypeInfo> vtilist = AllIntegerVectors ,
126
+ list<VTypeInfo> vtilist = AllScalableAndFixedIntegerVectors ,
127
127
bit isSEWAware = 0> {
128
128
foreach vti = vtilist in {
129
129
let Predicates = GetVTypePredicates<vti>.Predicates in {
@@ -141,7 +141,7 @@ multiclass VPatBinarySDNode_VV_VX<SDPatternOperator vop, string instruction_name
141
141
multiclass VPatBinarySDNode_VV_VX_VI<SDPatternOperator vop, string instruction_name,
142
142
Operand ImmType = simm5>
143
143
: VPatBinarySDNode_VV_VX<vop, instruction_name> {
144
- foreach vti = AllIntegerVectors in {
144
+ foreach vti = AllScalableAndFixedIntegerVectors in {
145
145
let Predicates = GetVTypePredicates<vti>.Predicates in
146
146
def : VPatBinarySDNode_XI<vop, instruction_name, "VI",
147
147
vti.Vector, vti.Vector, vti.Log2SEW,
@@ -470,7 +470,7 @@ multiclass VPatNConvertFP2ISDNode_W<SDPatternOperator vop,
470
470
471
471
multiclass VPatWidenBinarySDNode_VV_VX<SDNode op, PatFrags extop1, PatFrags extop2,
472
472
string instruction_name> {
473
- foreach vtiToWti = AllWidenableIntVectors in {
473
+ foreach vtiToWti = AllScalableAndFixedWidenableIntVectors in {
474
474
defvar vti = vtiToWti.Vti;
475
475
defvar wti = vtiToWti.Wti;
476
476
let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates,
@@ -491,7 +491,7 @@ multiclass VPatWidenBinarySDNode_VV_VX<SDNode op, PatFrags extop1, PatFrags exto
491
491
492
492
multiclass VPatWidenBinarySDNode_WV_WX<SDNode op, PatFrags extop,
493
493
string instruction_name> {
494
- foreach vtiToWti = AllWidenableIntVectors in {
494
+ foreach vtiToWti = AllScalableAndFixedWidenableIntVectors in {
495
495
defvar vti = vtiToWti.Vti;
496
496
defvar wti = vtiToWti.Wti;
497
497
let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates,
@@ -834,7 +834,7 @@ multiclass VPatWidenFPNegMulSacSDNode_VV_VF_RM<string instruction_name> {
834
834
}
835
835
836
836
multiclass VPatMultiplyAddSDNode_VV_VX<SDNode op, string instruction_name> {
837
- foreach vti = AllIntegerVectors in {
837
+ foreach vti = AllScalableAndFixedIntegerVectors in {
838
838
defvar suffix = vti.LMul.MX;
839
839
let Predicates = GetVTypePredicates<vti>.Predicates in {
840
840
// NOTE: We choose VMADD because it has the most commuting freedom. So it
@@ -877,7 +877,7 @@ multiclass VPatAVGADD_VV_VX_RM<SDNode vop, int vxrm, string suffix = ""> {
877
877
//===----------------------------------------------------------------------===//
878
878
879
879
// 7.4. Vector Unit-Stride Instructions
880
- foreach vti = AllVectors in
880
+ foreach vti = AllScalableAndFixedIntegerVectors in
881
881
let Predicates = !if(!eq(vti.Scalar, f16), [HasVInstructionsF16Minimal],
882
882
GetVTypePredicates<vti>.Predicates) in
883
883
defm : VPatUSLoadStoreSDNode<vti.Vector, vti.Log2SEW, vti.LMul,
@@ -893,7 +893,7 @@ defm : VPatBinarySDNode_VV_VX_VI<add, "PseudoVADD">;
893
893
defm : VPatBinarySDNode_VV_VX<sub, "PseudoVSUB">;
894
894
// Handle VRSUB specially since it's the only integer binary op with reversed
895
895
// pattern operands
896
- foreach vti = AllIntegerVectors in {
896
+ foreach vti = AllScalableAndFixedIntegerVectors in {
897
897
// FIXME: The AddedComplexity here is covering up a missing matcher for
898
898
// widening vwsub.vx which can recognize a extended folded into the
899
899
// scalar of the splat.
@@ -922,7 +922,7 @@ defm : VPatWidenBinarySDNode_VV_VX_WV_WX<sub, zext_oneuse, "PseudoVWSUBU">;
922
922
defm : VPatWidenBinarySDNode_VV_VX_WV_WX<sub, anyext_oneuse, "PseudoVWSUBU">;
923
923
924
924
// shl (ext v, splat 1) is a special case of widening add.
925
- foreach vtiToWti = AllWidenableIntVectors in {
925
+ foreach vtiToWti = AllScalableAndFixedWidenableIntVectors in {
926
926
defvar vti = vtiToWti.Vti;
927
927
defvar wti = vtiToWti.Wti;
928
928
let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates,
@@ -933,6 +933,7 @@ foreach vtiToWti = AllWidenableIntVectors in {
933
933
(wti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs1, vti.RegClass:$rs1,
934
934
vti.AVL, vti.Log2SEW, TA_MA)>;
935
935
def : Pat<(shl (wti.Vector (zext_oneuse (vti.Vector vti.RegClass:$rs1))),
936
+ // TODO: Need to make this splat 1 generic over fixed and scalable types
936
937
(wti.Vector (riscv_vmv_v_x_vl (wti.Vector undef), 1, (XLenVT srcvalue)))),
937
938
(!cast<Instruction>("PseudoVWADDU_VV_"#vti.LMul.MX)
938
939
(wti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs1, vti.RegClass:$rs1,
@@ -942,6 +943,7 @@ foreach vtiToWti = AllWidenableIntVectors in {
942
943
(!cast<Instruction>("PseudoVWADDU_VV_"#vti.LMul.MX)
943
944
(wti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs1, vti.RegClass:$rs1,
944
945
vti.AVL, vti.Log2SEW, TA_MA)>;
946
+ if wti.Vector.isScalable then {
945
947
def : Pat<(shl (wti.Vector (riscv_sext_vl_oneuse (vti.Vector vti.RegClass:$rs1), (vti.Mask V0), VLOpFrag)),
946
948
(wti.Vector (riscv_vmv_v_x_vl (wti.Vector undef), 1, (XLenVT srcvalue)))),
947
949
(!cast<Instruction>("PseudoVWADD_VV_"#vti.LMul.MX#"_MASK")
@@ -952,22 +954,23 @@ foreach vtiToWti = AllWidenableIntVectors in {
952
954
(!cast<Instruction>("PseudoVWADDU_VV_"#vti.LMul.MX#"_MASK")
953
955
(wti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs1, vti.RegClass:$rs1,
954
956
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>;
957
+ }
955
958
}
956
959
}
957
960
958
961
// 11.3. Vector Integer Extension
959
962
defm : VPatExtendSDNode_V<[zext, anyext], "PseudoVZEXT", "VF2",
960
- AllFractionableVF2IntVectors >;
963
+ AllFixedAndScalableFractionableVF2IntVectors >;
961
964
defm : VPatExtendSDNode_V<[sext], "PseudoVSEXT", "VF2",
962
- AllFractionableVF2IntVectors >;
965
+ AllFixedAndScalableFractionableVF2IntVectors >;
963
966
defm : VPatExtendSDNode_V<[zext, anyext], "PseudoVZEXT", "VF4",
964
- AllFractionableVF4IntVectors >;
967
+ AllFixedAndScalableFractionableVF4IntVectors >;
965
968
defm : VPatExtendSDNode_V<[sext], "PseudoVSEXT", "VF4",
966
- AllFractionableVF4IntVectors >;
969
+ AllFixedAndScalableFractionableVF4IntVectors >;
967
970
defm : VPatExtendSDNode_V<[zext, anyext], "PseudoVZEXT", "VF8",
968
- AllFractionableVF8IntVectors >;
971
+ AllFixedAndScalableFractionableVF8IntVectors >;
969
972
defm : VPatExtendSDNode_V<[sext], "PseudoVSEXT", "VF8",
970
- AllFractionableVF8IntVectors >;
973
+ AllFixedAndScalableFractionableVF8IntVectors >;
971
974
972
975
// 11.5. Vector Bitwise Logical Instructions
973
976
defm : VPatBinarySDNode_VV_VX_VI<and, "PseudoVAND">;
@@ -1455,3 +1458,14 @@ foreach vti = NoGroupFloatVectors in {
1455
1458
def : Pat<(vti.Scalar (extractelt (vti.Vector vti.RegClass:$rs2), 0)),
1456
1459
(vfmv_f_s_inst vti.RegClass:$rs2, vti.Log2SEW)>;
1457
1460
}
1461
+
1462
+ foreach vti = FixedLengthVectors in {
1463
+ defvar vslidedown_v_i_inst = !cast<Instruction>("PseudoVSLIDEDOWN_VI_" # vti.LMul.MX);
1464
+ defvar vmv_x_s_inst = !cast<Instruction>(!strconcat("PseudoVMV_",
1465
+ vti.ScalarSuffix,
1466
+ "_S"));
1467
+ // let Predicates = GetVTypePredicates<vti>.Predicates in
1468
+ // def : Pat<(vti.Scalar (extractelt (vti.Vector vti.RegClass:$rs2), uimm5:$idx)),
1469
+ // (vmv_x_s_inst (vslidedown_v_i_inst (IMPLICIT_DEF), vti.RegClass:$rs2, $idx, vti.AVL, vti.Log2SEW, 0),
1470
+ // vti.Log2SEW)>;
1471
+ }
0 commit comments