1 //===-- PPCScheduleP9.td - PPC P9 Scheduling Definitions ---*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines the itinerary class data for the POWER9 processor.
11 //===----------------------------------------------------------------------===//
12 include "PPCInstrInfo.td"
14 def P9Model : SchedMachineModel {
15 // The maximum number of instructions to be issued at the same time.
16 // While a value of 8 is technically correct since 8 instructions can be
17 // fetched from the instruction cache. However, only 6 instructions may be
18 // actually dispatched at a time.
21 // Load latency is 4 or 5 cycles depending on the load. This latency assumes
22 // that we have a cache hit. For a cache miss the load latency will be more.
23 // There are two instructions (lxvl, lxvll) that have a latencty of 6 cycles.
24 // However it is not worth bumping this value up to 6 when the vast majority
25 // of instructions are 4 or 5 cycles.
28 // A total of 16 cycles to recover from a branch mispredict.
29 let MispredictPenalty = 16;
31 // Try to make sure we have at least 10 dispatch groups in a loop.
32 // A dispatch group is 6 instructions.
33 let LoopMicroOpBufferSize = 60;
35 // As iops are dispatched to a slice, they are held in an independent slice
36 // issue queue until all register sources and other dependencies have been
37 // resolved and they can be issued. Each of four execution slices has an
38 // 11-entry iop issue queue.
39 let MicroOpBufferSize = 44;
41 let CompleteModel = 1;
43 // Do not support QPX (Quad Processing eXtension) or SPE (Signal Procesing
44 // Engine) on Power 9.
45 let UnsupportedFeatures = [HasQPX, HasSPE];
49 let SchedModel = P9Model in {
51 // ***************** Processor Resources *****************
54 def DISPATCHER : ProcResource<12>;
57 // An instruction can go down one of two issue queues.
58 // Address Generation (AGEN) mainly for loads and stores.
59 // Execution (EXEC) for most other instructions.
60 // Some instructions cannot be run on just any issue queue and may require an
61 // Even or an Odd queue. The EXECE represents the even queues and the EXECO
62 // represents the odd queues.
63 def IP_AGEN : ProcResource<4>;
64 def IP_EXEC : ProcResource<4>;
65 def IP_EXECE : ProcResource<2> {
69 def IP_EXECO : ProcResource<2> {
75 // Four ALU (Fixed Point Arithmetic) units in total. Two even, two Odd.
76 def ALU : ProcResource<4>;
77 def ALUE : ProcResource<2> {
81 def ALUO : ProcResource<2> {
86 // Two DIV (Fixed Point Divide) units.
87 def DIV : ProcResource<2>;
89 // Four DP (Floating Point) units in total. Two even, two Odd.
90 def DP : ProcResource<4>;
91 def DPE : ProcResource<2> {
95 def DPO : ProcResource<2> {
100 // Four LS (Load or Store) units.
101 def LS : ProcResource<4>;
103 // Two PM (Permute) units.
104 def PM : ProcResource<2>;
106 // Only one DFU (Decimal Floating Point and Quad Precision) unit.
107 def DFU : ProcResource<1>;
109 // Only one Branch unit.
110 def BR : ProcResource<1> {
114 // Only one CY (Crypto) unit.
115 def CY : ProcResource<1>;
117 // ***************** SchedWriteRes Definitions *****************
120 def DISP_1C : SchedWriteRes<[DISPATCHER]> {
126 def IP_AGEN_1C : SchedWriteRes<[IP_AGEN]> {
131 def IP_EXEC_1C : SchedWriteRes<[IP_EXEC]> {
136 def IP_EXECE_1C : SchedWriteRes<[IP_EXECE]> {
141 def IP_EXECO_1C : SchedWriteRes<[IP_EXECO]> {
149 // An ALU may take either 2 or 3 cycles to complete the operation.
150 // However, the ALU unit is only every busy for 1 cycle at a time and may
151 // receive new instructions each cycle.
152 def P9_ALU_2C : SchedWriteRes<[ALU]> {
156 def P9_ALUE_2C : SchedWriteRes<[ALUE]> {
160 def P9_ALUO_2C : SchedWriteRes<[ALUO]> {
164 def P9_ALU_3C : SchedWriteRes<[ALU]> {
168 def P9_ALUE_3C : SchedWriteRes<[ALUE]> {
172 def P9_ALUO_3C : SchedWriteRes<[ALUO]> {
177 // A DIV unit may take from 5 to 40 cycles to complete.
178 // Some DIV operations may keep the unit busy for up to 8 cycles.
179 def P9_DIV_5C : SchedWriteRes<[DIV]> {
183 def P9_DIV_12C : SchedWriteRes<[DIV]> {
187 def P9_DIV_16C_8 : SchedWriteRes<[DIV]> {
188 let ResourceCycles = [8];
192 def P9_DIV_24C_8 : SchedWriteRes<[DIV]> {
193 let ResourceCycles = [8];
197 def P9_DIV_40C_8 : SchedWriteRes<[DIV]> {
198 let ResourceCycles = [8];
203 // A DP unit may take from 2 to 36 cycles to complete.
204 // Some DP operations keep the unit busy for up to 10 cycles.
205 def P9_DP_2C : SchedWriteRes<[DP]> {
209 def P9_DP_5C : SchedWriteRes<[DP]> {
213 def P9_DP_7C : SchedWriteRes<[DP]> {
217 def P9_DPE_7C : SchedWriteRes<[DPE]> {
221 def P9_DPO_7C : SchedWriteRes<[DPO]> {
225 def P9_DP_22C_5 : SchedWriteRes<[DP]> {
226 let ResourceCycles = [5];
230 def P9_DP_24C_8 : SchedWriteRes<[DP]> {
231 let ResourceCycles = [8];
235 def P9_DPO_24C_8 : SchedWriteRes<[DPO]> {
236 let ResourceCycles = [8];
240 def P9_DPE_24C_8 : SchedWriteRes<[DPE]> {
241 let ResourceCycles = [8];
245 def P9_DP_26C_5 : SchedWriteRes<[DP]> {
246 let ResourceCycles = [5];
250 def P9_DP_27C_7 : SchedWriteRes<[DP]> {
251 let ResourceCycles = [7];
255 def P9_DPE_27C_10 : SchedWriteRes<[DP]> {
256 let ResourceCycles = [10];
260 def P9_DPO_27C_10 : SchedWriteRes<[DP]> {
261 let ResourceCycles = [10];
265 def P9_DP_33C_8 : SchedWriteRes<[DP]> {
266 let ResourceCycles = [8];
270 def P9_DPE_33C_8 : SchedWriteRes<[DPE]> {
271 let ResourceCycles = [8];
275 def P9_DPO_33C_8 : SchedWriteRes<[DPO]> {
276 let ResourceCycles = [8];
280 def P9_DP_36C_10 : SchedWriteRes<[DP]> {
281 let ResourceCycles = [10];
285 def P9_DPE_36C_10 : SchedWriteRes<[DP]> {
286 let ResourceCycles = [10];
290 def P9_DPO_36C_10 : SchedWriteRes<[DP]> {
291 let ResourceCycles = [10];
296 // Three cycle permute operations.
297 def P9_PM_3C : SchedWriteRes<[PM]> {
301 // Load and Store Units
302 // Loads can have 4, 5 or 6 cycles of latency.
303 // Stores are listed as having a single cycle of latency. This is not
304 // completely accurate since it takes more than 1 cycle to actually store
305 // the value. However, since the store does not produce a result it can be
306 // considered complete after one cycle.
307 def P9_LS_1C : SchedWriteRes<[LS]> {
311 def P9_LS_4C : SchedWriteRes<[LS]> {
315 def P9_LS_5C : SchedWriteRes<[LS]> {
319 def P9_LS_6C : SchedWriteRes<[LS]> {
324 // Some of the most expensive ops use the DFU.
325 // Can take from 12 cycles to 76 cycles to obtain a result.
326 // The unit may be busy for up to 62 cycles.
327 def P9_DFU_12C : SchedWriteRes<[DFU]> {
331 def P9_DFU_23C : SchedWriteRes<[DFU]> {
333 let ResourceCycles = [11];
336 def P9_DFU_24C : SchedWriteRes<[DFU]> {
338 let ResourceCycles = [12];
341 def P9_DFU_37C : SchedWriteRes<[DFU]> {
343 let ResourceCycles = [25];
346 def P9_DFU_58C : SchedWriteRes<[DFU]> {
348 let ResourceCycles = [44];
351 def P9_DFU_76C : SchedWriteRes<[DFU]> {
353 let ResourceCycles = [62];
356 // 2 or 5 cycle latencies for the branch unit.
357 def P9_BR_2C : SchedWriteRes<[BR]> {
361 def P9_BR_5C : SchedWriteRes<[BR]> {
365 // 6 cycle latency for the crypto unit
366 def P9_CY_6C : SchedWriteRes<[CY]> {
370 // ***************** WriteSeq Definitions *****************
372 // These are combinations of the resources listed above.
373 // The idea is that some cracked instructions cannot be done in parallel and
374 // so the latencies for their resources must be added.
375 def P9_LoadAndALUOp_6C : WriteSequence<[P9_LS_4C, P9_ALU_2C]>;
376 def P9_LoadAndALUOp_7C : WriteSequence<[P9_LS_5C, P9_ALU_2C]>;
377 def P9_LoadAndALU2Op_7C : WriteSequence<[P9_LS_4C, P9_ALU_3C]>;
378 def P9_LoadAndALU2Op_8C : WriteSequence<[P9_LS_5C, P9_ALU_3C]>;
379 def P9_LoadAndPMOp_8C : WriteSequence<[P9_LS_5C, P9_PM_3C]>;
380 def P9_LoadAndLoadOp_8C : WriteSequence<[P9_LS_4C, P9_LS_4C]>;
381 def P9_IntDivAndALUOp_18C_8 : WriteSequence<[P9_DIV_16C_8, P9_ALU_2C]>;
382 def P9_IntDivAndALUOp_26C_8 : WriteSequence<[P9_DIV_24C_8, P9_ALU_2C]>;
383 def P9_IntDivAndALUOp_42C_8 : WriteSequence<[P9_DIV_40C_8, P9_ALU_2C]>;
384 def P9_StoreAndALUOp_3C : WriteSequence<[P9_LS_1C, P9_ALU_2C]>;
385 def P9_StoreAndALUOp_4C : WriteSequence<[P9_LS_1C, P9_ALU_3C]>;
386 def P9_ALUOpAndALUOp_4C : WriteSequence<[P9_ALU_2C, P9_ALU_2C]>;
387 def P9_ALU2OpAndALU2Op_6C : WriteSequence<[P9_ALU_3C, P9_ALU_3C]>;
388 def P9_ALUOpAndALUOpAndALUOp_6C :
389 WriteSequence<[P9_ALU_2C, P9_ALU_2C, P9_ALU_2C]>;
390 def P9_DPOpAndALUOp_7C : WriteSequence<[P9_DP_5C, P9_ALU_2C]>;
391 def P9_DPOpAndALUOp_9C : WriteSequence<[P9_DP_7C, P9_ALU_2C]>;
392 def P9_DPOpAndALU2Op_10C : WriteSequence<[P9_DP_7C, P9_ALU_3C]>;
393 def P9_DPOpAndALUOp_24C_5 : WriteSequence<[P9_DP_22C_5, P9_ALU_2C]>;
394 def P9_DPOpAndALUOp_35C_8 : WriteSequence<[P9_DP_33C_8, P9_ALU_2C]>;
395 def P9_DPOpAndALU2Op_25C_5 : WriteSequence<[P9_DP_22C_5, P9_ALU_3C]>;
396 def P9_DPOpAndALU2Op_29C_5 : WriteSequence<[P9_DP_26C_5, P9_ALU_3C]>;
397 def P9_DPOpAndALU2Op_36C_8 : WriteSequence<[P9_DP_33C_8, P9_ALU_3C]>;
398 def P9_DPOpAndALU2Op_39C_10 : WriteSequence<[P9_DP_36C_10, P9_ALU_3C]>;
399 def P9_BROpAndALUOp_7C : WriteSequence<[P9_BR_5C, P9_ALU_2C]>;
401 // Include the resource requirements of individual instructions.
402 include "P9InstrResources.td"