@@ -103,20 +103,6 @@ def FPList {
103
103
list<FPR_Info> fpinfo = [SCALAR_F16, SCALAR_F32, SCALAR_F64];
104
104
}
105
105
106
- class getScalarSuffix<ValueType type> {
107
- string suffix = !cond(!eq(type, XLenVT): "VX",
108
- !eq(type, f16): "VF_F16",
109
- !eq(type, f32): "VF_F32",
110
- !eq(type, f64): "VF_F64");
111
- }
112
-
113
- class getWScalarSuffix<ValueType type> {
114
- string suffix = !cond(!eq(type, XLenVT): "WX",
115
- !eq(type, f16): "WF_F16",
116
- !eq(type, f32): "WF_F32",
117
- !eq(type, f64): "WF_F64");
118
- }
119
-
120
106
class MxSet<int eew> {
121
107
list<LMULInfo> m = !cond(!eq(eew, 8) : [V_MF8, V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8],
122
108
!eq(eew, 16) : [V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8],
@@ -186,6 +172,11 @@ class VTypeInfo<ValueType Vec, ValueType Mas, int Sew, VReg Reg, LMULInfo M,
186
172
// The pattern fragment which produces the AVL operand, representing the
187
173
// "natural" vector length for this type. For scalable vectors this is VLMax.
188
174
OutPatFrag AVL = VLMax;
175
+
176
+ string ScalarSuffix = !cond(!eq(Scal, XLenVT) : "X",
177
+ !eq(Scal, f16) : "F16",
178
+ !eq(Scal, f32) : "F32",
179
+ !eq(Scal, f64) : "F64");
189
180
}
190
181
191
182
class GroupVTypeInfo<ValueType Vec, ValueType VecM1, ValueType Mas, int Sew,
@@ -467,9 +458,9 @@ class PseudoToVInst<string PseudoInst> {
467
458
!subst("_B32", "",
468
459
!subst("_B64", "",
469
460
!subst("_MASK", "",
470
- !subst("_F16 ", "",
471
- !subst("_F32 ", "",
472
- !subst("_F64 ", "",
461
+ !subst("F16 ", "F ",
462
+ !subst("F32 ", "F ",
463
+ !subst("F64 ", "F ",
473
464
!subst("Pseudo", "", PseudoInst)))))))))))))))))));
474
465
}
475
466
@@ -1408,8 +1399,8 @@ multiclass VPseudoBinaryV_VX<string Constraint = ""> {
1408
1399
multiclass VPseudoBinaryV_VF<string Constraint = ""> {
1409
1400
foreach m = MxList.m in
1410
1401
foreach f = FPList.fpinfo in
1411
- defm "_VF_ " # f.FX : VPseudoBinary<m.vrclass, m.vrclass,
1412
- f.fprclass, m, Constraint>;
1402
+ defm "_V " # f.FX : VPseudoBinary<m.vrclass, m.vrclass,
1403
+ f.fprclass, m, Constraint>;
1413
1404
}
1414
1405
1415
1406
multiclass VPseudoBinaryV_VI<Operand ImmType = simm5, string Constraint = ""> {
@@ -1446,9 +1437,9 @@ multiclass VPseudoBinaryW_VX {
1446
1437
multiclass VPseudoBinaryW_VF {
1447
1438
foreach m = MxList.m[0-5] in
1448
1439
foreach f = FPList.fpinfo[0-1] in
1449
- defm "_VF_ " # f.FX : VPseudoBinary<m.wvrclass, m.vrclass,
1450
- f.fprclass, m,
1451
- "@earlyclobber $rd">;
1440
+ defm "_V " # f.FX : VPseudoBinary<m.wvrclass, m.vrclass,
1441
+ f.fprclass, m,
1442
+ "@earlyclobber $rd">;
1452
1443
}
1453
1444
1454
1445
multiclass VPseudoBinaryW_WV {
@@ -1466,9 +1457,9 @@ multiclass VPseudoBinaryW_WX {
1466
1457
multiclass VPseudoBinaryW_WF {
1467
1458
foreach m = MxList.m[0-5] in
1468
1459
foreach f = FPList.fpinfo[0-1] in
1469
- defm "_WF_ " # f.FX : VPseudoBinary<m.wvrclass, m.wvrclass,
1470
- f.fprclass, m,
1471
- "@earlyclobber $rd">;
1460
+ defm "_W " # f.FX : VPseudoBinary<m.wvrclass, m.wvrclass,
1461
+ f.fprclass, m,
1462
+ "@earlyclobber $rd">;
1472
1463
}
1473
1464
1474
1465
multiclass VPseudoBinaryV_WV {
@@ -1515,7 +1506,7 @@ multiclass VPseudoBinaryV_XM<bit CarryOut = 0, bit CarryIn = 1,
1515
1506
multiclass VPseudoBinaryV_FM {
1516
1507
foreach m = MxList.m in
1517
1508
foreach f = FPList.fpinfo in
1518
- def "_VFM_ " # f.FX # "_ " # m.MX :
1509
+ def "_V " # f.FX # "M_ " # m.MX :
1519
1510
VPseudoBinaryCarryIn<GetVRegNoV0<m.vrclass>.R,
1520
1511
m.vrclass, f.fprclass, m, /*CarryIn=*/1, "">;
1521
1512
}
@@ -1544,7 +1535,7 @@ multiclass VPseudoUnaryV_F_NoDummyMask {
1544
1535
foreach m = MxList.m in {
1545
1536
foreach f = FPList.fpinfo in {
1546
1537
let VLMul = m.value in {
1547
- def "_F_ " # f.FX # "_" # m.MX : VPseudoUnaryNoDummyMask<m.vrclass, f.fprclass>;
1538
+ def "_ " # f.FX # "_" # m.MX : VPseudoUnaryNoDummyMask<m.vrclass, f.fprclass>;
1548
1539
}
1549
1540
}
1550
1541
}
@@ -1613,7 +1604,7 @@ multiclass VPseudoBinaryM_VX {
1613
1604
multiclass VPseudoBinaryM_VF {
1614
1605
foreach m = MxList.m in
1615
1606
foreach f = FPList.fpinfo in
1616
- defm "_VF_ " # f.FX :
1607
+ defm "_V " # f.FX :
1617
1608
VPseudoBinary<VR, m.vrclass, f.fprclass, m, "@earlyclobber $rd">;
1618
1609
}
1619
1610
@@ -1731,8 +1722,8 @@ multiclass VPseudoTernaryV_VX_AAXA<string Constraint = ""> {
1731
1722
multiclass VPseudoTernaryV_VF_AAXA<string Constraint = ""> {
1732
1723
foreach m = MxList.m in
1733
1724
foreach f = FPList.fpinfo in
1734
- defm "_VF_ " # f.FX : VPseudoTernary<m.vrclass, f.fprclass, m.vrclass,
1735
- m, Constraint>;
1725
+ defm "_V " # f.FX : VPseudoTernary<m.vrclass, f.fprclass, m.vrclass,
1726
+ m, Constraint>;
1736
1727
}
1737
1728
1738
1729
multiclass VPseudoTernaryW_VV {
@@ -1751,8 +1742,8 @@ multiclass VPseudoTernaryW_VF {
1751
1742
defvar constraint = "@earlyclobber $rd";
1752
1743
foreach m = MxList.m[0-5] in
1753
1744
foreach f = FPList.fpinfo[0-1] in
1754
- defm "_VF_ " # f.FX : VPseudoTernary<m.wvrclass, f.fprclass, m.vrclass, m,
1755
- constraint>;
1745
+ defm "_V " # f.FX : VPseudoTernary<m.wvrclass, f.fprclass, m.vrclass, m,
1746
+ constraint>;
1756
1747
}
1757
1748
1758
1749
multiclass VPseudoTernaryV_VI<Operand ImmType = simm5, string Constraint = ""> {
@@ -2510,7 +2501,7 @@ multiclass VPatBinaryV_VV_INT_EEW<string intrinsic, string instruction,
2510
2501
multiclass VPatBinaryV_VX<string intrinsic, string instruction,
2511
2502
list<VTypeInfo> vtilist> {
2512
2503
foreach vti = vtilist in {
2513
- defvar kind = getScalarSuffix< vti.Scalar>.suffix ;
2504
+ defvar kind = "V"# vti.ScalarSuffix ;
2514
2505
defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#vti.LMul.MX,
2515
2506
vti.Vector, vti.Vector, vti.Scalar, vti.Mask,
2516
2507
vti.SEW, vti.RegClass,
@@ -2560,7 +2551,7 @@ multiclass VPatBinaryW_VX<string intrinsic, string instruction,
2560
2551
foreach VtiToWti = vtilist in {
2561
2552
defvar Vti = VtiToWti.Vti;
2562
2553
defvar Wti = VtiToWti.Wti;
2563
- defvar kind = getScalarSuffix< Vti.Scalar>.suffix ;
2554
+ defvar kind = "V"# Vti.ScalarSuffix ;
2564
2555
defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#Vti.LMul.MX,
2565
2556
Wti.Vector, Vti.Vector, Vti.Scalar, Vti.Mask,
2566
2557
Vti.SEW, Wti.RegClass,
@@ -2585,7 +2576,7 @@ multiclass VPatBinaryW_WX<string intrinsic, string instruction,
2585
2576
foreach VtiToWti = vtilist in {
2586
2577
defvar Vti = VtiToWti.Vti;
2587
2578
defvar Wti = VtiToWti.Wti;
2588
- defvar kind = getWScalarSuffix< Vti.Scalar>.suffix ;
2579
+ defvar kind = "W"# Vti.ScalarSuffix ;
2589
2580
defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#Vti.LMul.MX,
2590
2581
Wti.Vector, Wti.Vector, Vti.Scalar, Vti.Mask,
2591
2582
Vti.SEW, Wti.RegClass,
@@ -2610,7 +2601,7 @@ multiclass VPatBinaryV_WX<string intrinsic, string instruction,
2610
2601
foreach VtiToWti = vtilist in {
2611
2602
defvar Vti = VtiToWti.Vti;
2612
2603
defvar Wti = VtiToWti.Wti;
2613
- defvar kind = getWScalarSuffix< Vti.Scalar>.suffix ;
2604
+ defvar kind = "W"# Vti.ScalarSuffix ;
2614
2605
defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#Vti.LMul.MX,
2615
2606
Vti.Vector, Wti.Vector, Vti.Scalar, Vti.Mask,
2616
2607
Vti.SEW, Vti.RegClass,
@@ -2646,10 +2637,7 @@ multiclass VPatBinaryV_XM<string intrinsic, string instruction,
2646
2637
list<VTypeInfo> vtilist = AllIntegerVectors> {
2647
2638
foreach vti = vtilist in
2648
2639
defm : VPatBinaryCarryIn<intrinsic, instruction,
2649
- !cond(!eq(vti.Scalar, XLenVT): "VXM",
2650
- !eq(vti.Scalar, f16): "VFM_F16",
2651
- !eq(vti.Scalar, f32): "VFM_F32",
2652
- !eq(vti.Scalar, f64): "VFM_F64"),
2640
+ "V"#vti.ScalarSuffix#"M",
2653
2641
!if(CarryOut, vti.Mask, vti.Vector),
2654
2642
vti.Vector, vti.Scalar, vti.Mask,
2655
2643
vti.SEW, vti.LMul,
@@ -2702,7 +2690,7 @@ multiclass VPatBinaryM_VV<string intrinsic, string instruction,
2702
2690
multiclass VPatBinaryM_VX<string intrinsic, string instruction,
2703
2691
list<VTypeInfo> vtilist> {
2704
2692
foreach vti = vtilist in {
2705
- defvar kind = getScalarSuffix< vti.Scalar>.suffix ;
2693
+ defvar kind = "V"# vti.ScalarSuffix ;
2706
2694
defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#vti.LMul.MX,
2707
2695
vti.Mask, vti.Vector, vti.Scalar, vti.Mask,
2708
2696
vti.SEW, VR,
@@ -2844,7 +2832,7 @@ multiclass VPatTernaryV_VX_AAXA<string intrinsic, string instruction,
2844
2832
list<VTypeInfo> vtilist> {
2845
2833
foreach vti = vtilist in
2846
2834
defm : VPatTernary<intrinsic, instruction,
2847
- getScalarSuffix< vti.Scalar>.suffix ,
2835
+ "V"# vti.ScalarSuffix ,
2848
2836
vti.Vector, vti.Scalar, vti.Vector, vti.Mask,
2849
2837
vti.SEW, vti.LMul, vti.RegClass,
2850
2838
vti.ScalarRegClass, vti.RegClass>;
@@ -2877,7 +2865,7 @@ multiclass VPatTernaryW_VX<string intrinsic, string instruction,
2877
2865
defvar vti = vtiToWti.Vti;
2878
2866
defvar wti = vtiToWti.Wti;
2879
2867
defm : VPatTernary<intrinsic, instruction,
2880
- getScalarSuffix< vti.Scalar>.suffix ,
2868
+ "V"# vti.ScalarSuffix ,
2881
2869
wti.Vector, vti.Scalar, vti.Vector,
2882
2870
vti.Mask, vti.SEW, vti.LMul,
2883
2871
wti.RegClass, vti.ScalarRegClass, vti.RegClass>;
@@ -3662,14 +3650,14 @@ let mayLoad = 0, mayStore = 0, hasSideEffects = 0, usesCustomInserter = 1,
3662
3650
foreach f = FPList.fpinfo in {
3663
3651
let VLMul = m.value in {
3664
3652
let HasSEWOp = 1, BaseInstr = VFMV_F_S in
3665
- def PseudoVFMV_F_S # "_ " # f.FX # "_ " # m.MX :
3653
+ def "PseudoVFMV_ " # f.FX # "_S_ " # m.MX :
3666
3654
Pseudo<(outs f.fprclass:$rd),
3667
3655
(ins m.vrclass:$rs2,
3668
3656
ixlenimm:$sew),
3669
3657
[]>, RISCVVPseudo;
3670
3658
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VFMV_S_F, WritesElement0 = 1,
3671
3659
Constraints = "$rd = $rs1" in
3672
- def PseudoVFMV_S_F # "_ " # f.FX #"_" # m.MX :
3660
+ def "PseudoVFMV_S_ " # f.FX # "_" # m.MX :
3673
3661
Pseudo<(outs m.vrclass:$rd),
3674
3662
(ins m.vrclass:$rs1, f.fprclass:$rs2,
3675
3663
GPR:$vl, ixlenimm:$sew),
@@ -4185,10 +4173,7 @@ foreach fvti = AllFloatVectors in {
4185
4173
4186
4174
def : Pat<(fvti.Vector (int_riscv_vfmv_v_f
4187
4175
(fvti.Scalar fvti.ScalarRegClass:$rs2), GPR:$vl)),
4188
- (!cast<Instruction>("PseudoVFMV_V_F_" #
4189
- !cond(!eq(fvti.Scalar, f16): "F16_",
4190
- !eq(fvti.Scalar, f32): "F32_",
4191
- !eq(fvti.Scalar, f64): "F64_") #
4176
+ (!cast<Instruction>("PseudoVFMV_V_" # fvti.ScalarSuffix # "_" #
4192
4177
fvti.LMul.MX)
4193
4178
(fvti.Scalar fvti.ScalarRegClass:$rs2),
4194
4179
(NoX0 GPR:$vl), fvti.SEW)>;
@@ -4348,20 +4333,14 @@ foreach vti = AllIntegerVectors in {
4348
4333
4349
4334
let Predicates = [HasStdExtV, HasStdExtF] in {
4350
4335
foreach fvti = AllFloatVectors in {
4351
- defvar instr = !cast<Instruction>("PseudoVFMV_F_S_" #
4352
- !cond(!eq(fvti.Scalar, f16): "F16_",
4353
- !eq(fvti.Scalar, f32): "F32_",
4354
- !eq(fvti.Scalar, f64): "F64_") #
4336
+ defvar instr = !cast<Instruction>("PseudoVFMV_"#fvti.ScalarSuffix#"_S_" #
4355
4337
fvti.LMul.MX);
4356
4338
def : Pat<(fvti.Scalar (int_riscv_vfmv_f_s (fvti.Vector fvti.RegClass:$rs2))),
4357
4339
(instr $rs2, fvti.SEW)>;
4358
4340
4359
4341
def : Pat<(fvti.Vector (int_riscv_vfmv_s_f (fvti.Vector fvti.RegClass:$rs1),
4360
4342
(fvti.Scalar fvti.ScalarRegClass:$rs2), GPR:$vl)),
4361
- (!cast<Instruction>("PseudoVFMV_S_F_" #
4362
- !cond(!eq(fvti.Scalar, f16): "F16_",
4363
- !eq(fvti.Scalar, f32): "F32_",
4364
- !eq(fvti.Scalar, f64): "F64_") #
4343
+ (!cast<Instruction>("PseudoVFMV_S_"#fvti.ScalarSuffix#"_" #
4365
4344
fvti.LMul.MX)
4366
4345
(fvti.Vector $rs1),
4367
4346
(fvti.Scalar fvti.ScalarRegClass:$rs2),
0 commit comments