PPCInstrFormats.td 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191
  1. //===- PowerPCInstrFormats.td - PowerPC Instruction Formats --*- 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. //
  10. // PowerPC instruction formats
  11. class I<bits<6> opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin>
  12. : Instruction {
  13. field bits<32> Inst;
  14. field bits<32> SoftFail = 0;
  15. let Size = 4;
  16. bit PPC64 = 0; // Default value, override with isPPC64
  17. let Namespace = "PPC";
  18. let Inst{0-5} = opcode;
  19. let OutOperandList = OOL;
  20. let InOperandList = IOL;
  21. let AsmString = asmstr;
  22. let Itinerary = itin;
  23. bits<1> PPC970_First = 0;
  24. bits<1> PPC970_Single = 0;
  25. bits<1> PPC970_Cracked = 0;
  26. bits<3> PPC970_Unit = 0;
  27. /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
  28. /// these must be reflected there! See comments there for what these are.
  29. let TSFlags{0} = PPC970_First;
  30. let TSFlags{1} = PPC970_Single;
  31. let TSFlags{2} = PPC970_Cracked;
  32. let TSFlags{5-3} = PPC970_Unit;
  33. // Indicate that this instruction is of type X-Form Load or Store
  34. bits<1> XFormMemOp = 0;
  35. let TSFlags{6} = XFormMemOp;
  36. // Indicate that this instruction is prefixed.
  37. bits<1> Prefixed = 0;
  38. let TSFlags{7} = Prefixed;
  39. // Fields used for relation models.
  40. string BaseName = "";
  41. // For cases where multiple instruction definitions really represent the
  42. // same underlying instruction but with one definition for 64-bit arguments
  43. // and one for 32-bit arguments, this bit breaks the degeneracy between
  44. // the two forms and allows TableGen to generate mapping tables.
  45. bit Interpretation64Bit = 0;
  46. }
  47. class PPC970_DGroup_First { bits<1> PPC970_First = 1; }
  48. class PPC970_DGroup_Single { bits<1> PPC970_Single = 1; }
  49. class PPC970_DGroup_Cracked { bits<1> PPC970_Cracked = 1; }
  50. class PPC970_MicroCode;
  51. class PPC970_Unit_Pseudo { bits<3> PPC970_Unit = 0; }
  52. class PPC970_Unit_FXU { bits<3> PPC970_Unit = 1; }
  53. class PPC970_Unit_LSU { bits<3> PPC970_Unit = 2; }
  54. class PPC970_Unit_FPU { bits<3> PPC970_Unit = 3; }
  55. class PPC970_Unit_CRU { bits<3> PPC970_Unit = 4; }
  56. class PPC970_Unit_VALU { bits<3> PPC970_Unit = 5; }
  57. class PPC970_Unit_VPERM { bits<3> PPC970_Unit = 6; }
  58. class PPC970_Unit_BRU { bits<3> PPC970_Unit = 7; }
  59. class XFormMemOp { bits<1> XFormMemOp = 1; }
  60. // Two joined instructions; used to emit two adjacent instructions as one.
  61. // The itinerary from the first instruction is used for scheduling and
  62. // classification.
  63. class I2<bits<6> opcode1, bits<6> opcode2, dag OOL, dag IOL, string asmstr,
  64. InstrItinClass itin>
  65. : Instruction {
  66. field bits<64> Inst;
  67. field bits<64> SoftFail = 0;
  68. let Size = 8;
  69. bit PPC64 = 0; // Default value, override with isPPC64
  70. let Namespace = "PPC";
  71. let Inst{0-5} = opcode1;
  72. let Inst{32-37} = opcode2;
  73. let OutOperandList = OOL;
  74. let InOperandList = IOL;
  75. let AsmString = asmstr;
  76. let Itinerary = itin;
  77. bits<1> PPC970_First = 0;
  78. bits<1> PPC970_Single = 0;
  79. bits<1> PPC970_Cracked = 0;
  80. bits<3> PPC970_Unit = 0;
  81. /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
  82. /// these must be reflected there! See comments there for what these are.
  83. let TSFlags{0} = PPC970_First;
  84. let TSFlags{1} = PPC970_Single;
  85. let TSFlags{2} = PPC970_Cracked;
  86. let TSFlags{5-3} = PPC970_Unit;
  87. // Fields used for relation models.
  88. string BaseName = "";
  89. bit Interpretation64Bit = 0;
  90. }
  91. // Base class for all X-Form memory instructions
  92. class IXFormMemOp<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  93. InstrItinClass itin>
  94. :I<opcode, OOL, IOL, asmstr, itin>, XFormMemOp;
  95. // 1.7.1 I-Form
  96. class IForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr,
  97. InstrItinClass itin, list<dag> pattern>
  98. : I<opcode, OOL, IOL, asmstr, itin> {
  99. let Pattern = pattern;
  100. bits<24> LI;
  101. let Inst{6-29} = LI;
  102. let Inst{30} = aa;
  103. let Inst{31} = lk;
  104. }
  105. // 1.7.2 B-Form
  106. class BForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr>
  107. : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
  108. bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
  109. bits<3> CR;
  110. bits<14> BD;
  111. bits<5> BI;
  112. let BI{0-1} = BIBO{5-6};
  113. let BI{2-4} = CR{0-2};
  114. let Inst{6-10} = BIBO{4-0};
  115. let Inst{11-15} = BI;
  116. let Inst{16-29} = BD;
  117. let Inst{30} = aa;
  118. let Inst{31} = lk;
  119. }
  120. class BForm_1<bits<6> opcode, bits<5> bo, bit aa, bit lk, dag OOL, dag IOL,
  121. string asmstr>
  122. : BForm<opcode, aa, lk, OOL, IOL, asmstr> {
  123. let BIBO{4-0} = bo;
  124. let BIBO{6-5} = 0;
  125. let CR = 0;
  126. }
  127. class BForm_2<bits<6> opcode, bits<5> bo, bits<5> bi, bit aa, bit lk,
  128. dag OOL, dag IOL, string asmstr>
  129. : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
  130. bits<14> BD;
  131. let Inst{6-10} = bo;
  132. let Inst{11-15} = bi;
  133. let Inst{16-29} = BD;
  134. let Inst{30} = aa;
  135. let Inst{31} = lk;
  136. }
  137. class BForm_3<bits<6> opcode, bit aa, bit lk,
  138. dag OOL, dag IOL, string asmstr>
  139. : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
  140. bits<5> BO;
  141. bits<5> BI;
  142. bits<14> BD;
  143. let Inst{6-10} = BO;
  144. let Inst{11-15} = BI;
  145. let Inst{16-29} = BD;
  146. let Inst{30} = aa;
  147. let Inst{31} = lk;
  148. }
  149. class BForm_3_at<bits<6> opcode, bit aa, bit lk,
  150. dag OOL, dag IOL, string asmstr>
  151. : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
  152. bits<5> BO;
  153. bits<2> at;
  154. bits<5> BI;
  155. bits<14> BD;
  156. let Inst{6-8} = BO{4-2};
  157. let Inst{9-10} = at;
  158. let Inst{11-15} = BI;
  159. let Inst{16-29} = BD;
  160. let Inst{30} = aa;
  161. let Inst{31} = lk;
  162. }
  163. class BForm_4<bits<6> opcode, bits<5> bo, bit aa, bit lk,
  164. dag OOL, dag IOL, string asmstr>
  165. : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
  166. bits<5> BI;
  167. bits<14> BD;
  168. let Inst{6-10} = bo;
  169. let Inst{11-15} = BI;
  170. let Inst{16-29} = BD;
  171. let Inst{30} = aa;
  172. let Inst{31} = lk;
  173. }
  174. // 1.7.3 SC-Form
  175. class SCForm<bits<6> opcode, bits<1> xo,
  176. dag OOL, dag IOL, string asmstr, InstrItinClass itin,
  177. list<dag> pattern>
  178. : I<opcode, OOL, IOL, asmstr, itin> {
  179. bits<7> LEV;
  180. let Pattern = pattern;
  181. let Inst{20-26} = LEV;
  182. let Inst{30} = xo;
  183. }
  184. // 1.7.4 D-Form
  185. class DForm_base<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  186. InstrItinClass itin, list<dag> pattern>
  187. : I<opcode, OOL, IOL, asmstr, itin> {
  188. bits<5> A;
  189. bits<5> B;
  190. bits<16> C;
  191. let Pattern = pattern;
  192. let Inst{6-10} = A;
  193. let Inst{11-15} = B;
  194. let Inst{16-31} = C;
  195. }
  196. class DForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  197. InstrItinClass itin, list<dag> pattern>
  198. : I<opcode, OOL, IOL, asmstr, itin> {
  199. bits<5> A;
  200. bits<21> Addr;
  201. let Pattern = pattern;
  202. let Inst{6-10} = A;
  203. let Inst{11-15} = Addr{20-16}; // Base Reg
  204. let Inst{16-31} = Addr{15-0}; // Displacement
  205. }
  206. class DForm_1a<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  207. InstrItinClass itin, list<dag> pattern>
  208. : I<opcode, OOL, IOL, asmstr, itin> {
  209. bits<5> A;
  210. bits<16> C;
  211. bits<5> B;
  212. let Pattern = pattern;
  213. let Inst{6-10} = A;
  214. let Inst{11-15} = B;
  215. let Inst{16-31} = C;
  216. }
  217. class DForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  218. InstrItinClass itin, list<dag> pattern>
  219. : DForm_base<opcode, OOL, IOL, asmstr, itin, pattern> {
  220. // Even though ADDIC_rec does not really have an RC bit, provide
  221. // the declaration of one here so that isRecordForm has something to set.
  222. bit RC = 0;
  223. }
  224. class DForm_2_r0<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  225. InstrItinClass itin, list<dag> pattern>
  226. : I<opcode, OOL, IOL, asmstr, itin> {
  227. bits<5> A;
  228. bits<16> B;
  229. let Pattern = pattern;
  230. let Inst{6-10} = A;
  231. let Inst{11-15} = 0;
  232. let Inst{16-31} = B;
  233. }
  234. class DForm_4<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  235. InstrItinClass itin, list<dag> pattern>
  236. : I<opcode, OOL, IOL, asmstr, itin> {
  237. bits<5> B;
  238. bits<5> A;
  239. bits<16> C;
  240. let Pattern = pattern;
  241. let Inst{6-10} = A;
  242. let Inst{11-15} = B;
  243. let Inst{16-31} = C;
  244. }
  245. class DForm_4_zero<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  246. InstrItinClass itin, list<dag> pattern>
  247. : DForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
  248. let A = 0;
  249. let Addr = 0;
  250. }
  251. class DForm_4_fixedreg_zero<bits<6> opcode, bits<5> R, dag OOL, dag IOL,
  252. string asmstr, InstrItinClass itin,
  253. list<dag> pattern>
  254. : DForm_4<opcode, OOL, IOL, asmstr, itin, pattern> {
  255. let A = R;
  256. let B = R;
  257. let C = 0;
  258. }
  259. class IForm_and_DForm_1<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
  260. dag OOL, dag IOL, string asmstr,
  261. InstrItinClass itin, list<dag> pattern>
  262. : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
  263. bits<5> A;
  264. bits<21> Addr;
  265. let Pattern = pattern;
  266. bits<24> LI;
  267. let Inst{6-29} = LI;
  268. let Inst{30} = aa;
  269. let Inst{31} = lk;
  270. let Inst{38-42} = A;
  271. let Inst{43-47} = Addr{20-16}; // Base Reg
  272. let Inst{48-63} = Addr{15-0}; // Displacement
  273. }
  274. // This is used to emit BL8+NOP.
  275. class IForm_and_DForm_4_zero<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
  276. dag OOL, dag IOL, string asmstr,
  277. InstrItinClass itin, list<dag> pattern>
  278. : IForm_and_DForm_1<opcode1, aa, lk, opcode2,
  279. OOL, IOL, asmstr, itin, pattern> {
  280. let A = 0;
  281. let Addr = 0;
  282. }
  283. class DForm_5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  284. InstrItinClass itin>
  285. : I<opcode, OOL, IOL, asmstr, itin> {
  286. bits<3> BF;
  287. bits<1> L;
  288. bits<5> RA;
  289. bits<16> I;
  290. let Inst{6-8} = BF;
  291. let Inst{9} = 0;
  292. let Inst{10} = L;
  293. let Inst{11-15} = RA;
  294. let Inst{16-31} = I;
  295. }
  296. class DForm_5_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  297. InstrItinClass itin>
  298. : DForm_5<opcode, OOL, IOL, asmstr, itin> {
  299. let L = PPC64;
  300. }
  301. class DForm_6<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  302. InstrItinClass itin>
  303. : DForm_5<opcode, OOL, IOL, asmstr, itin>;
  304. class DForm_6_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  305. InstrItinClass itin>
  306. : DForm_6<opcode, OOL, IOL, asmstr, itin> {
  307. let L = PPC64;
  308. }
  309. // 1.7.5 DS-Form
  310. class DSForm_1<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
  311. InstrItinClass itin, list<dag> pattern>
  312. : I<opcode, OOL, IOL, asmstr, itin> {
  313. bits<5> RST;
  314. bits<19> DS_RA;
  315. let Pattern = pattern;
  316. let Inst{6-10} = RST;
  317. let Inst{11-15} = DS_RA{18-14}; // Register #
  318. let Inst{16-29} = DS_RA{13-0}; // Displacement.
  319. let Inst{30-31} = xo;
  320. }
  321. // ISA V3.0B 1.6.6 DX-Form
  322. class DXForm<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
  323. InstrItinClass itin, list<dag> pattern>
  324. : I<opcode, OOL, IOL, asmstr, itin> {
  325. bits<5> RT;
  326. bits<16> D;
  327. let Pattern = pattern;
  328. let Inst{6-10} = RT;
  329. let Inst{11-15} = D{5-1}; // d1
  330. let Inst{16-25} = D{15-6}; // d0
  331. let Inst{26-30} = xo;
  332. let Inst{31} = D{0}; // d2
  333. }
  334. // DQ-Form: [PO T RA DQ TX XO] or [PO S RA DQ SX XO]
  335. class DQ_RD6_RS5_DQ12<bits<6> opcode, bits<3> xo, dag OOL, dag IOL,
  336. string asmstr, InstrItinClass itin, list<dag> pattern>
  337. : I<opcode, OOL, IOL, asmstr, itin> {
  338. bits<6> XT;
  339. bits<17> DS_RA;
  340. let Pattern = pattern;
  341. let Inst{6-10} = XT{4-0};
  342. let Inst{11-15} = DS_RA{16-12}; // Register #
  343. let Inst{16-27} = DS_RA{11-0}; // Displacement.
  344. let Inst{28} = XT{5};
  345. let Inst{29-31} = xo;
  346. }
  347. class DQForm_RTp5_RA17_MEM<bits<6> opcode, bits<4> xo, dag OOL, dag IOL,
  348. string asmstr, InstrItinClass itin,
  349. list<dag> pattern>
  350. : I<opcode, OOL, IOL, asmstr, itin> {
  351. bits<5> RTp;
  352. bits<17> DQ_RA;
  353. let Pattern = pattern;
  354. let Inst{6-10} = RTp{4-0};
  355. let Inst{11-15} = DQ_RA{16-12}; // Register #
  356. let Inst{16-27} = DQ_RA{11-0}; // Displacement.
  357. let Inst{28-31} = xo;
  358. }
  359. // 1.7.6 X-Form
  360. class XForm_base_r3xo<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  361. InstrItinClass itin, list<dag> pattern>
  362. : I<opcode, OOL, IOL, asmstr, itin> {
  363. bits<5> RST;
  364. bits<5> A;
  365. bits<5> B;
  366. let Pattern = pattern;
  367. bit RC = 0; // set by isRecordForm
  368. let Inst{6-10} = RST;
  369. let Inst{11-15} = A;
  370. let Inst{16-20} = B;
  371. let Inst{21-30} = xo;
  372. let Inst{31} = RC;
  373. }
  374. class XForm_base_r3xo_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  375. string asmstr, InstrItinClass itin,
  376. list<dag> pattern>
  377. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
  378. class XForm_tlb<bits<10> xo, dag OOL, dag IOL, string asmstr,
  379. InstrItinClass itin> : XForm_base_r3xo<31, xo, OOL, IOL, asmstr, itin, []> {
  380. let RST = 0;
  381. }
  382. class XForm_attn<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  383. InstrItinClass itin>
  384. : I<opcode, OOL, IOL, asmstr, itin> {
  385. let Inst{21-30} = xo;
  386. }
  387. // This is the same as XForm_base_r3xo, but the first two operands are swapped
  388. // when code is emitted.
  389. class XForm_base_r3xo_swapped
  390. <bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  391. InstrItinClass itin>
  392. : I<opcode, OOL, IOL, asmstr, itin> {
  393. bits<5> A;
  394. bits<5> RST;
  395. bits<5> B;
  396. bit RC = 0; // set by isRecordForm
  397. let Inst{6-10} = RST;
  398. let Inst{11-15} = A;
  399. let Inst{16-20} = B;
  400. let Inst{21-30} = xo;
  401. let Inst{31} = RC;
  402. }
  403. class XForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  404. InstrItinClass itin, list<dag> pattern>
  405. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
  406. class XForm_1_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  407. InstrItinClass itin, list<dag> pattern>
  408. : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
  409. class XForm_1a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  410. InstrItinClass itin, list<dag> pattern>
  411. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  412. let RST = 0;
  413. }
  414. class XForm_rs<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  415. InstrItinClass itin, list<dag> pattern>
  416. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  417. let A = 0;
  418. let B = 0;
  419. }
  420. class XForm_tlbws<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  421. InstrItinClass itin, list<dag> pattern>
  422. : I<opcode, OOL, IOL, asmstr, itin> {
  423. bits<5> RST;
  424. bits<5> A;
  425. bits<1> WS;
  426. let Pattern = pattern;
  427. let Inst{6-10} = RST;
  428. let Inst{11-15} = A;
  429. let Inst{20} = WS;
  430. let Inst{21-30} = xo;
  431. let Inst{31} = 0;
  432. }
  433. class XForm_6<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  434. InstrItinClass itin, list<dag> pattern>
  435. : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
  436. let Pattern = pattern;
  437. }
  438. class XForm_8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  439. InstrItinClass itin, list<dag> pattern>
  440. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
  441. class XForm_8_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  442. InstrItinClass itin, list<dag> pattern>
  443. : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
  444. class XForm_10<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  445. InstrItinClass itin, list<dag> pattern>
  446. : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
  447. let Pattern = pattern;
  448. }
  449. class XForm_11<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  450. InstrItinClass itin, list<dag> pattern>
  451. : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
  452. let B = 0;
  453. let Pattern = pattern;
  454. }
  455. class XForm_16<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  456. InstrItinClass itin>
  457. : I<opcode, OOL, IOL, asmstr, itin> {
  458. bits<3> BF;
  459. bits<1> L;
  460. bits<5> RA;
  461. bits<5> RB;
  462. let Inst{6-8} = BF;
  463. let Inst{9} = 0;
  464. let Inst{10} = L;
  465. let Inst{11-15} = RA;
  466. let Inst{16-20} = RB;
  467. let Inst{21-30} = xo;
  468. let Inst{31} = 0;
  469. }
  470. class XForm_icbt<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  471. InstrItinClass itin>
  472. : I<opcode, OOL, IOL, asmstr, itin> {
  473. bits<4> CT;
  474. bits<5> RA;
  475. bits<5> RB;
  476. let Inst{6} = 0;
  477. let Inst{7-10} = CT;
  478. let Inst{11-15} = RA;
  479. let Inst{16-20} = RB;
  480. let Inst{21-30} = xo;
  481. let Inst{31} = 0;
  482. }
  483. class XForm_sr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  484. InstrItinClass itin>
  485. : I<opcode, OOL, IOL, asmstr, itin> {
  486. bits<5> RS;
  487. bits<4> SR;
  488. let Inst{6-10} = RS;
  489. let Inst{12-15} = SR;
  490. let Inst{21-30} = xo;
  491. }
  492. class XForm_mbar<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  493. InstrItinClass itin>
  494. : I<opcode, OOL, IOL, asmstr, itin> {
  495. bits<5> MO;
  496. let Inst{6-10} = MO;
  497. let Inst{21-30} = xo;
  498. }
  499. class XForm_srin<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  500. InstrItinClass itin>
  501. : I<opcode, OOL, IOL, asmstr, itin> {
  502. bits<5> RS;
  503. bits<5> RB;
  504. let Inst{6-10} = RS;
  505. let Inst{16-20} = RB;
  506. let Inst{21-30} = xo;
  507. }
  508. class XForm_mtmsr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  509. InstrItinClass itin>
  510. : I<opcode, OOL, IOL, asmstr, itin> {
  511. bits<5> RS;
  512. bits<1> L;
  513. let Inst{6-10} = RS;
  514. let Inst{15} = L;
  515. let Inst{21-30} = xo;
  516. }
  517. class XForm_16_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  518. InstrItinClass itin>
  519. : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
  520. let L = PPC64;
  521. }
  522. class XForm_17<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  523. InstrItinClass itin>
  524. : I<opcode, OOL, IOL, asmstr, itin> {
  525. bits<3> BF;
  526. bits<5> FRA;
  527. bits<5> FRB;
  528. let Inst{6-8} = BF;
  529. let Inst{9-10} = 0;
  530. let Inst{11-15} = FRA;
  531. let Inst{16-20} = FRB;
  532. let Inst{21-30} = xo;
  533. let Inst{31} = 0;
  534. }
  535. class XForm_17a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  536. InstrItinClass itin, list<dag> pattern>
  537. : XForm_17<opcode, xo, OOL, IOL, asmstr, itin > {
  538. let FRA = 0;
  539. let Pattern = pattern;
  540. }
  541. class XForm_18<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  542. InstrItinClass itin, list<dag> pattern>
  543. : I<opcode, OOL, IOL, asmstr, itin> {
  544. bits<5> FRT;
  545. bits<5> FRA;
  546. bits<5> FRB;
  547. let Pattern = pattern;
  548. let Inst{6-10} = FRT;
  549. let Inst{11-15} = FRA;
  550. let Inst{16-20} = FRB;
  551. let Inst{21-30} = xo;
  552. let Inst{31} = 0;
  553. }
  554. class XForm_19<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  555. InstrItinClass itin, list<dag> pattern>
  556. : XForm_18<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  557. let FRA = 0;
  558. }
  559. class XForm_20<bits<6> opcode, bits<6> xo, dag OOL, dag IOL, string asmstr,
  560. InstrItinClass itin, list<dag> pattern>
  561. : I<opcode, OOL, IOL, asmstr, itin> {
  562. bits<5> FRT;
  563. bits<5> FRA;
  564. bits<5> FRB;
  565. bits<4> tttt;
  566. let Pattern = pattern;
  567. let Inst{6-10} = FRT;
  568. let Inst{11-15} = FRA;
  569. let Inst{16-20} = FRB;
  570. let Inst{21-24} = tttt;
  571. let Inst{25-30} = xo;
  572. let Inst{31} = 0;
  573. }
  574. class XForm_24<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  575. InstrItinClass itin, list<dag> pattern>
  576. : I<opcode, OOL, IOL, asmstr, itin> {
  577. let Pattern = pattern;
  578. let Inst{6-10} = 31;
  579. let Inst{11-15} = 0;
  580. let Inst{16-20} = 0;
  581. let Inst{21-30} = xo;
  582. let Inst{31} = 0;
  583. }
  584. class XForm_24_sync<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  585. string asmstr, InstrItinClass itin, list<dag> pattern>
  586. : I<opcode, OOL, IOL, asmstr, itin> {
  587. bits<2> L;
  588. let Pattern = pattern;
  589. let Inst{6-8} = 0;
  590. let Inst{9-10} = L;
  591. let Inst{11-15} = 0;
  592. let Inst{16-20} = 0;
  593. let Inst{21-30} = xo;
  594. let Inst{31} = 0;
  595. }
  596. class XForm_24_eieio<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  597. string asmstr, InstrItinClass itin, list<dag> pattern>
  598. : XForm_24_sync<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  599. let L = 0;
  600. }
  601. class XForm_25<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  602. InstrItinClass itin, list<dag> pattern>
  603. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  604. }
  605. class XForm_25_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  606. string asmstr, InstrItinClass itin, list<dag> pattern>
  607. : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  608. }
  609. // [PO RT /// RB XO RC]
  610. class XForm_26<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  611. InstrItinClass itin, list<dag> pattern>
  612. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  613. let A = 0;
  614. }
  615. class XForm_28_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  616. string asmstr, InstrItinClass itin, list<dag> pattern>
  617. : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  618. }
  619. class XForm_28<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  620. InstrItinClass itin, list<dag> pattern>
  621. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  622. }
  623. // This is used for MFFS, MTFSB0, MTFSB1. 42 is arbitrary; this series of
  624. // numbers presumably relates to some document, but I haven't found it.
  625. class XForm_42<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  626. InstrItinClass itin, list<dag> pattern>
  627. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  628. let Pattern = pattern;
  629. bit RC = 0; // set by isRecordForm
  630. let Inst{6-10} = RST;
  631. let Inst{11-20} = 0;
  632. let Inst{21-30} = xo;
  633. let Inst{31} = RC;
  634. }
  635. class XForm_43<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  636. InstrItinClass itin, list<dag> pattern>
  637. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  638. let Pattern = pattern;
  639. bits<5> FM;
  640. bit RC = 0; // set by isRecordForm
  641. let Inst{6-10} = FM;
  642. let Inst{11-20} = 0;
  643. let Inst{21-30} = xo;
  644. let Inst{31} = RC;
  645. }
  646. class XForm_44<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  647. InstrItinClass itin>
  648. : I<opcode, OOL, IOL, asmstr, itin> {
  649. bits<5> RT;
  650. bits<3> BFA;
  651. let Inst{6-10} = RT;
  652. let Inst{11-13} = BFA;
  653. let Inst{14-15} = 0;
  654. let Inst{16-20} = 0;
  655. let Inst{21-30} = xo;
  656. let Inst{31} = 0;
  657. }
  658. class XForm_45<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  659. InstrItinClass itin>
  660. : I<opcode, OOL, IOL, asmstr, itin> {
  661. bits<5> RT;
  662. bits<2> L;
  663. let Inst{6-10} = RT;
  664. let Inst{11-13} = 0;
  665. let Inst{14-15} = L;
  666. let Inst{16-20} = 0;
  667. let Inst{21-30} = xo;
  668. let Inst{31} = 0;
  669. }
  670. class X_FRT5_XO2_XO3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2, bits<10> xo,
  671. dag OOL, dag IOL, string asmstr, InstrItinClass itin,
  672. list<dag> pattern>
  673. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  674. let Pattern = pattern;
  675. let Inst{6-10} = RST;
  676. let Inst{11-12} = xo1;
  677. let Inst{13-15} = xo2;
  678. let Inst{16-20} = 0;
  679. let Inst{21-30} = xo;
  680. let Inst{31} = 0;
  681. }
  682. class X_FRT5_XO2_XO3_FRB5_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
  683. bits<10> xo, dag OOL, dag IOL, string asmstr,
  684. InstrItinClass itin, list<dag> pattern>
  685. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  686. let Pattern = pattern;
  687. bits<5> FRB;
  688. let Inst{6-10} = RST;
  689. let Inst{11-12} = xo1;
  690. let Inst{13-15} = xo2;
  691. let Inst{16-20} = FRB;
  692. let Inst{21-30} = xo;
  693. let Inst{31} = 0;
  694. }
  695. class X_FRT5_XO2_XO3_DRM3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
  696. bits<10> xo, dag OOL, dag IOL, string asmstr,
  697. InstrItinClass itin, list<dag> pattern>
  698. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  699. let Pattern = pattern;
  700. bits<3> DRM;
  701. let Inst{6-10} = RST;
  702. let Inst{11-12} = xo1;
  703. let Inst{13-15} = xo2;
  704. let Inst{16-17} = 0;
  705. let Inst{18-20} = DRM;
  706. let Inst{21-30} = xo;
  707. let Inst{31} = 0;
  708. }
  709. class X_FRT5_XO2_XO3_RM2_X10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
  710. bits<10> xo, dag OOL, dag IOL, string asmstr,
  711. InstrItinClass itin, list<dag> pattern>
  712. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  713. let Pattern = pattern;
  714. bits<2> RM;
  715. let Inst{6-10} = RST;
  716. let Inst{11-12} = xo1;
  717. let Inst{13-15} = xo2;
  718. let Inst{16-18} = 0;
  719. let Inst{19-20} = RM;
  720. let Inst{21-30} = xo;
  721. let Inst{31} = 0;
  722. }
  723. class XForm_0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  724. InstrItinClass itin, list<dag> pattern>
  725. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  726. let RST = 0;
  727. let A = 0;
  728. let B = 0;
  729. }
  730. class XForm_16b<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  731. InstrItinClass itin, list<dag> pattern>
  732. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  733. let RST = 0;
  734. let A = 0;
  735. }
  736. class XForm_htm0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  737. string asmstr, InstrItinClass itin>
  738. : I<opcode, OOL, IOL, asmstr, itin> {
  739. bit R;
  740. bit RC = 1;
  741. let Inst{6-9} = 0;
  742. let Inst{10} = R;
  743. let Inst{11-20} = 0;
  744. let Inst{21-30} = xo;
  745. let Inst{31} = RC;
  746. }
  747. class XForm_htm1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  748. string asmstr, InstrItinClass itin>
  749. : I<opcode, OOL, IOL, asmstr, itin> {
  750. bit A;
  751. bit RC = 1;
  752. let Inst{6} = A;
  753. let Inst{7-20} = 0;
  754. let Inst{21-30} = xo;
  755. let Inst{31} = RC;
  756. }
  757. class XForm_htm2<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  758. InstrItinClass itin>
  759. : I<opcode, OOL, IOL, asmstr, itin> {
  760. bit L;
  761. bit RC = 0; // set by isRecordForm
  762. let Inst{7-9} = 0;
  763. let Inst{10} = L;
  764. let Inst{11-20} = 0;
  765. let Inst{21-30} = xo;
  766. let Inst{31} = RC;
  767. }
  768. class XForm_htm3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  769. InstrItinClass itin>
  770. : I<opcode, OOL, IOL, asmstr, itin> {
  771. bits<3> BF;
  772. bit RC = 0;
  773. let Inst{6-8} = BF;
  774. let Inst{9-20} = 0;
  775. let Inst{21-30} = xo;
  776. let Inst{31} = RC;
  777. }
  778. // [PO RT RA RB XO /]
  779. class X_BF3_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  780. string asmstr, InstrItinClass itin, list<dag> pattern>
  781. : I<opcode, OOL, IOL, asmstr, itin> {
  782. bits<3> BF;
  783. bits<1> L;
  784. bits<5> RA;
  785. bits<5> RB;
  786. let Pattern = pattern;
  787. let Inst{6-8} = BF;
  788. let Inst{9} = 0;
  789. let Inst{10} = L;
  790. let Inst{11-15} = RA;
  791. let Inst{16-20} = RB;
  792. let Inst{21-30} = xo;
  793. let Inst{31} = 0;
  794. }
  795. // Same as XForm_17 but with GPR's and new naming convention
  796. class X_BF3_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  797. string asmstr, InstrItinClass itin, list<dag> pattern>
  798. : I<opcode, OOL, IOL, asmstr, itin> {
  799. bits<3> BF;
  800. bits<5> RA;
  801. bits<5> RB;
  802. let Pattern = pattern;
  803. let Inst{6-8} = BF;
  804. let Inst{9-10} = 0;
  805. let Inst{11-15} = RA;
  806. let Inst{16-20} = RB;
  807. let Inst{21-30} = xo;
  808. let Inst{31} = 0;
  809. }
  810. // e.g. [PO VRT XO VRB XO /] or [PO VRT XO VRB XO RO]
  811. class X_RD5_XO5_RS5<bits<6> opcode, bits<5> xo2, bits<10> xo, dag OOL, dag IOL,
  812. string asmstr, InstrItinClass itin, list<dag> pattern>
  813. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  814. let A = xo2;
  815. }
  816. class X_BF3_DCMX7_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  817. string asmstr, InstrItinClass itin, list<dag> pattern>
  818. : I<opcode, OOL, IOL, asmstr, itin> {
  819. bits<3> BF;
  820. bits<7> DCMX;
  821. bits<5> VB;
  822. let Pattern = pattern;
  823. let Inst{6-8} = BF;
  824. let Inst{9-15} = DCMX;
  825. let Inst{16-20} = VB;
  826. let Inst{21-30} = xo;
  827. let Inst{31} = 0;
  828. }
  829. class X_RD6_IMM8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  830. string asmstr, InstrItinClass itin, list<dag> pattern>
  831. : I<opcode, OOL, IOL, asmstr, itin> {
  832. bits<6> XT;
  833. bits<8> IMM8;
  834. let Pattern = pattern;
  835. let Inst{6-10} = XT{4-0};
  836. let Inst{11-12} = 0;
  837. let Inst{13-20} = IMM8;
  838. let Inst{21-30} = xo;
  839. let Inst{31} = XT{5};
  840. }
  841. // XForm_base_r3xo for instructions such as P9 atomics where we don't want
  842. // to specify an SDAG pattern for matching.
  843. class X_RD5_RS5_IM5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  844. string asmstr, InstrItinClass itin>
  845. : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, []> {
  846. }
  847. class X_BF3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  848. InstrItinClass itin>
  849. : XForm_17<opcode, xo, OOL, IOL, asmstr, itin> {
  850. let FRA = 0;
  851. let FRB = 0;
  852. }
  853. // [PO /// L RA RB XO /]
  854. class X_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  855. string asmstr, InstrItinClass itin, list<dag> pattern>
  856. : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
  857. let BF = 0;
  858. let Pattern = pattern;
  859. bit RC = 0;
  860. let Inst{31} = RC;
  861. }
  862. // XX*-Form (VSX)
  863. class XX1Form<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  864. InstrItinClass itin, list<dag> pattern>
  865. : I<opcode, OOL, IOL, asmstr, itin> {
  866. bits<6> XT;
  867. bits<5> A;
  868. bits<5> B;
  869. let Pattern = pattern;
  870. let Inst{6-10} = XT{4-0};
  871. let Inst{11-15} = A;
  872. let Inst{16-20} = B;
  873. let Inst{21-30} = xo;
  874. let Inst{31} = XT{5};
  875. }
  876. class XX1Form_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  877. string asmstr, InstrItinClass itin, list<dag> pattern>
  878. : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
  879. class XX1_RS6_RD5_XO<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  880. string asmstr, InstrItinClass itin, list<dag> pattern>
  881. : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  882. let B = 0;
  883. }
  884. class XX2Form<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
  885. InstrItinClass itin, list<dag> pattern>
  886. : I<opcode, OOL, IOL, asmstr, itin> {
  887. bits<6> XT;
  888. bits<6> XB;
  889. let Pattern = pattern;
  890. let Inst{6-10} = XT{4-0};
  891. let Inst{11-15} = 0;
  892. let Inst{16-20} = XB{4-0};
  893. let Inst{21-29} = xo;
  894. let Inst{30} = XB{5};
  895. let Inst{31} = XT{5};
  896. }
  897. class XX2Form_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
  898. InstrItinClass itin, list<dag> pattern>
  899. : I<opcode, OOL, IOL, asmstr, itin> {
  900. bits<3> CR;
  901. bits<6> XB;
  902. let Pattern = pattern;
  903. let Inst{6-8} = CR;
  904. let Inst{9-15} = 0;
  905. let Inst{16-20} = XB{4-0};
  906. let Inst{21-29} = xo;
  907. let Inst{30} = XB{5};
  908. let Inst{31} = 0;
  909. }
  910. class XX2Form_2<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
  911. InstrItinClass itin, list<dag> pattern>
  912. : I<opcode, OOL, IOL, asmstr, itin> {
  913. bits<6> XT;
  914. bits<6> XB;
  915. bits<2> D;
  916. let Pattern = pattern;
  917. let Inst{6-10} = XT{4-0};
  918. let Inst{11-13} = 0;
  919. let Inst{14-15} = D;
  920. let Inst{16-20} = XB{4-0};
  921. let Inst{21-29} = xo;
  922. let Inst{30} = XB{5};
  923. let Inst{31} = XT{5};
  924. }
  925. class XX2_RD6_UIM5_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
  926. string asmstr, InstrItinClass itin, list<dag> pattern>
  927. : I<opcode, OOL, IOL, asmstr, itin> {
  928. bits<6> XT;
  929. bits<6> XB;
  930. bits<5> UIM5;
  931. let Pattern = pattern;
  932. let Inst{6-10} = XT{4-0};
  933. let Inst{11-15} = UIM5;
  934. let Inst{16-20} = XB{4-0};
  935. let Inst{21-29} = xo;
  936. let Inst{30} = XB{5};
  937. let Inst{31} = XT{5};
  938. }
  939. // [PO T XO B XO BX /]
  940. class XX2_RD5_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
  941. string asmstr, InstrItinClass itin, list<dag> pattern>
  942. : I<opcode, OOL, IOL, asmstr, itin> {
  943. bits<5> RT;
  944. bits<6> XB;
  945. let Pattern = pattern;
  946. let Inst{6-10} = RT;
  947. let Inst{11-15} = xo2;
  948. let Inst{16-20} = XB{4-0};
  949. let Inst{21-29} = xo;
  950. let Inst{30} = XB{5};
  951. let Inst{31} = 0;
  952. }
  953. // [PO T XO B XO BX TX]
  954. class XX2_RD6_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
  955. string asmstr, InstrItinClass itin, list<dag> pattern>
  956. : I<opcode, OOL, IOL, asmstr, itin> {
  957. bits<6> XT;
  958. bits<6> XB;
  959. let Pattern = pattern;
  960. let Inst{6-10} = XT{4-0};
  961. let Inst{11-15} = xo2;
  962. let Inst{16-20} = XB{4-0};
  963. let Inst{21-29} = xo;
  964. let Inst{30} = XB{5};
  965. let Inst{31} = XT{5};
  966. }
  967. class XX2_BF3_DCMX7_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
  968. string asmstr, InstrItinClass itin, list<dag> pattern>
  969. : I<opcode, OOL, IOL, asmstr, itin> {
  970. bits<3> BF;
  971. bits<7> DCMX;
  972. bits<6> XB;
  973. let Pattern = pattern;
  974. let Inst{6-8} = BF;
  975. let Inst{9-15} = DCMX;
  976. let Inst{16-20} = XB{4-0};
  977. let Inst{21-29} = xo;
  978. let Inst{30} = XB{5};
  979. let Inst{31} = 0;
  980. }
  981. class XX2_RD6_DCMX7_RS6<bits<6> opcode, bits<4> xo1, bits<3> xo2,
  982. dag OOL, dag IOL, string asmstr, InstrItinClass itin,
  983. list<dag> pattern>
  984. : I<opcode, OOL, IOL, asmstr, itin> {
  985. bits<6> XT;
  986. bits<7> DCMX;
  987. bits<6> XB;
  988. let Pattern = pattern;
  989. let Inst{6-10} = XT{4-0};
  990. let Inst{11-15} = DCMX{4-0};
  991. let Inst{16-20} = XB{4-0};
  992. let Inst{21-24} = xo1;
  993. let Inst{25} = DCMX{6};
  994. let Inst{26-28} = xo2;
  995. let Inst{29} = DCMX{5};
  996. let Inst{30} = XB{5};
  997. let Inst{31} = XT{5};
  998. }
  999. class XForm_XD6_RA5_RB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  1000. string asmstr, InstrItinClass itin, list<dag> pattern>
  1001. : I<opcode, OOL, IOL, asmstr, itin> {
  1002. bits<11> D_RA_XD;
  1003. bits<5> RB;
  1004. let Pattern = pattern;
  1005. let Inst{6-10} = D_RA_XD{4-0}; // D
  1006. let Inst{11-15} = D_RA_XD{10-6}; // RA
  1007. let Inst{16-20} = RB;
  1008. let Inst{21-30} = xo;
  1009. let Inst{31} = D_RA_XD{5}; // DX
  1010. }
  1011. class XX3Form<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
  1012. InstrItinClass itin, list<dag> pattern>
  1013. : I<opcode, OOL, IOL, asmstr, itin> {
  1014. bits<6> XT;
  1015. bits<6> XA;
  1016. bits<6> XB;
  1017. let Pattern = pattern;
  1018. let Inst{6-10} = XT{4-0};
  1019. let Inst{11-15} = XA{4-0};
  1020. let Inst{16-20} = XB{4-0};
  1021. let Inst{21-28} = xo;
  1022. let Inst{29} = XA{5};
  1023. let Inst{30} = XB{5};
  1024. let Inst{31} = XT{5};
  1025. }
  1026. class XX3Form_SameOp<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
  1027. InstrItinClass itin, list<dag> pattern>
  1028. : XX3Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  1029. let XA = XT;
  1030. let XB = XT;
  1031. }
  1032. class XX3Form_1<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
  1033. InstrItinClass itin, list<dag> pattern>
  1034. : I<opcode, OOL, IOL, asmstr, itin> {
  1035. bits<3> CR;
  1036. bits<6> XA;
  1037. bits<6> XB;
  1038. let Pattern = pattern;
  1039. let Inst{6-8} = CR;
  1040. let Inst{9-10} = 0;
  1041. let Inst{11-15} = XA{4-0};
  1042. let Inst{16-20} = XB{4-0};
  1043. let Inst{21-28} = xo;
  1044. let Inst{29} = XA{5};
  1045. let Inst{30} = XB{5};
  1046. let Inst{31} = 0;
  1047. }
  1048. class XX3Form_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
  1049. InstrItinClass itin, list<dag> pattern>
  1050. : I<opcode, OOL, IOL, asmstr, itin> {
  1051. bits<6> XT;
  1052. bits<6> XA;
  1053. bits<6> XB;
  1054. bits<2> D;
  1055. let Pattern = pattern;
  1056. let Inst{6-10} = XT{4-0};
  1057. let Inst{11-15} = XA{4-0};
  1058. let Inst{16-20} = XB{4-0};
  1059. let Inst{21} = 0;
  1060. let Inst{22-23} = D;
  1061. let Inst{24-28} = xo;
  1062. let Inst{29} = XA{5};
  1063. let Inst{30} = XB{5};
  1064. let Inst{31} = XT{5};
  1065. }
  1066. class XX3Form_Rc<bits<6> opcode, bits<7> xo, dag OOL, dag IOL, string asmstr,
  1067. InstrItinClass itin, list<dag> pattern>
  1068. : I<opcode, OOL, IOL, asmstr, itin> {
  1069. bits<6> XT;
  1070. bits<6> XA;
  1071. bits<6> XB;
  1072. let Pattern = pattern;
  1073. bit RC = 0; // set by isRecordForm
  1074. let Inst{6-10} = XT{4-0};
  1075. let Inst{11-15} = XA{4-0};
  1076. let Inst{16-20} = XB{4-0};
  1077. let Inst{21} = RC;
  1078. let Inst{22-28} = xo;
  1079. let Inst{29} = XA{5};
  1080. let Inst{30} = XB{5};
  1081. let Inst{31} = XT{5};
  1082. }
  1083. class XX4Form<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
  1084. InstrItinClass itin, list<dag> pattern>
  1085. : I<opcode, OOL, IOL, asmstr, itin> {
  1086. bits<6> XT;
  1087. bits<6> XA;
  1088. bits<6> XB;
  1089. bits<6> XC;
  1090. let Pattern = pattern;
  1091. let Inst{6-10} = XT{4-0};
  1092. let Inst{11-15} = XA{4-0};
  1093. let Inst{16-20} = XB{4-0};
  1094. let Inst{21-25} = XC{4-0};
  1095. let Inst{26-27} = xo;
  1096. let Inst{28} = XC{5};
  1097. let Inst{29} = XA{5};
  1098. let Inst{30} = XB{5};
  1099. let Inst{31} = XT{5};
  1100. }
  1101. // DCB_Form - Form X instruction, used for dcb* instructions.
  1102. class DCB_Form<bits<10> xo, bits<5> immfield, dag OOL, dag IOL, string asmstr,
  1103. InstrItinClass itin, list<dag> pattern>
  1104. : I<31, OOL, IOL, asmstr, itin> {
  1105. bits<5> A;
  1106. bits<5> B;
  1107. let Pattern = pattern;
  1108. let Inst{6-10} = immfield;
  1109. let Inst{11-15} = A;
  1110. let Inst{16-20} = B;
  1111. let Inst{21-30} = xo;
  1112. let Inst{31} = 0;
  1113. }
  1114. class DCB_Form_hint<bits<10> xo, dag OOL, dag IOL, string asmstr,
  1115. InstrItinClass itin, list<dag> pattern>
  1116. : I<31, OOL, IOL, asmstr, itin> {
  1117. bits<5> TH;
  1118. bits<5> A;
  1119. bits<5> B;
  1120. let Pattern = pattern;
  1121. let Inst{6-10} = TH;
  1122. let Inst{11-15} = A;
  1123. let Inst{16-20} = B;
  1124. let Inst{21-30} = xo;
  1125. let Inst{31} = 0;
  1126. }
  1127. // DSS_Form - Form X instruction, used for altivec dss* instructions.
  1128. class DSS_Form<bits<1> T, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1129. InstrItinClass itin, list<dag> pattern>
  1130. : I<31, OOL, IOL, asmstr, itin> {
  1131. bits<2> STRM;
  1132. bits<5> A;
  1133. bits<5> B;
  1134. let Pattern = pattern;
  1135. let Inst{6} = T;
  1136. let Inst{7-8} = 0;
  1137. let Inst{9-10} = STRM;
  1138. let Inst{11-15} = A;
  1139. let Inst{16-20} = B;
  1140. let Inst{21-30} = xo;
  1141. let Inst{31} = 0;
  1142. }
  1143. // 1.7.7 XL-Form
  1144. class XLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1145. InstrItinClass itin, list<dag> pattern>
  1146. : I<opcode, OOL, IOL, asmstr, itin> {
  1147. bits<5> CRD;
  1148. bits<5> CRA;
  1149. bits<5> CRB;
  1150. let Pattern = pattern;
  1151. let Inst{6-10} = CRD;
  1152. let Inst{11-15} = CRA;
  1153. let Inst{16-20} = CRB;
  1154. let Inst{21-30} = xo;
  1155. let Inst{31} = 0;
  1156. }
  1157. class XLForm_1_np<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1158. InstrItinClass itin, list<dag> pattern>
  1159. : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  1160. let CRD = 0;
  1161. let CRA = 0;
  1162. let CRB = 0;
  1163. }
  1164. class XLForm_1_gen<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1165. InstrItinClass itin, list<dag> pattern>
  1166. : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  1167. bits<5> RT;
  1168. bits<5> RB;
  1169. let CRD = RT;
  1170. let CRA = 0;
  1171. let CRB = RB;
  1172. }
  1173. class XLForm_1_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1174. InstrItinClass itin, list<dag> pattern>
  1175. : I<opcode, OOL, IOL, asmstr, itin> {
  1176. bits<5> CRD;
  1177. let Pattern = pattern;
  1178. let Inst{6-10} = CRD;
  1179. let Inst{11-15} = CRD;
  1180. let Inst{16-20} = CRD;
  1181. let Inst{21-30} = xo;
  1182. let Inst{31} = 0;
  1183. }
  1184. class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, dag OOL, dag IOL, string asmstr,
  1185. InstrItinClass itin, list<dag> pattern>
  1186. : I<opcode, OOL, IOL, asmstr, itin> {
  1187. bits<5> BO;
  1188. bits<5> BI;
  1189. bits<2> BH;
  1190. let Pattern = pattern;
  1191. let Inst{6-10} = BO;
  1192. let Inst{11-15} = BI;
  1193. let Inst{16-18} = 0;
  1194. let Inst{19-20} = BH;
  1195. let Inst{21-30} = xo;
  1196. let Inst{31} = lk;
  1197. }
  1198. class XLForm_2_br<bits<6> opcode, bits<10> xo, bit lk,
  1199. dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
  1200. : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
  1201. bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
  1202. bits<3> CR;
  1203. let BO = BIBO{4-0};
  1204. let BI{0-1} = BIBO{5-6};
  1205. let BI{2-4} = CR{0-2};
  1206. let BH = 0;
  1207. }
  1208. class XLForm_2_br2<bits<6> opcode, bits<10> xo, bits<5> bo, bit lk,
  1209. dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
  1210. : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
  1211. let BO = bo;
  1212. let BH = 0;
  1213. }
  1214. class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo, bits<5> bi, bit lk,
  1215. dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
  1216. : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
  1217. let BO = bo;
  1218. let BI = bi;
  1219. let BH = 0;
  1220. }
  1221. class XLForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1222. InstrItinClass itin>
  1223. : I<opcode, OOL, IOL, asmstr, itin> {
  1224. bits<3> BF;
  1225. bits<3> BFA;
  1226. let Inst{6-8} = BF;
  1227. let Inst{9-10} = 0;
  1228. let Inst{11-13} = BFA;
  1229. let Inst{14-15} = 0;
  1230. let Inst{16-20} = 0;
  1231. let Inst{21-30} = xo;
  1232. let Inst{31} = 0;
  1233. }
  1234. class XLForm_4<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1235. InstrItinClass itin>
  1236. : I<opcode, OOL, IOL, asmstr, itin> {
  1237. bits<3> BF;
  1238. bit W;
  1239. bits<4> U;
  1240. bit RC = 0;
  1241. let Inst{6-8} = BF;
  1242. let Inst{9-10} = 0;
  1243. let Inst{11-14} = 0;
  1244. let Inst{15} = W;
  1245. let Inst{16-19} = U;
  1246. let Inst{20} = 0;
  1247. let Inst{21-30} = xo;
  1248. let Inst{31} = RC;
  1249. }
  1250. class XLForm_S<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1251. InstrItinClass itin, list<dag> pattern>
  1252. : I<opcode, OOL, IOL, asmstr, itin> {
  1253. bits<1> S;
  1254. let Pattern = pattern;
  1255. let Inst{6-19} = 0;
  1256. let Inst{20} = S;
  1257. let Inst{21-30} = xo;
  1258. let Inst{31} = 0;
  1259. }
  1260. class XLForm_2_and_DSForm_1<bits<6> opcode1, bits<10> xo1, bit lk,
  1261. bits<6> opcode2, bits<2> xo2,
  1262. dag OOL, dag IOL, string asmstr,
  1263. InstrItinClass itin, list<dag> pattern>
  1264. : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
  1265. bits<5> BO;
  1266. bits<5> BI;
  1267. bits<2> BH;
  1268. bits<5> RST;
  1269. bits<19> DS_RA;
  1270. let Pattern = pattern;
  1271. let Inst{6-10} = BO;
  1272. let Inst{11-15} = BI;
  1273. let Inst{16-18} = 0;
  1274. let Inst{19-20} = BH;
  1275. let Inst{21-30} = xo1;
  1276. let Inst{31} = lk;
  1277. let Inst{38-42} = RST;
  1278. let Inst{43-47} = DS_RA{18-14}; // Register #
  1279. let Inst{48-61} = DS_RA{13-0}; // Displacement.
  1280. let Inst{62-63} = xo2;
  1281. }
  1282. class XLForm_2_ext_and_DSForm_1<bits<6> opcode1, bits<10> xo1,
  1283. bits<5> bo, bits<5> bi, bit lk,
  1284. bits<6> opcode2, bits<2> xo2,
  1285. dag OOL, dag IOL, string asmstr,
  1286. InstrItinClass itin, list<dag> pattern>
  1287. : XLForm_2_and_DSForm_1<opcode1, xo1, lk, opcode2, xo2,
  1288. OOL, IOL, asmstr, itin, pattern> {
  1289. let BO = bo;
  1290. let BI = bi;
  1291. let BH = 0;
  1292. }
  1293. class XLForm_2_ext_and_DForm_1<bits<6> opcode1, bits<10> xo1, bits<5> bo,
  1294. bits<5> bi, bit lk, bits<6> opcode2, dag OOL,
  1295. dag IOL, string asmstr, InstrItinClass itin,
  1296. list<dag> pattern>
  1297. : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
  1298. bits<5> RST;
  1299. bits<21> D_RA;
  1300. let Pattern = pattern;
  1301. let Inst{6-10} = bo;
  1302. let Inst{11-15} = bi;
  1303. let Inst{16-18} = 0;
  1304. let Inst{19-20} = 0; // Unused (BH)
  1305. let Inst{21-30} = xo1;
  1306. let Inst{31} = lk;
  1307. let Inst{38-42} = RST;
  1308. let Inst{43-47} = D_RA{20-16}; // Base Register
  1309. let Inst{48-63} = D_RA{15-0}; // Displacement
  1310. }
  1311. // 1.7.8 XFX-Form
  1312. class XFXForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1313. InstrItinClass itin>
  1314. : I<opcode, OOL, IOL, asmstr, itin> {
  1315. bits<5> RT;
  1316. bits<10> SPR;
  1317. let Inst{6-10} = RT;
  1318. let Inst{11} = SPR{4};
  1319. let Inst{12} = SPR{3};
  1320. let Inst{13} = SPR{2};
  1321. let Inst{14} = SPR{1};
  1322. let Inst{15} = SPR{0};
  1323. let Inst{16} = SPR{9};
  1324. let Inst{17} = SPR{8};
  1325. let Inst{18} = SPR{7};
  1326. let Inst{19} = SPR{6};
  1327. let Inst{20} = SPR{5};
  1328. let Inst{21-30} = xo;
  1329. let Inst{31} = 0;
  1330. }
  1331. class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
  1332. dag OOL, dag IOL, string asmstr, InstrItinClass itin>
  1333. : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin> {
  1334. let SPR = spr;
  1335. }
  1336. class XFXForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1337. InstrItinClass itin>
  1338. : I<opcode, OOL, IOL, asmstr, itin> {
  1339. bits<5> RT;
  1340. let Inst{6-10} = RT;
  1341. let Inst{11-20} = 0;
  1342. let Inst{21-30} = xo;
  1343. let Inst{31} = 0;
  1344. }
  1345. class XFXForm_3p<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1346. InstrItinClass itin, list<dag> pattern>
  1347. : I<opcode, OOL, IOL, asmstr, itin> {
  1348. bits<5> RT;
  1349. bits<10> Entry;
  1350. let Pattern = pattern;
  1351. let Inst{6-10} = RT;
  1352. let Inst{11-20} = Entry;
  1353. let Inst{21-30} = xo;
  1354. let Inst{31} = 0;
  1355. }
  1356. class XFXForm_5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1357. InstrItinClass itin>
  1358. : I<opcode, OOL, IOL, asmstr, itin> {
  1359. bits<8> FXM;
  1360. bits<5> rS;
  1361. let Inst{6-10} = rS;
  1362. let Inst{11} = 0;
  1363. let Inst{12-19} = FXM;
  1364. let Inst{20} = 0;
  1365. let Inst{21-30} = xo;
  1366. let Inst{31} = 0;
  1367. }
  1368. class XFXForm_5a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1369. InstrItinClass itin>
  1370. : I<opcode, OOL, IOL, asmstr, itin> {
  1371. bits<5> ST;
  1372. bits<8> FXM;
  1373. let Inst{6-10} = ST;
  1374. let Inst{11} = 1;
  1375. let Inst{12-19} = FXM;
  1376. let Inst{20} = 0;
  1377. let Inst{21-30} = xo;
  1378. let Inst{31} = 0;
  1379. }
  1380. class XFXForm_7<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1381. InstrItinClass itin>
  1382. : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin>;
  1383. class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
  1384. dag OOL, dag IOL, string asmstr, InstrItinClass itin>
  1385. : XFXForm_7<opcode, xo, OOL, IOL, asmstr, itin> {
  1386. let SPR = spr;
  1387. }
  1388. // XFL-Form - MTFSF
  1389. // This is probably 1.7.9, but I don't have the reference that uses this
  1390. // numbering scheme...
  1391. class XFLForm<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1392. InstrItinClass itin, list<dag>pattern>
  1393. : I<opcode, OOL, IOL, asmstr, itin> {
  1394. bits<8> FM;
  1395. bits<5> rT;
  1396. bit RC = 0; // set by isRecordForm
  1397. let Pattern = pattern;
  1398. let Inst{6} = 0;
  1399. let Inst{7-14} = FM;
  1400. let Inst{15} = 0;
  1401. let Inst{16-20} = rT;
  1402. let Inst{21-30} = xo;
  1403. let Inst{31} = RC;
  1404. }
  1405. class XFLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
  1406. InstrItinClass itin, list<dag>pattern>
  1407. : I<opcode, OOL, IOL, asmstr, itin> {
  1408. bit L;
  1409. bits<8> FLM;
  1410. bit W;
  1411. bits<5> FRB;
  1412. bit RC = 0; // set by isRecordForm
  1413. let Pattern = pattern;
  1414. let Inst{6} = L;
  1415. let Inst{7-14} = FLM;
  1416. let Inst{15} = W;
  1417. let Inst{16-20} = FRB;
  1418. let Inst{21-30} = xo;
  1419. let Inst{31} = RC;
  1420. }
  1421. // 1.7.10 XS-Form - SRADI.
  1422. class XSForm_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
  1423. InstrItinClass itin, list<dag> pattern>
  1424. : I<opcode, OOL, IOL, asmstr, itin> {
  1425. bits<5> A;
  1426. bits<5> RS;
  1427. bits<6> SH;
  1428. bit RC = 0; // set by isRecordForm
  1429. let Pattern = pattern;
  1430. let Inst{6-10} = RS;
  1431. let Inst{11-15} = A;
  1432. let Inst{16-20} = SH{4,3,2,1,0};
  1433. let Inst{21-29} = xo;
  1434. let Inst{30} = SH{5};
  1435. let Inst{31} = RC;
  1436. }
  1437. // 1.7.11 XO-Form
  1438. class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, string asmstr,
  1439. InstrItinClass itin, list<dag> pattern>
  1440. : I<opcode, OOL, IOL, asmstr, itin> {
  1441. bits<5> RT;
  1442. bits<5> RA;
  1443. bits<5> RB;
  1444. let Pattern = pattern;
  1445. bit RC = 0; // set by isRecordForm
  1446. let Inst{6-10} = RT;
  1447. let Inst{11-15} = RA;
  1448. let Inst{16-20} = RB;
  1449. let Inst{21} = oe;
  1450. let Inst{22-30} = xo;
  1451. let Inst{31} = RC;
  1452. }
  1453. class XOForm_3<bits<6> opcode, bits<9> xo, bit oe,
  1454. dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
  1455. : XOForm_1<opcode, xo, oe, OOL, IOL, asmstr, itin, pattern> {
  1456. let RB = 0;
  1457. }
  1458. // 1.7.12 A-Form
  1459. class AForm_1<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
  1460. InstrItinClass itin, list<dag> pattern>
  1461. : I<opcode, OOL, IOL, asmstr, itin> {
  1462. bits<5> FRT;
  1463. bits<5> FRA;
  1464. bits<5> FRC;
  1465. bits<5> FRB;
  1466. let Pattern = pattern;
  1467. bit RC = 0; // set by isRecordForm
  1468. let Inst{6-10} = FRT;
  1469. let Inst{11-15} = FRA;
  1470. let Inst{16-20} = FRB;
  1471. let Inst{21-25} = FRC;
  1472. let Inst{26-30} = xo;
  1473. let Inst{31} = RC;
  1474. }
  1475. class AForm_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
  1476. InstrItinClass itin, list<dag> pattern>
  1477. : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  1478. let FRC = 0;
  1479. }
  1480. class AForm_3<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
  1481. InstrItinClass itin, list<dag> pattern>
  1482. : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  1483. let FRB = 0;
  1484. }
  1485. class AForm_4<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
  1486. InstrItinClass itin, list<dag> pattern>
  1487. : I<opcode, OOL, IOL, asmstr, itin> {
  1488. bits<5> RT;
  1489. bits<5> RA;
  1490. bits<5> RB;
  1491. bits<5> COND;
  1492. let Pattern = pattern;
  1493. let Inst{6-10} = RT;
  1494. let Inst{11-15} = RA;
  1495. let Inst{16-20} = RB;
  1496. let Inst{21-25} = COND;
  1497. let Inst{26-30} = xo;
  1498. let Inst{31} = 0;
  1499. }
  1500. // 1.7.13 M-Form
  1501. class MForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  1502. InstrItinClass itin, list<dag> pattern>
  1503. : I<opcode, OOL, IOL, asmstr, itin> {
  1504. bits<5> RA;
  1505. bits<5> RS;
  1506. bits<5> RB;
  1507. bits<5> MB;
  1508. bits<5> ME;
  1509. let Pattern = pattern;
  1510. bit RC = 0; // set by isRecordForm
  1511. let Inst{6-10} = RS;
  1512. let Inst{11-15} = RA;
  1513. let Inst{16-20} = RB;
  1514. let Inst{21-25} = MB;
  1515. let Inst{26-30} = ME;
  1516. let Inst{31} = RC;
  1517. }
  1518. class MForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  1519. InstrItinClass itin, list<dag> pattern>
  1520. : MForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
  1521. }
  1522. // 1.7.14 MD-Form
  1523. class MDForm_1<bits<6> opcode, bits<3> xo, dag OOL, dag IOL, string asmstr,
  1524. InstrItinClass itin, list<dag> pattern>
  1525. : I<opcode, OOL, IOL, asmstr, itin> {
  1526. bits<5> RA;
  1527. bits<5> RS;
  1528. bits<6> SH;
  1529. bits<6> MBE;
  1530. let Pattern = pattern;
  1531. bit RC = 0; // set by isRecordForm
  1532. let Inst{6-10} = RS;
  1533. let Inst{11-15} = RA;
  1534. let Inst{16-20} = SH{4,3,2,1,0};
  1535. let Inst{21-26} = MBE{4,3,2,1,0,5};
  1536. let Inst{27-29} = xo;
  1537. let Inst{30} = SH{5};
  1538. let Inst{31} = RC;
  1539. }
  1540. class MDSForm_1<bits<6> opcode, bits<4> xo, dag OOL, dag IOL, string asmstr,
  1541. InstrItinClass itin, list<dag> pattern>
  1542. : I<opcode, OOL, IOL, asmstr, itin> {
  1543. bits<5> RA;
  1544. bits<5> RS;
  1545. bits<5> RB;
  1546. bits<6> MBE;
  1547. let Pattern = pattern;
  1548. bit RC = 0; // set by isRecordForm
  1549. let Inst{6-10} = RS;
  1550. let Inst{11-15} = RA;
  1551. let Inst{16-20} = RB;
  1552. let Inst{21-26} = MBE{4,3,2,1,0,5};
  1553. let Inst{27-30} = xo;
  1554. let Inst{31} = RC;
  1555. }
  1556. // E-1 VA-Form
  1557. // VAForm_1 - DACB ordering.
  1558. class VAForm_1<bits<6> xo, dag OOL, dag IOL, string asmstr,
  1559. InstrItinClass itin, list<dag> pattern>
  1560. : I<4, OOL, IOL, asmstr, itin> {
  1561. bits<5> VD;
  1562. bits<5> VA;
  1563. bits<5> VC;
  1564. bits<5> VB;
  1565. let Pattern = pattern;
  1566. let Inst{6-10} = VD;
  1567. let Inst{11-15} = VA;
  1568. let Inst{16-20} = VB;
  1569. let Inst{21-25} = VC;
  1570. let Inst{26-31} = xo;
  1571. }
  1572. // VAForm_1a - DABC ordering.
  1573. class VAForm_1a<bits<6> xo, dag OOL, dag IOL, string asmstr,
  1574. InstrItinClass itin, list<dag> pattern>
  1575. : I<4, OOL, IOL, asmstr, itin> {
  1576. bits<5> VD;
  1577. bits<5> VA;
  1578. bits<5> VB;
  1579. bits<5> VC;
  1580. let Pattern = pattern;
  1581. let Inst{6-10} = VD;
  1582. let Inst{11-15} = VA;
  1583. let Inst{16-20} = VB;
  1584. let Inst{21-25} = VC;
  1585. let Inst{26-31} = xo;
  1586. }
  1587. class VAForm_2<bits<6> xo, dag OOL, dag IOL, string asmstr,
  1588. InstrItinClass itin, list<dag> pattern>
  1589. : I<4, OOL, IOL, asmstr, itin> {
  1590. bits<5> VD;
  1591. bits<5> VA;
  1592. bits<5> VB;
  1593. bits<4> SH;
  1594. let Pattern = pattern;
  1595. let Inst{6-10} = VD;
  1596. let Inst{11-15} = VA;
  1597. let Inst{16-20} = VB;
  1598. let Inst{21} = 0;
  1599. let Inst{22-25} = SH;
  1600. let Inst{26-31} = xo;
  1601. }
  1602. // E-2 VX-Form
  1603. class VXForm_1<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1604. InstrItinClass itin, list<dag> pattern>
  1605. : I<4, OOL, IOL, asmstr, itin> {
  1606. bits<5> VD;
  1607. bits<5> VA;
  1608. bits<5> VB;
  1609. let Pattern = pattern;
  1610. let Inst{6-10} = VD;
  1611. let Inst{11-15} = VA;
  1612. let Inst{16-20} = VB;
  1613. let Inst{21-31} = xo;
  1614. }
  1615. class VXForm_setzero<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1616. InstrItinClass itin, list<dag> pattern>
  1617. : VXForm_1<xo, OOL, IOL, asmstr, itin, pattern> {
  1618. let VA = VD;
  1619. let VB = VD;
  1620. }
  1621. class VXForm_2<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1622. InstrItinClass itin, list<dag> pattern>
  1623. : I<4, OOL, IOL, asmstr, itin> {
  1624. bits<5> VD;
  1625. bits<5> VB;
  1626. let Pattern = pattern;
  1627. let Inst{6-10} = VD;
  1628. let Inst{11-15} = 0;
  1629. let Inst{16-20} = VB;
  1630. let Inst{21-31} = xo;
  1631. }
  1632. class VXForm_3<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1633. InstrItinClass itin, list<dag> pattern>
  1634. : I<4, OOL, IOL, asmstr, itin> {
  1635. bits<5> VD;
  1636. bits<5> IMM;
  1637. let Pattern = pattern;
  1638. let Inst{6-10} = VD;
  1639. let Inst{11-15} = IMM;
  1640. let Inst{16-20} = 0;
  1641. let Inst{21-31} = xo;
  1642. }
  1643. /// VXForm_4 - VX instructions with "VD,0,0" register fields, like mfvscr.
  1644. class VXForm_4<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1645. InstrItinClass itin, list<dag> pattern>
  1646. : I<4, OOL, IOL, asmstr, itin> {
  1647. bits<5> VD;
  1648. let Pattern = pattern;
  1649. let Inst{6-10} = VD;
  1650. let Inst{11-15} = 0;
  1651. let Inst{16-20} = 0;
  1652. let Inst{21-31} = xo;
  1653. }
  1654. /// VXForm_5 - VX instructions with "0,0,VB" register fields, like mtvscr.
  1655. class VXForm_5<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1656. InstrItinClass itin, list<dag> pattern>
  1657. : I<4, OOL, IOL, asmstr, itin> {
  1658. bits<5> VB;
  1659. let Pattern = pattern;
  1660. let Inst{6-10} = 0;
  1661. let Inst{11-15} = 0;
  1662. let Inst{16-20} = VB;
  1663. let Inst{21-31} = xo;
  1664. }
  1665. // e.g. [PO VRT EO VRB XO]
  1666. class VXForm_RD5_XO5_RS5<bits<11> xo, bits<5> eo, dag OOL, dag IOL,
  1667. string asmstr, InstrItinClass itin, list<dag> pattern>
  1668. : I<4, OOL, IOL, asmstr, itin> {
  1669. bits<5> RD;
  1670. bits<5> VB;
  1671. let Pattern = pattern;
  1672. let Inst{6-10} = RD;
  1673. let Inst{11-15} = eo;
  1674. let Inst{16-20} = VB;
  1675. let Inst{21-31} = xo;
  1676. }
  1677. /// VXForm_CR - VX crypto instructions with "VRT, VRA, ST, SIX"
  1678. class VXForm_CR<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1679. InstrItinClass itin, list<dag> pattern>
  1680. : I<4, OOL, IOL, asmstr, itin> {
  1681. bits<5> VD;
  1682. bits<5> VA;
  1683. bits<1> ST;
  1684. bits<4> SIX;
  1685. let Pattern = pattern;
  1686. let Inst{6-10} = VD;
  1687. let Inst{11-15} = VA;
  1688. let Inst{16} = ST;
  1689. let Inst{17-20} = SIX;
  1690. let Inst{21-31} = xo;
  1691. }
  1692. /// VXForm_BX - VX crypto instructions with "VRT, VRA, 0 - like vsbox"
  1693. class VXForm_BX<bits<11> xo, dag OOL, dag IOL, string asmstr,
  1694. InstrItinClass itin, list<dag> pattern>
  1695. : I<4, OOL, IOL, asmstr, itin> {
  1696. bits<5> VD;
  1697. bits<5> VA;
  1698. let Pattern = pattern;
  1699. let Inst{6-10} = VD;
  1700. let Inst{11-15} = VA;
  1701. let Inst{16-20} = 0;
  1702. let Inst{21-31} = xo;
  1703. }
  1704. // E-4 VXR-Form
  1705. class VXRForm_1<bits<10> xo, dag OOL, dag IOL, string asmstr,
  1706. InstrItinClass itin, list<dag> pattern>
  1707. : I<4, OOL, IOL, asmstr, itin> {
  1708. bits<5> VD;
  1709. bits<5> VA;
  1710. bits<5> VB;
  1711. bit RC = 0;
  1712. let Pattern = pattern;
  1713. let Inst{6-10} = VD;
  1714. let Inst{11-15} = VA;
  1715. let Inst{16-20} = VB;
  1716. let Inst{21} = RC;
  1717. let Inst{22-31} = xo;
  1718. }
  1719. // VX-Form: [PO VRT EO VRB 1 PS XO]
  1720. class VX_RD5_EO5_RS5_PS1_XO9<bits<5> eo, bits<9> xo,
  1721. dag OOL, dag IOL, string asmstr,
  1722. InstrItinClass itin, list<dag> pattern>
  1723. : I<4, OOL, IOL, asmstr, itin> {
  1724. bits<5> VD;
  1725. bits<5> VB;
  1726. bit PS;
  1727. let Pattern = pattern;
  1728. let Inst{6-10} = VD;
  1729. let Inst{11-15} = eo;
  1730. let Inst{16-20} = VB;
  1731. let Inst{21} = 1;
  1732. let Inst{22} = PS;
  1733. let Inst{23-31} = xo;
  1734. }
  1735. // VX-Form: [PO VRT VRA VRB 1 PS XO] or [PO VRT VRA VRB 1 / XO]
  1736. class VX_RD5_RSp5_PS1_XO9<bits<9> xo, dag OOL, dag IOL, string asmstr,
  1737. InstrItinClass itin, list<dag> pattern>
  1738. : I<4, OOL, IOL, asmstr, itin> {
  1739. bits<5> VD;
  1740. bits<5> VA;
  1741. bits<5> VB;
  1742. bit PS;
  1743. let Pattern = pattern;
  1744. let Inst{6-10} = VD;
  1745. let Inst{11-15} = VA;
  1746. let Inst{16-20} = VB;
  1747. let Inst{21} = 1;
  1748. let Inst{22} = PS;
  1749. let Inst{23-31} = xo;
  1750. }
  1751. class Z23Form_8<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
  1752. InstrItinClass itin, list<dag> pattern>
  1753. : I<opcode, OOL, IOL, asmstr, itin> {
  1754. bits<5> VRT;
  1755. bit R;
  1756. bits<5> VRB;
  1757. bits<2> idx;
  1758. let Pattern = pattern;
  1759. bit RC = 0; // set by isRecordForm
  1760. let Inst{6-10} = VRT;
  1761. let Inst{11-14} = 0;
  1762. let Inst{15} = R;
  1763. let Inst{16-20} = VRB;
  1764. let Inst{21-22} = idx;
  1765. let Inst{23-30} = xo;
  1766. let Inst{31} = RC;
  1767. }
  1768. class Z23Form_RTAB5_CY2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
  1769. string asmstr, InstrItinClass itin, list<dag> pattern>
  1770. : I<opcode, OOL, IOL, asmstr, itin> {
  1771. bits<5> RT;
  1772. bits<5> RA;
  1773. bits<5> RB;
  1774. bits<2> CY;
  1775. let Pattern = pattern;
  1776. let Inst{6-10} = RT;
  1777. let Inst{11-15} = RA;
  1778. let Inst{16-20} = RB;
  1779. let Inst{21-22} = CY;
  1780. let Inst{23-30} = xo;
  1781. let Inst{31} = 0;
  1782. }
  1783. //===----------------------------------------------------------------------===//
  1784. // EmitTimePseudo won't have encoding information for the [MC]CodeEmitter
  1785. // stuff
  1786. class PPCEmitTimePseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
  1787. : I<0, OOL, IOL, asmstr, NoItinerary> {
  1788. let isCodeGenOnly = 1;
  1789. let PPC64 = 0;
  1790. let Pattern = pattern;
  1791. let Inst{31-0} = 0;
  1792. let hasNoSchedulingInfo = 1;
  1793. }
  1794. // Instruction that require custom insertion support
  1795. // a.k.a. ISelPseudos, however, these won't have isPseudo set
  1796. class PPCCustomInserterPseudo<dag OOL, dag IOL, string asmstr,
  1797. list<dag> pattern>
  1798. : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
  1799. let usesCustomInserter = 1;
  1800. }
  1801. // PostRAPseudo will be expanded in expandPostRAPseudo, isPseudo flag in td
  1802. // files is set only for PostRAPseudo
  1803. class PPCPostRAExpPseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
  1804. : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
  1805. let isPseudo = 1;
  1806. }
  1807. class PseudoXFormMemOp<dag OOL, dag IOL, string asmstr, list<dag> pattern>
  1808. : PPCPostRAExpPseudo<OOL, IOL, asmstr, pattern>, XFormMemOp;