//==- RISCVSchedRocket32.td - Rocket Scheduling Definitions -*- tablegen -*-=// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // ===---------------------------------------------------------------------===// // The following definitions describe the simpler per-operand machine model. // This works with MachineScheduler. See MCSchedule.h for details. // Rocket machine model for scheduling and other instruction cost heuristics. def Rocket32Model : SchedMachineModel { let MicroOpBufferSize = 0; // Explicitly set to zero since Rocket is in-order. let IssueWidth = 1; // 1 micro-ops are dispatched per cycle. let LoadLatency = 3; let MispredictPenalty = 3; let CompleteModel = 1; } //===----------------------------------------------------------------------===// // Define each kind of processor resource and number available. // Modeling each pipeline as a ProcResource using the BufferSize = 0 since // Rocket is in-order. let BufferSize = 0 in { def Rocket32UnitALU : ProcResource<1>; // Int ALU def Rocket32UnitIMul : ProcResource<1>; // Int Multiply def Rocket32UnitMem : ProcResource<1>; // Load/Store def Rocket32UnitB : ProcResource<1>; // Branch def Rocket32UnitFPALU : ProcResource<1>; // FP ALU } let BufferSize = 1 in { def Rocket32UnitIDiv : ProcResource<1>; // Int Division def Rocket32UnitFPDivSqrt : ProcResource<1>; // FP Divide/Sqrt' } //===----------------------------------------------------------------------===// // Subtarget-specific SchedWrite types which both map the ProcResources and // set the latency. let SchedModel = Rocket32Model in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; // Multiplies on Rocket differ by implementation; placeholder until // we can determine how to read from command line def : WriteRes { let Latency = 4; } // 32-bit divides have worse case latency of 34 cycle def : WriteRes { let Latency = 34; let ResourceCycles = [34]; } // Memory def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; let Latency = 3 in { def : WriteRes; def : WriteRes; def : WriteRes; } let Latency = 2 in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } def : WriteRes; // Most FP single precision operations are 4 cycles def : WriteRes { let Latency = 4; } // Most FP double precision operations are 6 cycles def : WriteRes { let Latency = 6; } let Latency = 2 in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } let Latency = 5 in { def : WriteRes; def : WriteRes; def : WriteRes; } let Latency = 7 in { def : WriteRes; def : WriteRes; def : WriteRes; } // FP Divide unit on Rocket is not pipelined, so set resource cycles to latency let Latency = 20, ResourceCycles = [20] in { def : WriteRes; def : WriteRes; } // FP Sqrt unit on Rocket is not pipelined, so set resource cycles to latency def : WriteRes { let Latency = 20; let ResourceCycles = [20];} def : WriteRes { let Latency = 25; let ResourceCycles = [25];} def : WriteRes; def : InstRW<[WriteIALU], (instrs COPY)>; let Unsupported = 1 in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } //===----------------------------------------------------------------------===// // Subtarget-specific SchedRead types with cycles. // Dummy definitions for RocketCore. def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; }