RISCVSchedule.td 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. //===-- RISCVSchedule.td - RISCV 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. /// Define scheduler resources associated with def operands.
  9. def WriteIALU : SchedWrite; // 32 or 64-bit integer ALU operations
  10. def WriteIALU32 : SchedWrite; // 32-bit integer ALU operations on RV64I
  11. def WriteShiftImm : SchedWrite; // 32 or 64-bit shift by immediate operations
  12. def WriteShiftImm32 : SchedWrite; // 32-bit shift by immediate operations on RV64Ix
  13. def WriteShiftReg : SchedWrite; // 32 or 64-bit shift by immediate operations
  14. def WriteShiftReg32 : SchedWrite; // 32-bit shift by immediate operations on RV64Ix
  15. def WriteIDiv : SchedWrite; // 32-bit or 64-bit divide and remainder
  16. def WriteIDiv32 : SchedWrite; // 32-bit divide and remainder on RV64I
  17. def WriteIMul : SchedWrite; // 32-bit or 64-bit multiply
  18. def WriteIMul32 : SchedWrite; // 32-bit multiply on RV64I
  19. def WriteJmp : SchedWrite; // Jump
  20. def WriteJal : SchedWrite; // Jump and link
  21. def WriteJalr : SchedWrite; // Jump and link register
  22. def WriteJmpReg : SchedWrite; // Jump register
  23. def WriteNop : SchedWrite;
  24. def WriteLDB : SchedWrite; // Load byte
  25. def WriteLDH : SchedWrite; // Load half-word
  26. def WriteLDW : SchedWrite; // Load word
  27. def WriteLDD : SchedWrite; // Load double-word
  28. def WriteCSR : SchedWrite; // CSR instructions
  29. def WriteSTB : SchedWrite; // Store byte
  30. def WriteSTH : SchedWrite; // Store half-word
  31. def WriteSTW : SchedWrite; // Store word
  32. def WriteSTD : SchedWrite; // Store double-word
  33. def WriteAtomicW : SchedWrite; //Atomic memory operation word size
  34. def WriteAtomicD : SchedWrite; //Atomic memory operation double word size
  35. def WriteAtomicLDW : SchedWrite; // Atomic load word
  36. def WriteAtomicLDD : SchedWrite; // Atomic load double word
  37. def WriteAtomicSTW : SchedWrite; // Atomic store word
  38. def WriteAtomicSTD : SchedWrite; // Atomic store double word
  39. def WriteFAdd16 : SchedWrite; // 16-bit floating point addition/subtraction
  40. def WriteFAdd32 : SchedWrite; // 32-bit floating point addition/subtraction
  41. def WriteFAdd64 : SchedWrite; // 64-bit floating point addition/subtraction
  42. def WriteFMul16 : SchedWrite; // 16-bit floating point multiply
  43. def WriteFMul32 : SchedWrite; // 32-bit floating point multiply
  44. def WriteFMul64 : SchedWrite; // 64-bit floating point multiply
  45. def WriteFMA16 : SchedWrite; // 16-bit floating point fused multiply-add
  46. def WriteFMA32 : SchedWrite; // 32-bit floating point fused multiply-add
  47. def WriteFMA64 : SchedWrite; // 64-bit floating point fused multiply-add
  48. def WriteFDiv16 : SchedWrite; // 16-bit floating point divide
  49. def WriteFDiv32 : SchedWrite; // 32-bit floating point divide
  50. def WriteFDiv64 : SchedWrite; // 64-bit floating point divide
  51. def WriteFSqrt16 : SchedWrite; // 16-bit floating point sqrt
  52. def WriteFSqrt32 : SchedWrite; // 32-bit floating point sqrt
  53. def WriteFSqrt64 : SchedWrite; // 64-bit floating point sqrt
  54. // Integer to float conversions
  55. def WriteFCvtI32ToF16 : SchedWrite;
  56. def WriteFCvtI32ToF32 : SchedWrite;
  57. def WriteFCvtI32ToF64 : SchedWrite;
  58. def WriteFCvtI64ToF16 : SchedWrite; // RV64I only
  59. def WriteFCvtI64ToF32 : SchedWrite; // RV64I only
  60. def WriteFCvtI64ToF64 : SchedWrite; // RV64I only
  61. //Float to integer conversions
  62. def WriteFCvtF16ToI32 : SchedWrite;
  63. def WriteFCvtF16ToI64 : SchedWrite; // RV64I only
  64. def WriteFCvtF32ToI32 : SchedWrite;
  65. def WriteFCvtF32ToI64 : SchedWrite; // RV64I only
  66. def WriteFCvtF64ToI32 : SchedWrite;
  67. def WriteFCvtF64ToI64 : SchedWrite; // RV64I only
  68. // Float to float conversions
  69. def WriteFCvtF32ToF64 : SchedWrite;
  70. def WriteFCvtF64ToF32 : SchedWrite;
  71. def WriteFCvtF16ToF32 : SchedWrite;
  72. def WriteFCvtF32ToF16 : SchedWrite;
  73. def WriteFCvtF16ToF64 : SchedWrite;
  74. def WriteFCvtF64ToF16 : SchedWrite;
  75. def WriteFClass16 : SchedWrite; // 16-bit floating point classify
  76. def WriteFClass32 : SchedWrite; // 32-bit floating point classify
  77. def WriteFClass64 : SchedWrite; // 64-bit floating point classify
  78. def WriteFCmp16 : SchedWrite; // 16-bit floating point compare
  79. def WriteFCmp32 : SchedWrite; // 32-bit floating point compare
  80. def WriteFCmp64 : SchedWrite; // 64-bit floating point compare
  81. def WriteFSGNJ16 : SchedWrite; // 16-bit floating point sign-injection
  82. def WriteFSGNJ32 : SchedWrite; // 32-bit floating point sign-injection
  83. def WriteFSGNJ64 : SchedWrite; // 64-bit floating point sign-injection
  84. def WriteFMinMax16 : SchedWrite; // 16-bit floating point min or max
  85. def WriteFMinMax32 : SchedWrite; // 32-bit floating point min or max
  86. def WriteFMinMax64 : SchedWrite; // 64-bit floating point min or max
  87. def WriteFMovF16ToI16 : SchedWrite;
  88. def WriteFMovI16ToF16 : SchedWrite;
  89. def WriteFMovF32ToI32 : SchedWrite;
  90. def WriteFMovI32ToF32 : SchedWrite;
  91. def WriteFMovF64ToI64 : SchedWrite; // RV64I only
  92. def WriteFMovI64ToF64 : SchedWrite; // RV64I only
  93. def WriteFLD16 : SchedWrite; // Floating point sp load
  94. def WriteFLD32 : SchedWrite; // Floating point sp load
  95. def WriteFLD64 : SchedWrite; // Floating point dp load
  96. def WriteFST16 : SchedWrite; // Floating point sp store
  97. def WriteFST32 : SchedWrite; // Floating point sp store
  98. def WriteFST64 : SchedWrite; // Floating point dp store
  99. // short forward branch for Bullet
  100. def WriteSFB : SchedWrite;
  101. def ReadSFB : SchedRead;
  102. /// Define scheduler resources associated with use operands.
  103. def ReadJmp : SchedRead;
  104. def ReadJalr : SchedRead;
  105. def ReadCSR : SchedRead;
  106. def ReadMemBase : SchedRead;
  107. def ReadFMemBase : SchedRead;
  108. def ReadStoreData : SchedRead;
  109. def ReadFStoreData : SchedRead;
  110. def ReadIALU : SchedRead;
  111. def ReadIALU32 : SchedRead; // 32-bit integer ALU operations on RV64I
  112. def ReadShiftImm : SchedRead;
  113. def ReadShiftImm32 : SchedRead; // 32-bit shift by immediate operations on RV64Ix
  114. def ReadShiftReg : SchedRead;
  115. def ReadShiftReg32 : SchedRead; // 32-bit shift by register operations on RV64Ix
  116. def ReadIDiv : SchedRead;
  117. def ReadIDiv32 : SchedRead;
  118. def ReadIMul : SchedRead;
  119. def ReadIMul32 : SchedRead;
  120. def ReadAtomicWA : SchedRead;
  121. def ReadAtomicWD : SchedRead;
  122. def ReadAtomicDA : SchedRead;
  123. def ReadAtomicDD : SchedRead;
  124. def ReadAtomicLDW : SchedRead; // Atomic load word
  125. def ReadAtomicLDD : SchedRead; // Atomic load double word
  126. def ReadAtomicSTW : SchedRead; // Atomic store word
  127. def ReadAtomicSTD : SchedRead; // Atomic store double word
  128. def ReadFAdd16 : SchedRead; // 16-bit floating point addition/subtraction
  129. def ReadFAdd32 : SchedRead; // 32-bit floating point addition/subtraction
  130. def ReadFAdd64 : SchedRead; // 64-bit floating point addition/subtraction
  131. def ReadFMul16 : SchedRead; // 16-bit floating point multiply
  132. def ReadFMul32 : SchedRead; // 32-bit floating point multiply
  133. def ReadFMul64 : SchedRead; // 64-bit floating point multiply
  134. def ReadFMA16 : SchedRead; // 16-bit floating point fused multiply-add
  135. def ReadFMA32 : SchedRead; // 32-bit floating point fused multiply-add
  136. def ReadFMA64 : SchedRead; // 64-bit floating point fused multiply-add
  137. def ReadFDiv16 : SchedRead; // 16-bit floating point divide
  138. def ReadFDiv32 : SchedRead; // 32-bit floating point divide
  139. def ReadFDiv64 : SchedRead; // 64-bit floating point divide
  140. def ReadFSqrt16 : SchedRead; // 16-bit floating point sqrt
  141. def ReadFSqrt32 : SchedRead; // 32-bit floating point sqrt
  142. def ReadFSqrt64 : SchedRead; // 64-bit floating point sqrt
  143. def ReadFCmp16 : SchedRead;
  144. def ReadFCmp32 : SchedRead;
  145. def ReadFCmp64 : SchedRead;
  146. def ReadFSGNJ16 : SchedRead;
  147. def ReadFSGNJ32 : SchedRead;
  148. def ReadFSGNJ64 : SchedRead;
  149. def ReadFMinMax16 : SchedRead;
  150. def ReadFMinMax32 : SchedRead;
  151. def ReadFMinMax64 : SchedRead;
  152. def ReadFCvtF16ToI32 : SchedRead;
  153. def ReadFCvtF16ToI64 : SchedRead;
  154. def ReadFCvtF32ToI32 : SchedRead;
  155. def ReadFCvtF32ToI64 : SchedRead;
  156. def ReadFCvtF64ToI32 : SchedRead;
  157. def ReadFCvtF64ToI64 : SchedRead;
  158. def ReadFCvtI32ToF16 : SchedRead;
  159. def ReadFCvtI32ToF32 : SchedRead;
  160. def ReadFCvtI32ToF64 : SchedRead;
  161. def ReadFCvtI64ToF16 : SchedRead;
  162. def ReadFCvtI64ToF32 : SchedRead;
  163. def ReadFCvtI64ToF64 : SchedRead;
  164. def ReadFMovF16ToI16 : SchedRead;
  165. def ReadFMovI16ToF16 : SchedRead;
  166. def ReadFMovF32ToI32 : SchedRead;
  167. def ReadFMovI32ToF32 : SchedRead;
  168. def ReadFMovF64ToI64 : SchedRead;
  169. def ReadFMovI64ToF64 : SchedRead;
  170. def ReadFCvtF32ToF64 : SchedRead;
  171. def ReadFCvtF64ToF32 : SchedRead;
  172. def ReadFCvtF16ToF32 : SchedRead;
  173. def ReadFCvtF32ToF16 : SchedRead;
  174. def ReadFCvtF16ToF64 : SchedRead;
  175. def ReadFCvtF64ToF16 : SchedRead;
  176. def ReadFClass16 : SchedRead;
  177. def ReadFClass32 : SchedRead;
  178. def ReadFClass64 : SchedRead;
  179. multiclass UnsupportedSchedZfh {
  180. let Unsupported = true in {
  181. def : WriteRes<WriteFAdd16, []>;
  182. def : WriteRes<WriteFClass16, []>;
  183. def : WriteRes<WriteFCvtF16ToF64, []>;
  184. def : WriteRes<WriteFCvtF64ToF16, []>;
  185. def : WriteRes<WriteFCvtI64ToF16, []>;
  186. def : WriteRes<WriteFCvtF32ToF16, []>;
  187. def : WriteRes<WriteFCvtI32ToF16, []>;
  188. def : WriteRes<WriteFCvtF16ToI64, []>;
  189. def : WriteRes<WriteFCvtF16ToF32, []>;
  190. def : WriteRes<WriteFCvtF16ToI32, []>;
  191. def : WriteRes<WriteFDiv16, []>;
  192. def : WriteRes<WriteFCmp16, []>;
  193. def : WriteRes<WriteFLD16, []>;
  194. def : WriteRes<WriteFMA16, []>;
  195. def : WriteRes<WriteFMinMax16, []>;
  196. def : WriteRes<WriteFMul16, []>;
  197. def : WriteRes<WriteFMovI16ToF16, []>;
  198. def : WriteRes<WriteFMovF16ToI16, []>;
  199. def : WriteRes<WriteFSGNJ16, []>;
  200. def : WriteRes<WriteFST16, []>;
  201. def : WriteRes<WriteFSqrt16, []>;
  202. def : ReadAdvance<ReadFAdd16, 0>;
  203. def : ReadAdvance<ReadFClass16, 0>;
  204. def : ReadAdvance<ReadFCvtF16ToF64, 0>;
  205. def : ReadAdvance<ReadFCvtF64ToF16, 0>;
  206. def : ReadAdvance<ReadFCvtI64ToF16, 0>;
  207. def : ReadAdvance<ReadFCvtF32ToF16, 0>;
  208. def : ReadAdvance<ReadFCvtI32ToF16, 0>;
  209. def : ReadAdvance<ReadFCvtF16ToI64, 0>;
  210. def : ReadAdvance<ReadFCvtF16ToF32, 0>;
  211. def : ReadAdvance<ReadFCvtF16ToI32, 0>;
  212. def : ReadAdvance<ReadFDiv16, 0>;
  213. def : ReadAdvance<ReadFCmp16, 0>;
  214. def : ReadAdvance<ReadFMA16, 0>;
  215. def : ReadAdvance<ReadFMinMax16, 0>;
  216. def : ReadAdvance<ReadFMul16, 0>;
  217. def : ReadAdvance<ReadFMovI16ToF16, 0>;
  218. def : ReadAdvance<ReadFMovF16ToI16, 0>;
  219. def : ReadAdvance<ReadFSGNJ16, 0>;
  220. def : ReadAdvance<ReadFSqrt16, 0>;
  221. } // Unsupported = true
  222. }
  223. multiclass UnsupportedSchedSFB {
  224. let Unsupported = true in {
  225. def : WriteRes<WriteSFB, []>;
  226. def : ReadAdvance<ReadSFB, 0>;
  227. } // Unsupported = true
  228. }
  229. // Include the scheduler resources for other instruction extensions.
  230. include "RISCVScheduleZb.td"
  231. include "RISCVScheduleV.td"