1 //===-- PPCScheduleP9.td - PPC P9 Scheduling Definitions ---*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the itinerary class data for the POWER9 processor.
12 //===----------------------------------------------------------------------===//
13 include "PPCInstrInfo.td"
15 def P9Model : SchedMachineModel {
16 // The maximum number of instructions to be issued at the same time.
17 // While a value of 8 is technically correct since 8 instructions can be
18 // fetched from the instruction cache. However, only 6 instructions may be
19 // actually dispatched at a time.
22 // Load latency is 4 or 5 cycles depending on the load. This latency assumes
23 // that we have a cache hit. For a cache miss the load latency will be more.
24 // There are two instructions (lxvl, lxvll) that have a latencty of 6 cycles.
25 // However it is not worth bumping this value up to 6 when the vast majority
26 // of instructions are 4 or 5 cycles.
29 // A total of 16 cycles to recover from a branch mispredict.
30 let MispredictPenalty = 16;
32 // Try to make sure we have at least 10 dispatch groups in a loop.
33 // A dispatch group is 6 instructions.
34 let LoopMicroOpBufferSize = 60;
36 let CompleteModel = 1;
38 // Do not support QPX (Quad Processing eXtension) or SPE (Signal Procesing
39 // Engine) on Power 9.
40 let UnsupportedFeatures = [HasQPX, HasSPE];
44 let SchedModel = P9Model in {
46 // ***************** Processor Resources *****************
49 def DISPATCHER : ProcResource<12>;
52 // An instruction can go down one of two issue queues.
53 // Address Generation (AGEN) mainly for loads and stores.
54 // Execution (EXEC) for most other instructions.
55 // Some instructions cannot be run on just any issue queue and may require an
56 // Even or an Odd queue. The EXECE represents the even queues and the EXECO
57 // represents the odd queues.
58 def IP_AGEN : ProcResource<4>;
59 def IP_EXEC : ProcResource<4>;
60 def IP_EXECE : ProcResource<2> {
64 def IP_EXECO : ProcResource<2> {
70 // Four ALU (Fixed Point Arithmetic) units in total. Two even, two Odd.
71 def ALU : ProcResource<4>;
72 def ALUE : ProcResource<2> {
76 def ALUO : ProcResource<2> {
81 // Two DIV (Fixed Point Divide) units.
82 def DIV : ProcResource<2>;
84 // Four DP (Floating Point) units in total. Two even, two Odd.
85 def DP : ProcResource<4>;
86 def DPE : ProcResource<2> {
90 def DPO : ProcResource<2> {
95 // Four LS (Load or Store) units.
96 def LS : ProcResource<4>;
98 // Two PM (Permute) units.
99 def PM : ProcResource<2>;
101 // Only one DFU (Decimal Floating Point and Quad Precision) unit.
102 def DFU : ProcResource<1>;
104 // Only one Branch unit.
105 def BR : ProcResource<1> {
109 // Only one CY (Crypto) unit.
110 def CY : ProcResource<1>;
112 // ***************** SchedWriteRes Definitions *****************
115 def DISP_1C : SchedWriteRes<[DISPATCHER]> {
121 def IP_AGEN_1C : SchedWriteRes<[IP_AGEN]> {
126 def IP_EXEC_1C : SchedWriteRes<[IP_EXEC]> {
131 def IP_EXECE_1C : SchedWriteRes<[IP_EXECE]> {
136 def IP_EXECO_1C : SchedWriteRes<[IP_EXECO]> {
144 // An ALU may take either 2 or 3 cycles to complete the operation.
145 // However, the ALU unit is only every busy for 1 cycle at a time and may
146 // receive new instructions each cycle.
147 def P9_ALU_2C : SchedWriteRes<[ALU]> {
151 def P9_ALUE_2C : SchedWriteRes<[ALUE]> {
155 def P9_ALUO_2C : SchedWriteRes<[ALUO]> {
159 def P9_ALU_3C : SchedWriteRes<[ALU]> {
163 def P9_ALUE_3C : SchedWriteRes<[ALUE]> {
167 def P9_ALUO_3C : SchedWriteRes<[ALUO]> {
172 // A DIV unit may take from 5 to 40 cycles to complete.
173 // Some DIV operations may keep the unit busy for up to 8 cycles.
174 def P9_DIV_5C : SchedWriteRes<[DIV]> {
178 def P9_DIV_12C : SchedWriteRes<[DIV]> {
182 def P9_DIV_16C_8 : SchedWriteRes<[DIV]> {
183 let ResourceCycles = [8];
187 def P9_DIV_24C_8 : SchedWriteRes<[DIV]> {
188 let ResourceCycles = [8];
192 def P9_DIV_40C_8 : SchedWriteRes<[DIV]> {
193 let ResourceCycles = [8];
198 // A DP unit may take from 2 to 36 cycles to complete.
199 // Some DP operations keep the unit busy for up to 10 cycles.
200 def P9_DP_2C : SchedWriteRes<[DP]> {
204 def P9_DP_5C : SchedWriteRes<[DP]> {
208 def P9_DP_7C : SchedWriteRes<[DP]> {
212 def P9_DPE_7C : SchedWriteRes<[DPE]> {
216 def P9_DPO_7C : SchedWriteRes<[DPO]> {
220 def P9_DP_22C_5 : SchedWriteRes<[DP]> {
221 let ResourceCycles = [5];
225 def P9_DP_24C_8 : SchedWriteRes<[DP]> {
226 let ResourceCycles = [8];
230 def P9_DPO_24C_8 : SchedWriteRes<[DPO]> {
231 let ResourceCycles = [8];
235 def P9_DPE_24C_8 : SchedWriteRes<[DPE]> {
236 let ResourceCycles = [8];
240 def P9_DP_26C_5 : SchedWriteRes<[DP]> {
241 let ResourceCycles = [5];
245 def P9_DP_27C_7 : SchedWriteRes<[DP]> {
246 let ResourceCycles = [7];
250 def P9_DPE_27C_10 : SchedWriteRes<[DP]> {
251 let ResourceCycles = [10];
255 def P9_DPO_27C_10 : SchedWriteRes<[DP]> {
256 let ResourceCycles = [10];
260 def P9_DP_33C_8 : SchedWriteRes<[DP]> {
261 let ResourceCycles = [8];
265 def P9_DPE_33C_8 : SchedWriteRes<[DPE]> {
266 let ResourceCycles = [8];
270 def P9_DPO_33C_8 : SchedWriteRes<[DPO]> {
271 let ResourceCycles = [8];
275 def P9_DP_36C_10 : SchedWriteRes<[DP]> {
276 let ResourceCycles = [10];
280 def P9_DPE_36C_10 : SchedWriteRes<[DP]> {
281 let ResourceCycles = [10];
285 def P9_DPO_36C_10 : SchedWriteRes<[DP]> {
286 let ResourceCycles = [10];
291 // Three cycle permute operations.
292 def P9_PM_3C : SchedWriteRes<[PM]> {
296 // Load and Store Units
297 // Loads can have 4, 5 or 6 cycles of latency.
298 // Stores are listed as having a single cycle of latency. This is not
299 // completely accurate since it takes more than 1 cycle to actually store
300 // the value. However, since the store does not produce a result it can be
301 // considered complete after one cycle.
302 def P9_LS_1C : SchedWriteRes<[LS]> {
306 def P9_LS_4C : SchedWriteRes<[LS]> {
310 def P9_LS_5C : SchedWriteRes<[LS]> {
314 def P9_LS_6C : SchedWriteRes<[LS]> {
319 // Some of the most expensive ops use the DFU.
320 // Can take from 12 cycles to 76 cycles to obtain a result.
321 // The unit may be busy for up to 62 cycles.
322 def P9_DFU_12C : SchedWriteRes<[DFU]> {
326 def P9_DFU_23C : SchedWriteRes<[DFU]> {
328 let ResourceCycles = [11];
331 def P9_DFU_24C : SchedWriteRes<[DFU]> {
333 let ResourceCycles = [12];
336 def P9_DFU_37C : SchedWriteRes<[DFU]> {
338 let ResourceCycles = [25];
341 def P9_DFU_58C : SchedWriteRes<[DFU]> {
343 let ResourceCycles = [44];
346 def P9_DFU_76C : SchedWriteRes<[DFU]> {
348 let ResourceCycles = [62];
351 // 2 or 5 cycle latencies for the branch unit.
352 def P9_BR_2C : SchedWriteRes<[BR]> {
356 def P9_BR_5C : SchedWriteRes<[BR]> {
360 // 6 cycle latency for the crypto unit
361 def P9_CY_6C : SchedWriteRes<[CY]> {
365 // ***************** WriteSeq Definitions *****************
367 // These are combinations of the resources listed above.
368 // The idea is that some cracked instructions cannot be done in parallel and
369 // so the latencies for their resources must be added.
370 def P9_LoadAndALUOp_6C : WriteSequence<[P9_LS_4C, P9_ALU_2C]>;
371 def P9_LoadAndALUOp_7C : WriteSequence<[P9_LS_5C, P9_ALU_2C]>;
372 def P9_LoadAndALU2Op_7C : WriteSequence<[P9_LS_4C, P9_ALU_3C]>;
373 def P9_LoadAndALU2Op_8C : WriteSequence<[P9_LS_5C, P9_ALU_3C]>;
374 def P9_LoadAndPMOp_8C : WriteSequence<[P9_LS_5C, P9_PM_3C]>;
375 def P9_LoadAndLoadOp_8C : WriteSequence<[P9_LS_4C, P9_LS_4C]>;
376 def P9_IntDivAndALUOp_18C_8 : WriteSequence<[P9_DIV_16C_8, P9_ALU_2C]>;
377 def P9_IntDivAndALUOp_26C_8 : WriteSequence<[P9_DIV_24C_8, P9_ALU_2C]>;
378 def P9_IntDivAndALUOp_42C_8 : WriteSequence<[P9_DIV_40C_8, P9_ALU_2C]>;
379 def P9_StoreAndALUOp_3C : WriteSequence<[P9_LS_1C, P9_ALU_2C]>;
380 def P9_StoreAndALUOp_4C : WriteSequence<[P9_LS_1C, P9_ALU_3C]>;
381 def P9_ALUOpAndALUOp_4C : WriteSequence<[P9_ALU_2C, P9_ALU_2C]>;
382 def P9_ALU2OpAndALU2Op_6C : WriteSequence<[P9_ALU_3C, P9_ALU_3C]>;
383 def P9_ALUOpAndALUOpAndALUOp_6C :
384 WriteSequence<[P9_ALU_2C, P9_ALU_2C, P9_ALU_2C]>;
385 def P9_DPOpAndALUOp_7C : WriteSequence<[P9_DP_5C, P9_ALU_2C]>;
386 def P9_DPOpAndALUOp_9C : WriteSequence<[P9_DP_7C, P9_ALU_2C]>;
387 def P9_DPOpAndALU2Op_10C : WriteSequence<[P9_DP_7C, P9_ALU_3C]>;
388 def P9_DPOpAndALUOp_24C_5 : WriteSequence<[P9_DP_22C_5, P9_ALU_2C]>;
389 def P9_DPOpAndALUOp_35C_8 : WriteSequence<[P9_DP_33C_8, P9_ALU_2C]>;
390 def P9_DPOpAndALU2Op_25C_5 : WriteSequence<[P9_DP_22C_5, P9_ALU_3C]>;
391 def P9_DPOpAndALU2Op_29C_5 : WriteSequence<[P9_DP_26C_5, P9_ALU_3C]>;
392 def P9_DPOpAndALU2Op_36C_8 : WriteSequence<[P9_DP_33C_8, P9_ALU_3C]>;
393 def P9_DPOpAndALU2Op_39C_10 : WriteSequence<[P9_DP_36C_10, P9_ALU_3C]>;
394 def P9_BROpAndALUOp_7C : WriteSequence<[P9_BR_5C, P9_ALU_2C]>;
396 // Include the resource requirements of individual instructions.
397 include "P9InstrResources.td"