AArch64SchedThunderX2T99.td 69 KB

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