[llvm] [RISCV] Split WriteVISlideX into WriteVISlideUpX and WriteVISlideDownX (PR #92605)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 14:39:52 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Min-Yih Hsu (mshockwave)
<details>
<summary>Changes</summary>
Some processors might have different latencies and/or rthroughput for slide up and down operations on integer vectors, yet there is only a single SchedWrite for both of them at this moment. This patch splits this SchedWrite into two.
Note that we only tackle the X variant (i.e. using a register value for index offset) for now.
This is effectively NFC.
---
Full diff: https://github.com/llvm/llvm-project/pull/92605.diff
5 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVInstrInfoV.td (+5-1)
- (modified) llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td (+3-1)
- (modified) llvm/lib/Target/RISCV/RISCVSchedSiFive7.td (+2-1)
- (modified) llvm/lib/Target/RISCV/RISCVSchedSiFiveP600.td (+4-2)
- (modified) llvm/lib/Target/RISCV/RISCVScheduleV.td (+4-2)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td
index e68fb42ece9f0..10cb15bbcd16d 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td
@@ -976,8 +976,12 @@ multiclass VNCLP_IV_V_X_I<string opcodestr, bits<6> funct6> {
}
multiclass VSLD_IV_X_I<string opcodestr, bits<6> funct6> {
+ // Note: In the future, if VISlideI is also splitted into VISlideUpI and
+ // VISlideDownI, it'll probably better to use two separate multiclasses.
+ defvar WriteSlideX = !if(!ge(!find(NAME, "SLIDEUP"), 0),
+ "WriteVISlideUpX", "WriteVISlideDownX");
def X : VALUVX<funct6, OPIVX, opcodestr # ".vx">,
- SchedBinaryMC<"WriteVISlideX", "ReadVISlideV", "ReadVISlideX">;
+ SchedBinaryMC<WriteSlideX, "ReadVISlideV", "ReadVISlideX">;
def I : VALUVI<funct6, opcodestr # ".vi", uimm5>,
SchedUnaryMC<"WriteVISlideI", "ReadVISlideV">;
}
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index 317a6d7d4c52f..9291efaf3aace 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -3381,10 +3381,12 @@ multiclass VPseudoVMAC_VV_VF_AAXA_RM<string Constraint = ""> {
}
multiclass VPseudoVSLD_VX_VI<Operand ImmType = simm5, string Constraint = ""> {
+ defvar WriteSlideX = !if(!ge(!find(NAME, "SLIDEUP"), 0),
+ "WriteVISlideUpX", "WriteVISlideDownX");
foreach m = MxList in {
defvar mx = m.MX;
defm "" : VPseudoVSLDV_VX<m, Constraint>,
- SchedTernary<"WriteVISlideX", "ReadVISlideV", "ReadVISlideV",
+ SchedTernary<WriteSlideX, "ReadVISlideV", "ReadVISlideV",
"ReadVISlideX", mx>;
defm "" : VPseudoVSLDV_VI<ImmType, m, Constraint>,
SchedBinary<"WriteVISlideI", "ReadVISlideV", "ReadVISlideV", mx>;
diff --git a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
index e67da839bdb87..ae4a2b65a88a4 100644
--- a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
+++ b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
@@ -937,7 +937,8 @@ foreach mx = SchedMxList in {
defvar Cycles = SiFive7GetCyclesDefault<mx>.c;
defvar IsWorstCase = SiFive7IsWorstCaseMX<mx, SchedMxList>.c;
let Latency = 4, AcquireAtCycles = [0, 1], ReleaseAtCycles = [1, !add(1, Cycles)] in {
- defm "" : LMULWriteResMX<"WriteVISlideX", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;
+ defm "" : LMULWriteResMX<"WriteVISlideUpX", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;
+ defm "" : LMULWriteResMX<"WriteVISlideDownX", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;
defm "" : LMULWriteResMX<"WriteVISlideI", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;
defm "" : LMULWriteResMX<"WriteVISlide1X", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;
defm "" : LMULWriteResMX<"WriteVFSlide1F", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;
diff --git a/llvm/lib/Target/RISCV/RISCVSchedSiFiveP600.td b/llvm/lib/Target/RISCV/RISCVSchedSiFiveP600.td
index 6ba299385f07e..bcd1f464bc066 100644
--- a/llvm/lib/Target/RISCV/RISCVSchedSiFiveP600.td
+++ b/llvm/lib/Target/RISCV/RISCVSchedSiFiveP600.td
@@ -679,7 +679,8 @@ foreach mx = SchedMxList in {
foreach mx = ["MF8", "MF4", "MF2", "M1"] in {
defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
let Latency = 2, ReleaseAtCycles = [1] in {
- defm "" : LMULWriteResMX<"WriteVISlideX", [SiFiveP600VEXQ0], mx, IsWorstCase>;
+ defm "" : LMULWriteResMX<"WriteVISlideUpX", [SiFiveP600VEXQ0], mx, IsWorstCase>;
+ defm "" : LMULWriteResMX<"WriteVISlideDownX", [SiFiveP600VEXQ0], mx, IsWorstCase>;
}
}
@@ -688,7 +689,8 @@ foreach mx = ["M8", "M4", "M2"] in {
defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
let Latency = !add(4, LMulLat), ReleaseAtCycles = [LMulLat] in {
- defm "" : LMULWriteResMX<"WriteVISlideX", [SiFiveP600VEXQ1], mx, IsWorstCase>;
+ defm "" : LMULWriteResMX<"WriteVISlideUpX", [SiFiveP600VEXQ1], mx, IsWorstCase>;
+ defm "" : LMULWriteResMX<"WriteVISlideDownX", [SiFiveP600VEXQ1], mx, IsWorstCase>;
}
}
diff --git a/llvm/lib/Target/RISCV/RISCVScheduleV.td b/llvm/lib/Target/RISCV/RISCVScheduleV.td
index 5be06d4c3f7e7..7cae1a11840aa 100644
--- a/llvm/lib/Target/RISCV/RISCVScheduleV.td
+++ b/llvm/lib/Target/RISCV/RISCVScheduleV.td
@@ -514,7 +514,8 @@ def WriteVMovXS : SchedWrite;
def WriteVMovSF : SchedWrite;
def WriteVMovFS : SchedWrite;
// 16.3. Vector Slide Instructions
-defm "" : LMULSchedWrites<"WriteVISlideX">;
+defm "" : LMULSchedWrites<"WriteVISlideUpX">;
+defm "" : LMULSchedWrites<"WriteVISlideDownX">;
defm "" : LMULSchedWrites<"WriteVISlideI">;
defm "" : LMULSchedWrites<"WriteVISlide1X">;
defm "" : LMULSchedWrites<"WriteVFSlide1F">;
@@ -949,7 +950,8 @@ def : WriteRes<WriteVMovSX, []>;
def : WriteRes<WriteVMovXS, []>;
def : WriteRes<WriteVMovSF, []>;
def : WriteRes<WriteVMovFS, []>;
-defm "" : LMULWriteRes<"WriteVISlideX", []>;
+defm "" : LMULWriteRes<"WriteVISlideUpX", []>;
+defm "" : LMULWriteRes<"WriteVISlideDownX", []>;
defm "" : LMULWriteRes<"WriteVISlideI", []>;
defm "" : LMULWriteRes<"WriteVISlide1X", []>;
defm "" : LMULWriteRes<"WriteVFSlide1F", []>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/92605
More information about the llvm-commits
mailing list