tilepro.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639
  1. /* TILEPro opcode information.
  2. *
  3. * Copyright (C) 2011-2015 Free Software Foundation, Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  18. * MA 02110-1301, USA.
  19. */
  20. #ifndef opcode_tilepro_h
  21. #define opcode_tilepro_h
  22. typedef unsigned long long tilepro_bundle_bits;
  23. enum
  24. {
  25. TILEPRO_MAX_OPERANDS = 5 /* mm */
  26. };
  27. typedef enum
  28. {
  29. TILEPRO_OPC_BPT,
  30. TILEPRO_OPC_INFO,
  31. TILEPRO_OPC_INFOL,
  32. TILEPRO_OPC_J,
  33. TILEPRO_OPC_JAL,
  34. TILEPRO_OPC_LW_TLS,
  35. TILEPRO_OPC_LW_TLS_SN,
  36. TILEPRO_OPC_MOVE,
  37. TILEPRO_OPC_MOVE_SN,
  38. TILEPRO_OPC_MOVEI,
  39. TILEPRO_OPC_MOVEI_SN,
  40. TILEPRO_OPC_MOVELI,
  41. TILEPRO_OPC_MOVELI_SN,
  42. TILEPRO_OPC_MOVELIS,
  43. TILEPRO_OPC_PREFETCH,
  44. TILEPRO_OPC_RAISE,
  45. TILEPRO_OPC_ADD,
  46. TILEPRO_OPC_ADD_SN,
  47. TILEPRO_OPC_ADDB,
  48. TILEPRO_OPC_ADDB_SN,
  49. TILEPRO_OPC_ADDBS_U,
  50. TILEPRO_OPC_ADDBS_U_SN,
  51. TILEPRO_OPC_ADDH,
  52. TILEPRO_OPC_ADDH_SN,
  53. TILEPRO_OPC_ADDHS,
  54. TILEPRO_OPC_ADDHS_SN,
  55. TILEPRO_OPC_ADDI,
  56. TILEPRO_OPC_ADDI_SN,
  57. TILEPRO_OPC_ADDIB,
  58. TILEPRO_OPC_ADDIB_SN,
  59. TILEPRO_OPC_ADDIH,
  60. TILEPRO_OPC_ADDIH_SN,
  61. TILEPRO_OPC_ADDLI,
  62. TILEPRO_OPC_ADDLI_SN,
  63. TILEPRO_OPC_ADDLIS,
  64. TILEPRO_OPC_ADDS,
  65. TILEPRO_OPC_ADDS_SN,
  66. TILEPRO_OPC_ADIFFB_U,
  67. TILEPRO_OPC_ADIFFB_U_SN,
  68. TILEPRO_OPC_ADIFFH,
  69. TILEPRO_OPC_ADIFFH_SN,
  70. TILEPRO_OPC_AND,
  71. TILEPRO_OPC_AND_SN,
  72. TILEPRO_OPC_ANDI,
  73. TILEPRO_OPC_ANDI_SN,
  74. TILEPRO_OPC_AULI,
  75. TILEPRO_OPC_AVGB_U,
  76. TILEPRO_OPC_AVGB_U_SN,
  77. TILEPRO_OPC_AVGH,
  78. TILEPRO_OPC_AVGH_SN,
  79. TILEPRO_OPC_BBNS,
  80. TILEPRO_OPC_BBNS_SN,
  81. TILEPRO_OPC_BBNST,
  82. TILEPRO_OPC_BBNST_SN,
  83. TILEPRO_OPC_BBS,
  84. TILEPRO_OPC_BBS_SN,
  85. TILEPRO_OPC_BBST,
  86. TILEPRO_OPC_BBST_SN,
  87. TILEPRO_OPC_BGEZ,
  88. TILEPRO_OPC_BGEZ_SN,
  89. TILEPRO_OPC_BGEZT,
  90. TILEPRO_OPC_BGEZT_SN,
  91. TILEPRO_OPC_BGZ,
  92. TILEPRO_OPC_BGZ_SN,
  93. TILEPRO_OPC_BGZT,
  94. TILEPRO_OPC_BGZT_SN,
  95. TILEPRO_OPC_BITX,
  96. TILEPRO_OPC_BITX_SN,
  97. TILEPRO_OPC_BLEZ,
  98. TILEPRO_OPC_BLEZ_SN,
  99. TILEPRO_OPC_BLEZT,
  100. TILEPRO_OPC_BLEZT_SN,
  101. TILEPRO_OPC_BLZ,
  102. TILEPRO_OPC_BLZ_SN,
  103. TILEPRO_OPC_BLZT,
  104. TILEPRO_OPC_BLZT_SN,
  105. TILEPRO_OPC_BNZ,
  106. TILEPRO_OPC_BNZ_SN,
  107. TILEPRO_OPC_BNZT,
  108. TILEPRO_OPC_BNZT_SN,
  109. TILEPRO_OPC_BYTEX,
  110. TILEPRO_OPC_BYTEX_SN,
  111. TILEPRO_OPC_BZ,
  112. TILEPRO_OPC_BZ_SN,
  113. TILEPRO_OPC_BZT,
  114. TILEPRO_OPC_BZT_SN,
  115. TILEPRO_OPC_CLZ,
  116. TILEPRO_OPC_CLZ_SN,
  117. TILEPRO_OPC_CRC32_32,
  118. TILEPRO_OPC_CRC32_32_SN,
  119. TILEPRO_OPC_CRC32_8,
  120. TILEPRO_OPC_CRC32_8_SN,
  121. TILEPRO_OPC_CTZ,
  122. TILEPRO_OPC_CTZ_SN,
  123. TILEPRO_OPC_DRAIN,
  124. TILEPRO_OPC_DTLBPR,
  125. TILEPRO_OPC_DWORD_ALIGN,
  126. TILEPRO_OPC_DWORD_ALIGN_SN,
  127. TILEPRO_OPC_FINV,
  128. TILEPRO_OPC_FLUSH,
  129. TILEPRO_OPC_FNOP,
  130. TILEPRO_OPC_ICOH,
  131. TILEPRO_OPC_ILL,
  132. TILEPRO_OPC_INTHB,
  133. TILEPRO_OPC_INTHB_SN,
  134. TILEPRO_OPC_INTHH,
  135. TILEPRO_OPC_INTHH_SN,
  136. TILEPRO_OPC_INTLB,
  137. TILEPRO_OPC_INTLB_SN,
  138. TILEPRO_OPC_INTLH,
  139. TILEPRO_OPC_INTLH_SN,
  140. TILEPRO_OPC_INV,
  141. TILEPRO_OPC_IRET,
  142. TILEPRO_OPC_JALB,
  143. TILEPRO_OPC_JALF,
  144. TILEPRO_OPC_JALR,
  145. TILEPRO_OPC_JALRP,
  146. TILEPRO_OPC_JB,
  147. TILEPRO_OPC_JF,
  148. TILEPRO_OPC_JR,
  149. TILEPRO_OPC_JRP,
  150. TILEPRO_OPC_LB,
  151. TILEPRO_OPC_LB_SN,
  152. TILEPRO_OPC_LB_U,
  153. TILEPRO_OPC_LB_U_SN,
  154. TILEPRO_OPC_LBADD,
  155. TILEPRO_OPC_LBADD_SN,
  156. TILEPRO_OPC_LBADD_U,
  157. TILEPRO_OPC_LBADD_U_SN,
  158. TILEPRO_OPC_LH,
  159. TILEPRO_OPC_LH_SN,
  160. TILEPRO_OPC_LH_U,
  161. TILEPRO_OPC_LH_U_SN,
  162. TILEPRO_OPC_LHADD,
  163. TILEPRO_OPC_LHADD_SN,
  164. TILEPRO_OPC_LHADD_U,
  165. TILEPRO_OPC_LHADD_U_SN,
  166. TILEPRO_OPC_LNK,
  167. TILEPRO_OPC_LNK_SN,
  168. TILEPRO_OPC_LW,
  169. TILEPRO_OPC_LW_SN,
  170. TILEPRO_OPC_LW_NA,
  171. TILEPRO_OPC_LW_NA_SN,
  172. TILEPRO_OPC_LWADD,
  173. TILEPRO_OPC_LWADD_SN,
  174. TILEPRO_OPC_LWADD_NA,
  175. TILEPRO_OPC_LWADD_NA_SN,
  176. TILEPRO_OPC_MAXB_U,
  177. TILEPRO_OPC_MAXB_U_SN,
  178. TILEPRO_OPC_MAXH,
  179. TILEPRO_OPC_MAXH_SN,
  180. TILEPRO_OPC_MAXIB_U,
  181. TILEPRO_OPC_MAXIB_U_SN,
  182. TILEPRO_OPC_MAXIH,
  183. TILEPRO_OPC_MAXIH_SN,
  184. TILEPRO_OPC_MF,
  185. TILEPRO_OPC_MFSPR,
  186. TILEPRO_OPC_MINB_U,
  187. TILEPRO_OPC_MINB_U_SN,
  188. TILEPRO_OPC_MINH,
  189. TILEPRO_OPC_MINH_SN,
  190. TILEPRO_OPC_MINIB_U,
  191. TILEPRO_OPC_MINIB_U_SN,
  192. TILEPRO_OPC_MINIH,
  193. TILEPRO_OPC_MINIH_SN,
  194. TILEPRO_OPC_MM,
  195. TILEPRO_OPC_MNZ,
  196. TILEPRO_OPC_MNZ_SN,
  197. TILEPRO_OPC_MNZB,
  198. TILEPRO_OPC_MNZB_SN,
  199. TILEPRO_OPC_MNZH,
  200. TILEPRO_OPC_MNZH_SN,
  201. TILEPRO_OPC_MTSPR,
  202. TILEPRO_OPC_MULHH_SS,
  203. TILEPRO_OPC_MULHH_SS_SN,
  204. TILEPRO_OPC_MULHH_SU,
  205. TILEPRO_OPC_MULHH_SU_SN,
  206. TILEPRO_OPC_MULHH_UU,
  207. TILEPRO_OPC_MULHH_UU_SN,
  208. TILEPRO_OPC_MULHHA_SS,
  209. TILEPRO_OPC_MULHHA_SS_SN,
  210. TILEPRO_OPC_MULHHA_SU,
  211. TILEPRO_OPC_MULHHA_SU_SN,
  212. TILEPRO_OPC_MULHHA_UU,
  213. TILEPRO_OPC_MULHHA_UU_SN,
  214. TILEPRO_OPC_MULHHSA_UU,
  215. TILEPRO_OPC_MULHHSA_UU_SN,
  216. TILEPRO_OPC_MULHL_SS,
  217. TILEPRO_OPC_MULHL_SS_SN,
  218. TILEPRO_OPC_MULHL_SU,
  219. TILEPRO_OPC_MULHL_SU_SN,
  220. TILEPRO_OPC_MULHL_US,
  221. TILEPRO_OPC_MULHL_US_SN,
  222. TILEPRO_OPC_MULHL_UU,
  223. TILEPRO_OPC_MULHL_UU_SN,
  224. TILEPRO_OPC_MULHLA_SS,
  225. TILEPRO_OPC_MULHLA_SS_SN,
  226. TILEPRO_OPC_MULHLA_SU,
  227. TILEPRO_OPC_MULHLA_SU_SN,
  228. TILEPRO_OPC_MULHLA_US,
  229. TILEPRO_OPC_MULHLA_US_SN,
  230. TILEPRO_OPC_MULHLA_UU,
  231. TILEPRO_OPC_MULHLA_UU_SN,
  232. TILEPRO_OPC_MULHLSA_UU,
  233. TILEPRO_OPC_MULHLSA_UU_SN,
  234. TILEPRO_OPC_MULLL_SS,
  235. TILEPRO_OPC_MULLL_SS_SN,
  236. TILEPRO_OPC_MULLL_SU,
  237. TILEPRO_OPC_MULLL_SU_SN,
  238. TILEPRO_OPC_MULLL_UU,
  239. TILEPRO_OPC_MULLL_UU_SN,
  240. TILEPRO_OPC_MULLLA_SS,
  241. TILEPRO_OPC_MULLLA_SS_SN,
  242. TILEPRO_OPC_MULLLA_SU,
  243. TILEPRO_OPC_MULLLA_SU_SN,
  244. TILEPRO_OPC_MULLLA_UU,
  245. TILEPRO_OPC_MULLLA_UU_SN,
  246. TILEPRO_OPC_MULLLSA_UU,
  247. TILEPRO_OPC_MULLLSA_UU_SN,
  248. TILEPRO_OPC_MVNZ,
  249. TILEPRO_OPC_MVNZ_SN,
  250. TILEPRO_OPC_MVZ,
  251. TILEPRO_OPC_MVZ_SN,
  252. TILEPRO_OPC_MZ,
  253. TILEPRO_OPC_MZ_SN,
  254. TILEPRO_OPC_MZB,
  255. TILEPRO_OPC_MZB_SN,
  256. TILEPRO_OPC_MZH,
  257. TILEPRO_OPC_MZH_SN,
  258. TILEPRO_OPC_NAP,
  259. TILEPRO_OPC_NOP,
  260. TILEPRO_OPC_NOR,
  261. TILEPRO_OPC_NOR_SN,
  262. TILEPRO_OPC_OR,
  263. TILEPRO_OPC_OR_SN,
  264. TILEPRO_OPC_ORI,
  265. TILEPRO_OPC_ORI_SN,
  266. TILEPRO_OPC_PACKBS_U,
  267. TILEPRO_OPC_PACKBS_U_SN,
  268. TILEPRO_OPC_PACKHB,
  269. TILEPRO_OPC_PACKHB_SN,
  270. TILEPRO_OPC_PACKHS,
  271. TILEPRO_OPC_PACKHS_SN,
  272. TILEPRO_OPC_PACKLB,
  273. TILEPRO_OPC_PACKLB_SN,
  274. TILEPRO_OPC_PCNT,
  275. TILEPRO_OPC_PCNT_SN,
  276. TILEPRO_OPC_RL,
  277. TILEPRO_OPC_RL_SN,
  278. TILEPRO_OPC_RLI,
  279. TILEPRO_OPC_RLI_SN,
  280. TILEPRO_OPC_S1A,
  281. TILEPRO_OPC_S1A_SN,
  282. TILEPRO_OPC_S2A,
  283. TILEPRO_OPC_S2A_SN,
  284. TILEPRO_OPC_S3A,
  285. TILEPRO_OPC_S3A_SN,
  286. TILEPRO_OPC_SADAB_U,
  287. TILEPRO_OPC_SADAB_U_SN,
  288. TILEPRO_OPC_SADAH,
  289. TILEPRO_OPC_SADAH_SN,
  290. TILEPRO_OPC_SADAH_U,
  291. TILEPRO_OPC_SADAH_U_SN,
  292. TILEPRO_OPC_SADB_U,
  293. TILEPRO_OPC_SADB_U_SN,
  294. TILEPRO_OPC_SADH,
  295. TILEPRO_OPC_SADH_SN,
  296. TILEPRO_OPC_SADH_U,
  297. TILEPRO_OPC_SADH_U_SN,
  298. TILEPRO_OPC_SB,
  299. TILEPRO_OPC_SBADD,
  300. TILEPRO_OPC_SEQ,
  301. TILEPRO_OPC_SEQ_SN,
  302. TILEPRO_OPC_SEQB,
  303. TILEPRO_OPC_SEQB_SN,
  304. TILEPRO_OPC_SEQH,
  305. TILEPRO_OPC_SEQH_SN,
  306. TILEPRO_OPC_SEQI,
  307. TILEPRO_OPC_SEQI_SN,
  308. TILEPRO_OPC_SEQIB,
  309. TILEPRO_OPC_SEQIB_SN,
  310. TILEPRO_OPC_SEQIH,
  311. TILEPRO_OPC_SEQIH_SN,
  312. TILEPRO_OPC_SH,
  313. TILEPRO_OPC_SHADD,
  314. TILEPRO_OPC_SHL,
  315. TILEPRO_OPC_SHL_SN,
  316. TILEPRO_OPC_SHLB,
  317. TILEPRO_OPC_SHLB_SN,
  318. TILEPRO_OPC_SHLH,
  319. TILEPRO_OPC_SHLH_SN,
  320. TILEPRO_OPC_SHLI,
  321. TILEPRO_OPC_SHLI_SN,
  322. TILEPRO_OPC_SHLIB,
  323. TILEPRO_OPC_SHLIB_SN,
  324. TILEPRO_OPC_SHLIH,
  325. TILEPRO_OPC_SHLIH_SN,
  326. TILEPRO_OPC_SHR,
  327. TILEPRO_OPC_SHR_SN,
  328. TILEPRO_OPC_SHRB,
  329. TILEPRO_OPC_SHRB_SN,
  330. TILEPRO_OPC_SHRH,
  331. TILEPRO_OPC_SHRH_SN,
  332. TILEPRO_OPC_SHRI,
  333. TILEPRO_OPC_SHRI_SN,
  334. TILEPRO_OPC_SHRIB,
  335. TILEPRO_OPC_SHRIB_SN,
  336. TILEPRO_OPC_SHRIH,
  337. TILEPRO_OPC_SHRIH_SN,
  338. TILEPRO_OPC_SLT,
  339. TILEPRO_OPC_SLT_SN,
  340. TILEPRO_OPC_SLT_U,
  341. TILEPRO_OPC_SLT_U_SN,
  342. TILEPRO_OPC_SLTB,
  343. TILEPRO_OPC_SLTB_SN,
  344. TILEPRO_OPC_SLTB_U,
  345. TILEPRO_OPC_SLTB_U_SN,
  346. TILEPRO_OPC_SLTE,
  347. TILEPRO_OPC_SLTE_SN,
  348. TILEPRO_OPC_SLTE_U,
  349. TILEPRO_OPC_SLTE_U_SN,
  350. TILEPRO_OPC_SLTEB,
  351. TILEPRO_OPC_SLTEB_SN,
  352. TILEPRO_OPC_SLTEB_U,
  353. TILEPRO_OPC_SLTEB_U_SN,
  354. TILEPRO_OPC_SLTEH,
  355. TILEPRO_OPC_SLTEH_SN,
  356. TILEPRO_OPC_SLTEH_U,
  357. TILEPRO_OPC_SLTEH_U_SN,
  358. TILEPRO_OPC_SLTH,
  359. TILEPRO_OPC_SLTH_SN,
  360. TILEPRO_OPC_SLTH_U,
  361. TILEPRO_OPC_SLTH_U_SN,
  362. TILEPRO_OPC_SLTI,
  363. TILEPRO_OPC_SLTI_SN,
  364. TILEPRO_OPC_SLTI_U,
  365. TILEPRO_OPC_SLTI_U_SN,
  366. TILEPRO_OPC_SLTIB,
  367. TILEPRO_OPC_SLTIB_SN,
  368. TILEPRO_OPC_SLTIB_U,
  369. TILEPRO_OPC_SLTIB_U_SN,
  370. TILEPRO_OPC_SLTIH,
  371. TILEPRO_OPC_SLTIH_SN,
  372. TILEPRO_OPC_SLTIH_U,
  373. TILEPRO_OPC_SLTIH_U_SN,
  374. TILEPRO_OPC_SNE,
  375. TILEPRO_OPC_SNE_SN,
  376. TILEPRO_OPC_SNEB,
  377. TILEPRO_OPC_SNEB_SN,
  378. TILEPRO_OPC_SNEH,
  379. TILEPRO_OPC_SNEH_SN,
  380. TILEPRO_OPC_SRA,
  381. TILEPRO_OPC_SRA_SN,
  382. TILEPRO_OPC_SRAB,
  383. TILEPRO_OPC_SRAB_SN,
  384. TILEPRO_OPC_SRAH,
  385. TILEPRO_OPC_SRAH_SN,
  386. TILEPRO_OPC_SRAI,
  387. TILEPRO_OPC_SRAI_SN,
  388. TILEPRO_OPC_SRAIB,
  389. TILEPRO_OPC_SRAIB_SN,
  390. TILEPRO_OPC_SRAIH,
  391. TILEPRO_OPC_SRAIH_SN,
  392. TILEPRO_OPC_SUB,
  393. TILEPRO_OPC_SUB_SN,
  394. TILEPRO_OPC_SUBB,
  395. TILEPRO_OPC_SUBB_SN,
  396. TILEPRO_OPC_SUBBS_U,
  397. TILEPRO_OPC_SUBBS_U_SN,
  398. TILEPRO_OPC_SUBH,
  399. TILEPRO_OPC_SUBH_SN,
  400. TILEPRO_OPC_SUBHS,
  401. TILEPRO_OPC_SUBHS_SN,
  402. TILEPRO_OPC_SUBS,
  403. TILEPRO_OPC_SUBS_SN,
  404. TILEPRO_OPC_SW,
  405. TILEPRO_OPC_SWADD,
  406. TILEPRO_OPC_SWINT0,
  407. TILEPRO_OPC_SWINT1,
  408. TILEPRO_OPC_SWINT2,
  409. TILEPRO_OPC_SWINT3,
  410. TILEPRO_OPC_TBLIDXB0,
  411. TILEPRO_OPC_TBLIDXB0_SN,
  412. TILEPRO_OPC_TBLIDXB1,
  413. TILEPRO_OPC_TBLIDXB1_SN,
  414. TILEPRO_OPC_TBLIDXB2,
  415. TILEPRO_OPC_TBLIDXB2_SN,
  416. TILEPRO_OPC_TBLIDXB3,
  417. TILEPRO_OPC_TBLIDXB3_SN,
  418. TILEPRO_OPC_TNS,
  419. TILEPRO_OPC_TNS_SN,
  420. TILEPRO_OPC_WH64,
  421. TILEPRO_OPC_XOR,
  422. TILEPRO_OPC_XOR_SN,
  423. TILEPRO_OPC_XORI,
  424. TILEPRO_OPC_XORI_SN,
  425. TILEPRO_OPC_NONE
  426. } tilepro_mnemonic;
  427. /* 64-bit pattern for a { bpt ; nop } bundle. */
  428. #define TILEPRO_BPT_BUNDLE 0x400b3cae70166000ULL
  429. #ifndef DISASM_ONLY
  430. enum
  431. {
  432. TILEPRO_SN_MAX_OPERANDS = 6 /* route */
  433. };
  434. typedef enum
  435. {
  436. TILEPRO_SN_OPC_BZ,
  437. TILEPRO_SN_OPC_BNZ,
  438. TILEPRO_SN_OPC_JRR,
  439. TILEPRO_SN_OPC_FNOP,
  440. TILEPRO_SN_OPC_BLZ,
  441. TILEPRO_SN_OPC_NOP,
  442. TILEPRO_SN_OPC_MOVEI,
  443. TILEPRO_SN_OPC_MOVE,
  444. TILEPRO_SN_OPC_BGEZ,
  445. TILEPRO_SN_OPC_JR,
  446. TILEPRO_SN_OPC_BLEZ,
  447. TILEPRO_SN_OPC_BBNS,
  448. TILEPRO_SN_OPC_JALRR,
  449. TILEPRO_SN_OPC_BPT,
  450. TILEPRO_SN_OPC_JALR,
  451. TILEPRO_SN_OPC_SHR1,
  452. TILEPRO_SN_OPC_BGZ,
  453. TILEPRO_SN_OPC_BBS,
  454. TILEPRO_SN_OPC_SHL8II,
  455. TILEPRO_SN_OPC_ADDI,
  456. TILEPRO_SN_OPC_HALT,
  457. TILEPRO_SN_OPC_ROUTE,
  458. TILEPRO_SN_OPC_NONE
  459. } tilepro_sn_mnemonic;
  460. extern const unsigned char tilepro_sn_route_encode[6 * 6 * 6];
  461. extern const signed char tilepro_sn_route_decode[256][3];
  462. extern const char tilepro_sn_direction_names[6][5];
  463. extern const signed char tilepro_sn_dest_map[6][6];
  464. #endif /* DISASM_ONLY */
  465. static __inline unsigned int
  466. get_BrOff_SN(tilepro_bundle_bits num)
  467. {
  468. const unsigned int n = (unsigned int)num;
  469. return (((n >> 0)) & 0x3ff);
  470. }
  471. static __inline unsigned int
  472. get_BrOff_X1(tilepro_bundle_bits n)
  473. {
  474. return (((unsigned int)(n >> 43)) & 0x00007fff) |
  475. (((unsigned int)(n >> 20)) & 0x00018000);
  476. }
  477. static __inline unsigned int
  478. get_BrType_X1(tilepro_bundle_bits n)
  479. {
  480. return (((unsigned int)(n >> 31)) & 0xf);
  481. }
  482. static __inline unsigned int
  483. get_Dest_Imm8_X1(tilepro_bundle_bits n)
  484. {
  485. return (((unsigned int)(n >> 31)) & 0x0000003f) |
  486. (((unsigned int)(n >> 43)) & 0x000000c0);
  487. }
  488. static __inline unsigned int
  489. get_Dest_SN(tilepro_bundle_bits num)
  490. {
  491. const unsigned int n = (unsigned int)num;
  492. return (((n >> 2)) & 0x3);
  493. }
  494. static __inline unsigned int
  495. get_Dest_X0(tilepro_bundle_bits num)
  496. {
  497. const unsigned int n = (unsigned int)num;
  498. return (((n >> 0)) & 0x3f);
  499. }
  500. static __inline unsigned int
  501. get_Dest_X1(tilepro_bundle_bits n)
  502. {
  503. return (((unsigned int)(n >> 31)) & 0x3f);
  504. }
  505. static __inline unsigned int
  506. get_Dest_Y0(tilepro_bundle_bits num)
  507. {
  508. const unsigned int n = (unsigned int)num;
  509. return (((n >> 0)) & 0x3f);
  510. }
  511. static __inline unsigned int
  512. get_Dest_Y1(tilepro_bundle_bits n)
  513. {
  514. return (((unsigned int)(n >> 31)) & 0x3f);
  515. }
  516. static __inline unsigned int
  517. get_Imm16_X0(tilepro_bundle_bits num)
  518. {
  519. const unsigned int n = (unsigned int)num;
  520. return (((n >> 12)) & 0xffff);
  521. }
  522. static __inline unsigned int
  523. get_Imm16_X1(tilepro_bundle_bits n)
  524. {
  525. return (((unsigned int)(n >> 43)) & 0xffff);
  526. }
  527. static __inline unsigned int
  528. get_Imm8_SN(tilepro_bundle_bits num)
  529. {
  530. const unsigned int n = (unsigned int)num;
  531. return (((n >> 0)) & 0xff);
  532. }
  533. static __inline unsigned int
  534. get_Imm8_X0(tilepro_bundle_bits num)
  535. {
  536. const unsigned int n = (unsigned int)num;
  537. return (((n >> 12)) & 0xff);
  538. }
  539. static __inline unsigned int
  540. get_Imm8_X1(tilepro_bundle_bits n)
  541. {
  542. return (((unsigned int)(n >> 43)) & 0xff);
  543. }
  544. static __inline unsigned int
  545. get_Imm8_Y0(tilepro_bundle_bits num)
  546. {
  547. const unsigned int n = (unsigned int)num;
  548. return (((n >> 12)) & 0xff);
  549. }
  550. static __inline unsigned int
  551. get_Imm8_Y1(tilepro_bundle_bits n)
  552. {
  553. return (((unsigned int)(n >> 43)) & 0xff);
  554. }
  555. static __inline unsigned int
  556. get_ImmOpcodeExtension_X0(tilepro_bundle_bits num)
  557. {
  558. const unsigned int n = (unsigned int)num;
  559. return (((n >> 20)) & 0x7f);
  560. }
  561. static __inline unsigned int
  562. get_ImmOpcodeExtension_X1(tilepro_bundle_bits n)
  563. {
  564. return (((unsigned int)(n >> 51)) & 0x7f);
  565. }
  566. static __inline unsigned int
  567. get_ImmRROpcodeExtension_SN(tilepro_bundle_bits num)
  568. {
  569. const unsigned int n = (unsigned int)num;
  570. return (((n >> 8)) & 0x3);
  571. }
  572. static __inline unsigned int
  573. get_JOffLong_X1(tilepro_bundle_bits n)
  574. {
  575. return (((unsigned int)(n >> 43)) & 0x00007fff) |
  576. (((unsigned int)(n >> 20)) & 0x00018000) |
  577. (((unsigned int)(n >> 14)) & 0x001e0000) |
  578. (((unsigned int)(n >> 16)) & 0x07e00000) |
  579. (((unsigned int)(n >> 31)) & 0x18000000);
  580. }
  581. static __inline unsigned int
  582. get_JOff_X1(tilepro_bundle_bits n)
  583. {
  584. return (((unsigned int)(n >> 43)) & 0x00007fff) |
  585. (((unsigned int)(n >> 20)) & 0x00018000) |
  586. (((unsigned int)(n >> 14)) & 0x001e0000) |
  587. (((unsigned int)(n >> 16)) & 0x07e00000) |
  588. (((unsigned int)(n >> 31)) & 0x08000000);
  589. }
  590. static __inline unsigned int
  591. get_MF_Imm15_X1(tilepro_bundle_bits n)
  592. {
  593. return (((unsigned int)(n >> 37)) & 0x00003fff) |
  594. (((unsigned int)(n >> 44)) & 0x00004000);
  595. }
  596. static __inline unsigned int
  597. get_MMEnd_X0(tilepro_bundle_bits num)
  598. {
  599. const unsigned int n = (unsigned int)num;
  600. return (((n >> 18)) & 0x1f);
  601. }
  602. static __inline unsigned int
  603. get_MMEnd_X1(tilepro_bundle_bits n)
  604. {
  605. return (((unsigned int)(n >> 49)) & 0x1f);
  606. }
  607. static __inline unsigned int
  608. get_MMStart_X0(tilepro_bundle_bits num)
  609. {
  610. const unsigned int n = (unsigned int)num;
  611. return (((n >> 23)) & 0x1f);
  612. }
  613. static __inline unsigned int
  614. get_MMStart_X1(tilepro_bundle_bits n)
  615. {
  616. return (((unsigned int)(n >> 54)) & 0x1f);
  617. }
  618. static __inline unsigned int
  619. get_MT_Imm15_X1(tilepro_bundle_bits n)
  620. {
  621. return (((unsigned int)(n >> 31)) & 0x0000003f) |
  622. (((unsigned int)(n >> 37)) & 0x00003fc0) |
  623. (((unsigned int)(n >> 44)) & 0x00004000);
  624. }
  625. static __inline unsigned int
  626. get_Mode(tilepro_bundle_bits n)
  627. {
  628. return (((unsigned int)(n >> 63)) & 0x1);
  629. }
  630. static __inline unsigned int
  631. get_NoRegOpcodeExtension_SN(tilepro_bundle_bits num)
  632. {
  633. const unsigned int n = (unsigned int)num;
  634. return (((n >> 0)) & 0xf);
  635. }
  636. static __inline unsigned int
  637. get_Opcode_SN(tilepro_bundle_bits num)
  638. {
  639. const unsigned int n = (unsigned int)num;
  640. return (((n >> 10)) & 0x3f);
  641. }
  642. static __inline unsigned int
  643. get_Opcode_X0(tilepro_bundle_bits num)
  644. {
  645. const unsigned int n = (unsigned int)num;
  646. return (((n >> 28)) & 0x7);
  647. }
  648. static __inline unsigned int
  649. get_Opcode_X1(tilepro_bundle_bits n)
  650. {
  651. return (((unsigned int)(n >> 59)) & 0xf);
  652. }
  653. static __inline unsigned int
  654. get_Opcode_Y0(tilepro_bundle_bits num)
  655. {
  656. const unsigned int n = (unsigned int)num;
  657. return (((n >> 27)) & 0xf);
  658. }
  659. static __inline unsigned int
  660. get_Opcode_Y1(tilepro_bundle_bits n)
  661. {
  662. return (((unsigned int)(n >> 59)) & 0xf);
  663. }
  664. static __inline unsigned int
  665. get_Opcode_Y2(tilepro_bundle_bits n)
  666. {
  667. return (((unsigned int)(n >> 56)) & 0x7);
  668. }
  669. static __inline unsigned int
  670. get_RROpcodeExtension_SN(tilepro_bundle_bits num)
  671. {
  672. const unsigned int n = (unsigned int)num;
  673. return (((n >> 4)) & 0xf);
  674. }
  675. static __inline unsigned int
  676. get_RRROpcodeExtension_X0(tilepro_bundle_bits num)
  677. {
  678. const unsigned int n = (unsigned int)num;
  679. return (((n >> 18)) & 0x1ff);
  680. }
  681. static __inline unsigned int
  682. get_RRROpcodeExtension_X1(tilepro_bundle_bits n)
  683. {
  684. return (((unsigned int)(n >> 49)) & 0x1ff);
  685. }
  686. static __inline unsigned int
  687. get_RRROpcodeExtension_Y0(tilepro_bundle_bits num)
  688. {
  689. const unsigned int n = (unsigned int)num;
  690. return (((n >> 18)) & 0x3);
  691. }
  692. static __inline unsigned int
  693. get_RRROpcodeExtension_Y1(tilepro_bundle_bits n)
  694. {
  695. return (((unsigned int)(n >> 49)) & 0x3);
  696. }
  697. static __inline unsigned int
  698. get_RouteOpcodeExtension_SN(tilepro_bundle_bits num)
  699. {
  700. const unsigned int n = (unsigned int)num;
  701. return (((n >> 0)) & 0x3ff);
  702. }
  703. static __inline unsigned int
  704. get_S_X0(tilepro_bundle_bits num)
  705. {
  706. const unsigned int n = (unsigned int)num;
  707. return (((n >> 27)) & 0x1);
  708. }
  709. static __inline unsigned int
  710. get_S_X1(tilepro_bundle_bits n)
  711. {
  712. return (((unsigned int)(n >> 58)) & 0x1);
  713. }
  714. static __inline unsigned int
  715. get_ShAmt_X0(tilepro_bundle_bits num)
  716. {
  717. const unsigned int n = (unsigned int)num;
  718. return (((n >> 12)) & 0x1f);
  719. }
  720. static __inline unsigned int
  721. get_ShAmt_X1(tilepro_bundle_bits n)
  722. {
  723. return (((unsigned int)(n >> 43)) & 0x1f);
  724. }
  725. static __inline unsigned int
  726. get_ShAmt_Y0(tilepro_bundle_bits num)
  727. {
  728. const unsigned int n = (unsigned int)num;
  729. return (((n >> 12)) & 0x1f);
  730. }
  731. static __inline unsigned int
  732. get_ShAmt_Y1(tilepro_bundle_bits n)
  733. {
  734. return (((unsigned int)(n >> 43)) & 0x1f);
  735. }
  736. static __inline unsigned int
  737. get_SrcA_X0(tilepro_bundle_bits num)
  738. {
  739. const unsigned int n = (unsigned int)num;
  740. return (((n >> 6)) & 0x3f);
  741. }
  742. static __inline unsigned int
  743. get_SrcA_X1(tilepro_bundle_bits n)
  744. {
  745. return (((unsigned int)(n >> 37)) & 0x3f);
  746. }
  747. static __inline unsigned int
  748. get_SrcA_Y0(tilepro_bundle_bits num)
  749. {
  750. const unsigned int n = (unsigned int)num;
  751. return (((n >> 6)) & 0x3f);
  752. }
  753. static __inline unsigned int
  754. get_SrcA_Y1(tilepro_bundle_bits n)
  755. {
  756. return (((unsigned int)(n >> 37)) & 0x3f);
  757. }
  758. static __inline unsigned int
  759. get_SrcA_Y2(tilepro_bundle_bits n)
  760. {
  761. return (((n >> 26)) & 0x00000001) |
  762. (((unsigned int)(n >> 50)) & 0x0000003e);
  763. }
  764. static __inline unsigned int
  765. get_SrcBDest_Y2(tilepro_bundle_bits num)
  766. {
  767. const unsigned int n = (unsigned int)num;
  768. return (((n >> 20)) & 0x3f);
  769. }
  770. static __inline unsigned int
  771. get_SrcB_X0(tilepro_bundle_bits num)
  772. {
  773. const unsigned int n = (unsigned int)num;
  774. return (((n >> 12)) & 0x3f);
  775. }
  776. static __inline unsigned int
  777. get_SrcB_X1(tilepro_bundle_bits n)
  778. {
  779. return (((unsigned int)(n >> 43)) & 0x3f);
  780. }
  781. static __inline unsigned int
  782. get_SrcB_Y0(tilepro_bundle_bits num)
  783. {
  784. const unsigned int n = (unsigned int)num;
  785. return (((n >> 12)) & 0x3f);
  786. }
  787. static __inline unsigned int
  788. get_SrcB_Y1(tilepro_bundle_bits n)
  789. {
  790. return (((unsigned int)(n >> 43)) & 0x3f);
  791. }
  792. static __inline unsigned int
  793. get_Src_SN(tilepro_bundle_bits num)
  794. {
  795. const unsigned int n = (unsigned int)num;
  796. return (((n >> 0)) & 0x3);
  797. }
  798. static __inline unsigned int
  799. get_UnOpcodeExtension_X0(tilepro_bundle_bits num)
  800. {
  801. const unsigned int n = (unsigned int)num;
  802. return (((n >> 12)) & 0x1f);
  803. }
  804. static __inline unsigned int
  805. get_UnOpcodeExtension_X1(tilepro_bundle_bits n)
  806. {
  807. return (((unsigned int)(n >> 43)) & 0x1f);
  808. }
  809. static __inline unsigned int
  810. get_UnOpcodeExtension_Y0(tilepro_bundle_bits num)
  811. {
  812. const unsigned int n = (unsigned int)num;
  813. return (((n >> 12)) & 0x1f);
  814. }
  815. static __inline unsigned int
  816. get_UnOpcodeExtension_Y1(tilepro_bundle_bits n)
  817. {
  818. return (((unsigned int)(n >> 43)) & 0x1f);
  819. }
  820. static __inline unsigned int
  821. get_UnShOpcodeExtension_X0(tilepro_bundle_bits num)
  822. {
  823. const unsigned int n = (unsigned int)num;
  824. return (((n >> 17)) & 0x3ff);
  825. }
  826. static __inline unsigned int
  827. get_UnShOpcodeExtension_X1(tilepro_bundle_bits n)
  828. {
  829. return (((unsigned int)(n >> 48)) & 0x3ff);
  830. }
  831. static __inline unsigned int
  832. get_UnShOpcodeExtension_Y0(tilepro_bundle_bits num)
  833. {
  834. const unsigned int n = (unsigned int)num;
  835. return (((n >> 17)) & 0x7);
  836. }
  837. static __inline unsigned int
  838. get_UnShOpcodeExtension_Y1(tilepro_bundle_bits n)
  839. {
  840. return (((unsigned int)(n >> 48)) & 0x7);
  841. }
  842. static __inline int
  843. sign_extend(int n, int num_bits)
  844. {
  845. int shift = (int)(sizeof(int) * 8 - num_bits);
  846. return (n << shift) >> shift;
  847. }
  848. static __inline tilepro_bundle_bits
  849. create_BrOff_SN(int num)
  850. {
  851. const unsigned int n = (unsigned int)num;
  852. return ((n & 0x3ff) << 0);
  853. }
  854. static __inline tilepro_bundle_bits
  855. create_BrOff_X1(int num)
  856. {
  857. const unsigned int n = (unsigned int)num;
  858. return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
  859. (((tilepro_bundle_bits)(n & 0x00018000)) << 20);
  860. }
  861. static __inline tilepro_bundle_bits
  862. create_BrType_X1(int num)
  863. {
  864. const unsigned int n = (unsigned int)num;
  865. return (((tilepro_bundle_bits)(n & 0xf)) << 31);
  866. }
  867. static __inline tilepro_bundle_bits
  868. create_Dest_Imm8_X1(int num)
  869. {
  870. const unsigned int n = (unsigned int)num;
  871. return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
  872. (((tilepro_bundle_bits)(n & 0x000000c0)) << 43);
  873. }
  874. static __inline tilepro_bundle_bits
  875. create_Dest_SN(int num)
  876. {
  877. const unsigned int n = (unsigned int)num;
  878. return ((n & 0x3) << 2);
  879. }
  880. static __inline tilepro_bundle_bits
  881. create_Dest_X0(int num)
  882. {
  883. const unsigned int n = (unsigned int)num;
  884. return ((n & 0x3f) << 0);
  885. }
  886. static __inline tilepro_bundle_bits
  887. create_Dest_X1(int num)
  888. {
  889. const unsigned int n = (unsigned int)num;
  890. return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
  891. }
  892. static __inline tilepro_bundle_bits
  893. create_Dest_Y0(int num)
  894. {
  895. const unsigned int n = (unsigned int)num;
  896. return ((n & 0x3f) << 0);
  897. }
  898. static __inline tilepro_bundle_bits
  899. create_Dest_Y1(int num)
  900. {
  901. const unsigned int n = (unsigned int)num;
  902. return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
  903. }
  904. static __inline tilepro_bundle_bits
  905. create_Imm16_X0(int num)
  906. {
  907. const unsigned int n = (unsigned int)num;
  908. return ((n & 0xffff) << 12);
  909. }
  910. static __inline tilepro_bundle_bits
  911. create_Imm16_X1(int num)
  912. {
  913. const unsigned int n = (unsigned int)num;
  914. return (((tilepro_bundle_bits)(n & 0xffff)) << 43);
  915. }
  916. static __inline tilepro_bundle_bits
  917. create_Imm8_SN(int num)
  918. {
  919. const unsigned int n = (unsigned int)num;
  920. return ((n & 0xff) << 0);
  921. }
  922. static __inline tilepro_bundle_bits
  923. create_Imm8_X0(int num)
  924. {
  925. const unsigned int n = (unsigned int)num;
  926. return ((n & 0xff) << 12);
  927. }
  928. static __inline tilepro_bundle_bits
  929. create_Imm8_X1(int num)
  930. {
  931. const unsigned int n = (unsigned int)num;
  932. return (((tilepro_bundle_bits)(n & 0xff)) << 43);
  933. }
  934. static __inline tilepro_bundle_bits
  935. create_Imm8_Y0(int num)
  936. {
  937. const unsigned int n = (unsigned int)num;
  938. return ((n & 0xff) << 12);
  939. }
  940. static __inline tilepro_bundle_bits
  941. create_Imm8_Y1(int num)
  942. {
  943. const unsigned int n = (unsigned int)num;
  944. return (((tilepro_bundle_bits)(n & 0xff)) << 43);
  945. }
  946. static __inline tilepro_bundle_bits
  947. create_ImmOpcodeExtension_X0(int num)
  948. {
  949. const unsigned int n = (unsigned int)num;
  950. return ((n & 0x7f) << 20);
  951. }
  952. static __inline tilepro_bundle_bits
  953. create_ImmOpcodeExtension_X1(int num)
  954. {
  955. const unsigned int n = (unsigned int)num;
  956. return (((tilepro_bundle_bits)(n & 0x7f)) << 51);
  957. }
  958. static __inline tilepro_bundle_bits
  959. create_ImmRROpcodeExtension_SN(int num)
  960. {
  961. const unsigned int n = (unsigned int)num;
  962. return ((n & 0x3) << 8);
  963. }
  964. static __inline tilepro_bundle_bits
  965. create_JOffLong_X1(int num)
  966. {
  967. const unsigned int n = (unsigned int)num;
  968. return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
  969. (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
  970. (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
  971. (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
  972. (((tilepro_bundle_bits)(n & 0x18000000)) << 31);
  973. }
  974. static __inline tilepro_bundle_bits
  975. create_JOff_X1(int num)
  976. {
  977. const unsigned int n = (unsigned int)num;
  978. return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
  979. (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
  980. (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
  981. (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
  982. (((tilepro_bundle_bits)(n & 0x08000000)) << 31);
  983. }
  984. static __inline tilepro_bundle_bits
  985. create_MF_Imm15_X1(int num)
  986. {
  987. const unsigned int n = (unsigned int)num;
  988. return (((tilepro_bundle_bits)(n & 0x00003fff)) << 37) |
  989. (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
  990. }
  991. static __inline tilepro_bundle_bits
  992. create_MMEnd_X0(int num)
  993. {
  994. const unsigned int n = (unsigned int)num;
  995. return ((n & 0x1f) << 18);
  996. }
  997. static __inline tilepro_bundle_bits
  998. create_MMEnd_X1(int num)
  999. {
  1000. const unsigned int n = (unsigned int)num;
  1001. return (((tilepro_bundle_bits)(n & 0x1f)) << 49);
  1002. }
  1003. static __inline tilepro_bundle_bits
  1004. create_MMStart_X0(int num)
  1005. {
  1006. const unsigned int n = (unsigned int)num;
  1007. return ((n & 0x1f) << 23);
  1008. }
  1009. static __inline tilepro_bundle_bits
  1010. create_MMStart_X1(int num)
  1011. {
  1012. const unsigned int n = (unsigned int)num;
  1013. return (((tilepro_bundle_bits)(n & 0x1f)) << 54);
  1014. }
  1015. static __inline tilepro_bundle_bits
  1016. create_MT_Imm15_X1(int num)
  1017. {
  1018. const unsigned int n = (unsigned int)num;
  1019. return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
  1020. (((tilepro_bundle_bits)(n & 0x00003fc0)) << 37) |
  1021. (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
  1022. }
  1023. static __inline tilepro_bundle_bits
  1024. create_Mode(int num)
  1025. {
  1026. const unsigned int n = (unsigned int)num;
  1027. return (((tilepro_bundle_bits)(n & 0x1)) << 63);
  1028. }
  1029. static __inline tilepro_bundle_bits
  1030. create_NoRegOpcodeExtension_SN(int num)
  1031. {
  1032. const unsigned int n = (unsigned int)num;
  1033. return ((n & 0xf) << 0);
  1034. }
  1035. static __inline tilepro_bundle_bits
  1036. create_Opcode_SN(int num)
  1037. {
  1038. const unsigned int n = (unsigned int)num;
  1039. return ((n & 0x3f) << 10);
  1040. }
  1041. static __inline tilepro_bundle_bits
  1042. create_Opcode_X0(int num)
  1043. {
  1044. const unsigned int n = (unsigned int)num;
  1045. return ((n & 0x7) << 28);
  1046. }
  1047. static __inline tilepro_bundle_bits
  1048. create_Opcode_X1(int num)
  1049. {
  1050. const unsigned int n = (unsigned int)num;
  1051. return (((tilepro_bundle_bits)(n & 0xf)) << 59);
  1052. }
  1053. static __inline tilepro_bundle_bits
  1054. create_Opcode_Y0(int num)
  1055. {
  1056. const unsigned int n = (unsigned int)num;
  1057. return ((n & 0xf) << 27);
  1058. }
  1059. static __inline tilepro_bundle_bits
  1060. create_Opcode_Y1(int num)
  1061. {
  1062. const unsigned int n = (unsigned int)num;
  1063. return (((tilepro_bundle_bits)(n & 0xf)) << 59);
  1064. }
  1065. static __inline tilepro_bundle_bits
  1066. create_Opcode_Y2(int num)
  1067. {
  1068. const unsigned int n = (unsigned int)num;
  1069. return (((tilepro_bundle_bits)(n & 0x7)) << 56);
  1070. }
  1071. static __inline tilepro_bundle_bits
  1072. create_RROpcodeExtension_SN(int num)
  1073. {
  1074. const unsigned int n = (unsigned int)num;
  1075. return ((n & 0xf) << 4);
  1076. }
  1077. static __inline tilepro_bundle_bits
  1078. create_RRROpcodeExtension_X0(int num)
  1079. {
  1080. const unsigned int n = (unsigned int)num;
  1081. return ((n & 0x1ff) << 18);
  1082. }
  1083. static __inline tilepro_bundle_bits
  1084. create_RRROpcodeExtension_X1(int num)
  1085. {
  1086. const unsigned int n = (unsigned int)num;
  1087. return (((tilepro_bundle_bits)(n & 0x1ff)) << 49);
  1088. }
  1089. static __inline tilepro_bundle_bits
  1090. create_RRROpcodeExtension_Y0(int num)
  1091. {
  1092. const unsigned int n = (unsigned int)num;
  1093. return ((n & 0x3) << 18);
  1094. }
  1095. static __inline tilepro_bundle_bits
  1096. create_RRROpcodeExtension_Y1(int num)
  1097. {
  1098. const unsigned int n = (unsigned int)num;
  1099. return (((tilepro_bundle_bits)(n & 0x3)) << 49);
  1100. }
  1101. static __inline tilepro_bundle_bits
  1102. create_RouteOpcodeExtension_SN(int num)
  1103. {
  1104. const unsigned int n = (unsigned int)num;
  1105. return ((n & 0x3ff) << 0);
  1106. }
  1107. static __inline tilepro_bundle_bits
  1108. create_S_X0(int num)
  1109. {
  1110. const unsigned int n = (unsigned int)num;
  1111. return ((n & 0x1) << 27);
  1112. }
  1113. static __inline tilepro_bundle_bits
  1114. create_S_X1(int num)
  1115. {
  1116. const unsigned int n = (unsigned int)num;
  1117. return (((tilepro_bundle_bits)(n & 0x1)) << 58);
  1118. }
  1119. static __inline tilepro_bundle_bits
  1120. create_ShAmt_X0(int num)
  1121. {
  1122. const unsigned int n = (unsigned int)num;
  1123. return ((n & 0x1f) << 12);
  1124. }
  1125. static __inline tilepro_bundle_bits
  1126. create_ShAmt_X1(int num)
  1127. {
  1128. const unsigned int n = (unsigned int)num;
  1129. return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
  1130. }
  1131. static __inline tilepro_bundle_bits
  1132. create_ShAmt_Y0(int num)
  1133. {
  1134. const unsigned int n = (unsigned int)num;
  1135. return ((n & 0x1f) << 12);
  1136. }
  1137. static __inline tilepro_bundle_bits
  1138. create_ShAmt_Y1(int num)
  1139. {
  1140. const unsigned int n = (unsigned int)num;
  1141. return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
  1142. }
  1143. static __inline tilepro_bundle_bits
  1144. create_SrcA_X0(int num)
  1145. {
  1146. const unsigned int n = (unsigned int)num;
  1147. return ((n & 0x3f) << 6);
  1148. }
  1149. static __inline tilepro_bundle_bits
  1150. create_SrcA_X1(int num)
  1151. {
  1152. const unsigned int n = (unsigned int)num;
  1153. return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
  1154. }
  1155. static __inline tilepro_bundle_bits
  1156. create_SrcA_Y0(int num)
  1157. {
  1158. const unsigned int n = (unsigned int)num;
  1159. return ((n & 0x3f) << 6);
  1160. }
  1161. static __inline tilepro_bundle_bits
  1162. create_SrcA_Y1(int num)
  1163. {
  1164. const unsigned int n = (unsigned int)num;
  1165. return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
  1166. }
  1167. static __inline tilepro_bundle_bits
  1168. create_SrcA_Y2(int num)
  1169. {
  1170. const unsigned int n = (unsigned int)num;
  1171. return ((n & 0x00000001) << 26) |
  1172. (((tilepro_bundle_bits)(n & 0x0000003e)) << 50);
  1173. }
  1174. static __inline tilepro_bundle_bits
  1175. create_SrcBDest_Y2(int num)
  1176. {
  1177. const unsigned int n = (unsigned int)num;
  1178. return ((n & 0x3f) << 20);
  1179. }
  1180. static __inline tilepro_bundle_bits
  1181. create_SrcB_X0(int num)
  1182. {
  1183. const unsigned int n = (unsigned int)num;
  1184. return ((n & 0x3f) << 12);
  1185. }
  1186. static __inline tilepro_bundle_bits
  1187. create_SrcB_X1(int num)
  1188. {
  1189. const unsigned int n = (unsigned int)num;
  1190. return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
  1191. }
  1192. static __inline tilepro_bundle_bits
  1193. create_SrcB_Y0(int num)
  1194. {
  1195. const unsigned int n = (unsigned int)num;
  1196. return ((n & 0x3f) << 12);
  1197. }
  1198. static __inline tilepro_bundle_bits
  1199. create_SrcB_Y1(int num)
  1200. {
  1201. const unsigned int n = (unsigned int)num;
  1202. return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
  1203. }
  1204. static __inline tilepro_bundle_bits
  1205. create_Src_SN(int num)
  1206. {
  1207. const unsigned int n = (unsigned int)num;
  1208. return ((n & 0x3) << 0);
  1209. }
  1210. static __inline tilepro_bundle_bits
  1211. create_UnOpcodeExtension_X0(int num)
  1212. {
  1213. const unsigned int n = (unsigned int)num;
  1214. return ((n & 0x1f) << 12);
  1215. }
  1216. static __inline tilepro_bundle_bits
  1217. create_UnOpcodeExtension_X1(int num)
  1218. {
  1219. const unsigned int n = (unsigned int)num;
  1220. return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
  1221. }
  1222. static __inline tilepro_bundle_bits
  1223. create_UnOpcodeExtension_Y0(int num)
  1224. {
  1225. const unsigned int n = (unsigned int)num;
  1226. return ((n & 0x1f) << 12);
  1227. }
  1228. static __inline tilepro_bundle_bits
  1229. create_UnOpcodeExtension_Y1(int num)
  1230. {
  1231. const unsigned int n = (unsigned int)num;
  1232. return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
  1233. }
  1234. static __inline tilepro_bundle_bits
  1235. create_UnShOpcodeExtension_X0(int num)
  1236. {
  1237. const unsigned int n = (unsigned int)num;
  1238. return ((n & 0x3ff) << 17);
  1239. }
  1240. static __inline tilepro_bundle_bits
  1241. create_UnShOpcodeExtension_X1(int num)
  1242. {
  1243. const unsigned int n = (unsigned int)num;
  1244. return (((tilepro_bundle_bits)(n & 0x3ff)) << 48);
  1245. }
  1246. static __inline tilepro_bundle_bits
  1247. create_UnShOpcodeExtension_Y0(int num)
  1248. {
  1249. const unsigned int n = (unsigned int)num;
  1250. return ((n & 0x7) << 17);
  1251. }
  1252. static __inline tilepro_bundle_bits
  1253. create_UnShOpcodeExtension_Y1(int num)
  1254. {
  1255. const unsigned int n = (unsigned int)num;
  1256. return (((tilepro_bundle_bits)(n & 0x7)) << 48);
  1257. }
  1258. typedef enum
  1259. {
  1260. TILEPRO_PIPELINE_X0,
  1261. TILEPRO_PIPELINE_X1,
  1262. TILEPRO_PIPELINE_Y0,
  1263. TILEPRO_PIPELINE_Y1,
  1264. TILEPRO_PIPELINE_Y2,
  1265. } tilepro_pipeline;
  1266. #define tilepro_is_x_pipeline(p) ((int)(p) <= (int)TILEPRO_PIPELINE_X1)
  1267. typedef enum
  1268. {
  1269. TILEPRO_OP_TYPE_REGISTER,
  1270. TILEPRO_OP_TYPE_IMMEDIATE,
  1271. TILEPRO_OP_TYPE_ADDRESS,
  1272. TILEPRO_OP_TYPE_SPR
  1273. } tilepro_operand_type;
  1274. /* This is the bit that determines if a bundle is in the Y encoding. */
  1275. #define TILEPRO_BUNDLE_Y_ENCODING_MASK ((tilepro_bundle_bits)1 << 63)
  1276. enum
  1277. {
  1278. /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
  1279. TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
  1280. /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
  1281. TILEPRO_NUM_PIPELINE_ENCODINGS = 5,
  1282. /* Log base 2 of TILEPRO_BUNDLE_SIZE_IN_BYTES. */
  1283. TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
  1284. /* Instructions take this many bytes. */
  1285. TILEPRO_BUNDLE_SIZE_IN_BYTES = 1 << TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES,
  1286. /* Log base 2 of TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES. */
  1287. TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
  1288. /* Bundles should be aligned modulo this number of bytes. */
  1289. TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES =
  1290. (1 << TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
  1291. /* Log base 2 of TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES. */
  1292. TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES = 1,
  1293. /* Static network instructions take this many bytes. */
  1294. TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES =
  1295. (1 << TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES),
  1296. /* Number of registers (some are magic, such as network I/O). */
  1297. TILEPRO_NUM_REGISTERS = 64,
  1298. /* Number of static network registers. */
  1299. TILEPRO_NUM_SN_REGISTERS = 4
  1300. };
  1301. struct tilepro_operand
  1302. {
  1303. /* Is this operand a register, immediate or address? */
  1304. tilepro_operand_type type;
  1305. /* The default relocation type for this operand. */
  1306. signed int default_reloc : 16;
  1307. /* How many bits is this value? (used for range checking) */
  1308. unsigned int num_bits : 5;
  1309. /* Is the value signed? (used for range checking) */
  1310. unsigned int is_signed : 1;
  1311. /* Is this operand a source register? */
  1312. unsigned int is_src_reg : 1;
  1313. /* Is this operand written? (i.e. is it a destination register) */
  1314. unsigned int is_dest_reg : 1;
  1315. /* Is this operand PC-relative? */
  1316. unsigned int is_pc_relative : 1;
  1317. /* By how many bits do we right shift the value before inserting? */
  1318. unsigned int rightshift : 2;
  1319. /* Return the bits for this operand to be ORed into an existing bundle. */
  1320. tilepro_bundle_bits (*insert) (int op);
  1321. /* Extract this operand and return it. */
  1322. unsigned int (*extract) (tilepro_bundle_bits bundle);
  1323. };
  1324. extern const struct tilepro_operand tilepro_operands[];
  1325. /* One finite-state machine per pipe for rapid instruction decoding. */
  1326. extern const unsigned short * const
  1327. tilepro_bundle_decoder_fsms[TILEPRO_NUM_PIPELINE_ENCODINGS];
  1328. struct tilepro_opcode
  1329. {
  1330. /* The opcode mnemonic, e.g. "add" */
  1331. const char *name;
  1332. /* The enum value for this mnemonic. */
  1333. tilepro_mnemonic mnemonic;
  1334. /* A bit mask of which of the five pipes this instruction
  1335. is compatible with:
  1336. X0 0x01
  1337. X1 0x02
  1338. Y0 0x04
  1339. Y1 0x08
  1340. Y2 0x10 */
  1341. unsigned char pipes;
  1342. /* How many operands are there? */
  1343. unsigned char num_operands;
  1344. /* Which register does this write implicitly, or TREG_ZERO if none? */
  1345. unsigned char implicitly_written_register;
  1346. /* Can this be bundled with other instructions (almost always true). */
  1347. unsigned char can_bundle;
  1348. /* The description of the operands. Each of these is an
  1349. * index into the tilepro_operands[] table. */
  1350. unsigned char operands[TILEPRO_NUM_PIPELINE_ENCODINGS][TILEPRO_MAX_OPERANDS];
  1351. #if !defined(__KERNEL__) && !defined(_LIBC)
  1352. /* A mask of which bits have predefined values for each pipeline.
  1353. * This is useful for disassembly. */
  1354. tilepro_bundle_bits fixed_bit_masks[TILEPRO_NUM_PIPELINE_ENCODINGS];
  1355. /* For each bit set in fixed_bit_masks, what the value is for this
  1356. * instruction. */
  1357. tilepro_bundle_bits fixed_bit_values[TILEPRO_NUM_PIPELINE_ENCODINGS];
  1358. #endif
  1359. };
  1360. extern const struct tilepro_opcode tilepro_opcodes[];
  1361. #if !defined(__KERNEL__) && !defined(_LIBC)
  1362. typedef unsigned short tilepro_sn_instruction_bits;
  1363. struct tilepro_sn_opcode
  1364. {
  1365. /* The opcode mnemonic, e.g. "add" */
  1366. const char *name;
  1367. /* The enum value for this mnemonic. */
  1368. tilepro_sn_mnemonic mnemonic;
  1369. /* How many operands are there? */
  1370. unsigned char num_operands;
  1371. /* The description of the operands. Each of these is an
  1372. * index into the tilepro_operands[] table. */
  1373. unsigned char operands[TILEPRO_SN_MAX_OPERANDS];
  1374. /* A mask of which bits have predefined values.
  1375. * This is useful for disassembly. */
  1376. tilepro_sn_instruction_bits fixed_bit_mask;
  1377. /* For each bit set in fixed_bit_masks, what its value is. */
  1378. tilepro_sn_instruction_bits fixed_bit_values;
  1379. };
  1380. extern const struct tilepro_sn_opcode tilepro_sn_opcodes[];
  1381. #endif /* !__KERNEL__ && !_LIBC */
  1382. /* Used for non-textual disassembly into structs. */
  1383. struct tilepro_decoded_instruction
  1384. {
  1385. const struct tilepro_opcode *opcode;
  1386. const struct tilepro_operand *operands[TILEPRO_MAX_OPERANDS];
  1387. int operand_values[TILEPRO_MAX_OPERANDS];
  1388. };
  1389. /* Disassemble a bundle into a struct for machine processing. */
  1390. extern int parse_insn_tilepro(tilepro_bundle_bits bits,
  1391. unsigned int pc,
  1392. struct tilepro_decoded_instruction
  1393. decoded[TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE]);
  1394. /* Given a set of bundle bits and a specific pipe, returns which
  1395. * instruction the bundle contains in that pipe.
  1396. */
  1397. extern const struct tilepro_opcode *
  1398. find_opcode(tilepro_bundle_bits bits, tilepro_pipeline pipe);
  1399. #if !defined(__KERNEL__) && !defined(_LIBC)
  1400. /* Canonical names of all the registers. */
  1401. /* ISSUE: This table lives in "tilepro-dis.c" */
  1402. extern const char * const tilepro_register_names[];
  1403. /* Descriptor for a special-purpose register. */
  1404. struct tilepro_spr
  1405. {
  1406. /* The number */
  1407. int number;
  1408. /* The name */
  1409. const char *name;
  1410. };
  1411. /* List of all the SPRs; ordered by increasing number. */
  1412. extern const struct tilepro_spr tilepro_sprs[];
  1413. /* Number of special-purpose registers. */
  1414. extern const int tilepro_num_sprs;
  1415. extern const char *
  1416. get_tilepro_spr_name (int num);
  1417. #endif /* !__KERNEL__ && !_LIBC */
  1418. /* Make a few "tile_" variables to simply common code between
  1419. architectures. */
  1420. typedef tilepro_bundle_bits tile_bundle_bits;
  1421. #define TILE_BUNDLE_SIZE_IN_BYTES TILEPRO_BUNDLE_SIZE_IN_BYTES
  1422. #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES
  1423. #define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \
  1424. TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
  1425. #endif /* opcode_tilepro_h */