Skip to content

Commit 002ba17

Browse files
authored
[RISCV][MC] Name the vector tuple registers. NFC (llvm#102726)
Currently vector tuple registers don't have the specified names, the default name is, for example: `VRN3M2` -> `V8M2_V10M2_V12M2`, however it's equivalent to `v8` in the assembly.
1 parent f3d2609 commit 002ba17

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

llvm/lib/Target/RISCV/RISCVRegisterInfo.td

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,12 @@ class IndexSet<int tuple_index, int nf, int lmul, bit isV0 = false> {
423423

424424
// This class returns a list of vector register collections.
425425
// For example, for NF = 2 and LMUL = 4,
426-
// it will return
426+
// L would be:
427427
// ([ V8M4, V12M4, V16M4, V20M4, V24M4, V4M4],
428428
// [V12M4, V16M4, V20M4, V24M4, V28M4, V8M4])
429-
//
429+
// Names are the starting register of each register list,
430+
// in this example:
431+
// ["v8", "v12", "v16", "v20", "v24", "v4"]
430432
class VRegList<list<dag> LIn, int start, int nf, int lmul, bit isV0> {
431433
list<dag> L =
432434
!if(!ge(start, nf),
@@ -440,6 +442,9 @@ class VRegList<list<dag> LIn, int start, int nf, int lmul, bit isV0> {
440442
!listsplat("",
441443
!size(IndexSet<start, nf, lmul, isV0>.R)))],
442444
VRegList<LIn, !add(start, 1), nf, lmul, isV0>.L));
445+
list<string> Names =
446+
!if(!ge(start, nf), [],
447+
!foreach(i, IndexSet<start, nf, lmul, isV0>.R, "v" # i));
443448
}
444449

445450
// Vector registers
@@ -491,12 +496,16 @@ def VCSR : RISCVRegisterClass<[XLenVT], 32,
491496

492497
foreach m = [1, 2, 4] in {
493498
foreach n = NFList<m>.L in {
499+
defvar RegListWOV0 = VRegList<[], 0, n, m, false>;
500+
defvar RegListWV0 = VRegList<[], 0, n, m, true>;
494501
def "VN" # n # "M" # m # "NoV0": RegisterTuples<
495502
SubRegSet<n, m>.L,
496-
VRegList<[], 0, n, m, false>.L>;
503+
RegListWOV0.L,
504+
RegListWOV0.Names>;
497505
def "VN" # n # "M" # m # "V0" : RegisterTuples<
498506
SubRegSet<n, m>.L,
499-
VRegList<[], 0, n, m, true>.L>;
507+
RegListWV0.L,
508+
RegListWV0.Names>;
500509
}
501510
}
502511

0 commit comments

Comments
 (0)