Skip to content

Commit 54d891a

Browse files
author
Bin Cheng
committed
[RISCV]: Fix typo by abstracting VWholeLoad* classes
This patch abstracts VWholeLoad* classes into VWholeLoadN, simplifies existing code as well as fixes a typo. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D109319
1 parent d488f1f commit 54d891a

File tree

1 file changed

+12
-46
lines changed

1 file changed

+12
-46
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoV.td

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -784,48 +784,14 @@ multiclass VAMO<RISCVAMOOP amoop, RISCVWidth width, string opcodestr> {
784784
def _UNWD : VAMONoWd<amoop, width, opcodestr>;
785785
}
786786

787-
multiclass VWholeLoad1<string opcodestr, RegisterClass VRC> {
788-
def E8_V : VWholeLoad<0, LSWidth8, opcodestr # "e8.v", VRC>,
789-
Sched<[WriteVLD1R8, ReadVLDX]>;
790-
def E16_V : VWholeLoad<0, LSWidth16, opcodestr # "e16.v", VRC>,
791-
Sched<[WriteVLD1R16, ReadVLDX]>;
792-
def E32_V : VWholeLoad<0, LSWidth32, opcodestr # "e32.v", VRC>,
793-
Sched<[WriteVLD1R32, ReadVLDX]>;
794-
def E64_V : VWholeLoad<0, LSWidth64, opcodestr # "e64.v", VRC>,
795-
Sched<[WriteVLD1R64, ReadVLDX]>;
796-
}
797-
798-
multiclass VWholeLoad2<string opcodestr, RegisterClass VRC> {
799-
def E8_V : VWholeLoad<1, LSWidth8, opcodestr # "e8.v", VRC>,
800-
Sched<[WriteVLD2R8, ReadVLDX]>;
801-
def E16_V : VWholeLoad<1, LSWidth16, opcodestr # "e16.v", VRC>,
802-
Sched<[WriteVLD2R16, ReadVLDX]>;
803-
def E32_V : VWholeLoad<1, LSWidth32, opcodestr # "e32.v", VRC>,
804-
Sched<[WriteVLD2R32, ReadVLDX]>;
805-
def E64_V : VWholeLoad<1, LSWidth64, opcodestr # "e64.v", VRC>,
806-
Sched<[WriteVLD2R64, ReadVLDX]>;
807-
}
808-
809-
multiclass VWholeLoad4<string opcodestr, RegisterClass VRC> {
810-
def E8_V : VWholeLoad<3, LSWidth8, opcodestr # "e8.v", VRC>,
811-
Sched<[WriteVLD4R8, ReadVLDX]>;
812-
def E16_V : VWholeLoad<3, LSWidth16, opcodestr # "e16.v", VRC>,
813-
Sched<[WriteVLD4R16, ReadVLDX]>;
814-
def E32_V : VWholeLoad<3, LSWidth32, opcodestr # "e32.v", VRC>,
815-
Sched<[WriteVLD4R32, ReadVLDX]>;
816-
def E64_V : VWholeLoad<3, LSWidth64, opcodestr # "e64.v", VRC>,
817-
Sched<[WriteVLD1R64, ReadVLDX]>;
818-
}
819-
820-
multiclass VWholeLoad8<string opcodestr, RegisterClass VRC> {
821-
def E8_V : VWholeLoad<7, LSWidth8, opcodestr # "e8.v", VRC>,
822-
Sched<[WriteVLD8R8, ReadVLDX]>;
823-
def E16_V : VWholeLoad<7, LSWidth16, opcodestr # "e16.v", VRC>,
824-
Sched<[WriteVLD8R16, ReadVLDX]>;
825-
def E32_V : VWholeLoad<7, LSWidth32, opcodestr # "e32.v", VRC>,
826-
Sched<[WriteVLD8R32, ReadVLDX]>;
827-
def E64_V : VWholeLoad<7, LSWidth64, opcodestr # "e64.v", VRC>,
828-
Sched<[WriteVLD8R64, ReadVLDX]>;
787+
multiclass VWholeLoadN<bits<3> nf, string opcodestr, RegisterClass VRC> {
788+
foreach l = [8, 16, 32, 64] in {
789+
defvar w = !cast<RISCVWidth>("LSWidth" # l);
790+
defvar s = !cast<SchedWrite>("WriteVLD" # !add(nf, 1) # "R" # l);
791+
792+
def E # l # _V : VWholeLoad<nf, w, opcodestr # "e" # l # ".v", VRC>,
793+
Sched<[s, ReadVLDX]>;
794+
}
829795
}
830796

831797
//===----------------------------------------------------------------------===//
@@ -920,10 +886,10 @@ def VSOXEI # n # _V :
920886
VSXSched<n, "O">;
921887
}
922888

923-
defm VL1R : VWholeLoad1<"vl1r", VR>;
924-
defm VL2R : VWholeLoad2<"vl2r", VRM2>;
925-
defm VL4R : VWholeLoad4<"vl4r", VRM4>;
926-
defm VL8R : VWholeLoad8<"vl8r", VRM8>;
889+
defm VL1R : VWholeLoadN<0, "vl1r", VR>;
890+
defm VL2R : VWholeLoadN<1, "vl2r", VRM2>;
891+
defm VL4R : VWholeLoadN<3, "vl4r", VRM4>;
892+
defm VL8R : VWholeLoadN<7, "vl8r", VRM8>;
927893

928894
def : InstAlias<"vl1r.v $vd, (${rs1})", (VL1RE8_V VR:$vd, GPR:$rs1)>;
929895
def : InstAlias<"vl2r.v $vd, (${rs1})", (VL2RE8_V VRM2:$vd, GPR:$rs1)>;

0 commit comments

Comments
 (0)