[llvm] 7282a37 - [RISCV] Don't iterate SEW set again for floating-point
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 11 21:07:01 PDT 2023
Author: wangpc
Date: 2023-06-12T12:06:41+08:00
New Revision: 7282a37ff194885ef4aad0a68ad54011d43466b4
URL: https://github.com/llvm/llvm-project/commit/7282a37ff194885ef4aad0a68ad54011d43466b4
DIFF: https://github.com/llvm/llvm-project/commit/7282a37ff194885ef4aad0a68ad54011d43466b4.diff
LOG: [RISCV] Don't iterate SEW set again for floating-point
We have already iterated over `FPList`, so there is no need to get
and loop over SEW set again. Or we will generate some useless pseudo
instructions like `PseudoXXX_VF16_M1_E64`.
We add SEW to FPR_Info so that we can get it later. And we rewrite
FPR_Info to reduce arguments incidentally.
This should reduce the size of files generated by TableGen.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152524
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index 7310565fdf808..f8d17ace142e9 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -140,17 +140,17 @@ class MxSet<int eew> {
!eq(eew, 64) : [V_M1, V_M2, V_M4, V_M8]);
}
-class FPR_Info<RegisterClass regclass, string fx, list<LMULInfo> mxlist,
- list<LMULInfo> mxlistfw> {
- RegisterClass fprclass = regclass;
- string FX = fx;
- list<LMULInfo> MxList = mxlist;
- list<LMULInfo> MxListFW = mxlistfw;
+class FPR_Info<int sew> {
+ RegisterClass fprclass = !cast<RegisterClass>("FPR" # sew);
+ string FX = "F" # sew;
+ int SEW = sew;
+ list<LMULInfo> MxList = MxSet<sew>.m;
+ list<LMULInfo> MxListFW = !if(!eq(sew, 64), [], !listremove(MxList, [V_M8]));
}
-def SCALAR_F16 : FPR_Info<FPR16, "F16", MxSet<16>.m, [V_MF4, V_MF2, V_M1, V_M2, V_M4]>;
-def SCALAR_F32 : FPR_Info<FPR32, "F32", MxSet<32>.m, [V_MF2, V_M1, V_M2, V_M4]>;
-def SCALAR_F64 : FPR_Info<FPR64, "F64", MxSet<64>.m, []>;
+def SCALAR_F16 : FPR_Info<16>;
+def SCALAR_F32 : FPR_Info<32>;
+def SCALAR_F64 : FPR_Info<64>;
defvar FPList = [SCALAR_F16, SCALAR_F32, SCALAR_F64];
@@ -2677,15 +2677,12 @@ multiclass VPseudoVFDIV_VV_VF {
foreach f = FPList in {
foreach m = f.MxList in {
defvar mx = m.MX;
- defvar sews = SchedSEWSet<mx, /*isF*/ 1>.val;
- foreach e = sews in {
- defvar WriteVFDivF_MX_E = !cast<SchedWrite>("WriteVFDivF_" # mx # "_E" # e);
- defvar ReadVFDivV_MX_E = !cast<SchedRead>("ReadVFDivV_" # mx # "_E" # e);
- defvar ReadVFDivF_MX_E = !cast<SchedRead>("ReadVFDivF_" # mx # "_E" # e);
+ defvar WriteVFDivF_MX_E = !cast<SchedWrite>("WriteVFDivF_" # mx # "_E" # f.SEW);
+ defvar ReadVFDivV_MX_E = !cast<SchedRead>("ReadVFDivV_" # mx # "_E" # f.SEW);
+ defvar ReadVFDivF_MX_E = !cast<SchedRead>("ReadVFDivF_" # mx # "_E" # f.SEW);
- defm "" : VPseudoBinaryV_VF<m, f, "", e>,
- Sched<[WriteVFDivF_MX_E, ReadVFDivV_MX_E, ReadVFDivF_MX_E, ReadVMask]>;
- }
+ defm "" : VPseudoBinaryV_VF<m, f, "", f.SEW>,
+ Sched<[WriteVFDivF_MX_E, ReadVFDivV_MX_E, ReadVFDivF_MX_E, ReadVMask]>;
}
}
}
@@ -2694,15 +2691,12 @@ multiclass VPseudoVFRDIV_VF {
foreach f = FPList in {
foreach m = f.MxList in {
defvar mx = m.MX;
- defvar sews = SchedSEWSet<mx, /*isF*/ 1>.val;
- foreach e = sews in {
- defvar WriteVFDivF_MX_E = !cast<SchedWrite>("WriteVFDivF_" # mx # "_E" # e);
- defvar ReadVFDivV_MX_E = !cast<SchedRead>("ReadVFDivV_" # mx # "_E" # e);
- defvar ReadVFDivF_MX_E = !cast<SchedRead>("ReadVFDivF_" # mx # "_E" # e);
+ defvar WriteVFDivF_MX_E = !cast<SchedWrite>("WriteVFDivF_" # mx # "_E" # f.SEW);
+ defvar ReadVFDivV_MX_E = !cast<SchedRead>("ReadVFDivV_" # mx # "_E" # f.SEW);
+ defvar ReadVFDivF_MX_E = !cast<SchedRead>("ReadVFDivF_" # mx # "_E" # f.SEW);
- defm "" : VPseudoBinaryV_VF<m, f, "", e>,
- Sched<[WriteVFDivF_MX_E, ReadVFDivV_MX_E, ReadVFDivF_MX_E, ReadVMask]>;
- }
+ defm "" : VPseudoBinaryV_VF<m, f, "", f.SEW>,
+ Sched<[WriteVFDivF_MX_E, ReadVFDivV_MX_E, ReadVFDivF_MX_E, ReadVMask]>;
}
}
}
More information about the llvm-commits
mailing list