PPCScheduleE500.td 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. //===-- PPCScheduleE500.td - e500 Scheduling Defs ------*- 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 Freescale e500 32-bit
  10. // Power processor.
  11. //
  12. // All information is derived from the "e500 Core Reference Manual",
  13. // Freescale Document Number E500MCRM, Rev. 1, 03/2012.
  14. //
  15. //===----------------------------------------------------------------------===//
  16. // Relevant functional units in the Freescale e500 core:
  17. //
  18. // * Decode & Dispatch
  19. // Can dispatch up to 2 instructions per clock cycle to either the GPR Issue
  20. // queues (GIQx) or Branch issue queue (BIQ).
  21. def E500_DIS0 : FuncUnit; // Dispatch stage - insn 1
  22. def E500_DIS1 : FuncUnit; // Dispatch stage - insn 2
  23. // * Execute
  24. // 6 pipelined execution units: SU0, SU1, BU, LSU, MU.
  25. // Some instructions can only execute in SU0 but not SU1.
  26. def E500_SU0 : FuncUnit; // Simple unit 0
  27. def E500_SU1 : FuncUnit; // Simple unit 1
  28. def E500_BU : FuncUnit; // Branch unit
  29. def E500_MU : FuncUnit; // MU pipeline
  30. def E500_LSU_0 : FuncUnit; // LSU pipeline
  31. def E500_GPR_Bypass : Bypass;
  32. def E500_CR_Bypass : Bypass;
  33. def E500_DivBypass : Bypass;
  34. def PPCE500Itineraries : ProcessorItineraries<
  35. [E500_DIS0, E500_DIS1, E500_SU0, E500_SU1, E500_BU,
  36. E500_MU, E500_LSU_0],
  37. [E500_CR_Bypass, E500_GPR_Bypass, E500_DivBypass], [
  38. InstrItinData<IIC_IntSimple, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  39. InstrStage<1, [E500_SU0, E500_SU1]>],
  40. [4, 1, 1], // Latency = 1
  41. [E500_GPR_Bypass,
  42. E500_GPR_Bypass, E500_GPR_Bypass]>,
  43. InstrItinData<IIC_IntGeneral, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  44. InstrStage<1, [E500_SU0, E500_SU1]>],
  45. [4, 1, 1], // Latency = 1
  46. [E500_GPR_Bypass,
  47. E500_GPR_Bypass, E500_GPR_Bypass]>,
  48. InstrItinData<IIC_IntISEL, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  49. InstrStage<1, [E500_SU0, E500_SU1]>],
  50. [4, 1, 1, 1], // Latency = 1
  51. [E500_GPR_Bypass,
  52. E500_GPR_Bypass, E500_GPR_Bypass,
  53. E500_CR_Bypass]>,
  54. InstrItinData<IIC_IntCompare, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  55. InstrStage<1, [E500_SU0, E500_SU1]>],
  56. [5, 1, 1], // Latency = 1 or 2
  57. [E500_CR_Bypass,
  58. E500_GPR_Bypass, E500_GPR_Bypass]>,
  59. InstrItinData<IIC_IntDivW, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  60. InstrStage<1, [E500_MU], 0>,
  61. InstrStage<14, [E500_MU]>],
  62. [17, 1, 1], // Latency=4..35, Repeat= 4..35
  63. [E500_GPR_Bypass,
  64. E500_GPR_Bypass, E500_GPR_Bypass]>,
  65. InstrItinData<IIC_IntMulHW, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  66. InstrStage<4, [E500_MU]>],
  67. [7, 1, 1], // Latency = 4, Repeat rate = 1
  68. [E500_GPR_Bypass,
  69. E500_GPR_Bypass, E500_GPR_Bypass]>,
  70. InstrItinData<IIC_IntMulHWU, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  71. InstrStage<4, [E500_MU]>],
  72. [7, 1, 1], // Latency = 4, Repeat rate = 1
  73. [E500_GPR_Bypass,
  74. E500_GPR_Bypass, E500_GPR_Bypass]>,
  75. InstrItinData<IIC_IntMulLI, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  76. InstrStage<4, [E500_MU]>],
  77. [7, 1, 1], // Latency = 4, Repeat rate = 1
  78. [E500_GPR_Bypass,
  79. E500_GPR_Bypass, E500_GPR_Bypass]>,
  80. InstrItinData<IIC_IntRotate, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  81. InstrStage<1, [E500_SU0, E500_SU1]>],
  82. [4, 1, 1], // Latency = 1
  83. [E500_GPR_Bypass,
  84. E500_GPR_Bypass, E500_GPR_Bypass]>,
  85. InstrItinData<IIC_IntShift, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  86. InstrStage<1, [E500_SU0, E500_SU1]>],
  87. [4, 1, 1], // Latency = 1
  88. [E500_GPR_Bypass,
  89. E500_GPR_Bypass, E500_GPR_Bypass]>,
  90. InstrItinData<IIC_IntTrapW, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  91. InstrStage<2, [E500_SU0]>],
  92. [5, 1], // Latency = 2, Repeat rate = 2
  93. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  94. InstrItinData<IIC_BrB, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  95. InstrStage<1, [E500_BU]>],
  96. [4, 1], // Latency = 1
  97. [NoBypass, E500_GPR_Bypass]>,
  98. InstrItinData<IIC_BrCR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  99. InstrStage<1, [E500_BU]>],
  100. [4, 1, 1], // Latency = 1
  101. [E500_CR_Bypass,
  102. E500_CR_Bypass, E500_CR_Bypass]>,
  103. InstrItinData<IIC_BrMCR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  104. InstrStage<1, [E500_BU]>],
  105. [4, 1], // Latency = 1
  106. [E500_CR_Bypass, E500_CR_Bypass]>,
  107. InstrItinData<IIC_BrMCRX, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  108. InstrStage<1, [E500_SU0, E500_SU1]>],
  109. [4, 1, 1], // Latency = 1
  110. [E500_CR_Bypass, E500_GPR_Bypass]>,
  111. InstrItinData<IIC_LdStDCBA, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  112. InstrStage<1, [E500_LSU_0]>],
  113. [6, 1], // Latency = 3, Repeat rate = 1
  114. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  115. InstrItinData<IIC_LdStDCBF, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  116. InstrStage<1, [E500_LSU_0]>],
  117. [6, 1], // Latency = 3
  118. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  119. InstrItinData<IIC_LdStDCBI, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  120. InstrStage<1, [E500_LSU_0]>],
  121. [6, 1], // Latency = 3
  122. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  123. InstrItinData<IIC_LdStLoad, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  124. InstrStage<1, [E500_LSU_0]>],
  125. [6, 1], // Latency = 3
  126. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  127. InstrItinData<IIC_LdStLoadUpd, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  128. InstrStage<1, [E500_SU0, E500_SU1], 0>,
  129. InstrStage<1, [E500_LSU_0]>],
  130. [6, 1], // Latency = 3
  131. [E500_GPR_Bypass, E500_GPR_Bypass],
  132. 2>, // 2 micro-ops
  133. InstrItinData<IIC_LdStLoadUpdX,[InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  134. InstrStage<1, [E500_SU0, E500_SU1], 0>,
  135. InstrStage<1, [E500_LSU_0]>],
  136. [6, 1], // Latency = 3
  137. [E500_GPR_Bypass, E500_GPR_Bypass],
  138. 2>, // 2 micro-ops
  139. InstrItinData<IIC_LdStStore, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  140. InstrStage<1, [E500_LSU_0]>],
  141. [6, 1], // Latency = 3
  142. [NoBypass, E500_GPR_Bypass]>,
  143. InstrItinData<IIC_LdStSTU, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  144. InstrStage<1, [E500_SU0, E500_SU1], 0>,
  145. InstrStage<1, [E500_LSU_0]>],
  146. [6, 1], // Latency = 3
  147. [NoBypass, E500_GPR_Bypass],
  148. 2>, // 2 micro-ops
  149. InstrItinData<IIC_LdStSTUX, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  150. InstrStage<1, [E500_SU0, E500_SU1], 0>,
  151. InstrStage<1, [E500_LSU_0]>],
  152. [6, 1], // Latency = 3
  153. [NoBypass, E500_GPR_Bypass],
  154. 2>, // 2 micro-ops
  155. InstrItinData<IIC_LdStICBI, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  156. InstrStage<1, [E500_LSU_0]>],
  157. [6, 1], // Latency = 3
  158. [NoBypass, E500_GPR_Bypass]>,
  159. InstrItinData<IIC_LdStLHA, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  160. InstrStage<1, [E500_LSU_0]>],
  161. [6, 1], // Latency = 3
  162. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  163. InstrItinData<IIC_LdStLHAU, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  164. InstrStage<1, [E500_SU0, E500_SU1], 0>,
  165. InstrStage<1, [E500_LSU_0]>],
  166. [6, 1], // Latency = 3
  167. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  168. InstrItinData<IIC_LdStLHAUX, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  169. InstrStage<1, [E500_SU0, E500_SU1], 0>,
  170. InstrStage<1, [E500_LSU_0]>],
  171. [6, 1], // Latency = 3
  172. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  173. InstrItinData<IIC_LdStLMW, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  174. InstrStage<1, [E500_LSU_0]>],
  175. [7, 1], // Latency = r+3
  176. [NoBypass, E500_GPR_Bypass]>,
  177. InstrItinData<IIC_LdStLWARX, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  178. InstrStage<3, [E500_LSU_0]>],
  179. [6, 1, 1], // Latency = 3, Repeat rate = 3
  180. [E500_GPR_Bypass,
  181. E500_GPR_Bypass, E500_GPR_Bypass]>,
  182. InstrItinData<IIC_LdStSTWCX, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  183. InstrStage<1, [E500_LSU_0]>],
  184. [6, 1], // Latency = 3
  185. [NoBypass, E500_GPR_Bypass]>,
  186. InstrItinData<IIC_LdStSync, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  187. InstrStage<1, [E500_LSU_0]>]>,
  188. InstrItinData<IIC_SprMFSR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  189. InstrStage<4, [E500_SU0]>],
  190. [7, 1],
  191. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  192. InstrItinData<IIC_SprMTMSR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  193. InstrStage<2, [E500_SU0, E500_SU1]>],
  194. [5, 1], // Latency = 2, Repeat rate = 4
  195. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  196. InstrItinData<IIC_SprMTSR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  197. InstrStage<1, [E500_SU0]>],
  198. [5, 1],
  199. [NoBypass, E500_GPR_Bypass]>,
  200. InstrItinData<IIC_SprTLBSYNC, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  201. InstrStage<1, [E500_LSU_0], 0>]>,
  202. InstrItinData<IIC_SprMFCR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  203. InstrStage<5, [E500_SU0]>],
  204. [8, 1],
  205. [E500_GPR_Bypass, E500_CR_Bypass]>,
  206. InstrItinData<IIC_SprMFCRF, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  207. InstrStage<5, [E500_SU0]>],
  208. [8, 1],
  209. [E500_GPR_Bypass, E500_CR_Bypass]>,
  210. InstrItinData<IIC_SprMFPMR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  211. InstrStage<4, [E500_SU0]>],
  212. [7, 1], // Latency = 4, Repeat rate = 4
  213. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  214. InstrItinData<IIC_SprMFMSR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  215. InstrStage<4, [E500_SU0]>],
  216. [7, 1], // Latency = 4, Repeat rate = 4
  217. [E500_GPR_Bypass, E500_GPR_Bypass]>,
  218. InstrItinData<IIC_SprMFSPR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  219. InstrStage<1, [E500_SU0, E500_SU1]>],
  220. [4, 1], // Latency = 1, Repeat rate = 1
  221. [E500_GPR_Bypass, E500_CR_Bypass]>,
  222. InstrItinData<IIC_SprMTPMR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  223. InstrStage<1, [E500_SU0]>],
  224. [4, 1], // Latency = 1, Repeat rate = 1
  225. [E500_CR_Bypass, E500_GPR_Bypass]>,
  226. InstrItinData<IIC_SprMFTB, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  227. InstrStage<4, [E500_SU0]>],
  228. [7, 1], // Latency = 4, Repeat rate = 4
  229. [NoBypass, E500_GPR_Bypass]>,
  230. InstrItinData<IIC_SprMTSPR, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  231. InstrStage<1, [E500_SU0, E500_SU1]>],
  232. [4, 1], // Latency = 1, Repeat rate = 1
  233. [E500_CR_Bypass, E500_GPR_Bypass]>,
  234. InstrItinData<IIC_SprMTSRIN, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  235. InstrStage<1, [E500_SU0]>],
  236. [4, 1],
  237. [NoBypass, E500_GPR_Bypass]>,
  238. InstrItinData<IIC_FPDGeneral, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  239. InstrStage<6, [E500_MU]>],
  240. [9, 1, 1], // Latency = 6, Repeat rate = 1
  241. [NoBypass]>,
  242. InstrItinData<IIC_FPSGeneral, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  243. InstrStage<4, [E500_MU]>],
  244. [7, 1, 1], // Latency = 4, Repeat rate = 1
  245. [NoBypass]>,
  246. InstrItinData<IIC_FPDivD, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  247. InstrStage<32, [E500_MU]>],
  248. [35, 1, 1], // Latency = 32, Repeat rate = 32
  249. [E500_DivBypass]>,
  250. InstrItinData<IIC_FPDivS, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  251. InstrStage<29, [E500_MU]>],
  252. [32, 1, 1], // Latency = 29, Repeat rate = 29
  253. [E500_DivBypass]>,
  254. InstrItinData<IIC_VecGeneral, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  255. InstrStage<1, [E500_SU0]>],
  256. [4, 1, 1], // Latency = 1, Repeat rate = 1
  257. [NoBypass]>,
  258. InstrItinData<IIC_VecComplex, [InstrStage<1, [E500_DIS0, E500_DIS1], 0>,
  259. InstrStage<4, [E500_MU]>],
  260. [7, 1, 1], // Latency = 4, Repeat rate = 1
  261. [NoBypass]>
  262. ]>;
  263. // ===---------------------------------------------------------------------===//
  264. // e500 machine model for scheduling and other instruction cost heuristics.
  265. def PPCE500Model : SchedMachineModel {
  266. let IssueWidth = 2; // 2 micro-ops are dispatched per cycle.
  267. let LoadLatency = 5; // Optimistic load latency assuming bypass.
  268. // This is overriden by OperandCycles if the
  269. // Itineraries are queried instead.
  270. let CompleteModel = 0;
  271. let Itineraries = PPCE500Itineraries;
  272. }