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