diff --git a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td index 0b0ac0c368d07..71d8cda9d85c3 100644 --- a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td +++ b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td @@ -965,15 +965,18 @@ def : InstRW<[WriteIALU], (instrs COPY)>; // VCIX // -// In principle we don't know the latency of any VCIX instructions. But instead -// of taking the default of 1, which can lead to issues [1], we assume that they -// have a fairly high latency. +// In principle we don't know the latency of any VCIX instructions (they +// depends on a particular coprocessor implementation). However, the default +// latency of 1 can lead to issues [1]. So instead we set the latency to the +// default provided by `SiFive7GetCyclesDefault`. This is still not accurate +// and can lead to suboptimal codegen, but should hopefully be a better +// starting point. // // [1] https://github.com/llvm/llvm-project/issues/83391 foreach mx = SchedMxList in { defvar Cycles = SiFive7GetCyclesDefault.c; defvar IsWorstCase = SiFive7IsWorstCaseMX.c; - let Latency = !mul(Cycles, 10), + let Latency = Cycles, AcquireAtCycles = [0, 1], ReleaseAtCycles = [1, !add(1, Cycles)] in { defm "" : LMULWriteResMX<"WriteVC_V_I", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;