[PATCH] D135188: [RISCV][CodeGen] Add Scheduling for vset{i}vl{i} instruction
Michael Maitland via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 4 12:19:24 PDT 2022
michaelmaitland created this revision.
michaelmaitland added a reviewer: craig.topper.
Herald added subscribers: sunshaoce, VincentWu, StephenFan, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
michaelmaitland requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135188
Files:
llvm/lib/Target/RISCV/RISCVInstrInfoV.td
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/lib/Target/RISCV/RISCVScheduleV.td
Index: llvm/lib/Target/RISCV/RISCVScheduleV.td
===================================================================
--- llvm/lib/Target/RISCV/RISCVScheduleV.td
+++ llvm/lib/Target/RISCV/RISCVScheduleV.td
@@ -12,6 +12,11 @@
// 3.6 Vector Byte Length vlenb
def WriteRdVLENB : SchedWrite;
+// 6. Configuration-Setting Instructions
+def WriteVSETVLI : SchedWrite;
+def WriteVSETIVLI : SchedWrite;
+def WriteVSETVL : SchedWrite;
+
// 7. Vector Loads and Stores
// 7.4. Vector Unit-Stride Instructions
def WriteVLDE8 : SchedWrite;
@@ -272,6 +277,11 @@
//===----------------------------------------------------------------------===//
/// Define scheduler resources associated with use operands.
+// 6. Configuration-Setting Instructions
+def ReadVSETVLI : SchedRead;
+def ReadVSETIVLI : SchedRead;
+def ReadVSETVL : SchedRead;
+
// 7. Vector Loads and Stores
def ReadVLDX : SchedRead;
def ReadVSTX : SchedRead;
@@ -499,6 +509,11 @@
// 3.6 Vector Byte Length vlenb
def : WriteRes<WriteRdVLENB, []>;
+// 6. Configuration-Setting Instructions
+def : WriteRes<WriteVSETVLI, []>;
+def : WriteRes<WriteVSETIVLI, []>;
+def : WriteRes<WriteVSETVL, []>;
+
// 7. Vector Loads and Stores
def : WriteRes<WriteVLDE8, []>;
def : WriteRes<WriteVLDE16, []>;
@@ -693,6 +708,11 @@
def : WriteRes<WriteVMov4V, []>;
def : WriteRes<WriteVMov8V, []>;
+// 6. Configuration-Setting Instructions
+def : ReadAdvance<ReadVSETVLI, 2>;
+def : ReadAdvance<ReadVSETIVLI, 0>;
+def : ReadAdvance<ReadVSETVL, 2>;
+
// 7. Vector Loads and Stores
def : ReadAdvance<ReadVLDX, 0>;
def : ReadAdvance<ReadVSTX, 0>;
Index: llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -4445,9 +4445,12 @@
// the when we aren't using one of the special X0 encodings. Otherwise it could
// be accidentally be made X0 by MachineIR optimizations. To satisfy the
// verifier, we also need a GPRX0 instruction for the special encodings.
-def PseudoVSETVLI : Pseudo<(outs GPR:$rd), (ins GPRNoX0:$rs1, VTypeIOp11:$vtypei), []>;
-def PseudoVSETVLIX0 : Pseudo<(outs GPR:$rd), (ins GPRX0:$rs1, VTypeIOp11:$vtypei), []>;
-def PseudoVSETIVLI : Pseudo<(outs GPR:$rd), (ins uimm5:$rs1, VTypeIOp10:$vtypei), []>;
+def PseudoVSETVLI : Pseudo<(outs GPR:$rd), (ins GPRNoX0:$rs1, VTypeIOp11:$vtypei), []>,
+ Sched<[WriteVSETVLI, ReadVSETVLI]>;
+def PseudoVSETVLIX0 : Pseudo<(outs GPR:$rd), (ins GPRX0:$rs1, VTypeIOp11:$vtypei), []>,
+ Sched<[WriteVSETVLI, ReadVSETVLI]>;
+def PseudoVSETIVLI : Pseudo<(outs GPR:$rd), (ins uimm5:$rs1, VTypeIOp10:$vtypei), []>,
+ Sched<[WriteVSETIVLI, ReadVSETIVLI]>;
}
//===----------------------------------------------------------------------===//
Index: llvm/lib/Target/RISCV/RISCVInstrInfoV.td
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfoV.td
+++ llvm/lib/Target/RISCV/RISCVInstrInfoV.td
@@ -839,13 +839,15 @@
let Predicates = [HasVInstructions] in {
let hasSideEffects = 1, mayLoad = 0, mayStore = 0 in {
def VSETVLI : RVInstSetVLi<(outs GPR:$rd), (ins GPR:$rs1, VTypeIOp11:$vtypei),
- "vsetvli", "$rd, $rs1, $vtypei">;
-
+ "vsetvli", "$rd, $rs1, $vtypei">,
+ Sched<[WriteVSETVLI, ReadVSETVLI]>;
def VSETIVLI : RVInstSetiVLi<(outs GPR:$rd), (ins uimm5:$uimm, VTypeIOp10:$vtypei),
- "vsetivli", "$rd, $uimm, $vtypei">;
+ "vsetivli", "$rd, $uimm, $vtypei">,
+ Sched<[WriteVSETIVLI]>;
def VSETVL : RVInstSetVL<(outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2),
- "vsetvl", "$rd, $rs1, $rs2">;
+ "vsetvl", "$rd, $rs1, $rs2">,
+ Sched<[WriteVSETVL, ReadVSETVL, ReadVSETVL]>;
} // hasSideEffects = 1, mayLoad = 0, mayStore = 0
foreach eew = [8, 16, 32] in {
defvar w = !cast<RISCVWidth>("LSWidth" # eew);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135188.465113.patch
Type: text/x-patch
Size: 4186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221004/fb8526e2/attachment.bin>
More information about the llvm-commits
mailing list