AArch64SchedThunderX2T99.td 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867
  1. //=- AArch64SchedThunderX2T99.td - Cavium ThunderX T99 ---*- 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 scheduling model for Cavium ThunderX2T99
  10. // processors.
  11. // Based on Broadcom Vulcan.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. //===----------------------------------------------------------------------===//
  15. // 2. Pipeline Description.
  16. def ThunderX2T99Model : SchedMachineModel {
  17. let IssueWidth = 4; // 4 micro-ops dispatched at a time.
  18. let MicroOpBufferSize = 180; // 180 entries in micro-op re-order buffer.
  19. let LoadLatency = 4; // Optimistic load latency.
  20. let MispredictPenalty = 12; // Extra cycles for mispredicted branch.
  21. // Determined via a mix of micro-arch details and experimentation.
  22. let LoopMicroOpBufferSize = 128;
  23. let PostRAScheduler = 1; // Using PostRA sched.
  24. let CompleteModel = 1;
  25. list<Predicate> UnsupportedFeatures = !listconcat(SVEUnsupported.F,
  26. PAUnsupported.F,
  27. SMEUnsupported.F);
  28. // FIXME: Remove when all errors have been fixed.
  29. let FullInstRWOverlapCheck = 0;
  30. }
  31. let SchedModel = ThunderX2T99Model in {
  32. // Define the issue ports.
  33. // Port 0: ALU, FP/SIMD.
  34. def THX2T99P0 : ProcResource<1>;
  35. // Port 1: ALU, FP/SIMD, integer mul/div.
  36. def THX2T99P1 : ProcResource<1>;
  37. // Port 2: ALU, Branch.
  38. def THX2T99P2 : ProcResource<1>;
  39. // Port 3: Store data.
  40. def THX2T99P3 : ProcResource<1>;
  41. // Port 4: Load/store.
  42. def THX2T99P4 : ProcResource<1>;
  43. // Port 5: Load/store.
  44. def THX2T99P5 : ProcResource<1>;
  45. // Define groups for the functional units on each issue port. Each group
  46. // created will be used by a WriteRes later on.
  47. //
  48. // NOTE: Some groups only contain one member. This is a way to create names for
  49. // the various functional units that share a single issue port. For example,
  50. // "THX2T99I1" for ALU ops on port 1 and "THX2T99F1" for FP ops on port 1.
  51. // Integer divide and multiply micro-ops only on port 1.
  52. def THX2T99I1 : ProcResGroup<[THX2T99P1]>;
  53. // Branch micro-ops only on port 2.
  54. def THX2T99I2 : ProcResGroup<[THX2T99P2]>;
  55. // ALU micro-ops on ports 0, 1, and 2.
  56. def THX2T99I012 : ProcResGroup<[THX2T99P0, THX2T99P1, THX2T99P2]>;
  57. // Crypto FP/SIMD micro-ops only on port 1.
  58. def THX2T99F1 : ProcResGroup<[THX2T99P1]>;
  59. // FP/SIMD micro-ops on ports 0 and 1.
  60. def THX2T99F01 : ProcResGroup<[THX2T99P0, THX2T99P1]>;
  61. // Store data micro-ops only on port 3.
  62. def THX2T99SD : ProcResGroup<[THX2T99P3]>;
  63. // Load/store micro-ops on ports 4 and 5.
  64. def THX2T99LS01 : ProcResGroup<[THX2T99P4, THX2T99P5]>;
  65. // 60 entry unified scheduler.
  66. def THX2T99Any : ProcResGroup<[THX2T99P0, THX2T99P1, THX2T99P2,
  67. THX2T99P3, THX2T99P4, THX2T99P5]> {
  68. let BufferSize = 60;
  69. }
  70. // Define commonly used write types for InstRW specializations.
  71. // All definitions follow the format: THX2T99Write_<NumCycles>Cyc_<Resources>.
  72. // 3 cycles on I1.
  73. def THX2T99Write_3Cyc_I1 : SchedWriteRes<[THX2T99I1]> {
  74. let Latency = 3;
  75. let NumMicroOps = 2;
  76. }
  77. // 1 cycles on I2.
  78. def THX2T99Write_1Cyc_I2 : SchedWriteRes<[THX2T99I2]> {
  79. let Latency = 1;
  80. let NumMicroOps = 2;
  81. }
  82. // 4 cycles on I1.
  83. def THX2T99Write_4Cyc_I1 : SchedWriteRes<[THX2T99I1]> {
  84. let Latency = 4;
  85. let NumMicroOps = 2;
  86. }
  87. // 23 cycles on I1.
  88. def THX2T99Write_23Cyc_I1 : SchedWriteRes<[THX2T99I1]> {
  89. let Latency = 23;
  90. let ResourceCycles = [13, 23];
  91. let NumMicroOps = 4;
  92. }
  93. // 39 cycles on I1.
  94. def THX2T99Write_39Cyc_I1 : SchedWriteRes<[THX2T99I1]> {
  95. let Latency = 39;
  96. let ResourceCycles = [13, 39];
  97. let NumMicroOps = 4;
  98. }
  99. // 1 cycle on I0, I1, or I2.
  100. def THX2T99Write_1Cyc_I012 : SchedWriteRes<[THX2T99I012]> {
  101. let Latency = 1;
  102. let NumMicroOps = 2;
  103. }
  104. // 2 cycles on I0, I1, or I2.
  105. def THX2T99Write_2Cyc_I012 : SchedWriteRes<[THX2T99I012]> {
  106. let Latency = 2;
  107. let NumMicroOps = 2;
  108. }
  109. // 4 cycles on I0, I1, or I2.
  110. def THX2T99Write_4Cyc_I012 : SchedWriteRes<[THX2T99I012]> {
  111. let Latency = 2;
  112. let NumMicroOps = 3;
  113. }
  114. // 5 cycles on I0, I1, or I2.
  115. def THX2T99Write_5Cyc_I012 : SchedWriteRes<[THX2T99I012]> {
  116. let Latency = 2;
  117. let NumMicroOps = 3;
  118. }
  119. // 5 cycles on F1.
  120. def THX2T99Write_5Cyc_F1 : SchedWriteRes<[THX2T99F1]> {
  121. let Latency = 5;
  122. let NumMicroOps = 2;
  123. }
  124. // 7 cycles on F1.
  125. def THX2T99Write_7Cyc_F1 : SchedWriteRes<[THX2T99F1]> {
  126. let Latency = 7;
  127. let NumMicroOps = 2;
  128. }
  129. // 4 cycles on F0 or F1.
  130. def THX2T99Write_4Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  131. let Latency = 4;
  132. let NumMicroOps = 2;
  133. }
  134. // 5 cycles on F0 or F1.
  135. def THX2T99Write_5Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  136. let Latency = 5;
  137. let NumMicroOps = 2;
  138. }
  139. // 6 cycles on F0 or F1.
  140. def THX2T99Write_6Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  141. let Latency = 6;
  142. let NumMicroOps = 3;
  143. }
  144. // 7 cycles on F0 or F1.
  145. def THX2T99Write_7Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  146. let Latency = 7;
  147. let NumMicroOps = 3;
  148. }
  149. // 8 cycles on F0 or F1.
  150. def THX2T99Write_8Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  151. let Latency = 8;
  152. let NumMicroOps = 3;
  153. }
  154. // 10 cycles on F0 or F1.
  155. def THX2T99Write_10Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  156. let Latency = 10;
  157. let NumMicroOps = 3;
  158. }
  159. // 16 cycles on F0 or F1.
  160. def THX2T99Write_16Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  161. let Latency = 16;
  162. let NumMicroOps = 3;
  163. let ResourceCycles = [8];
  164. }
  165. // 23 cycles on F0 or F1.
  166. def THX2T99Write_23Cyc_F01 : SchedWriteRes<[THX2T99F01]> {
  167. let Latency = 23;
  168. let NumMicroOps = 3;
  169. let ResourceCycles = [11];
  170. }
  171. // 1 cycles on LS0 or LS1.
  172. def THX2T99Write_1Cyc_LS01 : SchedWriteRes<[THX2T99LS01]> {
  173. let Latency = 0;
  174. }
  175. // 1 cycles on LS0 or LS1 and I0, I1, or I2.
  176. def THX2T99Write_1Cyc_LS01_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  177. let Latency = 0;
  178. let NumMicroOps = 2;
  179. }
  180. // 1 cycles on LS0 or LS1 and 2 of I0, I1, or I2.
  181. def THX2T99Write_1Cyc_LS01_I012_I012 :
  182. SchedWriteRes<[THX2T99LS01, THX2T99I012, THX2T99I012]> {
  183. let Latency = 0;
  184. let NumMicroOps = 3;
  185. }
  186. // 2 cycles on LS0 or LS1.
  187. def THX2T99Write_2Cyc_LS01 : SchedWriteRes<[THX2T99LS01]> {
  188. let Latency = 1;
  189. let NumMicroOps = 2;
  190. }
  191. // 4 cycles on LS0 or LS1.
  192. def THX2T99Write_4Cyc_LS01 : SchedWriteRes<[THX2T99LS01]> {
  193. let Latency = 4;
  194. let NumMicroOps = 4;
  195. }
  196. // 5 cycles on LS0 or LS1.
  197. def THX2T99Write_5Cyc_LS01 : SchedWriteRes<[THX2T99LS01]> {
  198. let Latency = 5;
  199. let NumMicroOps = 3;
  200. }
  201. // 6 cycles on LS0 or LS1.
  202. def THX2T99Write_6Cyc_LS01 : SchedWriteRes<[THX2T99LS01]> {
  203. let Latency = 6;
  204. let NumMicroOps = 3;
  205. }
  206. // 4 cycles on LS0 or LS1 and I0, I1, or I2.
  207. def THX2T99Write_4Cyc_LS01_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  208. let Latency = 4;
  209. let NumMicroOps = 3;
  210. }
  211. // 4 cycles on LS0 or LS1 and 2 of I0, I1, or I2.
  212. def THX2T99Write_4Cyc_LS01_I012_I012 :
  213. SchedWriteRes<[THX2T99LS01, THX2T99I012, THX2T99I012]> {
  214. let Latency = 4;
  215. let NumMicroOps = 3;
  216. }
  217. // 5 cycles on LS0 or LS1 and I0, I1, or I2.
  218. def THX2T99Write_5Cyc_LS01_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  219. let Latency = 5;
  220. let NumMicroOps = 3;
  221. }
  222. // 5 cycles on LS0 or LS1 and 2 of I0, I1, or I2.
  223. def THX2T99Write_5Cyc_LS01_I012_I012 :
  224. SchedWriteRes<[THX2T99LS01, THX2T99I012, THX2T99I012]> {
  225. let Latency = 5;
  226. let NumMicroOps = 3;
  227. }
  228. // 6 cycles on LS0 or LS1 and I0, I1, or I2.
  229. def THX2T99Write_6Cyc_LS01_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  230. let Latency = 6;
  231. let NumMicroOps = 4;
  232. }
  233. // 6 cycles on LS0 or LS1 and 2 of I0, I1, or I2.
  234. def THX2T99Write_6Cyc_LS01_I012_I012 :
  235. SchedWriteRes<[THX2T99LS01, THX2T99I012, THX2T99I012]> {
  236. let Latency = 6;
  237. let NumMicroOps = 3;
  238. }
  239. // 1 cycles on LS0 or LS1 and F0 or F1.
  240. def THX2T99Write_1Cyc_LS01_F01 : SchedWriteRes<[THX2T99LS01, THX2T99F01]> {
  241. let Latency = 1;
  242. let NumMicroOps = 2;
  243. }
  244. // 5 cycles on LS0 or LS1 and F0 or F1.
  245. def THX2T99Write_5Cyc_LS01_F01 : SchedWriteRes<[THX2T99LS01, THX2T99F01]> {
  246. let Latency = 5;
  247. let NumMicroOps = 3;
  248. }
  249. // 6 cycles on LS0 or LS1 and F0 or F1.
  250. def THX2T99Write_6Cyc_LS01_F01 : SchedWriteRes<[THX2T99LS01, THX2T99F01]> {
  251. let Latency = 6;
  252. let NumMicroOps = 3;
  253. }
  254. // 7 cycles on LS0 or LS1 and F0 or F1.
  255. def THX2T99Write_7Cyc_LS01_F01 : SchedWriteRes<[THX2T99LS01, THX2T99F01]> {
  256. let Latency = 7;
  257. let NumMicroOps = 3;
  258. }
  259. // 8 cycles on LS0 or LS1 and F0 or F1.
  260. def THX2T99Write_8Cyc_LS01_F01 : SchedWriteRes<[THX2T99LS01, THX2T99F01]> {
  261. let Latency = 8;
  262. let NumMicroOps = 3;
  263. }
  264. // 8 cycles on LS0 or LS1 and I0, I1, or I2.
  265. def THX2T99Write_8Cyc_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  266. let Latency = 8;
  267. let NumMicroOps = 4;
  268. }
  269. // 12 cycles on LS0 or LS1 and I0, I1, or I2.
  270. def THX2T99Write_12Cyc_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  271. let Latency = 12;
  272. let NumMicroOps = 6;
  273. }
  274. // 16 cycles on LS0 or LS1 and I0, I1, or I2.
  275. def THX2T99Write_16Cyc_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  276. let Latency = 16;
  277. let NumMicroOps = 8;
  278. }
  279. // 24 cycles on LS0 or LS1 and I0, I1, or I2.
  280. def THX2T99Write_24Cyc_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  281. let Latency = 24;
  282. let NumMicroOps = 12;
  283. }
  284. // 32 cycles on LS0 or LS1 and I0, I1, or I2.
  285. def THX2T99Write_32Cyc_I012 : SchedWriteRes<[THX2T99LS01, THX2T99I012]> {
  286. let Latency = 32;
  287. let NumMicroOps = 16;
  288. }
  289. // Define commonly used read types.
  290. // No forwarding is provided for these types.
  291. def : ReadAdvance<ReadI, 0>;
  292. def : ReadAdvance<ReadISReg, 0>;
  293. def : ReadAdvance<ReadIEReg, 0>;
  294. def : ReadAdvance<ReadIM, 0>;
  295. def : ReadAdvance<ReadIMA, 0>;
  296. def : ReadAdvance<ReadID, 0>;
  297. def : ReadAdvance<ReadExtrHi, 0>;
  298. def : ReadAdvance<ReadAdrBase, 0>;
  299. def : ReadAdvance<ReadVLD, 0>;
  300. def : ReadAdvance<ReadST, 0>;
  301. //===----------------------------------------------------------------------===//
  302. // 3. Instruction Tables.
  303. //---
  304. // 3.1 Branch Instructions
  305. //---
  306. // Branch, immed
  307. // Branch and link, immed
  308. // Compare and branch
  309. def : WriteRes<WriteBr, [THX2T99I2]> {
  310. let Latency = 1;
  311. let NumMicroOps = 2;
  312. }
  313. // Branch, register
  314. // Branch and link, register != LR
  315. // Branch and link, register = LR
  316. def : WriteRes<WriteBrReg, [THX2T99I2]> {
  317. let Latency = 1;
  318. let NumMicroOps = 2;
  319. }
  320. def : WriteRes<WriteSys, []> { let Latency = 1; }
  321. def : WriteRes<WriteBarrier, []> { let Latency = 1; }
  322. def : WriteRes<WriteHint, []> { let Latency = 1; }
  323. def : WriteRes<WriteAtomic, []> {
  324. let Latency = 4;
  325. let NumMicroOps = 2;
  326. }
  327. //---
  328. // Branch
  329. //---
  330. def : InstRW<[THX2T99Write_1Cyc_I2], (instrs B, BL, BR, BLR)>;
  331. def : InstRW<[THX2T99Write_1Cyc_I2], (instrs RET)>;
  332. def : InstRW<[THX2T99Write_1Cyc_I2], (instregex "^B..$")>;
  333. def : InstRW<[THX2T99Write_1Cyc_I2],
  334. (instregex "^CBZ", "^CBNZ", "^TBZ", "^TBNZ")>;
  335. //---
  336. // 3.2 Arithmetic and Logical Instructions
  337. // 3.3 Move and Shift Instructions
  338. //---
  339. // ALU, basic
  340. // Conditional compare
  341. // Conditional select
  342. // Address generation
  343. def : WriteRes<WriteI, [THX2T99I012]> {
  344. let Latency = 1;
  345. let ResourceCycles = [1];
  346. let NumMicroOps = 2;
  347. }
  348. def : InstRW<[WriteI],
  349. (instregex "ADD?(W|X)r(i|r|s|x)", "ADDS?(W|X)r(i|r|s|x)(64)?",
  350. "AND?(W|X)r(i|r|s|x)", "ANDS?(W|X)r(i|r|s|x)",
  351. "ADC(W|X)r",
  352. "BIC?(W|X)r(i|r|s|x)", "BICS?(W|X)r(i|r|s|x)",
  353. "EON?(W|X)r(i|r|s|x)", "ORN?(W|X)r(i|r|s|x)",
  354. "ORR?(W|X)r(i|r|s|x)", "SUB?(W|X)r(i|r|s|x)",
  355. "SUBS?(W|X)r(i|r|s|x)", "SBC(W|X)r",
  356. "SBCS(W|X)r", "CCMN(W|X)(i|r)",
  357. "CCMP(W|X)(i|r)", "CSEL(W|X)r",
  358. "CSINC(W|X)r", "CSINV(W|X)r",
  359. "CSNEG(W|X)r")>;
  360. def : InstRW<[WriteI], (instrs COPY)>;
  361. // ALU, extend and/or shift
  362. def : WriteRes<WriteISReg, [THX2T99I012]> {
  363. let Latency = 2;
  364. let ResourceCycles = [2];
  365. let NumMicroOps = 2;
  366. }
  367. def : InstRW<[WriteISReg],
  368. (instregex "ADD?(W|X)r(i|r|s|x)", "ADDS?(W|X)r(i|r|s|x)(64)?",
  369. "AND?(W|X)r(i|r|s|x)", "ANDS?(W|X)r(i|r|s|x)",
  370. "ADC(W|X)r",
  371. "BIC?(W|X)r(i|r|s|x)", "BICS?(W|X)r(i|r|s|x)",
  372. "EON?(W|X)r(i|r|s|x)", "ORN?(W|X)r(i|r|s|x)",
  373. "ORR?(W|X)r(i|r|s|x)", "SUB?(W|X)r(i|r|s|x)",
  374. "SUBS?(W|X)r(i|r|s|x)", "SBC(W|X)r",
  375. "SBCS(W|X)r", "CCMN(W|X)(i|r)",
  376. "CCMP(W|X)(i|r)", "CSEL(W|X)r",
  377. "CSINC(W|X)r", "CSINV(W|X)r",
  378. "CSNEG(W|X)r")>;
  379. def : WriteRes<WriteIEReg, [THX2T99I012]> {
  380. let Latency = 1;
  381. let ResourceCycles = [1];
  382. let NumMicroOps = 2;
  383. }
  384. def : InstRW<[WriteIEReg],
  385. (instregex "ADD?(W|X)r(i|r|s|x)", "ADDS?(W|X)r(i|r|s|x)(64)?",
  386. "AND?(W|X)r(i|r|s|x)", "ANDS?(W|X)r(i|r|s|x)",
  387. "ADC(W|X)r",
  388. "BIC?(W|X)r(i|r|s|x)", "BICS?(W|X)r(i|r|s|x)",
  389. "EON?(W|X)r(i|r|s|x)", "ORN?(W|X)r(i|r|s|x)",
  390. "ORR?(W|X)r(i|r|s|x)", "SUB?(W|X)r(i|r|s|x)",
  391. "SUBS?(W|X)r(i|r|s|x)", "SBC(W|X)r",
  392. "SBCS(W|X)r", "CCMN(W|X)(i|r)",
  393. "CCMP(W|X)(i|r)", "CSEL(W|X)r",
  394. "CSINC(W|X)r", "CSINV(W|X)r",
  395. "CSNEG(W|X)r")>;
  396. // Move immed
  397. def : WriteRes<WriteImm, [THX2T99I012]> {
  398. let Latency = 1;
  399. let NumMicroOps = 2;
  400. }
  401. def : InstRW<[THX2T99Write_1Cyc_I012],
  402. (instrs MOVKWi, MOVKXi, MOVNWi, MOVNXi, MOVZWi, MOVZXi)>;
  403. def : InstRW<[THX2T99Write_1Cyc_I012],
  404. (instrs ASRVWr, ASRVXr, LSLVWr, LSLVXr, RORVWr, RORVXr)>;
  405. // Variable shift
  406. def : WriteRes<WriteIS, [THX2T99I012]> {
  407. let Latency = 1;
  408. let NumMicroOps = 2;
  409. }
  410. //---
  411. // 3.4 Divide and Multiply Instructions
  412. //---
  413. // Divide, W-form
  414. // Latency range of 13-23/13-39.
  415. def : WriteRes<WriteID32, [THX2T99I1]> {
  416. let Latency = 39;
  417. let ResourceCycles = [39];
  418. let NumMicroOps = 4;
  419. }
  420. // Divide, X-form
  421. def : WriteRes<WriteID64, [THX2T99I1]> {
  422. let Latency = 23;
  423. let ResourceCycles = [23];
  424. let NumMicroOps = 4;
  425. }
  426. // Multiply accumulate, W-form
  427. def : WriteRes<WriteIM32, [THX2T99I012]> {
  428. let Latency = 5;
  429. let NumMicroOps = 3;
  430. }
  431. // Multiply accumulate, X-form
  432. def : WriteRes<WriteIM64, [THX2T99I012]> {
  433. let Latency = 5;
  434. let NumMicroOps = 3;
  435. }
  436. //def : InstRW<[WriteIM32, ReadIM, ReadIM, ReadIMA, THX2T99Write_5Cyc_I012],
  437. // (instrs MADDWrrr, MSUBWrrr)>;
  438. def : InstRW<[WriteIM32], (instrs MADDWrrr, MSUBWrrr)>;
  439. def : InstRW<[WriteIM32], (instrs MADDXrrr, MSUBXrrr)>;
  440. def : InstRW<[THX2T99Write_5Cyc_I012],
  441. (instregex "(S|U)(MADDL|MSUBL)rrr")>;
  442. def : InstRW<[WriteID32], (instrs SDIVWr, UDIVWr)>;
  443. def : InstRW<[WriteID64], (instrs SDIVXr, UDIVXr)>;
  444. // Bitfield extract, two reg
  445. def : WriteRes<WriteExtr, [THX2T99I012]> {
  446. let Latency = 1;
  447. let NumMicroOps = 2;
  448. }
  449. // Multiply high
  450. def : InstRW<[THX2T99Write_4Cyc_I1], (instrs SMULHrr, UMULHrr)>;
  451. // Miscellaneous Data-Processing Instructions
  452. // Bitfield extract
  453. def : InstRW<[THX2T99Write_1Cyc_I012], (instrs EXTRWrri, EXTRXrri)>;
  454. // Bitifield move - basic
  455. def : InstRW<[THX2T99Write_1Cyc_I012],
  456. (instrs SBFMWri, SBFMXri, UBFMWri, UBFMXri)>;
  457. // Bitfield move, insert
  458. def : InstRW<[THX2T99Write_1Cyc_I012], (instregex "^BFM")>;
  459. def : InstRW<[THX2T99Write_1Cyc_I012], (instregex "(S|U)?BFM.*")>;
  460. // Count leading
  461. def : InstRW<[THX2T99Write_3Cyc_I1], (instregex "^CLS(W|X)r$",
  462. "^CLZ(W|X)r$")>;
  463. // Reverse bits
  464. def : InstRW<[THX2T99Write_1Cyc_I012], (instrs RBITWr, RBITXr)>;
  465. // Cryptography Extensions
  466. def : InstRW<[THX2T99Write_5Cyc_F1], (instregex "^AES[DE]")>;
  467. def : InstRW<[THX2T99Write_5Cyc_F1], (instregex "^AESI?MC")>;
  468. def : InstRW<[THX2T99Write_5Cyc_F1], (instregex "^PMULL")>;
  469. def : InstRW<[THX2T99Write_7Cyc_F1], (instregex "^SHA1SU0")>;
  470. def : InstRW<[THX2T99Write_7Cyc_F1], (instregex "^SHA1(H|SU1)")>;
  471. def : InstRW<[THX2T99Write_7Cyc_F1], (instregex "^SHA1[CMP]")>;
  472. def : InstRW<[THX2T99Write_7Cyc_F1], (instregex "^SHA256SU0")>;
  473. def : InstRW<[THX2T99Write_7Cyc_F1], (instregex "^SHA256(H|H2|SU1)")>;
  474. // CRC Instructions
  475. // def : InstRW<[THX2T99Write_4Cyc_I1], (instregex "^CRC32", "^CRC32C")>;
  476. def : InstRW<[THX2T99Write_4Cyc_I1],
  477. (instrs CRC32Brr, CRC32Hrr, CRC32Wrr, CRC32Xrr)>;
  478. def : InstRW<[THX2T99Write_4Cyc_I1],
  479. (instrs CRC32CBrr, CRC32CHrr, CRC32CWrr, CRC32CXrr)>;
  480. // Reverse bits/bytes
  481. // NOTE: Handled by WriteI.
  482. //---
  483. // 3.6 Load Instructions
  484. // 3.10 FP Load Instructions
  485. //---
  486. // Load register, literal
  487. // Load register, unscaled immed
  488. // Load register, immed unprivileged
  489. // Load register, unsigned immed
  490. def : WriteRes<WriteLD, [THX2T99LS01]> {
  491. let Latency = 4;
  492. let NumMicroOps = 4;
  493. }
  494. // Load register, immed post-index
  495. // NOTE: Handled by WriteLD, WriteI.
  496. // Load register, immed pre-index
  497. // NOTE: Handled by WriteLD, WriteAdr.
  498. def : WriteRes<WriteAdr, [THX2T99I012]> {
  499. let Latency = 1;
  500. let NumMicroOps = 2;
  501. }
  502. // Load pair, immed offset, normal
  503. // Load pair, immed offset, signed words, base != SP
  504. // Load pair, immed offset signed words, base = SP
  505. // LDP only breaks into *one* LS micro-op. Thus
  506. // the resources are handled by WriteLD.
  507. def : WriteRes<WriteLDHi, []> {
  508. let Latency = 5;
  509. let NumMicroOps = 5;
  510. }
  511. // Load register offset, basic
  512. // Load register, register offset, scale by 4/8
  513. // Load register, register offset, scale by 2
  514. // Load register offset, extend
  515. // Load register, register offset, extend, scale by 4/8
  516. // Load register, register offset, extend, scale by 2
  517. def THX2T99WriteLDIdx : SchedWriteVariant<[
  518. SchedVar<ScaledIdxPred, [THX2T99Write_6Cyc_LS01_I012_I012]>,
  519. SchedVar<NoSchedPred, [THX2T99Write_5Cyc_LS01_I012]>]>;
  520. def : SchedAlias<WriteLDIdx, THX2T99WriteLDIdx>;
  521. def THX2T99ReadAdrBase : SchedReadVariant<[
  522. SchedVar<ScaledIdxPred, [ReadDefault]>,
  523. SchedVar<NoSchedPred, [ReadDefault]>]>;
  524. def : SchedAlias<ReadAdrBase, THX2T99ReadAdrBase>;
  525. // Load pair, immed pre-index, normal
  526. // Load pair, immed pre-index, signed words
  527. // Load pair, immed post-index, normal
  528. // Load pair, immed post-index, signed words
  529. // NOTE: Handled by WriteLD, WriteLDHi, WriteAdr.
  530. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDNPDi)>;
  531. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDNPQi)>;
  532. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDNPSi)>;
  533. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDNPWi)>;
  534. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDNPXi)>;
  535. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDPDi)>;
  536. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDPQi)>;
  537. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDPSi)>;
  538. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDPSWi)>;
  539. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDPWi)>;
  540. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi], (instrs LDPXi)>;
  541. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDRBui)>;
  542. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDRDui)>;
  543. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDRHui)>;
  544. def : InstRW<[THX2T99Write_5Cyc_LS01], (instrs LDRQui)>;
  545. def : InstRW<[THX2T99Write_5Cyc_LS01], (instrs LDRSui)>;
  546. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDRDl)>;
  547. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDRQl)>;
  548. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDRWl)>;
  549. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDRXl)>;
  550. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRBi)>;
  551. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRHi)>;
  552. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRWi)>;
  553. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRXi)>;
  554. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRSBWi)>;
  555. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRSBXi)>;
  556. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRSHWi)>;
  557. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRSHXi)>;
  558. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDTRSWi)>;
  559. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  560. (instrs LDPDpre)>;
  561. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  562. (instrs LDPQpre)>;
  563. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  564. (instrs LDPSpre)>;
  565. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  566. (instrs LDPWpre)>;
  567. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  568. (instrs LDPWpre)>;
  569. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteAdr], (instrs LDRBpre)>;
  570. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteAdr], (instrs LDRDpre)>;
  571. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteAdr], (instrs LDRHpre)>;
  572. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteAdr], (instrs LDRQpre)>;
  573. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteAdr], (instrs LDRSpre)>;
  574. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteAdr], (instrs LDRWpre)>;
  575. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteAdr], (instrs LDRXpre)>;
  576. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSBWpre)>;
  577. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSBXpre)>;
  578. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSBWpost)>;
  579. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSBXpost)>;
  580. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSHWpre)>;
  581. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSHXpre)>;
  582. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSHWpost)>;
  583. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRSHXpost)>;
  584. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRBBpre)>;
  585. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRBBpost)>;
  586. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRHHpre)>;
  587. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, WriteAdr], (instrs LDRHHpost)>;
  588. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  589. (instrs LDPDpost)>;
  590. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  591. (instrs LDPQpost)>;
  592. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  593. (instrs LDPSpost)>;
  594. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  595. (instrs LDPWpost)>;
  596. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteLDHi, WriteAdr],
  597. (instrs LDPXpost)>;
  598. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteI], (instrs LDRBpost)>;
  599. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteI], (instrs LDRDpost)>;
  600. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteI], (instrs LDRHpost)>;
  601. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteI], (instrs LDRQpost)>;
  602. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteI], (instrs LDRSpost)>;
  603. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteI], (instrs LDRWpost)>;
  604. def : InstRW<[THX2T99Write_5Cyc_LS01_I012, WriteI], (instrs LDRXpost)>;
  605. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  606. (instrs LDPDpre)>;
  607. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  608. (instrs LDPQpre)>;
  609. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  610. (instrs LDPSpre)>;
  611. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  612. (instrs LDPWpre)>;
  613. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  614. (instrs LDPXpre)>;
  615. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteAdr], (instrs LDRBpre)>;
  616. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteAdr], (instrs LDRDpre)>;
  617. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteAdr], (instrs LDRHpre)>;
  618. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteAdr], (instrs LDRQpre)>;
  619. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteAdr], (instrs LDRSpre)>;
  620. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteAdr], (instrs LDRWpre)>;
  621. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteAdr], (instrs LDRXpre)>;
  622. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  623. (instrs LDPDpost)>;
  624. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  625. (instrs LDPQpost)>;
  626. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  627. (instrs LDPSpost)>;
  628. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  629. (instrs LDPWpost)>;
  630. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteLDHi, WriteAdr],
  631. (instrs LDPXpost)>;
  632. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteI], (instrs LDRBpost)>;
  633. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteI], (instrs LDRDpost)>;
  634. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteI], (instrs LDRHpost)>;
  635. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteI], (instrs LDRQpost)>;
  636. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteI], (instrs LDRSpost)>;
  637. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteI], (instrs LDRWpost)>;
  638. def : InstRW<[THX2T99Write_5Cyc_LS01_I012_I012, WriteI], (instrs LDRXpost)>;
  639. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRBroW)>;
  640. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRDroW)>;
  641. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRHroW)>;
  642. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRHHroW)>;
  643. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRQroW)>;
  644. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRSroW)>;
  645. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRSHWroW)>;
  646. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRSHXroW)>;
  647. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRWroW)>;
  648. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRXroW)>;
  649. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRBroX)>;
  650. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRDroX)>;
  651. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRHHroX)>;
  652. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRHroX)>;
  653. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRQroX)>;
  654. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRSroX)>;
  655. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRSHWroX)>;
  656. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRSHXroX)>;
  657. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRWroX)>;
  658. def : InstRW<[THX2T99Write_4Cyc_LS01_I012, ReadAdrBase], (instrs LDRXroX)>;
  659. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  660. (instrs LDRBroW)>;
  661. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  662. (instrs LDRBroW)>;
  663. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  664. (instrs LDRDroW)>;
  665. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  666. (instrs LDRHroW)>;
  667. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  668. (instrs LDRHHroW)>;
  669. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  670. (instrs LDRQroW)>;
  671. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  672. (instrs LDRSroW)>;
  673. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  674. (instrs LDRSHWroW)>;
  675. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  676. (instrs LDRSHXroW)>;
  677. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  678. (instrs LDRWroW)>;
  679. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  680. (instrs LDRXroW)>;
  681. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  682. (instrs LDRBroX)>;
  683. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  684. (instrs LDRDroX)>;
  685. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  686. (instrs LDRHroX)>;
  687. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  688. (instrs LDRHHroX)>;
  689. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  690. (instrs LDRQroX)>;
  691. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  692. (instrs LDRSroX)>;
  693. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  694. (instrs LDRSHWroX)>;
  695. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  696. (instrs LDRSHXroX)>;
  697. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  698. (instrs LDRWroX)>;
  699. def : InstRW<[THX2T99Write_4Cyc_LS01_I012_I012, ReadAdrBase],
  700. (instrs LDRXroX)>;
  701. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURBi)>;
  702. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURBBi)>;
  703. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURDi)>;
  704. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURHi)>;
  705. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURHHi)>;
  706. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURQi)>;
  707. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURSi)>;
  708. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURXi)>;
  709. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURSBWi)>;
  710. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURSBXi)>;
  711. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURSHWi)>;
  712. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURSHXi)>;
  713. def : InstRW<[THX2T99Write_4Cyc_LS01], (instrs LDURSWi)>;
  714. //---
  715. // Prefetch
  716. //---
  717. def : InstRW<[THX2T99Write_6Cyc_LS01_I012], (instrs PRFMl)>;
  718. def : InstRW<[THX2T99Write_6Cyc_LS01_I012], (instrs PRFUMi)>;
  719. def : InstRW<[THX2T99Write_6Cyc_LS01_I012], (instrs PRFMui)>;
  720. def : InstRW<[THX2T99Write_6Cyc_LS01_I012], (instrs PRFMroW)>;
  721. def : InstRW<[THX2T99Write_6Cyc_LS01_I012], (instrs PRFMroX)>;
  722. //--
  723. // 3.7 Store Instructions
  724. // 3.11 FP Store Instructions
  725. //--
  726. // Store register, unscaled immed
  727. // Store register, immed unprivileged
  728. // Store register, unsigned immed
  729. def : WriteRes<WriteST, [THX2T99LS01, THX2T99SD]> {
  730. let Latency = 1;
  731. let NumMicroOps = 2;
  732. }
  733. // Store register, immed post-index
  734. // NOTE: Handled by WriteAdr, WriteST, ReadAdrBase
  735. // Store register, immed pre-index
  736. // NOTE: Handled by WriteAdr, WriteST
  737. // Store register, register offset, basic
  738. // Store register, register offset, scaled by 4/8
  739. // Store register, register offset, scaled by 2
  740. // Store register, register offset, extend
  741. // Store register, register offset, extend, scale by 4/8
  742. // Store register, register offset, extend, scale by 1
  743. def : WriteRes<WriteSTIdx, [THX2T99LS01, THX2T99SD, THX2T99I012]> {
  744. let Latency = 1;
  745. let NumMicroOps = 3;
  746. }
  747. // Store pair, immed offset, W-form
  748. // Store pair, immed offset, X-form
  749. def : WriteRes<WriteSTP, [THX2T99LS01, THX2T99SD]> {
  750. let Latency = 1;
  751. let NumMicroOps = 2;
  752. }
  753. // Store pair, immed post-index, W-form
  754. // Store pair, immed post-index, X-form
  755. // Store pair, immed pre-index, W-form
  756. // Store pair, immed pre-index, X-form
  757. // NOTE: Handled by WriteAdr, WriteSTP.
  758. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURBi)>;
  759. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURBBi)>;
  760. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURDi)>;
  761. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURHi)>;
  762. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURHHi)>;
  763. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURQi)>;
  764. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURSi)>;
  765. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURWi)>;
  766. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STURXi)>;
  767. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01], (instrs STTRBi)>;
  768. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01], (instrs STTRHi)>;
  769. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01], (instrs STTRWi)>;
  770. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01], (instrs STTRXi)>;
  771. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STNPDi)>;
  772. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STNPQi)>;
  773. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STNPXi)>;
  774. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STNPWi)>;
  775. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STPDi)>;
  776. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STPQi)>;
  777. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STPXi)>;
  778. def : InstRW<[THX2T99Write_1Cyc_LS01], (instrs STPWi)>;
  779. def : InstRW<[THX2T99Write_1Cyc_LS01_I012_I012], (instrs STRBui)>;
  780. def : InstRW<[THX2T99Write_1Cyc_LS01_I012], (instrs STRBui)>;
  781. def : InstRW<[THX2T99Write_1Cyc_LS01_I012_I012], (instrs STRDui)>;
  782. def : InstRW<[THX2T99Write_1Cyc_LS01_I012], (instrs STRDui)>;
  783. def : InstRW<[THX2T99Write_1Cyc_LS01_I012_I012], (instrs STRHui)>;
  784. def : InstRW<[THX2T99Write_1Cyc_LS01_I012], (instrs STRHui)>;
  785. def : InstRW<[THX2T99Write_1Cyc_LS01_I012_I012], (instrs STRQui)>;
  786. def : InstRW<[THX2T99Write_1Cyc_LS01_I012], (instrs STRQui)>;
  787. def : InstRW<[THX2T99Write_1Cyc_LS01_I012_I012], (instrs STRXui)>;
  788. def : InstRW<[THX2T99Write_1Cyc_LS01_I012], (instrs STRXui)>;
  789. def : InstRW<[THX2T99Write_1Cyc_LS01_I012_I012], (instrs STRWui)>;
  790. def : InstRW<[THX2T99Write_1Cyc_LS01_I012], (instrs STRWui)>;
  791. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  792. (instrs STPDpre, STPDpost)>;
  793. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  794. (instrs STPDpre, STPDpost)>;
  795. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  796. (instrs STPDpre, STPDpost)>;
  797. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  798. (instrs STPDpre, STPDpost)>;
  799. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  800. (instrs STPQpre, STPQpost)>;
  801. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  802. (instrs STPQpre, STPQpost)>;
  803. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  804. (instrs STPQpre, STPQpost)>;
  805. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  806. (instrs STPQpre, STPQpost)>;
  807. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  808. (instrs STPSpre, STPSpost)>;
  809. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  810. (instrs STPSpre, STPSpost)>;
  811. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  812. (instrs STPSpre, STPSpost)>;
  813. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  814. (instrs STPSpre, STPSpost)>;
  815. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  816. (instrs STPWpre, STPWpost)>;
  817. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  818. (instrs STPWpre, STPWpost)>;
  819. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  820. (instrs STPWpre, STPWpost)>;
  821. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  822. (instrs STPWpre, STPWpost)>;
  823. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  824. (instrs STPXpre, STPXpost)>;
  825. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  826. (instrs STPXpre, STPXpost)>;
  827. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  828. (instrs STPXpre, STPXpost)>;
  829. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  830. (instrs STPXpre, STPXpost)>;
  831. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  832. (instrs STRBpre, STRBpost)>;
  833. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  834. (instrs STRBpre, STRBpost)>;
  835. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  836. (instrs STRBpre, STRBpost)>;
  837. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  838. (instrs STRBpre, STRBpost)>;
  839. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  840. (instrs STRBBpre, STRBBpost)>;
  841. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  842. (instrs STRBBpre, STRBBpost)>;
  843. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  844. (instrs STRBBpre, STRBBpost)>;
  845. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  846. (instrs STRBBpre, STRBBpost)>;
  847. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  848. (instrs STRDpre, STRDpost)>;
  849. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  850. (instrs STRDpre, STRDpost)>;
  851. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  852. (instrs STRDpre, STRDpost)>;
  853. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  854. (instrs STRDpre, STRDpost)>;
  855. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  856. (instrs STRHpre, STRHpost)>;
  857. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  858. (instrs STRHpre, STRHpost)>;
  859. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  860. (instrs STRHpre, STRHpost)>;
  861. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  862. (instrs STRHpre, STRHpost)>;
  863. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  864. (instrs STRHHpre, STRHHpost)>;
  865. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  866. (instrs STRHHpre, STRHHpost)>;
  867. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  868. (instrs STRHHpre, STRHHpost)>;
  869. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  870. (instrs STRHHpre, STRHHpost)>;
  871. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  872. (instrs STRQpre, STRQpost)>;
  873. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  874. (instrs STRQpre, STRQpost)>;
  875. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  876. (instrs STRQpre, STRQpost)>;
  877. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  878. (instrs STRQpre, STRQpost)>;
  879. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  880. (instrs STRSpre, STRSpost)>;
  881. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  882. (instrs STRSpre, STRSpost)>;
  883. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  884. (instrs STRSpre, STRSpost)>;
  885. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  886. (instrs STRSpre, STRSpost)>;
  887. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  888. (instrs STRWpre, STRWpost)>;
  889. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  890. (instrs STRWpre, STRWpost)>;
  891. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  892. (instrs STRWpre, STRWpost)>;
  893. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  894. (instrs STRWpre, STRWpost)>;
  895. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012],
  896. (instrs STRXpre, STRXpost)>;
  897. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  898. (instrs STRXpre, STRXpost)>;
  899. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012],
  900. (instrs STRXpre, STRXpost)>;
  901. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  902. (instrs STRXpre, STRXpost)>;
  903. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  904. (instrs STRBroW, STRBroX)>;
  905. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  906. (instrs STRBroW, STRBroX)>;
  907. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  908. (instrs STRBBroW, STRBBroX)>;
  909. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  910. (instrs STRBBroW, STRBBroX)>;
  911. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  912. (instrs STRDroW, STRDroX)>;
  913. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  914. (instrs STRDroW, STRDroX)>;
  915. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  916. (instrs STRHroW, STRHroX)>;
  917. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  918. (instrs STRHroW, STRHroX)>;
  919. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  920. (instrs STRHHroW, STRHHroX)>;
  921. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  922. (instrs STRHHroW, STRHHroX)>;
  923. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  924. (instrs STRQroW, STRQroX)>;
  925. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  926. (instrs STRQroW, STRQroX)>;
  927. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  928. (instrs STRSroW, STRSroX)>;
  929. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  930. (instrs STRSroW, STRSroX)>;
  931. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  932. (instrs STRWroW, STRWroX)>;
  933. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  934. (instrs STRWroW, STRWroX)>;
  935. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012, ReadAdrBase],
  936. (instrs STRXroW, STRXroX)>;
  937. def : InstRW<[WriteAdr, THX2T99Write_1Cyc_LS01_I012_I012, ReadAdrBase],
  938. (instrs STRXroW, STRXroX)>;
  939. //---
  940. // 3.8 FP Data Processing Instructions
  941. //---
  942. // FP absolute value
  943. // FP min/max
  944. // FP negate
  945. def : WriteRes<WriteF, [THX2T99F01]> {
  946. let Latency = 5;
  947. let NumMicroOps = 2;
  948. }
  949. // FP arithmetic
  950. def : InstRW<[THX2T99Write_6Cyc_F01], (instregex "^FADD", "^FSUB")>;
  951. // FP compare
  952. def : WriteRes<WriteFCmp, [THX2T99F01]> {
  953. let Latency = 5;
  954. let NumMicroOps = 2;
  955. }
  956. // FP Mul, Div, Sqrt
  957. def : WriteRes<WriteFDiv, [THX2T99F01]> {
  958. let Latency = 22;
  959. let ResourceCycles = [19];
  960. }
  961. def THX2T99XWriteFDiv : SchedWriteRes<[THX2T99F01]> {
  962. let Latency = 16;
  963. let ResourceCycles = [8];
  964. let NumMicroOps = 4;
  965. }
  966. def THX2T99XWriteFDivSP : SchedWriteRes<[THX2T99F01]> {
  967. let Latency = 16;
  968. let ResourceCycles = [8];
  969. let NumMicroOps = 4;
  970. }
  971. def THX2T99XWriteFDivDP : SchedWriteRes<[THX2T99F01]> {
  972. let Latency = 23;
  973. let ResourceCycles = [12];
  974. let NumMicroOps = 4;
  975. }
  976. def THX2T99XWriteFSqrtSP : SchedWriteRes<[THX2T99F01]> {
  977. let Latency = 16;
  978. let ResourceCycles = [8];
  979. let NumMicroOps = 4;
  980. }
  981. def THX2T99XWriteFSqrtDP : SchedWriteRes<[THX2T99F01]> {
  982. let Latency = 23;
  983. let ResourceCycles = [12];
  984. let NumMicroOps = 4;
  985. }
  986. // FP divide, S-form
  987. // FP square root, S-form
  988. def : InstRW<[THX2T99XWriteFDivSP], (instrs FDIVSrr)>;
  989. def : InstRW<[THX2T99XWriteFSqrtSP], (instrs FSQRTSr)>;
  990. def : InstRW<[THX2T99XWriteFDivSP], (instregex "^FDIVv.*32$")>;
  991. def : InstRW<[THX2T99XWriteFSqrtSP], (instregex "^.*SQRT.*32$")>;
  992. def : InstRW<[THX2T99Write_16Cyc_F01], (instregex "^FDIVSrr", "^FSQRTSr")>;
  993. // FP divide, D-form
  994. // FP square root, D-form
  995. def : InstRW<[THX2T99XWriteFDivDP], (instrs FDIVDrr)>;
  996. def : InstRW<[THX2T99XWriteFSqrtDP], (instrs FSQRTDr)>;
  997. def : InstRW<[THX2T99XWriteFDivDP], (instregex "^FDIVv.*64$")>;
  998. def : InstRW<[THX2T99XWriteFSqrtDP], (instregex "^.*SQRT.*64$")>;
  999. def : InstRW<[THX2T99Write_23Cyc_F01], (instregex "^FDIVDrr", "^FSQRTDr")>;
  1000. // FP multiply
  1001. // FP multiply accumulate
  1002. def : WriteRes<WriteFMul, [THX2T99F01]> {
  1003. let Latency = 6;
  1004. let ResourceCycles = [2];
  1005. let NumMicroOps = 3;
  1006. }
  1007. def THX2T99XWriteFMul : SchedWriteRes<[THX2T99F01]> {
  1008. let Latency = 6;
  1009. let ResourceCycles = [2];
  1010. let NumMicroOps = 3;
  1011. }
  1012. def THX2T99XWriteFMulAcc : SchedWriteRes<[THX2T99F01]> {
  1013. let Latency = 6;
  1014. let ResourceCycles = [2];
  1015. let NumMicroOps = 3;
  1016. }
  1017. def : InstRW<[THX2T99XWriteFMul], (instregex "^FMUL", "^FNMUL")>;
  1018. def : InstRW<[THX2T99XWriteFMulAcc],
  1019. (instregex "^FMADD", "^FMSUB", "^FNMADD", "^FNMSUB")>;
  1020. // FP round to integral
  1021. def : InstRW<[THX2T99Write_7Cyc_F01],
  1022. (instregex "^FRINT(A|I|M|N|P|X|Z)(Sr|Dr)")>;
  1023. // FP select
  1024. def : InstRW<[THX2T99Write_4Cyc_F01], (instregex "^FCSEL")>;
  1025. //---
  1026. // 3.9 FP Miscellaneous Instructions
  1027. //---
  1028. // FP convert, from vec to vec reg
  1029. // FP convert, from gen to vec reg
  1030. // FP convert, from vec to gen reg
  1031. def : WriteRes<WriteFCvt, [THX2T99F01]> {
  1032. let Latency = 7;
  1033. let NumMicroOps = 3;
  1034. }
  1035. // FP move, immed
  1036. // FP move, register
  1037. def : WriteRes<WriteFImm, [THX2T99F01]> {
  1038. let Latency = 4;
  1039. let NumMicroOps = 2;
  1040. }
  1041. // FP transfer, from gen to vec reg
  1042. // FP transfer, from vec to gen reg
  1043. def : WriteRes<WriteFCopy, [THX2T99F01]> {
  1044. let Latency = 4;
  1045. let NumMicroOps = 2;
  1046. }
  1047. def : InstRW<[THX2T99Write_5Cyc_F01], (instrs FMOVXDHighr, FMOVDXHighr)>;
  1048. //---
  1049. // 3.12 ASIMD Integer Instructions
  1050. //---
  1051. // ASIMD absolute diff, D-form
  1052. // ASIMD absolute diff, Q-form
  1053. // ASIMD absolute diff accum, D-form
  1054. // ASIMD absolute diff accum, Q-form
  1055. // ASIMD absolute diff accum long
  1056. // ASIMD absolute diff long
  1057. // ASIMD arith, basic
  1058. // ASIMD arith, complex
  1059. // ASIMD compare
  1060. // ASIMD logical (AND, BIC, EOR)
  1061. // ASIMD max/min, basic
  1062. // ASIMD max/min, reduce, 4H/4S
  1063. // ASIMD max/min, reduce, 8B/8H
  1064. // ASIMD max/min, reduce, 16B
  1065. // ASIMD multiply, D-form
  1066. // ASIMD multiply, Q-form
  1067. // ASIMD multiply accumulate long
  1068. // ASIMD multiply accumulate saturating long
  1069. // ASIMD multiply long
  1070. // ASIMD pairwise add and accumulate
  1071. // ASIMD shift accumulate
  1072. // ASIMD shift by immed, basic
  1073. // ASIMD shift by immed and insert, basic, D-form
  1074. // ASIMD shift by immed and insert, basic, Q-form
  1075. // ASIMD shift by immed, complex
  1076. // ASIMD shift by register, basic, D-form
  1077. // ASIMD shift by register, basic, Q-form
  1078. // ASIMD shift by register, complex, D-form
  1079. // ASIMD shift by register, complex, Q-form
  1080. def : WriteRes<WriteVd, [THX2T99F01]> {
  1081. let Latency = 7;
  1082. let NumMicroOps = 4;
  1083. let ResourceCycles = [4];
  1084. }
  1085. def : WriteRes<WriteVq, [THX2T99F01]> {
  1086. let Latency = 7;
  1087. let NumMicroOps = 4;
  1088. let ResourceCycles = [4];
  1089. }
  1090. // ASIMD arith, reduce, 4H/4S
  1091. // ASIMD arith, reduce, 8B/8H
  1092. // ASIMD arith, reduce, 16B
  1093. // ASIMD logical (MVN (alias for NOT), ORN, ORR)
  1094. def : InstRW<[THX2T99Write_5Cyc_F01],
  1095. (instregex "^ANDv", "^BICv", "^EORv", "^ORRv", "^ORNv", "^NOTv")>;
  1096. // ASIMD arith, reduce
  1097. def : InstRW<[THX2T99Write_10Cyc_F01],
  1098. (instregex "^ADDVv", "^SADDLVv", "^UADDLVv")>;
  1099. // ASIMD polynomial (8x8) multiply long
  1100. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^(S|U|SQD)MULL")>;
  1101. def : InstRW<[THX2T99Write_7Cyc_F01],
  1102. (instregex "(S|U|SQD)(MLAL|MLSL|MULL)v.*")>;
  1103. def : InstRW<[THX2T99Write_5Cyc_F1], (instregex "^PMULL(v8i8|v16i8)")>;
  1104. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^PMULL(v1i64|v2i64)")>;
  1105. // ASIMD absolute diff accum, D-form
  1106. def : InstRW<[THX2T99Write_7Cyc_F01],
  1107. (instregex "^[SU]ABA(v8i8|v4i16|v2i32)$")>;
  1108. // ASIMD absolute diff accum, Q-form
  1109. def : InstRW<[THX2T99Write_7Cyc_F01],
  1110. (instregex "^[SU]ABA(v16i8|v8i16|v4i32)$")>;
  1111. // ASIMD absolute diff accum long
  1112. def : InstRW<[THX2T99Write_7Cyc_F01],
  1113. (instregex "^[SU]ABAL")>;
  1114. // ASIMD arith, reduce, 4H/4S
  1115. def : InstRW<[THX2T99Write_5Cyc_F01],
  1116. (instregex "^[SU]?ADDL?V(v8i8|v4i16|v2i32)v$")>;
  1117. // ASIMD arith, reduce, 8B
  1118. def : InstRW<[THX2T99Write_5Cyc_F01],
  1119. (instregex "^[SU]?ADDL?V(v8i16|v4i32)v$")>;
  1120. // ASIMD arith, reduce, 16B/16H
  1121. def : InstRW<[THX2T99Write_10Cyc_F01],
  1122. (instregex "^[SU]?ADDL?Vv16i8v$")>;
  1123. // ASIMD max/min, reduce, 4H/4S
  1124. def : InstRW<[THX2T99Write_10Cyc_F01],
  1125. (instregex "^[SU](MIN|MAX)V(v4i16|v4i32)v$")>;
  1126. // ASIMD max/min, reduce, 8B/8H
  1127. def : InstRW<[THX2T99Write_7Cyc_F01],
  1128. (instregex "^[SU](MIN|MAX)V(v8i8|v8i16)v$")>;
  1129. // ASIMD max/min, reduce, 16B/16H
  1130. def : InstRW<[THX2T99Write_10Cyc_F01],
  1131. (instregex "^[SU](MIN|MAX)Vv16i8v$")>;
  1132. // ASIMD multiply, D-form
  1133. def : InstRW<[THX2T99Write_7Cyc_F01],
  1134. (instregex "^(P?MUL|SQR?DMULH)" #
  1135. "(v8i8|v4i16|v2i32|v1i8|v1i16|v1i32|v1i64)" #
  1136. "(_indexed)?$")>;
  1137. // ASIMD multiply, Q-form
  1138. def : InstRW<[THX2T99Write_7Cyc_F01],
  1139. (instregex "^(P?MUL|SQR?DMULH)(v16i8|v8i16|v4i32)(_indexed)?$")>;
  1140. // ASIMD multiply accumulate, D-form
  1141. def : InstRW<[THX2T99Write_7Cyc_F01],
  1142. (instregex "^ML[AS](v8i8|v4i16|v2i32)(_indexed)?$")>;
  1143. // ASIMD multiply accumulate, Q-form
  1144. def : InstRW<[THX2T99Write_7Cyc_F01],
  1145. (instregex "^ML[AS](v16i8|v8i16|v4i32)(_indexed)?$")>;
  1146. // ASIMD shift accumulate
  1147. def : InstRW<[THX2T99Write_7Cyc_F01],
  1148. (instregex "SRSRAv","SSRAv","URSRAv","USRAv")>;
  1149. // ASIMD shift by immed, basic
  1150. def : InstRW<[THX2T99Write_7Cyc_F01],
  1151. (instregex "RSHRNv","SHRNv", "SQRSHRNv","SQRSHRUNv",
  1152. "SQSHRNv","SQSHRUNv", "UQRSHRNv",
  1153. "UQSHRNv","SQXTNv","SQXTUNv","UQXTNv")>;
  1154. // ASIMD shift by immed, complex
  1155. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^[SU]?(Q|R){1,2}SHR")>;
  1156. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^SQSHLU")>;
  1157. // ASIMD shift by register, basic, Q-form
  1158. def : InstRW<[THX2T99Write_7Cyc_F01],
  1159. (instregex "^[SU]SHL(v16i8|v8i16|v4i32|v2i64)")>;
  1160. // ASIMD shift by register, complex, D-form
  1161. def : InstRW<[THX2T99Write_7Cyc_F01],
  1162. (instregex "^[SU][QR]{1,2}SHL" #
  1163. "(v1i8|v1i16|v1i32|v1i64|v8i8|v4i16|v2i32|b|d|h|s)")>;
  1164. // ASIMD shift by register, complex, Q-form
  1165. def : InstRW<[THX2T99Write_7Cyc_F01],
  1166. (instregex "^[SU][QR]{1,2}SHL(v16i8|v8i16|v4i32|v2i64)")>;
  1167. // ASIMD Arithmetic
  1168. def : InstRW<[THX2T99Write_7Cyc_F01],
  1169. (instregex "(ADD|SUB)(v8i8|v4i16|v2i32|v1i64)")>;
  1170. def : InstRW<[THX2T99Write_7Cyc_F01],
  1171. (instregex "(ADD|SUB)(v16i8|v8i16|v4i32|v2i64)")>;
  1172. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "(ADD|SUB)HNv.*")>;
  1173. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "(RADD|RSUB)HNv.*")>;
  1174. def : InstRW<[THX2T99Write_7Cyc_F01],
  1175. (instregex "^SQADD", "^SQNEG", "^SQSUB", "^SRHADD",
  1176. "^SUQADD", "^UQADD", "^UQSUB", "^URHADD", "^USQADD")>;
  1177. def : InstRW<[THX2T99Write_7Cyc_F01],
  1178. (instregex "ADDP(v16i8|v8i16|v4i32|v2i64)")>;
  1179. def : InstRW<[THX2T99Write_5Cyc_F01],
  1180. (instregex "((AND|ORN|EOR|EON)S?(Xr[rsi]|v16i8|v8i16|v4i32)|" #
  1181. "(ORR|BIC)S?(Xr[rs]|v16i8|v8i16|v4i32))")>;
  1182. def : InstRW<[THX2T99Write_5Cyc_F01],
  1183. (instregex "(CLS|CLZ|CNT)(v4i32|v8i16|v16i8)")>;
  1184. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^SADALP","^UADALP")>;
  1185. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^SADDLPv","^UADDLPv")>;
  1186. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^SADDLV","^UADDLV")>;
  1187. def : InstRW<[THX2T99Write_7Cyc_F01],
  1188. (instregex "^ADDVv","^SMAXVv","^UMAXVv","^SMINVv","^UMINVv")>;
  1189. def : InstRW<[THX2T99Write_7Cyc_F01],
  1190. (instregex "^SABAv","^UABAv","^SABALv","^UABALv")>;
  1191. def : InstRW<[THX2T99Write_7Cyc_F01],
  1192. (instregex "^SQADDv","^SQSUBv","^UQADDv","^UQSUBv")>;
  1193. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^SUQADDv","^USQADDv")>;
  1194. def : InstRW<[THX2T99Write_7Cyc_F01],
  1195. (instregex "^ADDHNv","^RADDHNv", "^RSUBHNv",
  1196. "^SQABS", "^SQADD", "^SQNEG", "^SQSUB",
  1197. "^SRHADD", "^SUBHNv", "^SUQADD",
  1198. "^UQADD", "^UQSUB", "^URHADD", "^USQADD")>;
  1199. def : InstRW<[THX2T99Write_7Cyc_F01],
  1200. (instregex "^CMEQv","^CMGEv","^CMGTv",
  1201. "^CMLEv","^CMLTv", "^CMHIv","^CMHSv")>;
  1202. def : InstRW<[THX2T99Write_7Cyc_F01],
  1203. (instregex "^SMAXv","^SMINv","^UMAXv","^UMINv",
  1204. "^SMAXPv","^SMINPv","^UMAXPv","^UMINPv")>;
  1205. def : InstRW<[THX2T99Write_7Cyc_F01],
  1206. (instregex "^SABDv","^UABDv", "^SABDLv","^UABDLv")>;
  1207. //---
  1208. // 3.13 ASIMD Floating-point Instructions
  1209. //---
  1210. // ASIMD FP absolute value
  1211. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FABSv")>;
  1212. // ASIMD FP arith, normal, D-form
  1213. // ASIMD FP arith, normal, Q-form
  1214. def : InstRW<[THX2T99Write_6Cyc_F01],
  1215. (instregex "^FABDv", "^FADDv", "^FSUBv")>;
  1216. // ASIMD FP arith,pairwise, D-form
  1217. // ASIMD FP arith, pairwise, Q-form
  1218. def : InstRW<[THX2T99Write_6Cyc_F01], (instregex "^FADDPv")>;
  1219. // ASIMD FP compare, D-form
  1220. // ASIMD FP compare, Q-form
  1221. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FACGEv", "^FACGTv")>;
  1222. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FCMEQv", "^FCMGEv",
  1223. "^FCMGTv", "^FCMLEv",
  1224. "^FCMLTv")>;
  1225. // ASIMD FP round, D-form
  1226. def : InstRW<[THX2T99Write_7Cyc_F01],
  1227. (instregex "^FRINT[AIMNPXZ](v2f32)")>;
  1228. // ASIMD FP round, Q-form
  1229. def : InstRW<[THX2T99Write_7Cyc_F01],
  1230. (instregex "^FRINT[AIMNPXZ](v4f32|v2f64)")>;
  1231. // ASIMD FP convert, long
  1232. // ASIMD FP convert, narrow
  1233. // ASIMD FP convert, other, D-form
  1234. // ASIMD FP convert, other, Q-form
  1235. // NOTE: Handled by WriteV.
  1236. // ASIMD FP convert, long and narrow
  1237. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^FCVT(L|N|XN)v")>;
  1238. // ASIMD FP convert, other, D-form
  1239. def : InstRW<[THX2T99Write_7Cyc_F01],
  1240. (instregex "^[FVSU]CVT([AMNPZ][SU])?(_Int)?(v2f32|v1i32|v2i32|v1i64)")>;
  1241. // ASIMD FP convert, other, Q-form
  1242. def : InstRW<[THX2T99Write_7Cyc_F01],
  1243. (instregex "^[FVSU]CVT([AMNPZ][SU])?(_Int)?(v4f32|v2f64|v4i32|v2i64)")>;
  1244. // ASIMD FP divide, D-form, F32
  1245. def : InstRW<[THX2T99Write_16Cyc_F01], (instrs FDIVv2f32)>;
  1246. def : InstRW<[THX2T99Write_16Cyc_F01], (instregex "FDIVv2f32")>;
  1247. // ASIMD FP divide, Q-form, F32
  1248. def : InstRW<[THX2T99Write_16Cyc_F01], (instrs FDIVv4f32)>;
  1249. def : InstRW<[THX2T99Write_16Cyc_F01], (instregex "FDIVv4f32")>;
  1250. // ASIMD FP divide, Q-form, F64
  1251. def : InstRW<[THX2T99Write_23Cyc_F01], (instrs FDIVv2f64)>;
  1252. def : InstRW<[THX2T99Write_23Cyc_F01], (instregex "FDIVv2f64")>;
  1253. // ASIMD FP max/min, normal, D-form
  1254. // ASIMD FP max/min, normal, Q-form
  1255. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FMAXv", "^FMAXNMv",
  1256. "^FMINv", "^FMINNMv")>;
  1257. // ASIMD FP max/min, pairwise, D-form
  1258. // ASIMD FP max/min, pairwise, Q-form
  1259. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FMAXPv", "^FMAXNMPv",
  1260. "^FMINPv", "^FMINNMPv")>;
  1261. // ASIMD FP max/min, reduce
  1262. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FMAXVv", "^FMAXNMVv",
  1263. "^FMINVv", "^FMINNMVv")>;
  1264. // ASIMD FP multiply, D-form, FZ
  1265. // ASIMD FP multiply, D-form, no FZ
  1266. // ASIMD FP multiply, Q-form, FZ
  1267. // ASIMD FP multiply, Q-form, no FZ
  1268. def : InstRW<[THX2T99Write_6Cyc_F01], (instregex "^FMULv", "^FMULXv")>;
  1269. def : InstRW<[THX2T99Write_6Cyc_F01],
  1270. (instregex "^FMULX?(v2f32|v1i32|v2i32|v1i64|32|64)")>;
  1271. def : InstRW<[THX2T99Write_6Cyc_F01],
  1272. (instregex "^FMULX?(v4f32|v2f64|v4i32|v2i64)")>;
  1273. // ASIMD FP multiply accumulate, Dform, FZ
  1274. // ASIMD FP multiply accumulate, Dform, no FZ
  1275. // ASIMD FP multiply accumulate, Qform, FZ
  1276. // ASIMD FP multiply accumulate, Qform, no FZ
  1277. def : InstRW<[THX2T99Write_6Cyc_F01], (instregex "^FMLAv", "^FMLSv")>;
  1278. def : InstRW<[THX2T99Write_6Cyc_F01],
  1279. (instregex "^FML[AS](v2f32|v1i32|v2i32|v1i64)")>;
  1280. def : InstRW<[THX2T99Write_6Cyc_F01],
  1281. (instregex "^FML[AS](v4f32|v2f64|v4i32|v2i64)")>;
  1282. // ASIMD FP negate
  1283. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FNEGv")>;
  1284. //--
  1285. // 3.14 ASIMD Miscellaneous Instructions
  1286. //--
  1287. // ASIMD bit reverse
  1288. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^RBITv")>;
  1289. // ASIMD bitwise insert, D-form
  1290. // ASIMD bitwise insert, Q-form
  1291. def : InstRW<[THX2T99Write_5Cyc_F01],
  1292. (instregex "^BIFv", "^BITv", "^BSLv", "^BSPv")>;
  1293. // ASIMD count, D-form
  1294. // ASIMD count, Q-form
  1295. def : InstRW<[THX2T99Write_5Cyc_F01],
  1296. (instregex "^CLSv", "^CLZv", "^CNTv")>;
  1297. // ASIMD duplicate, gen reg
  1298. // ASIMD duplicate, element
  1299. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^DUPv")>;
  1300. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^DUP(i8|i16|i32|i64)$")>;
  1301. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^DUPv.+gpr")>;
  1302. // ASIMD extract
  1303. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^EXTv")>;
  1304. // ASIMD extract narrow
  1305. def : InstRW<[THX2T99Write_7Cyc_F01], (instregex "^XTNv")>;
  1306. // ASIMD extract narrow, saturating
  1307. def : InstRW<[THX2T99Write_7Cyc_F01],
  1308. (instregex "^SQXTNv", "^SQXTUNv", "^UQXTNv")>;
  1309. // ASIMD insert, element to element
  1310. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^INSv")>;
  1311. // ASIMD transfer, element to gen reg
  1312. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^[SU]MOVv")>;
  1313. // ASIMD move, integer immed
  1314. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^MOVIv")>;
  1315. // ASIMD move, FP immed
  1316. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^FMOVv")>;
  1317. // ASIMD reciprocal estimate, D-form
  1318. // ASIMD reciprocal estimate, Q-form
  1319. def : InstRW<[THX2T99Write_5Cyc_F01],
  1320. (instregex "^FRECPEv", "^FRECPXv", "^URECPEv",
  1321. "^FRSQRTEv", "^URSQRTEv")>;
  1322. // ASIMD reciprocal step, D-form, FZ
  1323. // ASIMD reciprocal step, D-form, no FZ
  1324. // ASIMD reciprocal step, Q-form, FZ
  1325. // ASIMD reciprocal step, Q-form, no FZ
  1326. def : InstRW<[THX2T99Write_6Cyc_F01], (instregex "^FRECPSv", "^FRSQRTSv")>;
  1327. // ASIMD reverse
  1328. def : InstRW<[THX2T99Write_5Cyc_F01],
  1329. (instregex "^REV16v", "^REV32v", "^REV64v")>;
  1330. // ASIMD table lookup, D-form
  1331. // ASIMD table lookup, Q-form
  1332. def : InstRW<[THX2T99Write_8Cyc_F01], (instregex "^TBLv", "^TBXv")>;
  1333. // ASIMD transfer, element to word or word
  1334. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^[SU]MOVv")>;
  1335. // ASIMD transfer, element to gen reg
  1336. def : InstRW<[THX2T99Write_6Cyc_F01], (instregex "(S|U)MOVv.*")>;
  1337. // ASIMD transfer gen reg to element
  1338. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^INSv")>;
  1339. // ASIMD transpose
  1340. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^TRN1v", "^TRN2v",
  1341. "^UZP1v", "^UZP2v")>;
  1342. // ASIMD unzip/zip
  1343. def : InstRW<[THX2T99Write_5Cyc_F01], (instregex "^ZIP1v", "^ZIP2v")>;
  1344. //--
  1345. // 3.15 ASIMD Load Instructions
  1346. //--
  1347. // ASIMD load, 1 element, multiple, 1 reg, D-form
  1348. // ASIMD load, 1 element, multiple, 1 reg, Q-form
  1349. def : InstRW<[THX2T99Write_4Cyc_LS01],
  1350. (instregex "^LD1Onev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1351. def : InstRW<[THX2T99Write_4Cyc_LS01, WriteAdr],
  1352. (instregex "^LD1Onev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1353. // ASIMD load, 1 element, multiple, 2 reg, D-form
  1354. // ASIMD load, 1 element, multiple, 2 reg, Q-form
  1355. def : InstRW<[THX2T99Write_4Cyc_LS01],
  1356. (instregex "^LD1Twov(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1357. def : InstRW<[THX2T99Write_4Cyc_LS01, WriteAdr],
  1358. (instregex "^LD1Twov(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1359. // ASIMD load, 1 element, multiple, 3 reg, D-form
  1360. // ASIMD load, 1 element, multiple, 3 reg, Q-form
  1361. def : InstRW<[THX2T99Write_5Cyc_LS01],
  1362. (instregex "^LD1Threev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1363. def : InstRW<[THX2T99Write_5Cyc_LS01, WriteAdr],
  1364. (instregex "^LD1Threev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1365. // ASIMD load, 1 element, multiple, 4 reg, D-form
  1366. // ASIMD load, 1 element, multiple, 4 reg, Q-form
  1367. def : InstRW<[THX2T99Write_6Cyc_LS01],
  1368. (instregex "^LD1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1369. def : InstRW<[THX2T99Write_6Cyc_LS01, WriteAdr],
  1370. (instregex "^LD1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1371. // ASIMD load, 1 element, one lane, B/H/S
  1372. // ASIMD load, 1 element, one lane, D
  1373. def : InstRW<[THX2T99Write_5Cyc_LS01_F01], (instregex "^LD1i(8|16|32|64)$")>;
  1374. def : InstRW<[THX2T99Write_5Cyc_LS01_F01, WriteAdr],
  1375. (instregex "^LD1i(8|16|32|64)_POST$")>;
  1376. // ASIMD load, 1 element, all lanes, D-form, B/H/S
  1377. // ASIMD load, 1 element, all lanes, D-form, D
  1378. // ASIMD load, 1 element, all lanes, Q-form
  1379. def : InstRW<[THX2T99Write_5Cyc_LS01_F01],
  1380. (instregex "^LD1Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1381. def : InstRW<[THX2T99Write_5Cyc_LS01_F01, WriteAdr],
  1382. (instregex "^LD1Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1383. // ASIMD load, 2 element, multiple, D-form, B/H/S
  1384. // ASIMD load, 2 element, multiple, Q-form, D
  1385. def : InstRW<[THX2T99Write_5Cyc_LS01_F01],
  1386. (instregex "^LD2Twov(8b|4h|2s|16b|8h|4s|2d)$")>;
  1387. def : InstRW<[THX2T99Write_5Cyc_LS01_F01, WriteAdr],
  1388. (instregex "^LD2Twov(8b|4h|2s|16b|8h|4s|2d)_POST$")>;
  1389. // ASIMD load, 2 element, one lane, B/H
  1390. // ASIMD load, 2 element, one lane, S
  1391. // ASIMD load, 2 element, one lane, D
  1392. def : InstRW<[THX2T99Write_5Cyc_LS01_F01], (instregex "^LD2i(8|16|32|64)$")>;
  1393. def : InstRW<[THX2T99Write_5Cyc_LS01_F01, WriteAdr],
  1394. (instregex "^LD2i(8|16|32|64)_POST$")>;
  1395. // ASIMD load, 2 element, all lanes, D-form, B/H/S
  1396. // ASIMD load, 2 element, all lanes, D-form, D
  1397. // ASIMD load, 2 element, all lanes, Q-form
  1398. def : InstRW<[THX2T99Write_5Cyc_LS01_F01],
  1399. (instregex "^LD2Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1400. def : InstRW<[THX2T99Write_5Cyc_LS01_F01, WriteAdr],
  1401. (instregex "^LD2Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1402. // ASIMD load, 3 element, multiple, D-form, B/H/S
  1403. // ASIMD load, 3 element, multiple, Q-form, B/H/S
  1404. // ASIMD load, 3 element, multiple, Q-form, D
  1405. def : InstRW<[THX2T99Write_8Cyc_LS01_F01],
  1406. (instregex "^LD3Threev(8b|4h|2s|16b|8h|4s|2d)$")>;
  1407. def : InstRW<[THX2T99Write_8Cyc_LS01_F01, WriteAdr],
  1408. (instregex "^LD3Threev(8b|4h|2s|16b|8h|4s|2d)_POST$")>;
  1409. // ASIMD load, 3 element, one lone, B/H
  1410. // ASIMD load, 3 element, one lane, S
  1411. // ASIMD load, 3 element, one lane, D
  1412. def : InstRW<[THX2T99Write_7Cyc_LS01_F01], (instregex "^LD3i(8|16|32|64)$")>;
  1413. def : InstRW<[THX2T99Write_7Cyc_LS01_F01, WriteAdr],
  1414. (instregex "^LD3i(8|16|32|64)_POST$")>;
  1415. // ASIMD load, 3 element, all lanes, D-form, B/H/S
  1416. // ASIMD load, 3 element, all lanes, D-form, D
  1417. // ASIMD load, 3 element, all lanes, Q-form, B/H/S
  1418. // ASIMD load, 3 element, all lanes, Q-form, D
  1419. def : InstRW<[THX2T99Write_7Cyc_LS01_F01],
  1420. (instregex "^LD3Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1421. def : InstRW<[THX2T99Write_7Cyc_LS01_F01, WriteAdr],
  1422. (instregex "^LD3Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1423. // ASIMD load, 4 element, multiple, D-form, B/H/S
  1424. // ASIMD load, 4 element, multiple, Q-form, B/H/S
  1425. // ASIMD load, 4 element, multiple, Q-form, D
  1426. def : InstRW<[THX2T99Write_8Cyc_LS01_F01],
  1427. (instregex "^LD4Fourv(8b|4h|2s|16b|8h|4s|2d)$")>;
  1428. def : InstRW<[THX2T99Write_8Cyc_LS01_F01, WriteAdr],
  1429. (instregex "^LD4Fourv(8b|4h|2s|16b|8h|4s|2d)_POST$")>;
  1430. // ASIMD load, 4 element, one lane, B/H
  1431. // ASIMD load, 4 element, one lane, S
  1432. // ASIMD load, 4 element, one lane, D
  1433. def : InstRW<[THX2T99Write_6Cyc_LS01_F01], (instregex "^LD4i(8|16|32|64)$")>;
  1434. def : InstRW<[THX2T99Write_6Cyc_LS01_F01, WriteAdr],
  1435. (instregex "^LD4i(8|16|32|64)_POST$")>;
  1436. // ASIMD load, 4 element, all lanes, D-form, B/H/S
  1437. // ASIMD load, 4 element, all lanes, D-form, D
  1438. // ASIMD load, 4 element, all lanes, Q-form, B/H/S
  1439. // ASIMD load, 4 element, all lanes, Q-form, D
  1440. def : InstRW<[THX2T99Write_6Cyc_LS01_F01],
  1441. (instregex "^LD4Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1442. def : InstRW<[THX2T99Write_6Cyc_LS01_F01, WriteAdr],
  1443. (instregex "^LD4Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1444. //--
  1445. // 3.16 ASIMD Store Instructions
  1446. //--
  1447. // ASIMD store, 1 element, multiple, 1 reg, D-form
  1448. // ASIMD store, 1 element, multiple, 1 reg, Q-form
  1449. def : InstRW<[THX2T99Write_1Cyc_LS01],
  1450. (instregex "^ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1451. def : InstRW<[THX2T99Write_1Cyc_LS01, WriteAdr],
  1452. (instregex "^ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1453. // ASIMD store, 1 element, multiple, 2 reg, D-form
  1454. // ASIMD store, 1 element, multiple, 2 reg, Q-form
  1455. def : InstRW<[THX2T99Write_1Cyc_LS01],
  1456. (instregex "^ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1457. def : InstRW<[THX2T99Write_1Cyc_LS01, WriteAdr],
  1458. (instregex "^ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1459. // ASIMD store, 1 element, multiple, 3 reg, D-form
  1460. // ASIMD store, 1 element, multiple, 3 reg, Q-form
  1461. def : InstRW<[THX2T99Write_1Cyc_LS01],
  1462. (instregex "^ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1463. def : InstRW<[THX2T99Write_1Cyc_LS01, WriteAdr],
  1464. (instregex "^ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1465. // ASIMD store, 1 element, multiple, 4 reg, D-form
  1466. // ASIMD store, 1 element, multiple, 4 reg, Q-form
  1467. def : InstRW<[THX2T99Write_1Cyc_LS01],
  1468. (instregex "^ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  1469. def : InstRW<[THX2T99Write_1Cyc_LS01, WriteAdr],
  1470. (instregex "^ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  1471. // ASIMD store, 1 element, one lane, B/H/S
  1472. // ASIMD store, 1 element, one lane, D
  1473. def : InstRW<[THX2T99Write_1Cyc_LS01_F01],
  1474. (instregex "^ST1i(8|16|32|64)$")>;
  1475. def : InstRW<[THX2T99Write_1Cyc_LS01_F01, WriteAdr],
  1476. (instregex "^ST1i(8|16|32|64)_POST$")>;
  1477. // ASIMD store, 2 element, multiple, D-form, B/H/S
  1478. // ASIMD store, 2 element, multiple, Q-form, B/H/S
  1479. // ASIMD store, 2 element, multiple, Q-form, D
  1480. def : InstRW<[THX2T99Write_1Cyc_LS01_F01],
  1481. (instregex "^ST2Twov(8b|4h|2s|16b|8h|4s|2d)$")>;
  1482. def : InstRW<[THX2T99Write_1Cyc_LS01_F01, WriteAdr],
  1483. (instregex "^ST2Twov(8b|4h|2s|16b|8h|4s|2d)_POST$")>;
  1484. // ASIMD store, 2 element, one lane, B/H/S
  1485. // ASIMD store, 2 element, one lane, D
  1486. def : InstRW<[THX2T99Write_1Cyc_LS01_F01],
  1487. (instregex "^ST2i(8|16|32|64)$")>;
  1488. def : InstRW<[THX2T99Write_1Cyc_LS01_F01, WriteAdr],
  1489. (instregex "^ST2i(8|16|32|64)_POST$")>;
  1490. // ASIMD store, 3 element, multiple, D-form, B/H/S
  1491. // ASIMD store, 3 element, multiple, Q-form, B/H/S
  1492. // ASIMD store, 3 element, multiple, Q-form, D
  1493. def : InstRW<[THX2T99Write_1Cyc_LS01_F01],
  1494. (instregex "^ST3Threev(8b|4h|2s|16b|8h|4s|2d)$")>;
  1495. def : InstRW<[THX2T99Write_1Cyc_LS01_F01, WriteAdr],
  1496. (instregex "^ST3Threev(8b|4h|2s|16b|8h|4s|2d)_POST$")>;
  1497. // ASIMD store, 3 element, one lane, B/H
  1498. // ASIMD store, 3 element, one lane, S
  1499. // ASIMD store, 3 element, one lane, D
  1500. def : InstRW<[THX2T99Write_1Cyc_LS01_F01], (instregex "^ST3i(8|16|32|64)$")>;
  1501. def : InstRW<[THX2T99Write_1Cyc_LS01_F01, WriteAdr],
  1502. (instregex "^ST3i(8|16|32|64)_POST$")>;
  1503. // ASIMD store, 4 element, multiple, D-form, B/H/S
  1504. // ASIMD store, 4 element, multiple, Q-form, B/H/S
  1505. // ASIMD store, 4 element, multiple, Q-form, D
  1506. def : InstRW<[THX2T99Write_1Cyc_LS01_F01],
  1507. (instregex "^ST4Fourv(8b|4h|2s|16b|8h|4s|2d)$")>;
  1508. def : InstRW<[THX2T99Write_1Cyc_LS01_F01, WriteAdr],
  1509. (instregex "^ST4Fourv(8b|4h|2s|16b|8h|4s|2d)_POST$")>;
  1510. // ASIMD store, 4 element, one lane, B/H
  1511. // ASIMD store, 4 element, one lane, S
  1512. // ASIMD store, 4 element, one lane, D
  1513. def : InstRW<[THX2T99Write_1Cyc_LS01_F01], (instregex "^ST4i(8|16|32|64)$")>;
  1514. def : InstRW<[THX2T99Write_1Cyc_LS01_F01, WriteAdr],
  1515. (instregex "^ST4i(8|16|32|64)_POST$")>;
  1516. // V8.1a Atomics (LSE)
  1517. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1518. (instrs CASB, CASH, CASW, CASX)>;
  1519. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1520. (instrs CASAB, CASAH, CASAW, CASAX)>;
  1521. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1522. (instrs CASLB, CASLH, CASLW, CASLX)>;
  1523. def : InstRW<[THX2T99Write_16Cyc_I012, WriteAtomic],
  1524. (instrs CASALB, CASALH, CASALW, CASALX)>;
  1525. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1526. (instrs LDLARB, LDLARH, LDLARW, LDLARX)>;
  1527. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1528. (instrs LDADDB, LDADDH, LDADDW, LDADDX)>;
  1529. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1530. (instrs LDADDAB, LDADDAH, LDADDAW, LDADDAX)>;
  1531. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1532. (instrs LDADDLB, LDADDLH, LDADDLW, LDADDLX)>;
  1533. def : InstRW<[THX2T99Write_16Cyc_I012, WriteAtomic],
  1534. (instrs LDADDALB, LDADDALH, LDADDALW, LDADDALX)>;
  1535. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1536. (instrs LDCLRB, LDCLRH, LDCLRW, LDCLRX)>;
  1537. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1538. (instrs LDCLRAB, LDCLRAH, LDCLRAW, LDCLRAX)>;
  1539. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1540. (instrs LDCLRLB, LDCLRLH, LDCLRLW, LDCLRLX)>;
  1541. def : InstRW<[THX2T99Write_16Cyc_I012, WriteAtomic],
  1542. (instrs LDCLRALB, LDCLRALH, LDCLRALW, LDCLRALX)>;
  1543. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1544. (instrs LDEORB, LDEORH, LDEORW, LDEORX)>;
  1545. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1546. (instrs LDEORAB, LDEORAH, LDEORAW, LDEORAX)>;
  1547. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1548. (instrs LDEORLB, LDEORLH, LDEORLW, LDEORLX)>;
  1549. def : InstRW<[THX2T99Write_16Cyc_I012, WriteAtomic],
  1550. (instrs LDEORALB, LDEORALH, LDEORALW, LDEORALX)>;
  1551. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1552. (instrs LDSETB, LDSETH, LDSETW, LDSETX)>;
  1553. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1554. (instrs LDSETAB, LDSETAH, LDSETAW, LDSETAX)>;
  1555. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1556. (instrs LDSETLB, LDSETLH, LDSETLW, LDSETLX)>;
  1557. def : InstRW<[THX2T99Write_16Cyc_I012, WriteAtomic],
  1558. (instrs LDSETALB, LDSETALH, LDSETALW, LDSETALX)>;
  1559. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1560. (instrs LDSMAXB, LDSMAXH, LDSMAXW, LDSMAXX,
  1561. LDSMAXAB, LDSMAXAH, LDSMAXAW, LDSMAXAX,
  1562. LDSMAXLB, LDSMAXLH, LDSMAXLW, LDSMAXLX,
  1563. LDSMAXALB, LDSMAXALH, LDSMAXALW, LDSMAXALX)>;
  1564. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1565. (instrs LDSMINB, LDSMINH, LDSMINW, LDSMINX,
  1566. LDSMINAB, LDSMINAH, LDSMINAW, LDSMINAX,
  1567. LDSMINLB, LDSMINLH, LDSMINLW, LDSMINLX,
  1568. LDSMINALB, LDSMINALH, LDSMINALW, LDSMINALX)>;
  1569. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1570. (instrs LDUMAXB, LDUMAXH, LDUMAXW, LDUMAXX,
  1571. LDUMAXAB, LDUMAXAH, LDUMAXAW, LDUMAXAX,
  1572. LDUMAXLB, LDUMAXLH, LDUMAXLW, LDUMAXLX,
  1573. LDUMAXALB, LDUMAXALH, LDUMAXALW, LDUMAXALX)>;
  1574. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1575. (instrs LDUMINB, LDUMINH, LDUMINW, LDUMINX,
  1576. LDUMINAB, LDUMINAH, LDUMINAW, LDUMINAX,
  1577. LDUMINLB, LDUMINLH, LDUMINLW, LDUMINLX,
  1578. LDUMINALB, LDUMINALH, LDUMINALW, LDUMINALX)>;
  1579. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1580. (instrs SWPB, SWPH, SWPW, SWPX)>;
  1581. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1582. (instrs SWPAB, SWPAH, SWPAW, SWPAX)>;
  1583. def : InstRW<[THX2T99Write_12Cyc_I012, WriteAtomic],
  1584. (instrs SWPLB, SWPLH, SWPLW, SWPLX)>;
  1585. def : InstRW<[THX2T99Write_16Cyc_I012, WriteAtomic],
  1586. (instrs SWPALB, SWPALH, SWPALW, SWPALX)>;
  1587. def : InstRW<[THX2T99Write_8Cyc_I012, WriteAtomic],
  1588. (instrs STLLRB, STLLRH, STLLRW, STLLRX)>;
  1589. } // SchedModel = ThunderX2T99Model