@@ -1939,6 +1939,24 @@ multiclass VPseudoBinary<VReg RetClass,
1939
1939
}
1940
1940
}
1941
1941
1942
+ multiclass VPseudoBinary_E<VReg RetClass,
1943
+ VReg Op1Class,
1944
+ DAGOperand Op2Class,
1945
+ LMULInfo MInfo,
1946
+ int sew,
1947
+ string Constraint = ""> {
1948
+ let VLMul = MInfo.value in {
1949
+ defvar suffix = "_" # MInfo.MX # "_E" # sew;
1950
+ def suffix : VPseudoBinaryNoMask<RetClass, Op1Class, Op2Class,
1951
+ Constraint>;
1952
+ def suffix # "_TU" : VPseudoBinaryNoMaskTU<RetClass, Op1Class, Op2Class,
1953
+ Constraint>;
1954
+ def suffix # "_MASK" : VPseudoBinaryMaskPolicy<RetClass, Op1Class, Op2Class,
1955
+ Constraint>,
1956
+ RISCVMaskedPseudo</*MaskOpIdx*/ 3>;
1957
+ }
1958
+ }
1959
+
1942
1960
multiclass VPseudoBinaryM<VReg RetClass,
1943
1961
VReg Op1Class,
1944
1962
DAGOperand Op2Class,
@@ -1971,6 +1989,25 @@ multiclass VPseudoBinaryEmul<VReg RetClass,
1971
1989
}
1972
1990
}
1973
1991
1992
+ multiclass VPseudoBinaryEmul_E<VReg RetClass,
1993
+ VReg Op1Class,
1994
+ DAGOperand Op2Class,
1995
+ LMULInfo lmul,
1996
+ int sew,
1997
+ LMULInfo emul,
1998
+ string Constraint = ""> {
1999
+ let VLMul = lmul.value in {
2000
+ defvar suffix = "_" # lmul.MX # "_E" # sew # "_" # emul.MX;
2001
+ def suffix : VPseudoBinaryNoMask<RetClass, Op1Class, Op2Class,
2002
+ Constraint>;
2003
+ def suffix # "_TU" : VPseudoBinaryNoMaskTU<RetClass, Op1Class, Op2Class,
2004
+ Constraint>;
2005
+ def suffix # "_MASK" : VPseudoBinaryMaskPolicy<RetClass, Op1Class, Op2Class,
2006
+ Constraint>,
2007
+ RISCVMaskedPseudo</*MaskOpIdx*/ 3>;
2008
+ }
2009
+ }
2010
+
1974
2011
multiclass VPseudoTiedBinary<VReg RetClass,
1975
2012
DAGOperand Op2Class,
1976
2013
LMULInfo MInfo,
@@ -1987,6 +2024,10 @@ multiclass VPseudoBinaryV_VV<LMULInfo m, string Constraint = ""> {
1987
2024
defm _VV : VPseudoBinary<m.vrclass, m.vrclass, m.vrclass, m, Constraint>;
1988
2025
}
1989
2026
2027
+ multiclass VPseudoBinaryV_VV_E<LMULInfo m, int sew, string Constraint = ""> {
2028
+ defm _VV : VPseudoBinary_E<m.vrclass, m.vrclass, m.vrclass, m, sew, Constraint>;
2029
+ }
2030
+
1990
2031
// Similar to VPseudoBinaryV_VV, but uses MxListF.
1991
2032
multiclass VPseudoBinaryFV_VV<LMULInfo m, string Constraint = ""> {
1992
2033
defm _VV : VPseudoBinary<m.vrclass, m.vrclass, m.vrclass, m, Constraint>;
@@ -1995,20 +2036,21 @@ multiclass VPseudoBinaryFV_VV<LMULInfo m, string Constraint = ""> {
1995
2036
multiclass VPseudoVGTR_VV_EEW<int eew, string Constraint = ""> {
1996
2037
foreach m = MxList in {
1997
2038
defvar mx = m.MX;
1998
- defvar WriteVRGatherVV_MX = !cast<SchedWrite>("WriteVRGatherVV_" # mx);
1999
- defvar ReadVRGatherVV_data_MX = !cast<SchedRead>("ReadVRGatherVV_data_" # mx);
2000
- defvar ReadVRGatherVV_index_MX = !cast<SchedRead>("ReadVRGatherVV_index_" # mx);
2001
-
2002
2039
foreach sew = EEWList in {
2003
2040
defvar octuple_lmul = m.octuple;
2004
2041
// emul = lmul * eew / sew
2005
2042
defvar octuple_emul = !srl(!mul(octuple_lmul, eew), log2<sew>.val);
2006
2043
if !and(!ge(octuple_emul, 1), !le(octuple_emul, 64)) then {
2007
2044
defvar emulMX = octuple_to_str<octuple_emul>.ret;
2008
2045
defvar emul = !cast<LMULInfo>("V_" # emulMX);
2009
- defm _VV : VPseudoBinaryEmul<m.vrclass, m.vrclass, emul.vrclass, m, emul, Constraint>,
2010
- Sched<[WriteVRGatherVV_MX, ReadVRGatherVV_data_MX,
2011
- ReadVRGatherVV_index_MX]>;
2046
+ defvar sews = SchedSEWSet<mx>.val;
2047
+ foreach e = sews in {
2048
+ defvar WriteVRGatherVV_MX_E = !cast<SchedWrite>("WriteVRGatherVV_" # mx # "_E" # e);
2049
+ defvar ReadVRGatherVV_data_MX_E = !cast<SchedRead>("ReadVRGatherVV_data_" # mx # "_E" # e);
2050
+ defvar ReadVRGatherVV_index_MX_E = !cast<SchedRead>("ReadVRGatherVV_index_" # mx # "_E" # e);
2051
+ defm _VV : VPseudoBinaryEmul_E<m.vrclass, m.vrclass, emul.vrclass, m, e, emul, Constraint>,
2052
+ Sched<[WriteVRGatherVV_MX_E, ReadVRGatherVV_data_MX_E, ReadVRGatherVV_index_MX_E]>;
2053
+ }
2012
2054
}
2013
2055
}
2014
2056
}
@@ -2404,23 +2446,27 @@ multiclass VPseudoBinaryM_VI<LMULInfo m> {
2404
2446
multiclass VPseudoVGTR_VV_VX_VI<Operand ImmType = simm5, string Constraint = ""> {
2405
2447
foreach m = MxList in {
2406
2448
defvar mx = m.MX;
2407
- defvar WriteVRGatherVV_MX = !cast<SchedWrite>("WriteVRGatherVV_" # mx);
2408
2449
defvar WriteVRGatherVX_MX = !cast<SchedWrite>("WriteVRGatherVX_" # mx);
2409
2450
defvar WriteVRGatherVI_MX = !cast<SchedWrite>("WriteVRGatherVI_" # mx);
2410
- defvar ReadVRGatherVV_data_MX = !cast<SchedRead>("ReadVRGatherVV_data_" # mx);
2411
- defvar ReadVRGatherVV_index_MX = !cast<SchedRead>("ReadVRGatherVV_index_" # mx);
2412
2451
defvar ReadVRGatherVX_data_MX = !cast<SchedRead>("ReadVRGatherVX_data_" # mx);
2413
2452
defvar ReadVRGatherVX_index_MX = !cast<SchedRead>("ReadVRGatherVX_index_" # mx);
2414
2453
defvar ReadVRGatherVI_data_MX = !cast<SchedRead>("ReadVRGatherVI_data_" # mx);
2415
2454
2416
- defm "" : VPseudoBinaryV_VV<m, Constraint>,
2417
- Sched<[WriteVRGatherVV_MX, ReadVRGatherVV_data_MX,
2418
- ReadVRGatherVV_index_MX, ReadVMask]>;
2419
2455
defm "" : VPseudoBinaryV_VX<m, Constraint>,
2420
2456
Sched<[WriteVRGatherVX_MX, ReadVRGatherVX_data_MX,
2421
2457
ReadVRGatherVX_index_MX, ReadVMask]>;
2422
2458
defm "" : VPseudoBinaryV_VI<ImmType, m, Constraint>,
2423
2459
Sched<[WriteVRGatherVI_MX, ReadVRGatherVI_data_MX, ReadVMask]>;
2460
+
2461
+ defvar sews = SchedSEWSet<mx>.val;
2462
+ foreach e = sews in {
2463
+ defvar WriteVRGatherVV_MX_E = !cast<SchedWrite>("WriteVRGatherVV_" # mx # "_E" # e);
2464
+ defvar ReadVRGatherVV_data_MX_E = !cast<SchedRead>("ReadVRGatherVV_data_" # mx # "_E" # e);
2465
+ defvar ReadVRGatherVV_index_MX_E = !cast<SchedRead>("ReadVRGatherVV_index_" # mx # "_E" # e);
2466
+ defm "" : VPseudoBinaryV_VV_E<m, e, Constraint>,
2467
+ Sched<[WriteVRGatherVV_MX_E, ReadVRGatherVV_data_MX_E,
2468
+ ReadVRGatherVV_index_MX_E, ReadVMask]>;
2469
+ }
2424
2470
}
2425
2471
}
2426
2472
@@ -4457,18 +4503,19 @@ multiclass VPatBinaryV_VV<string intrinsic, string instruction,
4457
4503
vti.RegClass, vti.RegClass>;
4458
4504
}
4459
4505
4460
- multiclass VPatBinaryV_VV_INT <string intrinsic, string instruction,
4506
+ multiclass VPatBinaryV_VV_INT_E <string intrinsic, string instruction,
4461
4507
list<VTypeInfo> vtilist> {
4462
4508
foreach vti = vtilist in {
4463
4509
defvar ivti = GetIntVTypeInfo<vti>.Vti;
4464
- defm : VPatBinaryTA<intrinsic, instruction # "_VV_" # vti.LMul.MX,
4510
+ defm : VPatBinaryTA<intrinsic,
4511
+ instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW,
4465
4512
vti.Vector, vti.Vector, ivti.Vector, vti.Mask,
4466
4513
vti.Log2SEW, vti.RegClass,
4467
4514
vti.RegClass, vti.RegClass>;
4468
4515
}
4469
4516
}
4470
4517
4471
- multiclass VPatBinaryV_VV_INT_EEW <string intrinsic, string instruction,
4518
+ multiclass VPatBinaryV_VV_INT_E_EEW <string intrinsic, string instruction,
4472
4519
int eew, list<VTypeInfo> vtilist> {
4473
4520
foreach vti = vtilist in {
4474
4521
// emul = lmul * eew / sew
@@ -4478,7 +4525,7 @@ multiclass VPatBinaryV_VV_INT_EEW<string intrinsic, string instruction,
4478
4525
if !and(!ge(octuple_emul, 1), !le(octuple_emul, 64)) then {
4479
4526
defvar emul_str = octuple_to_str<octuple_emul>.ret;
4480
4527
defvar ivti = !cast<VTypeInfo>("VI" # eew # emul_str);
4481
- defvar inst = instruction # "_VV_" # vti.LMul.MX # "_" # emul_str;
4528
+ defvar inst = instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW # " _" # emul_str;
4482
4529
defm : VPatBinaryTA<intrinsic, inst,
4483
4530
vti.Vector, vti.Vector, ivti.Vector, vti.Mask,
4484
4531
vti.Log2SEW, vti.RegClass,
@@ -4967,7 +5014,7 @@ multiclass VPatBinaryM_VX_VI<string intrinsic, string instruction,
4967
5014
4968
5015
multiclass VPatBinaryV_VV_VX_VI_INT<string intrinsic, string instruction,
4969
5016
list<VTypeInfo> vtilist, Operand ImmType = simm5>
4970
- : VPatBinaryV_VV_INT <intrinsic#"_vv", instruction, vtilist>,
5017
+ : VPatBinaryV_VV_INT_E <intrinsic#"_vv", instruction, vtilist>,
4971
5018
VPatBinaryV_VX_INT<intrinsic#"_vx", instruction, vtilist>,
4972
5019
VPatBinaryV_VI<intrinsic#"_vx", instruction, vtilist, ImmType>;
4973
5020
@@ -6455,14 +6502,14 @@ let Predicates = [HasVInstructionsAnyF] in {
6455
6502
let Predicates = [HasVInstructions] in {
6456
6503
defm : VPatBinaryV_VV_VX_VI_INT<"int_riscv_vrgather", "PseudoVRGATHER",
6457
6504
AllIntegerVectors, uimm5>;
6458
- defm : VPatBinaryV_VV_INT_EEW <"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16",
6505
+ defm : VPatBinaryV_VV_INT_E_EEW <"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16",
6459
6506
/* eew */ 16, AllIntegerVectors>;
6460
6507
} // Predicates = [HasVInstructions]
6461
6508
6462
6509
let Predicates = [HasVInstructionsAnyF] in {
6463
6510
defm : VPatBinaryV_VV_VX_VI_INT<"int_riscv_vrgather", "PseudoVRGATHER",
6464
6511
AllFloatVectors, uimm5>;
6465
- defm : VPatBinaryV_VV_INT_EEW <"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16",
6512
+ defm : VPatBinaryV_VV_INT_E_EEW <"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16",
6466
6513
/* eew */ 16, AllFloatVectors>;
6467
6514
} // Predicates = [HasVInstructionsAnyF]
6468
6515
0 commit comments