PR ld/10144
[binutils.git] / include / opcode / tilepro.h
blob91e2a2bdb2f397385f910f2bce18f4c1bf7fdb36
1 /* TILEPro opcode information.
3 * Copyright 2011 Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
18 * MA 02110-1301, USA.
21 #ifndef opcode_tilepro_h
22 #define opcode_tilepro_h
24 typedef unsigned long long tilepro_bundle_bits;
27 enum
29 TILEPRO_MAX_OPERANDS = 5 /* mm */
32 typedef enum
34 TILEPRO_OPC_BPT,
35 TILEPRO_OPC_INFO,
36 TILEPRO_OPC_INFOL,
37 TILEPRO_OPC_J,
38 TILEPRO_OPC_JAL,
39 TILEPRO_OPC_MOVE,
40 TILEPRO_OPC_MOVE_SN,
41 TILEPRO_OPC_MOVEI,
42 TILEPRO_OPC_MOVEI_SN,
43 TILEPRO_OPC_MOVELI,
44 TILEPRO_OPC_MOVELI_SN,
45 TILEPRO_OPC_MOVELIS,
46 TILEPRO_OPC_PREFETCH,
47 TILEPRO_OPC_RAISE,
48 TILEPRO_OPC_ADD,
49 TILEPRO_OPC_ADD_SN,
50 TILEPRO_OPC_ADDB,
51 TILEPRO_OPC_ADDB_SN,
52 TILEPRO_OPC_ADDBS_U,
53 TILEPRO_OPC_ADDBS_U_SN,
54 TILEPRO_OPC_ADDH,
55 TILEPRO_OPC_ADDH_SN,
56 TILEPRO_OPC_ADDHS,
57 TILEPRO_OPC_ADDHS_SN,
58 TILEPRO_OPC_ADDI,
59 TILEPRO_OPC_ADDI_SN,
60 TILEPRO_OPC_ADDIB,
61 TILEPRO_OPC_ADDIB_SN,
62 TILEPRO_OPC_ADDIH,
63 TILEPRO_OPC_ADDIH_SN,
64 TILEPRO_OPC_ADDLI,
65 TILEPRO_OPC_ADDLI_SN,
66 TILEPRO_OPC_ADDLIS,
67 TILEPRO_OPC_ADDS,
68 TILEPRO_OPC_ADDS_SN,
69 TILEPRO_OPC_ADIFFB_U,
70 TILEPRO_OPC_ADIFFB_U_SN,
71 TILEPRO_OPC_ADIFFH,
72 TILEPRO_OPC_ADIFFH_SN,
73 TILEPRO_OPC_AND,
74 TILEPRO_OPC_AND_SN,
75 TILEPRO_OPC_ANDI,
76 TILEPRO_OPC_ANDI_SN,
77 TILEPRO_OPC_AULI,
78 TILEPRO_OPC_AVGB_U,
79 TILEPRO_OPC_AVGB_U_SN,
80 TILEPRO_OPC_AVGH,
81 TILEPRO_OPC_AVGH_SN,
82 TILEPRO_OPC_BBNS,
83 TILEPRO_OPC_BBNS_SN,
84 TILEPRO_OPC_BBNST,
85 TILEPRO_OPC_BBNST_SN,
86 TILEPRO_OPC_BBS,
87 TILEPRO_OPC_BBS_SN,
88 TILEPRO_OPC_BBST,
89 TILEPRO_OPC_BBST_SN,
90 TILEPRO_OPC_BGEZ,
91 TILEPRO_OPC_BGEZ_SN,
92 TILEPRO_OPC_BGEZT,
93 TILEPRO_OPC_BGEZT_SN,
94 TILEPRO_OPC_BGZ,
95 TILEPRO_OPC_BGZ_SN,
96 TILEPRO_OPC_BGZT,
97 TILEPRO_OPC_BGZT_SN,
98 TILEPRO_OPC_BITX,
99 TILEPRO_OPC_BITX_SN,
100 TILEPRO_OPC_BLEZ,
101 TILEPRO_OPC_BLEZ_SN,
102 TILEPRO_OPC_BLEZT,
103 TILEPRO_OPC_BLEZT_SN,
104 TILEPRO_OPC_BLZ,
105 TILEPRO_OPC_BLZ_SN,
106 TILEPRO_OPC_BLZT,
107 TILEPRO_OPC_BLZT_SN,
108 TILEPRO_OPC_BNZ,
109 TILEPRO_OPC_BNZ_SN,
110 TILEPRO_OPC_BNZT,
111 TILEPRO_OPC_BNZT_SN,
112 TILEPRO_OPC_BYTEX,
113 TILEPRO_OPC_BYTEX_SN,
114 TILEPRO_OPC_BZ,
115 TILEPRO_OPC_BZ_SN,
116 TILEPRO_OPC_BZT,
117 TILEPRO_OPC_BZT_SN,
118 TILEPRO_OPC_CLZ,
119 TILEPRO_OPC_CLZ_SN,
120 TILEPRO_OPC_CRC32_32,
121 TILEPRO_OPC_CRC32_32_SN,
122 TILEPRO_OPC_CRC32_8,
123 TILEPRO_OPC_CRC32_8_SN,
124 TILEPRO_OPC_CTZ,
125 TILEPRO_OPC_CTZ_SN,
126 TILEPRO_OPC_DRAIN,
127 TILEPRO_OPC_DTLBPR,
128 TILEPRO_OPC_DWORD_ALIGN,
129 TILEPRO_OPC_DWORD_ALIGN_SN,
130 TILEPRO_OPC_FINV,
131 TILEPRO_OPC_FLUSH,
132 TILEPRO_OPC_FNOP,
133 TILEPRO_OPC_ICOH,
134 TILEPRO_OPC_ILL,
135 TILEPRO_OPC_INTHB,
136 TILEPRO_OPC_INTHB_SN,
137 TILEPRO_OPC_INTHH,
138 TILEPRO_OPC_INTHH_SN,
139 TILEPRO_OPC_INTLB,
140 TILEPRO_OPC_INTLB_SN,
141 TILEPRO_OPC_INTLH,
142 TILEPRO_OPC_INTLH_SN,
143 TILEPRO_OPC_INV,
144 TILEPRO_OPC_IRET,
145 TILEPRO_OPC_JALB,
146 TILEPRO_OPC_JALF,
147 TILEPRO_OPC_JALR,
148 TILEPRO_OPC_JALRP,
149 TILEPRO_OPC_JB,
150 TILEPRO_OPC_JF,
151 TILEPRO_OPC_JR,
152 TILEPRO_OPC_JRP,
153 TILEPRO_OPC_LB,
154 TILEPRO_OPC_LB_SN,
155 TILEPRO_OPC_LB_U,
156 TILEPRO_OPC_LB_U_SN,
157 TILEPRO_OPC_LBADD,
158 TILEPRO_OPC_LBADD_SN,
159 TILEPRO_OPC_LBADD_U,
160 TILEPRO_OPC_LBADD_U_SN,
161 TILEPRO_OPC_LH,
162 TILEPRO_OPC_LH_SN,
163 TILEPRO_OPC_LH_U,
164 TILEPRO_OPC_LH_U_SN,
165 TILEPRO_OPC_LHADD,
166 TILEPRO_OPC_LHADD_SN,
167 TILEPRO_OPC_LHADD_U,
168 TILEPRO_OPC_LHADD_U_SN,
169 TILEPRO_OPC_LNK,
170 TILEPRO_OPC_LNK_SN,
171 TILEPRO_OPC_LW,
172 TILEPRO_OPC_LW_SN,
173 TILEPRO_OPC_LW_NA,
174 TILEPRO_OPC_LW_NA_SN,
175 TILEPRO_OPC_LWADD,
176 TILEPRO_OPC_LWADD_SN,
177 TILEPRO_OPC_LWADD_NA,
178 TILEPRO_OPC_LWADD_NA_SN,
179 TILEPRO_OPC_MAXB_U,
180 TILEPRO_OPC_MAXB_U_SN,
181 TILEPRO_OPC_MAXH,
182 TILEPRO_OPC_MAXH_SN,
183 TILEPRO_OPC_MAXIB_U,
184 TILEPRO_OPC_MAXIB_U_SN,
185 TILEPRO_OPC_MAXIH,
186 TILEPRO_OPC_MAXIH_SN,
187 TILEPRO_OPC_MF,
188 TILEPRO_OPC_MFSPR,
189 TILEPRO_OPC_MINB_U,
190 TILEPRO_OPC_MINB_U_SN,
191 TILEPRO_OPC_MINH,
192 TILEPRO_OPC_MINH_SN,
193 TILEPRO_OPC_MINIB_U,
194 TILEPRO_OPC_MINIB_U_SN,
195 TILEPRO_OPC_MINIH,
196 TILEPRO_OPC_MINIH_SN,
197 TILEPRO_OPC_MM,
198 TILEPRO_OPC_MNZ,
199 TILEPRO_OPC_MNZ_SN,
200 TILEPRO_OPC_MNZB,
201 TILEPRO_OPC_MNZB_SN,
202 TILEPRO_OPC_MNZH,
203 TILEPRO_OPC_MNZH_SN,
204 TILEPRO_OPC_MTSPR,
205 TILEPRO_OPC_MULHH_SS,
206 TILEPRO_OPC_MULHH_SS_SN,
207 TILEPRO_OPC_MULHH_SU,
208 TILEPRO_OPC_MULHH_SU_SN,
209 TILEPRO_OPC_MULHH_UU,
210 TILEPRO_OPC_MULHH_UU_SN,
211 TILEPRO_OPC_MULHHA_SS,
212 TILEPRO_OPC_MULHHA_SS_SN,
213 TILEPRO_OPC_MULHHA_SU,
214 TILEPRO_OPC_MULHHA_SU_SN,
215 TILEPRO_OPC_MULHHA_UU,
216 TILEPRO_OPC_MULHHA_UU_SN,
217 TILEPRO_OPC_MULHHSA_UU,
218 TILEPRO_OPC_MULHHSA_UU_SN,
219 TILEPRO_OPC_MULHL_SS,
220 TILEPRO_OPC_MULHL_SS_SN,
221 TILEPRO_OPC_MULHL_SU,
222 TILEPRO_OPC_MULHL_SU_SN,
223 TILEPRO_OPC_MULHL_US,
224 TILEPRO_OPC_MULHL_US_SN,
225 TILEPRO_OPC_MULHL_UU,
226 TILEPRO_OPC_MULHL_UU_SN,
227 TILEPRO_OPC_MULHLA_SS,
228 TILEPRO_OPC_MULHLA_SS_SN,
229 TILEPRO_OPC_MULHLA_SU,
230 TILEPRO_OPC_MULHLA_SU_SN,
231 TILEPRO_OPC_MULHLA_US,
232 TILEPRO_OPC_MULHLA_US_SN,
233 TILEPRO_OPC_MULHLA_UU,
234 TILEPRO_OPC_MULHLA_UU_SN,
235 TILEPRO_OPC_MULHLSA_UU,
236 TILEPRO_OPC_MULHLSA_UU_SN,
237 TILEPRO_OPC_MULLL_SS,
238 TILEPRO_OPC_MULLL_SS_SN,
239 TILEPRO_OPC_MULLL_SU,
240 TILEPRO_OPC_MULLL_SU_SN,
241 TILEPRO_OPC_MULLL_UU,
242 TILEPRO_OPC_MULLL_UU_SN,
243 TILEPRO_OPC_MULLLA_SS,
244 TILEPRO_OPC_MULLLA_SS_SN,
245 TILEPRO_OPC_MULLLA_SU,
246 TILEPRO_OPC_MULLLA_SU_SN,
247 TILEPRO_OPC_MULLLA_UU,
248 TILEPRO_OPC_MULLLA_UU_SN,
249 TILEPRO_OPC_MULLLSA_UU,
250 TILEPRO_OPC_MULLLSA_UU_SN,
251 TILEPRO_OPC_MVNZ,
252 TILEPRO_OPC_MVNZ_SN,
253 TILEPRO_OPC_MVZ,
254 TILEPRO_OPC_MVZ_SN,
255 TILEPRO_OPC_MZ,
256 TILEPRO_OPC_MZ_SN,
257 TILEPRO_OPC_MZB,
258 TILEPRO_OPC_MZB_SN,
259 TILEPRO_OPC_MZH,
260 TILEPRO_OPC_MZH_SN,
261 TILEPRO_OPC_NAP,
262 TILEPRO_OPC_NOP,
263 TILEPRO_OPC_NOR,
264 TILEPRO_OPC_NOR_SN,
265 TILEPRO_OPC_OR,
266 TILEPRO_OPC_OR_SN,
267 TILEPRO_OPC_ORI,
268 TILEPRO_OPC_ORI_SN,
269 TILEPRO_OPC_PACKBS_U,
270 TILEPRO_OPC_PACKBS_U_SN,
271 TILEPRO_OPC_PACKHB,
272 TILEPRO_OPC_PACKHB_SN,
273 TILEPRO_OPC_PACKHS,
274 TILEPRO_OPC_PACKHS_SN,
275 TILEPRO_OPC_PACKLB,
276 TILEPRO_OPC_PACKLB_SN,
277 TILEPRO_OPC_PCNT,
278 TILEPRO_OPC_PCNT_SN,
279 TILEPRO_OPC_RL,
280 TILEPRO_OPC_RL_SN,
281 TILEPRO_OPC_RLI,
282 TILEPRO_OPC_RLI_SN,
283 TILEPRO_OPC_S1A,
284 TILEPRO_OPC_S1A_SN,
285 TILEPRO_OPC_S2A,
286 TILEPRO_OPC_S2A_SN,
287 TILEPRO_OPC_S3A,
288 TILEPRO_OPC_S3A_SN,
289 TILEPRO_OPC_SADAB_U,
290 TILEPRO_OPC_SADAB_U_SN,
291 TILEPRO_OPC_SADAH,
292 TILEPRO_OPC_SADAH_SN,
293 TILEPRO_OPC_SADAH_U,
294 TILEPRO_OPC_SADAH_U_SN,
295 TILEPRO_OPC_SADB_U,
296 TILEPRO_OPC_SADB_U_SN,
297 TILEPRO_OPC_SADH,
298 TILEPRO_OPC_SADH_SN,
299 TILEPRO_OPC_SADH_U,
300 TILEPRO_OPC_SADH_U_SN,
301 TILEPRO_OPC_SB,
302 TILEPRO_OPC_SBADD,
303 TILEPRO_OPC_SEQ,
304 TILEPRO_OPC_SEQ_SN,
305 TILEPRO_OPC_SEQB,
306 TILEPRO_OPC_SEQB_SN,
307 TILEPRO_OPC_SEQH,
308 TILEPRO_OPC_SEQH_SN,
309 TILEPRO_OPC_SEQI,
310 TILEPRO_OPC_SEQI_SN,
311 TILEPRO_OPC_SEQIB,
312 TILEPRO_OPC_SEQIB_SN,
313 TILEPRO_OPC_SEQIH,
314 TILEPRO_OPC_SEQIH_SN,
315 TILEPRO_OPC_SH,
316 TILEPRO_OPC_SHADD,
317 TILEPRO_OPC_SHL,
318 TILEPRO_OPC_SHL_SN,
319 TILEPRO_OPC_SHLB,
320 TILEPRO_OPC_SHLB_SN,
321 TILEPRO_OPC_SHLH,
322 TILEPRO_OPC_SHLH_SN,
323 TILEPRO_OPC_SHLI,
324 TILEPRO_OPC_SHLI_SN,
325 TILEPRO_OPC_SHLIB,
326 TILEPRO_OPC_SHLIB_SN,
327 TILEPRO_OPC_SHLIH,
328 TILEPRO_OPC_SHLIH_SN,
329 TILEPRO_OPC_SHR,
330 TILEPRO_OPC_SHR_SN,
331 TILEPRO_OPC_SHRB,
332 TILEPRO_OPC_SHRB_SN,
333 TILEPRO_OPC_SHRH,
334 TILEPRO_OPC_SHRH_SN,
335 TILEPRO_OPC_SHRI,
336 TILEPRO_OPC_SHRI_SN,
337 TILEPRO_OPC_SHRIB,
338 TILEPRO_OPC_SHRIB_SN,
339 TILEPRO_OPC_SHRIH,
340 TILEPRO_OPC_SHRIH_SN,
341 TILEPRO_OPC_SLT,
342 TILEPRO_OPC_SLT_SN,
343 TILEPRO_OPC_SLT_U,
344 TILEPRO_OPC_SLT_U_SN,
345 TILEPRO_OPC_SLTB,
346 TILEPRO_OPC_SLTB_SN,
347 TILEPRO_OPC_SLTB_U,
348 TILEPRO_OPC_SLTB_U_SN,
349 TILEPRO_OPC_SLTE,
350 TILEPRO_OPC_SLTE_SN,
351 TILEPRO_OPC_SLTE_U,
352 TILEPRO_OPC_SLTE_U_SN,
353 TILEPRO_OPC_SLTEB,
354 TILEPRO_OPC_SLTEB_SN,
355 TILEPRO_OPC_SLTEB_U,
356 TILEPRO_OPC_SLTEB_U_SN,
357 TILEPRO_OPC_SLTEH,
358 TILEPRO_OPC_SLTEH_SN,
359 TILEPRO_OPC_SLTEH_U,
360 TILEPRO_OPC_SLTEH_U_SN,
361 TILEPRO_OPC_SLTH,
362 TILEPRO_OPC_SLTH_SN,
363 TILEPRO_OPC_SLTH_U,
364 TILEPRO_OPC_SLTH_U_SN,
365 TILEPRO_OPC_SLTI,
366 TILEPRO_OPC_SLTI_SN,
367 TILEPRO_OPC_SLTI_U,
368 TILEPRO_OPC_SLTI_U_SN,
369 TILEPRO_OPC_SLTIB,
370 TILEPRO_OPC_SLTIB_SN,
371 TILEPRO_OPC_SLTIB_U,
372 TILEPRO_OPC_SLTIB_U_SN,
373 TILEPRO_OPC_SLTIH,
374 TILEPRO_OPC_SLTIH_SN,
375 TILEPRO_OPC_SLTIH_U,
376 TILEPRO_OPC_SLTIH_U_SN,
377 TILEPRO_OPC_SNE,
378 TILEPRO_OPC_SNE_SN,
379 TILEPRO_OPC_SNEB,
380 TILEPRO_OPC_SNEB_SN,
381 TILEPRO_OPC_SNEH,
382 TILEPRO_OPC_SNEH_SN,
383 TILEPRO_OPC_SRA,
384 TILEPRO_OPC_SRA_SN,
385 TILEPRO_OPC_SRAB,
386 TILEPRO_OPC_SRAB_SN,
387 TILEPRO_OPC_SRAH,
388 TILEPRO_OPC_SRAH_SN,
389 TILEPRO_OPC_SRAI,
390 TILEPRO_OPC_SRAI_SN,
391 TILEPRO_OPC_SRAIB,
392 TILEPRO_OPC_SRAIB_SN,
393 TILEPRO_OPC_SRAIH,
394 TILEPRO_OPC_SRAIH_SN,
395 TILEPRO_OPC_SUB,
396 TILEPRO_OPC_SUB_SN,
397 TILEPRO_OPC_SUBB,
398 TILEPRO_OPC_SUBB_SN,
399 TILEPRO_OPC_SUBBS_U,
400 TILEPRO_OPC_SUBBS_U_SN,
401 TILEPRO_OPC_SUBH,
402 TILEPRO_OPC_SUBH_SN,
403 TILEPRO_OPC_SUBHS,
404 TILEPRO_OPC_SUBHS_SN,
405 TILEPRO_OPC_SUBS,
406 TILEPRO_OPC_SUBS_SN,
407 TILEPRO_OPC_SW,
408 TILEPRO_OPC_SWADD,
409 TILEPRO_OPC_SWINT0,
410 TILEPRO_OPC_SWINT1,
411 TILEPRO_OPC_SWINT2,
412 TILEPRO_OPC_SWINT3,
413 TILEPRO_OPC_TBLIDXB0,
414 TILEPRO_OPC_TBLIDXB0_SN,
415 TILEPRO_OPC_TBLIDXB1,
416 TILEPRO_OPC_TBLIDXB1_SN,
417 TILEPRO_OPC_TBLIDXB2,
418 TILEPRO_OPC_TBLIDXB2_SN,
419 TILEPRO_OPC_TBLIDXB3,
420 TILEPRO_OPC_TBLIDXB3_SN,
421 TILEPRO_OPC_TNS,
422 TILEPRO_OPC_TNS_SN,
423 TILEPRO_OPC_WH64,
424 TILEPRO_OPC_XOR,
425 TILEPRO_OPC_XOR_SN,
426 TILEPRO_OPC_XORI,
427 TILEPRO_OPC_XORI_SN,
428 TILEPRO_OPC_NONE
429 } tilepro_mnemonic;
431 /* 64-bit pattern for a { bpt ; nop } bundle. */
432 #define TILEPRO_BPT_BUNDLE 0x400b3cae70166000ULL
434 #ifndef DISASM_ONLY
436 enum
438 TILEPRO_SN_MAX_OPERANDS = 6 /* route */
441 typedef enum
443 TILEPRO_SN_OPC_BZ,
444 TILEPRO_SN_OPC_BNZ,
445 TILEPRO_SN_OPC_JRR,
446 TILEPRO_SN_OPC_FNOP,
447 TILEPRO_SN_OPC_BLZ,
448 TILEPRO_SN_OPC_NOP,
449 TILEPRO_SN_OPC_MOVEI,
450 TILEPRO_SN_OPC_MOVE,
451 TILEPRO_SN_OPC_BGEZ,
452 TILEPRO_SN_OPC_JR,
453 TILEPRO_SN_OPC_BLEZ,
454 TILEPRO_SN_OPC_BBNS,
455 TILEPRO_SN_OPC_JALRR,
456 TILEPRO_SN_OPC_BPT,
457 TILEPRO_SN_OPC_JALR,
458 TILEPRO_SN_OPC_SHR1,
459 TILEPRO_SN_OPC_BGZ,
460 TILEPRO_SN_OPC_BBS,
461 TILEPRO_SN_OPC_SHL8II,
462 TILEPRO_SN_OPC_ADDI,
463 TILEPRO_SN_OPC_HALT,
464 TILEPRO_SN_OPC_ROUTE,
465 TILEPRO_SN_OPC_NONE
466 } tilepro_sn_mnemonic;
468 extern const unsigned char tilepro_sn_route_encode[6 * 6 * 6];
469 extern const signed char tilepro_sn_route_decode[256][3];
470 extern const char tilepro_sn_direction_names[6][5];
471 extern const signed char tilepro_sn_dest_map[6][6];
472 #endif /* DISASM_ONLY */
475 static __inline unsigned int
476 get_BrOff_SN(tilepro_bundle_bits num)
478 const unsigned int n = (unsigned int)num;
479 return (((n >> 0)) & 0x3ff);
482 static __inline unsigned int
483 get_BrOff_X1(tilepro_bundle_bits n)
485 return (((unsigned int)(n >> 43)) & 0x00007fff) |
486 (((unsigned int)(n >> 20)) & 0x00018000);
489 static __inline unsigned int
490 get_BrType_X1(tilepro_bundle_bits n)
492 return (((unsigned int)(n >> 31)) & 0xf);
495 static __inline unsigned int
496 get_Dest_Imm8_X1(tilepro_bundle_bits n)
498 return (((unsigned int)(n >> 31)) & 0x0000003f) |
499 (((unsigned int)(n >> 43)) & 0x000000c0);
502 static __inline unsigned int
503 get_Dest_SN(tilepro_bundle_bits num)
505 const unsigned int n = (unsigned int)num;
506 return (((n >> 2)) & 0x3);
509 static __inline unsigned int
510 get_Dest_X0(tilepro_bundle_bits num)
512 const unsigned int n = (unsigned int)num;
513 return (((n >> 0)) & 0x3f);
516 static __inline unsigned int
517 get_Dest_X1(tilepro_bundle_bits n)
519 return (((unsigned int)(n >> 31)) & 0x3f);
522 static __inline unsigned int
523 get_Dest_Y0(tilepro_bundle_bits num)
525 const unsigned int n = (unsigned int)num;
526 return (((n >> 0)) & 0x3f);
529 static __inline unsigned int
530 get_Dest_Y1(tilepro_bundle_bits n)
532 return (((unsigned int)(n >> 31)) & 0x3f);
535 static __inline unsigned int
536 get_Imm16_X0(tilepro_bundle_bits num)
538 const unsigned int n = (unsigned int)num;
539 return (((n >> 12)) & 0xffff);
542 static __inline unsigned int
543 get_Imm16_X1(tilepro_bundle_bits n)
545 return (((unsigned int)(n >> 43)) & 0xffff);
548 static __inline unsigned int
549 get_Imm8_SN(tilepro_bundle_bits num)
551 const unsigned int n = (unsigned int)num;
552 return (((n >> 0)) & 0xff);
555 static __inline unsigned int
556 get_Imm8_X0(tilepro_bundle_bits num)
558 const unsigned int n = (unsigned int)num;
559 return (((n >> 12)) & 0xff);
562 static __inline unsigned int
563 get_Imm8_X1(tilepro_bundle_bits n)
565 return (((unsigned int)(n >> 43)) & 0xff);
568 static __inline unsigned int
569 get_Imm8_Y0(tilepro_bundle_bits num)
571 const unsigned int n = (unsigned int)num;
572 return (((n >> 12)) & 0xff);
575 static __inline unsigned int
576 get_Imm8_Y1(tilepro_bundle_bits n)
578 return (((unsigned int)(n >> 43)) & 0xff);
581 static __inline unsigned int
582 get_ImmOpcodeExtension_X0(tilepro_bundle_bits num)
584 const unsigned int n = (unsigned int)num;
585 return (((n >> 20)) & 0x7f);
588 static __inline unsigned int
589 get_ImmOpcodeExtension_X1(tilepro_bundle_bits n)
591 return (((unsigned int)(n >> 51)) & 0x7f);
594 static __inline unsigned int
595 get_ImmRROpcodeExtension_SN(tilepro_bundle_bits num)
597 const unsigned int n = (unsigned int)num;
598 return (((n >> 8)) & 0x3);
601 static __inline unsigned int
602 get_JOffLong_X1(tilepro_bundle_bits n)
604 return (((unsigned int)(n >> 43)) & 0x00007fff) |
605 (((unsigned int)(n >> 20)) & 0x00018000) |
606 (((unsigned int)(n >> 14)) & 0x001e0000) |
607 (((unsigned int)(n >> 16)) & 0x07e00000) |
608 (((unsigned int)(n >> 31)) & 0x18000000);
611 static __inline unsigned int
612 get_JOff_X1(tilepro_bundle_bits n)
614 return (((unsigned int)(n >> 43)) & 0x00007fff) |
615 (((unsigned int)(n >> 20)) & 0x00018000) |
616 (((unsigned int)(n >> 14)) & 0x001e0000) |
617 (((unsigned int)(n >> 16)) & 0x07e00000) |
618 (((unsigned int)(n >> 31)) & 0x08000000);
621 static __inline unsigned int
622 get_MF_Imm15_X1(tilepro_bundle_bits n)
624 return (((unsigned int)(n >> 37)) & 0x00003fff) |
625 (((unsigned int)(n >> 44)) & 0x00004000);
628 static __inline unsigned int
629 get_MMEnd_X0(tilepro_bundle_bits num)
631 const unsigned int n = (unsigned int)num;
632 return (((n >> 18)) & 0x1f);
635 static __inline unsigned int
636 get_MMEnd_X1(tilepro_bundle_bits n)
638 return (((unsigned int)(n >> 49)) & 0x1f);
641 static __inline unsigned int
642 get_MMStart_X0(tilepro_bundle_bits num)
644 const unsigned int n = (unsigned int)num;
645 return (((n >> 23)) & 0x1f);
648 static __inline unsigned int
649 get_MMStart_X1(tilepro_bundle_bits n)
651 return (((unsigned int)(n >> 54)) & 0x1f);
654 static __inline unsigned int
655 get_MT_Imm15_X1(tilepro_bundle_bits n)
657 return (((unsigned int)(n >> 31)) & 0x0000003f) |
658 (((unsigned int)(n >> 37)) & 0x00003fc0) |
659 (((unsigned int)(n >> 44)) & 0x00004000);
662 static __inline unsigned int
663 get_Mode(tilepro_bundle_bits n)
665 return (((unsigned int)(n >> 63)) & 0x1);
668 static __inline unsigned int
669 get_NoRegOpcodeExtension_SN(tilepro_bundle_bits num)
671 const unsigned int n = (unsigned int)num;
672 return (((n >> 0)) & 0xf);
675 static __inline unsigned int
676 get_Opcode_SN(tilepro_bundle_bits num)
678 const unsigned int n = (unsigned int)num;
679 return (((n >> 10)) & 0x3f);
682 static __inline unsigned int
683 get_Opcode_X0(tilepro_bundle_bits num)
685 const unsigned int n = (unsigned int)num;
686 return (((n >> 28)) & 0x7);
689 static __inline unsigned int
690 get_Opcode_X1(tilepro_bundle_bits n)
692 return (((unsigned int)(n >> 59)) & 0xf);
695 static __inline unsigned int
696 get_Opcode_Y0(tilepro_bundle_bits num)
698 const unsigned int n = (unsigned int)num;
699 return (((n >> 27)) & 0xf);
702 static __inline unsigned int
703 get_Opcode_Y1(tilepro_bundle_bits n)
705 return (((unsigned int)(n >> 59)) & 0xf);
708 static __inline unsigned int
709 get_Opcode_Y2(tilepro_bundle_bits n)
711 return (((unsigned int)(n >> 56)) & 0x7);
714 static __inline unsigned int
715 get_RROpcodeExtension_SN(tilepro_bundle_bits num)
717 const unsigned int n = (unsigned int)num;
718 return (((n >> 4)) & 0xf);
721 static __inline unsigned int
722 get_RRROpcodeExtension_X0(tilepro_bundle_bits num)
724 const unsigned int n = (unsigned int)num;
725 return (((n >> 18)) & 0x1ff);
728 static __inline unsigned int
729 get_RRROpcodeExtension_X1(tilepro_bundle_bits n)
731 return (((unsigned int)(n >> 49)) & 0x1ff);
734 static __inline unsigned int
735 get_RRROpcodeExtension_Y0(tilepro_bundle_bits num)
737 const unsigned int n = (unsigned int)num;
738 return (((n >> 18)) & 0x3);
741 static __inline unsigned int
742 get_RRROpcodeExtension_Y1(tilepro_bundle_bits n)
744 return (((unsigned int)(n >> 49)) & 0x3);
747 static __inline unsigned int
748 get_RouteOpcodeExtension_SN(tilepro_bundle_bits num)
750 const unsigned int n = (unsigned int)num;
751 return (((n >> 0)) & 0x3ff);
754 static __inline unsigned int
755 get_S_X0(tilepro_bundle_bits num)
757 const unsigned int n = (unsigned int)num;
758 return (((n >> 27)) & 0x1);
761 static __inline unsigned int
762 get_S_X1(tilepro_bundle_bits n)
764 return (((unsigned int)(n >> 58)) & 0x1);
767 static __inline unsigned int
768 get_ShAmt_X0(tilepro_bundle_bits num)
770 const unsigned int n = (unsigned int)num;
771 return (((n >> 12)) & 0x1f);
774 static __inline unsigned int
775 get_ShAmt_X1(tilepro_bundle_bits n)
777 return (((unsigned int)(n >> 43)) & 0x1f);
780 static __inline unsigned int
781 get_ShAmt_Y0(tilepro_bundle_bits num)
783 const unsigned int n = (unsigned int)num;
784 return (((n >> 12)) & 0x1f);
787 static __inline unsigned int
788 get_ShAmt_Y1(tilepro_bundle_bits n)
790 return (((unsigned int)(n >> 43)) & 0x1f);
793 static __inline unsigned int
794 get_SrcA_X0(tilepro_bundle_bits num)
796 const unsigned int n = (unsigned int)num;
797 return (((n >> 6)) & 0x3f);
800 static __inline unsigned int
801 get_SrcA_X1(tilepro_bundle_bits n)
803 return (((unsigned int)(n >> 37)) & 0x3f);
806 static __inline unsigned int
807 get_SrcA_Y0(tilepro_bundle_bits num)
809 const unsigned int n = (unsigned int)num;
810 return (((n >> 6)) & 0x3f);
813 static __inline unsigned int
814 get_SrcA_Y1(tilepro_bundle_bits n)
816 return (((unsigned int)(n >> 37)) & 0x3f);
819 static __inline unsigned int
820 get_SrcA_Y2(tilepro_bundle_bits n)
822 return (((n >> 26)) & 0x00000001) |
823 (((unsigned int)(n >> 50)) & 0x0000003e);
826 static __inline unsigned int
827 get_SrcBDest_Y2(tilepro_bundle_bits num)
829 const unsigned int n = (unsigned int)num;
830 return (((n >> 20)) & 0x3f);
833 static __inline unsigned int
834 get_SrcB_X0(tilepro_bundle_bits num)
836 const unsigned int n = (unsigned int)num;
837 return (((n >> 12)) & 0x3f);
840 static __inline unsigned int
841 get_SrcB_X1(tilepro_bundle_bits n)
843 return (((unsigned int)(n >> 43)) & 0x3f);
846 static __inline unsigned int
847 get_SrcB_Y0(tilepro_bundle_bits num)
849 const unsigned int n = (unsigned int)num;
850 return (((n >> 12)) & 0x3f);
853 static __inline unsigned int
854 get_SrcB_Y1(tilepro_bundle_bits n)
856 return (((unsigned int)(n >> 43)) & 0x3f);
859 static __inline unsigned int
860 get_Src_SN(tilepro_bundle_bits num)
862 const unsigned int n = (unsigned int)num;
863 return (((n >> 0)) & 0x3);
866 static __inline unsigned int
867 get_UnOpcodeExtension_X0(tilepro_bundle_bits num)
869 const unsigned int n = (unsigned int)num;
870 return (((n >> 12)) & 0x1f);
873 static __inline unsigned int
874 get_UnOpcodeExtension_X1(tilepro_bundle_bits n)
876 return (((unsigned int)(n >> 43)) & 0x1f);
879 static __inline unsigned int
880 get_UnOpcodeExtension_Y0(tilepro_bundle_bits num)
882 const unsigned int n = (unsigned int)num;
883 return (((n >> 12)) & 0x1f);
886 static __inline unsigned int
887 get_UnOpcodeExtension_Y1(tilepro_bundle_bits n)
889 return (((unsigned int)(n >> 43)) & 0x1f);
892 static __inline unsigned int
893 get_UnShOpcodeExtension_X0(tilepro_bundle_bits num)
895 const unsigned int n = (unsigned int)num;
896 return (((n >> 17)) & 0x3ff);
899 static __inline unsigned int
900 get_UnShOpcodeExtension_X1(tilepro_bundle_bits n)
902 return (((unsigned int)(n >> 48)) & 0x3ff);
905 static __inline unsigned int
906 get_UnShOpcodeExtension_Y0(tilepro_bundle_bits num)
908 const unsigned int n = (unsigned int)num;
909 return (((n >> 17)) & 0x7);
912 static __inline unsigned int
913 get_UnShOpcodeExtension_Y1(tilepro_bundle_bits n)
915 return (((unsigned int)(n >> 48)) & 0x7);
919 static __inline int
920 sign_extend(int n, int num_bits)
922 int shift = (int)(sizeof(int) * 8 - num_bits);
923 return (n << shift) >> shift;
928 static __inline tilepro_bundle_bits
929 create_BrOff_SN(int num)
931 const unsigned int n = (unsigned int)num;
932 return ((n & 0x3ff) << 0);
935 static __inline tilepro_bundle_bits
936 create_BrOff_X1(int num)
938 const unsigned int n = (unsigned int)num;
939 return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
940 (((tilepro_bundle_bits)(n & 0x00018000)) << 20);
943 static __inline tilepro_bundle_bits
944 create_BrType_X1(int num)
946 const unsigned int n = (unsigned int)num;
947 return (((tilepro_bundle_bits)(n & 0xf)) << 31);
950 static __inline tilepro_bundle_bits
951 create_Dest_Imm8_X1(int num)
953 const unsigned int n = (unsigned int)num;
954 return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
955 (((tilepro_bundle_bits)(n & 0x000000c0)) << 43);
958 static __inline tilepro_bundle_bits
959 create_Dest_SN(int num)
961 const unsigned int n = (unsigned int)num;
962 return ((n & 0x3) << 2);
965 static __inline tilepro_bundle_bits
966 create_Dest_X0(int num)
968 const unsigned int n = (unsigned int)num;
969 return ((n & 0x3f) << 0);
972 static __inline tilepro_bundle_bits
973 create_Dest_X1(int num)
975 const unsigned int n = (unsigned int)num;
976 return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
979 static __inline tilepro_bundle_bits
980 create_Dest_Y0(int num)
982 const unsigned int n = (unsigned int)num;
983 return ((n & 0x3f) << 0);
986 static __inline tilepro_bundle_bits
987 create_Dest_Y1(int num)
989 const unsigned int n = (unsigned int)num;
990 return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
993 static __inline tilepro_bundle_bits
994 create_Imm16_X0(int num)
996 const unsigned int n = (unsigned int)num;
997 return ((n & 0xffff) << 12);
1000 static __inline tilepro_bundle_bits
1001 create_Imm16_X1(int num)
1003 const unsigned int n = (unsigned int)num;
1004 return (((tilepro_bundle_bits)(n & 0xffff)) << 43);
1007 static __inline tilepro_bundle_bits
1008 create_Imm8_SN(int num)
1010 const unsigned int n = (unsigned int)num;
1011 return ((n & 0xff) << 0);
1014 static __inline tilepro_bundle_bits
1015 create_Imm8_X0(int num)
1017 const unsigned int n = (unsigned int)num;
1018 return ((n & 0xff) << 12);
1021 static __inline tilepro_bundle_bits
1022 create_Imm8_X1(int num)
1024 const unsigned int n = (unsigned int)num;
1025 return (((tilepro_bundle_bits)(n & 0xff)) << 43);
1028 static __inline tilepro_bundle_bits
1029 create_Imm8_Y0(int num)
1031 const unsigned int n = (unsigned int)num;
1032 return ((n & 0xff) << 12);
1035 static __inline tilepro_bundle_bits
1036 create_Imm8_Y1(int num)
1038 const unsigned int n = (unsigned int)num;
1039 return (((tilepro_bundle_bits)(n & 0xff)) << 43);
1042 static __inline tilepro_bundle_bits
1043 create_ImmOpcodeExtension_X0(int num)
1045 const unsigned int n = (unsigned int)num;
1046 return ((n & 0x7f) << 20);
1049 static __inline tilepro_bundle_bits
1050 create_ImmOpcodeExtension_X1(int num)
1052 const unsigned int n = (unsigned int)num;
1053 return (((tilepro_bundle_bits)(n & 0x7f)) << 51);
1056 static __inline tilepro_bundle_bits
1057 create_ImmRROpcodeExtension_SN(int num)
1059 const unsigned int n = (unsigned int)num;
1060 return ((n & 0x3) << 8);
1063 static __inline tilepro_bundle_bits
1064 create_JOffLong_X1(int num)
1066 const unsigned int n = (unsigned int)num;
1067 return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
1068 (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
1069 (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
1070 (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
1071 (((tilepro_bundle_bits)(n & 0x18000000)) << 31);
1074 static __inline tilepro_bundle_bits
1075 create_JOff_X1(int num)
1077 const unsigned int n = (unsigned int)num;
1078 return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
1079 (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
1080 (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
1081 (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
1082 (((tilepro_bundle_bits)(n & 0x08000000)) << 31);
1085 static __inline tilepro_bundle_bits
1086 create_MF_Imm15_X1(int num)
1088 const unsigned int n = (unsigned int)num;
1089 return (((tilepro_bundle_bits)(n & 0x00003fff)) << 37) |
1090 (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
1093 static __inline tilepro_bundle_bits
1094 create_MMEnd_X0(int num)
1096 const unsigned int n = (unsigned int)num;
1097 return ((n & 0x1f) << 18);
1100 static __inline tilepro_bundle_bits
1101 create_MMEnd_X1(int num)
1103 const unsigned int n = (unsigned int)num;
1104 return (((tilepro_bundle_bits)(n & 0x1f)) << 49);
1107 static __inline tilepro_bundle_bits
1108 create_MMStart_X0(int num)
1110 const unsigned int n = (unsigned int)num;
1111 return ((n & 0x1f) << 23);
1114 static __inline tilepro_bundle_bits
1115 create_MMStart_X1(int num)
1117 const unsigned int n = (unsigned int)num;
1118 return (((tilepro_bundle_bits)(n & 0x1f)) << 54);
1121 static __inline tilepro_bundle_bits
1122 create_MT_Imm15_X1(int num)
1124 const unsigned int n = (unsigned int)num;
1125 return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
1126 (((tilepro_bundle_bits)(n & 0x00003fc0)) << 37) |
1127 (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
1130 static __inline tilepro_bundle_bits
1131 create_Mode(int num)
1133 const unsigned int n = (unsigned int)num;
1134 return (((tilepro_bundle_bits)(n & 0x1)) << 63);
1137 static __inline tilepro_bundle_bits
1138 create_NoRegOpcodeExtension_SN(int num)
1140 const unsigned int n = (unsigned int)num;
1141 return ((n & 0xf) << 0);
1144 static __inline tilepro_bundle_bits
1145 create_Opcode_SN(int num)
1147 const unsigned int n = (unsigned int)num;
1148 return ((n & 0x3f) << 10);
1151 static __inline tilepro_bundle_bits
1152 create_Opcode_X0(int num)
1154 const unsigned int n = (unsigned int)num;
1155 return ((n & 0x7) << 28);
1158 static __inline tilepro_bundle_bits
1159 create_Opcode_X1(int num)
1161 const unsigned int n = (unsigned int)num;
1162 return (((tilepro_bundle_bits)(n & 0xf)) << 59);
1165 static __inline tilepro_bundle_bits
1166 create_Opcode_Y0(int num)
1168 const unsigned int n = (unsigned int)num;
1169 return ((n & 0xf) << 27);
1172 static __inline tilepro_bundle_bits
1173 create_Opcode_Y1(int num)
1175 const unsigned int n = (unsigned int)num;
1176 return (((tilepro_bundle_bits)(n & 0xf)) << 59);
1179 static __inline tilepro_bundle_bits
1180 create_Opcode_Y2(int num)
1182 const unsigned int n = (unsigned int)num;
1183 return (((tilepro_bundle_bits)(n & 0x7)) << 56);
1186 static __inline tilepro_bundle_bits
1187 create_RROpcodeExtension_SN(int num)
1189 const unsigned int n = (unsigned int)num;
1190 return ((n & 0xf) << 4);
1193 static __inline tilepro_bundle_bits
1194 create_RRROpcodeExtension_X0(int num)
1196 const unsigned int n = (unsigned int)num;
1197 return ((n & 0x1ff) << 18);
1200 static __inline tilepro_bundle_bits
1201 create_RRROpcodeExtension_X1(int num)
1203 const unsigned int n = (unsigned int)num;
1204 return (((tilepro_bundle_bits)(n & 0x1ff)) << 49);
1207 static __inline tilepro_bundle_bits
1208 create_RRROpcodeExtension_Y0(int num)
1210 const unsigned int n = (unsigned int)num;
1211 return ((n & 0x3) << 18);
1214 static __inline tilepro_bundle_bits
1215 create_RRROpcodeExtension_Y1(int num)
1217 const unsigned int n = (unsigned int)num;
1218 return (((tilepro_bundle_bits)(n & 0x3)) << 49);
1221 static __inline tilepro_bundle_bits
1222 create_RouteOpcodeExtension_SN(int num)
1224 const unsigned int n = (unsigned int)num;
1225 return ((n & 0x3ff) << 0);
1228 static __inline tilepro_bundle_bits
1229 create_S_X0(int num)
1231 const unsigned int n = (unsigned int)num;
1232 return ((n & 0x1) << 27);
1235 static __inline tilepro_bundle_bits
1236 create_S_X1(int num)
1238 const unsigned int n = (unsigned int)num;
1239 return (((tilepro_bundle_bits)(n & 0x1)) << 58);
1242 static __inline tilepro_bundle_bits
1243 create_ShAmt_X0(int num)
1245 const unsigned int n = (unsigned int)num;
1246 return ((n & 0x1f) << 12);
1249 static __inline tilepro_bundle_bits
1250 create_ShAmt_X1(int num)
1252 const unsigned int n = (unsigned int)num;
1253 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1256 static __inline tilepro_bundle_bits
1257 create_ShAmt_Y0(int num)
1259 const unsigned int n = (unsigned int)num;
1260 return ((n & 0x1f) << 12);
1263 static __inline tilepro_bundle_bits
1264 create_ShAmt_Y1(int num)
1266 const unsigned int n = (unsigned int)num;
1267 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1270 static __inline tilepro_bundle_bits
1271 create_SrcA_X0(int num)
1273 const unsigned int n = (unsigned int)num;
1274 return ((n & 0x3f) << 6);
1277 static __inline tilepro_bundle_bits
1278 create_SrcA_X1(int num)
1280 const unsigned int n = (unsigned int)num;
1281 return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
1284 static __inline tilepro_bundle_bits
1285 create_SrcA_Y0(int num)
1287 const unsigned int n = (unsigned int)num;
1288 return ((n & 0x3f) << 6);
1291 static __inline tilepro_bundle_bits
1292 create_SrcA_Y1(int num)
1294 const unsigned int n = (unsigned int)num;
1295 return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
1298 static __inline tilepro_bundle_bits
1299 create_SrcA_Y2(int num)
1301 const unsigned int n = (unsigned int)num;
1302 return ((n & 0x00000001) << 26) |
1303 (((tilepro_bundle_bits)(n & 0x0000003e)) << 50);
1306 static __inline tilepro_bundle_bits
1307 create_SrcBDest_Y2(int num)
1309 const unsigned int n = (unsigned int)num;
1310 return ((n & 0x3f) << 20);
1313 static __inline tilepro_bundle_bits
1314 create_SrcB_X0(int num)
1316 const unsigned int n = (unsigned int)num;
1317 return ((n & 0x3f) << 12);
1320 static __inline tilepro_bundle_bits
1321 create_SrcB_X1(int num)
1323 const unsigned int n = (unsigned int)num;
1324 return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
1327 static __inline tilepro_bundle_bits
1328 create_SrcB_Y0(int num)
1330 const unsigned int n = (unsigned int)num;
1331 return ((n & 0x3f) << 12);
1334 static __inline tilepro_bundle_bits
1335 create_SrcB_Y1(int num)
1337 const unsigned int n = (unsigned int)num;
1338 return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
1341 static __inline tilepro_bundle_bits
1342 create_Src_SN(int num)
1344 const unsigned int n = (unsigned int)num;
1345 return ((n & 0x3) << 0);
1348 static __inline tilepro_bundle_bits
1349 create_UnOpcodeExtension_X0(int num)
1351 const unsigned int n = (unsigned int)num;
1352 return ((n & 0x1f) << 12);
1355 static __inline tilepro_bundle_bits
1356 create_UnOpcodeExtension_X1(int num)
1358 const unsigned int n = (unsigned int)num;
1359 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1362 static __inline tilepro_bundle_bits
1363 create_UnOpcodeExtension_Y0(int num)
1365 const unsigned int n = (unsigned int)num;
1366 return ((n & 0x1f) << 12);
1369 static __inline tilepro_bundle_bits
1370 create_UnOpcodeExtension_Y1(int num)
1372 const unsigned int n = (unsigned int)num;
1373 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1376 static __inline tilepro_bundle_bits
1377 create_UnShOpcodeExtension_X0(int num)
1379 const unsigned int n = (unsigned int)num;
1380 return ((n & 0x3ff) << 17);
1383 static __inline tilepro_bundle_bits
1384 create_UnShOpcodeExtension_X1(int num)
1386 const unsigned int n = (unsigned int)num;
1387 return (((tilepro_bundle_bits)(n & 0x3ff)) << 48);
1390 static __inline tilepro_bundle_bits
1391 create_UnShOpcodeExtension_Y0(int num)
1393 const unsigned int n = (unsigned int)num;
1394 return ((n & 0x7) << 17);
1397 static __inline tilepro_bundle_bits
1398 create_UnShOpcodeExtension_Y1(int num)
1400 const unsigned int n = (unsigned int)num;
1401 return (((tilepro_bundle_bits)(n & 0x7)) << 48);
1406 typedef enum
1408 TILEPRO_PIPELINE_X0,
1409 TILEPRO_PIPELINE_X1,
1410 TILEPRO_PIPELINE_Y0,
1411 TILEPRO_PIPELINE_Y1,
1412 TILEPRO_PIPELINE_Y2,
1413 } tilepro_pipeline;
1415 #define tilepro_is_x_pipeline(p) ((int)(p) <= (int)TILEPRO_PIPELINE_X1)
1417 typedef enum
1419 TILEPRO_OP_TYPE_REGISTER,
1420 TILEPRO_OP_TYPE_IMMEDIATE,
1421 TILEPRO_OP_TYPE_ADDRESS,
1422 TILEPRO_OP_TYPE_SPR
1423 } tilepro_operand_type;
1425 /* This is the bit that determines if a bundle is in the Y encoding. */
1426 #define TILEPRO_BUNDLE_Y_ENCODING_MASK ((tilepro_bundle_bits)1 << 63)
1428 enum
1430 /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
1431 TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
1433 /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
1434 TILEPRO_NUM_PIPELINE_ENCODINGS = 5,
1436 /* Log base 2 of TILEPRO_BUNDLE_SIZE_IN_BYTES. */
1437 TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
1439 /* Instructions take this many bytes. */
1440 TILEPRO_BUNDLE_SIZE_IN_BYTES = 1 << TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES,
1442 /* Log base 2 of TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES. */
1443 TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
1445 /* Bundles should be aligned modulo this number of bytes. */
1446 TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES =
1447 (1 << TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
1449 /* Log base 2 of TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES. */
1450 TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES = 1,
1452 /* Static network instructions take this many bytes. */
1453 TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES =
1454 (1 << TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES),
1456 /* Number of registers (some are magic, such as network I/O). */
1457 TILEPRO_NUM_REGISTERS = 64,
1459 /* Number of static network registers. */
1460 TILEPRO_NUM_SN_REGISTERS = 4
1464 struct tilepro_operand
1466 /* Is this operand a register, immediate or address? */
1467 tilepro_operand_type type;
1469 /* The default relocation type for this operand. */
1470 signed int default_reloc : 16;
1472 /* How many bits is this value? (used for range checking) */
1473 unsigned int num_bits : 5;
1475 /* Is the value signed? (used for range checking) */
1476 unsigned int is_signed : 1;
1478 /* Is this operand a source register? */
1479 unsigned int is_src_reg : 1;
1481 /* Is this operand written? (i.e. is it a destination register) */
1482 unsigned int is_dest_reg : 1;
1484 /* Is this operand PC-relative? */
1485 unsigned int is_pc_relative : 1;
1487 /* By how many bits do we right shift the value before inserting? */
1488 unsigned int rightshift : 2;
1490 /* Return the bits for this operand to be ORed into an existing bundle. */
1491 tilepro_bundle_bits (*insert) (int op);
1493 /* Extract this operand and return it. */
1494 unsigned int (*extract) (tilepro_bundle_bits bundle);
1498 extern const struct tilepro_operand tilepro_operands[];
1500 /* One finite-state machine per pipe for rapid instruction decoding. */
1501 extern const unsigned short * const
1502 tilepro_bundle_decoder_fsms[TILEPRO_NUM_PIPELINE_ENCODINGS];
1505 struct tilepro_opcode
1507 /* The opcode mnemonic, e.g. "add" */
1508 const char *name;
1510 /* The enum value for this mnemonic. */
1511 tilepro_mnemonic mnemonic;
1513 /* A bit mask of which of the five pipes this instruction
1514 is compatible with:
1515 X0 0x01
1516 X1 0x02
1517 Y0 0x04
1518 Y1 0x08
1519 Y2 0x10 */
1520 unsigned char pipes;
1522 /* How many operands are there? */
1523 unsigned char num_operands;
1525 /* Which register does this write implicitly, or TREG_ZERO if none? */
1526 unsigned char implicitly_written_register;
1528 /* Can this be bundled with other instructions (almost always true). */
1529 unsigned char can_bundle;
1531 /* The description of the operands. Each of these is an
1532 * index into the tilepro_operands[] table. */
1533 unsigned char operands[TILEPRO_NUM_PIPELINE_ENCODINGS][TILEPRO_MAX_OPERANDS];
1535 #if !defined(__KERNEL__) && !defined(_LIBC)
1536 /* A mask of which bits have predefined values for each pipeline.
1537 * This is useful for disassembly. */
1538 tilepro_bundle_bits fixed_bit_masks[TILEPRO_NUM_PIPELINE_ENCODINGS];
1540 /* For each bit set in fixed_bit_masks, what the value is for this
1541 * instruction. */
1542 tilepro_bundle_bits fixed_bit_values[TILEPRO_NUM_PIPELINE_ENCODINGS];
1543 #endif
1546 extern const struct tilepro_opcode tilepro_opcodes[];
1548 #if !defined(__KERNEL__) && !defined(_LIBC)
1550 typedef unsigned short tilepro_sn_instruction_bits;
1552 struct tilepro_sn_opcode
1554 /* The opcode mnemonic, e.g. "add" */
1555 const char *name;
1557 /* The enum value for this mnemonic. */
1558 tilepro_sn_mnemonic mnemonic;
1560 /* How many operands are there? */
1561 unsigned char num_operands;
1563 /* The description of the operands. Each of these is an
1564 * index into the tilepro_operands[] table. */
1565 unsigned char operands[TILEPRO_SN_MAX_OPERANDS];
1567 /* A mask of which bits have predefined values.
1568 * This is useful for disassembly. */
1569 tilepro_sn_instruction_bits fixed_bit_mask;
1571 /* For each bit set in fixed_bit_masks, what its value is. */
1572 tilepro_sn_instruction_bits fixed_bit_values;
1575 extern const struct tilepro_sn_opcode tilepro_sn_opcodes[];
1577 #endif /* !__KERNEL__ && !_LIBC */
1579 /* Used for non-textual disassembly into structs. */
1580 struct tilepro_decoded_instruction
1582 const struct tilepro_opcode *opcode;
1583 const struct tilepro_operand *operands[TILEPRO_MAX_OPERANDS];
1584 int operand_values[TILEPRO_MAX_OPERANDS];
1588 /* Disassemble a bundle into a struct for machine processing. */
1589 extern int parse_insn_tilepro(tilepro_bundle_bits bits,
1590 unsigned int pc,
1591 struct tilepro_decoded_instruction
1592 decoded[TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE]);
1595 /* Given a set of bundle bits and a specific pipe, returns which
1596 * instruction the bundle contains in that pipe.
1598 extern const struct tilepro_opcode *
1599 find_opcode(tilepro_bundle_bits bits, tilepro_pipeline pipe);
1602 #if !defined(__KERNEL__) && !defined(_LIBC)
1603 /* Canonical names of all the registers. */
1604 /* ISSUE: This table lives in "tilepro-dis.c" */
1605 extern const char * const tilepro_register_names[];
1607 /* Descriptor for a special-purpose register. */
1608 struct tilepro_spr
1610 /* The number */
1611 int number;
1613 /* The name */
1614 const char *name;
1617 /* List of all the SPRs; ordered by increasing number. */
1618 extern const struct tilepro_spr tilepro_sprs[];
1620 /* Number of special-purpose registers. */
1621 extern const int tilepro_num_sprs;
1623 extern const char *
1624 get_tilepro_spr_name (int num);
1625 #endif /* !__KERNEL__ && !_LIBC */
1627 /* Make a few "tile_" variables to simply common code between
1628 architectures. */
1630 typedef tilepro_bundle_bits tile_bundle_bits;
1631 #define TILE_BUNDLE_SIZE_IN_BYTES TILEPRO_BUNDLE_SIZE_IN_BYTES
1632 #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES
1633 #define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \
1634 TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
1636 #endif /* opcode_tilepro_h */