struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / sdbinutils / include / opcode / tilepro.h
blob1c30bdf9b8cb06a3e2e4311ce4a5d209a1057aa7
1 /* TILEPro opcode information.
3 * Copyright (C) 2011-2022 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_LW_TLS,
40 TILEPRO_OPC_LW_TLS_SN,
41 TILEPRO_OPC_MOVE,
42 TILEPRO_OPC_MOVE_SN,
43 TILEPRO_OPC_MOVEI,
44 TILEPRO_OPC_MOVEI_SN,
45 TILEPRO_OPC_MOVELI,
46 TILEPRO_OPC_MOVELI_SN,
47 TILEPRO_OPC_MOVELIS,
48 TILEPRO_OPC_PREFETCH,
49 TILEPRO_OPC_RAISE,
50 TILEPRO_OPC_ADD,
51 TILEPRO_OPC_ADD_SN,
52 TILEPRO_OPC_ADDB,
53 TILEPRO_OPC_ADDB_SN,
54 TILEPRO_OPC_ADDBS_U,
55 TILEPRO_OPC_ADDBS_U_SN,
56 TILEPRO_OPC_ADDH,
57 TILEPRO_OPC_ADDH_SN,
58 TILEPRO_OPC_ADDHS,
59 TILEPRO_OPC_ADDHS_SN,
60 TILEPRO_OPC_ADDI,
61 TILEPRO_OPC_ADDI_SN,
62 TILEPRO_OPC_ADDIB,
63 TILEPRO_OPC_ADDIB_SN,
64 TILEPRO_OPC_ADDIH,
65 TILEPRO_OPC_ADDIH_SN,
66 TILEPRO_OPC_ADDLI,
67 TILEPRO_OPC_ADDLI_SN,
68 TILEPRO_OPC_ADDLIS,
69 TILEPRO_OPC_ADDS,
70 TILEPRO_OPC_ADDS_SN,
71 TILEPRO_OPC_ADIFFB_U,
72 TILEPRO_OPC_ADIFFB_U_SN,
73 TILEPRO_OPC_ADIFFH,
74 TILEPRO_OPC_ADIFFH_SN,
75 TILEPRO_OPC_AND,
76 TILEPRO_OPC_AND_SN,
77 TILEPRO_OPC_ANDI,
78 TILEPRO_OPC_ANDI_SN,
79 TILEPRO_OPC_AULI,
80 TILEPRO_OPC_AVGB_U,
81 TILEPRO_OPC_AVGB_U_SN,
82 TILEPRO_OPC_AVGH,
83 TILEPRO_OPC_AVGH_SN,
84 TILEPRO_OPC_BBNS,
85 TILEPRO_OPC_BBNS_SN,
86 TILEPRO_OPC_BBNST,
87 TILEPRO_OPC_BBNST_SN,
88 TILEPRO_OPC_BBS,
89 TILEPRO_OPC_BBS_SN,
90 TILEPRO_OPC_BBST,
91 TILEPRO_OPC_BBST_SN,
92 TILEPRO_OPC_BGEZ,
93 TILEPRO_OPC_BGEZ_SN,
94 TILEPRO_OPC_BGEZT,
95 TILEPRO_OPC_BGEZT_SN,
96 TILEPRO_OPC_BGZ,
97 TILEPRO_OPC_BGZ_SN,
98 TILEPRO_OPC_BGZT,
99 TILEPRO_OPC_BGZT_SN,
100 TILEPRO_OPC_BITX,
101 TILEPRO_OPC_BITX_SN,
102 TILEPRO_OPC_BLEZ,
103 TILEPRO_OPC_BLEZ_SN,
104 TILEPRO_OPC_BLEZT,
105 TILEPRO_OPC_BLEZT_SN,
106 TILEPRO_OPC_BLZ,
107 TILEPRO_OPC_BLZ_SN,
108 TILEPRO_OPC_BLZT,
109 TILEPRO_OPC_BLZT_SN,
110 TILEPRO_OPC_BNZ,
111 TILEPRO_OPC_BNZ_SN,
112 TILEPRO_OPC_BNZT,
113 TILEPRO_OPC_BNZT_SN,
114 TILEPRO_OPC_BYTEX,
115 TILEPRO_OPC_BYTEX_SN,
116 TILEPRO_OPC_BZ,
117 TILEPRO_OPC_BZ_SN,
118 TILEPRO_OPC_BZT,
119 TILEPRO_OPC_BZT_SN,
120 TILEPRO_OPC_CLZ,
121 TILEPRO_OPC_CLZ_SN,
122 TILEPRO_OPC_CRC32_32,
123 TILEPRO_OPC_CRC32_32_SN,
124 TILEPRO_OPC_CRC32_8,
125 TILEPRO_OPC_CRC32_8_SN,
126 TILEPRO_OPC_CTZ,
127 TILEPRO_OPC_CTZ_SN,
128 TILEPRO_OPC_DRAIN,
129 TILEPRO_OPC_DTLBPR,
130 TILEPRO_OPC_DWORD_ALIGN,
131 TILEPRO_OPC_DWORD_ALIGN_SN,
132 TILEPRO_OPC_FINV,
133 TILEPRO_OPC_FLUSH,
134 TILEPRO_OPC_FNOP,
135 TILEPRO_OPC_ICOH,
136 TILEPRO_OPC_ILL,
137 TILEPRO_OPC_INTHB,
138 TILEPRO_OPC_INTHB_SN,
139 TILEPRO_OPC_INTHH,
140 TILEPRO_OPC_INTHH_SN,
141 TILEPRO_OPC_INTLB,
142 TILEPRO_OPC_INTLB_SN,
143 TILEPRO_OPC_INTLH,
144 TILEPRO_OPC_INTLH_SN,
145 TILEPRO_OPC_INV,
146 TILEPRO_OPC_IRET,
147 TILEPRO_OPC_JALB,
148 TILEPRO_OPC_JALF,
149 TILEPRO_OPC_JALR,
150 TILEPRO_OPC_JALRP,
151 TILEPRO_OPC_JB,
152 TILEPRO_OPC_JF,
153 TILEPRO_OPC_JR,
154 TILEPRO_OPC_JRP,
155 TILEPRO_OPC_LB,
156 TILEPRO_OPC_LB_SN,
157 TILEPRO_OPC_LB_U,
158 TILEPRO_OPC_LB_U_SN,
159 TILEPRO_OPC_LBADD,
160 TILEPRO_OPC_LBADD_SN,
161 TILEPRO_OPC_LBADD_U,
162 TILEPRO_OPC_LBADD_U_SN,
163 TILEPRO_OPC_LH,
164 TILEPRO_OPC_LH_SN,
165 TILEPRO_OPC_LH_U,
166 TILEPRO_OPC_LH_U_SN,
167 TILEPRO_OPC_LHADD,
168 TILEPRO_OPC_LHADD_SN,
169 TILEPRO_OPC_LHADD_U,
170 TILEPRO_OPC_LHADD_U_SN,
171 TILEPRO_OPC_LNK,
172 TILEPRO_OPC_LNK_SN,
173 TILEPRO_OPC_LW,
174 TILEPRO_OPC_LW_SN,
175 TILEPRO_OPC_LW_NA,
176 TILEPRO_OPC_LW_NA_SN,
177 TILEPRO_OPC_LWADD,
178 TILEPRO_OPC_LWADD_SN,
179 TILEPRO_OPC_LWADD_NA,
180 TILEPRO_OPC_LWADD_NA_SN,
181 TILEPRO_OPC_MAXB_U,
182 TILEPRO_OPC_MAXB_U_SN,
183 TILEPRO_OPC_MAXH,
184 TILEPRO_OPC_MAXH_SN,
185 TILEPRO_OPC_MAXIB_U,
186 TILEPRO_OPC_MAXIB_U_SN,
187 TILEPRO_OPC_MAXIH,
188 TILEPRO_OPC_MAXIH_SN,
189 TILEPRO_OPC_MF,
190 TILEPRO_OPC_MFSPR,
191 TILEPRO_OPC_MINB_U,
192 TILEPRO_OPC_MINB_U_SN,
193 TILEPRO_OPC_MINH,
194 TILEPRO_OPC_MINH_SN,
195 TILEPRO_OPC_MINIB_U,
196 TILEPRO_OPC_MINIB_U_SN,
197 TILEPRO_OPC_MINIH,
198 TILEPRO_OPC_MINIH_SN,
199 TILEPRO_OPC_MM,
200 TILEPRO_OPC_MNZ,
201 TILEPRO_OPC_MNZ_SN,
202 TILEPRO_OPC_MNZB,
203 TILEPRO_OPC_MNZB_SN,
204 TILEPRO_OPC_MNZH,
205 TILEPRO_OPC_MNZH_SN,
206 TILEPRO_OPC_MTSPR,
207 TILEPRO_OPC_MULHH_SS,
208 TILEPRO_OPC_MULHH_SS_SN,
209 TILEPRO_OPC_MULHH_SU,
210 TILEPRO_OPC_MULHH_SU_SN,
211 TILEPRO_OPC_MULHH_UU,
212 TILEPRO_OPC_MULHH_UU_SN,
213 TILEPRO_OPC_MULHHA_SS,
214 TILEPRO_OPC_MULHHA_SS_SN,
215 TILEPRO_OPC_MULHHA_SU,
216 TILEPRO_OPC_MULHHA_SU_SN,
217 TILEPRO_OPC_MULHHA_UU,
218 TILEPRO_OPC_MULHHA_UU_SN,
219 TILEPRO_OPC_MULHHSA_UU,
220 TILEPRO_OPC_MULHHSA_UU_SN,
221 TILEPRO_OPC_MULHL_SS,
222 TILEPRO_OPC_MULHL_SS_SN,
223 TILEPRO_OPC_MULHL_SU,
224 TILEPRO_OPC_MULHL_SU_SN,
225 TILEPRO_OPC_MULHL_US,
226 TILEPRO_OPC_MULHL_US_SN,
227 TILEPRO_OPC_MULHL_UU,
228 TILEPRO_OPC_MULHL_UU_SN,
229 TILEPRO_OPC_MULHLA_SS,
230 TILEPRO_OPC_MULHLA_SS_SN,
231 TILEPRO_OPC_MULHLA_SU,
232 TILEPRO_OPC_MULHLA_SU_SN,
233 TILEPRO_OPC_MULHLA_US,
234 TILEPRO_OPC_MULHLA_US_SN,
235 TILEPRO_OPC_MULHLA_UU,
236 TILEPRO_OPC_MULHLA_UU_SN,
237 TILEPRO_OPC_MULHLSA_UU,
238 TILEPRO_OPC_MULHLSA_UU_SN,
239 TILEPRO_OPC_MULLL_SS,
240 TILEPRO_OPC_MULLL_SS_SN,
241 TILEPRO_OPC_MULLL_SU,
242 TILEPRO_OPC_MULLL_SU_SN,
243 TILEPRO_OPC_MULLL_UU,
244 TILEPRO_OPC_MULLL_UU_SN,
245 TILEPRO_OPC_MULLLA_SS,
246 TILEPRO_OPC_MULLLA_SS_SN,
247 TILEPRO_OPC_MULLLA_SU,
248 TILEPRO_OPC_MULLLA_SU_SN,
249 TILEPRO_OPC_MULLLA_UU,
250 TILEPRO_OPC_MULLLA_UU_SN,
251 TILEPRO_OPC_MULLLSA_UU,
252 TILEPRO_OPC_MULLLSA_UU_SN,
253 TILEPRO_OPC_MVNZ,
254 TILEPRO_OPC_MVNZ_SN,
255 TILEPRO_OPC_MVZ,
256 TILEPRO_OPC_MVZ_SN,
257 TILEPRO_OPC_MZ,
258 TILEPRO_OPC_MZ_SN,
259 TILEPRO_OPC_MZB,
260 TILEPRO_OPC_MZB_SN,
261 TILEPRO_OPC_MZH,
262 TILEPRO_OPC_MZH_SN,
263 TILEPRO_OPC_NAP,
264 TILEPRO_OPC_NOP,
265 TILEPRO_OPC_NOR,
266 TILEPRO_OPC_NOR_SN,
267 TILEPRO_OPC_OR,
268 TILEPRO_OPC_OR_SN,
269 TILEPRO_OPC_ORI,
270 TILEPRO_OPC_ORI_SN,
271 TILEPRO_OPC_PACKBS_U,
272 TILEPRO_OPC_PACKBS_U_SN,
273 TILEPRO_OPC_PACKHB,
274 TILEPRO_OPC_PACKHB_SN,
275 TILEPRO_OPC_PACKHS,
276 TILEPRO_OPC_PACKHS_SN,
277 TILEPRO_OPC_PACKLB,
278 TILEPRO_OPC_PACKLB_SN,
279 TILEPRO_OPC_PCNT,
280 TILEPRO_OPC_PCNT_SN,
281 TILEPRO_OPC_RL,
282 TILEPRO_OPC_RL_SN,
283 TILEPRO_OPC_RLI,
284 TILEPRO_OPC_RLI_SN,
285 TILEPRO_OPC_S1A,
286 TILEPRO_OPC_S1A_SN,
287 TILEPRO_OPC_S2A,
288 TILEPRO_OPC_S2A_SN,
289 TILEPRO_OPC_S3A,
290 TILEPRO_OPC_S3A_SN,
291 TILEPRO_OPC_SADAB_U,
292 TILEPRO_OPC_SADAB_U_SN,
293 TILEPRO_OPC_SADAH,
294 TILEPRO_OPC_SADAH_SN,
295 TILEPRO_OPC_SADAH_U,
296 TILEPRO_OPC_SADAH_U_SN,
297 TILEPRO_OPC_SADB_U,
298 TILEPRO_OPC_SADB_U_SN,
299 TILEPRO_OPC_SADH,
300 TILEPRO_OPC_SADH_SN,
301 TILEPRO_OPC_SADH_U,
302 TILEPRO_OPC_SADH_U_SN,
303 TILEPRO_OPC_SB,
304 TILEPRO_OPC_SBADD,
305 TILEPRO_OPC_SEQ,
306 TILEPRO_OPC_SEQ_SN,
307 TILEPRO_OPC_SEQB,
308 TILEPRO_OPC_SEQB_SN,
309 TILEPRO_OPC_SEQH,
310 TILEPRO_OPC_SEQH_SN,
311 TILEPRO_OPC_SEQI,
312 TILEPRO_OPC_SEQI_SN,
313 TILEPRO_OPC_SEQIB,
314 TILEPRO_OPC_SEQIB_SN,
315 TILEPRO_OPC_SEQIH,
316 TILEPRO_OPC_SEQIH_SN,
317 TILEPRO_OPC_SH,
318 TILEPRO_OPC_SHADD,
319 TILEPRO_OPC_SHL,
320 TILEPRO_OPC_SHL_SN,
321 TILEPRO_OPC_SHLB,
322 TILEPRO_OPC_SHLB_SN,
323 TILEPRO_OPC_SHLH,
324 TILEPRO_OPC_SHLH_SN,
325 TILEPRO_OPC_SHLI,
326 TILEPRO_OPC_SHLI_SN,
327 TILEPRO_OPC_SHLIB,
328 TILEPRO_OPC_SHLIB_SN,
329 TILEPRO_OPC_SHLIH,
330 TILEPRO_OPC_SHLIH_SN,
331 TILEPRO_OPC_SHR,
332 TILEPRO_OPC_SHR_SN,
333 TILEPRO_OPC_SHRB,
334 TILEPRO_OPC_SHRB_SN,
335 TILEPRO_OPC_SHRH,
336 TILEPRO_OPC_SHRH_SN,
337 TILEPRO_OPC_SHRI,
338 TILEPRO_OPC_SHRI_SN,
339 TILEPRO_OPC_SHRIB,
340 TILEPRO_OPC_SHRIB_SN,
341 TILEPRO_OPC_SHRIH,
342 TILEPRO_OPC_SHRIH_SN,
343 TILEPRO_OPC_SLT,
344 TILEPRO_OPC_SLT_SN,
345 TILEPRO_OPC_SLT_U,
346 TILEPRO_OPC_SLT_U_SN,
347 TILEPRO_OPC_SLTB,
348 TILEPRO_OPC_SLTB_SN,
349 TILEPRO_OPC_SLTB_U,
350 TILEPRO_OPC_SLTB_U_SN,
351 TILEPRO_OPC_SLTE,
352 TILEPRO_OPC_SLTE_SN,
353 TILEPRO_OPC_SLTE_U,
354 TILEPRO_OPC_SLTE_U_SN,
355 TILEPRO_OPC_SLTEB,
356 TILEPRO_OPC_SLTEB_SN,
357 TILEPRO_OPC_SLTEB_U,
358 TILEPRO_OPC_SLTEB_U_SN,
359 TILEPRO_OPC_SLTEH,
360 TILEPRO_OPC_SLTEH_SN,
361 TILEPRO_OPC_SLTEH_U,
362 TILEPRO_OPC_SLTEH_U_SN,
363 TILEPRO_OPC_SLTH,
364 TILEPRO_OPC_SLTH_SN,
365 TILEPRO_OPC_SLTH_U,
366 TILEPRO_OPC_SLTH_U_SN,
367 TILEPRO_OPC_SLTI,
368 TILEPRO_OPC_SLTI_SN,
369 TILEPRO_OPC_SLTI_U,
370 TILEPRO_OPC_SLTI_U_SN,
371 TILEPRO_OPC_SLTIB,
372 TILEPRO_OPC_SLTIB_SN,
373 TILEPRO_OPC_SLTIB_U,
374 TILEPRO_OPC_SLTIB_U_SN,
375 TILEPRO_OPC_SLTIH,
376 TILEPRO_OPC_SLTIH_SN,
377 TILEPRO_OPC_SLTIH_U,
378 TILEPRO_OPC_SLTIH_U_SN,
379 TILEPRO_OPC_SNE,
380 TILEPRO_OPC_SNE_SN,
381 TILEPRO_OPC_SNEB,
382 TILEPRO_OPC_SNEB_SN,
383 TILEPRO_OPC_SNEH,
384 TILEPRO_OPC_SNEH_SN,
385 TILEPRO_OPC_SRA,
386 TILEPRO_OPC_SRA_SN,
387 TILEPRO_OPC_SRAB,
388 TILEPRO_OPC_SRAB_SN,
389 TILEPRO_OPC_SRAH,
390 TILEPRO_OPC_SRAH_SN,
391 TILEPRO_OPC_SRAI,
392 TILEPRO_OPC_SRAI_SN,
393 TILEPRO_OPC_SRAIB,
394 TILEPRO_OPC_SRAIB_SN,
395 TILEPRO_OPC_SRAIH,
396 TILEPRO_OPC_SRAIH_SN,
397 TILEPRO_OPC_SUB,
398 TILEPRO_OPC_SUB_SN,
399 TILEPRO_OPC_SUBB,
400 TILEPRO_OPC_SUBB_SN,
401 TILEPRO_OPC_SUBBS_U,
402 TILEPRO_OPC_SUBBS_U_SN,
403 TILEPRO_OPC_SUBH,
404 TILEPRO_OPC_SUBH_SN,
405 TILEPRO_OPC_SUBHS,
406 TILEPRO_OPC_SUBHS_SN,
407 TILEPRO_OPC_SUBS,
408 TILEPRO_OPC_SUBS_SN,
409 TILEPRO_OPC_SW,
410 TILEPRO_OPC_SWADD,
411 TILEPRO_OPC_SWINT0,
412 TILEPRO_OPC_SWINT1,
413 TILEPRO_OPC_SWINT2,
414 TILEPRO_OPC_SWINT3,
415 TILEPRO_OPC_TBLIDXB0,
416 TILEPRO_OPC_TBLIDXB0_SN,
417 TILEPRO_OPC_TBLIDXB1,
418 TILEPRO_OPC_TBLIDXB1_SN,
419 TILEPRO_OPC_TBLIDXB2,
420 TILEPRO_OPC_TBLIDXB2_SN,
421 TILEPRO_OPC_TBLIDXB3,
422 TILEPRO_OPC_TBLIDXB3_SN,
423 TILEPRO_OPC_TNS,
424 TILEPRO_OPC_TNS_SN,
425 TILEPRO_OPC_WH64,
426 TILEPRO_OPC_XOR,
427 TILEPRO_OPC_XOR_SN,
428 TILEPRO_OPC_XORI,
429 TILEPRO_OPC_XORI_SN,
430 TILEPRO_OPC_NONE
431 } tilepro_mnemonic;
433 /* 64-bit pattern for a { bpt ; nop } bundle. */
434 #define TILEPRO_BPT_BUNDLE 0x400b3cae70166000ULL
436 #ifndef DISASM_ONLY
438 enum
440 TILEPRO_SN_MAX_OPERANDS = 6 /* route */
443 typedef enum
445 TILEPRO_SN_OPC_BZ,
446 TILEPRO_SN_OPC_BNZ,
447 TILEPRO_SN_OPC_JRR,
448 TILEPRO_SN_OPC_FNOP,
449 TILEPRO_SN_OPC_BLZ,
450 TILEPRO_SN_OPC_NOP,
451 TILEPRO_SN_OPC_MOVEI,
452 TILEPRO_SN_OPC_MOVE,
453 TILEPRO_SN_OPC_BGEZ,
454 TILEPRO_SN_OPC_JR,
455 TILEPRO_SN_OPC_BLEZ,
456 TILEPRO_SN_OPC_BBNS,
457 TILEPRO_SN_OPC_JALRR,
458 TILEPRO_SN_OPC_BPT,
459 TILEPRO_SN_OPC_JALR,
460 TILEPRO_SN_OPC_SHR1,
461 TILEPRO_SN_OPC_BGZ,
462 TILEPRO_SN_OPC_BBS,
463 TILEPRO_SN_OPC_SHL8II,
464 TILEPRO_SN_OPC_ADDI,
465 TILEPRO_SN_OPC_HALT,
466 TILEPRO_SN_OPC_ROUTE,
467 TILEPRO_SN_OPC_NONE
468 } tilepro_sn_mnemonic;
470 extern const unsigned char tilepro_sn_route_encode[6 * 6 * 6];
471 extern const signed char tilepro_sn_route_decode[256][3];
472 extern const char tilepro_sn_direction_names[6][5];
473 extern const signed char tilepro_sn_dest_map[6][6];
474 #endif /* DISASM_ONLY */
477 static __inline unsigned int
478 get_BrOff_SN(tilepro_bundle_bits num)
480 const unsigned int n = (unsigned int)num;
481 return (((n >> 0)) & 0x3ff);
484 static __inline unsigned int
485 get_BrOff_X1(tilepro_bundle_bits n)
487 return (((unsigned int)(n >> 43)) & 0x00007fff) |
488 (((unsigned int)(n >> 20)) & 0x00018000);
491 static __inline unsigned int
492 get_BrType_X1(tilepro_bundle_bits n)
494 return (((unsigned int)(n >> 31)) & 0xf);
497 static __inline unsigned int
498 get_Dest_Imm8_X1(tilepro_bundle_bits n)
500 return (((unsigned int)(n >> 31)) & 0x0000003f) |
501 (((unsigned int)(n >> 43)) & 0x000000c0);
504 static __inline unsigned int
505 get_Dest_SN(tilepro_bundle_bits num)
507 const unsigned int n = (unsigned int)num;
508 return (((n >> 2)) & 0x3);
511 static __inline unsigned int
512 get_Dest_X0(tilepro_bundle_bits num)
514 const unsigned int n = (unsigned int)num;
515 return (((n >> 0)) & 0x3f);
518 static __inline unsigned int
519 get_Dest_X1(tilepro_bundle_bits n)
521 return (((unsigned int)(n >> 31)) & 0x3f);
524 static __inline unsigned int
525 get_Dest_Y0(tilepro_bundle_bits num)
527 const unsigned int n = (unsigned int)num;
528 return (((n >> 0)) & 0x3f);
531 static __inline unsigned int
532 get_Dest_Y1(tilepro_bundle_bits n)
534 return (((unsigned int)(n >> 31)) & 0x3f);
537 static __inline unsigned int
538 get_Imm16_X0(tilepro_bundle_bits num)
540 const unsigned int n = (unsigned int)num;
541 return (((n >> 12)) & 0xffff);
544 static __inline unsigned int
545 get_Imm16_X1(tilepro_bundle_bits n)
547 return (((unsigned int)(n >> 43)) & 0xffff);
550 static __inline unsigned int
551 get_Imm8_SN(tilepro_bundle_bits num)
553 const unsigned int n = (unsigned int)num;
554 return (((n >> 0)) & 0xff);
557 static __inline unsigned int
558 get_Imm8_X0(tilepro_bundle_bits num)
560 const unsigned int n = (unsigned int)num;
561 return (((n >> 12)) & 0xff);
564 static __inline unsigned int
565 get_Imm8_X1(tilepro_bundle_bits n)
567 return (((unsigned int)(n >> 43)) & 0xff);
570 static __inline unsigned int
571 get_Imm8_Y0(tilepro_bundle_bits num)
573 const unsigned int n = (unsigned int)num;
574 return (((n >> 12)) & 0xff);
577 static __inline unsigned int
578 get_Imm8_Y1(tilepro_bundle_bits n)
580 return (((unsigned int)(n >> 43)) & 0xff);
583 static __inline unsigned int
584 get_ImmOpcodeExtension_X0(tilepro_bundle_bits num)
586 const unsigned int n = (unsigned int)num;
587 return (((n >> 20)) & 0x7f);
590 static __inline unsigned int
591 get_ImmOpcodeExtension_X1(tilepro_bundle_bits n)
593 return (((unsigned int)(n >> 51)) & 0x7f);
596 static __inline unsigned int
597 get_ImmRROpcodeExtension_SN(tilepro_bundle_bits num)
599 const unsigned int n = (unsigned int)num;
600 return (((n >> 8)) & 0x3);
603 static __inline unsigned int
604 get_JOffLong_X1(tilepro_bundle_bits n)
606 return (((unsigned int)(n >> 43)) & 0x00007fff) |
607 (((unsigned int)(n >> 20)) & 0x00018000) |
608 (((unsigned int)(n >> 14)) & 0x001e0000) |
609 (((unsigned int)(n >> 16)) & 0x07e00000) |
610 (((unsigned int)(n >> 31)) & 0x18000000);
613 static __inline unsigned int
614 get_JOff_X1(tilepro_bundle_bits n)
616 return (((unsigned int)(n >> 43)) & 0x00007fff) |
617 (((unsigned int)(n >> 20)) & 0x00018000) |
618 (((unsigned int)(n >> 14)) & 0x001e0000) |
619 (((unsigned int)(n >> 16)) & 0x07e00000) |
620 (((unsigned int)(n >> 31)) & 0x08000000);
623 static __inline unsigned int
624 get_MF_Imm15_X1(tilepro_bundle_bits n)
626 return (((unsigned int)(n >> 37)) & 0x00003fff) |
627 (((unsigned int)(n >> 44)) & 0x00004000);
630 static __inline unsigned int
631 get_MMEnd_X0(tilepro_bundle_bits num)
633 const unsigned int n = (unsigned int)num;
634 return (((n >> 18)) & 0x1f);
637 static __inline unsigned int
638 get_MMEnd_X1(tilepro_bundle_bits n)
640 return (((unsigned int)(n >> 49)) & 0x1f);
643 static __inline unsigned int
644 get_MMStart_X0(tilepro_bundle_bits num)
646 const unsigned int n = (unsigned int)num;
647 return (((n >> 23)) & 0x1f);
650 static __inline unsigned int
651 get_MMStart_X1(tilepro_bundle_bits n)
653 return (((unsigned int)(n >> 54)) & 0x1f);
656 static __inline unsigned int
657 get_MT_Imm15_X1(tilepro_bundle_bits n)
659 return (((unsigned int)(n >> 31)) & 0x0000003f) |
660 (((unsigned int)(n >> 37)) & 0x00003fc0) |
661 (((unsigned int)(n >> 44)) & 0x00004000);
664 static __inline unsigned int
665 get_Mode(tilepro_bundle_bits n)
667 return (((unsigned int)(n >> 63)) & 0x1);
670 static __inline unsigned int
671 get_NoRegOpcodeExtension_SN(tilepro_bundle_bits num)
673 const unsigned int n = (unsigned int)num;
674 return (((n >> 0)) & 0xf);
677 static __inline unsigned int
678 get_Opcode_SN(tilepro_bundle_bits num)
680 const unsigned int n = (unsigned int)num;
681 return (((n >> 10)) & 0x3f);
684 static __inline unsigned int
685 get_Opcode_X0(tilepro_bundle_bits num)
687 const unsigned int n = (unsigned int)num;
688 return (((n >> 28)) & 0x7);
691 static __inline unsigned int
692 get_Opcode_X1(tilepro_bundle_bits n)
694 return (((unsigned int)(n >> 59)) & 0xf);
697 static __inline unsigned int
698 get_Opcode_Y0(tilepro_bundle_bits num)
700 const unsigned int n = (unsigned int)num;
701 return (((n >> 27)) & 0xf);
704 static __inline unsigned int
705 get_Opcode_Y1(tilepro_bundle_bits n)
707 return (((unsigned int)(n >> 59)) & 0xf);
710 static __inline unsigned int
711 get_Opcode_Y2(tilepro_bundle_bits n)
713 return (((unsigned int)(n >> 56)) & 0x7);
716 static __inline unsigned int
717 get_RROpcodeExtension_SN(tilepro_bundle_bits num)
719 const unsigned int n = (unsigned int)num;
720 return (((n >> 4)) & 0xf);
723 static __inline unsigned int
724 get_RRROpcodeExtension_X0(tilepro_bundle_bits num)
726 const unsigned int n = (unsigned int)num;
727 return (((n >> 18)) & 0x1ff);
730 static __inline unsigned int
731 get_RRROpcodeExtension_X1(tilepro_bundle_bits n)
733 return (((unsigned int)(n >> 49)) & 0x1ff);
736 static __inline unsigned int
737 get_RRROpcodeExtension_Y0(tilepro_bundle_bits num)
739 const unsigned int n = (unsigned int)num;
740 return (((n >> 18)) & 0x3);
743 static __inline unsigned int
744 get_RRROpcodeExtension_Y1(tilepro_bundle_bits n)
746 return (((unsigned int)(n >> 49)) & 0x3);
749 static __inline unsigned int
750 get_RouteOpcodeExtension_SN(tilepro_bundle_bits num)
752 const unsigned int n = (unsigned int)num;
753 return (((n >> 0)) & 0x3ff);
756 static __inline unsigned int
757 get_S_X0(tilepro_bundle_bits num)
759 const unsigned int n = (unsigned int)num;
760 return (((n >> 27)) & 0x1);
763 static __inline unsigned int
764 get_S_X1(tilepro_bundle_bits n)
766 return (((unsigned int)(n >> 58)) & 0x1);
769 static __inline unsigned int
770 get_ShAmt_X0(tilepro_bundle_bits num)
772 const unsigned int n = (unsigned int)num;
773 return (((n >> 12)) & 0x1f);
776 static __inline unsigned int
777 get_ShAmt_X1(tilepro_bundle_bits n)
779 return (((unsigned int)(n >> 43)) & 0x1f);
782 static __inline unsigned int
783 get_ShAmt_Y0(tilepro_bundle_bits num)
785 const unsigned int n = (unsigned int)num;
786 return (((n >> 12)) & 0x1f);
789 static __inline unsigned int
790 get_ShAmt_Y1(tilepro_bundle_bits n)
792 return (((unsigned int)(n >> 43)) & 0x1f);
795 static __inline unsigned int
796 get_SrcA_X0(tilepro_bundle_bits num)
798 const unsigned int n = (unsigned int)num;
799 return (((n >> 6)) & 0x3f);
802 static __inline unsigned int
803 get_SrcA_X1(tilepro_bundle_bits n)
805 return (((unsigned int)(n >> 37)) & 0x3f);
808 static __inline unsigned int
809 get_SrcA_Y0(tilepro_bundle_bits num)
811 const unsigned int n = (unsigned int)num;
812 return (((n >> 6)) & 0x3f);
815 static __inline unsigned int
816 get_SrcA_Y1(tilepro_bundle_bits n)
818 return (((unsigned int)(n >> 37)) & 0x3f);
821 static __inline unsigned int
822 get_SrcA_Y2(tilepro_bundle_bits n)
824 return (((n >> 26)) & 0x00000001) |
825 (((unsigned int)(n >> 50)) & 0x0000003e);
828 static __inline unsigned int
829 get_SrcBDest_Y2(tilepro_bundle_bits num)
831 const unsigned int n = (unsigned int)num;
832 return (((n >> 20)) & 0x3f);
835 static __inline unsigned int
836 get_SrcB_X0(tilepro_bundle_bits num)
838 const unsigned int n = (unsigned int)num;
839 return (((n >> 12)) & 0x3f);
842 static __inline unsigned int
843 get_SrcB_X1(tilepro_bundle_bits n)
845 return (((unsigned int)(n >> 43)) & 0x3f);
848 static __inline unsigned int
849 get_SrcB_Y0(tilepro_bundle_bits num)
851 const unsigned int n = (unsigned int)num;
852 return (((n >> 12)) & 0x3f);
855 static __inline unsigned int
856 get_SrcB_Y1(tilepro_bundle_bits n)
858 return (((unsigned int)(n >> 43)) & 0x3f);
861 static __inline unsigned int
862 get_Src_SN(tilepro_bundle_bits num)
864 const unsigned int n = (unsigned int)num;
865 return (((n >> 0)) & 0x3);
868 static __inline unsigned int
869 get_UnOpcodeExtension_X0(tilepro_bundle_bits num)
871 const unsigned int n = (unsigned int)num;
872 return (((n >> 12)) & 0x1f);
875 static __inline unsigned int
876 get_UnOpcodeExtension_X1(tilepro_bundle_bits n)
878 return (((unsigned int)(n >> 43)) & 0x1f);
881 static __inline unsigned int
882 get_UnOpcodeExtension_Y0(tilepro_bundle_bits num)
884 const unsigned int n = (unsigned int)num;
885 return (((n >> 12)) & 0x1f);
888 static __inline unsigned int
889 get_UnOpcodeExtension_Y1(tilepro_bundle_bits n)
891 return (((unsigned int)(n >> 43)) & 0x1f);
894 static __inline unsigned int
895 get_UnShOpcodeExtension_X0(tilepro_bundle_bits num)
897 const unsigned int n = (unsigned int)num;
898 return (((n >> 17)) & 0x3ff);
901 static __inline unsigned int
902 get_UnShOpcodeExtension_X1(tilepro_bundle_bits n)
904 return (((unsigned int)(n >> 48)) & 0x3ff);
907 static __inline unsigned int
908 get_UnShOpcodeExtension_Y0(tilepro_bundle_bits num)
910 const unsigned int n = (unsigned int)num;
911 return (((n >> 17)) & 0x7);
914 static __inline unsigned int
915 get_UnShOpcodeExtension_Y1(tilepro_bundle_bits n)
917 return (((unsigned int)(n >> 48)) & 0x7);
921 static __inline int
922 sign_extend(int n, int num_bits)
924 int shift = (int)(sizeof(int) * 8 - num_bits);
925 return (n << shift) >> shift;
930 static __inline tilepro_bundle_bits
931 create_BrOff_SN(int num)
933 const unsigned int n = (unsigned int)num;
934 return ((n & 0x3ff) << 0);
937 static __inline tilepro_bundle_bits
938 create_BrOff_X1(int num)
940 const unsigned int n = (unsigned int)num;
941 return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
942 (((tilepro_bundle_bits)(n & 0x00018000)) << 20);
945 static __inline tilepro_bundle_bits
946 create_BrType_X1(int num)
948 const unsigned int n = (unsigned int)num;
949 return (((tilepro_bundle_bits)(n & 0xf)) << 31);
952 static __inline tilepro_bundle_bits
953 create_Dest_Imm8_X1(int num)
955 const unsigned int n = (unsigned int)num;
956 return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
957 (((tilepro_bundle_bits)(n & 0x000000c0)) << 43);
960 static __inline tilepro_bundle_bits
961 create_Dest_SN(int num)
963 const unsigned int n = (unsigned int)num;
964 return ((n & 0x3) << 2);
967 static __inline tilepro_bundle_bits
968 create_Dest_X0(int num)
970 const unsigned int n = (unsigned int)num;
971 return ((n & 0x3f) << 0);
974 static __inline tilepro_bundle_bits
975 create_Dest_X1(int num)
977 const unsigned int n = (unsigned int)num;
978 return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
981 static __inline tilepro_bundle_bits
982 create_Dest_Y0(int num)
984 const unsigned int n = (unsigned int)num;
985 return ((n & 0x3f) << 0);
988 static __inline tilepro_bundle_bits
989 create_Dest_Y1(int num)
991 const unsigned int n = (unsigned int)num;
992 return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
995 static __inline tilepro_bundle_bits
996 create_Imm16_X0(int num)
998 const unsigned int n = (unsigned int)num;
999 return ((n & 0xffff) << 12);
1002 static __inline tilepro_bundle_bits
1003 create_Imm16_X1(int num)
1005 const unsigned int n = (unsigned int)num;
1006 return (((tilepro_bundle_bits)(n & 0xffff)) << 43);
1009 static __inline tilepro_bundle_bits
1010 create_Imm8_SN(int num)
1012 const unsigned int n = (unsigned int)num;
1013 return ((n & 0xff) << 0);
1016 static __inline tilepro_bundle_bits
1017 create_Imm8_X0(int num)
1019 const unsigned int n = (unsigned int)num;
1020 return ((n & 0xff) << 12);
1023 static __inline tilepro_bundle_bits
1024 create_Imm8_X1(int num)
1026 const unsigned int n = (unsigned int)num;
1027 return (((tilepro_bundle_bits)(n & 0xff)) << 43);
1030 static __inline tilepro_bundle_bits
1031 create_Imm8_Y0(int num)
1033 const unsigned int n = (unsigned int)num;
1034 return ((n & 0xff) << 12);
1037 static __inline tilepro_bundle_bits
1038 create_Imm8_Y1(int num)
1040 const unsigned int n = (unsigned int)num;
1041 return (((tilepro_bundle_bits)(n & 0xff)) << 43);
1044 static __inline tilepro_bundle_bits
1045 create_ImmOpcodeExtension_X0(int num)
1047 const unsigned int n = (unsigned int)num;
1048 return ((n & 0x7f) << 20);
1051 static __inline tilepro_bundle_bits
1052 create_ImmOpcodeExtension_X1(int num)
1054 const unsigned int n = (unsigned int)num;
1055 return (((tilepro_bundle_bits)(n & 0x7f)) << 51);
1058 static __inline tilepro_bundle_bits
1059 create_ImmRROpcodeExtension_SN(int num)
1061 const unsigned int n = (unsigned int)num;
1062 return ((n & 0x3) << 8);
1065 static __inline tilepro_bundle_bits
1066 create_JOffLong_X1(int num)
1068 const unsigned int n = (unsigned int)num;
1069 return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
1070 (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
1071 (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
1072 (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
1073 (((tilepro_bundle_bits)(n & 0x18000000)) << 31);
1076 static __inline tilepro_bundle_bits
1077 create_JOff_X1(int num)
1079 const unsigned int n = (unsigned int)num;
1080 return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
1081 (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
1082 (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
1083 (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
1084 (((tilepro_bundle_bits)(n & 0x08000000)) << 31);
1087 static __inline tilepro_bundle_bits
1088 create_MF_Imm15_X1(int num)
1090 const unsigned int n = (unsigned int)num;
1091 return (((tilepro_bundle_bits)(n & 0x00003fff)) << 37) |
1092 (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
1095 static __inline tilepro_bundle_bits
1096 create_MMEnd_X0(int num)
1098 const unsigned int n = (unsigned int)num;
1099 return ((n & 0x1f) << 18);
1102 static __inline tilepro_bundle_bits
1103 create_MMEnd_X1(int num)
1105 const unsigned int n = (unsigned int)num;
1106 return (((tilepro_bundle_bits)(n & 0x1f)) << 49);
1109 static __inline tilepro_bundle_bits
1110 create_MMStart_X0(int num)
1112 const unsigned int n = (unsigned int)num;
1113 return ((n & 0x1f) << 23);
1116 static __inline tilepro_bundle_bits
1117 create_MMStart_X1(int num)
1119 const unsigned int n = (unsigned int)num;
1120 return (((tilepro_bundle_bits)(n & 0x1f)) << 54);
1123 static __inline tilepro_bundle_bits
1124 create_MT_Imm15_X1(int num)
1126 const unsigned int n = (unsigned int)num;
1127 return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
1128 (((tilepro_bundle_bits)(n & 0x00003fc0)) << 37) |
1129 (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
1132 static __inline tilepro_bundle_bits
1133 create_Mode(int num)
1135 const unsigned int n = (unsigned int)num;
1136 return (((tilepro_bundle_bits)(n & 0x1)) << 63);
1139 static __inline tilepro_bundle_bits
1140 create_NoRegOpcodeExtension_SN(int num)
1142 const unsigned int n = (unsigned int)num;
1143 return ((n & 0xf) << 0);
1146 static __inline tilepro_bundle_bits
1147 create_Opcode_SN(int num)
1149 const unsigned int n = (unsigned int)num;
1150 return ((n & 0x3f) << 10);
1153 static __inline tilepro_bundle_bits
1154 create_Opcode_X0(int num)
1156 const unsigned int n = (unsigned int)num;
1157 return ((n & 0x7) << 28);
1160 static __inline tilepro_bundle_bits
1161 create_Opcode_X1(int num)
1163 const unsigned int n = (unsigned int)num;
1164 return (((tilepro_bundle_bits)(n & 0xf)) << 59);
1167 static __inline tilepro_bundle_bits
1168 create_Opcode_Y0(int num)
1170 const unsigned int n = (unsigned int)num;
1171 return ((n & 0xf) << 27);
1174 static __inline tilepro_bundle_bits
1175 create_Opcode_Y1(int num)
1177 const unsigned int n = (unsigned int)num;
1178 return (((tilepro_bundle_bits)(n & 0xf)) << 59);
1181 static __inline tilepro_bundle_bits
1182 create_Opcode_Y2(int num)
1184 const unsigned int n = (unsigned int)num;
1185 return (((tilepro_bundle_bits)(n & 0x7)) << 56);
1188 static __inline tilepro_bundle_bits
1189 create_RROpcodeExtension_SN(int num)
1191 const unsigned int n = (unsigned int)num;
1192 return ((n & 0xf) << 4);
1195 static __inline tilepro_bundle_bits
1196 create_RRROpcodeExtension_X0(int num)
1198 const unsigned int n = (unsigned int)num;
1199 return ((n & 0x1ff) << 18);
1202 static __inline tilepro_bundle_bits
1203 create_RRROpcodeExtension_X1(int num)
1205 const unsigned int n = (unsigned int)num;
1206 return (((tilepro_bundle_bits)(n & 0x1ff)) << 49);
1209 static __inline tilepro_bundle_bits
1210 create_RRROpcodeExtension_Y0(int num)
1212 const unsigned int n = (unsigned int)num;
1213 return ((n & 0x3) << 18);
1216 static __inline tilepro_bundle_bits
1217 create_RRROpcodeExtension_Y1(int num)
1219 const unsigned int n = (unsigned int)num;
1220 return (((tilepro_bundle_bits)(n & 0x3)) << 49);
1223 static __inline tilepro_bundle_bits
1224 create_RouteOpcodeExtension_SN(int num)
1226 const unsigned int n = (unsigned int)num;
1227 return ((n & 0x3ff) << 0);
1230 static __inline tilepro_bundle_bits
1231 create_S_X0(int num)
1233 const unsigned int n = (unsigned int)num;
1234 return ((n & 0x1) << 27);
1237 static __inline tilepro_bundle_bits
1238 create_S_X1(int num)
1240 const unsigned int n = (unsigned int)num;
1241 return (((tilepro_bundle_bits)(n & 0x1)) << 58);
1244 static __inline tilepro_bundle_bits
1245 create_ShAmt_X0(int num)
1247 const unsigned int n = (unsigned int)num;
1248 return ((n & 0x1f) << 12);
1251 static __inline tilepro_bundle_bits
1252 create_ShAmt_X1(int num)
1254 const unsigned int n = (unsigned int)num;
1255 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1258 static __inline tilepro_bundle_bits
1259 create_ShAmt_Y0(int num)
1261 const unsigned int n = (unsigned int)num;
1262 return ((n & 0x1f) << 12);
1265 static __inline tilepro_bundle_bits
1266 create_ShAmt_Y1(int num)
1268 const unsigned int n = (unsigned int)num;
1269 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1272 static __inline tilepro_bundle_bits
1273 create_SrcA_X0(int num)
1275 const unsigned int n = (unsigned int)num;
1276 return ((n & 0x3f) << 6);
1279 static __inline tilepro_bundle_bits
1280 create_SrcA_X1(int num)
1282 const unsigned int n = (unsigned int)num;
1283 return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
1286 static __inline tilepro_bundle_bits
1287 create_SrcA_Y0(int num)
1289 const unsigned int n = (unsigned int)num;
1290 return ((n & 0x3f) << 6);
1293 static __inline tilepro_bundle_bits
1294 create_SrcA_Y1(int num)
1296 const unsigned int n = (unsigned int)num;
1297 return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
1300 static __inline tilepro_bundle_bits
1301 create_SrcA_Y2(int num)
1303 const unsigned int n = (unsigned int)num;
1304 return ((n & 0x00000001) << 26) |
1305 (((tilepro_bundle_bits)(n & 0x0000003e)) << 50);
1308 static __inline tilepro_bundle_bits
1309 create_SrcBDest_Y2(int num)
1311 const unsigned int n = (unsigned int)num;
1312 return ((n & 0x3f) << 20);
1315 static __inline tilepro_bundle_bits
1316 create_SrcB_X0(int num)
1318 const unsigned int n = (unsigned int)num;
1319 return ((n & 0x3f) << 12);
1322 static __inline tilepro_bundle_bits
1323 create_SrcB_X1(int num)
1325 const unsigned int n = (unsigned int)num;
1326 return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
1329 static __inline tilepro_bundle_bits
1330 create_SrcB_Y0(int num)
1332 const unsigned int n = (unsigned int)num;
1333 return ((n & 0x3f) << 12);
1336 static __inline tilepro_bundle_bits
1337 create_SrcB_Y1(int num)
1339 const unsigned int n = (unsigned int)num;
1340 return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
1343 static __inline tilepro_bundle_bits
1344 create_Src_SN(int num)
1346 const unsigned int n = (unsigned int)num;
1347 return ((n & 0x3) << 0);
1350 static __inline tilepro_bundle_bits
1351 create_UnOpcodeExtension_X0(int num)
1353 const unsigned int n = (unsigned int)num;
1354 return ((n & 0x1f) << 12);
1357 static __inline tilepro_bundle_bits
1358 create_UnOpcodeExtension_X1(int num)
1360 const unsigned int n = (unsigned int)num;
1361 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1364 static __inline tilepro_bundle_bits
1365 create_UnOpcodeExtension_Y0(int num)
1367 const unsigned int n = (unsigned int)num;
1368 return ((n & 0x1f) << 12);
1371 static __inline tilepro_bundle_bits
1372 create_UnOpcodeExtension_Y1(int num)
1374 const unsigned int n = (unsigned int)num;
1375 return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1378 static __inline tilepro_bundle_bits
1379 create_UnShOpcodeExtension_X0(int num)
1381 const unsigned int n = (unsigned int)num;
1382 return ((n & 0x3ff) << 17);
1385 static __inline tilepro_bundle_bits
1386 create_UnShOpcodeExtension_X1(int num)
1388 const unsigned int n = (unsigned int)num;
1389 return (((tilepro_bundle_bits)(n & 0x3ff)) << 48);
1392 static __inline tilepro_bundle_bits
1393 create_UnShOpcodeExtension_Y0(int num)
1395 const unsigned int n = (unsigned int)num;
1396 return ((n & 0x7) << 17);
1399 static __inline tilepro_bundle_bits
1400 create_UnShOpcodeExtension_Y1(int num)
1402 const unsigned int n = (unsigned int)num;
1403 return (((tilepro_bundle_bits)(n & 0x7)) << 48);
1408 typedef enum
1410 TILEPRO_PIPELINE_X0,
1411 TILEPRO_PIPELINE_X1,
1412 TILEPRO_PIPELINE_Y0,
1413 TILEPRO_PIPELINE_Y1,
1414 TILEPRO_PIPELINE_Y2,
1415 TILEPRO_NUM_PIPELINE_ENCODINGS
1416 } tilepro_pipeline;
1418 #define tilepro_is_x_pipeline(p) ((int)(p) <= (int)TILEPRO_PIPELINE_X1)
1420 typedef enum
1422 TILEPRO_OP_TYPE_REGISTER,
1423 TILEPRO_OP_TYPE_IMMEDIATE,
1424 TILEPRO_OP_TYPE_ADDRESS,
1425 TILEPRO_OP_TYPE_SPR
1426 } tilepro_operand_type;
1428 /* This is the bit that determines if a bundle is in the Y encoding. */
1429 #define TILEPRO_BUNDLE_Y_ENCODING_MASK ((tilepro_bundle_bits)1 << 63)
1431 enum
1433 /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
1434 TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
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 */