[llvm] [RISCV][NFC] Use NFList in NFSet (PR #67517)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 06:15:56 PDT 2023


================
@@ -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);
----------------
michaelmaitland wrote:

For the fractional LMULs, this encoding gives:
```
>>> 1 << 0b101
32
>>> 1 << 0b110
64
>>> 1 << 0b111
128
```
`NFList` was never used with fractional LMUL in the  past. This encoding ends up working out since fractional LMUL will hit the true branch of `NFList`, but it does diverge from `RISCVII::VLMUL` encoding which caught my eye. I wanted to say something so we're aware of it, but I am not requesting a change since I think it is fine as this is an implementation detail.

https://github.com/llvm/llvm-project/pull/67517


More information about the llvm-commits mailing list