xref: /netbsd-src/external/gpl3/gdb.old/dist/include/opcode/tilepro.h (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1a5a4af3bSchristos /* TILEPro opcode information.
2a5a4af3bSchristos  *
3*8b657b07Schristos  *    Copyright (C) 2011-2022 Free Software Foundation, Inc.
4a5a4af3bSchristos  *
5a5a4af3bSchristos  *    This program is free software; you can redistribute it and/or modify
6a5a4af3bSchristos  *    it under the terms of the GNU General Public License as published by
7a5a4af3bSchristos  *    the Free Software Foundation; either version 3 of the License, or
8a5a4af3bSchristos  *    (at your option) any later version.
9a5a4af3bSchristos  *
10a5a4af3bSchristos  *    This program is distributed in the hope that it will be useful,
11a5a4af3bSchristos  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
12a5a4af3bSchristos  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13a5a4af3bSchristos  *    GNU General Public License for more details.
14a5a4af3bSchristos  *
15a5a4af3bSchristos  *    You should have received a copy of the GNU General Public License
16a5a4af3bSchristos  *    along with this program; if not, write to the Free Software
17a5a4af3bSchristos  *    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
18a5a4af3bSchristos  *    MA 02110-1301, USA.
19a5a4af3bSchristos  */
20a5a4af3bSchristos 
21a5a4af3bSchristos #ifndef opcode_tilepro_h
22a5a4af3bSchristos #define opcode_tilepro_h
23a5a4af3bSchristos 
24a5a4af3bSchristos typedef unsigned long long tilepro_bundle_bits;
25a5a4af3bSchristos 
26a5a4af3bSchristos 
27a5a4af3bSchristos enum
28a5a4af3bSchristos {
29a5a4af3bSchristos   TILEPRO_MAX_OPERANDS = 5 /* mm */
30a5a4af3bSchristos };
31a5a4af3bSchristos 
32a5a4af3bSchristos typedef enum
33a5a4af3bSchristos {
34a5a4af3bSchristos   TILEPRO_OPC_BPT,
35a5a4af3bSchristos   TILEPRO_OPC_INFO,
36a5a4af3bSchristos   TILEPRO_OPC_INFOL,
37a5a4af3bSchristos   TILEPRO_OPC_J,
38a5a4af3bSchristos   TILEPRO_OPC_JAL,
39a5a4af3bSchristos   TILEPRO_OPC_LW_TLS,
40a5a4af3bSchristos   TILEPRO_OPC_LW_TLS_SN,
41a5a4af3bSchristos   TILEPRO_OPC_MOVE,
42a5a4af3bSchristos   TILEPRO_OPC_MOVE_SN,
43a5a4af3bSchristos   TILEPRO_OPC_MOVEI,
44a5a4af3bSchristos   TILEPRO_OPC_MOVEI_SN,
45a5a4af3bSchristos   TILEPRO_OPC_MOVELI,
46a5a4af3bSchristos   TILEPRO_OPC_MOVELI_SN,
47a5a4af3bSchristos   TILEPRO_OPC_MOVELIS,
48a5a4af3bSchristos   TILEPRO_OPC_PREFETCH,
49a5a4af3bSchristos   TILEPRO_OPC_RAISE,
50a5a4af3bSchristos   TILEPRO_OPC_ADD,
51a5a4af3bSchristos   TILEPRO_OPC_ADD_SN,
52a5a4af3bSchristos   TILEPRO_OPC_ADDB,
53a5a4af3bSchristos   TILEPRO_OPC_ADDB_SN,
54a5a4af3bSchristos   TILEPRO_OPC_ADDBS_U,
55a5a4af3bSchristos   TILEPRO_OPC_ADDBS_U_SN,
56a5a4af3bSchristos   TILEPRO_OPC_ADDH,
57a5a4af3bSchristos   TILEPRO_OPC_ADDH_SN,
58a5a4af3bSchristos   TILEPRO_OPC_ADDHS,
59a5a4af3bSchristos   TILEPRO_OPC_ADDHS_SN,
60a5a4af3bSchristos   TILEPRO_OPC_ADDI,
61a5a4af3bSchristos   TILEPRO_OPC_ADDI_SN,
62a5a4af3bSchristos   TILEPRO_OPC_ADDIB,
63a5a4af3bSchristos   TILEPRO_OPC_ADDIB_SN,
64a5a4af3bSchristos   TILEPRO_OPC_ADDIH,
65a5a4af3bSchristos   TILEPRO_OPC_ADDIH_SN,
66a5a4af3bSchristos   TILEPRO_OPC_ADDLI,
67a5a4af3bSchristos   TILEPRO_OPC_ADDLI_SN,
68a5a4af3bSchristos   TILEPRO_OPC_ADDLIS,
69a5a4af3bSchristos   TILEPRO_OPC_ADDS,
70a5a4af3bSchristos   TILEPRO_OPC_ADDS_SN,
71a5a4af3bSchristos   TILEPRO_OPC_ADIFFB_U,
72a5a4af3bSchristos   TILEPRO_OPC_ADIFFB_U_SN,
73a5a4af3bSchristos   TILEPRO_OPC_ADIFFH,
74a5a4af3bSchristos   TILEPRO_OPC_ADIFFH_SN,
75a5a4af3bSchristos   TILEPRO_OPC_AND,
76a5a4af3bSchristos   TILEPRO_OPC_AND_SN,
77a5a4af3bSchristos   TILEPRO_OPC_ANDI,
78a5a4af3bSchristos   TILEPRO_OPC_ANDI_SN,
79a5a4af3bSchristos   TILEPRO_OPC_AULI,
80a5a4af3bSchristos   TILEPRO_OPC_AVGB_U,
81a5a4af3bSchristos   TILEPRO_OPC_AVGB_U_SN,
82a5a4af3bSchristos   TILEPRO_OPC_AVGH,
83a5a4af3bSchristos   TILEPRO_OPC_AVGH_SN,
84a5a4af3bSchristos   TILEPRO_OPC_BBNS,
85a5a4af3bSchristos   TILEPRO_OPC_BBNS_SN,
86a5a4af3bSchristos   TILEPRO_OPC_BBNST,
87a5a4af3bSchristos   TILEPRO_OPC_BBNST_SN,
88a5a4af3bSchristos   TILEPRO_OPC_BBS,
89a5a4af3bSchristos   TILEPRO_OPC_BBS_SN,
90a5a4af3bSchristos   TILEPRO_OPC_BBST,
91a5a4af3bSchristos   TILEPRO_OPC_BBST_SN,
92a5a4af3bSchristos   TILEPRO_OPC_BGEZ,
93a5a4af3bSchristos   TILEPRO_OPC_BGEZ_SN,
94a5a4af3bSchristos   TILEPRO_OPC_BGEZT,
95a5a4af3bSchristos   TILEPRO_OPC_BGEZT_SN,
96a5a4af3bSchristos   TILEPRO_OPC_BGZ,
97a5a4af3bSchristos   TILEPRO_OPC_BGZ_SN,
98a5a4af3bSchristos   TILEPRO_OPC_BGZT,
99a5a4af3bSchristos   TILEPRO_OPC_BGZT_SN,
100a5a4af3bSchristos   TILEPRO_OPC_BITX,
101a5a4af3bSchristos   TILEPRO_OPC_BITX_SN,
102a5a4af3bSchristos   TILEPRO_OPC_BLEZ,
103a5a4af3bSchristos   TILEPRO_OPC_BLEZ_SN,
104a5a4af3bSchristos   TILEPRO_OPC_BLEZT,
105a5a4af3bSchristos   TILEPRO_OPC_BLEZT_SN,
106a5a4af3bSchristos   TILEPRO_OPC_BLZ,
107a5a4af3bSchristos   TILEPRO_OPC_BLZ_SN,
108a5a4af3bSchristos   TILEPRO_OPC_BLZT,
109a5a4af3bSchristos   TILEPRO_OPC_BLZT_SN,
110a5a4af3bSchristos   TILEPRO_OPC_BNZ,
111a5a4af3bSchristos   TILEPRO_OPC_BNZ_SN,
112a5a4af3bSchristos   TILEPRO_OPC_BNZT,
113a5a4af3bSchristos   TILEPRO_OPC_BNZT_SN,
114a5a4af3bSchristos   TILEPRO_OPC_BYTEX,
115a5a4af3bSchristos   TILEPRO_OPC_BYTEX_SN,
116a5a4af3bSchristos   TILEPRO_OPC_BZ,
117a5a4af3bSchristos   TILEPRO_OPC_BZ_SN,
118a5a4af3bSchristos   TILEPRO_OPC_BZT,
119a5a4af3bSchristos   TILEPRO_OPC_BZT_SN,
120a5a4af3bSchristos   TILEPRO_OPC_CLZ,
121a5a4af3bSchristos   TILEPRO_OPC_CLZ_SN,
122a5a4af3bSchristos   TILEPRO_OPC_CRC32_32,
123a5a4af3bSchristos   TILEPRO_OPC_CRC32_32_SN,
124a5a4af3bSchristos   TILEPRO_OPC_CRC32_8,
125a5a4af3bSchristos   TILEPRO_OPC_CRC32_8_SN,
126a5a4af3bSchristos   TILEPRO_OPC_CTZ,
127a5a4af3bSchristos   TILEPRO_OPC_CTZ_SN,
128a5a4af3bSchristos   TILEPRO_OPC_DRAIN,
129a5a4af3bSchristos   TILEPRO_OPC_DTLBPR,
130a5a4af3bSchristos   TILEPRO_OPC_DWORD_ALIGN,
131a5a4af3bSchristos   TILEPRO_OPC_DWORD_ALIGN_SN,
132a5a4af3bSchristos   TILEPRO_OPC_FINV,
133a5a4af3bSchristos   TILEPRO_OPC_FLUSH,
134a5a4af3bSchristos   TILEPRO_OPC_FNOP,
135a5a4af3bSchristos   TILEPRO_OPC_ICOH,
136a5a4af3bSchristos   TILEPRO_OPC_ILL,
137a5a4af3bSchristos   TILEPRO_OPC_INTHB,
138a5a4af3bSchristos   TILEPRO_OPC_INTHB_SN,
139a5a4af3bSchristos   TILEPRO_OPC_INTHH,
140a5a4af3bSchristos   TILEPRO_OPC_INTHH_SN,
141a5a4af3bSchristos   TILEPRO_OPC_INTLB,
142a5a4af3bSchristos   TILEPRO_OPC_INTLB_SN,
143a5a4af3bSchristos   TILEPRO_OPC_INTLH,
144a5a4af3bSchristos   TILEPRO_OPC_INTLH_SN,
145a5a4af3bSchristos   TILEPRO_OPC_INV,
146a5a4af3bSchristos   TILEPRO_OPC_IRET,
147a5a4af3bSchristos   TILEPRO_OPC_JALB,
148a5a4af3bSchristos   TILEPRO_OPC_JALF,
149a5a4af3bSchristos   TILEPRO_OPC_JALR,
150a5a4af3bSchristos   TILEPRO_OPC_JALRP,
151a5a4af3bSchristos   TILEPRO_OPC_JB,
152a5a4af3bSchristos   TILEPRO_OPC_JF,
153a5a4af3bSchristos   TILEPRO_OPC_JR,
154a5a4af3bSchristos   TILEPRO_OPC_JRP,
155a5a4af3bSchristos   TILEPRO_OPC_LB,
156a5a4af3bSchristos   TILEPRO_OPC_LB_SN,
157a5a4af3bSchristos   TILEPRO_OPC_LB_U,
158a5a4af3bSchristos   TILEPRO_OPC_LB_U_SN,
159a5a4af3bSchristos   TILEPRO_OPC_LBADD,
160a5a4af3bSchristos   TILEPRO_OPC_LBADD_SN,
161a5a4af3bSchristos   TILEPRO_OPC_LBADD_U,
162a5a4af3bSchristos   TILEPRO_OPC_LBADD_U_SN,
163a5a4af3bSchristos   TILEPRO_OPC_LH,
164a5a4af3bSchristos   TILEPRO_OPC_LH_SN,
165a5a4af3bSchristos   TILEPRO_OPC_LH_U,
166a5a4af3bSchristos   TILEPRO_OPC_LH_U_SN,
167a5a4af3bSchristos   TILEPRO_OPC_LHADD,
168a5a4af3bSchristos   TILEPRO_OPC_LHADD_SN,
169a5a4af3bSchristos   TILEPRO_OPC_LHADD_U,
170a5a4af3bSchristos   TILEPRO_OPC_LHADD_U_SN,
171a5a4af3bSchristos   TILEPRO_OPC_LNK,
172a5a4af3bSchristos   TILEPRO_OPC_LNK_SN,
173a5a4af3bSchristos   TILEPRO_OPC_LW,
174a5a4af3bSchristos   TILEPRO_OPC_LW_SN,
175a5a4af3bSchristos   TILEPRO_OPC_LW_NA,
176a5a4af3bSchristos   TILEPRO_OPC_LW_NA_SN,
177a5a4af3bSchristos   TILEPRO_OPC_LWADD,
178a5a4af3bSchristos   TILEPRO_OPC_LWADD_SN,
179a5a4af3bSchristos   TILEPRO_OPC_LWADD_NA,
180a5a4af3bSchristos   TILEPRO_OPC_LWADD_NA_SN,
181a5a4af3bSchristos   TILEPRO_OPC_MAXB_U,
182a5a4af3bSchristos   TILEPRO_OPC_MAXB_U_SN,
183a5a4af3bSchristos   TILEPRO_OPC_MAXH,
184a5a4af3bSchristos   TILEPRO_OPC_MAXH_SN,
185a5a4af3bSchristos   TILEPRO_OPC_MAXIB_U,
186a5a4af3bSchristos   TILEPRO_OPC_MAXIB_U_SN,
187a5a4af3bSchristos   TILEPRO_OPC_MAXIH,
188a5a4af3bSchristos   TILEPRO_OPC_MAXIH_SN,
189a5a4af3bSchristos   TILEPRO_OPC_MF,
190a5a4af3bSchristos   TILEPRO_OPC_MFSPR,
191a5a4af3bSchristos   TILEPRO_OPC_MINB_U,
192a5a4af3bSchristos   TILEPRO_OPC_MINB_U_SN,
193a5a4af3bSchristos   TILEPRO_OPC_MINH,
194a5a4af3bSchristos   TILEPRO_OPC_MINH_SN,
195a5a4af3bSchristos   TILEPRO_OPC_MINIB_U,
196a5a4af3bSchristos   TILEPRO_OPC_MINIB_U_SN,
197a5a4af3bSchristos   TILEPRO_OPC_MINIH,
198a5a4af3bSchristos   TILEPRO_OPC_MINIH_SN,
199a5a4af3bSchristos   TILEPRO_OPC_MM,
200a5a4af3bSchristos   TILEPRO_OPC_MNZ,
201a5a4af3bSchristos   TILEPRO_OPC_MNZ_SN,
202a5a4af3bSchristos   TILEPRO_OPC_MNZB,
203a5a4af3bSchristos   TILEPRO_OPC_MNZB_SN,
204a5a4af3bSchristos   TILEPRO_OPC_MNZH,
205a5a4af3bSchristos   TILEPRO_OPC_MNZH_SN,
206a5a4af3bSchristos   TILEPRO_OPC_MTSPR,
207a5a4af3bSchristos   TILEPRO_OPC_MULHH_SS,
208a5a4af3bSchristos   TILEPRO_OPC_MULHH_SS_SN,
209a5a4af3bSchristos   TILEPRO_OPC_MULHH_SU,
210a5a4af3bSchristos   TILEPRO_OPC_MULHH_SU_SN,
211a5a4af3bSchristos   TILEPRO_OPC_MULHH_UU,
212a5a4af3bSchristos   TILEPRO_OPC_MULHH_UU_SN,
213a5a4af3bSchristos   TILEPRO_OPC_MULHHA_SS,
214a5a4af3bSchristos   TILEPRO_OPC_MULHHA_SS_SN,
215a5a4af3bSchristos   TILEPRO_OPC_MULHHA_SU,
216a5a4af3bSchristos   TILEPRO_OPC_MULHHA_SU_SN,
217a5a4af3bSchristos   TILEPRO_OPC_MULHHA_UU,
218a5a4af3bSchristos   TILEPRO_OPC_MULHHA_UU_SN,
219a5a4af3bSchristos   TILEPRO_OPC_MULHHSA_UU,
220a5a4af3bSchristos   TILEPRO_OPC_MULHHSA_UU_SN,
221a5a4af3bSchristos   TILEPRO_OPC_MULHL_SS,
222a5a4af3bSchristos   TILEPRO_OPC_MULHL_SS_SN,
223a5a4af3bSchristos   TILEPRO_OPC_MULHL_SU,
224a5a4af3bSchristos   TILEPRO_OPC_MULHL_SU_SN,
225a5a4af3bSchristos   TILEPRO_OPC_MULHL_US,
226a5a4af3bSchristos   TILEPRO_OPC_MULHL_US_SN,
227a5a4af3bSchristos   TILEPRO_OPC_MULHL_UU,
228a5a4af3bSchristos   TILEPRO_OPC_MULHL_UU_SN,
229a5a4af3bSchristos   TILEPRO_OPC_MULHLA_SS,
230a5a4af3bSchristos   TILEPRO_OPC_MULHLA_SS_SN,
231a5a4af3bSchristos   TILEPRO_OPC_MULHLA_SU,
232a5a4af3bSchristos   TILEPRO_OPC_MULHLA_SU_SN,
233a5a4af3bSchristos   TILEPRO_OPC_MULHLA_US,
234a5a4af3bSchristos   TILEPRO_OPC_MULHLA_US_SN,
235a5a4af3bSchristos   TILEPRO_OPC_MULHLA_UU,
236a5a4af3bSchristos   TILEPRO_OPC_MULHLA_UU_SN,
237a5a4af3bSchristos   TILEPRO_OPC_MULHLSA_UU,
238a5a4af3bSchristos   TILEPRO_OPC_MULHLSA_UU_SN,
239a5a4af3bSchristos   TILEPRO_OPC_MULLL_SS,
240a5a4af3bSchristos   TILEPRO_OPC_MULLL_SS_SN,
241a5a4af3bSchristos   TILEPRO_OPC_MULLL_SU,
242a5a4af3bSchristos   TILEPRO_OPC_MULLL_SU_SN,
243a5a4af3bSchristos   TILEPRO_OPC_MULLL_UU,
244a5a4af3bSchristos   TILEPRO_OPC_MULLL_UU_SN,
245a5a4af3bSchristos   TILEPRO_OPC_MULLLA_SS,
246a5a4af3bSchristos   TILEPRO_OPC_MULLLA_SS_SN,
247a5a4af3bSchristos   TILEPRO_OPC_MULLLA_SU,
248a5a4af3bSchristos   TILEPRO_OPC_MULLLA_SU_SN,
249a5a4af3bSchristos   TILEPRO_OPC_MULLLA_UU,
250a5a4af3bSchristos   TILEPRO_OPC_MULLLA_UU_SN,
251a5a4af3bSchristos   TILEPRO_OPC_MULLLSA_UU,
252a5a4af3bSchristos   TILEPRO_OPC_MULLLSA_UU_SN,
253a5a4af3bSchristos   TILEPRO_OPC_MVNZ,
254a5a4af3bSchristos   TILEPRO_OPC_MVNZ_SN,
255a5a4af3bSchristos   TILEPRO_OPC_MVZ,
256a5a4af3bSchristos   TILEPRO_OPC_MVZ_SN,
257a5a4af3bSchristos   TILEPRO_OPC_MZ,
258a5a4af3bSchristos   TILEPRO_OPC_MZ_SN,
259a5a4af3bSchristos   TILEPRO_OPC_MZB,
260a5a4af3bSchristos   TILEPRO_OPC_MZB_SN,
261a5a4af3bSchristos   TILEPRO_OPC_MZH,
262a5a4af3bSchristos   TILEPRO_OPC_MZH_SN,
263a5a4af3bSchristos   TILEPRO_OPC_NAP,
264a5a4af3bSchristos   TILEPRO_OPC_NOP,
265a5a4af3bSchristos   TILEPRO_OPC_NOR,
266a5a4af3bSchristos   TILEPRO_OPC_NOR_SN,
267a5a4af3bSchristos   TILEPRO_OPC_OR,
268a5a4af3bSchristos   TILEPRO_OPC_OR_SN,
269a5a4af3bSchristos   TILEPRO_OPC_ORI,
270a5a4af3bSchristos   TILEPRO_OPC_ORI_SN,
271a5a4af3bSchristos   TILEPRO_OPC_PACKBS_U,
272a5a4af3bSchristos   TILEPRO_OPC_PACKBS_U_SN,
273a5a4af3bSchristos   TILEPRO_OPC_PACKHB,
274a5a4af3bSchristos   TILEPRO_OPC_PACKHB_SN,
275a5a4af3bSchristos   TILEPRO_OPC_PACKHS,
276a5a4af3bSchristos   TILEPRO_OPC_PACKHS_SN,
277a5a4af3bSchristos   TILEPRO_OPC_PACKLB,
278a5a4af3bSchristos   TILEPRO_OPC_PACKLB_SN,
279a5a4af3bSchristos   TILEPRO_OPC_PCNT,
280a5a4af3bSchristos   TILEPRO_OPC_PCNT_SN,
281a5a4af3bSchristos   TILEPRO_OPC_RL,
282a5a4af3bSchristos   TILEPRO_OPC_RL_SN,
283a5a4af3bSchristos   TILEPRO_OPC_RLI,
284a5a4af3bSchristos   TILEPRO_OPC_RLI_SN,
285a5a4af3bSchristos   TILEPRO_OPC_S1A,
286a5a4af3bSchristos   TILEPRO_OPC_S1A_SN,
287a5a4af3bSchristos   TILEPRO_OPC_S2A,
288a5a4af3bSchristos   TILEPRO_OPC_S2A_SN,
289a5a4af3bSchristos   TILEPRO_OPC_S3A,
290a5a4af3bSchristos   TILEPRO_OPC_S3A_SN,
291a5a4af3bSchristos   TILEPRO_OPC_SADAB_U,
292a5a4af3bSchristos   TILEPRO_OPC_SADAB_U_SN,
293a5a4af3bSchristos   TILEPRO_OPC_SADAH,
294a5a4af3bSchristos   TILEPRO_OPC_SADAH_SN,
295a5a4af3bSchristos   TILEPRO_OPC_SADAH_U,
296a5a4af3bSchristos   TILEPRO_OPC_SADAH_U_SN,
297a5a4af3bSchristos   TILEPRO_OPC_SADB_U,
298a5a4af3bSchristos   TILEPRO_OPC_SADB_U_SN,
299a5a4af3bSchristos   TILEPRO_OPC_SADH,
300a5a4af3bSchristos   TILEPRO_OPC_SADH_SN,
301a5a4af3bSchristos   TILEPRO_OPC_SADH_U,
302a5a4af3bSchristos   TILEPRO_OPC_SADH_U_SN,
303a5a4af3bSchristos   TILEPRO_OPC_SB,
304a5a4af3bSchristos   TILEPRO_OPC_SBADD,
305a5a4af3bSchristos   TILEPRO_OPC_SEQ,
306a5a4af3bSchristos   TILEPRO_OPC_SEQ_SN,
307a5a4af3bSchristos   TILEPRO_OPC_SEQB,
308a5a4af3bSchristos   TILEPRO_OPC_SEQB_SN,
309a5a4af3bSchristos   TILEPRO_OPC_SEQH,
310a5a4af3bSchristos   TILEPRO_OPC_SEQH_SN,
311a5a4af3bSchristos   TILEPRO_OPC_SEQI,
312a5a4af3bSchristos   TILEPRO_OPC_SEQI_SN,
313a5a4af3bSchristos   TILEPRO_OPC_SEQIB,
314a5a4af3bSchristos   TILEPRO_OPC_SEQIB_SN,
315a5a4af3bSchristos   TILEPRO_OPC_SEQIH,
316a5a4af3bSchristos   TILEPRO_OPC_SEQIH_SN,
317a5a4af3bSchristos   TILEPRO_OPC_SH,
318a5a4af3bSchristos   TILEPRO_OPC_SHADD,
319a5a4af3bSchristos   TILEPRO_OPC_SHL,
320a5a4af3bSchristos   TILEPRO_OPC_SHL_SN,
321a5a4af3bSchristos   TILEPRO_OPC_SHLB,
322a5a4af3bSchristos   TILEPRO_OPC_SHLB_SN,
323a5a4af3bSchristos   TILEPRO_OPC_SHLH,
324a5a4af3bSchristos   TILEPRO_OPC_SHLH_SN,
325a5a4af3bSchristos   TILEPRO_OPC_SHLI,
326a5a4af3bSchristos   TILEPRO_OPC_SHLI_SN,
327a5a4af3bSchristos   TILEPRO_OPC_SHLIB,
328a5a4af3bSchristos   TILEPRO_OPC_SHLIB_SN,
329a5a4af3bSchristos   TILEPRO_OPC_SHLIH,
330a5a4af3bSchristos   TILEPRO_OPC_SHLIH_SN,
331a5a4af3bSchristos   TILEPRO_OPC_SHR,
332a5a4af3bSchristos   TILEPRO_OPC_SHR_SN,
333a5a4af3bSchristos   TILEPRO_OPC_SHRB,
334a5a4af3bSchristos   TILEPRO_OPC_SHRB_SN,
335a5a4af3bSchristos   TILEPRO_OPC_SHRH,
336a5a4af3bSchristos   TILEPRO_OPC_SHRH_SN,
337a5a4af3bSchristos   TILEPRO_OPC_SHRI,
338a5a4af3bSchristos   TILEPRO_OPC_SHRI_SN,
339a5a4af3bSchristos   TILEPRO_OPC_SHRIB,
340a5a4af3bSchristos   TILEPRO_OPC_SHRIB_SN,
341a5a4af3bSchristos   TILEPRO_OPC_SHRIH,
342a5a4af3bSchristos   TILEPRO_OPC_SHRIH_SN,
343a5a4af3bSchristos   TILEPRO_OPC_SLT,
344a5a4af3bSchristos   TILEPRO_OPC_SLT_SN,
345a5a4af3bSchristos   TILEPRO_OPC_SLT_U,
346a5a4af3bSchristos   TILEPRO_OPC_SLT_U_SN,
347a5a4af3bSchristos   TILEPRO_OPC_SLTB,
348a5a4af3bSchristos   TILEPRO_OPC_SLTB_SN,
349a5a4af3bSchristos   TILEPRO_OPC_SLTB_U,
350a5a4af3bSchristos   TILEPRO_OPC_SLTB_U_SN,
351a5a4af3bSchristos   TILEPRO_OPC_SLTE,
352a5a4af3bSchristos   TILEPRO_OPC_SLTE_SN,
353a5a4af3bSchristos   TILEPRO_OPC_SLTE_U,
354a5a4af3bSchristos   TILEPRO_OPC_SLTE_U_SN,
355a5a4af3bSchristos   TILEPRO_OPC_SLTEB,
356a5a4af3bSchristos   TILEPRO_OPC_SLTEB_SN,
357a5a4af3bSchristos   TILEPRO_OPC_SLTEB_U,
358a5a4af3bSchristos   TILEPRO_OPC_SLTEB_U_SN,
359a5a4af3bSchristos   TILEPRO_OPC_SLTEH,
360a5a4af3bSchristos   TILEPRO_OPC_SLTEH_SN,
361a5a4af3bSchristos   TILEPRO_OPC_SLTEH_U,
362a5a4af3bSchristos   TILEPRO_OPC_SLTEH_U_SN,
363a5a4af3bSchristos   TILEPRO_OPC_SLTH,
364a5a4af3bSchristos   TILEPRO_OPC_SLTH_SN,
365a5a4af3bSchristos   TILEPRO_OPC_SLTH_U,
366a5a4af3bSchristos   TILEPRO_OPC_SLTH_U_SN,
367a5a4af3bSchristos   TILEPRO_OPC_SLTI,
368a5a4af3bSchristos   TILEPRO_OPC_SLTI_SN,
369a5a4af3bSchristos   TILEPRO_OPC_SLTI_U,
370a5a4af3bSchristos   TILEPRO_OPC_SLTI_U_SN,
371a5a4af3bSchristos   TILEPRO_OPC_SLTIB,
372a5a4af3bSchristos   TILEPRO_OPC_SLTIB_SN,
373a5a4af3bSchristos   TILEPRO_OPC_SLTIB_U,
374a5a4af3bSchristos   TILEPRO_OPC_SLTIB_U_SN,
375a5a4af3bSchristos   TILEPRO_OPC_SLTIH,
376a5a4af3bSchristos   TILEPRO_OPC_SLTIH_SN,
377a5a4af3bSchristos   TILEPRO_OPC_SLTIH_U,
378a5a4af3bSchristos   TILEPRO_OPC_SLTIH_U_SN,
379a5a4af3bSchristos   TILEPRO_OPC_SNE,
380a5a4af3bSchristos   TILEPRO_OPC_SNE_SN,
381a5a4af3bSchristos   TILEPRO_OPC_SNEB,
382a5a4af3bSchristos   TILEPRO_OPC_SNEB_SN,
383a5a4af3bSchristos   TILEPRO_OPC_SNEH,
384a5a4af3bSchristos   TILEPRO_OPC_SNEH_SN,
385a5a4af3bSchristos   TILEPRO_OPC_SRA,
386a5a4af3bSchristos   TILEPRO_OPC_SRA_SN,
387a5a4af3bSchristos   TILEPRO_OPC_SRAB,
388a5a4af3bSchristos   TILEPRO_OPC_SRAB_SN,
389a5a4af3bSchristos   TILEPRO_OPC_SRAH,
390a5a4af3bSchristos   TILEPRO_OPC_SRAH_SN,
391a5a4af3bSchristos   TILEPRO_OPC_SRAI,
392a5a4af3bSchristos   TILEPRO_OPC_SRAI_SN,
393a5a4af3bSchristos   TILEPRO_OPC_SRAIB,
394a5a4af3bSchristos   TILEPRO_OPC_SRAIB_SN,
395a5a4af3bSchristos   TILEPRO_OPC_SRAIH,
396a5a4af3bSchristos   TILEPRO_OPC_SRAIH_SN,
397a5a4af3bSchristos   TILEPRO_OPC_SUB,
398a5a4af3bSchristos   TILEPRO_OPC_SUB_SN,
399a5a4af3bSchristos   TILEPRO_OPC_SUBB,
400a5a4af3bSchristos   TILEPRO_OPC_SUBB_SN,
401a5a4af3bSchristos   TILEPRO_OPC_SUBBS_U,
402a5a4af3bSchristos   TILEPRO_OPC_SUBBS_U_SN,
403a5a4af3bSchristos   TILEPRO_OPC_SUBH,
404a5a4af3bSchristos   TILEPRO_OPC_SUBH_SN,
405a5a4af3bSchristos   TILEPRO_OPC_SUBHS,
406a5a4af3bSchristos   TILEPRO_OPC_SUBHS_SN,
407a5a4af3bSchristos   TILEPRO_OPC_SUBS,
408a5a4af3bSchristos   TILEPRO_OPC_SUBS_SN,
409a5a4af3bSchristos   TILEPRO_OPC_SW,
410a5a4af3bSchristos   TILEPRO_OPC_SWADD,
411a5a4af3bSchristos   TILEPRO_OPC_SWINT0,
412a5a4af3bSchristos   TILEPRO_OPC_SWINT1,
413a5a4af3bSchristos   TILEPRO_OPC_SWINT2,
414a5a4af3bSchristos   TILEPRO_OPC_SWINT3,
415a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB0,
416a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB0_SN,
417a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB1,
418a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB1_SN,
419a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB2,
420a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB2_SN,
421a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB3,
422a5a4af3bSchristos   TILEPRO_OPC_TBLIDXB3_SN,
423a5a4af3bSchristos   TILEPRO_OPC_TNS,
424a5a4af3bSchristos   TILEPRO_OPC_TNS_SN,
425a5a4af3bSchristos   TILEPRO_OPC_WH64,
426a5a4af3bSchristos   TILEPRO_OPC_XOR,
427a5a4af3bSchristos   TILEPRO_OPC_XOR_SN,
428a5a4af3bSchristos   TILEPRO_OPC_XORI,
429a5a4af3bSchristos   TILEPRO_OPC_XORI_SN,
430a5a4af3bSchristos   TILEPRO_OPC_NONE
431a5a4af3bSchristos } tilepro_mnemonic;
432a5a4af3bSchristos 
433a5a4af3bSchristos /* 64-bit pattern for a { bpt ; nop } bundle. */
434a5a4af3bSchristos #define TILEPRO_BPT_BUNDLE 0x400b3cae70166000ULL
435a5a4af3bSchristos 
436a5a4af3bSchristos #ifndef DISASM_ONLY
437a5a4af3bSchristos 
438a5a4af3bSchristos enum
439a5a4af3bSchristos {
440a5a4af3bSchristos   TILEPRO_SN_MAX_OPERANDS = 6 /* route */
441a5a4af3bSchristos };
442a5a4af3bSchristos 
443a5a4af3bSchristos typedef enum
444a5a4af3bSchristos {
445a5a4af3bSchristos   TILEPRO_SN_OPC_BZ,
446a5a4af3bSchristos   TILEPRO_SN_OPC_BNZ,
447a5a4af3bSchristos   TILEPRO_SN_OPC_JRR,
448a5a4af3bSchristos   TILEPRO_SN_OPC_FNOP,
449a5a4af3bSchristos   TILEPRO_SN_OPC_BLZ,
450a5a4af3bSchristos   TILEPRO_SN_OPC_NOP,
451a5a4af3bSchristos   TILEPRO_SN_OPC_MOVEI,
452a5a4af3bSchristos   TILEPRO_SN_OPC_MOVE,
453a5a4af3bSchristos   TILEPRO_SN_OPC_BGEZ,
454a5a4af3bSchristos   TILEPRO_SN_OPC_JR,
455a5a4af3bSchristos   TILEPRO_SN_OPC_BLEZ,
456a5a4af3bSchristos   TILEPRO_SN_OPC_BBNS,
457a5a4af3bSchristos   TILEPRO_SN_OPC_JALRR,
458a5a4af3bSchristos   TILEPRO_SN_OPC_BPT,
459a5a4af3bSchristos   TILEPRO_SN_OPC_JALR,
460a5a4af3bSchristos   TILEPRO_SN_OPC_SHR1,
461a5a4af3bSchristos   TILEPRO_SN_OPC_BGZ,
462a5a4af3bSchristos   TILEPRO_SN_OPC_BBS,
463a5a4af3bSchristos   TILEPRO_SN_OPC_SHL8II,
464a5a4af3bSchristos   TILEPRO_SN_OPC_ADDI,
465a5a4af3bSchristos   TILEPRO_SN_OPC_HALT,
466a5a4af3bSchristos   TILEPRO_SN_OPC_ROUTE,
467a5a4af3bSchristos   TILEPRO_SN_OPC_NONE
468a5a4af3bSchristos } tilepro_sn_mnemonic;
469a5a4af3bSchristos 
470a5a4af3bSchristos extern const unsigned char tilepro_sn_route_encode[6 * 6 * 6];
471a5a4af3bSchristos extern const signed char tilepro_sn_route_decode[256][3];
472a5a4af3bSchristos extern const char tilepro_sn_direction_names[6][5];
473a5a4af3bSchristos extern const signed char tilepro_sn_dest_map[6][6];
474a5a4af3bSchristos #endif /* DISASM_ONLY */
475a5a4af3bSchristos 
476a5a4af3bSchristos 
477a5a4af3bSchristos static __inline unsigned int
478a5a4af3bSchristos get_BrOff_SN(tilepro_bundle_bits num)
479a5a4af3bSchristos {
480a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
481a5a4af3bSchristos   return (((n >> 0)) & 0x3ff);
482a5a4af3bSchristos }
483a5a4af3bSchristos 
484a5a4af3bSchristos static __inline unsigned int
485a5a4af3bSchristos get_BrOff_X1(tilepro_bundle_bits n)
486a5a4af3bSchristos {
487a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x00007fff) |
488a5a4af3bSchristos          (((unsigned int)(n >> 20)) & 0x00018000);
489a5a4af3bSchristos }
490a5a4af3bSchristos 
491a5a4af3bSchristos static __inline unsigned int
492a5a4af3bSchristos get_BrType_X1(tilepro_bundle_bits n)
493a5a4af3bSchristos {
494a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0xf);
495a5a4af3bSchristos }
496a5a4af3bSchristos 
497a5a4af3bSchristos static __inline unsigned int
498a5a4af3bSchristos get_Dest_Imm8_X1(tilepro_bundle_bits n)
499a5a4af3bSchristos {
500a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x0000003f) |
501a5a4af3bSchristos          (((unsigned int)(n >> 43)) & 0x000000c0);
502a5a4af3bSchristos }
503a5a4af3bSchristos 
504a5a4af3bSchristos static __inline unsigned int
505a5a4af3bSchristos get_Dest_SN(tilepro_bundle_bits num)
506a5a4af3bSchristos {
507a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
508a5a4af3bSchristos   return (((n >> 2)) & 0x3);
509a5a4af3bSchristos }
510a5a4af3bSchristos 
511a5a4af3bSchristos static __inline unsigned int
512a5a4af3bSchristos get_Dest_X0(tilepro_bundle_bits num)
513a5a4af3bSchristos {
514a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
515a5a4af3bSchristos   return (((n >> 0)) & 0x3f);
516a5a4af3bSchristos }
517a5a4af3bSchristos 
518a5a4af3bSchristos static __inline unsigned int
519a5a4af3bSchristos get_Dest_X1(tilepro_bundle_bits n)
520a5a4af3bSchristos {
521a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x3f);
522a5a4af3bSchristos }
523a5a4af3bSchristos 
524a5a4af3bSchristos static __inline unsigned int
525a5a4af3bSchristos get_Dest_Y0(tilepro_bundle_bits num)
526a5a4af3bSchristos {
527a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
528a5a4af3bSchristos   return (((n >> 0)) & 0x3f);
529a5a4af3bSchristos }
530a5a4af3bSchristos 
531a5a4af3bSchristos static __inline unsigned int
532a5a4af3bSchristos get_Dest_Y1(tilepro_bundle_bits n)
533a5a4af3bSchristos {
534a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x3f);
535a5a4af3bSchristos }
536a5a4af3bSchristos 
537a5a4af3bSchristos static __inline unsigned int
538a5a4af3bSchristos get_Imm16_X0(tilepro_bundle_bits num)
539a5a4af3bSchristos {
540a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
541a5a4af3bSchristos   return (((n >> 12)) & 0xffff);
542a5a4af3bSchristos }
543a5a4af3bSchristos 
544a5a4af3bSchristos static __inline unsigned int
545a5a4af3bSchristos get_Imm16_X1(tilepro_bundle_bits n)
546a5a4af3bSchristos {
547a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0xffff);
548a5a4af3bSchristos }
549a5a4af3bSchristos 
550a5a4af3bSchristos static __inline unsigned int
551a5a4af3bSchristos get_Imm8_SN(tilepro_bundle_bits num)
552a5a4af3bSchristos {
553a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
554a5a4af3bSchristos   return (((n >> 0)) & 0xff);
555a5a4af3bSchristos }
556a5a4af3bSchristos 
557a5a4af3bSchristos static __inline unsigned int
558a5a4af3bSchristos get_Imm8_X0(tilepro_bundle_bits num)
559a5a4af3bSchristos {
560a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
561a5a4af3bSchristos   return (((n >> 12)) & 0xff);
562a5a4af3bSchristos }
563a5a4af3bSchristos 
564a5a4af3bSchristos static __inline unsigned int
565a5a4af3bSchristos get_Imm8_X1(tilepro_bundle_bits n)
566a5a4af3bSchristos {
567a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0xff);
568a5a4af3bSchristos }
569a5a4af3bSchristos 
570a5a4af3bSchristos static __inline unsigned int
571a5a4af3bSchristos get_Imm8_Y0(tilepro_bundle_bits num)
572a5a4af3bSchristos {
573a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
574a5a4af3bSchristos   return (((n >> 12)) & 0xff);
575a5a4af3bSchristos }
576a5a4af3bSchristos 
577a5a4af3bSchristos static __inline unsigned int
578a5a4af3bSchristos get_Imm8_Y1(tilepro_bundle_bits n)
579a5a4af3bSchristos {
580a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0xff);
581a5a4af3bSchristos }
582a5a4af3bSchristos 
583a5a4af3bSchristos static __inline unsigned int
584a5a4af3bSchristos get_ImmOpcodeExtension_X0(tilepro_bundle_bits num)
585a5a4af3bSchristos {
586a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
587a5a4af3bSchristos   return (((n >> 20)) & 0x7f);
588a5a4af3bSchristos }
589a5a4af3bSchristos 
590a5a4af3bSchristos static __inline unsigned int
591a5a4af3bSchristos get_ImmOpcodeExtension_X1(tilepro_bundle_bits n)
592a5a4af3bSchristos {
593a5a4af3bSchristos   return (((unsigned int)(n >> 51)) & 0x7f);
594a5a4af3bSchristos }
595a5a4af3bSchristos 
596a5a4af3bSchristos static __inline unsigned int
597a5a4af3bSchristos get_ImmRROpcodeExtension_SN(tilepro_bundle_bits num)
598a5a4af3bSchristos {
599a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
600a5a4af3bSchristos   return (((n >> 8)) & 0x3);
601a5a4af3bSchristos }
602a5a4af3bSchristos 
603a5a4af3bSchristos static __inline unsigned int
604a5a4af3bSchristos get_JOffLong_X1(tilepro_bundle_bits n)
605a5a4af3bSchristos {
606a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x00007fff) |
607a5a4af3bSchristos          (((unsigned int)(n >> 20)) & 0x00018000) |
608a5a4af3bSchristos          (((unsigned int)(n >> 14)) & 0x001e0000) |
609a5a4af3bSchristos          (((unsigned int)(n >> 16)) & 0x07e00000) |
610a5a4af3bSchristos          (((unsigned int)(n >> 31)) & 0x18000000);
611a5a4af3bSchristos }
612a5a4af3bSchristos 
613a5a4af3bSchristos static __inline unsigned int
614a5a4af3bSchristos get_JOff_X1(tilepro_bundle_bits n)
615a5a4af3bSchristos {
616a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x00007fff) |
617a5a4af3bSchristos          (((unsigned int)(n >> 20)) & 0x00018000) |
618a5a4af3bSchristos          (((unsigned int)(n >> 14)) & 0x001e0000) |
619a5a4af3bSchristos          (((unsigned int)(n >> 16)) & 0x07e00000) |
620a5a4af3bSchristos          (((unsigned int)(n >> 31)) & 0x08000000);
621a5a4af3bSchristos }
622a5a4af3bSchristos 
623a5a4af3bSchristos static __inline unsigned int
624a5a4af3bSchristos get_MF_Imm15_X1(tilepro_bundle_bits n)
625a5a4af3bSchristos {
626a5a4af3bSchristos   return (((unsigned int)(n >> 37)) & 0x00003fff) |
627a5a4af3bSchristos          (((unsigned int)(n >> 44)) & 0x00004000);
628a5a4af3bSchristos }
629a5a4af3bSchristos 
630a5a4af3bSchristos static __inline unsigned int
631a5a4af3bSchristos get_MMEnd_X0(tilepro_bundle_bits num)
632a5a4af3bSchristos {
633a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
634a5a4af3bSchristos   return (((n >> 18)) & 0x1f);
635a5a4af3bSchristos }
636a5a4af3bSchristos 
637a5a4af3bSchristos static __inline unsigned int
638a5a4af3bSchristos get_MMEnd_X1(tilepro_bundle_bits n)
639a5a4af3bSchristos {
640a5a4af3bSchristos   return (((unsigned int)(n >> 49)) & 0x1f);
641a5a4af3bSchristos }
642a5a4af3bSchristos 
643a5a4af3bSchristos static __inline unsigned int
644a5a4af3bSchristos get_MMStart_X0(tilepro_bundle_bits num)
645a5a4af3bSchristos {
646a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
647a5a4af3bSchristos   return (((n >> 23)) & 0x1f);
648a5a4af3bSchristos }
649a5a4af3bSchristos 
650a5a4af3bSchristos static __inline unsigned int
651a5a4af3bSchristos get_MMStart_X1(tilepro_bundle_bits n)
652a5a4af3bSchristos {
653a5a4af3bSchristos   return (((unsigned int)(n >> 54)) & 0x1f);
654a5a4af3bSchristos }
655a5a4af3bSchristos 
656a5a4af3bSchristos static __inline unsigned int
657a5a4af3bSchristos get_MT_Imm15_X1(tilepro_bundle_bits n)
658a5a4af3bSchristos {
659a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x0000003f) |
660a5a4af3bSchristos          (((unsigned int)(n >> 37)) & 0x00003fc0) |
661a5a4af3bSchristos          (((unsigned int)(n >> 44)) & 0x00004000);
662a5a4af3bSchristos }
663a5a4af3bSchristos 
664a5a4af3bSchristos static __inline unsigned int
665a5a4af3bSchristos get_Mode(tilepro_bundle_bits n)
666a5a4af3bSchristos {
667a5a4af3bSchristos   return (((unsigned int)(n >> 63)) & 0x1);
668a5a4af3bSchristos }
669a5a4af3bSchristos 
670a5a4af3bSchristos static __inline unsigned int
671a5a4af3bSchristos get_NoRegOpcodeExtension_SN(tilepro_bundle_bits num)
672a5a4af3bSchristos {
673a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
674a5a4af3bSchristos   return (((n >> 0)) & 0xf);
675a5a4af3bSchristos }
676a5a4af3bSchristos 
677a5a4af3bSchristos static __inline unsigned int
678a5a4af3bSchristos get_Opcode_SN(tilepro_bundle_bits num)
679a5a4af3bSchristos {
680a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
681a5a4af3bSchristos   return (((n >> 10)) & 0x3f);
682a5a4af3bSchristos }
683a5a4af3bSchristos 
684a5a4af3bSchristos static __inline unsigned int
685a5a4af3bSchristos get_Opcode_X0(tilepro_bundle_bits num)
686a5a4af3bSchristos {
687a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
688a5a4af3bSchristos   return (((n >> 28)) & 0x7);
689a5a4af3bSchristos }
690a5a4af3bSchristos 
691a5a4af3bSchristos static __inline unsigned int
692a5a4af3bSchristos get_Opcode_X1(tilepro_bundle_bits n)
693a5a4af3bSchristos {
694a5a4af3bSchristos   return (((unsigned int)(n >> 59)) & 0xf);
695a5a4af3bSchristos }
696a5a4af3bSchristos 
697a5a4af3bSchristos static __inline unsigned int
698a5a4af3bSchristos get_Opcode_Y0(tilepro_bundle_bits num)
699a5a4af3bSchristos {
700a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
701a5a4af3bSchristos   return (((n >> 27)) & 0xf);
702a5a4af3bSchristos }
703a5a4af3bSchristos 
704a5a4af3bSchristos static __inline unsigned int
705a5a4af3bSchristos get_Opcode_Y1(tilepro_bundle_bits n)
706a5a4af3bSchristos {
707a5a4af3bSchristos   return (((unsigned int)(n >> 59)) & 0xf);
708a5a4af3bSchristos }
709a5a4af3bSchristos 
710a5a4af3bSchristos static __inline unsigned int
711a5a4af3bSchristos get_Opcode_Y2(tilepro_bundle_bits n)
712a5a4af3bSchristos {
713a5a4af3bSchristos   return (((unsigned int)(n >> 56)) & 0x7);
714a5a4af3bSchristos }
715a5a4af3bSchristos 
716a5a4af3bSchristos static __inline unsigned int
717a5a4af3bSchristos get_RROpcodeExtension_SN(tilepro_bundle_bits num)
718a5a4af3bSchristos {
719a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
720a5a4af3bSchristos   return (((n >> 4)) & 0xf);
721a5a4af3bSchristos }
722a5a4af3bSchristos 
723a5a4af3bSchristos static __inline unsigned int
724a5a4af3bSchristos get_RRROpcodeExtension_X0(tilepro_bundle_bits num)
725a5a4af3bSchristos {
726a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
727a5a4af3bSchristos   return (((n >> 18)) & 0x1ff);
728a5a4af3bSchristos }
729a5a4af3bSchristos 
730a5a4af3bSchristos static __inline unsigned int
731a5a4af3bSchristos get_RRROpcodeExtension_X1(tilepro_bundle_bits n)
732a5a4af3bSchristos {
733a5a4af3bSchristos   return (((unsigned int)(n >> 49)) & 0x1ff);
734a5a4af3bSchristos }
735a5a4af3bSchristos 
736a5a4af3bSchristos static __inline unsigned int
737a5a4af3bSchristos get_RRROpcodeExtension_Y0(tilepro_bundle_bits num)
738a5a4af3bSchristos {
739a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
740a5a4af3bSchristos   return (((n >> 18)) & 0x3);
741a5a4af3bSchristos }
742a5a4af3bSchristos 
743a5a4af3bSchristos static __inline unsigned int
744a5a4af3bSchristos get_RRROpcodeExtension_Y1(tilepro_bundle_bits n)
745a5a4af3bSchristos {
746a5a4af3bSchristos   return (((unsigned int)(n >> 49)) & 0x3);
747a5a4af3bSchristos }
748a5a4af3bSchristos 
749a5a4af3bSchristos static __inline unsigned int
750a5a4af3bSchristos get_RouteOpcodeExtension_SN(tilepro_bundle_bits num)
751a5a4af3bSchristos {
752a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
753a5a4af3bSchristos   return (((n >> 0)) & 0x3ff);
754a5a4af3bSchristos }
755a5a4af3bSchristos 
756a5a4af3bSchristos static __inline unsigned int
757a5a4af3bSchristos get_S_X0(tilepro_bundle_bits num)
758a5a4af3bSchristos {
759a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
760a5a4af3bSchristos   return (((n >> 27)) & 0x1);
761a5a4af3bSchristos }
762a5a4af3bSchristos 
763a5a4af3bSchristos static __inline unsigned int
764a5a4af3bSchristos get_S_X1(tilepro_bundle_bits n)
765a5a4af3bSchristos {
766a5a4af3bSchristos   return (((unsigned int)(n >> 58)) & 0x1);
767a5a4af3bSchristos }
768a5a4af3bSchristos 
769a5a4af3bSchristos static __inline unsigned int
770a5a4af3bSchristos get_ShAmt_X0(tilepro_bundle_bits num)
771a5a4af3bSchristos {
772a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
773a5a4af3bSchristos   return (((n >> 12)) & 0x1f);
774a5a4af3bSchristos }
775a5a4af3bSchristos 
776a5a4af3bSchristos static __inline unsigned int
777a5a4af3bSchristos get_ShAmt_X1(tilepro_bundle_bits n)
778a5a4af3bSchristos {
779a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x1f);
780a5a4af3bSchristos }
781a5a4af3bSchristos 
782a5a4af3bSchristos static __inline unsigned int
783a5a4af3bSchristos get_ShAmt_Y0(tilepro_bundle_bits num)
784a5a4af3bSchristos {
785a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
786a5a4af3bSchristos   return (((n >> 12)) & 0x1f);
787a5a4af3bSchristos }
788a5a4af3bSchristos 
789a5a4af3bSchristos static __inline unsigned int
790a5a4af3bSchristos get_ShAmt_Y1(tilepro_bundle_bits n)
791a5a4af3bSchristos {
792a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x1f);
793a5a4af3bSchristos }
794a5a4af3bSchristos 
795a5a4af3bSchristos static __inline unsigned int
796a5a4af3bSchristos get_SrcA_X0(tilepro_bundle_bits num)
797a5a4af3bSchristos {
798a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
799a5a4af3bSchristos   return (((n >> 6)) & 0x3f);
800a5a4af3bSchristos }
801a5a4af3bSchristos 
802a5a4af3bSchristos static __inline unsigned int
803a5a4af3bSchristos get_SrcA_X1(tilepro_bundle_bits n)
804a5a4af3bSchristos {
805a5a4af3bSchristos   return (((unsigned int)(n >> 37)) & 0x3f);
806a5a4af3bSchristos }
807a5a4af3bSchristos 
808a5a4af3bSchristos static __inline unsigned int
809a5a4af3bSchristos get_SrcA_Y0(tilepro_bundle_bits num)
810a5a4af3bSchristos {
811a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
812a5a4af3bSchristos   return (((n >> 6)) & 0x3f);
813a5a4af3bSchristos }
814a5a4af3bSchristos 
815a5a4af3bSchristos static __inline unsigned int
816a5a4af3bSchristos get_SrcA_Y1(tilepro_bundle_bits n)
817a5a4af3bSchristos {
818a5a4af3bSchristos   return (((unsigned int)(n >> 37)) & 0x3f);
819a5a4af3bSchristos }
820a5a4af3bSchristos 
821a5a4af3bSchristos static __inline unsigned int
822a5a4af3bSchristos get_SrcA_Y2(tilepro_bundle_bits n)
823a5a4af3bSchristos {
824a5a4af3bSchristos   return (((n >> 26)) & 0x00000001) |
825a5a4af3bSchristos          (((unsigned int)(n >> 50)) & 0x0000003e);
826a5a4af3bSchristos }
827a5a4af3bSchristos 
828a5a4af3bSchristos static __inline unsigned int
829a5a4af3bSchristos get_SrcBDest_Y2(tilepro_bundle_bits num)
830a5a4af3bSchristos {
831a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
832a5a4af3bSchristos   return (((n >> 20)) & 0x3f);
833a5a4af3bSchristos }
834a5a4af3bSchristos 
835a5a4af3bSchristos static __inline unsigned int
836a5a4af3bSchristos get_SrcB_X0(tilepro_bundle_bits num)
837a5a4af3bSchristos {
838a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
839a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
840a5a4af3bSchristos }
841a5a4af3bSchristos 
842a5a4af3bSchristos static __inline unsigned int
843a5a4af3bSchristos get_SrcB_X1(tilepro_bundle_bits n)
844a5a4af3bSchristos {
845a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
846a5a4af3bSchristos }
847a5a4af3bSchristos 
848a5a4af3bSchristos static __inline unsigned int
849a5a4af3bSchristos get_SrcB_Y0(tilepro_bundle_bits num)
850a5a4af3bSchristos {
851a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
852a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
853a5a4af3bSchristos }
854a5a4af3bSchristos 
855a5a4af3bSchristos static __inline unsigned int
856a5a4af3bSchristos get_SrcB_Y1(tilepro_bundle_bits n)
857a5a4af3bSchristos {
858a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
859a5a4af3bSchristos }
860a5a4af3bSchristos 
861a5a4af3bSchristos static __inline unsigned int
862a5a4af3bSchristos get_Src_SN(tilepro_bundle_bits num)
863a5a4af3bSchristos {
864a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
865a5a4af3bSchristos   return (((n >> 0)) & 0x3);
866a5a4af3bSchristos }
867a5a4af3bSchristos 
868a5a4af3bSchristos static __inline unsigned int
869a5a4af3bSchristos get_UnOpcodeExtension_X0(tilepro_bundle_bits num)
870a5a4af3bSchristos {
871a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
872a5a4af3bSchristos   return (((n >> 12)) & 0x1f);
873a5a4af3bSchristos }
874a5a4af3bSchristos 
875a5a4af3bSchristos static __inline unsigned int
876a5a4af3bSchristos get_UnOpcodeExtension_X1(tilepro_bundle_bits n)
877a5a4af3bSchristos {
878a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x1f);
879a5a4af3bSchristos }
880a5a4af3bSchristos 
881a5a4af3bSchristos static __inline unsigned int
882a5a4af3bSchristos get_UnOpcodeExtension_Y0(tilepro_bundle_bits num)
883a5a4af3bSchristos {
884a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
885a5a4af3bSchristos   return (((n >> 12)) & 0x1f);
886a5a4af3bSchristos }
887a5a4af3bSchristos 
888a5a4af3bSchristos static __inline unsigned int
889a5a4af3bSchristos get_UnOpcodeExtension_Y1(tilepro_bundle_bits n)
890a5a4af3bSchristos {
891a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x1f);
892a5a4af3bSchristos }
893a5a4af3bSchristos 
894a5a4af3bSchristos static __inline unsigned int
895a5a4af3bSchristos get_UnShOpcodeExtension_X0(tilepro_bundle_bits num)
896a5a4af3bSchristos {
897a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
898a5a4af3bSchristos   return (((n >> 17)) & 0x3ff);
899a5a4af3bSchristos }
900a5a4af3bSchristos 
901a5a4af3bSchristos static __inline unsigned int
902a5a4af3bSchristos get_UnShOpcodeExtension_X1(tilepro_bundle_bits n)
903a5a4af3bSchristos {
904a5a4af3bSchristos   return (((unsigned int)(n >> 48)) & 0x3ff);
905a5a4af3bSchristos }
906a5a4af3bSchristos 
907a5a4af3bSchristos static __inline unsigned int
908a5a4af3bSchristos get_UnShOpcodeExtension_Y0(tilepro_bundle_bits num)
909a5a4af3bSchristos {
910a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
911a5a4af3bSchristos   return (((n >> 17)) & 0x7);
912a5a4af3bSchristos }
913a5a4af3bSchristos 
914a5a4af3bSchristos static __inline unsigned int
915a5a4af3bSchristos get_UnShOpcodeExtension_Y1(tilepro_bundle_bits n)
916a5a4af3bSchristos {
917a5a4af3bSchristos   return (((unsigned int)(n >> 48)) & 0x7);
918a5a4af3bSchristos }
919a5a4af3bSchristos 
920a5a4af3bSchristos 
921a5a4af3bSchristos static __inline int
922a5a4af3bSchristos sign_extend(int n, int num_bits)
923a5a4af3bSchristos {
924a5a4af3bSchristos   int shift = (int)(sizeof(int) * 8 - num_bits);
925a5a4af3bSchristos   return (n << shift) >> shift;
926a5a4af3bSchristos }
927a5a4af3bSchristos 
928a5a4af3bSchristos 
929a5a4af3bSchristos 
930a5a4af3bSchristos static __inline tilepro_bundle_bits
931a5a4af3bSchristos create_BrOff_SN(int num)
932a5a4af3bSchristos {
933a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
934a5a4af3bSchristos   return ((n & 0x3ff) << 0);
935a5a4af3bSchristos }
936a5a4af3bSchristos 
937a5a4af3bSchristos static __inline tilepro_bundle_bits
938a5a4af3bSchristos create_BrOff_X1(int num)
939a5a4af3bSchristos {
940a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
941a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
942a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x00018000)) << 20);
943a5a4af3bSchristos }
944a5a4af3bSchristos 
945a5a4af3bSchristos static __inline tilepro_bundle_bits
946a5a4af3bSchristos create_BrType_X1(int num)
947a5a4af3bSchristos {
948a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
949a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0xf)) << 31);
950a5a4af3bSchristos }
951a5a4af3bSchristos 
952a5a4af3bSchristos static __inline tilepro_bundle_bits
953a5a4af3bSchristos create_Dest_Imm8_X1(int num)
954a5a4af3bSchristos {
955a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
956a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
957a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x000000c0)) << 43);
958a5a4af3bSchristos }
959a5a4af3bSchristos 
960a5a4af3bSchristos static __inline tilepro_bundle_bits
961a5a4af3bSchristos create_Dest_SN(int num)
962a5a4af3bSchristos {
963a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
964a5a4af3bSchristos   return ((n & 0x3) << 2);
965a5a4af3bSchristos }
966a5a4af3bSchristos 
967a5a4af3bSchristos static __inline tilepro_bundle_bits
968a5a4af3bSchristos create_Dest_X0(int num)
969a5a4af3bSchristos {
970a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
971a5a4af3bSchristos   return ((n & 0x3f) << 0);
972a5a4af3bSchristos }
973a5a4af3bSchristos 
974a5a4af3bSchristos static __inline tilepro_bundle_bits
975a5a4af3bSchristos create_Dest_X1(int num)
976a5a4af3bSchristos {
977a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
978a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
979a5a4af3bSchristos }
980a5a4af3bSchristos 
981a5a4af3bSchristos static __inline tilepro_bundle_bits
982a5a4af3bSchristos create_Dest_Y0(int num)
983a5a4af3bSchristos {
984a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
985a5a4af3bSchristos   return ((n & 0x3f) << 0);
986a5a4af3bSchristos }
987a5a4af3bSchristos 
988a5a4af3bSchristos static __inline tilepro_bundle_bits
989a5a4af3bSchristos create_Dest_Y1(int num)
990a5a4af3bSchristos {
991a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
992a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3f)) << 31);
993a5a4af3bSchristos }
994a5a4af3bSchristos 
995a5a4af3bSchristos static __inline tilepro_bundle_bits
996a5a4af3bSchristos create_Imm16_X0(int num)
997a5a4af3bSchristos {
998a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
999a5a4af3bSchristos   return ((n & 0xffff) << 12);
1000a5a4af3bSchristos }
1001a5a4af3bSchristos 
1002a5a4af3bSchristos static __inline tilepro_bundle_bits
1003a5a4af3bSchristos create_Imm16_X1(int num)
1004a5a4af3bSchristos {
1005a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1006a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0xffff)) << 43);
1007a5a4af3bSchristos }
1008a5a4af3bSchristos 
1009a5a4af3bSchristos static __inline tilepro_bundle_bits
1010a5a4af3bSchristos create_Imm8_SN(int num)
1011a5a4af3bSchristos {
1012a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1013a5a4af3bSchristos   return ((n & 0xff) << 0);
1014a5a4af3bSchristos }
1015a5a4af3bSchristos 
1016a5a4af3bSchristos static __inline tilepro_bundle_bits
1017a5a4af3bSchristos create_Imm8_X0(int num)
1018a5a4af3bSchristos {
1019a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1020a5a4af3bSchristos   return ((n & 0xff) << 12);
1021a5a4af3bSchristos }
1022a5a4af3bSchristos 
1023a5a4af3bSchristos static __inline tilepro_bundle_bits
1024a5a4af3bSchristos create_Imm8_X1(int num)
1025a5a4af3bSchristos {
1026a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1027a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0xff)) << 43);
1028a5a4af3bSchristos }
1029a5a4af3bSchristos 
1030a5a4af3bSchristos static __inline tilepro_bundle_bits
1031a5a4af3bSchristos create_Imm8_Y0(int num)
1032a5a4af3bSchristos {
1033a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1034a5a4af3bSchristos   return ((n & 0xff) << 12);
1035a5a4af3bSchristos }
1036a5a4af3bSchristos 
1037a5a4af3bSchristos static __inline tilepro_bundle_bits
1038a5a4af3bSchristos create_Imm8_Y1(int num)
1039a5a4af3bSchristos {
1040a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1041a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0xff)) << 43);
1042a5a4af3bSchristos }
1043a5a4af3bSchristos 
1044a5a4af3bSchristos static __inline tilepro_bundle_bits
1045a5a4af3bSchristos create_ImmOpcodeExtension_X0(int num)
1046a5a4af3bSchristos {
1047a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1048a5a4af3bSchristos   return ((n & 0x7f) << 20);
1049a5a4af3bSchristos }
1050a5a4af3bSchristos 
1051a5a4af3bSchristos static __inline tilepro_bundle_bits
1052a5a4af3bSchristos create_ImmOpcodeExtension_X1(int num)
1053a5a4af3bSchristos {
1054a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1055a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x7f)) << 51);
1056a5a4af3bSchristos }
1057a5a4af3bSchristos 
1058a5a4af3bSchristos static __inline tilepro_bundle_bits
1059a5a4af3bSchristos create_ImmRROpcodeExtension_SN(int num)
1060a5a4af3bSchristos {
1061a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1062a5a4af3bSchristos   return ((n & 0x3) << 8);
1063a5a4af3bSchristos }
1064a5a4af3bSchristos 
1065a5a4af3bSchristos static __inline tilepro_bundle_bits
1066a5a4af3bSchristos create_JOffLong_X1(int num)
1067a5a4af3bSchristos {
1068a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1069a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
1070a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
1071a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
1072a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
1073a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x18000000)) << 31);
1074a5a4af3bSchristos }
1075a5a4af3bSchristos 
1076a5a4af3bSchristos static __inline tilepro_bundle_bits
1077a5a4af3bSchristos create_JOff_X1(int num)
1078a5a4af3bSchristos {
1079a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1080a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x00007fff)) << 43) |
1081a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x00018000)) << 20) |
1082a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x001e0000)) << 14) |
1083a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x07e00000)) << 16) |
1084a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x08000000)) << 31);
1085a5a4af3bSchristos }
1086a5a4af3bSchristos 
1087a5a4af3bSchristos static __inline tilepro_bundle_bits
1088a5a4af3bSchristos create_MF_Imm15_X1(int num)
1089a5a4af3bSchristos {
1090a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1091a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x00003fff)) << 37) |
1092a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
1093a5a4af3bSchristos }
1094a5a4af3bSchristos 
1095a5a4af3bSchristos static __inline tilepro_bundle_bits
1096a5a4af3bSchristos create_MMEnd_X0(int num)
1097a5a4af3bSchristos {
1098a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1099a5a4af3bSchristos   return ((n & 0x1f) << 18);
1100a5a4af3bSchristos }
1101a5a4af3bSchristos 
1102a5a4af3bSchristos static __inline tilepro_bundle_bits
1103a5a4af3bSchristos create_MMEnd_X1(int num)
1104a5a4af3bSchristos {
1105a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1106a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1f)) << 49);
1107a5a4af3bSchristos }
1108a5a4af3bSchristos 
1109a5a4af3bSchristos static __inline tilepro_bundle_bits
1110a5a4af3bSchristos create_MMStart_X0(int num)
1111a5a4af3bSchristos {
1112a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1113a5a4af3bSchristos   return ((n & 0x1f) << 23);
1114a5a4af3bSchristos }
1115a5a4af3bSchristos 
1116a5a4af3bSchristos static __inline tilepro_bundle_bits
1117a5a4af3bSchristos create_MMStart_X1(int num)
1118a5a4af3bSchristos {
1119a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1120a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1f)) << 54);
1121a5a4af3bSchristos }
1122a5a4af3bSchristos 
1123a5a4af3bSchristos static __inline tilepro_bundle_bits
1124a5a4af3bSchristos create_MT_Imm15_X1(int num)
1125a5a4af3bSchristos {
1126a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1127a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x0000003f)) << 31) |
1128a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x00003fc0)) << 37) |
1129a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x00004000)) << 44);
1130a5a4af3bSchristos }
1131a5a4af3bSchristos 
1132a5a4af3bSchristos static __inline tilepro_bundle_bits
1133a5a4af3bSchristos create_Mode(int num)
1134a5a4af3bSchristos {
1135a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1136a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1)) << 63);
1137a5a4af3bSchristos }
1138a5a4af3bSchristos 
1139a5a4af3bSchristos static __inline tilepro_bundle_bits
1140a5a4af3bSchristos create_NoRegOpcodeExtension_SN(int num)
1141a5a4af3bSchristos {
1142a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1143a5a4af3bSchristos   return ((n & 0xf) << 0);
1144a5a4af3bSchristos }
1145a5a4af3bSchristos 
1146a5a4af3bSchristos static __inline tilepro_bundle_bits
1147a5a4af3bSchristos create_Opcode_SN(int num)
1148a5a4af3bSchristos {
1149a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1150a5a4af3bSchristos   return ((n & 0x3f) << 10);
1151a5a4af3bSchristos }
1152a5a4af3bSchristos 
1153a5a4af3bSchristos static __inline tilepro_bundle_bits
1154a5a4af3bSchristos create_Opcode_X0(int num)
1155a5a4af3bSchristos {
1156a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1157a5a4af3bSchristos   return ((n & 0x7) << 28);
1158a5a4af3bSchristos }
1159a5a4af3bSchristos 
1160a5a4af3bSchristos static __inline tilepro_bundle_bits
1161a5a4af3bSchristos create_Opcode_X1(int num)
1162a5a4af3bSchristos {
1163a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1164a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0xf)) << 59);
1165a5a4af3bSchristos }
1166a5a4af3bSchristos 
1167a5a4af3bSchristos static __inline tilepro_bundle_bits
1168a5a4af3bSchristos create_Opcode_Y0(int num)
1169a5a4af3bSchristos {
1170a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1171a5a4af3bSchristos   return ((n & 0xf) << 27);
1172a5a4af3bSchristos }
1173a5a4af3bSchristos 
1174a5a4af3bSchristos static __inline tilepro_bundle_bits
1175a5a4af3bSchristos create_Opcode_Y1(int num)
1176a5a4af3bSchristos {
1177a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1178a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0xf)) << 59);
1179a5a4af3bSchristos }
1180a5a4af3bSchristos 
1181a5a4af3bSchristos static __inline tilepro_bundle_bits
1182a5a4af3bSchristos create_Opcode_Y2(int num)
1183a5a4af3bSchristos {
1184a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1185a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x7)) << 56);
1186a5a4af3bSchristos }
1187a5a4af3bSchristos 
1188a5a4af3bSchristos static __inline tilepro_bundle_bits
1189a5a4af3bSchristos create_RROpcodeExtension_SN(int num)
1190a5a4af3bSchristos {
1191a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1192a5a4af3bSchristos   return ((n & 0xf) << 4);
1193a5a4af3bSchristos }
1194a5a4af3bSchristos 
1195a5a4af3bSchristos static __inline tilepro_bundle_bits
1196a5a4af3bSchristos create_RRROpcodeExtension_X0(int num)
1197a5a4af3bSchristos {
1198a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1199a5a4af3bSchristos   return ((n & 0x1ff) << 18);
1200a5a4af3bSchristos }
1201a5a4af3bSchristos 
1202a5a4af3bSchristos static __inline tilepro_bundle_bits
1203a5a4af3bSchristos create_RRROpcodeExtension_X1(int num)
1204a5a4af3bSchristos {
1205a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1206a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1ff)) << 49);
1207a5a4af3bSchristos }
1208a5a4af3bSchristos 
1209a5a4af3bSchristos static __inline tilepro_bundle_bits
1210a5a4af3bSchristos create_RRROpcodeExtension_Y0(int num)
1211a5a4af3bSchristos {
1212a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1213a5a4af3bSchristos   return ((n & 0x3) << 18);
1214a5a4af3bSchristos }
1215a5a4af3bSchristos 
1216a5a4af3bSchristos static __inline tilepro_bundle_bits
1217a5a4af3bSchristos create_RRROpcodeExtension_Y1(int num)
1218a5a4af3bSchristos {
1219a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1220a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3)) << 49);
1221a5a4af3bSchristos }
1222a5a4af3bSchristos 
1223a5a4af3bSchristos static __inline tilepro_bundle_bits
1224a5a4af3bSchristos create_RouteOpcodeExtension_SN(int num)
1225a5a4af3bSchristos {
1226a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1227a5a4af3bSchristos   return ((n & 0x3ff) << 0);
1228a5a4af3bSchristos }
1229a5a4af3bSchristos 
1230a5a4af3bSchristos static __inline tilepro_bundle_bits
1231a5a4af3bSchristos create_S_X0(int num)
1232a5a4af3bSchristos {
1233a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1234a5a4af3bSchristos   return ((n & 0x1) << 27);
1235a5a4af3bSchristos }
1236a5a4af3bSchristos 
1237a5a4af3bSchristos static __inline tilepro_bundle_bits
1238a5a4af3bSchristos create_S_X1(int num)
1239a5a4af3bSchristos {
1240a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1241a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1)) << 58);
1242a5a4af3bSchristos }
1243a5a4af3bSchristos 
1244a5a4af3bSchristos static __inline tilepro_bundle_bits
1245a5a4af3bSchristos create_ShAmt_X0(int num)
1246a5a4af3bSchristos {
1247a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1248a5a4af3bSchristos   return ((n & 0x1f) << 12);
1249a5a4af3bSchristos }
1250a5a4af3bSchristos 
1251a5a4af3bSchristos static __inline tilepro_bundle_bits
1252a5a4af3bSchristos create_ShAmt_X1(int num)
1253a5a4af3bSchristos {
1254a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1255a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1256a5a4af3bSchristos }
1257a5a4af3bSchristos 
1258a5a4af3bSchristos static __inline tilepro_bundle_bits
1259a5a4af3bSchristos create_ShAmt_Y0(int num)
1260a5a4af3bSchristos {
1261a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1262a5a4af3bSchristos   return ((n & 0x1f) << 12);
1263a5a4af3bSchristos }
1264a5a4af3bSchristos 
1265a5a4af3bSchristos static __inline tilepro_bundle_bits
1266a5a4af3bSchristos create_ShAmt_Y1(int num)
1267a5a4af3bSchristos {
1268a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1269a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1270a5a4af3bSchristos }
1271a5a4af3bSchristos 
1272a5a4af3bSchristos static __inline tilepro_bundle_bits
1273a5a4af3bSchristos create_SrcA_X0(int num)
1274a5a4af3bSchristos {
1275a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1276a5a4af3bSchristos   return ((n & 0x3f) << 6);
1277a5a4af3bSchristos }
1278a5a4af3bSchristos 
1279a5a4af3bSchristos static __inline tilepro_bundle_bits
1280a5a4af3bSchristos create_SrcA_X1(int num)
1281a5a4af3bSchristos {
1282a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1283a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
1284a5a4af3bSchristos }
1285a5a4af3bSchristos 
1286a5a4af3bSchristos static __inline tilepro_bundle_bits
1287a5a4af3bSchristos create_SrcA_Y0(int num)
1288a5a4af3bSchristos {
1289a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1290a5a4af3bSchristos   return ((n & 0x3f) << 6);
1291a5a4af3bSchristos }
1292a5a4af3bSchristos 
1293a5a4af3bSchristos static __inline tilepro_bundle_bits
1294a5a4af3bSchristos create_SrcA_Y1(int num)
1295a5a4af3bSchristos {
1296a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1297a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3f)) << 37);
1298a5a4af3bSchristos }
1299a5a4af3bSchristos 
1300a5a4af3bSchristos static __inline tilepro_bundle_bits
1301a5a4af3bSchristos create_SrcA_Y2(int num)
1302a5a4af3bSchristos {
1303a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1304a5a4af3bSchristos   return ((n & 0x00000001) << 26) |
1305a5a4af3bSchristos          (((tilepro_bundle_bits)(n & 0x0000003e)) << 50);
1306a5a4af3bSchristos }
1307a5a4af3bSchristos 
1308a5a4af3bSchristos static __inline tilepro_bundle_bits
1309a5a4af3bSchristos create_SrcBDest_Y2(int num)
1310a5a4af3bSchristos {
1311a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1312a5a4af3bSchristos   return ((n & 0x3f) << 20);
1313a5a4af3bSchristos }
1314a5a4af3bSchristos 
1315a5a4af3bSchristos static __inline tilepro_bundle_bits
1316a5a4af3bSchristos create_SrcB_X0(int num)
1317a5a4af3bSchristos {
1318a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1319a5a4af3bSchristos   return ((n & 0x3f) << 12);
1320a5a4af3bSchristos }
1321a5a4af3bSchristos 
1322a5a4af3bSchristos static __inline tilepro_bundle_bits
1323a5a4af3bSchristos create_SrcB_X1(int num)
1324a5a4af3bSchristos {
1325a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1326a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
1327a5a4af3bSchristos }
1328a5a4af3bSchristos 
1329a5a4af3bSchristos static __inline tilepro_bundle_bits
1330a5a4af3bSchristos create_SrcB_Y0(int num)
1331a5a4af3bSchristos {
1332a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1333a5a4af3bSchristos   return ((n & 0x3f) << 12);
1334a5a4af3bSchristos }
1335a5a4af3bSchristos 
1336a5a4af3bSchristos static __inline tilepro_bundle_bits
1337a5a4af3bSchristos create_SrcB_Y1(int num)
1338a5a4af3bSchristos {
1339a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1340a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3f)) << 43);
1341a5a4af3bSchristos }
1342a5a4af3bSchristos 
1343a5a4af3bSchristos static __inline tilepro_bundle_bits
1344a5a4af3bSchristos create_Src_SN(int num)
1345a5a4af3bSchristos {
1346a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1347a5a4af3bSchristos   return ((n & 0x3) << 0);
1348a5a4af3bSchristos }
1349a5a4af3bSchristos 
1350a5a4af3bSchristos static __inline tilepro_bundle_bits
1351a5a4af3bSchristos create_UnOpcodeExtension_X0(int num)
1352a5a4af3bSchristos {
1353a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1354a5a4af3bSchristos   return ((n & 0x1f) << 12);
1355a5a4af3bSchristos }
1356a5a4af3bSchristos 
1357a5a4af3bSchristos static __inline tilepro_bundle_bits
1358a5a4af3bSchristos create_UnOpcodeExtension_X1(int num)
1359a5a4af3bSchristos {
1360a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1361a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1362a5a4af3bSchristos }
1363a5a4af3bSchristos 
1364a5a4af3bSchristos static __inline tilepro_bundle_bits
1365a5a4af3bSchristos create_UnOpcodeExtension_Y0(int num)
1366a5a4af3bSchristos {
1367a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1368a5a4af3bSchristos   return ((n & 0x1f) << 12);
1369a5a4af3bSchristos }
1370a5a4af3bSchristos 
1371a5a4af3bSchristos static __inline tilepro_bundle_bits
1372a5a4af3bSchristos create_UnOpcodeExtension_Y1(int num)
1373a5a4af3bSchristos {
1374a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1375a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x1f)) << 43);
1376a5a4af3bSchristos }
1377a5a4af3bSchristos 
1378a5a4af3bSchristos static __inline tilepro_bundle_bits
1379a5a4af3bSchristos create_UnShOpcodeExtension_X0(int num)
1380a5a4af3bSchristos {
1381a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1382a5a4af3bSchristos   return ((n & 0x3ff) << 17);
1383a5a4af3bSchristos }
1384a5a4af3bSchristos 
1385a5a4af3bSchristos static __inline tilepro_bundle_bits
1386a5a4af3bSchristos create_UnShOpcodeExtension_X1(int num)
1387a5a4af3bSchristos {
1388a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1389a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x3ff)) << 48);
1390a5a4af3bSchristos }
1391a5a4af3bSchristos 
1392a5a4af3bSchristos static __inline tilepro_bundle_bits
1393a5a4af3bSchristos create_UnShOpcodeExtension_Y0(int num)
1394a5a4af3bSchristos {
1395a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1396a5a4af3bSchristos   return ((n & 0x7) << 17);
1397a5a4af3bSchristos }
1398a5a4af3bSchristos 
1399a5a4af3bSchristos static __inline tilepro_bundle_bits
1400a5a4af3bSchristos create_UnShOpcodeExtension_Y1(int num)
1401a5a4af3bSchristos {
1402a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1403a5a4af3bSchristos   return (((tilepro_bundle_bits)(n & 0x7)) << 48);
1404a5a4af3bSchristos }
1405a5a4af3bSchristos 
1406a5a4af3bSchristos 
1407a5a4af3bSchristos 
1408a5a4af3bSchristos typedef enum
1409a5a4af3bSchristos {
1410a5a4af3bSchristos   TILEPRO_PIPELINE_X0,
1411a5a4af3bSchristos   TILEPRO_PIPELINE_X1,
1412a5a4af3bSchristos   TILEPRO_PIPELINE_Y0,
1413a5a4af3bSchristos   TILEPRO_PIPELINE_Y1,
1414a5a4af3bSchristos   TILEPRO_PIPELINE_Y2,
141582650ea5Schristos   TILEPRO_NUM_PIPELINE_ENCODINGS
1416a5a4af3bSchristos } tilepro_pipeline;
1417a5a4af3bSchristos 
1418a5a4af3bSchristos #define tilepro_is_x_pipeline(p) ((int)(p) <= (int)TILEPRO_PIPELINE_X1)
1419a5a4af3bSchristos 
1420a5a4af3bSchristos typedef enum
1421a5a4af3bSchristos {
1422a5a4af3bSchristos   TILEPRO_OP_TYPE_REGISTER,
1423a5a4af3bSchristos   TILEPRO_OP_TYPE_IMMEDIATE,
1424a5a4af3bSchristos   TILEPRO_OP_TYPE_ADDRESS,
1425a5a4af3bSchristos   TILEPRO_OP_TYPE_SPR
1426a5a4af3bSchristos } tilepro_operand_type;
1427a5a4af3bSchristos 
1428a5a4af3bSchristos /* This is the bit that determines if a bundle is in the Y encoding. */
1429a5a4af3bSchristos #define TILEPRO_BUNDLE_Y_ENCODING_MASK ((tilepro_bundle_bits)1 << 63)
1430a5a4af3bSchristos 
1431a5a4af3bSchristos enum
1432a5a4af3bSchristos {
1433a5a4af3bSchristos   /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
1434a5a4af3bSchristos   TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
1435a5a4af3bSchristos 
1436a5a4af3bSchristos   /* Log base 2 of TILEPRO_BUNDLE_SIZE_IN_BYTES. */
1437a5a4af3bSchristos   TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
1438a5a4af3bSchristos 
1439a5a4af3bSchristos   /* Instructions take this many bytes. */
1440a5a4af3bSchristos   TILEPRO_BUNDLE_SIZE_IN_BYTES = 1 << TILEPRO_LOG2_BUNDLE_SIZE_IN_BYTES,
1441a5a4af3bSchristos 
1442a5a4af3bSchristos   /* Log base 2 of TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES. */
1443a5a4af3bSchristos   TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
1444a5a4af3bSchristos 
1445a5a4af3bSchristos   /* Bundles should be aligned modulo this number of bytes. */
1446a5a4af3bSchristos   TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES =
1447a5a4af3bSchristos     (1 << TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
1448a5a4af3bSchristos 
1449a5a4af3bSchristos   /* Log base 2 of TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES. */
1450a5a4af3bSchristos   TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES = 1,
1451a5a4af3bSchristos 
1452a5a4af3bSchristos   /* Static network instructions take this many bytes. */
1453a5a4af3bSchristos   TILEPRO_SN_INSTRUCTION_SIZE_IN_BYTES =
1454a5a4af3bSchristos     (1 << TILEPRO_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES),
1455a5a4af3bSchristos 
1456a5a4af3bSchristos   /* Number of registers (some are magic, such as network I/O). */
1457a5a4af3bSchristos   TILEPRO_NUM_REGISTERS = 64,
1458a5a4af3bSchristos 
1459a5a4af3bSchristos   /* Number of static network registers. */
1460a5a4af3bSchristos   TILEPRO_NUM_SN_REGISTERS = 4
1461a5a4af3bSchristos };
1462a5a4af3bSchristos 
1463a5a4af3bSchristos 
1464a5a4af3bSchristos struct tilepro_operand
1465a5a4af3bSchristos {
1466a5a4af3bSchristos   /* Is this operand a register, immediate or address? */
1467a5a4af3bSchristos   tilepro_operand_type type;
1468a5a4af3bSchristos 
1469a5a4af3bSchristos   /* The default relocation type for this operand.  */
1470a5a4af3bSchristos   signed int default_reloc : 16;
1471a5a4af3bSchristos 
1472a5a4af3bSchristos   /* How many bits is this value? (used for range checking) */
1473a5a4af3bSchristos   unsigned int num_bits : 5;
1474a5a4af3bSchristos 
1475a5a4af3bSchristos   /* Is the value signed? (used for range checking) */
1476a5a4af3bSchristos   unsigned int is_signed : 1;
1477a5a4af3bSchristos 
1478a5a4af3bSchristos   /* Is this operand a source register? */
1479a5a4af3bSchristos   unsigned int is_src_reg : 1;
1480a5a4af3bSchristos 
1481a5a4af3bSchristos   /* Is this operand written? (i.e. is it a destination register) */
1482a5a4af3bSchristos   unsigned int is_dest_reg : 1;
1483a5a4af3bSchristos 
1484a5a4af3bSchristos   /* Is this operand PC-relative? */
1485a5a4af3bSchristos   unsigned int is_pc_relative : 1;
1486a5a4af3bSchristos 
1487a5a4af3bSchristos   /* By how many bits do we right shift the value before inserting? */
1488a5a4af3bSchristos   unsigned int rightshift : 2;
1489a5a4af3bSchristos 
1490a5a4af3bSchristos   /* Return the bits for this operand to be ORed into an existing bundle. */
1491a5a4af3bSchristos   tilepro_bundle_bits (*insert) (int op);
1492a5a4af3bSchristos 
1493a5a4af3bSchristos   /* Extract this operand and return it. */
1494a5a4af3bSchristos   unsigned int (*extract) (tilepro_bundle_bits bundle);
1495a5a4af3bSchristos };
1496a5a4af3bSchristos 
1497a5a4af3bSchristos 
1498a5a4af3bSchristos extern const struct tilepro_operand tilepro_operands[];
1499a5a4af3bSchristos 
1500a5a4af3bSchristos /* One finite-state machine per pipe for rapid instruction decoding. */
1501a5a4af3bSchristos extern const unsigned short * const
1502a5a4af3bSchristos tilepro_bundle_decoder_fsms[TILEPRO_NUM_PIPELINE_ENCODINGS];
1503a5a4af3bSchristos 
1504a5a4af3bSchristos 
1505a5a4af3bSchristos struct tilepro_opcode
1506a5a4af3bSchristos {
1507a5a4af3bSchristos   /* The opcode mnemonic, e.g. "add" */
1508a5a4af3bSchristos   const char *name;
1509a5a4af3bSchristos 
1510a5a4af3bSchristos   /* The enum value for this mnemonic. */
1511a5a4af3bSchristos   tilepro_mnemonic mnemonic;
1512a5a4af3bSchristos 
1513a5a4af3bSchristos   /* A bit mask of which of the five pipes this instruction
1514a5a4af3bSchristos      is compatible with:
1515a5a4af3bSchristos      X0  0x01
1516a5a4af3bSchristos      X1  0x02
1517a5a4af3bSchristos      Y0  0x04
1518a5a4af3bSchristos      Y1  0x08
1519a5a4af3bSchristos      Y2  0x10 */
1520a5a4af3bSchristos   unsigned char pipes;
1521a5a4af3bSchristos 
1522a5a4af3bSchristos   /* How many operands are there? */
1523a5a4af3bSchristos   unsigned char num_operands;
1524a5a4af3bSchristos 
1525a5a4af3bSchristos   /* Which register does this write implicitly, or TREG_ZERO if none? */
1526a5a4af3bSchristos   unsigned char implicitly_written_register;
1527a5a4af3bSchristos 
1528a5a4af3bSchristos   /* Can this be bundled with other instructions (almost always true). */
1529a5a4af3bSchristos   unsigned char can_bundle;
1530a5a4af3bSchristos 
1531a5a4af3bSchristos   /* The description of the operands. Each of these is an
1532a5a4af3bSchristos    * index into the tilepro_operands[] table. */
1533a5a4af3bSchristos   unsigned char operands[TILEPRO_NUM_PIPELINE_ENCODINGS][TILEPRO_MAX_OPERANDS];
1534a5a4af3bSchristos 
1535a5a4af3bSchristos #if !defined(__KERNEL__) && !defined(_LIBC)
1536a5a4af3bSchristos   /* A mask of which bits have predefined values for each pipeline.
1537a5a4af3bSchristos    * This is useful for disassembly. */
1538a5a4af3bSchristos   tilepro_bundle_bits fixed_bit_masks[TILEPRO_NUM_PIPELINE_ENCODINGS];
1539a5a4af3bSchristos 
1540a5a4af3bSchristos   /* For each bit set in fixed_bit_masks, what the value is for this
1541a5a4af3bSchristos    * instruction. */
1542a5a4af3bSchristos   tilepro_bundle_bits fixed_bit_values[TILEPRO_NUM_PIPELINE_ENCODINGS];
1543a5a4af3bSchristos #endif
1544a5a4af3bSchristos };
1545a5a4af3bSchristos 
1546a5a4af3bSchristos extern const struct tilepro_opcode tilepro_opcodes[];
1547a5a4af3bSchristos 
1548a5a4af3bSchristos #if !defined(__KERNEL__) && !defined(_LIBC)
1549a5a4af3bSchristos 
1550a5a4af3bSchristos typedef unsigned short tilepro_sn_instruction_bits;
1551a5a4af3bSchristos 
1552a5a4af3bSchristos struct tilepro_sn_opcode
1553a5a4af3bSchristos {
1554a5a4af3bSchristos   /* The opcode mnemonic, e.g. "add" */
1555a5a4af3bSchristos   const char *name;
1556a5a4af3bSchristos 
1557a5a4af3bSchristos   /* The enum value for this mnemonic. */
1558a5a4af3bSchristos   tilepro_sn_mnemonic mnemonic;
1559a5a4af3bSchristos 
1560a5a4af3bSchristos   /* How many operands are there? */
1561a5a4af3bSchristos   unsigned char num_operands;
1562a5a4af3bSchristos 
1563a5a4af3bSchristos   /* The description of the operands. Each of these is an
1564a5a4af3bSchristos    * index into the tilepro_operands[] table. */
1565a5a4af3bSchristos   unsigned char operands[TILEPRO_SN_MAX_OPERANDS];
1566a5a4af3bSchristos 
1567a5a4af3bSchristos   /* A mask of which bits have predefined values.
1568a5a4af3bSchristos    * This is useful for disassembly. */
1569a5a4af3bSchristos   tilepro_sn_instruction_bits fixed_bit_mask;
1570a5a4af3bSchristos 
1571a5a4af3bSchristos   /* For each bit set in fixed_bit_masks, what its value is. */
1572a5a4af3bSchristos   tilepro_sn_instruction_bits fixed_bit_values;
1573a5a4af3bSchristos };
1574a5a4af3bSchristos 
1575a5a4af3bSchristos extern const struct tilepro_sn_opcode tilepro_sn_opcodes[];
1576a5a4af3bSchristos 
1577a5a4af3bSchristos #endif /* !__KERNEL__ && !_LIBC */
1578a5a4af3bSchristos 
1579a5a4af3bSchristos /* Used for non-textual disassembly into structs. */
1580a5a4af3bSchristos struct tilepro_decoded_instruction
1581a5a4af3bSchristos {
1582a5a4af3bSchristos   const struct tilepro_opcode *opcode;
1583a5a4af3bSchristos   const struct tilepro_operand *operands[TILEPRO_MAX_OPERANDS];
1584a5a4af3bSchristos   int operand_values[TILEPRO_MAX_OPERANDS];
1585a5a4af3bSchristos };
1586a5a4af3bSchristos 
1587a5a4af3bSchristos 
1588a5a4af3bSchristos /* Disassemble a bundle into a struct for machine processing. */
1589a5a4af3bSchristos extern int parse_insn_tilepro(tilepro_bundle_bits bits,
1590a5a4af3bSchristos                               unsigned int pc,
1591a5a4af3bSchristos                               struct tilepro_decoded_instruction
1592a5a4af3bSchristos                               decoded[TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE]);
1593a5a4af3bSchristos 
1594a5a4af3bSchristos 
1595a5a4af3bSchristos /* Given a set of bundle bits and a specific pipe, returns which
1596a5a4af3bSchristos  * instruction the bundle contains in that pipe.
1597a5a4af3bSchristos  */
1598a5a4af3bSchristos extern const struct tilepro_opcode *
1599a5a4af3bSchristos find_opcode(tilepro_bundle_bits bits, tilepro_pipeline pipe);
1600a5a4af3bSchristos 
1601a5a4af3bSchristos 
1602a5a4af3bSchristos #if !defined(__KERNEL__) && !defined(_LIBC)
1603a5a4af3bSchristos /* Canonical names of all the registers. */
1604a5a4af3bSchristos /* ISSUE: This table lives in "tilepro-dis.c" */
1605a5a4af3bSchristos extern const char * const tilepro_register_names[];
1606a5a4af3bSchristos 
1607a5a4af3bSchristos /* Descriptor for a special-purpose register. */
1608a5a4af3bSchristos struct tilepro_spr
1609a5a4af3bSchristos {
1610a5a4af3bSchristos   /* The number */
1611a5a4af3bSchristos   int number;
1612a5a4af3bSchristos 
1613a5a4af3bSchristos   /* The name */
1614a5a4af3bSchristos   const char *name;
1615a5a4af3bSchristos };
1616a5a4af3bSchristos 
1617a5a4af3bSchristos /* List of all the SPRs; ordered by increasing number. */
1618a5a4af3bSchristos extern const struct tilepro_spr tilepro_sprs[];
1619a5a4af3bSchristos 
1620a5a4af3bSchristos /* Number of special-purpose registers. */
1621a5a4af3bSchristos extern const int tilepro_num_sprs;
1622a5a4af3bSchristos 
1623a5a4af3bSchristos extern const char *
1624a5a4af3bSchristos get_tilepro_spr_name (int num);
1625a5a4af3bSchristos #endif /* !__KERNEL__ && !_LIBC */
1626a5a4af3bSchristos 
1627a5a4af3bSchristos /* Make a few "tile_" variables to simply common code between
1628a5a4af3bSchristos    architectures.  */
1629a5a4af3bSchristos 
1630a5a4af3bSchristos typedef tilepro_bundle_bits tile_bundle_bits;
1631a5a4af3bSchristos #define TILE_BUNDLE_SIZE_IN_BYTES TILEPRO_BUNDLE_SIZE_IN_BYTES
1632a5a4af3bSchristos #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEPRO_BUNDLE_ALIGNMENT_IN_BYTES
1633a5a4af3bSchristos #define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \
1634a5a4af3bSchristos   TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
1635a5a4af3bSchristos 
1636a5a4af3bSchristos #endif /* opcode_tilepro_h */
1637