[llvm] 4a03ea1 - [RISCV][NFC] Use NFList in NFSet (#67517)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 19:39:15 PDT 2023
Author: Wang Pengcheng
Date: 2023-09-28T10:39:11+08:00
New Revision: 4a03ea1a385c953116a936516b098fc80189b254
URL: https://github.com/llvm/llvm-project/commit/4a03ea1a385c953116a936516b098fc80189b254
DIFF: https://github.com/llvm/llvm-project/commit/4a03ea1a385c953116a936516b098fc80189b254.diff
LOG: [RISCV][NFC] Use NFList in NFSet (#67517)
These two subroutines are almost the same except the LMUL encoding.
We can use `NFList` in `NFSet` to remove duplicated code.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/lib/Target/RISCV/RISCVRegisterInfo.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index b36ec6f4313afc0..445f057d61ee1dc 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -219,10 +219,8 @@ defvar FPListW = [SCALAR_F16, SCALAR_F32];
defvar BFPListW = [SCALAR_BF16];
class NFSet<LMULInfo m> {
- list<int> L = !cond(!eq(m.value, V_M8.value): [],
- !eq(m.value, V_M4.value): [2],
- !eq(m.value, V_M2.value): [2, 3, 4],
- true: [2, 3, 4, 5, 6, 7, 8]);
+ defvar lmul = !shl(1, m.value);
+ list<int> L = NFList<lmul>.L;
}
class octuple_to_str<int octuple> {
diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
index 1a6145f92908134..ab0d354967b34c7 100644
--- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
@@ -337,14 +337,15 @@ defvar LMULList = [1, 2, 4, 8];
// Utility classes for segment load/store.
//===----------------------------------------------------------------------===//
// The set of legal NF for LMUL = lmul.
-// LMUL == 1, NF = 2, 3, 4, 5, 6, 7, 8
+// LMUL <= 1, NF = 2, 3, 4, 5, 6, 7, 8
// LMUL == 2, NF = 2, 3, 4
// LMUL == 4, NF = 2
+// LMUL == 8, no legal NF
class NFList<int lmul> {
- list<int> L = !cond(!eq(lmul, 1): [2, 3, 4, 5, 6, 7, 8],
- !eq(lmul, 2): [2, 3, 4],
+ list<int> L = !cond(!eq(lmul, 8): [],
!eq(lmul, 4): [2],
- !eq(lmul, 8): []);
+ !eq(lmul, 2): [2, 3, 4],
+ true: [2, 3, 4, 5, 6, 7, 8]);
}
// Generate [start, end) SubRegIndex list.
More information about the llvm-commits
mailing list