opcode-tile_64.h 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249
  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 tilegx_bundle_bits;
  7. enum
  8. {
  9. TILEGX_MAX_OPERANDS = 4 /* bfexts */
  10. };
  11. typedef enum
  12. {
  13. TILEGX_OPC_BPT,
  14. TILEGX_OPC_INFO,
  15. TILEGX_OPC_INFOL,
  16. TILEGX_OPC_MOVE,
  17. TILEGX_OPC_MOVEI,
  18. TILEGX_OPC_MOVELI,
  19. TILEGX_OPC_PREFETCH,
  20. TILEGX_OPC_PREFETCH_ADD_L1,
  21. TILEGX_OPC_PREFETCH_ADD_L1_FAULT,
  22. TILEGX_OPC_PREFETCH_ADD_L2,
  23. TILEGX_OPC_PREFETCH_ADD_L2_FAULT,
  24. TILEGX_OPC_PREFETCH_ADD_L3,
  25. TILEGX_OPC_PREFETCH_ADD_L3_FAULT,
  26. TILEGX_OPC_PREFETCH_L1,
  27. TILEGX_OPC_PREFETCH_L1_FAULT,
  28. TILEGX_OPC_PREFETCH_L2,
  29. TILEGX_OPC_PREFETCH_L2_FAULT,
  30. TILEGX_OPC_PREFETCH_L3,
  31. TILEGX_OPC_PREFETCH_L3_FAULT,
  32. TILEGX_OPC_RAISE,
  33. TILEGX_OPC_ADD,
  34. TILEGX_OPC_ADDI,
  35. TILEGX_OPC_ADDLI,
  36. TILEGX_OPC_ADDX,
  37. TILEGX_OPC_ADDXI,
  38. TILEGX_OPC_ADDXLI,
  39. TILEGX_OPC_ADDXSC,
  40. TILEGX_OPC_AND,
  41. TILEGX_OPC_ANDI,
  42. TILEGX_OPC_BEQZ,
  43. TILEGX_OPC_BEQZT,
  44. TILEGX_OPC_BFEXTS,
  45. TILEGX_OPC_BFEXTU,
  46. TILEGX_OPC_BFINS,
  47. TILEGX_OPC_BGEZ,
  48. TILEGX_OPC_BGEZT,
  49. TILEGX_OPC_BGTZ,
  50. TILEGX_OPC_BGTZT,
  51. TILEGX_OPC_BLBC,
  52. TILEGX_OPC_BLBCT,
  53. TILEGX_OPC_BLBS,
  54. TILEGX_OPC_BLBST,
  55. TILEGX_OPC_BLEZ,
  56. TILEGX_OPC_BLEZT,
  57. TILEGX_OPC_BLTZ,
  58. TILEGX_OPC_BLTZT,
  59. TILEGX_OPC_BNEZ,
  60. TILEGX_OPC_BNEZT,
  61. TILEGX_OPC_CLZ,
  62. TILEGX_OPC_CMOVEQZ,
  63. TILEGX_OPC_CMOVNEZ,
  64. TILEGX_OPC_CMPEQ,
  65. TILEGX_OPC_CMPEQI,
  66. TILEGX_OPC_CMPEXCH,
  67. TILEGX_OPC_CMPEXCH4,
  68. TILEGX_OPC_CMPLES,
  69. TILEGX_OPC_CMPLEU,
  70. TILEGX_OPC_CMPLTS,
  71. TILEGX_OPC_CMPLTSI,
  72. TILEGX_OPC_CMPLTU,
  73. TILEGX_OPC_CMPLTUI,
  74. TILEGX_OPC_CMPNE,
  75. TILEGX_OPC_CMUL,
  76. TILEGX_OPC_CMULA,
  77. TILEGX_OPC_CMULAF,
  78. TILEGX_OPC_CMULF,
  79. TILEGX_OPC_CMULFR,
  80. TILEGX_OPC_CMULH,
  81. TILEGX_OPC_CMULHR,
  82. TILEGX_OPC_CRC32_32,
  83. TILEGX_OPC_CRC32_8,
  84. TILEGX_OPC_CTZ,
  85. TILEGX_OPC_DBLALIGN,
  86. TILEGX_OPC_DBLALIGN2,
  87. TILEGX_OPC_DBLALIGN4,
  88. TILEGX_OPC_DBLALIGN6,
  89. TILEGX_OPC_DRAIN,
  90. TILEGX_OPC_DTLBPR,
  91. TILEGX_OPC_EXCH,
  92. TILEGX_OPC_EXCH4,
  93. TILEGX_OPC_FDOUBLE_ADD_FLAGS,
  94. TILEGX_OPC_FDOUBLE_ADDSUB,
  95. TILEGX_OPC_FDOUBLE_MUL_FLAGS,
  96. TILEGX_OPC_FDOUBLE_PACK1,
  97. TILEGX_OPC_FDOUBLE_PACK2,
  98. TILEGX_OPC_FDOUBLE_SUB_FLAGS,
  99. TILEGX_OPC_FDOUBLE_UNPACK_MAX,
  100. TILEGX_OPC_FDOUBLE_UNPACK_MIN,
  101. TILEGX_OPC_FETCHADD,
  102. TILEGX_OPC_FETCHADD4,
  103. TILEGX_OPC_FETCHADDGEZ,
  104. TILEGX_OPC_FETCHADDGEZ4,
  105. TILEGX_OPC_FETCHAND,
  106. TILEGX_OPC_FETCHAND4,
  107. TILEGX_OPC_FETCHOR,
  108. TILEGX_OPC_FETCHOR4,
  109. TILEGX_OPC_FINV,
  110. TILEGX_OPC_FLUSH,
  111. TILEGX_OPC_FLUSHWB,
  112. TILEGX_OPC_FNOP,
  113. TILEGX_OPC_FSINGLE_ADD1,
  114. TILEGX_OPC_FSINGLE_ADDSUB2,
  115. TILEGX_OPC_FSINGLE_MUL1,
  116. TILEGX_OPC_FSINGLE_MUL2,
  117. TILEGX_OPC_FSINGLE_PACK1,
  118. TILEGX_OPC_FSINGLE_PACK2,
  119. TILEGX_OPC_FSINGLE_SUB1,
  120. TILEGX_OPC_ICOH,
  121. TILEGX_OPC_ILL,
  122. TILEGX_OPC_INV,
  123. TILEGX_OPC_IRET,
  124. TILEGX_OPC_J,
  125. TILEGX_OPC_JAL,
  126. TILEGX_OPC_JALR,
  127. TILEGX_OPC_JALRP,
  128. TILEGX_OPC_JR,
  129. TILEGX_OPC_JRP,
  130. TILEGX_OPC_LD,
  131. TILEGX_OPC_LD1S,
  132. TILEGX_OPC_LD1S_ADD,
  133. TILEGX_OPC_LD1U,
  134. TILEGX_OPC_LD1U_ADD,
  135. TILEGX_OPC_LD2S,
  136. TILEGX_OPC_LD2S_ADD,
  137. TILEGX_OPC_LD2U,
  138. TILEGX_OPC_LD2U_ADD,
  139. TILEGX_OPC_LD4S,
  140. TILEGX_OPC_LD4S_ADD,
  141. TILEGX_OPC_LD4U,
  142. TILEGX_OPC_LD4U_ADD,
  143. TILEGX_OPC_LD_ADD,
  144. TILEGX_OPC_LDNA,
  145. TILEGX_OPC_LDNA_ADD,
  146. TILEGX_OPC_LDNT,
  147. TILEGX_OPC_LDNT1S,
  148. TILEGX_OPC_LDNT1S_ADD,
  149. TILEGX_OPC_LDNT1U,
  150. TILEGX_OPC_LDNT1U_ADD,
  151. TILEGX_OPC_LDNT2S,
  152. TILEGX_OPC_LDNT2S_ADD,
  153. TILEGX_OPC_LDNT2U,
  154. TILEGX_OPC_LDNT2U_ADD,
  155. TILEGX_OPC_LDNT4S,
  156. TILEGX_OPC_LDNT4S_ADD,
  157. TILEGX_OPC_LDNT4U,
  158. TILEGX_OPC_LDNT4U_ADD,
  159. TILEGX_OPC_LDNT_ADD,
  160. TILEGX_OPC_LNK,
  161. TILEGX_OPC_MF,
  162. TILEGX_OPC_MFSPR,
  163. TILEGX_OPC_MM,
  164. TILEGX_OPC_MNZ,
  165. TILEGX_OPC_MTSPR,
  166. TILEGX_OPC_MUL_HS_HS,
  167. TILEGX_OPC_MUL_HS_HU,
  168. TILEGX_OPC_MUL_HS_LS,
  169. TILEGX_OPC_MUL_HS_LU,
  170. TILEGX_OPC_MUL_HU_HU,
  171. TILEGX_OPC_MUL_HU_LS,
  172. TILEGX_OPC_MUL_HU_LU,
  173. TILEGX_OPC_MUL_LS_LS,
  174. TILEGX_OPC_MUL_LS_LU,
  175. TILEGX_OPC_MUL_LU_LU,
  176. TILEGX_OPC_MULA_HS_HS,
  177. TILEGX_OPC_MULA_HS_HU,
  178. TILEGX_OPC_MULA_HS_LS,
  179. TILEGX_OPC_MULA_HS_LU,
  180. TILEGX_OPC_MULA_HU_HU,
  181. TILEGX_OPC_MULA_HU_LS,
  182. TILEGX_OPC_MULA_HU_LU,
  183. TILEGX_OPC_MULA_LS_LS,
  184. TILEGX_OPC_MULA_LS_LU,
  185. TILEGX_OPC_MULA_LU_LU,
  186. TILEGX_OPC_MULAX,
  187. TILEGX_OPC_MULX,
  188. TILEGX_OPC_MZ,
  189. TILEGX_OPC_NAP,
  190. TILEGX_OPC_NOP,
  191. TILEGX_OPC_NOR,
  192. TILEGX_OPC_OR,
  193. TILEGX_OPC_ORI,
  194. TILEGX_OPC_PCNT,
  195. TILEGX_OPC_REVBITS,
  196. TILEGX_OPC_REVBYTES,
  197. TILEGX_OPC_ROTL,
  198. TILEGX_OPC_ROTLI,
  199. TILEGX_OPC_SHL,
  200. TILEGX_OPC_SHL16INSLI,
  201. TILEGX_OPC_SHL1ADD,
  202. TILEGX_OPC_SHL1ADDX,
  203. TILEGX_OPC_SHL2ADD,
  204. TILEGX_OPC_SHL2ADDX,
  205. TILEGX_OPC_SHL3ADD,
  206. TILEGX_OPC_SHL3ADDX,
  207. TILEGX_OPC_SHLI,
  208. TILEGX_OPC_SHLX,
  209. TILEGX_OPC_SHLXI,
  210. TILEGX_OPC_SHRS,
  211. TILEGX_OPC_SHRSI,
  212. TILEGX_OPC_SHRU,
  213. TILEGX_OPC_SHRUI,
  214. TILEGX_OPC_SHRUX,
  215. TILEGX_OPC_SHRUXI,
  216. TILEGX_OPC_SHUFFLEBYTES,
  217. TILEGX_OPC_ST,
  218. TILEGX_OPC_ST1,
  219. TILEGX_OPC_ST1_ADD,
  220. TILEGX_OPC_ST2,
  221. TILEGX_OPC_ST2_ADD,
  222. TILEGX_OPC_ST4,
  223. TILEGX_OPC_ST4_ADD,
  224. TILEGX_OPC_ST_ADD,
  225. TILEGX_OPC_STNT,
  226. TILEGX_OPC_STNT1,
  227. TILEGX_OPC_STNT1_ADD,
  228. TILEGX_OPC_STNT2,
  229. TILEGX_OPC_STNT2_ADD,
  230. TILEGX_OPC_STNT4,
  231. TILEGX_OPC_STNT4_ADD,
  232. TILEGX_OPC_STNT_ADD,
  233. TILEGX_OPC_SUB,
  234. TILEGX_OPC_SUBX,
  235. TILEGX_OPC_SUBXSC,
  236. TILEGX_OPC_SWINT0,
  237. TILEGX_OPC_SWINT1,
  238. TILEGX_OPC_SWINT2,
  239. TILEGX_OPC_SWINT3,
  240. TILEGX_OPC_TBLIDXB0,
  241. TILEGX_OPC_TBLIDXB1,
  242. TILEGX_OPC_TBLIDXB2,
  243. TILEGX_OPC_TBLIDXB3,
  244. TILEGX_OPC_V1ADD,
  245. TILEGX_OPC_V1ADDI,
  246. TILEGX_OPC_V1ADDUC,
  247. TILEGX_OPC_V1ADIFFU,
  248. TILEGX_OPC_V1AVGU,
  249. TILEGX_OPC_V1CMPEQ,
  250. TILEGX_OPC_V1CMPEQI,
  251. TILEGX_OPC_V1CMPLES,
  252. TILEGX_OPC_V1CMPLEU,
  253. TILEGX_OPC_V1CMPLTS,
  254. TILEGX_OPC_V1CMPLTSI,
  255. TILEGX_OPC_V1CMPLTU,
  256. TILEGX_OPC_V1CMPLTUI,
  257. TILEGX_OPC_V1CMPNE,
  258. TILEGX_OPC_V1DDOTPU,
  259. TILEGX_OPC_V1DDOTPUA,
  260. TILEGX_OPC_V1DDOTPUS,
  261. TILEGX_OPC_V1DDOTPUSA,
  262. TILEGX_OPC_V1DOTP,
  263. TILEGX_OPC_V1DOTPA,
  264. TILEGX_OPC_V1DOTPU,
  265. TILEGX_OPC_V1DOTPUA,
  266. TILEGX_OPC_V1DOTPUS,
  267. TILEGX_OPC_V1DOTPUSA,
  268. TILEGX_OPC_V1INT_H,
  269. TILEGX_OPC_V1INT_L,
  270. TILEGX_OPC_V1MAXU,
  271. TILEGX_OPC_V1MAXUI,
  272. TILEGX_OPC_V1MINU,
  273. TILEGX_OPC_V1MINUI,
  274. TILEGX_OPC_V1MNZ,
  275. TILEGX_OPC_V1MULTU,
  276. TILEGX_OPC_V1MULU,
  277. TILEGX_OPC_V1MULUS,
  278. TILEGX_OPC_V1MZ,
  279. TILEGX_OPC_V1SADAU,
  280. TILEGX_OPC_V1SADU,
  281. TILEGX_OPC_V1SHL,
  282. TILEGX_OPC_V1SHLI,
  283. TILEGX_OPC_V1SHRS,
  284. TILEGX_OPC_V1SHRSI,
  285. TILEGX_OPC_V1SHRU,
  286. TILEGX_OPC_V1SHRUI,
  287. TILEGX_OPC_V1SUB,
  288. TILEGX_OPC_V1SUBUC,
  289. TILEGX_OPC_V2ADD,
  290. TILEGX_OPC_V2ADDI,
  291. TILEGX_OPC_V2ADDSC,
  292. TILEGX_OPC_V2ADIFFS,
  293. TILEGX_OPC_V2AVGS,
  294. TILEGX_OPC_V2CMPEQ,
  295. TILEGX_OPC_V2CMPEQI,
  296. TILEGX_OPC_V2CMPLES,
  297. TILEGX_OPC_V2CMPLEU,
  298. TILEGX_OPC_V2CMPLTS,
  299. TILEGX_OPC_V2CMPLTSI,
  300. TILEGX_OPC_V2CMPLTU,
  301. TILEGX_OPC_V2CMPLTUI,
  302. TILEGX_OPC_V2CMPNE,
  303. TILEGX_OPC_V2DOTP,
  304. TILEGX_OPC_V2DOTPA,
  305. TILEGX_OPC_V2INT_H,
  306. TILEGX_OPC_V2INT_L,
  307. TILEGX_OPC_V2MAXS,
  308. TILEGX_OPC_V2MAXSI,
  309. TILEGX_OPC_V2MINS,
  310. TILEGX_OPC_V2MINSI,
  311. TILEGX_OPC_V2MNZ,
  312. TILEGX_OPC_V2MULFSC,
  313. TILEGX_OPC_V2MULS,
  314. TILEGX_OPC_V2MULTS,
  315. TILEGX_OPC_V2MZ,
  316. TILEGX_OPC_V2PACKH,
  317. TILEGX_OPC_V2PACKL,
  318. TILEGX_OPC_V2PACKUC,
  319. TILEGX_OPC_V2SADAS,
  320. TILEGX_OPC_V2SADAU,
  321. TILEGX_OPC_V2SADS,
  322. TILEGX_OPC_V2SADU,
  323. TILEGX_OPC_V2SHL,
  324. TILEGX_OPC_V2SHLI,
  325. TILEGX_OPC_V2SHLSC,
  326. TILEGX_OPC_V2SHRS,
  327. TILEGX_OPC_V2SHRSI,
  328. TILEGX_OPC_V2SHRU,
  329. TILEGX_OPC_V2SHRUI,
  330. TILEGX_OPC_V2SUB,
  331. TILEGX_OPC_V2SUBSC,
  332. TILEGX_OPC_V4ADD,
  333. TILEGX_OPC_V4ADDSC,
  334. TILEGX_OPC_V4INT_H,
  335. TILEGX_OPC_V4INT_L,
  336. TILEGX_OPC_V4PACKSC,
  337. TILEGX_OPC_V4SHL,
  338. TILEGX_OPC_V4SHLSC,
  339. TILEGX_OPC_V4SHRS,
  340. TILEGX_OPC_V4SHRU,
  341. TILEGX_OPC_V4SUB,
  342. TILEGX_OPC_V4SUBSC,
  343. TILEGX_OPC_WH64,
  344. TILEGX_OPC_XOR,
  345. TILEGX_OPC_XORI,
  346. TILEGX_OPC_NONE
  347. } tilegx_mnemonic;
  348. /* 64-bit pattern for a { bpt ; nop } bundle. */
  349. #define TILEGX_BPT_BUNDLE 0x286a44ae51485000ULL
  350. #define TILE_ELF_MACHINE_CODE EM_TILE64
  351. #define TILE_ELF_NAME "elf32-tile64"
  352. static __inline unsigned int
  353. get_BFEnd_X0(tilegx_bundle_bits num)
  354. {
  355. const unsigned int n = (unsigned int)num;
  356. return (((n >> 12)) & 0x3f);
  357. }
  358. static __inline unsigned int
  359. get_BFOpcodeExtension_X0(tilegx_bundle_bits num)
  360. {
  361. const unsigned int n = (unsigned int)num;
  362. return (((n >> 24)) & 0xf);
  363. }
  364. static __inline unsigned int
  365. get_BFStart_X0(tilegx_bundle_bits num)
  366. {
  367. const unsigned int n = (unsigned int)num;
  368. return (((n >> 18)) & 0x3f);
  369. }
  370. static __inline unsigned int
  371. get_BrOff_X1(tilegx_bundle_bits n)
  372. {
  373. return (((unsigned int)(n >> 31)) & 0x0000003f) |
  374. (((unsigned int)(n >> 37)) & 0x0001ffc0);
  375. }
  376. static __inline unsigned int
  377. get_BrType_X1(tilegx_bundle_bits n)
  378. {
  379. return (((unsigned int)(n >> 54)) & 0x1f);
  380. }
  381. static __inline unsigned int
  382. get_Dest_Imm8_X1(tilegx_bundle_bits n)
  383. {
  384. return (((unsigned int)(n >> 31)) & 0x0000003f) |
  385. (((unsigned int)(n >> 43)) & 0x000000c0);
  386. }
  387. static __inline unsigned int
  388. get_Dest_X0(tilegx_bundle_bits num)
  389. {
  390. const unsigned int n = (unsigned int)num;
  391. return (((n >> 0)) & 0x3f);
  392. }
  393. static __inline unsigned int
  394. get_Dest_X1(tilegx_bundle_bits n)
  395. {
  396. return (((unsigned int)(n >> 31)) & 0x3f);
  397. }
  398. static __inline unsigned int
  399. get_Dest_Y0(tilegx_bundle_bits num)
  400. {
  401. const unsigned int n = (unsigned int)num;
  402. return (((n >> 0)) & 0x3f);
  403. }
  404. static __inline unsigned int
  405. get_Dest_Y1(tilegx_bundle_bits n)
  406. {
  407. return (((unsigned int)(n >> 31)) & 0x3f);
  408. }
  409. static __inline unsigned int
  410. get_Imm16_X0(tilegx_bundle_bits num)
  411. {
  412. const unsigned int n = (unsigned int)num;
  413. return (((n >> 12)) & 0xffff);
  414. }
  415. static __inline unsigned int
  416. get_Imm16_X1(tilegx_bundle_bits n)
  417. {
  418. return (((unsigned int)(n >> 43)) & 0xffff);
  419. }
  420. static __inline unsigned int
  421. get_Imm8OpcodeExtension_X0(tilegx_bundle_bits num)
  422. {
  423. const unsigned int n = (unsigned int)num;
  424. return (((n >> 20)) & 0xff);
  425. }
  426. static __inline unsigned int
  427. get_Imm8OpcodeExtension_X1(tilegx_bundle_bits n)
  428. {
  429. return (((unsigned int)(n >> 51)) & 0xff);
  430. }
  431. static __inline unsigned int
  432. get_Imm8_X0(tilegx_bundle_bits num)
  433. {
  434. const unsigned int n = (unsigned int)num;
  435. return (((n >> 12)) & 0xff);
  436. }
  437. static __inline unsigned int
  438. get_Imm8_X1(tilegx_bundle_bits n)
  439. {
  440. return (((unsigned int)(n >> 43)) & 0xff);
  441. }
  442. static __inline unsigned int
  443. get_Imm8_Y0(tilegx_bundle_bits num)
  444. {
  445. const unsigned int n = (unsigned int)num;
  446. return (((n >> 12)) & 0xff);
  447. }
  448. static __inline unsigned int
  449. get_Imm8_Y1(tilegx_bundle_bits n)
  450. {
  451. return (((unsigned int)(n >> 43)) & 0xff);
  452. }
  453. static __inline unsigned int
  454. get_JumpOff_X1(tilegx_bundle_bits n)
  455. {
  456. return (((unsigned int)(n >> 31)) & 0x7ffffff);
  457. }
  458. static __inline unsigned int
  459. get_JumpOpcodeExtension_X1(tilegx_bundle_bits n)
  460. {
  461. return (((unsigned int)(n >> 58)) & 0x1);
  462. }
  463. static __inline unsigned int
  464. get_MF_Imm14_X1(tilegx_bundle_bits n)
  465. {
  466. return (((unsigned int)(n >> 37)) & 0x3fff);
  467. }
  468. static __inline unsigned int
  469. get_MT_Imm14_X1(tilegx_bundle_bits n)
  470. {
  471. return (((unsigned int)(n >> 31)) & 0x0000003f) |
  472. (((unsigned int)(n >> 37)) & 0x00003fc0);
  473. }
  474. static __inline unsigned int
  475. get_Mode(tilegx_bundle_bits n)
  476. {
  477. return (((unsigned int)(n >> 62)) & 0x3);
  478. }
  479. static __inline unsigned int
  480. get_Opcode_X0(tilegx_bundle_bits num)
  481. {
  482. const unsigned int n = (unsigned int)num;
  483. return (((n >> 28)) & 0x7);
  484. }
  485. static __inline unsigned int
  486. get_Opcode_X1(tilegx_bundle_bits n)
  487. {
  488. return (((unsigned int)(n >> 59)) & 0x7);
  489. }
  490. static __inline unsigned int
  491. get_Opcode_Y0(tilegx_bundle_bits num)
  492. {
  493. const unsigned int n = (unsigned int)num;
  494. return (((n >> 27)) & 0xf);
  495. }
  496. static __inline unsigned int
  497. get_Opcode_Y1(tilegx_bundle_bits n)
  498. {
  499. return (((unsigned int)(n >> 58)) & 0xf);
  500. }
  501. static __inline unsigned int
  502. get_Opcode_Y2(tilegx_bundle_bits n)
  503. {
  504. return (((n >> 26)) & 0x00000001) |
  505. (((unsigned int)(n >> 56)) & 0x00000002);
  506. }
  507. static __inline unsigned int
  508. get_RRROpcodeExtension_X0(tilegx_bundle_bits num)
  509. {
  510. const unsigned int n = (unsigned int)num;
  511. return (((n >> 18)) & 0x3ff);
  512. }
  513. static __inline unsigned int
  514. get_RRROpcodeExtension_X1(tilegx_bundle_bits n)
  515. {
  516. return (((unsigned int)(n >> 49)) & 0x3ff);
  517. }
  518. static __inline unsigned int
  519. get_RRROpcodeExtension_Y0(tilegx_bundle_bits num)
  520. {
  521. const unsigned int n = (unsigned int)num;
  522. return (((n >> 18)) & 0x3);
  523. }
  524. static __inline unsigned int
  525. get_RRROpcodeExtension_Y1(tilegx_bundle_bits n)
  526. {
  527. return (((unsigned int)(n >> 49)) & 0x3);
  528. }
  529. static __inline unsigned int
  530. get_ShAmt_X0(tilegx_bundle_bits num)
  531. {
  532. const unsigned int n = (unsigned int)num;
  533. return (((n >> 12)) & 0x3f);
  534. }
  535. static __inline unsigned int
  536. get_ShAmt_X1(tilegx_bundle_bits n)
  537. {
  538. return (((unsigned int)(n >> 43)) & 0x3f);
  539. }
  540. static __inline unsigned int
  541. get_ShAmt_Y0(tilegx_bundle_bits num)
  542. {
  543. const unsigned int n = (unsigned int)num;
  544. return (((n >> 12)) & 0x3f);
  545. }
  546. static __inline unsigned int
  547. get_ShAmt_Y1(tilegx_bundle_bits n)
  548. {
  549. return (((unsigned int)(n >> 43)) & 0x3f);
  550. }
  551. static __inline unsigned int
  552. get_ShiftOpcodeExtension_X0(tilegx_bundle_bits num)
  553. {
  554. const unsigned int n = (unsigned int)num;
  555. return (((n >> 18)) & 0x3ff);
  556. }
  557. static __inline unsigned int
  558. get_ShiftOpcodeExtension_X1(tilegx_bundle_bits n)
  559. {
  560. return (((unsigned int)(n >> 49)) & 0x3ff);
  561. }
  562. static __inline unsigned int
  563. get_ShiftOpcodeExtension_Y0(tilegx_bundle_bits num)
  564. {
  565. const unsigned int n = (unsigned int)num;
  566. return (((n >> 18)) & 0x3);
  567. }
  568. static __inline unsigned int
  569. get_ShiftOpcodeExtension_Y1(tilegx_bundle_bits n)
  570. {
  571. return (((unsigned int)(n >> 49)) & 0x3);
  572. }
  573. static __inline unsigned int
  574. get_SrcA_X0(tilegx_bundle_bits num)
  575. {
  576. const unsigned int n = (unsigned int)num;
  577. return (((n >> 6)) & 0x3f);
  578. }
  579. static __inline unsigned int
  580. get_SrcA_X1(tilegx_bundle_bits n)
  581. {
  582. return (((unsigned int)(n >> 37)) & 0x3f);
  583. }
  584. static __inline unsigned int
  585. get_SrcA_Y0(tilegx_bundle_bits num)
  586. {
  587. const unsigned int n = (unsigned int)num;
  588. return (((n >> 6)) & 0x3f);
  589. }
  590. static __inline unsigned int
  591. get_SrcA_Y1(tilegx_bundle_bits n)
  592. {
  593. return (((unsigned int)(n >> 37)) & 0x3f);
  594. }
  595. static __inline unsigned int
  596. get_SrcA_Y2(tilegx_bundle_bits num)
  597. {
  598. const unsigned int n = (unsigned int)num;
  599. return (((n >> 20)) & 0x3f);
  600. }
  601. static __inline unsigned int
  602. get_SrcBDest_Y2(tilegx_bundle_bits n)
  603. {
  604. return (((unsigned int)(n >> 51)) & 0x3f);
  605. }
  606. static __inline unsigned int
  607. get_SrcB_X0(tilegx_bundle_bits num)
  608. {
  609. const unsigned int n = (unsigned int)num;
  610. return (((n >> 12)) & 0x3f);
  611. }
  612. static __inline unsigned int
  613. get_SrcB_X1(tilegx_bundle_bits n)
  614. {
  615. return (((unsigned int)(n >> 43)) & 0x3f);
  616. }
  617. static __inline unsigned int
  618. get_SrcB_Y0(tilegx_bundle_bits num)
  619. {
  620. const unsigned int n = (unsigned int)num;
  621. return (((n >> 12)) & 0x3f);
  622. }
  623. static __inline unsigned int
  624. get_SrcB_Y1(tilegx_bundle_bits n)
  625. {
  626. return (((unsigned int)(n >> 43)) & 0x3f);
  627. }
  628. static __inline unsigned int
  629. get_UnaryOpcodeExtension_X0(tilegx_bundle_bits num)
  630. {
  631. const unsigned int n = (unsigned int)num;
  632. return (((n >> 12)) & 0x3f);
  633. }
  634. static __inline unsigned int
  635. get_UnaryOpcodeExtension_X1(tilegx_bundle_bits n)
  636. {
  637. return (((unsigned int)(n >> 43)) & 0x3f);
  638. }
  639. static __inline unsigned int
  640. get_UnaryOpcodeExtension_Y0(tilegx_bundle_bits num)
  641. {
  642. const unsigned int n = (unsigned int)num;
  643. return (((n >> 12)) & 0x3f);
  644. }
  645. static __inline unsigned int
  646. get_UnaryOpcodeExtension_Y1(tilegx_bundle_bits n)
  647. {
  648. return (((unsigned int)(n >> 43)) & 0x3f);
  649. }
  650. static __inline int
  651. sign_extend(int n, int num_bits)
  652. {
  653. int shift = (int)(sizeof(int) * 8 - num_bits);
  654. return (n << shift) >> shift;
  655. }
  656. static __inline tilegx_bundle_bits
  657. create_BFEnd_X0(int num)
  658. {
  659. const unsigned int n = (unsigned int)num;
  660. return ((n & 0x3f) << 12);
  661. }
  662. static __inline tilegx_bundle_bits
  663. create_BFOpcodeExtension_X0(int num)
  664. {
  665. const unsigned int n = (unsigned int)num;
  666. return ((n & 0xf) << 24);
  667. }
  668. static __inline tilegx_bundle_bits
  669. create_BFStart_X0(int num)
  670. {
  671. const unsigned int n = (unsigned int)num;
  672. return ((n & 0x3f) << 18);
  673. }
  674. static __inline tilegx_bundle_bits
  675. create_BrOff_X1(int num)
  676. {
  677. const unsigned int n = (unsigned int)num;
  678. return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
  679. (((tilegx_bundle_bits)(n & 0x0001ffc0)) << 37);
  680. }
  681. static __inline tilegx_bundle_bits
  682. create_BrType_X1(int num)
  683. {
  684. const unsigned int n = (unsigned int)num;
  685. return (((tilegx_bundle_bits)(n & 0x1f)) << 54);
  686. }
  687. static __inline tilegx_bundle_bits
  688. create_Dest_Imm8_X1(int num)
  689. {
  690. const unsigned int n = (unsigned int)num;
  691. return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
  692. (((tilegx_bundle_bits)(n & 0x000000c0)) << 43);
  693. }
  694. static __inline tilegx_bundle_bits
  695. create_Dest_X0(int num)
  696. {
  697. const unsigned int n = (unsigned int)num;
  698. return ((n & 0x3f) << 0);
  699. }
  700. static __inline tilegx_bundle_bits
  701. create_Dest_X1(int num)
  702. {
  703. const unsigned int n = (unsigned int)num;
  704. return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
  705. }
  706. static __inline tilegx_bundle_bits
  707. create_Dest_Y0(int num)
  708. {
  709. const unsigned int n = (unsigned int)num;
  710. return ((n & 0x3f) << 0);
  711. }
  712. static __inline tilegx_bundle_bits
  713. create_Dest_Y1(int num)
  714. {
  715. const unsigned int n = (unsigned int)num;
  716. return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
  717. }
  718. static __inline tilegx_bundle_bits
  719. create_Imm16_X0(int num)
  720. {
  721. const unsigned int n = (unsigned int)num;
  722. return ((n & 0xffff) << 12);
  723. }
  724. static __inline tilegx_bundle_bits
  725. create_Imm16_X1(int num)
  726. {
  727. const unsigned int n = (unsigned int)num;
  728. return (((tilegx_bundle_bits)(n & 0xffff)) << 43);
  729. }
  730. static __inline tilegx_bundle_bits
  731. create_Imm8OpcodeExtension_X0(int num)
  732. {
  733. const unsigned int n = (unsigned int)num;
  734. return ((n & 0xff) << 20);
  735. }
  736. static __inline tilegx_bundle_bits
  737. create_Imm8OpcodeExtension_X1(int num)
  738. {
  739. const unsigned int n = (unsigned int)num;
  740. return (((tilegx_bundle_bits)(n & 0xff)) << 51);
  741. }
  742. static __inline tilegx_bundle_bits
  743. create_Imm8_X0(int num)
  744. {
  745. const unsigned int n = (unsigned int)num;
  746. return ((n & 0xff) << 12);
  747. }
  748. static __inline tilegx_bundle_bits
  749. create_Imm8_X1(int num)
  750. {
  751. const unsigned int n = (unsigned int)num;
  752. return (((tilegx_bundle_bits)(n & 0xff)) << 43);
  753. }
  754. static __inline tilegx_bundle_bits
  755. create_Imm8_Y0(int num)
  756. {
  757. const unsigned int n = (unsigned int)num;
  758. return ((n & 0xff) << 12);
  759. }
  760. static __inline tilegx_bundle_bits
  761. create_Imm8_Y1(int num)
  762. {
  763. const unsigned int n = (unsigned int)num;
  764. return (((tilegx_bundle_bits)(n & 0xff)) << 43);
  765. }
  766. static __inline tilegx_bundle_bits
  767. create_JumpOff_X1(int num)
  768. {
  769. const unsigned int n = (unsigned int)num;
  770. return (((tilegx_bundle_bits)(n & 0x7ffffff)) << 31);
  771. }
  772. static __inline tilegx_bundle_bits
  773. create_JumpOpcodeExtension_X1(int num)
  774. {
  775. const unsigned int n = (unsigned int)num;
  776. return (((tilegx_bundle_bits)(n & 0x1)) << 58);
  777. }
  778. static __inline tilegx_bundle_bits
  779. create_MF_Imm14_X1(int num)
  780. {
  781. const unsigned int n = (unsigned int)num;
  782. return (((tilegx_bundle_bits)(n & 0x3fff)) << 37);
  783. }
  784. static __inline tilegx_bundle_bits
  785. create_MT_Imm14_X1(int num)
  786. {
  787. const unsigned int n = (unsigned int)num;
  788. return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
  789. (((tilegx_bundle_bits)(n & 0x00003fc0)) << 37);
  790. }
  791. static __inline tilegx_bundle_bits
  792. create_Mode(int num)
  793. {
  794. const unsigned int n = (unsigned int)num;
  795. return (((tilegx_bundle_bits)(n & 0x3)) << 62);
  796. }
  797. static __inline tilegx_bundle_bits
  798. create_Opcode_X0(int num)
  799. {
  800. const unsigned int n = (unsigned int)num;
  801. return ((n & 0x7) << 28);
  802. }
  803. static __inline tilegx_bundle_bits
  804. create_Opcode_X1(int num)
  805. {
  806. const unsigned int n = (unsigned int)num;
  807. return (((tilegx_bundle_bits)(n & 0x7)) << 59);
  808. }
  809. static __inline tilegx_bundle_bits
  810. create_Opcode_Y0(int num)
  811. {
  812. const unsigned int n = (unsigned int)num;
  813. return ((n & 0xf) << 27);
  814. }
  815. static __inline tilegx_bundle_bits
  816. create_Opcode_Y1(int num)
  817. {
  818. const unsigned int n = (unsigned int)num;
  819. return (((tilegx_bundle_bits)(n & 0xf)) << 58);
  820. }
  821. static __inline tilegx_bundle_bits
  822. create_Opcode_Y2(int num)
  823. {
  824. const unsigned int n = (unsigned int)num;
  825. return ((n & 0x00000001) << 26) |
  826. (((tilegx_bundle_bits)(n & 0x00000002)) << 56);
  827. }
  828. static __inline tilegx_bundle_bits
  829. create_RRROpcodeExtension_X0(int num)
  830. {
  831. const unsigned int n = (unsigned int)num;
  832. return ((n & 0x3ff) << 18);
  833. }
  834. static __inline tilegx_bundle_bits
  835. create_RRROpcodeExtension_X1(int num)
  836. {
  837. const unsigned int n = (unsigned int)num;
  838. return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
  839. }
  840. static __inline tilegx_bundle_bits
  841. create_RRROpcodeExtension_Y0(int num)
  842. {
  843. const unsigned int n = (unsigned int)num;
  844. return ((n & 0x3) << 18);
  845. }
  846. static __inline tilegx_bundle_bits
  847. create_RRROpcodeExtension_Y1(int num)
  848. {
  849. const unsigned int n = (unsigned int)num;
  850. return (((tilegx_bundle_bits)(n & 0x3)) << 49);
  851. }
  852. static __inline tilegx_bundle_bits
  853. create_ShAmt_X0(int num)
  854. {
  855. const unsigned int n = (unsigned int)num;
  856. return ((n & 0x3f) << 12);
  857. }
  858. static __inline tilegx_bundle_bits
  859. create_ShAmt_X1(int num)
  860. {
  861. const unsigned int n = (unsigned int)num;
  862. return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
  863. }
  864. static __inline tilegx_bundle_bits
  865. create_ShAmt_Y0(int num)
  866. {
  867. const unsigned int n = (unsigned int)num;
  868. return ((n & 0x3f) << 12);
  869. }
  870. static __inline tilegx_bundle_bits
  871. create_ShAmt_Y1(int num)
  872. {
  873. const unsigned int n = (unsigned int)num;
  874. return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
  875. }
  876. static __inline tilegx_bundle_bits
  877. create_ShiftOpcodeExtension_X0(int num)
  878. {
  879. const unsigned int n = (unsigned int)num;
  880. return ((n & 0x3ff) << 18);
  881. }
  882. static __inline tilegx_bundle_bits
  883. create_ShiftOpcodeExtension_X1(int num)
  884. {
  885. const unsigned int n = (unsigned int)num;
  886. return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
  887. }
  888. static __inline tilegx_bundle_bits
  889. create_ShiftOpcodeExtension_Y0(int num)
  890. {
  891. const unsigned int n = (unsigned int)num;
  892. return ((n & 0x3) << 18);
  893. }
  894. static __inline tilegx_bundle_bits
  895. create_ShiftOpcodeExtension_Y1(int num)
  896. {
  897. const unsigned int n = (unsigned int)num;
  898. return (((tilegx_bundle_bits)(n & 0x3)) << 49);
  899. }
  900. static __inline tilegx_bundle_bits
  901. create_SrcA_X0(int num)
  902. {
  903. const unsigned int n = (unsigned int)num;
  904. return ((n & 0x3f) << 6);
  905. }
  906. static __inline tilegx_bundle_bits
  907. create_SrcA_X1(int num)
  908. {
  909. const unsigned int n = (unsigned int)num;
  910. return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
  911. }
  912. static __inline tilegx_bundle_bits
  913. create_SrcA_Y0(int num)
  914. {
  915. const unsigned int n = (unsigned int)num;
  916. return ((n & 0x3f) << 6);
  917. }
  918. static __inline tilegx_bundle_bits
  919. create_SrcA_Y1(int num)
  920. {
  921. const unsigned int n = (unsigned int)num;
  922. return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
  923. }
  924. static __inline tilegx_bundle_bits
  925. create_SrcA_Y2(int num)
  926. {
  927. const unsigned int n = (unsigned int)num;
  928. return ((n & 0x3f) << 20);
  929. }
  930. static __inline tilegx_bundle_bits
  931. create_SrcBDest_Y2(int num)
  932. {
  933. const unsigned int n = (unsigned int)num;
  934. return (((tilegx_bundle_bits)(n & 0x3f)) << 51);
  935. }
  936. static __inline tilegx_bundle_bits
  937. create_SrcB_X0(int num)
  938. {
  939. const unsigned int n = (unsigned int)num;
  940. return ((n & 0x3f) << 12);
  941. }
  942. static __inline tilegx_bundle_bits
  943. create_SrcB_X1(int num)
  944. {
  945. const unsigned int n = (unsigned int)num;
  946. return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
  947. }
  948. static __inline tilegx_bundle_bits
  949. create_SrcB_Y0(int num)
  950. {
  951. const unsigned int n = (unsigned int)num;
  952. return ((n & 0x3f) << 12);
  953. }
  954. static __inline tilegx_bundle_bits
  955. create_SrcB_Y1(int num)
  956. {
  957. const unsigned int n = (unsigned int)num;
  958. return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
  959. }
  960. static __inline tilegx_bundle_bits
  961. create_UnaryOpcodeExtension_X0(int num)
  962. {
  963. const unsigned int n = (unsigned int)num;
  964. return ((n & 0x3f) << 12);
  965. }
  966. static __inline tilegx_bundle_bits
  967. create_UnaryOpcodeExtension_X1(int num)
  968. {
  969. const unsigned int n = (unsigned int)num;
  970. return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
  971. }
  972. static __inline tilegx_bundle_bits
  973. create_UnaryOpcodeExtension_Y0(int num)
  974. {
  975. const unsigned int n = (unsigned int)num;
  976. return ((n & 0x3f) << 12);
  977. }
  978. static __inline tilegx_bundle_bits
  979. create_UnaryOpcodeExtension_Y1(int num)
  980. {
  981. const unsigned int n = (unsigned int)num;
  982. return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
  983. }
  984. typedef enum
  985. {
  986. TILEGX_PIPELINE_X0,
  987. TILEGX_PIPELINE_X1,
  988. TILEGX_PIPELINE_Y0,
  989. TILEGX_PIPELINE_Y1,
  990. TILEGX_PIPELINE_Y2,
  991. } tilegx_pipeline;
  992. #define tilegx_is_x_pipeline(p) ((int)(p) <= (int)TILEGX_PIPELINE_X1)
  993. typedef enum
  994. {
  995. TILEGX_OP_TYPE_REGISTER,
  996. TILEGX_OP_TYPE_IMMEDIATE,
  997. TILEGX_OP_TYPE_ADDRESS,
  998. TILEGX_OP_TYPE_SPR
  999. } tilegx_operand_type;
  1000. /* These are the bits that determine if a bundle is in the X encoding. */
  1001. #define TILEGX_BUNDLE_MODE_MASK ((tilegx_bundle_bits)3 << 62)
  1002. enum
  1003. {
  1004. /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
  1005. TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
  1006. /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
  1007. TILEGX_NUM_PIPELINE_ENCODINGS = 5,
  1008. /* Log base 2 of TILEGX_BUNDLE_SIZE_IN_BYTES. */
  1009. TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
  1010. /* Instructions take this many bytes. */
  1011. TILEGX_BUNDLE_SIZE_IN_BYTES = 1 << TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES,
  1012. /* Log base 2 of TILEGX_BUNDLE_ALIGNMENT_IN_BYTES. */
  1013. TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
  1014. /* Bundles should be aligned modulo this number of bytes. */
  1015. TILEGX_BUNDLE_ALIGNMENT_IN_BYTES =
  1016. (1 << TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
  1017. /* Number of registers (some are magic, such as network I/O). */
  1018. TILEGX_NUM_REGISTERS = 64,
  1019. };
  1020. struct tilegx_operand
  1021. {
  1022. /* Is this operand a register, immediate or address? */
  1023. tilegx_operand_type type;
  1024. /* The default relocation type for this operand. */
  1025. signed int default_reloc : 16;
  1026. /* How many bits is this value? (used for range checking) */
  1027. unsigned int num_bits : 5;
  1028. /* Is the value signed? (used for range checking) */
  1029. unsigned int is_signed : 1;
  1030. /* Is this operand a source register? */
  1031. unsigned int is_src_reg : 1;
  1032. /* Is this operand written? (i.e. is it a destination register) */
  1033. unsigned int is_dest_reg : 1;
  1034. /* Is this operand PC-relative? */
  1035. unsigned int is_pc_relative : 1;
  1036. /* By how many bits do we right shift the value before inserting? */
  1037. unsigned int rightshift : 2;
  1038. /* Return the bits for this operand to be ORed into an existing bundle. */
  1039. tilegx_bundle_bits (*insert) (int op);
  1040. /* Extract this operand and return it. */
  1041. unsigned int (*extract) (tilegx_bundle_bits bundle);
  1042. };
  1043. extern const struct tilegx_operand tilegx_operands[];
  1044. /* One finite-state machine per pipe for rapid instruction decoding. */
  1045. extern const unsigned short * const
  1046. tilegx_bundle_decoder_fsms[TILEGX_NUM_PIPELINE_ENCODINGS];
  1047. struct tilegx_opcode
  1048. {
  1049. /* The opcode mnemonic, e.g. "add" */
  1050. const char *name;
  1051. /* The enum value for this mnemonic. */
  1052. tilegx_mnemonic mnemonic;
  1053. /* A bit mask of which of the five pipes this instruction
  1054. is compatible with:
  1055. X0 0x01
  1056. X1 0x02
  1057. Y0 0x04
  1058. Y1 0x08
  1059. Y2 0x10 */
  1060. unsigned char pipes;
  1061. /* How many operands are there? */
  1062. unsigned char num_operands;
  1063. /* Which register does this write implicitly, or TREG_ZERO if none? */
  1064. unsigned char implicitly_written_register;
  1065. /* Can this be bundled with other instructions (almost always true). */
  1066. unsigned char can_bundle;
  1067. /* The description of the operands. Each of these is an
  1068. * index into the tilegx_operands[] table. */
  1069. unsigned char operands[TILEGX_NUM_PIPELINE_ENCODINGS][TILEGX_MAX_OPERANDS];
  1070. };
  1071. extern const struct tilegx_opcode tilegx_opcodes[];
  1072. /* Used for non-textual disassembly into structs. */
  1073. struct tilegx_decoded_instruction
  1074. {
  1075. const struct tilegx_opcode *opcode;
  1076. const struct tilegx_operand *operands[TILEGX_MAX_OPERANDS];
  1077. long long operand_values[TILEGX_MAX_OPERANDS];
  1078. };
  1079. /* Disassemble a bundle into a struct for machine processing. */
  1080. extern int parse_insn_tilegx(tilegx_bundle_bits bits,
  1081. unsigned long long pc,
  1082. struct tilegx_decoded_instruction
  1083. decoded[TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE]);
  1084. #endif /* opcode_tilegx_h */