Skip to content

Commit 4a03ea1

Browse files
authored
[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.
1 parent f9558c6 commit 4a03ea1

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,8 @@ defvar FPListW = [SCALAR_F16, SCALAR_F32];
219219
defvar BFPListW = [SCALAR_BF16];
220220

221221
class NFSet<LMULInfo m> {
222-
list<int> L = !cond(!eq(m.value, V_M8.value): [],
223-
!eq(m.value, V_M4.value): [2],
224-
!eq(m.value, V_M2.value): [2, 3, 4],
225-
true: [2, 3, 4, 5, 6, 7, 8]);
222+
defvar lmul = !shl(1, m.value);
223+
list<int> L = NFList<lmul>.L;
226224
}
227225

228226
class octuple_to_str<int octuple> {

llvm/lib/Target/RISCV/RISCVRegisterInfo.td

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,15 @@ defvar LMULList = [1, 2, 4, 8];
337337
// Utility classes for segment load/store.
338338
//===----------------------------------------------------------------------===//
339339
// The set of legal NF for LMUL = lmul.
340-
// LMUL == 1, NF = 2, 3, 4, 5, 6, 7, 8
340+
// LMUL <= 1, NF = 2, 3, 4, 5, 6, 7, 8
341341
// LMUL == 2, NF = 2, 3, 4
342342
// LMUL == 4, NF = 2
343+
// LMUL == 8, no legal NF
343344
class NFList<int lmul> {
344-
list<int> L = !cond(!eq(lmul, 1): [2, 3, 4, 5, 6, 7, 8],
345-
!eq(lmul, 2): [2, 3, 4],
345+
list<int> L = !cond(!eq(lmul, 8): [],
346346
!eq(lmul, 4): [2],
347-
!eq(lmul, 8): []);
347+
!eq(lmul, 2): [2, 3, 4],
348+
true: [2, 3, 4, 5, 6, 7, 8]);
348349
}
349350

350351
// Generate [start, end) SubRegIndex list.

0 commit comments

Comments
 (0)