AArch64SchedExynosM4.td 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. //=- AArch64SchedExynosM4.td - Samsung Exynos M4 Sched 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 machine model for the Samsung Exynos M4 to support
  10. // instruction scheduling and other instruction cost heuristics.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //===----------------------------------------------------------------------===//
  14. // The Exynos-M4 is an advanced superscalar microprocessor with a 6-wide
  15. // in-order stage for decode and dispatch and a wider issue stage.
  16. // The execution units and loads and stores are out-of-order.
  17. def ExynosM4Model : SchedMachineModel {
  18. let IssueWidth = 6; // Up to 6 uops per cycle.
  19. let MicroOpBufferSize = 228; // ROB size.
  20. let LoopMicroOpBufferSize = 48; // Based on the instruction queue size.
  21. let LoadLatency = 4; // Optimistic load cases.
  22. let MispredictPenalty = 16; // Minimum branch misprediction penalty.
  23. let CompleteModel = 1; // Use the default model otherwise.
  24. list<Predicate> UnsupportedFeatures = !listconcat(SVEUnsupported.F,
  25. PAUnsupported.F,
  26. SMEUnsupported.F,
  27. [HasMTE]);
  28. }
  29. //===----------------------------------------------------------------------===//
  30. // Define each kind of processor resource and number available on the Exynos-M4.
  31. let SchedModel = ExynosM4Model in {
  32. def M4UnitA : ProcResource<2>; // Simple integer
  33. def M4UnitC : ProcResource<2>; // Simple and complex integer
  34. let Super = M4UnitC, BufferSize = 1 in
  35. def M4UnitD : ProcResource<1>; // Integer division (inside C0, serialized)
  36. let Super = M4UnitC in
  37. def M4UnitE : ProcResource<1>; // CRC (inside C0)
  38. def M4UnitB : ProcResource<2>; // Branch
  39. def M4UnitL0 : ProcResource<1>; // Load
  40. def M4UnitS0 : ProcResource<1>; // Store
  41. def M4PipeLS : ProcResource<1>; // Load/Store
  42. let Super = M4PipeLS in {
  43. def M4UnitL1 : ProcResource<1>;
  44. def M4UnitS1 : ProcResource<1>;
  45. }
  46. def M4PipeF0 : ProcResource<1>; // FP #0
  47. let Super = M4PipeF0 in {
  48. def M4UnitFMAC0 : ProcResource<1>; // FP multiplication
  49. def M4UnitFADD0 : ProcResource<1>; // Simple FP
  50. def M4UnitFCVT0 : ProcResource<1>; // FP conversion
  51. def M4UnitNALU0 : ProcResource<1>; // Simple vector
  52. def M4UnitNHAD : ProcResource<1>; // Horizontal vector
  53. def M4UnitNMSC : ProcResource<1>; // FP and vector miscellanea
  54. def M4UnitNMUL0 : ProcResource<1>; // Vector multiplication
  55. def M4UnitNSHT0 : ProcResource<1>; // Vector shifting
  56. def M4UnitNSHF0 : ProcResource<1>; // Vector shuffling
  57. def M4UnitNCRY0 : ProcResource<1>; // Cryptographic
  58. }
  59. def M4PipeF1 : ProcResource<1>; // FP #1
  60. let Super = M4PipeF1 in {
  61. def M4UnitFMAC1 : ProcResource<1>; // FP multiplication
  62. def M4UnitFADD1 : ProcResource<1>; // Simple FP
  63. def M4UnitFDIV0 : ProcResource<2>; // FP division (serialized)
  64. def M4UnitFSQR0 : ProcResource<2>; // FP square root (serialized)
  65. def M4UnitFST0 : ProcResource<1>; // FP store
  66. def M4UnitNALU1 : ProcResource<1>; // Simple vector
  67. def M4UnitNSHT1 : ProcResource<1>; // Vector shifting
  68. def M4UnitNSHF1 : ProcResource<1>; // Vector shuffling
  69. }
  70. def M4PipeF2 : ProcResource<1>; // FP #2
  71. let Super = M4PipeF2 in {
  72. def M4UnitFMAC2 : ProcResource<1>; // FP multiplication
  73. def M4UnitFADD2 : ProcResource<1>; // Simple FP
  74. def M4UnitFCVT1 : ProcResource<1>; // FP conversion
  75. def M4UnitFDIV1 : ProcResource<2>; // FP division (serialized)
  76. def M4UnitFSQR1 : ProcResource<2>; // FP square root (serialized)
  77. def M4UnitFST1 : ProcResource<1>; // FP store
  78. def M4UnitNALU2 : ProcResource<1>; // Simple vector
  79. def M4UnitNMUL1 : ProcResource<1>; // Vector multiplication
  80. def M4UnitNSHT2 : ProcResource<1>; // Vector shifting
  81. def M4UnitNCRY1 : ProcResource<1>; // Cryptographic
  82. }
  83. def M4UnitALU : ProcResGroup<[M4UnitA,
  84. M4UnitC]>;
  85. def M4UnitL : ProcResGroup<[M4UnitL0,
  86. M4UnitL1]>;
  87. def M4UnitS : ProcResGroup<[M4UnitS0,
  88. M4UnitS1]>;
  89. def M4UnitFMAC : ProcResGroup<[M4UnitFMAC0,
  90. M4UnitFMAC1,
  91. M4UnitFMAC2]>;
  92. def M4UnitFMACH : ProcResGroup<[M4UnitFMAC0,
  93. M4UnitFMAC1]>;
  94. def M4UnitFADD : ProcResGroup<[M4UnitFADD0,
  95. M4UnitFADD1,
  96. M4UnitFADD2]>;
  97. def M4UnitFADDH : ProcResGroup<[M4UnitFADD0,
  98. M4UnitFADD1]>;
  99. def M4UnitFCVT : ProcResGroup<[M4UnitFCVT0,
  100. M4UnitFCVT1]>;
  101. def M4UnitFCVTH : ProcResGroup<[M4UnitFCVT0]>;
  102. def M4UnitFDIV : ProcResGroup<[M4UnitFDIV0,
  103. M4UnitFDIV1]>;
  104. def M4UnitFDIVH : ProcResGroup<[M4UnitFDIV0]>;
  105. def M4UnitFSQR : ProcResGroup<[M4UnitFSQR0,
  106. M4UnitFSQR1]>;
  107. def M4UnitFSQRH : ProcResGroup<[M4UnitFSQR0]>;
  108. def M4UnitFST : ProcResGroup<[M4UnitFST0,
  109. M4UnitFST1]>;
  110. def M4UnitNALU : ProcResGroup<[M4UnitNALU0,
  111. M4UnitNALU1,
  112. M4UnitNALU2]>;
  113. def M4UnitNALUH : ProcResGroup<[M4UnitNALU0,
  114. M4UnitNALU1]>;
  115. def M4UnitNMUL : ProcResGroup<[M4UnitNMUL0,
  116. M4UnitNMUL1]>;
  117. def M4UnitNSHT : ProcResGroup<[M4UnitNSHT0,
  118. M4UnitNSHT1,
  119. M4UnitNSHT2]>;
  120. def M4UnitNSHF : ProcResGroup<[M4UnitNSHF0,
  121. M4UnitNSHF1]>;
  122. def M4UnitNSHFH : ProcResGroup<[M4UnitNSHF0]>;
  123. def M4UnitNCRY : ProcResGroup<[M4UnitNCRY0,
  124. M4UnitNCRY1]>;
  125. //===----------------------------------------------------------------------===//
  126. // Resources details.
  127. def M4WriteZ0 : SchedWriteRes<[]> { let Latency = 0; }
  128. def M4WriteZ1 : SchedWriteRes<[]> { let Latency = 1;
  129. let NumMicroOps = 0; }
  130. def M4WriteZ4 : SchedWriteRes<[]> { let Latency = 4;
  131. let NumMicroOps = 0; }
  132. def M4WriteA1 : SchedWriteRes<[M4UnitALU]> { let Latency = 1; }
  133. def M4WriteA2 : SchedWriteRes<[M4UnitALU]> { let Latency = 2; }
  134. def M4WriteAA : SchedWriteRes<[M4UnitALU]> { let Latency = 2;
  135. let ResourceCycles = [2]; }
  136. def M4WriteAB : SchedWriteRes<[M4UnitALU,
  137. M4UnitC]> { let Latency = 2;
  138. let NumMicroOps = 2; }
  139. def M4WriteAC : SchedWriteRes<[M4UnitALU,
  140. M4UnitALU,
  141. M4UnitC]> { let Latency = 3;
  142. let NumMicroOps = 3; }
  143. def M4WriteAD : SchedWriteRes<[M4UnitALU,
  144. M4UnitC]> { let Latency = 2;
  145. let NumMicroOps = 2; }
  146. def M4WriteAF : SchedWriteRes<[M4UnitALU]> { let Latency = 2;
  147. let NumMicroOps = 2; }
  148. def M4WriteAU : SchedWriteVariant<[SchedVar<IsCopyIdiomPred, [M4WriteZ0]>,
  149. SchedVar<ExynosArithPred, [M4WriteA1]>,
  150. SchedVar<ExynosLogicExPred, [M4WriteA1]>,
  151. SchedVar<NoSchedPred, [M4WriteAA]>]>;
  152. def M4WriteAV : SchedWriteVariant<[SchedVar<ExynosResetPred, [M4WriteZ0]>,
  153. SchedVar<ExynosArithPred, [M4WriteA1]>,
  154. SchedVar<ExynosLogicExPred, [M4WriteA1]>,
  155. SchedVar<NoSchedPred, [M4WriteAA]>]>;
  156. def M4WriteAX : SchedWriteVariant<[SchedVar<ExynosArithPred, [M4WriteA1]>,
  157. SchedVar<ExynosLogicExPred, [M4WriteA1]>,
  158. SchedVar<NoSchedPred, [M4WriteAA]>]>;
  159. def M4WriteAY : SchedWriteVariant<[SchedVar<ExynosRotateRightImmPred, [M4WriteA1]>,
  160. SchedVar<NoSchedPred, [M4WriteAF]>]>;
  161. def M4WriteB1 : SchedWriteRes<[M4UnitB]> { let Latency = 1; }
  162. def M4WriteBX : SchedWriteVariant<[SchedVar<ExynosBranchLinkLRPred, [M4WriteAC]>,
  163. SchedVar<NoSchedPred, [M4WriteAB]>]>;
  164. def M4WriteC1 : SchedWriteRes<[M4UnitC]> { let Latency = 1; }
  165. def M4WriteC3 : SchedWriteRes<[M4UnitC]> { let Latency = 3; }
  166. def M4WriteCA : SchedWriteRes<[M4UnitC]> { let Latency = 4;
  167. let ResourceCycles = [2]; }
  168. def M4WriteD12 : SchedWriteRes<[M4UnitD]> { let Latency = 12;
  169. let ResourceCycles = [12]; }
  170. def M4WriteD21 : SchedWriteRes<[M4UnitD]> { let Latency = 21;
  171. let ResourceCycles = [21]; }
  172. def M4WriteE2 : SchedWriteRes<[M4UnitE]> { let Latency = 2; }
  173. def M4WriteL4 : SchedWriteRes<[M4UnitL]> { let Latency = 4; }
  174. def M4WriteL5 : SchedWriteRes<[M4UnitL]> { let Latency = 5; }
  175. def M4WriteLA : SchedWriteRes<[M4UnitL,
  176. M4UnitL]> { let Latency = 5;
  177. let NumMicroOps = 1; }
  178. def M4WriteLB : SchedWriteRes<[M4UnitA,
  179. M4UnitL]> { let Latency = 5;
  180. let NumMicroOps = 2; }
  181. def M4WriteLC : SchedWriteRes<[M4UnitA,
  182. M4UnitL,
  183. M4UnitL]> { let Latency = 5;
  184. let NumMicroOps = 2; }
  185. def M4WriteLD : SchedWriteRes<[M4UnitA,
  186. M4UnitL]> { let Latency = 4;
  187. let NumMicroOps = 2; }
  188. def M4WriteLE : SchedWriteRes<[M4UnitA,
  189. M4UnitL]> { let Latency = 6;
  190. let NumMicroOps = 2; }
  191. def M4WriteLH : SchedWriteRes<[]> { let Latency = 5;
  192. let NumMicroOps = 0; }
  193. def M4WriteLX : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteL5]>,
  194. SchedVar<NoSchedPred, [M4WriteL4]>]>;
  195. def M4WriteLY : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteLE]>,
  196. SchedVar<NoSchedPred, [M4WriteL5]>]>;
  197. def M4WriteS1 : SchedWriteRes<[M4UnitS]> { let Latency = 1; }
  198. def M4WriteSA : SchedWriteRes<[M4UnitS0]> { let Latency = 3; }
  199. def M4WriteSB : SchedWriteRes<[M4UnitA,
  200. M4UnitS]> { let Latency = 2;
  201. let NumMicroOps = 1; }
  202. def M4WriteSX : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteSB]>,
  203. SchedVar<NoSchedPred, [M4WriteS1]>]>;
  204. def M4ReadAdrBase : SchedReadVariant<[SchedVar<
  205. MCSchedPredicate<
  206. CheckAny<
  207. [ScaledIdxFn,
  208. ExynosScaledIdxFn]>>, [ReadDefault]>,
  209. SchedVar<NoSchedPred, [ReadDefault]>]>;
  210. def M4WriteNEONA : SchedWriteRes<[M4UnitNSHF,
  211. M4UnitFADD]> { let Latency = 3;
  212. let NumMicroOps = 2; }
  213. def M4WriteNEONB : SchedWriteRes<[M4UnitNALU,
  214. M4UnitS0]> { let Latency = 5;
  215. let NumMicroOps = 2; }
  216. def M4WriteNEOND : SchedWriteRes<[M4UnitNSHF,
  217. M4UnitFST]> { let Latency = 6;
  218. let NumMicroOps = 2; }
  219. def M4WriteNEONH : SchedWriteRes<[M4UnitNALU,
  220. M4UnitS0]> { let Latency = 5;
  221. let NumMicroOps = 2; }
  222. def M4WriteNEONI : SchedWriteRes<[M4UnitNSHF,
  223. M4UnitS0]> { let Latency = 2;
  224. let NumMicroOps = 2; }
  225. def M4WriteNEONJ : SchedWriteRes<[M4UnitNMSC,
  226. M4UnitS0]> { let Latency = 4; }
  227. def M4WriteNEONK : SchedWriteRes<[M4UnitNSHF,
  228. M4UnitNMSC,
  229. M4UnitS0]> { let Latency = 5;
  230. let NumMicroOps = 2; }
  231. def M4WriteNEONL : SchedWriteRes<[M4UnitNMUL]> { let Latency = 3; }
  232. def M4WriteNEONN : SchedWriteRes<[M4UnitNMSC,
  233. M4UnitNMSC]> { let Latency = 5;
  234. let NumMicroOps = 2; }
  235. def M4WriteNEONO : SchedWriteRes<[M4UnitNMSC,
  236. M4UnitNMSC,
  237. M4UnitNMSC]> { let Latency = 8;
  238. let NumMicroOps = 3; }
  239. def M4WriteNEONP : SchedWriteRes<[M4UnitNSHF,
  240. M4UnitNMSC]> { let Latency = 4;
  241. let NumMicroOps = 2; }
  242. def M4WriteNEONQ : SchedWriteRes<[M4UnitNMSC,
  243. M4UnitC]> { let Latency = 3;
  244. let NumMicroOps = 1; }
  245. def M4WriteNEONR : SchedWriteRes<[M4UnitFCVT0,
  246. M4UnitS0]> { let Latency = 4;
  247. let NumMicroOps = 1; }
  248. def M4WriteNEONV : SchedWriteRes<[M4UnitFDIV,
  249. M4UnitFDIV]> { let Latency = 7;
  250. let ResourceCycles = [6, 6]; }
  251. def M4WriteNEONVH : SchedWriteRes<[M4UnitFDIVH,
  252. M4UnitFDIVH]> { let Latency = 7;
  253. let ResourceCycles = [6, 6]; }
  254. def M4WriteNEONW : SchedWriteRes<[M4UnitFDIV,
  255. M4UnitFDIV]> { let Latency = 12;
  256. let ResourceCycles = [9, 9]; }
  257. def M4WriteNEONX : SchedWriteRes<[M4UnitFSQR,
  258. M4UnitFSQR]> { let Latency = 8;
  259. let ResourceCycles = [7, 7]; }
  260. def M4WriteNEONXH : SchedWriteRes<[M4UnitFSQRH,
  261. M4UnitFSQRH]> { let Latency = 7;
  262. let ResourceCycles = [6, 6]; }
  263. def M4WriteNEONY : SchedWriteRes<[M4UnitFSQR,
  264. M4UnitFSQR]> { let Latency = 12;
  265. let ResourceCycles = [9, 9]; }
  266. def M4WriteNEONZ : SchedWriteVariant<[SchedVar<ExynosQFormPred, [M4WriteNEONO]>,
  267. SchedVar<NoSchedPred, [M4WriteNEONN]>]>;
  268. def M4WriteFADD2 : SchedWriteRes<[M4UnitFADD]> { let Latency = 2; }
  269. def M4WriteFADD2H : SchedWriteRes<[M4UnitFADDH]> { let Latency = 2; }
  270. def M4WriteFCVT2 : SchedWriteRes<[M4UnitFCVT]> { let Latency = 2; }
  271. def M4WriteFCVT2A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 2; }
  272. def M4WriteFCVT2H : SchedWriteRes<[M4UnitFCVTH]> { let Latency = 2; }
  273. def M4WriteFCVT3 : SchedWriteRes<[M4UnitFCVT]> { let Latency = 3; }
  274. def M4WriteFCVT3A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 3; }
  275. def M4WriteFCVT3H : SchedWriteRes<[M4UnitFCVTH]> { let Latency = 3; }
  276. def M4WriteFCVT4 : SchedWriteRes<[M4UnitFCVT]> { let Latency = 4; }
  277. def M4WriteFCVT4A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 4; }
  278. def M4WriteFCVT6A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 6; }
  279. def M4WriteFDIV7 : SchedWriteRes<[M4UnitFDIV]> { let Latency = 7;
  280. let ResourceCycles = [6]; }
  281. def M4WriteFDIV7H : SchedWriteRes<[M4UnitFDIVH]> { let Latency = 7;
  282. let ResourceCycles = [6]; }
  283. def M4WriteFDIV12 : SchedWriteRes<[M4UnitFDIV]> { let Latency = 12;
  284. let ResourceCycles = [9]; }
  285. def M4WriteFMAC2H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 2; }
  286. def M4WriteFMAC3H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 3; }
  287. def M4WriteFMAC3 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 3; }
  288. def M4WriteFMAC4 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 4; }
  289. def M4WriteFMAC4H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 4; }
  290. def M4WriteFMAC5 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 5; }
  291. def M4WriteFSQR7H : SchedWriteRes<[M4UnitFSQRH]> { let Latency = 7;
  292. let ResourceCycles = [6]; }
  293. def M4WriteFSQR8 : SchedWriteRes<[M4UnitFSQR]> { let Latency = 8;
  294. let ResourceCycles = [7]; }
  295. def M4WriteFSQR12 : SchedWriteRes<[M4UnitFSQR]> { let Latency = 12;
  296. let ResourceCycles = [9]; }
  297. def M4WriteNALU1 : SchedWriteRes<[M4UnitNALU]> { let Latency = 1; }
  298. def M4WriteNALU1H : SchedWriteRes<[M4UnitNALUH]> { let Latency = 1; }
  299. def M4WriteNCRY1 : SchedWriteRes<[M4UnitNCRY]> { let Latency = 1; }
  300. def M4WriteNCRY1A : SchedWriteRes<[M4UnitNCRY0]> { let Latency = 1; }
  301. def M4WriteNCRY3A : SchedWriteRes<[M4UnitNCRY0]> { let Latency = 3; }
  302. def M4WriteNCRY5A : SchedWriteRes<[M4UnitNCRY]> { let Latency = 5; }
  303. def M4WriteNHAD1 : SchedWriteRes<[M4UnitNHAD]> { let Latency = 1; }
  304. def M4WriteNHAD3 : SchedWriteRes<[M4UnitNHAD]> { let Latency = 3; }
  305. def M4WriteNMSC1 : SchedWriteRes<[M4UnitNMSC]> { let Latency = 1; }
  306. def M4WriteNMSC2 : SchedWriteRes<[M4UnitNMSC]> { let Latency = 2; }
  307. def M4WriteNMSC3 : SchedWriteRes<[M4UnitNMSC]> { let Latency = 3; }
  308. def M4WriteNMUL3 : SchedWriteRes<[M4UnitNMUL]> { let Latency = 3; }
  309. def M4WriteNSHF1 : SchedWriteRes<[M4UnitNSHF]> { let Latency = 1; }
  310. def M4WriteNSHF1H : SchedWriteRes<[M4UnitNSHFH]> { let Latency = 1; }
  311. def M4WriteNSHF3 : SchedWriteRes<[M4UnitNSHF]> { let Latency = 3; }
  312. def M4WriteNSHFA : SchedWriteRes<[M4UnitNSHF]> { let Latency = 1;
  313. let ResourceCycles = [2]; }
  314. def M4WriteNSHFB : SchedWriteRes<[M4UnitNSHF]> { let Latency = 2;
  315. let NumMicroOps = 2;
  316. let ResourceCycles = [2]; }
  317. def M4WriteNSHFC : SchedWriteRes<[M4UnitNSHF]> { let Latency = 3;
  318. let NumMicroOps = 3;
  319. let ResourceCycles = [4]; }
  320. def M4WriteNSHFD : SchedWriteRes<[M4UnitNSHF]> { let Latency = 4;
  321. let NumMicroOps = 4;
  322. let ResourceCycles = [4]; }
  323. def M4WriteNSHT1 : SchedWriteRes<[M4UnitNSHT]> { let Latency = 1; }
  324. def M4WriteNSHT2 : SchedWriteRes<[M4UnitNSHT]> { let Latency = 2; }
  325. def M4WriteNSHT3 : SchedWriteRes<[M4UnitNSHT]> { let Latency = 3; }
  326. def M4WriteNSHT4A : SchedWriteRes<[M4UnitNSHT1]> { let Latency = 4; }
  327. def M4WriteVLDA : SchedWriteRes<[M4UnitL,
  328. M4UnitL]> { let Latency = 5;
  329. let NumMicroOps = 2; }
  330. def M4WriteVLDB : SchedWriteRes<[M4UnitL,
  331. M4UnitL,
  332. M4UnitL]> { let Latency = 6;
  333. let NumMicroOps = 3; }
  334. def M4WriteVLDC : SchedWriteRes<[M4UnitL,
  335. M4UnitL,
  336. M4UnitL,
  337. M4UnitL]> { let Latency = 6;
  338. let NumMicroOps = 4; }
  339. def M4WriteVLDD : SchedWriteRes<[M4UnitL,
  340. M4UnitNSHF]> { let Latency = 6;
  341. let NumMicroOps = 2;
  342. let ResourceCycles = [2, 1]; }
  343. def M4WriteVLDF : SchedWriteRes<[M4UnitL,
  344. M4UnitL]> { let Latency = 10;
  345. let NumMicroOps = 2;
  346. let ResourceCycles = [3, 3]; }
  347. def M4WriteVLDG : SchedWriteRes<[M4UnitL,
  348. M4UnitNSHF,
  349. M4UnitNSHF]> { let Latency = 6;
  350. let NumMicroOps = 3;
  351. let ResourceCycles = [2, 1, 1]; }
  352. def M4WriteVLDI : SchedWriteRes<[M4UnitL,
  353. M4UnitL,
  354. M4UnitL]> { let Latency = 12;
  355. let NumMicroOps = 3;
  356. let ResourceCycles = [3, 3, 3]; }
  357. def M4WriteVLDJ : SchedWriteRes<[M4UnitL,
  358. M4UnitNSHF,
  359. M4UnitNSHF,
  360. M4UnitNSHF]> { let Latency = 7;
  361. let NumMicroOps = 4;
  362. let ResourceCycles = [3, 1, 1, 1]; }
  363. def M4WriteVLDK : SchedWriteRes<[M4UnitL,
  364. M4UnitNSHF,
  365. M4UnitNSHF,
  366. M4UnitNSHF,
  367. M4UnitNSHF]> { let Latency = 7;
  368. let NumMicroOps = 5;
  369. let ResourceCycles = [3, 1, 1, 1, 1]; }
  370. def M4WriteVLDL : SchedWriteRes<[M4UnitL,
  371. M4UnitNSHF,
  372. M4UnitNSHF,
  373. M4UnitL,
  374. M4UnitNSHF]> { let Latency = 7;
  375. let NumMicroOps = 5;
  376. let ResourceCycles = [3, 1, 1, 6, 1]; }
  377. def M4WriteVLDM : SchedWriteRes<[M4UnitL,
  378. M4UnitNSHF,
  379. M4UnitNSHF,
  380. M4UnitL,
  381. M4UnitNSHF,
  382. M4UnitNSHF]> { let Latency = 7;
  383. let NumMicroOps = 6;
  384. let ResourceCycles = [3, 1, 1, 3, 1, 1]; }
  385. def M4WriteVLDN : SchedWriteRes<[M4UnitL,
  386. M4UnitL,
  387. M4UnitL,
  388. M4UnitL]> { let Latency = 14;
  389. let NumMicroOps = 4;
  390. let ResourceCycles = [3, 3, 3, 3]; }
  391. def M4WriteVST1 : SchedWriteRes<[M4UnitS,
  392. M4UnitFST]> { let Latency = 1;
  393. let NumMicroOps = 1; }
  394. def M4WriteVSTA : WriteSequence<[WriteVST], 2>;
  395. def M4WriteVSTB : WriteSequence<[WriteVST], 3>;
  396. def M4WriteVSTC : WriteSequence<[WriteVST], 4>;
  397. def M4WriteVSTD : SchedWriteRes<[M4UnitS,
  398. M4UnitFST]> { let Latency = 2; }
  399. def M4WriteVSTE : SchedWriteRes<[M4UnitS,
  400. M4UnitFST,
  401. M4UnitS,
  402. M4UnitFST]> { let Latency = 2;
  403. let NumMicroOps = 2; }
  404. def M4WriteVSTF : SchedWriteRes<[M4UnitNSHF,
  405. M4UnitS,
  406. M4UnitFST,
  407. M4UnitS,
  408. M4UnitFST]> { let Latency = 4;
  409. let NumMicroOps = 4;
  410. let ResourceCycles = [1, 2, 1, 2, 1]; }
  411. def M4WriteVSTG : SchedWriteRes<[M4UnitNSHF,
  412. M4UnitNSHF,
  413. M4UnitNSHF,
  414. M4UnitS,
  415. M4UnitFST,
  416. M4UnitS,
  417. M4UnitFST,
  418. M4UnitS,
  419. M4UnitFST]> { let Latency = 5;
  420. let NumMicroOps = 6;
  421. let ResourceCycles = [1, 1, 1, 2, 1, 2, 1, 2, 1]; }
  422. def M4WriteVSTI : SchedWriteRes<[M4UnitNSHF,
  423. M4UnitNSHF,
  424. M4UnitNSHF,
  425. M4UnitNSHF,
  426. M4UnitS,
  427. M4UnitFST,
  428. M4UnitS,
  429. M4UnitFST,
  430. M4UnitS,
  431. M4UnitFST,
  432. M4UnitS,
  433. M4UnitFST]> { let Latency = 8;
  434. let NumMicroOps = 5;
  435. let ResourceCycles = [1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1]; }
  436. def M4WriteVSTJ : SchedWriteRes<[M4UnitA,
  437. M4UnitS,
  438. M4UnitFST,
  439. M4UnitS,
  440. M4UnitFST]> { let Latency = 1;
  441. let NumMicroOps = 2; }
  442. def M4WriteVSTK : SchedWriteRes<[M4UnitA,
  443. M4UnitS,
  444. M4UnitFST]> { let Latency = 3;
  445. let NumMicroOps = 2; }
  446. def M4WriteVSTL : SchedWriteRes<[M4UnitNSHF,
  447. M4UnitNSHF,
  448. M4UnitS,
  449. M4UnitFST,
  450. M4UnitS,
  451. M4UnitFST]> { let Latency = 4;
  452. let NumMicroOps = 4;
  453. let ResourceCycles = [1, 1, 2, 1, 2, 1]; }
  454. def M4WriteVSTY : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteVSTK]>,
  455. SchedVar<NoSchedPred, [WriteVST]>]>;
  456. // Special cases.
  457. def M4WriteCOPY : SchedWriteVariant<[SchedVar<ExynosFPPred, [M4WriteNALU1]>,
  458. SchedVar<NoSchedPred, [M4WriteZ0]>]>;
  459. def M4WriteMOVI : SchedWriteVariant<[SchedVar<IsZeroFPIdiomPred, [M4WriteZ0]>,
  460. SchedVar<NoSchedPred, [M4WriteNALU1]>]>;
  461. // Fast forwarding.
  462. def M4ReadAESM1 : SchedReadAdvance<+1, [M4WriteNCRY1]>;
  463. def M4ReadFMACM1 : SchedReadAdvance<+1, [M4WriteFMAC4,
  464. M4WriteFMAC4H,
  465. M4WriteFMAC5]>;
  466. def M4ReadNMULM1 : SchedReadAdvance<+1, [M4WriteNMUL3]>;
  467. def M4ReadNMULP2 : SchedReadAdvance<-2, [M4WriteNMUL3]>;
  468. //===----------------------------------------------------------------------===//
  469. // Coarse scheduling model.
  470. // Branch instructions.
  471. def : SchedAlias<WriteBr, M4WriteZ0>;
  472. def : SchedAlias<WriteBrReg, M4WriteC1>;
  473. // Arithmetic and logical integer instructions.
  474. def : SchedAlias<WriteI, M4WriteA1>;
  475. def : SchedAlias<WriteIEReg, M4WriteAA>; // FIXME: M4WriteAX crashes TableGen.
  476. def : SchedAlias<WriteISReg, M4WriteAA>; // FIXME: M4WriteAX crashes TableGen.
  477. def : SchedAlias<WriteIS, M4WriteA1>;
  478. // Move instructions.
  479. def : SchedAlias<WriteImm, M4WriteA1>;
  480. // Divide and multiply instructions.
  481. def : SchedAlias<WriteID32, M4WriteD12>;
  482. def : SchedAlias<WriteID64, M4WriteD21>;
  483. def : SchedAlias<WriteIM32, M4WriteC3>;
  484. def : SchedAlias<WriteIM64, M4WriteCA>;
  485. // Miscellaneous instructions.
  486. def : SchedAlias<WriteExtr, M4WriteAY>;
  487. // Addressing modes.
  488. def : SchedAlias<WriteAdr, M4WriteZ1>;
  489. def : SchedAlias<ReadAdrBase, M4ReadAdrBase>;
  490. // Load instructions.
  491. def : SchedAlias<WriteLD, M4WriteL4>;
  492. def : SchedAlias<WriteLDHi, M4WriteZ4>;
  493. def : SchedAlias<WriteLDIdx, M4WriteLX>;
  494. // Store instructions.
  495. def : SchedAlias<WriteST, M4WriteS1>;
  496. def : SchedAlias<WriteSTP, M4WriteS1>;
  497. def : SchedAlias<WriteSTX, M4WriteS1>;
  498. def : SchedAlias<WriteSTIdx, M4WriteSX>;
  499. // FP data instructions.
  500. def : SchedAlias<WriteF, M4WriteFADD2>;
  501. def : SchedAlias<WriteFCmp, M4WriteNMSC2>;
  502. def : SchedAlias<WriteFDiv, M4WriteFDIV12>;
  503. def : SchedAlias<WriteFMul, M4WriteFMAC3>;
  504. // FP miscellaneous instructions.
  505. def : SchedAlias<WriteFCvt, M4WriteFCVT2>;
  506. def : SchedAlias<WriteFImm, M4WriteNALU1>;
  507. def : SchedAlias<WriteFCopy, M4WriteNALU1>;
  508. // FP load instructions.
  509. def : SchedAlias<WriteVLD, M4WriteL5>;
  510. // FP store instructions.
  511. def : SchedAlias<WriteVST, M4WriteVST1>;
  512. // ASIMD FP instructions.
  513. def : SchedAlias<WriteVd, M4WriteNALU1>;
  514. def : SchedAlias<WriteVq, M4WriteNALU1>;
  515. // Other miscellaneous instructions.
  516. def : WriteRes<WriteAtomic, []> { let Unsupported = 1; }
  517. def : WriteRes<WriteBarrier, []> { let Latency = 1; }
  518. def : WriteRes<WriteHint, []> { let Latency = 1; }
  519. def : WriteRes<WriteSys, []> { let Latency = 1; }
  520. //===----------------------------------------------------------------------===//
  521. // Generic fast forwarding.
  522. // TODO: Add FP register forwarding rules.
  523. def : ReadAdvance<ReadI, 0>;
  524. def : ReadAdvance<ReadISReg, 0>;
  525. def : ReadAdvance<ReadIEReg, 0>;
  526. def : ReadAdvance<ReadIM, 0>;
  527. // TODO: The forwarding for 32 bits actually saves 2 cycles.
  528. def : ReadAdvance<ReadIMA, 3, [WriteIM32, WriteIM64]>;
  529. def : ReadAdvance<ReadID, 0>;
  530. def : ReadAdvance<ReadExtrHi, 0>;
  531. def : ReadAdvance<ReadAdrBase, 0>;
  532. def : ReadAdvance<ReadVLD, 0>;
  533. def : ReadAdvance<ReadST, 0>;
  534. //===----------------------------------------------------------------------===//
  535. // Finer scheduling model.
  536. // Branch instructions
  537. def : InstRW<[M4WriteB1], (instrs Bcc)>;
  538. def : InstRW<[M4WriteAF], (instrs BL)>;
  539. def : InstRW<[M4WriteBX], (instrs BLR)>;
  540. def : InstRW<[M4WriteC1], (instregex "^CBN?Z[WX]")>;
  541. def : InstRW<[M4WriteAD], (instregex "^TBN?Z[WX]")>;
  542. // Arithmetic and logical integer instructions.
  543. def : InstRW<[M4WriteAX], (instregex "^(ADD|AND|BIC|EON|EOR|ORN|SUB)[WX]rs$")>;
  544. def : InstRW<[M4WriteAU], (instrs ORRWrs, ORRXrs)>;
  545. def : InstRW<[M4WriteAX], (instregex "^(ADD|AND|BIC|SUB)S[WX]rs$")>;
  546. def : InstRW<[M4WriteAX], (instregex "^(ADD|SUB)S?[WX]rx(64)?$")>;
  547. def : InstRW<[M4WriteAV], (instrs ADDWri, ADDXri, ORRWri, ORRXri)>;
  548. // Move instructions.
  549. def : InstRW<[M4WriteCOPY], (instrs COPY)>;
  550. def : InstRW<[M4WriteZ0], (instrs ADR, ADRP)>;
  551. def : InstRW<[M4WriteZ0], (instregex "^MOV[NZ][WX]i")>;
  552. // Divide and multiply instructions.
  553. // Miscellaneous instructions.
  554. // Load instructions.
  555. def : InstRW<[M4WriteLD,
  556. WriteLDHi,
  557. WriteAdr], (instregex "^LDP(SW|W|X)(post|pre)")>;
  558. def : InstRW<[M4WriteL5,
  559. ReadAdrBase], (instregex "^LDR(BB|SBW|SBX|HH|SHW|SHX|SW|W|X)roW")>;
  560. def : InstRW<[WriteLDIdx,
  561. ReadAdrBase], (instregex "^LDR(BB|SBW|SBX|HH|SHW|SHX|SW|W|X)roX")>;
  562. def : InstRW<[M4WriteL5,
  563. ReadAdrBase], (instrs PRFMroW)>;
  564. def : InstRW<[WriteLDIdx,
  565. ReadAdrBase], (instrs PRFMroX)>;
  566. // Store instructions.
  567. def : InstRW<[M4WriteSB,
  568. ReadAdrBase], (instregex "^STR(BB|HH|W|X)roW")>;
  569. def : InstRW<[WriteST,
  570. ReadAdrBase], (instregex "^STR(BB|HH|W|X)roX")>;
  571. // FP data instructions.
  572. def : InstRW<[M4WriteNSHF1H], (instrs FABSHr)>;
  573. def : InstRW<[M4WriteNSHF1], (instregex "^FABS[SD]r")>;
  574. def : InstRW<[M4WriteFADD2H], (instregex "^F(ADD|SUB)Hrr")>;
  575. def : InstRW<[M4WriteFADD2], (instregex "^F(ADD|SUB)[SD]rr")>;
  576. def : InstRW<[M4WriteFADD2H], (instregex "^FADDPv.i16")>;
  577. def : InstRW<[M4WriteFADD2], (instregex "^FADDPv.i(32|64)")>;
  578. def : InstRW<[M4WriteNEONQ], (instregex "^FCCMPE?[HSD]rr")>;
  579. def : InstRW<[M4WriteNMSC2], (instregex "^FCMPE?[HSD]r[ir]")>;
  580. def : InstRW<[M4WriteNMSC1], (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)(16|32|64|v1)")>;
  581. def : InstRW<[M4WriteFDIV7H], (instrs FDIVHrr)>;
  582. def : InstRW<[M4WriteFDIV7], (instrs FDIVSrr)>;
  583. def : InstRW<[M4WriteFDIV12], (instrs FDIVDrr)>;
  584. def : InstRW<[M4WriteNMSC1], (instregex "^F(MAX|MIN)(NM)?[HSD]rr")>;
  585. def : InstRW<[M4WriteFMAC3H], (instregex "^FN?MULHrr")>;
  586. def : InstRW<[M4WriteFMAC3], (instregex "^FN?MUL[SD]rr")>;
  587. def : InstRW<[M4WriteFMAC3H], (instrs FMULX16)>;
  588. def : InstRW<[M4WriteFMAC3], (instregex "^FMULX(32|64)")>;
  589. def : InstRW<[M4WriteFMAC4H,
  590. M4ReadFMACM1], (instregex "^FN?M(ADD|SUB)Hrrr")>;
  591. def : InstRW<[M4WriteFMAC4,
  592. M4ReadFMACM1], (instregex "^FN?M(ADD|SUB)[SD]rrr")>;
  593. def : InstRW<[M4WriteNALU1H], (instrs FNEGHr)>;
  594. def : InstRW<[M4WriteNALU1], (instregex "^FNEG[SD]r")>;
  595. def : InstRW<[M4WriteFCVT3A], (instregex "^FRINT.+r")>;
  596. def : InstRW<[M4WriteNEONH], (instregex "^FCSEL[HSD]rrr")>;
  597. def : InstRW<[M4WriteFSQR7H], (instrs FSQRTHr)>;
  598. def : InstRW<[M4WriteFSQR8], (instrs FSQRTSr)>;
  599. def : InstRW<[M4WriteFSQR12], (instrs FSQRTDr)>;
  600. // FP miscellaneous instructions.
  601. def : InstRW<[M4WriteFCVT2H], (instregex "^FCVTH[SD]r")>;
  602. def : InstRW<[M4WriteFCVT2H], (instregex "^FCVT[SD]Hr")>;
  603. def : InstRW<[M4WriteFCVT2], (instregex "^FCVT[SD][SD]r")>;
  604. def : InstRW<[M4WriteFCVT6A], (instregex "^[SU]CVTF[SU][XW][HSD]ri")>;
  605. def : InstRW<[M4WriteNEONR], (instregex "^FCVT[AMNPZ][SU][SU][XW][HSD]r")>;
  606. def : InstRW<[M4WriteNALU1], (instregex "^FMOV[HSD][ir]")>;
  607. def : InstRW<[M4WriteSA], (instregex "^FMOV[WX][HSD]r")>;
  608. def : InstRW<[M4WriteNEONJ], (instregex "^FMOV[HSD][WX]r")>;
  609. def : InstRW<[M4WriteNEONI], (instregex "^FMOVXDHighr")>;
  610. def : InstRW<[M4WriteNEONK], (instregex "^FMOVDXHighr")>;
  611. def : InstRW<[M4WriteFCVT3H], (instregex "^F(RECP|RSQRT)Ev1f16")>;
  612. def : InstRW<[M4WriteFCVT3], (instregex "^F(RECP|RSQRT)Ev1i(32|64)")>;
  613. def : InstRW<[M4WriteNMSC1], (instregex "^FRECPXv1")>;
  614. def : InstRW<[M4WriteFMAC4H], (instregex "^F(RECP|RSQRT)S16")>;
  615. def : InstRW<[M4WriteFMAC4], (instregex "^F(RECP|RSQRT)S(32|64)")>;
  616. // FP load instructions.
  617. def : InstRW<[WriteVLD], (instregex "^LDR[SDQ]l")>;
  618. def : InstRW<[WriteVLD], (instregex "^LDUR[BHSDQ]i")>;
  619. def : InstRW<[WriteVLD,
  620. WriteAdr], (instregex "^LDR[BHSDQ](post|pre)")>;
  621. def : InstRW<[WriteVLD], (instregex "^LDR[BHSDQ]ui")>;
  622. def : InstRW<[M4WriteLE,
  623. ReadAdrBase], (instregex "^LDR[BHSDQ]roW")>;
  624. def : InstRW<[WriteVLD,
  625. ReadAdrBase], (instregex "^LDR[BHSD]roX")>;
  626. def : InstRW<[M4WriteLY,
  627. ReadAdrBase], (instrs LDRQroX)>;
  628. def : InstRW<[WriteVLD,
  629. M4WriteLH], (instregex "^LDN?P[SD]i")>;
  630. def : InstRW<[M4WriteLA,
  631. M4WriteLH], (instregex "^LDN?PQi")>;
  632. def : InstRW<[M4WriteL5,
  633. M4WriteLH,
  634. WriteAdr], (instregex "^LDP[SD]post")>;
  635. def : InstRW<[M4WriteLB,
  636. M4WriteLH,
  637. WriteAdr], (instrs LDPQpost)>;
  638. def : InstRW<[M4WriteLB,
  639. M4WriteLH,
  640. WriteAdr], (instregex "^LDP[SD]pre")>;
  641. def : InstRW<[M4WriteLC,
  642. M4WriteLH,
  643. WriteAdr], (instrs LDPQpre)>;
  644. // FP store instructions.
  645. def : InstRW<[WriteVST], (instregex "^STUR[BHSDQ]i")>;
  646. def : InstRW<[WriteVST,
  647. WriteAdr], (instregex "^STR[BHSDQ](post|pre)")>;
  648. def : InstRW<[WriteVST], (instregex "^STR[BHSDQ]ui")>;
  649. def : InstRW<[M4WriteVSTK,
  650. ReadAdrBase], (instregex "^STR[BHSD]roW")>;
  651. def : InstRW<[M4WriteVSTK,
  652. ReadAdrBase], (instrs STRQroW)>;
  653. def : InstRW<[WriteVST,
  654. ReadAdrBase], (instregex "^STR[BHSD]roX")>;
  655. def : InstRW<[M4WriteVSTY,
  656. ReadAdrBase], (instrs STRQroX)>;
  657. def : InstRW<[WriteVST], (instregex "^STN?P[SD]i")>;
  658. def : InstRW<[M4WriteVSTJ], (instregex "^STN?PQi")>;
  659. def : InstRW<[WriteVST,
  660. WriteAdr], (instregex "^STP[SD](post|pre)")>;
  661. def : InstRW<[M4WriteVSTJ,
  662. WriteAdr], (instregex "^STPQ(post|pre)")>;
  663. // ASIMD instructions.
  664. def : InstRW<[M4WriteNHAD1], (instregex "^[SU]ABDL?v")>;
  665. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]ABAL?v")>;
  666. def : InstRW<[M4WriteNMSC1], (instregex "^ABSv")>;
  667. def : InstRW<[M4WriteNALU1], (instregex "^(ADD|NEG|SUB)v")>;
  668. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]?ADDL?Pv")>;
  669. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]H(ADD|SUB)v")>;
  670. def : InstRW<[M4WriteNHAD3], (instregex "^[SU](ADD|SUB)[LW]v")>;
  671. def : InstRW<[M4WriteNHAD3], (instregex "^R?(ADD|SUB)HN2?v")>;
  672. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]Q(ADD|SUB)v")>;
  673. def : InstRW<[M4WriteNHAD3], (instregex "^(SU|US)QADDv")>;
  674. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]RHADDv")>;
  675. def : InstRW<[M4WriteNMSC1], (instregex "^SQ(ABS|NEG)v")>;
  676. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]?ADDL?Vv")>;
  677. def : InstRW<[M4WriteNMSC1], (instregex "^CM(EQ|GE|GT|HI|HS|LE|LT)v")>;
  678. def : InstRW<[M4WriteNALU1], (instregex "^CMTSTv")>;
  679. def : InstRW<[M4WriteNALU1], (instregex "^(AND|BIC|EOR|NOT|ORN|ORR)v")>;
  680. def : InstRW<[M4WriteNMSC1], (instregex "^[SU](MIN|MAX)v")>;
  681. def : InstRW<[M4WriteNMSC2], (instregex "^[SU](MIN|MAX)Pv")>;
  682. def : InstRW<[M4WriteNHAD3], (instregex "^[SU](MIN|MAX)Vv")>;
  683. def : InstRW<[M4WriteNMUL3,
  684. M4ReadNMULM1], (instregex "^ML[AS]v")>;
  685. def : InstRW<[M4WriteNMUL3,
  686. M4ReadNMULM1], (instregex "^(SQR?D)?MULH?v")>;
  687. def : InstRW<[M4WriteNMUL3,
  688. M4ReadNMULM1], (instregex "^SQRDML[AS]H")>;
  689. def : InstRW<[M4WriteNMUL3,
  690. M4ReadNMULM1], (instregex "^(S|U|SQD)ML[AS]L(v1(i32|i64)|v2i32|v4i16|v8i8)")>;
  691. def : InstRW<[M4WriteNMUL3,
  692. M4ReadNMULP2], (instregex "^(S|U|SQD)ML[AS]L(v4i32|v8i16|v16i8)")>;
  693. def : InstRW<[M4WriteNMUL3,
  694. M4ReadNMULM1], (instregex "^(S|U|SQD)MULL(v1(i32|i64)|v2i32|v4i16|v8i8)")>;
  695. def : InstRW<[M4WriteNMUL3,
  696. M4ReadNMULP2], (instregex "^(S|U|SQD)MULL(v4i32|v8i16|v16i8)")>;
  697. def : InstRW<[M4WriteNMUL3], (instregex "^[SU]DOT(lane)?v")>;
  698. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]ADALPv")>;
  699. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]R?SRA[dv]")>;
  700. def : InstRW<[M4WriteNSHT1], (instregex "^SHL[dv]")>;
  701. def : InstRW<[M4WriteNSHT1], (instregex "^S[LR]I[dv]")>;
  702. def : InstRW<[M4WriteNSHT1], (instregex "^[SU]SH[LR][dv]")>;
  703. def : InstRW<[M4WriteNSHT2], (instregex "^[SU]?SHLLv")>;
  704. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]?Q?R?SHRU?N[bhsv]")>;
  705. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]RSH[LR][dv]")>;
  706. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]QR?SHLU?[bhsdv]")>;
  707. // ASIMD FP instructions.
  708. def : InstRW<[M4WriteNSHF1H], (instregex "^FABSv.f16")>;
  709. def : InstRW<[M4WriteNSHF1], (instregex "^FABSv.f(32|64)")>;
  710. def : InstRW<[M4WriteFADD2H], (instregex "^F(ABD|ADD|SUB)v.f16")>;
  711. def : InstRW<[M4WriteFADD2], (instregex "^F(ABD|ADD|SUB)v.f(32|64)")>;
  712. def : InstRW<[M4WriteFADD2H], (instregex "^FADDPv.f16")>;
  713. def : InstRW<[M4WriteFADD2], (instregex "^FADDPv.f(32|64)")>;
  714. def : InstRW<[M4WriteNMSC1], (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)v[^1]")>;
  715. def : InstRW<[M4WriteFCVT2], (instregex "^FCVT(L|N|XN)v")>;
  716. def : InstRW<[M4WriteFCVT2A], (instregex "^FCVT[AMNPZ][SU]v")>;
  717. def : InstRW<[M4WriteFCVT2H], (instregex "^[SU]CVTFv.[fi]16")>;
  718. def : InstRW<[M4WriteFCVT2], (instregex "^[SU]CVTFv.[fi](32|64)")>;
  719. def : InstRW<[M4WriteFDIV7H], (instrs FDIVv4f16)>;
  720. def : InstRW<[M4WriteNEONVH], (instrs FDIVv8f16)>;
  721. def : InstRW<[M4WriteFDIV7], (instrs FDIVv2f32)>;
  722. def : InstRW<[M4WriteNEONV], (instrs FDIVv4f32)>;
  723. def : InstRW<[M4WriteNEONW], (instrs FDIVv2f64)>;
  724. def : InstRW<[M4WriteNMSC1], (instregex "^F(MAX|MIN)(NM)?v")>;
  725. def : InstRW<[M4WriteNMSC2], (instregex "^F(MAX|MIN)(NM)?Pv")>;
  726. def : InstRW<[M4WriteNEONZ], (instregex "^F(MAX|MIN)(NM)?Vv")>;
  727. def : InstRW<[M4WriteFMAC2H], (instregex "^FMULX?v.[fi]16")>;
  728. def : InstRW<[M4WriteFMAC3], (instregex "^FMULX?v.[fi](32|64)")>;
  729. def : InstRW<[M4WriteFMAC4H,
  730. M4ReadFMACM1], (instregex "^FML[AS]v.[fi]16")>;
  731. def : InstRW<[M4WriteFMAC4,
  732. M4ReadFMACM1], (instregex "^FML[AS]v.[fi](32|64)")>;
  733. def : InstRW<[M4WriteNALU1H], (instregex "^FNEGv.f16")>;
  734. def : InstRW<[M4WriteNALU1], (instregex "^FNEGv.f(32|64)")>;
  735. def : InstRW<[M4WriteFCVT3A], (instregex "^FRINT[AIMNPXZ]v")>;
  736. def : InstRW<[M4WriteFSQR7H], (instrs FSQRTv4f16)>;
  737. def : InstRW<[M4WriteNEONXH], (instrs FSQRTv8f16)>;
  738. def : InstRW<[M4WriteFSQR8], (instrs FSQRTv2f32)>;
  739. def : InstRW<[M4WriteNEONX], (instrs FSQRTv4f32)>;
  740. def : InstRW<[M4WriteNEONY], (instrs FSQRTv2f64)>;
  741. // ASIMD miscellaneous instructions.
  742. def : InstRW<[M4WriteNALU1], (instregex "^RBITv")>;
  743. def : InstRW<[M4WriteNALU1], (instregex "^(BIF|BIT|BSL|BSP)v")>;
  744. def : InstRW<[M4WriteNALU1], (instregex "^CL[STZ]v")>;
  745. def : InstRW<[M4WriteNEONB], (instregex "^DUPv.+gpr")>;
  746. def : InstRW<[M4WriteNSHF1], (instregex "^DUP(i8|i16|i32|i64)$")>;
  747. def : InstRW<[M4WriteNSHF1], (instregex "^DUPv.+lane")>;
  748. def : InstRW<[M4WriteNSHF1], (instregex "^EXTv")>;
  749. def : InstRW<[M4WriteNSHT4A], (instregex "^XTNv")>;
  750. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]?QXTU?Nv")>;
  751. def : InstRW<[M4WriteNEONB], (instregex "^INSv.+gpr")>;
  752. def : InstRW<[M4WriteNSHF1], (instregex "^INSv.+lane")>;
  753. def : InstRW<[M4WriteMOVI], (instregex "^(MOV|MVN)I")>;
  754. def : InstRW<[M4WriteNALU1H], (instregex "^FMOVv.f16")>;
  755. def : InstRW<[M4WriteNALU1], (instregex "^FMOVv.f(32|64)")>;
  756. def : InstRW<[M4WriteFCVT3H], (instregex "^F(RECP|RSQRT)Ev[248]f16")>;
  757. def : InstRW<[M4WriteFCVT3], (instregex "^F(RECP|RSQRT)Ev[248]f(32|64)")>;
  758. def : InstRW<[M4WriteFCVT3], (instregex "^U(RECP|RSQRT)Ev[24]i32")>;
  759. def : InstRW<[M4WriteFMAC4H], (instregex "^F(RECP|RSQRT)Sv.f16")>;
  760. def : InstRW<[M4WriteFMAC4], (instregex "^F(RECP|RSQRT)Sv.f(32|64)")>;
  761. def : InstRW<[M4WriteNSHF1], (instregex "^REV(16|32|64)v")>;
  762. def : InstRW<[M4WriteNSHFA], (instregex "^TB[LX]v(8|16)i8One")>;
  763. def : InstRW<[M4WriteNSHFB], (instregex "^TB[LX]v(8|16)i8Two")>;
  764. def : InstRW<[M4WriteNSHFC], (instregex "^TB[LX]v(8|16)i8Three")>;
  765. def : InstRW<[M4WriteNSHFD], (instregex "^TB[LX]v(8|16)i8Four")>;
  766. def : InstRW<[M4WriteNEONP], (instregex "^[SU]MOVv")>;
  767. def : InstRW<[M4WriteNSHF1], (instregex "^(TRN|UZP|ZIP)[12]v")>;
  768. // ASIMD load instructions.
  769. def : InstRW<[WriteVLD], (instregex "LD1Onev(8b|4h|2s|1d)$")>;
  770. def : InstRW<[WriteVLD,
  771. M4WriteA1], (instregex "LD1Onev(8b|4h|2s|1d)_POST$")>;
  772. def : InstRW<[WriteVLD], (instregex "LD1Onev(16b|8h|4s|2d)$")>;
  773. def : InstRW<[WriteVLD,
  774. M4WriteA1], (instregex "LD1Onev(16b|8h|4s|2d)_POST$")>;
  775. def : InstRW<[M4WriteVLDA], (instregex "LD1Twov(8b|4h|2s|1d)$")>;
  776. def : InstRW<[M4WriteVLDA,
  777. M4WriteA1], (instregex "LD1Twov(8b|4h|2s|1d)_POST$")>;
  778. def : InstRW<[M4WriteVLDA], (instregex "LD1Twov(16b|8h|4s|2d)$")>;
  779. def : InstRW<[M4WriteVLDA,
  780. M4WriteA1], (instregex "LD1Twov(16b|8h|4s|2d)_POST$")>;
  781. def : InstRW<[M4WriteVLDB], (instregex "LD1Threev(8b|4h|2s|1d)$")>;
  782. def : InstRW<[M4WriteVLDB,
  783. M4WriteA1], (instregex "LD1Threev(8b|4h|2s|1d)_POST$")>;
  784. def : InstRW<[M4WriteVLDB], (instregex "LD1Threev(16b|8h|4s|2d)$")>;
  785. def : InstRW<[M4WriteVLDB,
  786. M4WriteA1], (instregex "LD1Threev(16b|8h|4s|2d)_POST$")>;
  787. def : InstRW<[M4WriteVLDC], (instregex "LD1Fourv(8b|4h|2s|1d)$")>;
  788. def : InstRW<[M4WriteVLDC,
  789. M4WriteA1], (instregex "LD1Fourv(8b|4h|2s|1d)_POST$")>;
  790. def : InstRW<[M4WriteVLDC], (instregex "LD1Fourv(16b|8h|4s|2d)$")>;
  791. def : InstRW<[M4WriteVLDC,
  792. M4WriteA1], (instregex "LD1Fourv(16b|8h|4s|2d)_POST$")>;
  793. def : InstRW<[M4WriteVLDD], (instregex "LD1i(8|16|32|64)$")>;
  794. def : InstRW<[M4WriteVLDD,
  795. M4WriteA1], (instregex "LD1i(8|16|32|64)_POST$")>;
  796. def : InstRW<[WriteVLD], (instregex "LD1Rv(8b|4h|2s|1d)$")>;
  797. def : InstRW<[WriteVLD,
  798. M4WriteA1], (instregex "LD1Rv(8b|4h|2s|1d)_POST$")>;
  799. def : InstRW<[WriteVLD], (instregex "LD1Rv(16b|8h|4s|2d)$")>;
  800. def : InstRW<[WriteVLD,
  801. M4WriteA1], (instregex "LD1Rv(16b|8h|4s|2d)_POST$")>;
  802. def : InstRW<[M4WriteVLDF], (instregex "LD2Twov(8b|4h|2s)$")>;
  803. def : InstRW<[M4WriteVLDF,
  804. M4WriteA1], (instregex "LD2Twov(8b|4h|2s)_POST$")>;
  805. def : InstRW<[M4WriteVLDF], (instregex "LD2Twov(16b|8h|4s|2d)$")>;
  806. def : InstRW<[M4WriteVLDF,
  807. M4WriteA1], (instregex "LD2Twov(16b|8h|4s|2d)_POST$")>;
  808. def : InstRW<[M4WriteVLDG], (instregex "LD2i(8|16|32|64)$")>;
  809. def : InstRW<[M4WriteVLDG,
  810. M4WriteA1], (instregex "LD2i(8|16|32|64)_POST$")>;
  811. def : InstRW<[M4WriteVLDA], (instregex "LD2Rv(8b|4h|2s|1d)$")>;
  812. def : InstRW<[M4WriteVLDA,
  813. M4WriteA1], (instregex "LD2Rv(8b|4h|2s|1d)_POST$")>;
  814. def : InstRW<[M4WriteVLDA], (instregex "LD2Rv(16b|8h|4s|2d)$")>;
  815. def : InstRW<[M4WriteVLDA,
  816. M4WriteA1], (instregex "LD2Rv(16b|8h|4s|2d)_POST$")>;
  817. def : InstRW<[M4WriteVLDI], (instregex "LD3Threev(8b|4h|2s)$")>;
  818. def : InstRW<[M4WriteVLDI,
  819. M4WriteA1], (instregex "LD3Threev(8b|4h|2s)_POST$")>;
  820. def : InstRW<[M4WriteVLDI], (instregex "LD3Threev(16b|8h|4s|2d)$")>;
  821. def : InstRW<[M4WriteVLDI,
  822. M4WriteA1], (instregex "LD3Threev(16b|8h|4s|2d)_POST$")>;
  823. def : InstRW<[M4WriteVLDJ], (instregex "LD3i(8|16|32)$")>;
  824. def : InstRW<[M4WriteVLDJ,
  825. M4WriteA1], (instregex "LD3i(8|16|32)_POST$")>;
  826. def : InstRW<[M4WriteVLDL], (instregex "LD3i64$")>;
  827. def : InstRW<[M4WriteVLDL,
  828. M4WriteA1], (instregex "LD3i64_POST$")>;
  829. def : InstRW<[M4WriteVLDB], (instregex "LD3Rv(8b|4h|2s|1d)$")>;
  830. def : InstRW<[M4WriteVLDB,
  831. M4WriteA1], (instregex "LD3Rv(8b|4h|2s|1d)_POST$")>;
  832. def : InstRW<[M4WriteVLDB], (instregex "LD3Rv(16b|8h|4s|2d)$")>;
  833. def : InstRW<[M4WriteVLDB,
  834. M4WriteA1], (instregex "LD3Rv(16b|8h|4s|2d)_POST$")>;
  835. def : InstRW<[M4WriteVLDN], (instregex "LD4Fourv(8b|4h|2s)$")>;
  836. def : InstRW<[M4WriteVLDN,
  837. M4WriteA1], (instregex "LD4Fourv(8b|4h|2s)_POST$")>;
  838. def : InstRW<[M4WriteVLDN], (instregex "LD4Fourv(16b|8h|4s|2d)$")>;
  839. def : InstRW<[M4WriteVLDN,
  840. M4WriteA1], (instregex "LD4Fourv(16b|8h|4s|2d)_POST$")>;
  841. def : InstRW<[M4WriteVLDK], (instregex "LD4i(8|16|32)$")>;
  842. def : InstRW<[M4WriteVLDK,
  843. M4WriteA1], (instregex "LD4i(8|16|32)_POST$")>;
  844. def : InstRW<[M4WriteVLDM], (instregex "LD4i64$")>;
  845. def : InstRW<[M4WriteVLDM,
  846. M4WriteA1], (instregex "LD4i64_POST$")>;
  847. def : InstRW<[M4WriteVLDC], (instregex "LD4Rv(8b|4h|2s|1d)$")>;
  848. def : InstRW<[M4WriteVLDC,
  849. M4WriteA1], (instregex "LD4Rv(8b|4h|2s|1d)_POST$")>;
  850. def : InstRW<[M4WriteVLDC], (instregex "LD4Rv(16b|8h|4s|2d)$")>;
  851. def : InstRW<[M4WriteVLDC,
  852. M4WriteA1], (instregex "LD4Rv(16b|8h|4s|2d)_POST$")>;
  853. // ASIMD store instructions.
  854. def : InstRW<[WriteVST], (instregex "ST1Onev(8b|4h|2s|1d)$")>;
  855. def : InstRW<[WriteVST,
  856. M4WriteA1], (instregex "ST1Onev(8b|4h|2s|1d)_POST$")>;
  857. def : InstRW<[WriteVST], (instregex "ST1Onev(16b|8h|4s|2d)$")>;
  858. def : InstRW<[WriteVST,
  859. M4WriteA1], (instregex "ST1Onev(16b|8h|4s|2d)_POST$")>;
  860. def : InstRW<[M4WriteVSTA], (instregex "ST1Twov(8b|4h|2s|1d)$")>;
  861. def : InstRW<[M4WriteVSTA,
  862. M4WriteA1], (instregex "ST1Twov(8b|4h|2s|1d)_POST$")>;
  863. def : InstRW<[M4WriteVSTA], (instregex "ST1Twov(16b|8h|4s|2d)$")>;
  864. def : InstRW<[M4WriteVSTA,
  865. M4WriteA1], (instregex "ST1Twov(16b|8h|4s|2d)_POST$")>;
  866. def : InstRW<[M4WriteVSTB], (instregex "ST1Threev(8b|4h|2s|1d)$")>;
  867. def : InstRW<[M4WriteVSTB,
  868. M4WriteA1], (instregex "ST1Threev(8b|4h|2s|1d)_POST$")>;
  869. def : InstRW<[M4WriteVSTB], (instregex "ST1Threev(16b|8h|4s|2d)$")>;
  870. def : InstRW<[M4WriteVSTB,
  871. M4WriteA1], (instregex "ST1Threev(16b|8h|4s|2d)_POST$")>;
  872. def : InstRW<[M4WriteVSTC], (instregex "ST1Fourv(8b|4h|2s|1d)$")>;
  873. def : InstRW<[M4WriteVSTC,
  874. M4WriteA1], (instregex "ST1Fourv(8b|4h|2s|1d)_POST$")>;
  875. def : InstRW<[M4WriteVSTC], (instregex "ST1Fourv(16b|8h|4s|2d)$")>;
  876. def : InstRW<[M4WriteVSTC,
  877. M4WriteA1], (instregex "ST1Fourv(16b|8h|4s|2d)_POST$")>;
  878. def : InstRW<[WriteVST], (instregex "ST1i(8|16|32|64)$")>;
  879. def : InstRW<[WriteVST,
  880. M4WriteA1], (instregex "ST1i(8|16|32|64)_POST$")>;
  881. def : InstRW<[M4WriteVSTD], (instregex "ST2Twov(8b|4h|2s)$")>;
  882. def : InstRW<[M4WriteVSTD,
  883. M4WriteA1], (instregex "ST2Twov(8b|4h|2s)_POST$")>;
  884. def : InstRW<[M4WriteVSTE], (instregex "ST2Twov(16b|8h|4s|2d)$")>;
  885. def : InstRW<[M4WriteVSTE,
  886. M4WriteA1], (instregex "ST2Twov(16b|8h|4s|2d)_POST$")>;
  887. def : InstRW<[M4WriteVSTD], (instregex "ST2i(8|16|32|64)$")>;
  888. def : InstRW<[M4WriteVSTD,
  889. M4WriteA1], (instregex "ST2i(8|16|32|64)_POST$")>;
  890. def : InstRW<[M4WriteVSTF], (instregex "ST3Threev(8b|4h|2s)$")>;
  891. def : InstRW<[M4WriteVSTF,
  892. M4WriteA1], (instregex "ST3Threev(8b|4h|2s)_POST$")>;
  893. def : InstRW<[M4WriteVSTG], (instregex "ST3Threev(16b|8h|4s|2d)$")>;
  894. def : InstRW<[M4WriteVSTG,
  895. M4WriteA1], (instregex "ST3Threev(16b|8h|4s|2d)_POST$")>;
  896. def : InstRW<[M4WriteVSTE], (instregex "ST3i(8|16|32|64)$")>;
  897. def : InstRW<[M4WriteVSTE,
  898. M4WriteA1], (instregex "ST3i(8|16|32|64)_POST$")>;
  899. def : InstRW<[M4WriteVSTL], (instregex "ST4Fourv(8b|4h|2s)$")>;
  900. def : InstRW<[M4WriteVSTL,
  901. M4WriteA1], (instregex "ST4Fourv(8b|4h|2s)_POST$")>;
  902. def : InstRW<[M4WriteVSTI], (instregex "ST4Fourv(16b|8h|4s|2d)$")>;
  903. def : InstRW<[M4WriteVSTI,
  904. M4WriteA1], (instregex "ST4Fourv(16b|8h|4s|2d)_POST$")>;
  905. def : InstRW<[M4WriteVSTE], (instregex "ST4i(8|16|32|64)$")>;
  906. def : InstRW<[M4WriteVSTE,
  907. M4WriteA1], (instregex "ST4i(8|16|32|64)_POST$")>;
  908. // Cryptography instructions.
  909. def : InstRW<[M4WriteNCRY1], (instregex "^AES[DE]")>;
  910. def : InstRW<[M4WriteNCRY1,
  911. M4ReadAESM1], (instregex "^AESI?MC")>;
  912. def : InstRW<[M4WriteNCRY1A], (instregex "^PMULv")>;
  913. def : InstRW<[M4WriteNCRY1A], (instregex "^PMULLv(1|8)i")>;
  914. def : InstRW<[M4WriteNCRY3A], (instregex "^PMULLv(2|16)i")>;
  915. def : InstRW<[M4WriteNCRY1A], (instregex "^SHA1([CHMP]|SU[01])")>;
  916. def : InstRW<[M4WriteNCRY1A], (instrs SHA256SU0rr)>;
  917. def : InstRW<[M4WriteNCRY5A], (instrs SHA256SU1rrr)>;
  918. def : InstRW<[M4WriteNCRY5A], (instrs SHA256H2rrr)>;
  919. // CRC instructions.
  920. def : InstRW<[M4WriteE2], (instregex "^CRC32C?[BHWX]rr$")>;
  921. } // SchedModel = ExynosM4Model