opcode-tile_64.h 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597
  1. /* tile.h -- Header file for TILE opcode table
  2. Copyright (C) 2005 Free Software Foundation, Inc.
  3. Contributed by Tilera Corp. */
  4. #ifndef opcode_tile_h
  5. #define opcode_tile_h
  6. typedef unsigned long long tile_bundle_bits;
  7. enum
  8. {
  9. TILE_MAX_OPERANDS = 5 /* mm */
  10. };
  11. typedef enum
  12. {
  13. TILE_OPC_BPT,
  14. TILE_OPC_INFO,
  15. TILE_OPC_INFOL,
  16. TILE_OPC_J,
  17. TILE_OPC_JAL,
  18. TILE_OPC_MOVE,
  19. TILE_OPC_MOVE_SN,
  20. TILE_OPC_MOVEI,
  21. TILE_OPC_MOVEI_SN,
  22. TILE_OPC_MOVELI,
  23. TILE_OPC_MOVELI_SN,
  24. TILE_OPC_MOVELIS,
  25. TILE_OPC_PREFETCH,
  26. TILE_OPC_ADD,
  27. TILE_OPC_ADD_SN,
  28. TILE_OPC_ADDB,
  29. TILE_OPC_ADDB_SN,
  30. TILE_OPC_ADDBS_U,
  31. TILE_OPC_ADDBS_U_SN,
  32. TILE_OPC_ADDH,
  33. TILE_OPC_ADDH_SN,
  34. TILE_OPC_ADDHS,
  35. TILE_OPC_ADDHS_SN,
  36. TILE_OPC_ADDI,
  37. TILE_OPC_ADDI_SN,
  38. TILE_OPC_ADDIB,
  39. TILE_OPC_ADDIB_SN,
  40. TILE_OPC_ADDIH,
  41. TILE_OPC_ADDIH_SN,
  42. TILE_OPC_ADDLI,
  43. TILE_OPC_ADDLI_SN,
  44. TILE_OPC_ADDLIS,
  45. TILE_OPC_ADDS,
  46. TILE_OPC_ADDS_SN,
  47. TILE_OPC_ADIFFB_U,
  48. TILE_OPC_ADIFFB_U_SN,
  49. TILE_OPC_ADIFFH,
  50. TILE_OPC_ADIFFH_SN,
  51. TILE_OPC_AND,
  52. TILE_OPC_AND_SN,
  53. TILE_OPC_ANDI,
  54. TILE_OPC_ANDI_SN,
  55. TILE_OPC_AULI,
  56. TILE_OPC_AVGB_U,
  57. TILE_OPC_AVGB_U_SN,
  58. TILE_OPC_AVGH,
  59. TILE_OPC_AVGH_SN,
  60. TILE_OPC_BBNS,
  61. TILE_OPC_BBNS_SN,
  62. TILE_OPC_BBNST,
  63. TILE_OPC_BBNST_SN,
  64. TILE_OPC_BBS,
  65. TILE_OPC_BBS_SN,
  66. TILE_OPC_BBST,
  67. TILE_OPC_BBST_SN,
  68. TILE_OPC_BGEZ,
  69. TILE_OPC_BGEZ_SN,
  70. TILE_OPC_BGEZT,
  71. TILE_OPC_BGEZT_SN,
  72. TILE_OPC_BGZ,
  73. TILE_OPC_BGZ_SN,
  74. TILE_OPC_BGZT,
  75. TILE_OPC_BGZT_SN,
  76. TILE_OPC_BITX,
  77. TILE_OPC_BITX_SN,
  78. TILE_OPC_BLEZ,
  79. TILE_OPC_BLEZ_SN,
  80. TILE_OPC_BLEZT,
  81. TILE_OPC_BLEZT_SN,
  82. TILE_OPC_BLZ,
  83. TILE_OPC_BLZ_SN,
  84. TILE_OPC_BLZT,
  85. TILE_OPC_BLZT_SN,
  86. TILE_OPC_BNZ,
  87. TILE_OPC_BNZ_SN,
  88. TILE_OPC_BNZT,
  89. TILE_OPC_BNZT_SN,
  90. TILE_OPC_BYTEX,
  91. TILE_OPC_BYTEX_SN,
  92. TILE_OPC_BZ,
  93. TILE_OPC_BZ_SN,
  94. TILE_OPC_BZT,
  95. TILE_OPC_BZT_SN,
  96. TILE_OPC_CLZ,
  97. TILE_OPC_CLZ_SN,
  98. TILE_OPC_CRC32_32,
  99. TILE_OPC_CRC32_32_SN,
  100. TILE_OPC_CRC32_8,
  101. TILE_OPC_CRC32_8_SN,
  102. TILE_OPC_CTZ,
  103. TILE_OPC_CTZ_SN,
  104. TILE_OPC_DRAIN,
  105. TILE_OPC_DTLBPR,
  106. TILE_OPC_DWORD_ALIGN,
  107. TILE_OPC_DWORD_ALIGN_SN,
  108. TILE_OPC_FINV,
  109. TILE_OPC_FLUSH,
  110. TILE_OPC_FNOP,
  111. TILE_OPC_ICOH,
  112. TILE_OPC_ILL,
  113. TILE_OPC_INTHB,
  114. TILE_OPC_INTHB_SN,
  115. TILE_OPC_INTHH,
  116. TILE_OPC_INTHH_SN,
  117. TILE_OPC_INTLB,
  118. TILE_OPC_INTLB_SN,
  119. TILE_OPC_INTLH,
  120. TILE_OPC_INTLH_SN,
  121. TILE_OPC_INV,
  122. TILE_OPC_IRET,
  123. TILE_OPC_JALB,
  124. TILE_OPC_JALF,
  125. TILE_OPC_JALR,
  126. TILE_OPC_JALRP,
  127. TILE_OPC_JB,
  128. TILE_OPC_JF,
  129. TILE_OPC_JR,
  130. TILE_OPC_JRP,
  131. TILE_OPC_LB,
  132. TILE_OPC_LB_SN,
  133. TILE_OPC_LB_U,
  134. TILE_OPC_LB_U_SN,
  135. TILE_OPC_LBADD,
  136. TILE_OPC_LBADD_SN,
  137. TILE_OPC_LBADD_U,
  138. TILE_OPC_LBADD_U_SN,
  139. TILE_OPC_LH,
  140. TILE_OPC_LH_SN,
  141. TILE_OPC_LH_U,
  142. TILE_OPC_LH_U_SN,
  143. TILE_OPC_LHADD,
  144. TILE_OPC_LHADD_SN,
  145. TILE_OPC_LHADD_U,
  146. TILE_OPC_LHADD_U_SN,
  147. TILE_OPC_LNK,
  148. TILE_OPC_LNK_SN,
  149. TILE_OPC_LW,
  150. TILE_OPC_LW_SN,
  151. TILE_OPC_LW_NA,
  152. TILE_OPC_LW_NA_SN,
  153. TILE_OPC_LWADD,
  154. TILE_OPC_LWADD_SN,
  155. TILE_OPC_LWADD_NA,
  156. TILE_OPC_LWADD_NA_SN,
  157. TILE_OPC_MAXB_U,
  158. TILE_OPC_MAXB_U_SN,
  159. TILE_OPC_MAXH,
  160. TILE_OPC_MAXH_SN,
  161. TILE_OPC_MAXIB_U,
  162. TILE_OPC_MAXIB_U_SN,
  163. TILE_OPC_MAXIH,
  164. TILE_OPC_MAXIH_SN,
  165. TILE_OPC_MF,
  166. TILE_OPC_MFSPR,
  167. TILE_OPC_MINB_U,
  168. TILE_OPC_MINB_U_SN,
  169. TILE_OPC_MINH,
  170. TILE_OPC_MINH_SN,
  171. TILE_OPC_MINIB_U,
  172. TILE_OPC_MINIB_U_SN,
  173. TILE_OPC_MINIH,
  174. TILE_OPC_MINIH_SN,
  175. TILE_OPC_MM,
  176. TILE_OPC_MNZ,
  177. TILE_OPC_MNZ_SN,
  178. TILE_OPC_MNZB,
  179. TILE_OPC_MNZB_SN,
  180. TILE_OPC_MNZH,
  181. TILE_OPC_MNZH_SN,
  182. TILE_OPC_MTSPR,
  183. TILE_OPC_MULHH_SS,
  184. TILE_OPC_MULHH_SS_SN,
  185. TILE_OPC_MULHH_SU,
  186. TILE_OPC_MULHH_SU_SN,
  187. TILE_OPC_MULHH_UU,
  188. TILE_OPC_MULHH_UU_SN,
  189. TILE_OPC_MULHHA_SS,
  190. TILE_OPC_MULHHA_SS_SN,
  191. TILE_OPC_MULHHA_SU,
  192. TILE_OPC_MULHHA_SU_SN,
  193. TILE_OPC_MULHHA_UU,
  194. TILE_OPC_MULHHA_UU_SN,
  195. TILE_OPC_MULHHSA_UU,
  196. TILE_OPC_MULHHSA_UU_SN,
  197. TILE_OPC_MULHL_SS,
  198. TILE_OPC_MULHL_SS_SN,
  199. TILE_OPC_MULHL_SU,
  200. TILE_OPC_MULHL_SU_SN,
  201. TILE_OPC_MULHL_US,
  202. TILE_OPC_MULHL_US_SN,
  203. TILE_OPC_MULHL_UU,
  204. TILE_OPC_MULHL_UU_SN,
  205. TILE_OPC_MULHLA_SS,
  206. TILE_OPC_MULHLA_SS_SN,
  207. TILE_OPC_MULHLA_SU,
  208. TILE_OPC_MULHLA_SU_SN,
  209. TILE_OPC_MULHLA_US,
  210. TILE_OPC_MULHLA_US_SN,
  211. TILE_OPC_MULHLA_UU,
  212. TILE_OPC_MULHLA_UU_SN,
  213. TILE_OPC_MULHLSA_UU,
  214. TILE_OPC_MULHLSA_UU_SN,
  215. TILE_OPC_MULLL_SS,
  216. TILE_OPC_MULLL_SS_SN,
  217. TILE_OPC_MULLL_SU,
  218. TILE_OPC_MULLL_SU_SN,
  219. TILE_OPC_MULLL_UU,
  220. TILE_OPC_MULLL_UU_SN,
  221. TILE_OPC_MULLLA_SS,
  222. TILE_OPC_MULLLA_SS_SN,
  223. TILE_OPC_MULLLA_SU,
  224. TILE_OPC_MULLLA_SU_SN,
  225. TILE_OPC_MULLLA_UU,
  226. TILE_OPC_MULLLA_UU_SN,
  227. TILE_OPC_MULLLSA_UU,
  228. TILE_OPC_MULLLSA_UU_SN,
  229. TILE_OPC_MVNZ,
  230. TILE_OPC_MVNZ_SN,
  231. TILE_OPC_MVZ,
  232. TILE_OPC_MVZ_SN,
  233. TILE_OPC_MZ,
  234. TILE_OPC_MZ_SN,
  235. TILE_OPC_MZB,
  236. TILE_OPC_MZB_SN,
  237. TILE_OPC_MZH,
  238. TILE_OPC_MZH_SN,
  239. TILE_OPC_NAP,
  240. TILE_OPC_NOP,
  241. TILE_OPC_NOR,
  242. TILE_OPC_NOR_SN,
  243. TILE_OPC_OR,
  244. TILE_OPC_OR_SN,
  245. TILE_OPC_ORI,
  246. TILE_OPC_ORI_SN,
  247. TILE_OPC_PACKBS_U,
  248. TILE_OPC_PACKBS_U_SN,
  249. TILE_OPC_PACKHB,
  250. TILE_OPC_PACKHB_SN,
  251. TILE_OPC_PACKHS,
  252. TILE_OPC_PACKHS_SN,
  253. TILE_OPC_PACKLB,
  254. TILE_OPC_PACKLB_SN,
  255. TILE_OPC_PCNT,
  256. TILE_OPC_PCNT_SN,
  257. TILE_OPC_RL,
  258. TILE_OPC_RL_SN,
  259. TILE_OPC_RLI,
  260. TILE_OPC_RLI_SN,
  261. TILE_OPC_S1A,
  262. TILE_OPC_S1A_SN,
  263. TILE_OPC_S2A,
  264. TILE_OPC_S2A_SN,
  265. TILE_OPC_S3A,
  266. TILE_OPC_S3A_SN,
  267. TILE_OPC_SADAB_U,
  268. TILE_OPC_SADAB_U_SN,
  269. TILE_OPC_SADAH,
  270. TILE_OPC_SADAH_SN,
  271. TILE_OPC_SADAH_U,
  272. TILE_OPC_SADAH_U_SN,
  273. TILE_OPC_SADB_U,
  274. TILE_OPC_SADB_U_SN,
  275. TILE_OPC_SADH,
  276. TILE_OPC_SADH_SN,
  277. TILE_OPC_SADH_U,
  278. TILE_OPC_SADH_U_SN,
  279. TILE_OPC_SB,
  280. TILE_OPC_SBADD,
  281. TILE_OPC_SEQ,
  282. TILE_OPC_SEQ_SN,
  283. TILE_OPC_SEQB,
  284. TILE_OPC_SEQB_SN,
  285. TILE_OPC_SEQH,
  286. TILE_OPC_SEQH_SN,
  287. TILE_OPC_SEQI,
  288. TILE_OPC_SEQI_SN,
  289. TILE_OPC_SEQIB,
  290. TILE_OPC_SEQIB_SN,
  291. TILE_OPC_SEQIH,
  292. TILE_OPC_SEQIH_SN,
  293. TILE_OPC_SH,
  294. TILE_OPC_SHADD,
  295. TILE_OPC_SHL,
  296. TILE_OPC_SHL_SN,
  297. TILE_OPC_SHLB,
  298. TILE_OPC_SHLB_SN,
  299. TILE_OPC_SHLH,
  300. TILE_OPC_SHLH_SN,
  301. TILE_OPC_SHLI,
  302. TILE_OPC_SHLI_SN,
  303. TILE_OPC_SHLIB,
  304. TILE_OPC_SHLIB_SN,
  305. TILE_OPC_SHLIH,
  306. TILE_OPC_SHLIH_SN,
  307. TILE_OPC_SHR,
  308. TILE_OPC_SHR_SN,
  309. TILE_OPC_SHRB,
  310. TILE_OPC_SHRB_SN,
  311. TILE_OPC_SHRH,
  312. TILE_OPC_SHRH_SN,
  313. TILE_OPC_SHRI,
  314. TILE_OPC_SHRI_SN,
  315. TILE_OPC_SHRIB,
  316. TILE_OPC_SHRIB_SN,
  317. TILE_OPC_SHRIH,
  318. TILE_OPC_SHRIH_SN,
  319. TILE_OPC_SLT,
  320. TILE_OPC_SLT_SN,
  321. TILE_OPC_SLT_U,
  322. TILE_OPC_SLT_U_SN,
  323. TILE_OPC_SLTB,
  324. TILE_OPC_SLTB_SN,
  325. TILE_OPC_SLTB_U,
  326. TILE_OPC_SLTB_U_SN,
  327. TILE_OPC_SLTE,
  328. TILE_OPC_SLTE_SN,
  329. TILE_OPC_SLTE_U,
  330. TILE_OPC_SLTE_U_SN,
  331. TILE_OPC_SLTEB,
  332. TILE_OPC_SLTEB_SN,
  333. TILE_OPC_SLTEB_U,
  334. TILE_OPC_SLTEB_U_SN,
  335. TILE_OPC_SLTEH,
  336. TILE_OPC_SLTEH_SN,
  337. TILE_OPC_SLTEH_U,
  338. TILE_OPC_SLTEH_U_SN,
  339. TILE_OPC_SLTH,
  340. TILE_OPC_SLTH_SN,
  341. TILE_OPC_SLTH_U,
  342. TILE_OPC_SLTH_U_SN,
  343. TILE_OPC_SLTI,
  344. TILE_OPC_SLTI_SN,
  345. TILE_OPC_SLTI_U,
  346. TILE_OPC_SLTI_U_SN,
  347. TILE_OPC_SLTIB,
  348. TILE_OPC_SLTIB_SN,
  349. TILE_OPC_SLTIB_U,
  350. TILE_OPC_SLTIB_U_SN,
  351. TILE_OPC_SLTIH,
  352. TILE_OPC_SLTIH_SN,
  353. TILE_OPC_SLTIH_U,
  354. TILE_OPC_SLTIH_U_SN,
  355. TILE_OPC_SNE,
  356. TILE_OPC_SNE_SN,
  357. TILE_OPC_SNEB,
  358. TILE_OPC_SNEB_SN,
  359. TILE_OPC_SNEH,
  360. TILE_OPC_SNEH_SN,
  361. TILE_OPC_SRA,
  362. TILE_OPC_SRA_SN,
  363. TILE_OPC_SRAB,
  364. TILE_OPC_SRAB_SN,
  365. TILE_OPC_SRAH,
  366. TILE_OPC_SRAH_SN,
  367. TILE_OPC_SRAI,
  368. TILE_OPC_SRAI_SN,
  369. TILE_OPC_SRAIB,
  370. TILE_OPC_SRAIB_SN,
  371. TILE_OPC_SRAIH,
  372. TILE_OPC_SRAIH_SN,
  373. TILE_OPC_SUB,
  374. TILE_OPC_SUB_SN,
  375. TILE_OPC_SUBB,
  376. TILE_OPC_SUBB_SN,
  377. TILE_OPC_SUBBS_U,
  378. TILE_OPC_SUBBS_U_SN,
  379. TILE_OPC_SUBH,
  380. TILE_OPC_SUBH_SN,
  381. TILE_OPC_SUBHS,
  382. TILE_OPC_SUBHS_SN,
  383. TILE_OPC_SUBS,
  384. TILE_OPC_SUBS_SN,
  385. TILE_OPC_SW,
  386. TILE_OPC_SWADD,
  387. TILE_OPC_SWINT0,
  388. TILE_OPC_SWINT1,
  389. TILE_OPC_SWINT2,
  390. TILE_OPC_SWINT3,
  391. TILE_OPC_TBLIDXB0,
  392. TILE_OPC_TBLIDXB0_SN,
  393. TILE_OPC_TBLIDXB1,
  394. TILE_OPC_TBLIDXB1_SN,
  395. TILE_OPC_TBLIDXB2,
  396. TILE_OPC_TBLIDXB2_SN,
  397. TILE_OPC_TBLIDXB3,
  398. TILE_OPC_TBLIDXB3_SN,
  399. TILE_OPC_TNS,
  400. TILE_OPC_TNS_SN,
  401. TILE_OPC_WH64,
  402. TILE_OPC_XOR,
  403. TILE_OPC_XOR_SN,
  404. TILE_OPC_XORI,
  405. TILE_OPC_XORI_SN,
  406. TILE_OPC_NONE
  407. } tile_mnemonic;
  408. /* 64-bit pattern for a { bpt ; nop } bundle. */
  409. #define TILE_BPT_BUNDLE 0x400b3cae70166000ULL
  410. #define TILE_ELF_MACHINE_CODE EM_TILEPRO
  411. #define TILE_ELF_NAME "elf32-tilepro"
  412. enum
  413. {
  414. TILE_SN_MAX_OPERANDS = 6 /* route */
  415. };
  416. typedef enum
  417. {
  418. TILE_SN_OPC_BZ,
  419. TILE_SN_OPC_BNZ,
  420. TILE_SN_OPC_JRR,
  421. TILE_SN_OPC_FNOP,
  422. TILE_SN_OPC_BLZ,
  423. TILE_SN_OPC_NOP,
  424. TILE_SN_OPC_MOVEI,
  425. TILE_SN_OPC_MOVE,
  426. TILE_SN_OPC_BGEZ,
  427. TILE_SN_OPC_JR,
  428. TILE_SN_OPC_BLEZ,
  429. TILE_SN_OPC_BBNS,
  430. TILE_SN_OPC_JALRR,
  431. TILE_SN_OPC_BPT,
  432. TILE_SN_OPC_JALR,
  433. TILE_SN_OPC_SHR1,
  434. TILE_SN_OPC_BGZ,
  435. TILE_SN_OPC_BBS,
  436. TILE_SN_OPC_SHL8II,
  437. TILE_SN_OPC_ADDI,
  438. TILE_SN_OPC_HALT,
  439. TILE_SN_OPC_ROUTE,
  440. TILE_SN_OPC_NONE
  441. } tile_sn_mnemonic;
  442. extern const unsigned char tile_sn_route_encode[6 * 6 * 6];
  443. extern const signed char tile_sn_route_decode[256][3];
  444. extern const char tile_sn_direction_names[6][5];
  445. extern const signed char tile_sn_dest_map[6][6];
  446. static __inline unsigned int
  447. get_BrOff_SN(tile_bundle_bits num)
  448. {
  449. const unsigned int n = (unsigned int)num;
  450. return (((n >> 0)) & 0x3ff);
  451. }
  452. static __inline unsigned int
  453. get_BrOff_X1(tile_bundle_bits n)
  454. {
  455. return (((unsigned int)(n >> 43)) & 0x00007fff) |
  456. (((unsigned int)(n >> 20)) & 0x00018000);
  457. }
  458. static __inline unsigned int
  459. get_BrType_X1(tile_bundle_bits n)
  460. {
  461. return (((unsigned int)(n >> 31)) & 0xf);
  462. }
  463. static __inline unsigned int
  464. get_Dest_Imm8_X1(tile_bundle_bits n)
  465. {
  466. return (((unsigned int)(n >> 31)) & 0x0000003f) |
  467. (((unsigned int)(n >> 43)) & 0x000000c0);
  468. }
  469. static __inline unsigned int
  470. get_Dest_SN(tile_bundle_bits num)
  471. {
  472. const unsigned int n = (unsigned int)num;
  473. return (((n >> 2)) & 0x3);
  474. }
  475. static __inline unsigned int
  476. get_Dest_X0(tile_bundle_bits num)
  477. {
  478. const unsigned int n = (unsigned int)num;
  479. return (((n >> 0)) & 0x3f);
  480. }
  481. static __inline unsigned int
  482. get_Dest_X1(tile_bundle_bits n)
  483. {
  484. return (((unsigned int)(n >> 31)) & 0x3f);
  485. }
  486. static __inline unsigned int
  487. get_Dest_Y0(tile_bundle_bits num)
  488. {
  489. const unsigned int n = (unsigned int)num;
  490. return (((n >> 0)) & 0x3f);
  491. }
  492. static __inline unsigned int
  493. get_Dest_Y1(tile_bundle_bits n)
  494. {
  495. return (((unsigned int)(n >> 31)) & 0x3f);
  496. }
  497. static __inline unsigned int
  498. get_Imm16_X0(tile_bundle_bits num)
  499. {
  500. const unsigned int n = (unsigned int)num;
  501. return (((n >> 12)) & 0xffff);
  502. }
  503. static __inline unsigned int
  504. get_Imm16_X1(tile_bundle_bits n)
  505. {
  506. return (((unsigned int)(n >> 43)) & 0xffff);
  507. }
  508. static __inline unsigned int
  509. get_Imm8_SN(tile_bundle_bits num)
  510. {
  511. const unsigned int n = (unsigned int)num;
  512. return (((n >> 0)) & 0xff);
  513. }
  514. static __inline unsigned int
  515. get_Imm8_X0(tile_bundle_bits num)
  516. {
  517. const unsigned int n = (unsigned int)num;
  518. return (((n >> 12)) & 0xff);
  519. }
  520. static __inline unsigned int
  521. get_Imm8_X1(tile_bundle_bits n)
  522. {
  523. return (((unsigned int)(n >> 43)) & 0xff);
  524. }
  525. static __inline unsigned int
  526. get_Imm8_Y0(tile_bundle_bits num)
  527. {
  528. const unsigned int n = (unsigned int)num;
  529. return (((n >> 12)) & 0xff);
  530. }
  531. static __inline unsigned int
  532. get_Imm8_Y1(tile_bundle_bits n)
  533. {
  534. return (((unsigned int)(n >> 43)) & 0xff);
  535. }
  536. static __inline unsigned int
  537. get_ImmOpcodeExtension_X0(tile_bundle_bits num)
  538. {
  539. const unsigned int n = (unsigned int)num;
  540. return (((n >> 20)) & 0x7f);
  541. }
  542. static __inline unsigned int
  543. get_ImmOpcodeExtension_X1(tile_bundle_bits n)
  544. {
  545. return (((unsigned int)(n >> 51)) & 0x7f);
  546. }
  547. static __inline unsigned int
  548. get_ImmRROpcodeExtension_SN(tile_bundle_bits num)
  549. {
  550. const unsigned int n = (unsigned int)num;
  551. return (((n >> 8)) & 0x3);
  552. }
  553. static __inline unsigned int
  554. get_JOffLong_X1(tile_bundle_bits n)
  555. {
  556. return (((unsigned int)(n >> 43)) & 0x00007fff) |
  557. (((unsigned int)(n >> 20)) & 0x00018000) |
  558. (((unsigned int)(n >> 14)) & 0x001e0000) |
  559. (((unsigned int)(n >> 16)) & 0x07e00000) |
  560. (((unsigned int)(n >> 31)) & 0x18000000);
  561. }
  562. static __inline unsigned int
  563. get_JOff_X1(tile_bundle_bits n)
  564. {
  565. return (((unsigned int)(n >> 43)) & 0x00007fff) |
  566. (((unsigned int)(n >> 20)) & 0x00018000) |
  567. (((unsigned int)(n >> 14)) & 0x001e0000) |
  568. (((unsigned int)(n >> 16)) & 0x07e00000) |
  569. (((unsigned int)(n >> 31)) & 0x08000000);
  570. }
  571. static __inline unsigned int
  572. get_MF_Imm15_X1(tile_bundle_bits n)
  573. {
  574. return (((unsigned int)(n >> 37)) & 0x00003fff) |
  575. (((unsigned int)(n >> 44)) & 0x00004000);
  576. }
  577. static __inline unsigned int
  578. get_MMEnd_X0(tile_bundle_bits num)
  579. {
  580. const unsigned int n = (unsigned int)num;
  581. return (((n >> 18)) & 0x1f);
  582. }
  583. static __inline unsigned int
  584. get_MMEnd_X1(tile_bundle_bits n)
  585. {
  586. return (((unsigned int)(n >> 49)) & 0x1f);
  587. }
  588. static __inline unsigned int
  589. get_MMStart_X0(tile_bundle_bits num)
  590. {
  591. const unsigned int n = (unsigned int)num;
  592. return (((n >> 23)) & 0x1f);
  593. }
  594. static __inline unsigned int
  595. get_MMStart_X1(tile_bundle_bits n)
  596. {
  597. return (((unsigned int)(n >> 54)) & 0x1f);
  598. }
  599. static __inline unsigned int
  600. get_MT_Imm15_X1(tile_bundle_bits n)
  601. {
  602. return (((unsigned int)(n >> 31)) & 0x0000003f) |
  603. (((unsigned int)(n >> 37)) & 0x00003fc0) |
  604. (((unsigned int)(n >> 44)) & 0x00004000);
  605. }
  606. static __inline unsigned int
  607. get_Mode(tile_bundle_bits n)
  608. {
  609. return (((unsigned int)(n >> 63)) & 0x1);
  610. }
  611. static __inline unsigned int
  612. get_NoRegOpcodeExtension_SN(tile_bundle_bits num)
  613. {
  614. const unsigned int n = (unsigned int)num;
  615. return (((n >> 0)) & 0xf);
  616. }
  617. static __inline unsigned int
  618. get_Opcode_SN(tile_bundle_bits num)
  619. {
  620. const unsigned int n = (unsigned int)num;
  621. return (((n >> 10)) & 0x3f);
  622. }
  623. static __inline unsigned int
  624. get_Opcode_X0(tile_bundle_bits num)
  625. {
  626. const unsigned int n = (unsigned int)num;
  627. return (((n >> 28)) & 0x7);
  628. }
  629. static __inline unsigned int
  630. get_Opcode_X1(tile_bundle_bits n)
  631. {
  632. return (((unsigned int)(n >> 59)) & 0xf);
  633. }
  634. static __inline unsigned int
  635. get_Opcode_Y0(tile_bundle_bits num)
  636. {
  637. const unsigned int n = (unsigned int)num;
  638. return (((n >> 27)) & 0xf);
  639. }
  640. static __inline unsigned int
  641. get_Opcode_Y1(tile_bundle_bits n)
  642. {
  643. return (((unsigned int)(n >> 59)) & 0xf);
  644. }
  645. static __inline unsigned int
  646. get_Opcode_Y2(tile_bundle_bits n)
  647. {
  648. return (((unsigned int)(n >> 56)) & 0x7);
  649. }
  650. static __inline unsigned int
  651. get_RROpcodeExtension_SN(tile_bundle_bits num)
  652. {
  653. const unsigned int n = (unsigned int)num;
  654. return (((n >> 4)) & 0xf);
  655. }
  656. static __inline unsigned int
  657. get_RRROpcodeExtension_X0(tile_bundle_bits num)
  658. {
  659. const unsigned int n = (unsigned int)num;
  660. return (((n >> 18)) & 0x1ff);
  661. }
  662. static __inline unsigned int
  663. get_RRROpcodeExtension_X1(tile_bundle_bits n)
  664. {
  665. return (((unsigned int)(n >> 49)) & 0x1ff);
  666. }
  667. static __inline unsigned int
  668. get_RRROpcodeExtension_Y0(tile_bundle_bits num)
  669. {
  670. const unsigned int n = (unsigned int)num;
  671. return (((n >> 18)) & 0x3);
  672. }
  673. static __inline unsigned int
  674. get_RRROpcodeExtension_Y1(tile_bundle_bits n)
  675. {
  676. return (((unsigned int)(n >> 49)) & 0x3);
  677. }
  678. static __inline unsigned int
  679. get_RouteOpcodeExtension_SN(tile_bundle_bits num)
  680. {
  681. const unsigned int n = (unsigned int)num;
  682. return (((n >> 0)) & 0x3ff);
  683. }
  684. static __inline unsigned int
  685. get_S_X0(tile_bundle_bits num)
  686. {
  687. const unsigned int n = (unsigned int)num;
  688. return (((n >> 27)) & 0x1);
  689. }
  690. static __inline unsigned int
  691. get_S_X1(tile_bundle_bits n)
  692. {
  693. return (((unsigned int)(n >> 58)) & 0x1);
  694. }
  695. static __inline unsigned int
  696. get_ShAmt_X0(tile_bundle_bits num)
  697. {
  698. const unsigned int n = (unsigned int)num;
  699. return (((n >> 12)) & 0x1f);
  700. }
  701. static __inline unsigned int
  702. get_ShAmt_X1(tile_bundle_bits n)
  703. {
  704. return (((unsigned int)(n >> 43)) & 0x1f);
  705. }
  706. static __inline unsigned int
  707. get_ShAmt_Y0(tile_bundle_bits num)
  708. {
  709. const unsigned int n = (unsigned int)num;
  710. return (((n >> 12)) & 0x1f);
  711. }
  712. static __inline unsigned int
  713. get_ShAmt_Y1(tile_bundle_bits n)
  714. {
  715. return (((unsigned int)(n >> 43)) & 0x1f);
  716. }
  717. static __inline unsigned int
  718. get_SrcA_X0(tile_bundle_bits num)
  719. {
  720. const unsigned int n = (unsigned int)num;
  721. return (((n >> 6)) & 0x3f);
  722. }
  723. static __inline unsigned int
  724. get_SrcA_X1(tile_bundle_bits n)
  725. {
  726. return (((unsigned int)(n >> 37)) & 0x3f);
  727. }
  728. static __inline unsigned int
  729. get_SrcA_Y0(tile_bundle_bits num)
  730. {
  731. const unsigned int n = (unsigned int)num;
  732. return (((n >> 6)) & 0x3f);
  733. }
  734. static __inline unsigned int
  735. get_SrcA_Y1(tile_bundle_bits n)
  736. {
  737. return (((unsigned int)(n >> 37)) & 0x3f);
  738. }
  739. static __inline unsigned int
  740. get_SrcA_Y2(tile_bundle_bits n)
  741. {
  742. return (((n >> 26)) & 0x00000001) |
  743. (((unsigned int)(n >> 50)) & 0x0000003e);
  744. }
  745. static __inline unsigned int
  746. get_SrcBDest_Y2(tile_bundle_bits num)
  747. {
  748. const unsigned int n = (unsigned int)num;
  749. return (((n >> 20)) & 0x3f);
  750. }
  751. static __inline unsigned int
  752. get_SrcB_X0(tile_bundle_bits num)
  753. {
  754. const unsigned int n = (unsigned int)num;
  755. return (((n >> 12)) & 0x3f);
  756. }
  757. static __inline unsigned int
  758. get_SrcB_X1(tile_bundle_bits n)
  759. {
  760. return (((unsigned int)(n >> 43)) & 0x3f);
  761. }
  762. static __inline unsigned int
  763. get_SrcB_Y0(tile_bundle_bits num)
  764. {
  765. const unsigned int n = (unsigned int)num;
  766. return (((n >> 12)) & 0x3f);
  767. }
  768. static __inline unsigned int
  769. get_SrcB_Y1(tile_bundle_bits n)
  770. {
  771. return (((unsigned int)(n >> 43)) & 0x3f);
  772. }
  773. static __inline unsigned int
  774. get_Src_SN(tile_bundle_bits num)
  775. {
  776. const unsigned int n = (unsigned int)num;
  777. return (((n >> 0)) & 0x3);
  778. }
  779. static __inline unsigned int
  780. get_UnOpcodeExtension_X0(tile_bundle_bits num)
  781. {
  782. const unsigned int n = (unsigned int)num;
  783. return (((n >> 12)) & 0x1f);
  784. }
  785. static __inline unsigned int
  786. get_UnOpcodeExtension_X1(tile_bundle_bits n)
  787. {
  788. return (((unsigned int)(n >> 43)) & 0x1f);
  789. }
  790. static __inline unsigned int
  791. get_UnOpcodeExtension_Y0(tile_bundle_bits num)
  792. {
  793. const unsigned int n = (unsigned int)num;
  794. return (((n >> 12)) & 0x1f);
  795. }
  796. static __inline unsigned int
  797. get_UnOpcodeExtension_Y1(tile_bundle_bits n)
  798. {
  799. return (((unsigned int)(n >> 43)) & 0x1f);
  800. }
  801. static __inline unsigned int
  802. get_UnShOpcodeExtension_X0(tile_bundle_bits num)
  803. {
  804. const unsigned int n = (unsigned int)num;
  805. return (((n >> 17)) & 0x3ff);
  806. }
  807. static __inline unsigned int
  808. get_UnShOpcodeExtension_X1(tile_bundle_bits n)
  809. {
  810. return (((unsigned int)(n >> 48)) & 0x3ff);
  811. }
  812. static __inline unsigned int
  813. get_UnShOpcodeExtension_Y0(tile_bundle_bits num)
  814. {
  815. const unsigned int n = (unsigned int)num;
  816. return (((n >> 17)) & 0x7);
  817. }
  818. static __inline unsigned int
  819. get_UnShOpcodeExtension_Y1(tile_bundle_bits n)
  820. {
  821. return (((unsigned int)(n >> 48)) & 0x7);
  822. }
  823. static __inline int
  824. sign_extend(int n, int num_bits)
  825. {
  826. int shift = (int)(sizeof(int) * 8 - num_bits);
  827. return (n << shift) >> shift;
  828. }
  829. static __inline tile_bundle_bits
  830. create_BrOff_SN(int num)
  831. {
  832. const unsigned int n = (unsigned int)num;
  833. return ((n & 0x3ff) << 0);
  834. }
  835. static __inline tile_bundle_bits
  836. create_BrOff_X1(int num)
  837. {
  838. const unsigned int n = (unsigned int)num;
  839. return (((tile_bundle_bits)(n & 0x00007fff)) << 43) |
  840. (((tile_bundle_bits)(n & 0x00018000)) << 20);
  841. }
  842. static __inline tile_bundle_bits
  843. create_BrType_X1(int num)
  844. {
  845. const unsigned int n = (unsigned int)num;
  846. return (((tile_bundle_bits)(n & 0xf)) << 31);
  847. }
  848. static __inline tile_bundle_bits
  849. create_Dest_Imm8_X1(int num)
  850. {
  851. const unsigned int n = (unsigned int)num;
  852. return (((tile_bundle_bits)(n & 0x0000003f)) << 31) |
  853. (((tile_bundle_bits)(n & 0x000000c0)) << 43);
  854. }
  855. static __inline tile_bundle_bits
  856. create_Dest_SN(int num)
  857. {
  858. const unsigned int n = (unsigned int)num;
  859. return ((n & 0x3) << 2);
  860. }
  861. static __inline tile_bundle_bits
  862. create_Dest_X0(int num)
  863. {
  864. const unsigned int n = (unsigned int)num;
  865. return ((n & 0x3f) << 0);
  866. }
  867. static __inline tile_bundle_bits
  868. create_Dest_X1(int num)
  869. {
  870. const unsigned int n = (unsigned int)num;
  871. return (((tile_bundle_bits)(n & 0x3f)) << 31);
  872. }
  873. static __inline tile_bundle_bits
  874. create_Dest_Y0(int num)
  875. {
  876. const unsigned int n = (unsigned int)num;
  877. return ((n & 0x3f) << 0);
  878. }
  879. static __inline tile_bundle_bits
  880. create_Dest_Y1(int num)
  881. {
  882. const unsigned int n = (unsigned int)num;
  883. return (((tile_bundle_bits)(n & 0x3f)) << 31);
  884. }
  885. static __inline tile_bundle_bits
  886. create_Imm16_X0(int num)
  887. {
  888. const unsigned int n = (unsigned int)num;
  889. return ((n & 0xffff) << 12);
  890. }
  891. static __inline tile_bundle_bits
  892. create_Imm16_X1(int num)
  893. {
  894. const unsigned int n = (unsigned int)num;
  895. return (((tile_bundle_bits)(n & 0xffff)) << 43);
  896. }
  897. static __inline tile_bundle_bits
  898. create_Imm8_SN(int num)
  899. {
  900. const unsigned int n = (unsigned int)num;
  901. return ((n & 0xff) << 0);
  902. }
  903. static __inline tile_bundle_bits
  904. create_Imm8_X0(int num)
  905. {
  906. const unsigned int n = (unsigned int)num;
  907. return ((n & 0xff) << 12);
  908. }
  909. static __inline tile_bundle_bits
  910. create_Imm8_X1(int num)
  911. {
  912. const unsigned int n = (unsigned int)num;
  913. return (((tile_bundle_bits)(n & 0xff)) << 43);
  914. }
  915. static __inline tile_bundle_bits
  916. create_Imm8_Y0(int num)
  917. {
  918. const unsigned int n = (unsigned int)num;
  919. return ((n & 0xff) << 12);
  920. }
  921. static __inline tile_bundle_bits
  922. create_Imm8_Y1(int num)
  923. {
  924. const unsigned int n = (unsigned int)num;
  925. return (((tile_bundle_bits)(n & 0xff)) << 43);
  926. }
  927. static __inline tile_bundle_bits
  928. create_ImmOpcodeExtension_X0(int num)
  929. {
  930. const unsigned int n = (unsigned int)num;
  931. return ((n & 0x7f) << 20);
  932. }
  933. static __inline tile_bundle_bits
  934. create_ImmOpcodeExtension_X1(int num)
  935. {
  936. const unsigned int n = (unsigned int)num;
  937. return (((tile_bundle_bits)(n & 0x7f)) << 51);
  938. }
  939. static __inline tile_bundle_bits
  940. create_ImmRROpcodeExtension_SN(int num)
  941. {
  942. const unsigned int n = (unsigned int)num;
  943. return ((n & 0x3) << 8);
  944. }
  945. static __inline tile_bundle_bits
  946. create_JOffLong_X1(int num)
  947. {
  948. const unsigned int n = (unsigned int)num;
  949. return (((tile_bundle_bits)(n & 0x00007fff)) << 43) |
  950. (((tile_bundle_bits)(n & 0x00018000)) << 20) |
  951. (((tile_bundle_bits)(n & 0x001e0000)) << 14) |
  952. (((tile_bundle_bits)(n & 0x07e00000)) << 16) |
  953. (((tile_bundle_bits)(n & 0x18000000)) << 31);
  954. }
  955. static __inline tile_bundle_bits
  956. create_JOff_X1(int num)
  957. {
  958. const unsigned int n = (unsigned int)num;
  959. return (((tile_bundle_bits)(n & 0x00007fff)) << 43) |
  960. (((tile_bundle_bits)(n & 0x00018000)) << 20) |
  961. (((tile_bundle_bits)(n & 0x001e0000)) << 14) |
  962. (((tile_bundle_bits)(n & 0x07e00000)) << 16) |
  963. (((tile_bundle_bits)(n & 0x08000000)) << 31);
  964. }
  965. static __inline tile_bundle_bits
  966. create_MF_Imm15_X1(int num)
  967. {
  968. const unsigned int n = (unsigned int)num;
  969. return (((tile_bundle_bits)(n & 0x00003fff)) << 37) |
  970. (((tile_bundle_bits)(n & 0x00004000)) << 44);
  971. }
  972. static __inline tile_bundle_bits
  973. create_MMEnd_X0(int num)
  974. {
  975. const unsigned int n = (unsigned int)num;
  976. return ((n & 0x1f) << 18);
  977. }
  978. static __inline tile_bundle_bits
  979. create_MMEnd_X1(int num)
  980. {
  981. const unsigned int n = (unsigned int)num;
  982. return (((tile_bundle_bits)(n & 0x1f)) << 49);
  983. }
  984. static __inline tile_bundle_bits
  985. create_MMStart_X0(int num)
  986. {
  987. const unsigned int n = (unsigned int)num;
  988. return ((n & 0x1f) << 23);
  989. }
  990. static __inline tile_bundle_bits
  991. create_MMStart_X1(int num)
  992. {
  993. const unsigned int n = (unsigned int)num;
  994. return (((tile_bundle_bits)(n & 0x1f)) << 54);
  995. }
  996. static __inline tile_bundle_bits
  997. create_MT_Imm15_X1(int num)
  998. {
  999. const unsigned int n = (unsigned int)num;
  1000. return (((tile_bundle_bits)(n & 0x0000003f)) << 31) |
  1001. (((tile_bundle_bits)(n & 0x00003fc0)) << 37) |
  1002. (((tile_bundle_bits)(n & 0x00004000)) << 44);
  1003. }
  1004. static __inline tile_bundle_bits
  1005. create_Mode(int num)
  1006. {
  1007. const unsigned int n = (unsigned int)num;
  1008. return (((tile_bundle_bits)(n & 0x1)) << 63);
  1009. }
  1010. static __inline tile_bundle_bits
  1011. create_NoRegOpcodeExtension_SN(int num)
  1012. {
  1013. const unsigned int n = (unsigned int)num;
  1014. return ((n & 0xf) << 0);
  1015. }
  1016. static __inline tile_bundle_bits
  1017. create_Opcode_SN(int num)
  1018. {
  1019. const unsigned int n = (unsigned int)num;
  1020. return ((n & 0x3f) << 10);
  1021. }
  1022. static __inline tile_bundle_bits
  1023. create_Opcode_X0(int num)
  1024. {
  1025. const unsigned int n = (unsigned int)num;
  1026. return ((n & 0x7) << 28);
  1027. }
  1028. static __inline tile_bundle_bits
  1029. create_Opcode_X1(int num)
  1030. {
  1031. const unsigned int n = (unsigned int)num;
  1032. return (((tile_bundle_bits)(n & 0xf)) << 59);
  1033. }
  1034. static __inline tile_bundle_bits
  1035. create_Opcode_Y0(int num)
  1036. {
  1037. const unsigned int n = (unsigned int)num;
  1038. return ((n & 0xf) << 27);
  1039. }
  1040. static __inline tile_bundle_bits
  1041. create_Opcode_Y1(int num)
  1042. {
  1043. const unsigned int n = (unsigned int)num;
  1044. return (((tile_bundle_bits)(n & 0xf)) << 59);
  1045. }
  1046. static __inline tile_bundle_bits
  1047. create_Opcode_Y2(int num)
  1048. {
  1049. const unsigned int n = (unsigned int)num;
  1050. return (((tile_bundle_bits)(n & 0x7)) << 56);
  1051. }
  1052. static __inline tile_bundle_bits
  1053. create_RROpcodeExtension_SN(int num)
  1054. {
  1055. const unsigned int n = (unsigned int)num;
  1056. return ((n & 0xf) << 4);
  1057. }
  1058. static __inline tile_bundle_bits
  1059. create_RRROpcodeExtension_X0(int num)
  1060. {
  1061. const unsigned int n = (unsigned int)num;
  1062. return ((n & 0x1ff) << 18);
  1063. }
  1064. static __inline tile_bundle_bits
  1065. create_RRROpcodeExtension_X1(int num)
  1066. {
  1067. const unsigned int n = (unsigned int)num;
  1068. return (((tile_bundle_bits)(n & 0x1ff)) << 49);
  1069. }
  1070. static __inline tile_bundle_bits
  1071. create_RRROpcodeExtension_Y0(int num)
  1072. {
  1073. const unsigned int n = (unsigned int)num;
  1074. return ((n & 0x3) << 18);
  1075. }
  1076. static __inline tile_bundle_bits
  1077. create_RRROpcodeExtension_Y1(int num)
  1078. {
  1079. const unsigned int n = (unsigned int)num;
  1080. return (((tile_bundle_bits)(n & 0x3)) << 49);
  1081. }
  1082. static __inline tile_bundle_bits
  1083. create_RouteOpcodeExtension_SN(int num)
  1084. {
  1085. const unsigned int n = (unsigned int)num;
  1086. return ((n & 0x3ff) << 0);
  1087. }
  1088. static __inline tile_bundle_bits
  1089. create_S_X0(int num)
  1090. {
  1091. const unsigned int n = (unsigned int)num;
  1092. return ((n & 0x1) << 27);
  1093. }
  1094. static __inline tile_bundle_bits
  1095. create_S_X1(int num)
  1096. {
  1097. const unsigned int n = (unsigned int)num;
  1098. return (((tile_bundle_bits)(n & 0x1)) << 58);
  1099. }
  1100. static __inline tile_bundle_bits
  1101. create_ShAmt_X0(int num)
  1102. {
  1103. const unsigned int n = (unsigned int)num;
  1104. return ((n & 0x1f) << 12);
  1105. }
  1106. static __inline tile_bundle_bits
  1107. create_ShAmt_X1(int num)
  1108. {
  1109. const unsigned int n = (unsigned int)num;
  1110. return (((tile_bundle_bits)(n & 0x1f)) << 43);
  1111. }
  1112. static __inline tile_bundle_bits
  1113. create_ShAmt_Y0(int num)
  1114. {
  1115. const unsigned int n = (unsigned int)num;
  1116. return ((n & 0x1f) << 12);
  1117. }
  1118. static __inline tile_bundle_bits
  1119. create_ShAmt_Y1(int num)
  1120. {
  1121. const unsigned int n = (unsigned int)num;
  1122. return (((tile_bundle_bits)(n & 0x1f)) << 43);
  1123. }
  1124. static __inline tile_bundle_bits
  1125. create_SrcA_X0(int num)
  1126. {
  1127. const unsigned int n = (unsigned int)num;
  1128. return ((n & 0x3f) << 6);
  1129. }
  1130. static __inline tile_bundle_bits
  1131. create_SrcA_X1(int num)
  1132. {
  1133. const unsigned int n = (unsigned int)num;
  1134. return (((tile_bundle_bits)(n & 0x3f)) << 37);
  1135. }
  1136. static __inline tile_bundle_bits
  1137. create_SrcA_Y0(int num)
  1138. {
  1139. const unsigned int n = (unsigned int)num;
  1140. return ((n & 0x3f) << 6);
  1141. }
  1142. static __inline tile_bundle_bits
  1143. create_SrcA_Y1(int num)
  1144. {
  1145. const unsigned int n = (unsigned int)num;
  1146. return (((tile_bundle_bits)(n & 0x3f)) << 37);
  1147. }
  1148. static __inline tile_bundle_bits
  1149. create_SrcA_Y2(int num)
  1150. {
  1151. const unsigned int n = (unsigned int)num;
  1152. return ((n & 0x00000001) << 26) |
  1153. (((tile_bundle_bits)(n & 0x0000003e)) << 50);
  1154. }
  1155. static __inline tile_bundle_bits
  1156. create_SrcBDest_Y2(int num)
  1157. {
  1158. const unsigned int n = (unsigned int)num;
  1159. return ((n & 0x3f) << 20);
  1160. }
  1161. static __inline tile_bundle_bits
  1162. create_SrcB_X0(int num)
  1163. {
  1164. const unsigned int n = (unsigned int)num;
  1165. return ((n & 0x3f) << 12);
  1166. }
  1167. static __inline tile_bundle_bits
  1168. create_SrcB_X1(int num)
  1169. {
  1170. const unsigned int n = (unsigned int)num;
  1171. return (((tile_bundle_bits)(n & 0x3f)) << 43);
  1172. }
  1173. static __inline tile_bundle_bits
  1174. create_SrcB_Y0(int num)
  1175. {
  1176. const unsigned int n = (unsigned int)num;
  1177. return ((n & 0x3f) << 12);
  1178. }
  1179. static __inline tile_bundle_bits
  1180. create_SrcB_Y1(int num)
  1181. {
  1182. const unsigned int n = (unsigned int)num;
  1183. return (((tile_bundle_bits)(n & 0x3f)) << 43);
  1184. }
  1185. static __inline tile_bundle_bits
  1186. create_Src_SN(int num)
  1187. {
  1188. const unsigned int n = (unsigned int)num;
  1189. return ((n & 0x3) << 0);
  1190. }
  1191. static __inline tile_bundle_bits
  1192. create_UnOpcodeExtension_X0(int num)
  1193. {
  1194. const unsigned int n = (unsigned int)num;
  1195. return ((n & 0x1f) << 12);
  1196. }
  1197. static __inline tile_bundle_bits
  1198. create_UnOpcodeExtension_X1(int num)
  1199. {
  1200. const unsigned int n = (unsigned int)num;
  1201. return (((tile_bundle_bits)(n & 0x1f)) << 43);
  1202. }
  1203. static __inline tile_bundle_bits
  1204. create_UnOpcodeExtension_Y0(int num)
  1205. {
  1206. const unsigned int n = (unsigned int)num;
  1207. return ((n & 0x1f) << 12);
  1208. }
  1209. static __inline tile_bundle_bits
  1210. create_UnOpcodeExtension_Y1(int num)
  1211. {
  1212. const unsigned int n = (unsigned int)num;
  1213. return (((tile_bundle_bits)(n & 0x1f)) << 43);
  1214. }
  1215. static __inline tile_bundle_bits
  1216. create_UnShOpcodeExtension_X0(int num)
  1217. {
  1218. const unsigned int n = (unsigned int)num;
  1219. return ((n & 0x3ff) << 17);
  1220. }
  1221. static __inline tile_bundle_bits
  1222. create_UnShOpcodeExtension_X1(int num)
  1223. {
  1224. const unsigned int n = (unsigned int)num;
  1225. return (((tile_bundle_bits)(n & 0x3ff)) << 48);
  1226. }
  1227. static __inline tile_bundle_bits
  1228. create_UnShOpcodeExtension_Y0(int num)
  1229. {
  1230. const unsigned int n = (unsigned int)num;
  1231. return ((n & 0x7) << 17);
  1232. }
  1233. static __inline tile_bundle_bits
  1234. create_UnShOpcodeExtension_Y1(int num)
  1235. {
  1236. const unsigned int n = (unsigned int)num;
  1237. return (((tile_bundle_bits)(n & 0x7)) << 48);
  1238. }
  1239. typedef unsigned short tile_sn_instruction_bits;
  1240. typedef enum
  1241. {
  1242. TILE_PIPELINE_X0,
  1243. TILE_PIPELINE_X1,
  1244. TILE_PIPELINE_Y0,
  1245. TILE_PIPELINE_Y1,
  1246. TILE_PIPELINE_Y2,
  1247. } tile_pipeline;
  1248. #define tile_is_x_pipeline(p) ((int)(p) <= (int)TILE_PIPELINE_X1)
  1249. typedef enum
  1250. {
  1251. TILE_OP_TYPE_REGISTER,
  1252. TILE_OP_TYPE_IMMEDIATE,
  1253. TILE_OP_TYPE_ADDRESS,
  1254. TILE_OP_TYPE_SPR
  1255. } tile_operand_type;
  1256. /* This is the bit that determines if a bundle is in the Y encoding. */
  1257. #define TILE_BUNDLE_Y_ENCODING_MASK ((tile_bundle_bits)1 << 63)
  1258. enum
  1259. {
  1260. /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
  1261. TILE_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
  1262. /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
  1263. TILE_NUM_PIPELINE_ENCODINGS = 5,
  1264. /* Log base 2 of TILE_BUNDLE_SIZE_IN_BYTES. */
  1265. TILE_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
  1266. /* Instructions take this many bytes. */
  1267. TILE_BUNDLE_SIZE_IN_BYTES = 1 << TILE_LOG2_BUNDLE_SIZE_IN_BYTES,
  1268. /* Log base 2 of TILE_BUNDLE_ALIGNMENT_IN_BYTES. */
  1269. TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
  1270. /* Bundles should be aligned modulo this number of bytes. */
  1271. TILE_BUNDLE_ALIGNMENT_IN_BYTES =
  1272. (1 << TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
  1273. /* Log base 2 of TILE_SN_INSTRUCTION_SIZE_IN_BYTES. */
  1274. TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES = 1,
  1275. /* Static network instructions take this many bytes. */
  1276. TILE_SN_INSTRUCTION_SIZE_IN_BYTES =
  1277. (1 << TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES),
  1278. /* Number of registers (some are magic, such as network I/O). */
  1279. TILE_NUM_REGISTERS = 64,
  1280. /* Number of static network registers. */
  1281. TILE_NUM_SN_REGISTERS = 4
  1282. };
  1283. struct tile_operand
  1284. {
  1285. /* Is this operand a register, immediate or address? */
  1286. tile_operand_type type;
  1287. /* The default relocation type for this operand. */
  1288. signed int default_reloc : 16;
  1289. /* How many bits is this value? (used for range checking) */
  1290. unsigned int num_bits : 5;
  1291. /* Is the value signed? (used for range checking) */
  1292. unsigned int is_signed : 1;
  1293. /* Is this operand a source register? */
  1294. unsigned int is_src_reg : 1;
  1295. /* Is this operand written? (i.e. is it a destination register) */
  1296. unsigned int is_dest_reg : 1;
  1297. /* Is this operand PC-relative? */
  1298. unsigned int is_pc_relative : 1;
  1299. /* By how many bits do we right shift the value before inserting? */
  1300. unsigned int rightshift : 2;
  1301. /* Return the bits for this operand to be ORed into an existing bundle. */
  1302. tile_bundle_bits (*insert) (int op);
  1303. /* Extract this operand and return it. */
  1304. unsigned int (*extract) (tile_bundle_bits bundle);
  1305. };
  1306. extern const struct tile_operand tile_operands[];
  1307. /* One finite-state machine per pipe for rapid instruction decoding. */
  1308. extern const unsigned short * const
  1309. tile_bundle_decoder_fsms[TILE_NUM_PIPELINE_ENCODINGS];
  1310. struct tile_opcode
  1311. {
  1312. /* The opcode mnemonic, e.g. "add" */
  1313. const char *name;
  1314. /* The enum value for this mnemonic. */
  1315. tile_mnemonic mnemonic;
  1316. /* A bit mask of which of the five pipes this instruction
  1317. is compatible with:
  1318. X0 0x01
  1319. X1 0x02
  1320. Y0 0x04
  1321. Y1 0x08
  1322. Y2 0x10 */
  1323. unsigned char pipes;
  1324. /* How many operands are there? */
  1325. unsigned char num_operands;
  1326. /* Which register does this write implicitly, or TREG_ZERO if none? */
  1327. unsigned char implicitly_written_register;
  1328. /* Can this be bundled with other instructions (almost always true). */
  1329. unsigned char can_bundle;
  1330. /* The description of the operands. Each of these is an
  1331. * index into the tile_operands[] table. */
  1332. unsigned char operands[TILE_NUM_PIPELINE_ENCODINGS][TILE_MAX_OPERANDS];
  1333. /* A mask of which bits have predefined values for each pipeline.
  1334. * This is useful for disassembly. */
  1335. tile_bundle_bits fixed_bit_masks[TILE_NUM_PIPELINE_ENCODINGS];
  1336. /* For each bit set in fixed_bit_masks, what the value is for this
  1337. * instruction. */
  1338. tile_bundle_bits fixed_bit_values[TILE_NUM_PIPELINE_ENCODINGS];
  1339. };
  1340. extern const struct tile_opcode tile_opcodes[];
  1341. struct tile_sn_opcode
  1342. {
  1343. /* The opcode mnemonic, e.g. "add" */
  1344. const char *name;
  1345. /* The enum value for this mnemonic. */
  1346. tile_sn_mnemonic mnemonic;
  1347. /* How many operands are there? */
  1348. unsigned char num_operands;
  1349. /* The description of the operands. Each of these is an
  1350. * index into the tile_operands[] table. */
  1351. unsigned char operands[TILE_SN_MAX_OPERANDS];
  1352. /* A mask of which bits have predefined values.
  1353. * This is useful for disassembly. */
  1354. tile_sn_instruction_bits fixed_bit_mask;
  1355. /* For each bit set in fixed_bit_masks, what its value is. */
  1356. tile_sn_instruction_bits fixed_bit_values;
  1357. };
  1358. extern const struct tile_sn_opcode tile_sn_opcodes[];
  1359. /* Used for non-textual disassembly into structs. */
  1360. struct tile_decoded_instruction
  1361. {
  1362. const struct tile_opcode *opcode;
  1363. const struct tile_operand *operands[TILE_MAX_OPERANDS];
  1364. int operand_values[TILE_MAX_OPERANDS];
  1365. };
  1366. /* Disassemble a bundle into a struct for machine processing. */
  1367. extern int parse_insn_tile(tile_bundle_bits bits,
  1368. unsigned int pc,
  1369. struct tile_decoded_instruction
  1370. decoded[TILE_MAX_INSTRUCTIONS_PER_BUNDLE]);
  1371. /* Canonical names of all the registers. */
  1372. /* ISSUE: This table lives in "tile-dis.c" */
  1373. extern const char * const tile_register_names[];
  1374. /* Descriptor for a special-purpose register. */
  1375. struct tile_spr
  1376. {
  1377. /* The number */
  1378. int number;
  1379. /* The name */
  1380. const char *name;
  1381. };
  1382. /* List of all the SPRs; ordered by increasing number. */
  1383. extern const struct tile_spr tile_sprs[];
  1384. /* Number of special-purpose registers. */
  1385. extern const int tile_num_sprs;
  1386. extern const char *
  1387. get_tile_spr_name (int num);
  1388. #endif /* opcode_tile_h */