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