PPCScheduleP9.td 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. //===-- PPCScheduleP9.td - PPC P9 Scheduling Definitions ---*- tablegen -*-===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines the itinerary class data for the POWER9 processor.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. def P9Model : SchedMachineModel {
  13. // The maximum number of instructions to be issued at the same time.
  14. // While a value of 8 is technically correct since 8 instructions can be
  15. // fetched from the instruction cache. However, only 6 instructions may be
  16. // actually dispatched at a time.
  17. let IssueWidth = 8;
  18. // Load latency is 4 or 5 cycles depending on the load. This latency assumes
  19. // that we have a cache hit. For a cache miss the load latency will be more.
  20. // There are two instructions (lxvl, lxvll) that have a latency of 6 cycles.
  21. // However it is not worth bumping this value up to 6 when the vast majority
  22. // of instructions are 4 or 5 cycles.
  23. let LoadLatency = 5;
  24. // A total of 16 cycles to recover from a branch mispredict.
  25. let MispredictPenalty = 16;
  26. // Try to make sure we have at least 10 dispatch groups in a loop.
  27. // A dispatch group is 6 instructions.
  28. let LoopMicroOpBufferSize = 60;
  29. // As iops are dispatched to a slice, they are held in an independent slice
  30. // issue queue until all register sources and other dependencies have been
  31. // resolved and they can be issued. Each of four execution slices has an
  32. // 11-entry iop issue queue.
  33. let MicroOpBufferSize = 44;
  34. let CompleteModel = 1;
  35. // Do not support SPE (Signal Processing Engine) or prefixed instructions on
  36. // Power 9, or MMA, or paired vector mem ops, or PC relative mem ops, or
  37. // instructions introduced after ISA 3.0.
  38. let UnsupportedFeatures = [HasSPE, PrefixInstrs, MMA,
  39. PairedVectorMemops,
  40. PCRelativeMemops, IsISA3_1, IsISAFuture];
  41. }
  42. let SchedModel = P9Model in {
  43. // ***************** Processor Resources *****************
  44. // Dispatcher slots:
  45. // x0, x1, x2, and x3 are the dedicated slice dispatch ports, where each
  46. // corresponds to one of the four execution slices.
  47. def DISPx02 : ProcResource<2>;
  48. def DISPx13 : ProcResource<2>;
  49. // The xa and xb ports can be used to send an iop to either of the two slices
  50. // of the superslice, but are restricted to iops with only two primary sources.
  51. def DISPxab : ProcResource<2>;
  52. // b0 and b1 are dedicated dispatch ports into the branch slice.
  53. def DISPb01 : ProcResource<2>;
  54. // Any non BR dispatch ports
  55. def DISP_NBR
  56. : ProcResGroup<[ DISPx02, DISPx13, DISPxab]>;
  57. def DISP_SS : ProcResGroup<[ DISPx02, DISPx13]>;
  58. // Issue Ports
  59. // An instruction can go down one of two issue queues.
  60. // Address Generation (AGEN) mainly for loads and stores.
  61. // Execution (EXEC) for most other instructions.
  62. // Some instructions cannot be run on just any issue queue and may require an
  63. // Even or an Odd queue. The EXECE represents the even queues and the EXECO
  64. // represents the odd queues.
  65. def IP_AGEN : ProcResource<4>;
  66. def IP_EXEC : ProcResource<4>;
  67. def IP_EXECE : ProcResource<2> {
  68. //Even Exec Ports
  69. let Super = IP_EXEC;
  70. }
  71. def IP_EXECO : ProcResource<2> {
  72. //Odd Exec Ports
  73. let Super = IP_EXEC;
  74. }
  75. // Pipeline Groups
  76. // Four ALU (Fixed Point Arithmetic) units in total. Two even, two Odd.
  77. def ALU : ProcResource<4>;
  78. def ALUE : ProcResource<2> {
  79. //Even ALU pipelines
  80. let Super = ALU;
  81. }
  82. def ALUO : ProcResource<2> {
  83. //Odd ALU pipelines
  84. let Super = ALU;
  85. }
  86. // Two DIV (Fixed Point Divide) units.
  87. def DIV : ProcResource<2>;
  88. // Four DP (Floating Point) units in total. Two even, two Odd.
  89. def DP : ProcResource<4>;
  90. def DPE : ProcResource<2> {
  91. //Even DP pipelines
  92. let Super = DP;
  93. }
  94. def DPO : ProcResource<2> {
  95. //Odd DP pipelines
  96. let Super = DP;
  97. }
  98. // Four LS (Load or Store) units.
  99. def LS : ProcResource<4>;
  100. // Two PM (Permute) units.
  101. def PM : ProcResource<2>;
  102. // Only one DFU (Decimal Floating Point and Quad Precision) unit.
  103. def DFU : ProcResource<1>;
  104. // Only one Branch unit.
  105. def BR : ProcResource<1> {
  106. let BufferSize = 16;
  107. }
  108. // Only one CY (Crypto) unit.
  109. def CY : ProcResource<1>;
  110. // ***************** SchedWriteRes Definitions *****************
  111. // Dispatcher
  112. // Dispatch Rules: '-' or 'V'
  113. // Vector ('V') - vector iops (128-bit operand) take only one decode and
  114. // dispatch slot but are dispatched to both the even and odd slices of a
  115. // superslice.
  116. def DISP_1C : SchedWriteRes<[DISP_NBR]> {
  117. let NumMicroOps = 0;
  118. let Latency = 1;
  119. }
  120. // Dispatch Rules: 'E'
  121. // Even slice ('E')- certain operations must be sent only to an even slice.
  122. // Also consumes odd dispatch slice slot of the same superslice at dispatch
  123. def DISP_EVEN_1C : SchedWriteRes<[ DISPx02, DISPx13 ]> {
  124. let NumMicroOps = 0;
  125. let Latency = 1;
  126. }
  127. // Dispatch Rules: 'P'
  128. // Paired ('P') - certain cracked and expanded iops are paired such that they
  129. // must dispatch together to the same superslice.
  130. def DISP_PAIR_1C : SchedWriteRes<[ DISP_SS, DISP_SS]> {
  131. let NumMicroOps = 0;
  132. let Latency = 1;
  133. }
  134. // Tuple Restricted ('R') - certain iops preclude dispatching more than one
  135. // operation per slice for the super- slice to which they are dispatched
  136. def DISP_3SLOTS_1C : SchedWriteRes<[DISPx02, DISPx13, DISPxab]> {
  137. let NumMicroOps = 0;
  138. let Latency = 1;
  139. }
  140. // Each execution and branch slice can receive up to two iops per cycle
  141. def DISP_BR_1C : SchedWriteRes<[ DISPxab ]> {
  142. let NumMicroOps = 0;
  143. let Latency = 1;
  144. }
  145. // Issue Ports
  146. def IP_AGEN_1C : SchedWriteRes<[IP_AGEN]> {
  147. let NumMicroOps = 0;
  148. let Latency = 1;
  149. }
  150. def IP_EXEC_1C : SchedWriteRes<[IP_EXEC]> {
  151. let NumMicroOps = 0;
  152. let Latency = 1;
  153. }
  154. def IP_EXECE_1C : SchedWriteRes<[IP_EXECE]> {
  155. let NumMicroOps = 0;
  156. let Latency = 1;
  157. }
  158. def IP_EXECO_1C : SchedWriteRes<[IP_EXECO]> {
  159. let NumMicroOps = 0;
  160. let Latency = 1;
  161. }
  162. //Pipeline Groups
  163. // ALU Units
  164. // An ALU may take either 2 or 3 cycles to complete the operation.
  165. // However, the ALU unit is only ever busy for 1 cycle at a time and may
  166. // receive new instructions each cycle.
  167. def P9_ALU_2C : SchedWriteRes<[ALU]> {
  168. let Latency = 2;
  169. }
  170. def P9_ALUE_2C : SchedWriteRes<[ALUE]> {
  171. let Latency = 2;
  172. }
  173. def P9_ALUO_2C : SchedWriteRes<[ALUO]> {
  174. let Latency = 2;
  175. }
  176. def P9_ALU_3C : SchedWriteRes<[ALU]> {
  177. let Latency = 3;
  178. }
  179. def P9_ALUE_3C : SchedWriteRes<[ALUE]> {
  180. let Latency = 3;
  181. }
  182. def P9_ALUO_3C : SchedWriteRes<[ALUO]> {
  183. let Latency = 3;
  184. }
  185. // DIV Unit
  186. // A DIV unit may take from 5 to 40 cycles to complete.
  187. // Some DIV operations may keep the unit busy for up to 8 cycles.
  188. def P9_DIV_5C : SchedWriteRes<[DIV]> {
  189. let Latency = 5;
  190. }
  191. def P9_DIV_12C : SchedWriteRes<[DIV]> {
  192. let Latency = 12;
  193. }
  194. def P9_DIV_16C_8 : SchedWriteRes<[DIV]> {
  195. let ResourceCycles = [8];
  196. let Latency = 16;
  197. }
  198. def P9_DIV_24C_8 : SchedWriteRes<[DIV]> {
  199. let ResourceCycles = [8];
  200. let Latency = 24;
  201. }
  202. def P9_DIV_40C_8 : SchedWriteRes<[DIV]> {
  203. let ResourceCycles = [8];
  204. let Latency = 40;
  205. }
  206. // DP Unit
  207. // A DP unit may take from 2 to 36 cycles to complete.
  208. // Some DP operations keep the unit busy for up to 10 cycles.
  209. def P9_DP_5C : SchedWriteRes<[DP]> {
  210. let Latency = 5;
  211. }
  212. def P9_DP_7C : SchedWriteRes<[DP]> {
  213. let Latency = 7;
  214. }
  215. def P9_DPE_7C : SchedWriteRes<[DPE]> {
  216. let Latency = 7;
  217. }
  218. def P9_DPO_7C : SchedWriteRes<[DPO]> {
  219. let Latency = 7;
  220. }
  221. def P9_DP_22C_5 : SchedWriteRes<[DP]> {
  222. let ResourceCycles = [5];
  223. let Latency = 22;
  224. }
  225. def P9_DPO_24C_8 : SchedWriteRes<[DPO]> {
  226. let ResourceCycles = [8];
  227. let Latency = 24;
  228. }
  229. def P9_DPE_24C_8 : SchedWriteRes<[DPE]> {
  230. let ResourceCycles = [8];
  231. let Latency = 24;
  232. }
  233. def P9_DP_26C_5 : SchedWriteRes<[DP]> {
  234. let ResourceCycles = [5];
  235. let Latency = 22;
  236. }
  237. def P9_DPE_27C_10 : SchedWriteRes<[DP]> {
  238. let ResourceCycles = [10];
  239. let Latency = 27;
  240. }
  241. def P9_DPO_27C_10 : SchedWriteRes<[DP]> {
  242. let ResourceCycles = [10];
  243. let Latency = 27;
  244. }
  245. def P9_DP_33C_8 : SchedWriteRes<[DP]> {
  246. let ResourceCycles = [8];
  247. let Latency = 33;
  248. }
  249. def P9_DPE_33C_8 : SchedWriteRes<[DPE]> {
  250. let ResourceCycles = [8];
  251. let Latency = 33;
  252. }
  253. def P9_DPO_33C_8 : SchedWriteRes<[DPO]> {
  254. let ResourceCycles = [8];
  255. let Latency = 33;
  256. }
  257. def P9_DP_36C_10 : SchedWriteRes<[DP]> {
  258. let ResourceCycles = [10];
  259. let Latency = 36;
  260. }
  261. def P9_DPE_36C_10 : SchedWriteRes<[DP]> {
  262. let ResourceCycles = [10];
  263. let Latency = 36;
  264. }
  265. def P9_DPO_36C_10 : SchedWriteRes<[DP]> {
  266. let ResourceCycles = [10];
  267. let Latency = 36;
  268. }
  269. // PM Unit
  270. // Three cycle permute operations.
  271. def P9_PM_3C : SchedWriteRes<[PM]> {
  272. let Latency = 3;
  273. }
  274. // Load and Store Units
  275. // Loads can have 4, 5 or 6 cycles of latency.
  276. // Stores are listed as having a single cycle of latency. This is not
  277. // completely accurate since it takes more than 1 cycle to actually store
  278. // the value. However, since the store does not produce a result it can be
  279. // considered complete after one cycle.
  280. def P9_LS_1C : SchedWriteRes<[LS]> {
  281. let Latency = 1;
  282. }
  283. def P9_LS_4C : SchedWriteRes<[LS]> {
  284. let Latency = 4;
  285. }
  286. def P9_LS_5C : SchedWriteRes<[LS]> {
  287. let Latency = 5;
  288. }
  289. def P9_LS_6C : SchedWriteRes<[LS]> {
  290. let Latency = 6;
  291. }
  292. // DFU Unit
  293. // Some of the most expensive ops use the DFU.
  294. // Can take from 12 cycles to 76 cycles to obtain a result.
  295. // The unit may be busy for up to 62 cycles.
  296. def P9_DFU_12C : SchedWriteRes<[DFU]> {
  297. let Latency = 12;
  298. }
  299. def P9_DFU_23C : SchedWriteRes<[DFU]> {
  300. let Latency = 23;
  301. let ResourceCycles = [11];
  302. }
  303. def P9_DFU_24C : SchedWriteRes<[DFU]> {
  304. let Latency = 24;
  305. let ResourceCycles = [12];
  306. }
  307. def P9_DFU_37C : SchedWriteRes<[DFU]> {
  308. let Latency = 37;
  309. let ResourceCycles = [25];
  310. }
  311. def P9_DFU_58C : SchedWriteRes<[DFU]> {
  312. let Latency = 58;
  313. let ResourceCycles = [44];
  314. }
  315. def P9_DFU_76C : SchedWriteRes<[DFU]> {
  316. let Latency = 76;
  317. let ResourceCycles = [62];
  318. }
  319. // 2 or 5 cycle latencies for the branch unit.
  320. def P9_BR_2C : SchedWriteRes<[BR]> {
  321. let Latency = 2;
  322. }
  323. def P9_BR_5C : SchedWriteRes<[BR]> {
  324. let Latency = 5;
  325. }
  326. // 6 cycle latency for the crypto unit
  327. def P9_CY_6C : SchedWriteRes<[CY]> {
  328. let Latency = 6;
  329. }
  330. // ***************** WriteSeq Definitions *****************
  331. // These are combinations of the resources listed above.
  332. // The idea is that some cracked instructions cannot be done in parallel and
  333. // so the latencies for their resources must be added.
  334. def P9_LoadAndALUOp_6C : WriteSequence<[P9_LS_4C, P9_ALU_2C]>;
  335. def P9_LoadAndALUOp_7C : WriteSequence<[P9_LS_5C, P9_ALU_2C]>;
  336. def P9_LoadAndALU2Op_7C : WriteSequence<[P9_LS_4C, P9_ALU_3C]>;
  337. def P9_LoadAndALU2Op_8C : WriteSequence<[P9_LS_5C, P9_ALU_3C]>;
  338. def P9_LoadAndPMOp_8C : WriteSequence<[P9_LS_5C, P9_PM_3C]>;
  339. def P9_IntDivAndALUOp_18C_8 : WriteSequence<[P9_DIV_16C_8, P9_ALU_2C]>;
  340. def P9_IntDivAndALUOp_26C_8 : WriteSequence<[P9_DIV_24C_8, P9_ALU_2C]>;
  341. def P9_IntDivAndALUOp_42C_8 : WriteSequence<[P9_DIV_40C_8, P9_ALU_2C]>;
  342. def P9_StoreAndALUOp_3C : WriteSequence<[P9_LS_1C, P9_ALU_2C]>;
  343. def P9_ALUOpAndALUOp_4C : WriteSequence<[P9_ALU_2C, P9_ALU_2C]>;
  344. def P9_ALU2OpAndALU2Op_6C : WriteSequence<[P9_ALU_3C, P9_ALU_3C]>;
  345. def P9_ALUOpAndALUOpAndALUOp_6C :
  346. WriteSequence<[P9_ALU_2C, P9_ALU_2C, P9_ALU_2C]>;
  347. def P9_DPOpAndALUOp_7C : WriteSequence<[P9_DP_5C, P9_ALU_2C]>;
  348. def P9_DPOpAndALU2Op_10C : WriteSequence<[P9_DP_7C, P9_ALU_3C]>;
  349. def P9_DPOpAndALU2Op_25C_5 : WriteSequence<[P9_DP_22C_5, P9_ALU_3C]>;
  350. def P9_DPOpAndALU2Op_29C_5 : WriteSequence<[P9_DP_26C_5, P9_ALU_3C]>;
  351. def P9_DPOpAndALU2Op_36C_8 : WriteSequence<[P9_DP_33C_8, P9_ALU_3C]>;
  352. def P9_DPOpAndALU2Op_39C_10 : WriteSequence<[P9_DP_36C_10, P9_ALU_3C]>;
  353. def P9_BROpAndALUOp_7C : WriteSequence<[P9_BR_5C, P9_ALU_2C]>;
  354. // Include the resource requirements of individual instructions.
  355. include "P9InstrResources.td"
  356. }