xref: /netbsd-src/external/gpl3/gdb.old/dist/include/opcode/tilegx.h (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1a5a4af3bSchristos /* TILE-Gx 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_tile_h
22a5a4af3bSchristos #define opcode_tile_h
23a5a4af3bSchristos 
24a5a4af3bSchristos #ifdef __cplusplus
25a5a4af3bSchristos extern "C" {
26a5a4af3bSchristos #endif
27a5a4af3bSchristos 
28a5a4af3bSchristos typedef unsigned long long tilegx_bundle_bits;
29a5a4af3bSchristos 
30a5a4af3bSchristos 
31a5a4af3bSchristos enum
32a5a4af3bSchristos {
33a5a4af3bSchristos   TILEGX_MAX_OPERANDS = 4 /* bfexts */
34a5a4af3bSchristos };
35a5a4af3bSchristos 
36a5a4af3bSchristos typedef enum
37a5a4af3bSchristos {
38a5a4af3bSchristos   TILEGX_OPC_BPT,
39a5a4af3bSchristos   TILEGX_OPC_INFO,
40a5a4af3bSchristos   TILEGX_OPC_INFOL,
41a5a4af3bSchristos   TILEGX_OPC_LD4S_TLS,
42a5a4af3bSchristos   TILEGX_OPC_LD_TLS,
43a5a4af3bSchristos   TILEGX_OPC_MOVE,
44a5a4af3bSchristos   TILEGX_OPC_MOVEI,
45a5a4af3bSchristos   TILEGX_OPC_MOVELI,
46a5a4af3bSchristos   TILEGX_OPC_PREFETCH,
47a5a4af3bSchristos   TILEGX_OPC_PREFETCH_ADD_L1,
48a5a4af3bSchristos   TILEGX_OPC_PREFETCH_ADD_L1_FAULT,
49a5a4af3bSchristos   TILEGX_OPC_PREFETCH_ADD_L2,
50a5a4af3bSchristos   TILEGX_OPC_PREFETCH_ADD_L2_FAULT,
51a5a4af3bSchristos   TILEGX_OPC_PREFETCH_ADD_L3,
52a5a4af3bSchristos   TILEGX_OPC_PREFETCH_ADD_L3_FAULT,
53a5a4af3bSchristos   TILEGX_OPC_PREFETCH_L1,
54a5a4af3bSchristos   TILEGX_OPC_PREFETCH_L1_FAULT,
55a5a4af3bSchristos   TILEGX_OPC_PREFETCH_L2,
56a5a4af3bSchristos   TILEGX_OPC_PREFETCH_L2_FAULT,
57a5a4af3bSchristos   TILEGX_OPC_PREFETCH_L3,
58a5a4af3bSchristos   TILEGX_OPC_PREFETCH_L3_FAULT,
59a5a4af3bSchristos   TILEGX_OPC_RAISE,
60a5a4af3bSchristos   TILEGX_OPC_ADD,
61a5a4af3bSchristos   TILEGX_OPC_ADDI,
62a5a4af3bSchristos   TILEGX_OPC_ADDLI,
63a5a4af3bSchristos   TILEGX_OPC_ADDX,
64a5a4af3bSchristos   TILEGX_OPC_ADDXI,
65a5a4af3bSchristos   TILEGX_OPC_ADDXLI,
66a5a4af3bSchristos   TILEGX_OPC_ADDXSC,
67a5a4af3bSchristos   TILEGX_OPC_AND,
68a5a4af3bSchristos   TILEGX_OPC_ANDI,
69a5a4af3bSchristos   TILEGX_OPC_BEQZ,
70a5a4af3bSchristos   TILEGX_OPC_BEQZT,
71a5a4af3bSchristos   TILEGX_OPC_BFEXTS,
72a5a4af3bSchristos   TILEGX_OPC_BFEXTU,
73a5a4af3bSchristos   TILEGX_OPC_BFINS,
74a5a4af3bSchristos   TILEGX_OPC_BGEZ,
75a5a4af3bSchristos   TILEGX_OPC_BGEZT,
76a5a4af3bSchristos   TILEGX_OPC_BGTZ,
77a5a4af3bSchristos   TILEGX_OPC_BGTZT,
78a5a4af3bSchristos   TILEGX_OPC_BLBC,
79a5a4af3bSchristos   TILEGX_OPC_BLBCT,
80a5a4af3bSchristos   TILEGX_OPC_BLBS,
81a5a4af3bSchristos   TILEGX_OPC_BLBST,
82a5a4af3bSchristos   TILEGX_OPC_BLEZ,
83a5a4af3bSchristos   TILEGX_OPC_BLEZT,
84a5a4af3bSchristos   TILEGX_OPC_BLTZ,
85a5a4af3bSchristos   TILEGX_OPC_BLTZT,
86a5a4af3bSchristos   TILEGX_OPC_BNEZ,
87a5a4af3bSchristos   TILEGX_OPC_BNEZT,
88a5a4af3bSchristos   TILEGX_OPC_CLZ,
89a5a4af3bSchristos   TILEGX_OPC_CMOVEQZ,
90a5a4af3bSchristos   TILEGX_OPC_CMOVNEZ,
91a5a4af3bSchristos   TILEGX_OPC_CMPEQ,
92a5a4af3bSchristos   TILEGX_OPC_CMPEQI,
93a5a4af3bSchristos   TILEGX_OPC_CMPEXCH,
94a5a4af3bSchristos   TILEGX_OPC_CMPEXCH4,
95a5a4af3bSchristos   TILEGX_OPC_CMPLES,
96a5a4af3bSchristos   TILEGX_OPC_CMPLEU,
97a5a4af3bSchristos   TILEGX_OPC_CMPLTS,
98a5a4af3bSchristos   TILEGX_OPC_CMPLTSI,
99a5a4af3bSchristos   TILEGX_OPC_CMPLTU,
100a5a4af3bSchristos   TILEGX_OPC_CMPLTUI,
101a5a4af3bSchristos   TILEGX_OPC_CMPNE,
102a5a4af3bSchristos   TILEGX_OPC_CMUL,
103a5a4af3bSchristos   TILEGX_OPC_CMULA,
104a5a4af3bSchristos   TILEGX_OPC_CMULAF,
105a5a4af3bSchristos   TILEGX_OPC_CMULF,
106a5a4af3bSchristos   TILEGX_OPC_CMULFR,
107a5a4af3bSchristos   TILEGX_OPC_CMULH,
108a5a4af3bSchristos   TILEGX_OPC_CMULHR,
109a5a4af3bSchristos   TILEGX_OPC_CRC32_32,
110a5a4af3bSchristos   TILEGX_OPC_CRC32_8,
111a5a4af3bSchristos   TILEGX_OPC_CTZ,
112a5a4af3bSchristos   TILEGX_OPC_DBLALIGN,
113a5a4af3bSchristos   TILEGX_OPC_DBLALIGN2,
114a5a4af3bSchristos   TILEGX_OPC_DBLALIGN4,
115a5a4af3bSchristos   TILEGX_OPC_DBLALIGN6,
116a5a4af3bSchristos   TILEGX_OPC_DRAIN,
117a5a4af3bSchristos   TILEGX_OPC_DTLBPR,
118a5a4af3bSchristos   TILEGX_OPC_EXCH,
119a5a4af3bSchristos   TILEGX_OPC_EXCH4,
120a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_ADD_FLAGS,
121a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_ADDSUB,
122a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_MUL_FLAGS,
123a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_PACK1,
124a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_PACK2,
125a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_SUB_FLAGS,
126a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_UNPACK_MAX,
127a5a4af3bSchristos   TILEGX_OPC_FDOUBLE_UNPACK_MIN,
128a5a4af3bSchristos   TILEGX_OPC_FETCHADD,
129a5a4af3bSchristos   TILEGX_OPC_FETCHADD4,
130a5a4af3bSchristos   TILEGX_OPC_FETCHADDGEZ,
131a5a4af3bSchristos   TILEGX_OPC_FETCHADDGEZ4,
132a5a4af3bSchristos   TILEGX_OPC_FETCHAND,
133a5a4af3bSchristos   TILEGX_OPC_FETCHAND4,
134a5a4af3bSchristos   TILEGX_OPC_FETCHOR,
135a5a4af3bSchristos   TILEGX_OPC_FETCHOR4,
136a5a4af3bSchristos   TILEGX_OPC_FINV,
137a5a4af3bSchristos   TILEGX_OPC_FLUSH,
138a5a4af3bSchristos   TILEGX_OPC_FLUSHWB,
139a5a4af3bSchristos   TILEGX_OPC_FNOP,
140a5a4af3bSchristos   TILEGX_OPC_FSINGLE_ADD1,
141a5a4af3bSchristos   TILEGX_OPC_FSINGLE_ADDSUB2,
142a5a4af3bSchristos   TILEGX_OPC_FSINGLE_MUL1,
143a5a4af3bSchristos   TILEGX_OPC_FSINGLE_MUL2,
144a5a4af3bSchristos   TILEGX_OPC_FSINGLE_PACK1,
145a5a4af3bSchristos   TILEGX_OPC_FSINGLE_PACK2,
146a5a4af3bSchristos   TILEGX_OPC_FSINGLE_SUB1,
147a5a4af3bSchristos   TILEGX_OPC_ICOH,
148a5a4af3bSchristos   TILEGX_OPC_ILL,
149a5a4af3bSchristos   TILEGX_OPC_INV,
150a5a4af3bSchristos   TILEGX_OPC_IRET,
151a5a4af3bSchristos   TILEGX_OPC_J,
152a5a4af3bSchristos   TILEGX_OPC_JAL,
153a5a4af3bSchristos   TILEGX_OPC_JALR,
154a5a4af3bSchristos   TILEGX_OPC_JALRP,
155a5a4af3bSchristos   TILEGX_OPC_JR,
156a5a4af3bSchristos   TILEGX_OPC_JRP,
157a5a4af3bSchristos   TILEGX_OPC_LD,
158a5a4af3bSchristos   TILEGX_OPC_LD1S,
159a5a4af3bSchristos   TILEGX_OPC_LD1S_ADD,
160a5a4af3bSchristos   TILEGX_OPC_LD1U,
161a5a4af3bSchristos   TILEGX_OPC_LD1U_ADD,
162a5a4af3bSchristos   TILEGX_OPC_LD2S,
163a5a4af3bSchristos   TILEGX_OPC_LD2S_ADD,
164a5a4af3bSchristos   TILEGX_OPC_LD2U,
165a5a4af3bSchristos   TILEGX_OPC_LD2U_ADD,
166a5a4af3bSchristos   TILEGX_OPC_LD4S,
167a5a4af3bSchristos   TILEGX_OPC_LD4S_ADD,
168a5a4af3bSchristos   TILEGX_OPC_LD4U,
169a5a4af3bSchristos   TILEGX_OPC_LD4U_ADD,
170a5a4af3bSchristos   TILEGX_OPC_LD_ADD,
171a5a4af3bSchristos   TILEGX_OPC_LDNA,
172a5a4af3bSchristos   TILEGX_OPC_LDNA_ADD,
173a5a4af3bSchristos   TILEGX_OPC_LDNT,
174a5a4af3bSchristos   TILEGX_OPC_LDNT1S,
175a5a4af3bSchristos   TILEGX_OPC_LDNT1S_ADD,
176a5a4af3bSchristos   TILEGX_OPC_LDNT1U,
177a5a4af3bSchristos   TILEGX_OPC_LDNT1U_ADD,
178a5a4af3bSchristos   TILEGX_OPC_LDNT2S,
179a5a4af3bSchristos   TILEGX_OPC_LDNT2S_ADD,
180a5a4af3bSchristos   TILEGX_OPC_LDNT2U,
181a5a4af3bSchristos   TILEGX_OPC_LDNT2U_ADD,
182a5a4af3bSchristos   TILEGX_OPC_LDNT4S,
183a5a4af3bSchristos   TILEGX_OPC_LDNT4S_ADD,
184a5a4af3bSchristos   TILEGX_OPC_LDNT4U,
185a5a4af3bSchristos   TILEGX_OPC_LDNT4U_ADD,
186a5a4af3bSchristos   TILEGX_OPC_LDNT_ADD,
187a5a4af3bSchristos   TILEGX_OPC_LNK,
188a5a4af3bSchristos   TILEGX_OPC_MF,
189a5a4af3bSchristos   TILEGX_OPC_MFSPR,
190a5a4af3bSchristos   TILEGX_OPC_MM,
191a5a4af3bSchristos   TILEGX_OPC_MNZ,
192a5a4af3bSchristos   TILEGX_OPC_MTSPR,
193a5a4af3bSchristos   TILEGX_OPC_MUL_HS_HS,
194a5a4af3bSchristos   TILEGX_OPC_MUL_HS_HU,
195a5a4af3bSchristos   TILEGX_OPC_MUL_HS_LS,
196a5a4af3bSchristos   TILEGX_OPC_MUL_HS_LU,
197a5a4af3bSchristos   TILEGX_OPC_MUL_HU_HU,
198a5a4af3bSchristos   TILEGX_OPC_MUL_HU_LS,
199a5a4af3bSchristos   TILEGX_OPC_MUL_HU_LU,
200a5a4af3bSchristos   TILEGX_OPC_MUL_LS_LS,
201a5a4af3bSchristos   TILEGX_OPC_MUL_LS_LU,
202a5a4af3bSchristos   TILEGX_OPC_MUL_LU_LU,
203a5a4af3bSchristos   TILEGX_OPC_MULA_HS_HS,
204a5a4af3bSchristos   TILEGX_OPC_MULA_HS_HU,
205a5a4af3bSchristos   TILEGX_OPC_MULA_HS_LS,
206a5a4af3bSchristos   TILEGX_OPC_MULA_HS_LU,
207a5a4af3bSchristos   TILEGX_OPC_MULA_HU_HU,
208a5a4af3bSchristos   TILEGX_OPC_MULA_HU_LS,
209a5a4af3bSchristos   TILEGX_OPC_MULA_HU_LU,
210a5a4af3bSchristos   TILEGX_OPC_MULA_LS_LS,
211a5a4af3bSchristos   TILEGX_OPC_MULA_LS_LU,
212a5a4af3bSchristos   TILEGX_OPC_MULA_LU_LU,
213a5a4af3bSchristos   TILEGX_OPC_MULAX,
214a5a4af3bSchristos   TILEGX_OPC_MULX,
215a5a4af3bSchristos   TILEGX_OPC_MZ,
216a5a4af3bSchristos   TILEGX_OPC_NAP,
217a5a4af3bSchristos   TILEGX_OPC_NOP,
218a5a4af3bSchristos   TILEGX_OPC_NOR,
219a5a4af3bSchristos   TILEGX_OPC_OR,
220a5a4af3bSchristos   TILEGX_OPC_ORI,
221a5a4af3bSchristos   TILEGX_OPC_PCNT,
222a5a4af3bSchristos   TILEGX_OPC_REVBITS,
223a5a4af3bSchristos   TILEGX_OPC_REVBYTES,
224a5a4af3bSchristos   TILEGX_OPC_ROTL,
225a5a4af3bSchristos   TILEGX_OPC_ROTLI,
226a5a4af3bSchristos   TILEGX_OPC_SHL,
227a5a4af3bSchristos   TILEGX_OPC_SHL16INSLI,
228a5a4af3bSchristos   TILEGX_OPC_SHL1ADD,
229a5a4af3bSchristos   TILEGX_OPC_SHL1ADDX,
230a5a4af3bSchristos   TILEGX_OPC_SHL2ADD,
231a5a4af3bSchristos   TILEGX_OPC_SHL2ADDX,
232a5a4af3bSchristos   TILEGX_OPC_SHL3ADD,
233a5a4af3bSchristos   TILEGX_OPC_SHL3ADDX,
234a5a4af3bSchristos   TILEGX_OPC_SHLI,
235a5a4af3bSchristos   TILEGX_OPC_SHLX,
236a5a4af3bSchristos   TILEGX_OPC_SHLXI,
237a5a4af3bSchristos   TILEGX_OPC_SHRS,
238a5a4af3bSchristos   TILEGX_OPC_SHRSI,
239a5a4af3bSchristos   TILEGX_OPC_SHRU,
240a5a4af3bSchristos   TILEGX_OPC_SHRUI,
241a5a4af3bSchristos   TILEGX_OPC_SHRUX,
242a5a4af3bSchristos   TILEGX_OPC_SHRUXI,
243a5a4af3bSchristos   TILEGX_OPC_SHUFFLEBYTES,
244a5a4af3bSchristos   TILEGX_OPC_ST,
245a5a4af3bSchristos   TILEGX_OPC_ST1,
246a5a4af3bSchristos   TILEGX_OPC_ST1_ADD,
247a5a4af3bSchristos   TILEGX_OPC_ST2,
248a5a4af3bSchristos   TILEGX_OPC_ST2_ADD,
249a5a4af3bSchristos   TILEGX_OPC_ST4,
250a5a4af3bSchristos   TILEGX_OPC_ST4_ADD,
251a5a4af3bSchristos   TILEGX_OPC_ST_ADD,
252a5a4af3bSchristos   TILEGX_OPC_STNT,
253a5a4af3bSchristos   TILEGX_OPC_STNT1,
254a5a4af3bSchristos   TILEGX_OPC_STNT1_ADD,
255a5a4af3bSchristos   TILEGX_OPC_STNT2,
256a5a4af3bSchristos   TILEGX_OPC_STNT2_ADD,
257a5a4af3bSchristos   TILEGX_OPC_STNT4,
258a5a4af3bSchristos   TILEGX_OPC_STNT4_ADD,
259a5a4af3bSchristos   TILEGX_OPC_STNT_ADD,
260a5a4af3bSchristos   TILEGX_OPC_SUB,
261a5a4af3bSchristos   TILEGX_OPC_SUBX,
262a5a4af3bSchristos   TILEGX_OPC_SUBXSC,
263a5a4af3bSchristos   TILEGX_OPC_SWINT0,
264a5a4af3bSchristos   TILEGX_OPC_SWINT1,
265a5a4af3bSchristos   TILEGX_OPC_SWINT2,
266a5a4af3bSchristos   TILEGX_OPC_SWINT3,
267a5a4af3bSchristos   TILEGX_OPC_TBLIDXB0,
268a5a4af3bSchristos   TILEGX_OPC_TBLIDXB1,
269a5a4af3bSchristos   TILEGX_OPC_TBLIDXB2,
270a5a4af3bSchristos   TILEGX_OPC_TBLIDXB3,
271a5a4af3bSchristos   TILEGX_OPC_V1ADD,
272a5a4af3bSchristos   TILEGX_OPC_V1ADDI,
273a5a4af3bSchristos   TILEGX_OPC_V1ADDUC,
274a5a4af3bSchristos   TILEGX_OPC_V1ADIFFU,
275a5a4af3bSchristos   TILEGX_OPC_V1AVGU,
276a5a4af3bSchristos   TILEGX_OPC_V1CMPEQ,
277a5a4af3bSchristos   TILEGX_OPC_V1CMPEQI,
278a5a4af3bSchristos   TILEGX_OPC_V1CMPLES,
279a5a4af3bSchristos   TILEGX_OPC_V1CMPLEU,
280a5a4af3bSchristos   TILEGX_OPC_V1CMPLTS,
281a5a4af3bSchristos   TILEGX_OPC_V1CMPLTSI,
282a5a4af3bSchristos   TILEGX_OPC_V1CMPLTU,
283a5a4af3bSchristos   TILEGX_OPC_V1CMPLTUI,
284a5a4af3bSchristos   TILEGX_OPC_V1CMPNE,
285a5a4af3bSchristos   TILEGX_OPC_V1DDOTPU,
286a5a4af3bSchristos   TILEGX_OPC_V1DDOTPUA,
287a5a4af3bSchristos   TILEGX_OPC_V1DDOTPUS,
288a5a4af3bSchristos   TILEGX_OPC_V1DDOTPUSA,
289a5a4af3bSchristos   TILEGX_OPC_V1DOTP,
290a5a4af3bSchristos   TILEGX_OPC_V1DOTPA,
291a5a4af3bSchristos   TILEGX_OPC_V1DOTPU,
292a5a4af3bSchristos   TILEGX_OPC_V1DOTPUA,
293a5a4af3bSchristos   TILEGX_OPC_V1DOTPUS,
294a5a4af3bSchristos   TILEGX_OPC_V1DOTPUSA,
295a5a4af3bSchristos   TILEGX_OPC_V1INT_H,
296a5a4af3bSchristos   TILEGX_OPC_V1INT_L,
297a5a4af3bSchristos   TILEGX_OPC_V1MAXU,
298a5a4af3bSchristos   TILEGX_OPC_V1MAXUI,
299a5a4af3bSchristos   TILEGX_OPC_V1MINU,
300a5a4af3bSchristos   TILEGX_OPC_V1MINUI,
301a5a4af3bSchristos   TILEGX_OPC_V1MNZ,
302a5a4af3bSchristos   TILEGX_OPC_V1MULTU,
303a5a4af3bSchristos   TILEGX_OPC_V1MULU,
304a5a4af3bSchristos   TILEGX_OPC_V1MULUS,
305a5a4af3bSchristos   TILEGX_OPC_V1MZ,
306a5a4af3bSchristos   TILEGX_OPC_V1SADAU,
307a5a4af3bSchristos   TILEGX_OPC_V1SADU,
308a5a4af3bSchristos   TILEGX_OPC_V1SHL,
309a5a4af3bSchristos   TILEGX_OPC_V1SHLI,
310a5a4af3bSchristos   TILEGX_OPC_V1SHRS,
311a5a4af3bSchristos   TILEGX_OPC_V1SHRSI,
312a5a4af3bSchristos   TILEGX_OPC_V1SHRU,
313a5a4af3bSchristos   TILEGX_OPC_V1SHRUI,
314a5a4af3bSchristos   TILEGX_OPC_V1SUB,
315a5a4af3bSchristos   TILEGX_OPC_V1SUBUC,
316a5a4af3bSchristos   TILEGX_OPC_V2ADD,
317a5a4af3bSchristos   TILEGX_OPC_V2ADDI,
318a5a4af3bSchristos   TILEGX_OPC_V2ADDSC,
319a5a4af3bSchristos   TILEGX_OPC_V2ADIFFS,
320a5a4af3bSchristos   TILEGX_OPC_V2AVGS,
321a5a4af3bSchristos   TILEGX_OPC_V2CMPEQ,
322a5a4af3bSchristos   TILEGX_OPC_V2CMPEQI,
323a5a4af3bSchristos   TILEGX_OPC_V2CMPLES,
324a5a4af3bSchristos   TILEGX_OPC_V2CMPLEU,
325a5a4af3bSchristos   TILEGX_OPC_V2CMPLTS,
326a5a4af3bSchristos   TILEGX_OPC_V2CMPLTSI,
327a5a4af3bSchristos   TILEGX_OPC_V2CMPLTU,
328a5a4af3bSchristos   TILEGX_OPC_V2CMPLTUI,
329a5a4af3bSchristos   TILEGX_OPC_V2CMPNE,
330a5a4af3bSchristos   TILEGX_OPC_V2DOTP,
331a5a4af3bSchristos   TILEGX_OPC_V2DOTPA,
332a5a4af3bSchristos   TILEGX_OPC_V2INT_H,
333a5a4af3bSchristos   TILEGX_OPC_V2INT_L,
334a5a4af3bSchristos   TILEGX_OPC_V2MAXS,
335a5a4af3bSchristos   TILEGX_OPC_V2MAXSI,
336a5a4af3bSchristos   TILEGX_OPC_V2MINS,
337a5a4af3bSchristos   TILEGX_OPC_V2MINSI,
338a5a4af3bSchristos   TILEGX_OPC_V2MNZ,
339a5a4af3bSchristos   TILEGX_OPC_V2MULFSC,
340a5a4af3bSchristos   TILEGX_OPC_V2MULS,
341a5a4af3bSchristos   TILEGX_OPC_V2MULTS,
342a5a4af3bSchristos   TILEGX_OPC_V2MZ,
343a5a4af3bSchristos   TILEGX_OPC_V2PACKH,
344a5a4af3bSchristos   TILEGX_OPC_V2PACKL,
345a5a4af3bSchristos   TILEGX_OPC_V2PACKUC,
346a5a4af3bSchristos   TILEGX_OPC_V2SADAS,
347a5a4af3bSchristos   TILEGX_OPC_V2SADAU,
348a5a4af3bSchristos   TILEGX_OPC_V2SADS,
349a5a4af3bSchristos   TILEGX_OPC_V2SADU,
350a5a4af3bSchristos   TILEGX_OPC_V2SHL,
351a5a4af3bSchristos   TILEGX_OPC_V2SHLI,
352a5a4af3bSchristos   TILEGX_OPC_V2SHLSC,
353a5a4af3bSchristos   TILEGX_OPC_V2SHRS,
354a5a4af3bSchristos   TILEGX_OPC_V2SHRSI,
355a5a4af3bSchristos   TILEGX_OPC_V2SHRU,
356a5a4af3bSchristos   TILEGX_OPC_V2SHRUI,
357a5a4af3bSchristos   TILEGX_OPC_V2SUB,
358a5a4af3bSchristos   TILEGX_OPC_V2SUBSC,
359a5a4af3bSchristos   TILEGX_OPC_V4ADD,
360a5a4af3bSchristos   TILEGX_OPC_V4ADDSC,
361a5a4af3bSchristos   TILEGX_OPC_V4INT_H,
362a5a4af3bSchristos   TILEGX_OPC_V4INT_L,
363a5a4af3bSchristos   TILEGX_OPC_V4PACKSC,
364a5a4af3bSchristos   TILEGX_OPC_V4SHL,
365a5a4af3bSchristos   TILEGX_OPC_V4SHLSC,
366a5a4af3bSchristos   TILEGX_OPC_V4SHRS,
367a5a4af3bSchristos   TILEGX_OPC_V4SHRU,
368a5a4af3bSchristos   TILEGX_OPC_V4SUB,
369a5a4af3bSchristos   TILEGX_OPC_V4SUBSC,
370a5a4af3bSchristos   TILEGX_OPC_WH64,
371a5a4af3bSchristos   TILEGX_OPC_XOR,
372a5a4af3bSchristos   TILEGX_OPC_XORI,
373a5a4af3bSchristos   TILEGX_OPC_NONE
374a5a4af3bSchristos } tilegx_mnemonic;
375a5a4af3bSchristos 
376a5a4af3bSchristos /* 64-bit pattern for a { bpt ; nop } bundle. */
377a5a4af3bSchristos #define TILEGX_BPT_BUNDLE 0x286a44ae51485000ULL
378a5a4af3bSchristos 
379a5a4af3bSchristos 
380a5a4af3bSchristos 
381a5a4af3bSchristos static __inline unsigned int
382a5a4af3bSchristos get_BFEnd_X0(tilegx_bundle_bits num)
383a5a4af3bSchristos {
384a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
385a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
386a5a4af3bSchristos }
387a5a4af3bSchristos 
388a5a4af3bSchristos static __inline unsigned int
389a5a4af3bSchristos get_BFOpcodeExtension_X0(tilegx_bundle_bits num)
390a5a4af3bSchristos {
391a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
392a5a4af3bSchristos   return (((n >> 24)) & 0xf);
393a5a4af3bSchristos }
394a5a4af3bSchristos 
395a5a4af3bSchristos static __inline unsigned int
396a5a4af3bSchristos get_BFStart_X0(tilegx_bundle_bits num)
397a5a4af3bSchristos {
398a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
399a5a4af3bSchristos   return (((n >> 18)) & 0x3f);
400a5a4af3bSchristos }
401a5a4af3bSchristos 
402a5a4af3bSchristos static __inline unsigned int
403a5a4af3bSchristos get_BrOff_X1(tilegx_bundle_bits n)
404a5a4af3bSchristos {
405a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x0000003f) |
406a5a4af3bSchristos          (((unsigned int)(n >> 37)) & 0x0001ffc0);
407a5a4af3bSchristos }
408a5a4af3bSchristos 
409a5a4af3bSchristos static __inline unsigned int
410a5a4af3bSchristos get_BrType_X1(tilegx_bundle_bits n)
411a5a4af3bSchristos {
412a5a4af3bSchristos   return (((unsigned int)(n >> 54)) & 0x1f);
413a5a4af3bSchristos }
414a5a4af3bSchristos 
415a5a4af3bSchristos static __inline unsigned int
416a5a4af3bSchristos get_Dest_Imm8_X1(tilegx_bundle_bits n)
417a5a4af3bSchristos {
418a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x0000003f) |
419a5a4af3bSchristos          (((unsigned int)(n >> 43)) & 0x000000c0);
420a5a4af3bSchristos }
421a5a4af3bSchristos 
422a5a4af3bSchristos static __inline unsigned int
423a5a4af3bSchristos get_Dest_X0(tilegx_bundle_bits num)
424a5a4af3bSchristos {
425a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
426a5a4af3bSchristos   return (((n >> 0)) & 0x3f);
427a5a4af3bSchristos }
428a5a4af3bSchristos 
429a5a4af3bSchristos static __inline unsigned int
430a5a4af3bSchristos get_Dest_X1(tilegx_bundle_bits n)
431a5a4af3bSchristos {
432a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x3f);
433a5a4af3bSchristos }
434a5a4af3bSchristos 
435a5a4af3bSchristos static __inline unsigned int
436a5a4af3bSchristos get_Dest_Y0(tilegx_bundle_bits num)
437a5a4af3bSchristos {
438a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
439a5a4af3bSchristos   return (((n >> 0)) & 0x3f);
440a5a4af3bSchristos }
441a5a4af3bSchristos 
442a5a4af3bSchristos static __inline unsigned int
443a5a4af3bSchristos get_Dest_Y1(tilegx_bundle_bits n)
444a5a4af3bSchristos {
445a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x3f);
446a5a4af3bSchristos }
447a5a4af3bSchristos 
448a5a4af3bSchristos static __inline unsigned int
449a5a4af3bSchristos get_Imm16_X0(tilegx_bundle_bits num)
450a5a4af3bSchristos {
451a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
452a5a4af3bSchristos   return (((n >> 12)) & 0xffff);
453a5a4af3bSchristos }
454a5a4af3bSchristos 
455a5a4af3bSchristos static __inline unsigned int
456a5a4af3bSchristos get_Imm16_X1(tilegx_bundle_bits n)
457a5a4af3bSchristos {
458a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0xffff);
459a5a4af3bSchristos }
460a5a4af3bSchristos 
461a5a4af3bSchristos static __inline unsigned int
462a5a4af3bSchristos get_Imm8OpcodeExtension_X0(tilegx_bundle_bits num)
463a5a4af3bSchristos {
464a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
465a5a4af3bSchristos   return (((n >> 20)) & 0xff);
466a5a4af3bSchristos }
467a5a4af3bSchristos 
468a5a4af3bSchristos static __inline unsigned int
469a5a4af3bSchristos get_Imm8OpcodeExtension_X1(tilegx_bundle_bits n)
470a5a4af3bSchristos {
471a5a4af3bSchristos   return (((unsigned int)(n >> 51)) & 0xff);
472a5a4af3bSchristos }
473a5a4af3bSchristos 
474a5a4af3bSchristos static __inline unsigned int
475a5a4af3bSchristos get_Imm8_X0(tilegx_bundle_bits num)
476a5a4af3bSchristos {
477a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
478a5a4af3bSchristos   return (((n >> 12)) & 0xff);
479a5a4af3bSchristos }
480a5a4af3bSchristos 
481a5a4af3bSchristos static __inline unsigned int
482a5a4af3bSchristos get_Imm8_X1(tilegx_bundle_bits n)
483a5a4af3bSchristos {
484a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0xff);
485a5a4af3bSchristos }
486a5a4af3bSchristos 
487a5a4af3bSchristos static __inline unsigned int
488a5a4af3bSchristos get_Imm8_Y0(tilegx_bundle_bits num)
489a5a4af3bSchristos {
490a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
491a5a4af3bSchristos   return (((n >> 12)) & 0xff);
492a5a4af3bSchristos }
493a5a4af3bSchristos 
494a5a4af3bSchristos static __inline unsigned int
495a5a4af3bSchristos get_Imm8_Y1(tilegx_bundle_bits n)
496a5a4af3bSchristos {
497a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0xff);
498a5a4af3bSchristos }
499a5a4af3bSchristos 
500a5a4af3bSchristos static __inline unsigned int
501a5a4af3bSchristos get_JumpOff_X1(tilegx_bundle_bits n)
502a5a4af3bSchristos {
503a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x7ffffff);
504a5a4af3bSchristos }
505a5a4af3bSchristos 
506a5a4af3bSchristos static __inline unsigned int
507a5a4af3bSchristos get_JumpOpcodeExtension_X1(tilegx_bundle_bits n)
508a5a4af3bSchristos {
509a5a4af3bSchristos   return (((unsigned int)(n >> 58)) & 0x1);
510a5a4af3bSchristos }
511a5a4af3bSchristos 
512a5a4af3bSchristos static __inline unsigned int
513a5a4af3bSchristos get_MF_Imm14_X1(tilegx_bundle_bits n)
514a5a4af3bSchristos {
515a5a4af3bSchristos   return (((unsigned int)(n >> 37)) & 0x3fff);
516a5a4af3bSchristos }
517a5a4af3bSchristos 
518a5a4af3bSchristos static __inline unsigned int
519a5a4af3bSchristos get_MT_Imm14_X1(tilegx_bundle_bits n)
520a5a4af3bSchristos {
521a5a4af3bSchristos   return (((unsigned int)(n >> 31)) & 0x0000003f) |
522a5a4af3bSchristos          (((unsigned int)(n >> 37)) & 0x00003fc0);
523a5a4af3bSchristos }
524a5a4af3bSchristos 
525a5a4af3bSchristos static __inline unsigned int
526a5a4af3bSchristos get_Mode(tilegx_bundle_bits n)
527a5a4af3bSchristos {
528a5a4af3bSchristos   return (((unsigned int)(n >> 62)) & 0x3);
529a5a4af3bSchristos }
530a5a4af3bSchristos 
531a5a4af3bSchristos static __inline unsigned int
532a5a4af3bSchristos get_Opcode_X0(tilegx_bundle_bits num)
533a5a4af3bSchristos {
534a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
535a5a4af3bSchristos   return (((n >> 28)) & 0x7);
536a5a4af3bSchristos }
537a5a4af3bSchristos 
538a5a4af3bSchristos static __inline unsigned int
539a5a4af3bSchristos get_Opcode_X1(tilegx_bundle_bits n)
540a5a4af3bSchristos {
541a5a4af3bSchristos   return (((unsigned int)(n >> 59)) & 0x7);
542a5a4af3bSchristos }
543a5a4af3bSchristos 
544a5a4af3bSchristos static __inline unsigned int
545a5a4af3bSchristos get_Opcode_Y0(tilegx_bundle_bits num)
546a5a4af3bSchristos {
547a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
548a5a4af3bSchristos   return (((n >> 27)) & 0xf);
549a5a4af3bSchristos }
550a5a4af3bSchristos 
551a5a4af3bSchristos static __inline unsigned int
552a5a4af3bSchristos get_Opcode_Y1(tilegx_bundle_bits n)
553a5a4af3bSchristos {
554a5a4af3bSchristos   return (((unsigned int)(n >> 58)) & 0xf);
555a5a4af3bSchristos }
556a5a4af3bSchristos 
557a5a4af3bSchristos static __inline unsigned int
558a5a4af3bSchristos get_Opcode_Y2(tilegx_bundle_bits n)
559a5a4af3bSchristos {
560a5a4af3bSchristos   return (((n >> 26)) & 0x00000001) |
561a5a4af3bSchristos          (((unsigned int)(n >> 56)) & 0x00000002);
562a5a4af3bSchristos }
563a5a4af3bSchristos 
564a5a4af3bSchristos static __inline unsigned int
565a5a4af3bSchristos get_RRROpcodeExtension_X0(tilegx_bundle_bits num)
566a5a4af3bSchristos {
567a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
568a5a4af3bSchristos   return (((n >> 18)) & 0x3ff);
569a5a4af3bSchristos }
570a5a4af3bSchristos 
571a5a4af3bSchristos static __inline unsigned int
572a5a4af3bSchristos get_RRROpcodeExtension_X1(tilegx_bundle_bits n)
573a5a4af3bSchristos {
574a5a4af3bSchristos   return (((unsigned int)(n >> 49)) & 0x3ff);
575a5a4af3bSchristos }
576a5a4af3bSchristos 
577a5a4af3bSchristos static __inline unsigned int
578a5a4af3bSchristos get_RRROpcodeExtension_Y0(tilegx_bundle_bits num)
579a5a4af3bSchristos {
580a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
581a5a4af3bSchristos   return (((n >> 18)) & 0x3);
582a5a4af3bSchristos }
583a5a4af3bSchristos 
584a5a4af3bSchristos static __inline unsigned int
585a5a4af3bSchristos get_RRROpcodeExtension_Y1(tilegx_bundle_bits n)
586a5a4af3bSchristos {
587a5a4af3bSchristos   return (((unsigned int)(n >> 49)) & 0x3);
588a5a4af3bSchristos }
589a5a4af3bSchristos 
590a5a4af3bSchristos static __inline unsigned int
591a5a4af3bSchristos get_ShAmt_X0(tilegx_bundle_bits num)
592a5a4af3bSchristos {
593a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
594a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
595a5a4af3bSchristos }
596a5a4af3bSchristos 
597a5a4af3bSchristos static __inline unsigned int
598a5a4af3bSchristos get_ShAmt_X1(tilegx_bundle_bits n)
599a5a4af3bSchristos {
600a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
601a5a4af3bSchristos }
602a5a4af3bSchristos 
603a5a4af3bSchristos static __inline unsigned int
604a5a4af3bSchristos get_ShAmt_Y0(tilegx_bundle_bits num)
605a5a4af3bSchristos {
606a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
607a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
608a5a4af3bSchristos }
609a5a4af3bSchristos 
610a5a4af3bSchristos static __inline unsigned int
611a5a4af3bSchristos get_ShAmt_Y1(tilegx_bundle_bits n)
612a5a4af3bSchristos {
613a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
614a5a4af3bSchristos }
615a5a4af3bSchristos 
616a5a4af3bSchristos static __inline unsigned int
617a5a4af3bSchristos get_ShiftOpcodeExtension_X0(tilegx_bundle_bits num)
618a5a4af3bSchristos {
619a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
620a5a4af3bSchristos   return (((n >> 18)) & 0x3ff);
621a5a4af3bSchristos }
622a5a4af3bSchristos 
623a5a4af3bSchristos static __inline unsigned int
624a5a4af3bSchristos get_ShiftOpcodeExtension_X1(tilegx_bundle_bits n)
625a5a4af3bSchristos {
626a5a4af3bSchristos   return (((unsigned int)(n >> 49)) & 0x3ff);
627a5a4af3bSchristos }
628a5a4af3bSchristos 
629a5a4af3bSchristos static __inline unsigned int
630a5a4af3bSchristos get_ShiftOpcodeExtension_Y0(tilegx_bundle_bits num)
631a5a4af3bSchristos {
632a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
633a5a4af3bSchristos   return (((n >> 18)) & 0x3);
634a5a4af3bSchristos }
635a5a4af3bSchristos 
636a5a4af3bSchristos static __inline unsigned int
637a5a4af3bSchristos get_ShiftOpcodeExtension_Y1(tilegx_bundle_bits n)
638a5a4af3bSchristos {
639a5a4af3bSchristos   return (((unsigned int)(n >> 49)) & 0x3);
640a5a4af3bSchristos }
641a5a4af3bSchristos 
642a5a4af3bSchristos static __inline unsigned int
643a5a4af3bSchristos get_SrcA_X0(tilegx_bundle_bits num)
644a5a4af3bSchristos {
645a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
646a5a4af3bSchristos   return (((n >> 6)) & 0x3f);
647a5a4af3bSchristos }
648a5a4af3bSchristos 
649a5a4af3bSchristos static __inline unsigned int
650a5a4af3bSchristos get_SrcA_X1(tilegx_bundle_bits n)
651a5a4af3bSchristos {
652a5a4af3bSchristos   return (((unsigned int)(n >> 37)) & 0x3f);
653a5a4af3bSchristos }
654a5a4af3bSchristos 
655a5a4af3bSchristos static __inline unsigned int
656a5a4af3bSchristos get_SrcA_Y0(tilegx_bundle_bits num)
657a5a4af3bSchristos {
658a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
659a5a4af3bSchristos   return (((n >> 6)) & 0x3f);
660a5a4af3bSchristos }
661a5a4af3bSchristos 
662a5a4af3bSchristos static __inline unsigned int
663a5a4af3bSchristos get_SrcA_Y1(tilegx_bundle_bits n)
664a5a4af3bSchristos {
665a5a4af3bSchristos   return (((unsigned int)(n >> 37)) & 0x3f);
666a5a4af3bSchristos }
667a5a4af3bSchristos 
668a5a4af3bSchristos static __inline unsigned int
669a5a4af3bSchristos get_SrcA_Y2(tilegx_bundle_bits num)
670a5a4af3bSchristos {
671a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
672a5a4af3bSchristos   return (((n >> 20)) & 0x3f);
673a5a4af3bSchristos }
674a5a4af3bSchristos 
675a5a4af3bSchristos static __inline unsigned int
676a5a4af3bSchristos get_SrcBDest_Y2(tilegx_bundle_bits n)
677a5a4af3bSchristos {
678a5a4af3bSchristos   return (((unsigned int)(n >> 51)) & 0x3f);
679a5a4af3bSchristos }
680a5a4af3bSchristos 
681a5a4af3bSchristos static __inline unsigned int
682a5a4af3bSchristos get_SrcB_X0(tilegx_bundle_bits num)
683a5a4af3bSchristos {
684a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
685a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
686a5a4af3bSchristos }
687a5a4af3bSchristos 
688a5a4af3bSchristos static __inline unsigned int
689a5a4af3bSchristos get_SrcB_X1(tilegx_bundle_bits n)
690a5a4af3bSchristos {
691a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
692a5a4af3bSchristos }
693a5a4af3bSchristos 
694a5a4af3bSchristos static __inline unsigned int
695a5a4af3bSchristos get_SrcB_Y0(tilegx_bundle_bits num)
696a5a4af3bSchristos {
697a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
698a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
699a5a4af3bSchristos }
700a5a4af3bSchristos 
701a5a4af3bSchristos static __inline unsigned int
702a5a4af3bSchristos get_SrcB_Y1(tilegx_bundle_bits n)
703a5a4af3bSchristos {
704a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
705a5a4af3bSchristos }
706a5a4af3bSchristos 
707a5a4af3bSchristos static __inline unsigned int
708a5a4af3bSchristos get_UnaryOpcodeExtension_X0(tilegx_bundle_bits num)
709a5a4af3bSchristos {
710a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
711a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
712a5a4af3bSchristos }
713a5a4af3bSchristos 
714a5a4af3bSchristos static __inline unsigned int
715a5a4af3bSchristos get_UnaryOpcodeExtension_X1(tilegx_bundle_bits n)
716a5a4af3bSchristos {
717a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
718a5a4af3bSchristos }
719a5a4af3bSchristos 
720a5a4af3bSchristos static __inline unsigned int
721a5a4af3bSchristos get_UnaryOpcodeExtension_Y0(tilegx_bundle_bits num)
722a5a4af3bSchristos {
723a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
724a5a4af3bSchristos   return (((n >> 12)) & 0x3f);
725a5a4af3bSchristos }
726a5a4af3bSchristos 
727a5a4af3bSchristos static __inline unsigned int
728a5a4af3bSchristos get_UnaryOpcodeExtension_Y1(tilegx_bundle_bits n)
729a5a4af3bSchristos {
730a5a4af3bSchristos   return (((unsigned int)(n >> 43)) & 0x3f);
731a5a4af3bSchristos }
732a5a4af3bSchristos 
733a5a4af3bSchristos 
734a5a4af3bSchristos static __inline int
735a5a4af3bSchristos sign_extend(int n, int num_bits)
736a5a4af3bSchristos {
737a5a4af3bSchristos   int shift = (int)(sizeof(int) * 8 - num_bits);
738a5a4af3bSchristos   return (n << shift) >> shift;
739a5a4af3bSchristos }
740a5a4af3bSchristos 
741a5a4af3bSchristos 
742a5a4af3bSchristos 
743a5a4af3bSchristos static __inline tilegx_bundle_bits
744a5a4af3bSchristos create_BFEnd_X0(int num)
745a5a4af3bSchristos {
746a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
747a5a4af3bSchristos   return ((n & 0x3f) << 12);
748a5a4af3bSchristos }
749a5a4af3bSchristos 
750a5a4af3bSchristos static __inline tilegx_bundle_bits
751a5a4af3bSchristos create_BFOpcodeExtension_X0(int num)
752a5a4af3bSchristos {
753a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
754a5a4af3bSchristos   return ((n & 0xf) << 24);
755a5a4af3bSchristos }
756a5a4af3bSchristos 
757a5a4af3bSchristos static __inline tilegx_bundle_bits
758a5a4af3bSchristos create_BFStart_X0(int num)
759a5a4af3bSchristos {
760a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
761a5a4af3bSchristos   return ((n & 0x3f) << 18);
762a5a4af3bSchristos }
763a5a4af3bSchristos 
764a5a4af3bSchristos static __inline tilegx_bundle_bits
765a5a4af3bSchristos create_BrOff_X1(int num)
766a5a4af3bSchristos {
767a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
768a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
769a5a4af3bSchristos          (((tilegx_bundle_bits)(n & 0x0001ffc0)) << 37);
770a5a4af3bSchristos }
771a5a4af3bSchristos 
772a5a4af3bSchristos static __inline tilegx_bundle_bits
773a5a4af3bSchristos create_BrType_X1(int num)
774a5a4af3bSchristos {
775a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
776a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x1f)) << 54);
777a5a4af3bSchristos }
778a5a4af3bSchristos 
779a5a4af3bSchristos static __inline tilegx_bundle_bits
780a5a4af3bSchristos create_Dest_Imm8_X1(int num)
781a5a4af3bSchristos {
782a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
783a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
784a5a4af3bSchristos          (((tilegx_bundle_bits)(n & 0x000000c0)) << 43);
785a5a4af3bSchristos }
786a5a4af3bSchristos 
787a5a4af3bSchristos static __inline tilegx_bundle_bits
788a5a4af3bSchristos create_Dest_X0(int num)
789a5a4af3bSchristos {
790a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
791a5a4af3bSchristos   return ((n & 0x3f) << 0);
792a5a4af3bSchristos }
793a5a4af3bSchristos 
794a5a4af3bSchristos static __inline tilegx_bundle_bits
795a5a4af3bSchristos create_Dest_X1(int num)
796a5a4af3bSchristos {
797a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
798a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
799a5a4af3bSchristos }
800a5a4af3bSchristos 
801a5a4af3bSchristos static __inline tilegx_bundle_bits
802a5a4af3bSchristos create_Dest_Y0(int num)
803a5a4af3bSchristos {
804a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
805a5a4af3bSchristos   return ((n & 0x3f) << 0);
806a5a4af3bSchristos }
807a5a4af3bSchristos 
808a5a4af3bSchristos static __inline tilegx_bundle_bits
809a5a4af3bSchristos create_Dest_Y1(int num)
810a5a4af3bSchristos {
811a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
812a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 31);
813a5a4af3bSchristos }
814a5a4af3bSchristos 
815a5a4af3bSchristos static __inline tilegx_bundle_bits
816a5a4af3bSchristos create_Imm16_X0(int num)
817a5a4af3bSchristos {
818a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
819a5a4af3bSchristos   return ((n & 0xffff) << 12);
820a5a4af3bSchristos }
821a5a4af3bSchristos 
822a5a4af3bSchristos static __inline tilegx_bundle_bits
823a5a4af3bSchristos create_Imm16_X1(int num)
824a5a4af3bSchristos {
825a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
826a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0xffff)) << 43);
827a5a4af3bSchristos }
828a5a4af3bSchristos 
829a5a4af3bSchristos static __inline tilegx_bundle_bits
830a5a4af3bSchristos create_Imm8OpcodeExtension_X0(int num)
831a5a4af3bSchristos {
832a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
833a5a4af3bSchristos   return ((n & 0xff) << 20);
834a5a4af3bSchristos }
835a5a4af3bSchristos 
836a5a4af3bSchristos static __inline tilegx_bundle_bits
837a5a4af3bSchristos create_Imm8OpcodeExtension_X1(int num)
838a5a4af3bSchristos {
839a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
840a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0xff)) << 51);
841a5a4af3bSchristos }
842a5a4af3bSchristos 
843a5a4af3bSchristos static __inline tilegx_bundle_bits
844a5a4af3bSchristos create_Imm8_X0(int num)
845a5a4af3bSchristos {
846a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
847a5a4af3bSchristos   return ((n & 0xff) << 12);
848a5a4af3bSchristos }
849a5a4af3bSchristos 
850a5a4af3bSchristos static __inline tilegx_bundle_bits
851a5a4af3bSchristos create_Imm8_X1(int num)
852a5a4af3bSchristos {
853a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
854a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0xff)) << 43);
855a5a4af3bSchristos }
856a5a4af3bSchristos 
857a5a4af3bSchristos static __inline tilegx_bundle_bits
858a5a4af3bSchristos create_Imm8_Y0(int num)
859a5a4af3bSchristos {
860a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
861a5a4af3bSchristos   return ((n & 0xff) << 12);
862a5a4af3bSchristos }
863a5a4af3bSchristos 
864a5a4af3bSchristos static __inline tilegx_bundle_bits
865a5a4af3bSchristos create_Imm8_Y1(int num)
866a5a4af3bSchristos {
867a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
868a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0xff)) << 43);
869a5a4af3bSchristos }
870a5a4af3bSchristos 
871a5a4af3bSchristos static __inline tilegx_bundle_bits
872a5a4af3bSchristos create_JumpOff_X1(int num)
873a5a4af3bSchristos {
874a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
875a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x7ffffff)) << 31);
876a5a4af3bSchristos }
877a5a4af3bSchristos 
878a5a4af3bSchristos static __inline tilegx_bundle_bits
879a5a4af3bSchristos create_JumpOpcodeExtension_X1(int num)
880a5a4af3bSchristos {
881a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
882a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x1)) << 58);
883a5a4af3bSchristos }
884a5a4af3bSchristos 
885a5a4af3bSchristos static __inline tilegx_bundle_bits
886a5a4af3bSchristos create_MF_Imm14_X1(int num)
887a5a4af3bSchristos {
888a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
889a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3fff)) << 37);
890a5a4af3bSchristos }
891a5a4af3bSchristos 
892a5a4af3bSchristos static __inline tilegx_bundle_bits
893a5a4af3bSchristos create_MT_Imm14_X1(int num)
894a5a4af3bSchristos {
895a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
896a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) |
897a5a4af3bSchristos          (((tilegx_bundle_bits)(n & 0x00003fc0)) << 37);
898a5a4af3bSchristos }
899a5a4af3bSchristos 
900a5a4af3bSchristos static __inline tilegx_bundle_bits
901a5a4af3bSchristos create_Mode(int num)
902a5a4af3bSchristos {
903a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
904a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3)) << 62);
905a5a4af3bSchristos }
906a5a4af3bSchristos 
907a5a4af3bSchristos static __inline tilegx_bundle_bits
908a5a4af3bSchristos create_Opcode_X0(int num)
909a5a4af3bSchristos {
910a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
911a5a4af3bSchristos   return ((n & 0x7) << 28);
912a5a4af3bSchristos }
913a5a4af3bSchristos 
914a5a4af3bSchristos static __inline tilegx_bundle_bits
915a5a4af3bSchristos create_Opcode_X1(int num)
916a5a4af3bSchristos {
917a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
918a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x7)) << 59);
919a5a4af3bSchristos }
920a5a4af3bSchristos 
921a5a4af3bSchristos static __inline tilegx_bundle_bits
922a5a4af3bSchristos create_Opcode_Y0(int num)
923a5a4af3bSchristos {
924a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
925a5a4af3bSchristos   return ((n & 0xf) << 27);
926a5a4af3bSchristos }
927a5a4af3bSchristos 
928a5a4af3bSchristos static __inline tilegx_bundle_bits
929a5a4af3bSchristos create_Opcode_Y1(int num)
930a5a4af3bSchristos {
931a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
932a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0xf)) << 58);
933a5a4af3bSchristos }
934a5a4af3bSchristos 
935a5a4af3bSchristos static __inline tilegx_bundle_bits
936a5a4af3bSchristos create_Opcode_Y2(int num)
937a5a4af3bSchristos {
938a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
939a5a4af3bSchristos   return ((n & 0x00000001) << 26) |
940a5a4af3bSchristos          (((tilegx_bundle_bits)(n & 0x00000002)) << 56);
941a5a4af3bSchristos }
942a5a4af3bSchristos 
943a5a4af3bSchristos static __inline tilegx_bundle_bits
944a5a4af3bSchristos create_RRROpcodeExtension_X0(int num)
945a5a4af3bSchristos {
946a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
947a5a4af3bSchristos   return ((n & 0x3ff) << 18);
948a5a4af3bSchristos }
949a5a4af3bSchristos 
950a5a4af3bSchristos static __inline tilegx_bundle_bits
951a5a4af3bSchristos create_RRROpcodeExtension_X1(int num)
952a5a4af3bSchristos {
953a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
954a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
955a5a4af3bSchristos }
956a5a4af3bSchristos 
957a5a4af3bSchristos static __inline tilegx_bundle_bits
958a5a4af3bSchristos create_RRROpcodeExtension_Y0(int num)
959a5a4af3bSchristos {
960a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
961a5a4af3bSchristos   return ((n & 0x3) << 18);
962a5a4af3bSchristos }
963a5a4af3bSchristos 
964a5a4af3bSchristos static __inline tilegx_bundle_bits
965a5a4af3bSchristos create_RRROpcodeExtension_Y1(int num)
966a5a4af3bSchristos {
967a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
968a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3)) << 49);
969a5a4af3bSchristos }
970a5a4af3bSchristos 
971a5a4af3bSchristos static __inline tilegx_bundle_bits
972a5a4af3bSchristos create_ShAmt_X0(int num)
973a5a4af3bSchristos {
974a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
975a5a4af3bSchristos   return ((n & 0x3f) << 12);
976a5a4af3bSchristos }
977a5a4af3bSchristos 
978a5a4af3bSchristos static __inline tilegx_bundle_bits
979a5a4af3bSchristos create_ShAmt_X1(int num)
980a5a4af3bSchristos {
981a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
982a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
983a5a4af3bSchristos }
984a5a4af3bSchristos 
985a5a4af3bSchristos static __inline tilegx_bundle_bits
986a5a4af3bSchristos create_ShAmt_Y0(int num)
987a5a4af3bSchristos {
988a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
989a5a4af3bSchristos   return ((n & 0x3f) << 12);
990a5a4af3bSchristos }
991a5a4af3bSchristos 
992a5a4af3bSchristos static __inline tilegx_bundle_bits
993a5a4af3bSchristos create_ShAmt_Y1(int num)
994a5a4af3bSchristos {
995a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
996a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
997a5a4af3bSchristos }
998a5a4af3bSchristos 
999a5a4af3bSchristos static __inline tilegx_bundle_bits
1000a5a4af3bSchristos create_ShiftOpcodeExtension_X0(int num)
1001a5a4af3bSchristos {
1002a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1003a5a4af3bSchristos   return ((n & 0x3ff) << 18);
1004a5a4af3bSchristos }
1005a5a4af3bSchristos 
1006a5a4af3bSchristos static __inline tilegx_bundle_bits
1007a5a4af3bSchristos create_ShiftOpcodeExtension_X1(int num)
1008a5a4af3bSchristos {
1009a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1010a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3ff)) << 49);
1011a5a4af3bSchristos }
1012a5a4af3bSchristos 
1013a5a4af3bSchristos static __inline tilegx_bundle_bits
1014a5a4af3bSchristos create_ShiftOpcodeExtension_Y0(int num)
1015a5a4af3bSchristos {
1016a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1017a5a4af3bSchristos   return ((n & 0x3) << 18);
1018a5a4af3bSchristos }
1019a5a4af3bSchristos 
1020a5a4af3bSchristos static __inline tilegx_bundle_bits
1021a5a4af3bSchristos create_ShiftOpcodeExtension_Y1(int num)
1022a5a4af3bSchristos {
1023a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1024a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3)) << 49);
1025a5a4af3bSchristos }
1026a5a4af3bSchristos 
1027a5a4af3bSchristos static __inline tilegx_bundle_bits
1028a5a4af3bSchristos create_SrcA_X0(int num)
1029a5a4af3bSchristos {
1030a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1031a5a4af3bSchristos   return ((n & 0x3f) << 6);
1032a5a4af3bSchristos }
1033a5a4af3bSchristos 
1034a5a4af3bSchristos static __inline tilegx_bundle_bits
1035a5a4af3bSchristos create_SrcA_X1(int num)
1036a5a4af3bSchristos {
1037a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1038a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
1039a5a4af3bSchristos }
1040a5a4af3bSchristos 
1041a5a4af3bSchristos static __inline tilegx_bundle_bits
1042a5a4af3bSchristos create_SrcA_Y0(int num)
1043a5a4af3bSchristos {
1044a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1045a5a4af3bSchristos   return ((n & 0x3f) << 6);
1046a5a4af3bSchristos }
1047a5a4af3bSchristos 
1048a5a4af3bSchristos static __inline tilegx_bundle_bits
1049a5a4af3bSchristos create_SrcA_Y1(int num)
1050a5a4af3bSchristos {
1051a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1052a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 37);
1053a5a4af3bSchristos }
1054a5a4af3bSchristos 
1055a5a4af3bSchristos static __inline tilegx_bundle_bits
1056a5a4af3bSchristos create_SrcA_Y2(int num)
1057a5a4af3bSchristos {
1058a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1059a5a4af3bSchristos   return ((n & 0x3f) << 20);
1060a5a4af3bSchristos }
1061a5a4af3bSchristos 
1062a5a4af3bSchristos static __inline tilegx_bundle_bits
1063a5a4af3bSchristos create_SrcBDest_Y2(int num)
1064a5a4af3bSchristos {
1065a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1066a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 51);
1067a5a4af3bSchristos }
1068a5a4af3bSchristos 
1069a5a4af3bSchristos static __inline tilegx_bundle_bits
1070a5a4af3bSchristos create_SrcB_X0(int num)
1071a5a4af3bSchristos {
1072a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1073a5a4af3bSchristos   return ((n & 0x3f) << 12);
1074a5a4af3bSchristos }
1075a5a4af3bSchristos 
1076a5a4af3bSchristos static __inline tilegx_bundle_bits
1077a5a4af3bSchristos create_SrcB_X1(int num)
1078a5a4af3bSchristos {
1079a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1080a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
1081a5a4af3bSchristos }
1082a5a4af3bSchristos 
1083a5a4af3bSchristos static __inline tilegx_bundle_bits
1084a5a4af3bSchristos create_SrcB_Y0(int num)
1085a5a4af3bSchristos {
1086a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1087a5a4af3bSchristos   return ((n & 0x3f) << 12);
1088a5a4af3bSchristos }
1089a5a4af3bSchristos 
1090a5a4af3bSchristos static __inline tilegx_bundle_bits
1091a5a4af3bSchristos create_SrcB_Y1(int num)
1092a5a4af3bSchristos {
1093a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1094a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
1095a5a4af3bSchristos }
1096a5a4af3bSchristos 
1097a5a4af3bSchristos static __inline tilegx_bundle_bits
1098a5a4af3bSchristos create_UnaryOpcodeExtension_X0(int num)
1099a5a4af3bSchristos {
1100a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1101a5a4af3bSchristos   return ((n & 0x3f) << 12);
1102a5a4af3bSchristos }
1103a5a4af3bSchristos 
1104a5a4af3bSchristos static __inline tilegx_bundle_bits
1105a5a4af3bSchristos create_UnaryOpcodeExtension_X1(int num)
1106a5a4af3bSchristos {
1107a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1108a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
1109a5a4af3bSchristos }
1110a5a4af3bSchristos 
1111a5a4af3bSchristos static __inline tilegx_bundle_bits
1112a5a4af3bSchristos create_UnaryOpcodeExtension_Y0(int num)
1113a5a4af3bSchristos {
1114a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1115a5a4af3bSchristos   return ((n & 0x3f) << 12);
1116a5a4af3bSchristos }
1117a5a4af3bSchristos 
1118a5a4af3bSchristos static __inline tilegx_bundle_bits
1119a5a4af3bSchristos create_UnaryOpcodeExtension_Y1(int num)
1120a5a4af3bSchristos {
1121a5a4af3bSchristos   const unsigned int n = (unsigned int)num;
1122a5a4af3bSchristos   return (((tilegx_bundle_bits)(n & 0x3f)) << 43);
1123a5a4af3bSchristos }
1124a5a4af3bSchristos 
1125a5a4af3bSchristos 
1126a5a4af3bSchristos typedef enum
1127a5a4af3bSchristos {
1128a5a4af3bSchristos   TILEGX_PIPELINE_X0,
1129a5a4af3bSchristos   TILEGX_PIPELINE_X1,
1130a5a4af3bSchristos   TILEGX_PIPELINE_Y0,
1131a5a4af3bSchristos   TILEGX_PIPELINE_Y1,
1132a5a4af3bSchristos   TILEGX_PIPELINE_Y2,
1133e5cb852cSchristos   TILEGX_NUM_PIPELINE_ENCODINGS = 5,
1134a5a4af3bSchristos } tilegx_pipeline;
1135a5a4af3bSchristos 
1136a5a4af3bSchristos #define tilegx_is_x_pipeline(p) ((int)(p) <= (int)TILEGX_PIPELINE_X1)
1137a5a4af3bSchristos 
1138a5a4af3bSchristos typedef enum
1139a5a4af3bSchristos {
1140a5a4af3bSchristos   TILEGX_OP_TYPE_REGISTER,
1141a5a4af3bSchristos   TILEGX_OP_TYPE_IMMEDIATE,
1142a5a4af3bSchristos   TILEGX_OP_TYPE_ADDRESS,
1143a5a4af3bSchristos   TILEGX_OP_TYPE_SPR
1144a5a4af3bSchristos } tilegx_operand_type;
1145a5a4af3bSchristos 
1146a5a4af3bSchristos /* These are the bits that determine if a bundle is in the X encoding. */
1147a5a4af3bSchristos #define TILEGX_BUNDLE_MODE_MASK ((tilegx_bundle_bits)3 << 62)
1148a5a4af3bSchristos 
1149a5a4af3bSchristos enum
1150a5a4af3bSchristos {
1151a5a4af3bSchristos   /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
1152a5a4af3bSchristos   TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE = 3,
1153a5a4af3bSchristos 
1154a5a4af3bSchristos   /* Log base 2 of TILEGX_BUNDLE_SIZE_IN_BYTES. */
1155a5a4af3bSchristos   TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES = 3,
1156a5a4af3bSchristos 
1157a5a4af3bSchristos   /* Instructions take this many bytes. */
1158a5a4af3bSchristos   TILEGX_BUNDLE_SIZE_IN_BYTES = 1 << TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES,
1159a5a4af3bSchristos 
1160a5a4af3bSchristos   /* Log base 2 of TILEGX_BUNDLE_ALIGNMENT_IN_BYTES. */
1161a5a4af3bSchristos   TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3,
1162a5a4af3bSchristos 
1163a5a4af3bSchristos   /* Bundles should be aligned modulo this number of bytes. */
1164a5a4af3bSchristos   TILEGX_BUNDLE_ALIGNMENT_IN_BYTES =
1165a5a4af3bSchristos     (1 << TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES),
1166a5a4af3bSchristos 
1167a5a4af3bSchristos   /* Number of registers (some are magic, such as network I/O). */
1168a5a4af3bSchristos   TILEGX_NUM_REGISTERS = 64,
1169a5a4af3bSchristos };
1170a5a4af3bSchristos 
1171a5a4af3bSchristos 
1172a5a4af3bSchristos struct tilegx_operand
1173a5a4af3bSchristos {
1174a5a4af3bSchristos   /* Is this operand a register, immediate or address? */
1175a5a4af3bSchristos   tilegx_operand_type type;
1176a5a4af3bSchristos 
1177a5a4af3bSchristos   /* The default relocation type for this operand.  */
1178a5a4af3bSchristos   signed int default_reloc : 16;
1179a5a4af3bSchristos 
1180a5a4af3bSchristos   /* How many bits is this value? (used for range checking) */
1181a5a4af3bSchristos   unsigned int num_bits : 5;
1182a5a4af3bSchristos 
1183a5a4af3bSchristos   /* Is the value signed? (used for range checking) */
1184a5a4af3bSchristos   unsigned int is_signed : 1;
1185a5a4af3bSchristos 
1186a5a4af3bSchristos   /* Is this operand a source register? */
1187a5a4af3bSchristos   unsigned int is_src_reg : 1;
1188a5a4af3bSchristos 
1189a5a4af3bSchristos   /* Is this operand written? (i.e. is it a destination register) */
1190a5a4af3bSchristos   unsigned int is_dest_reg : 1;
1191a5a4af3bSchristos 
1192a5a4af3bSchristos   /* Is this operand PC-relative? */
1193a5a4af3bSchristos   unsigned int is_pc_relative : 1;
1194a5a4af3bSchristos 
1195a5a4af3bSchristos   /* By how many bits do we right shift the value before inserting? */
1196a5a4af3bSchristos   unsigned int rightshift : 2;
1197a5a4af3bSchristos 
1198a5a4af3bSchristos   /* Return the bits for this operand to be ORed into an existing bundle. */
1199a5a4af3bSchristos   tilegx_bundle_bits (*insert) (int op);
1200a5a4af3bSchristos 
1201a5a4af3bSchristos   /* Extract this operand and return it. */
1202a5a4af3bSchristos   unsigned int (*extract) (tilegx_bundle_bits bundle);
1203a5a4af3bSchristos };
1204a5a4af3bSchristos 
1205a5a4af3bSchristos 
1206a5a4af3bSchristos extern const struct tilegx_operand tilegx_operands[];
1207a5a4af3bSchristos 
1208a5a4af3bSchristos /* One finite-state machine per pipe for rapid instruction decoding. */
1209a5a4af3bSchristos extern const unsigned short * const
1210a5a4af3bSchristos tilegx_bundle_decoder_fsms[TILEGX_NUM_PIPELINE_ENCODINGS];
1211a5a4af3bSchristos 
1212a5a4af3bSchristos 
1213a5a4af3bSchristos struct tilegx_opcode
1214a5a4af3bSchristos {
1215a5a4af3bSchristos   /* The opcode mnemonic, e.g. "add" */
1216a5a4af3bSchristos   const char *name;
1217a5a4af3bSchristos 
1218a5a4af3bSchristos   /* The enum value for this mnemonic. */
1219a5a4af3bSchristos   tilegx_mnemonic mnemonic;
1220a5a4af3bSchristos 
1221a5a4af3bSchristos   /* A bit mask of which of the five pipes this instruction
1222a5a4af3bSchristos      is compatible with:
1223a5a4af3bSchristos      X0  0x01
1224a5a4af3bSchristos      X1  0x02
1225a5a4af3bSchristos      Y0  0x04
1226a5a4af3bSchristos      Y1  0x08
1227a5a4af3bSchristos      Y2  0x10 */
1228a5a4af3bSchristos   unsigned char pipes;
1229a5a4af3bSchristos 
1230a5a4af3bSchristos   /* How many operands are there? */
1231a5a4af3bSchristos   unsigned char num_operands;
1232a5a4af3bSchristos 
1233a5a4af3bSchristos   /* Which register does this write implicitly, or TREG_ZERO if none? */
1234a5a4af3bSchristos   unsigned char implicitly_written_register;
1235a5a4af3bSchristos 
1236a5a4af3bSchristos   /* Can this be bundled with other instructions (almost always true). */
1237a5a4af3bSchristos   unsigned char can_bundle;
1238a5a4af3bSchristos 
1239a5a4af3bSchristos   /* The description of the operands. Each of these is an
1240a5a4af3bSchristos    * index into the tilegx_operands[] table. */
1241a5a4af3bSchristos   unsigned char operands[TILEGX_NUM_PIPELINE_ENCODINGS][TILEGX_MAX_OPERANDS];
1242a5a4af3bSchristos 
1243a5a4af3bSchristos #if !defined(__KERNEL__) && !defined(_LIBC)
1244a5a4af3bSchristos   /* A mask of which bits have predefined values for each pipeline.
1245a5a4af3bSchristos    * This is useful for disassembly. */
1246a5a4af3bSchristos   tilegx_bundle_bits fixed_bit_masks[TILEGX_NUM_PIPELINE_ENCODINGS];
1247a5a4af3bSchristos 
1248a5a4af3bSchristos   /* For each bit set in fixed_bit_masks, what the value is for this
1249a5a4af3bSchristos    * instruction. */
1250a5a4af3bSchristos   tilegx_bundle_bits fixed_bit_values[TILEGX_NUM_PIPELINE_ENCODINGS];
1251a5a4af3bSchristos #endif
1252a5a4af3bSchristos };
1253a5a4af3bSchristos 
1254a5a4af3bSchristos extern const struct tilegx_opcode tilegx_opcodes[];
1255a5a4af3bSchristos 
1256a5a4af3bSchristos /* Used for non-textual disassembly into structs. */
1257a5a4af3bSchristos struct tilegx_decoded_instruction
1258a5a4af3bSchristos {
1259a5a4af3bSchristos   const struct tilegx_opcode *opcode;
1260a5a4af3bSchristos   const struct tilegx_operand *operands[TILEGX_MAX_OPERANDS];
1261a5a4af3bSchristos   long long operand_values[TILEGX_MAX_OPERANDS];
1262a5a4af3bSchristos };
1263a5a4af3bSchristos 
1264a5a4af3bSchristos 
1265a5a4af3bSchristos /* Disassemble a bundle into a struct for machine processing. */
1266a5a4af3bSchristos extern int parse_insn_tilegx(tilegx_bundle_bits bits,
1267a5a4af3bSchristos                              unsigned long long pc,
1268a5a4af3bSchristos                              struct tilegx_decoded_instruction
1269a5a4af3bSchristos                              decoded[TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE]);
1270a5a4af3bSchristos 
1271a5a4af3bSchristos 
1272a5a4af3bSchristos #if !defined(__KERNEL__) && !defined(_LIBC)
1273a5a4af3bSchristos /* Canonical names of all the registers. */
1274a5a4af3bSchristos /* ISSUE: This table lives in "tile-dis.c" */
1275a5a4af3bSchristos extern const char * const tilegx_register_names[];
1276a5a4af3bSchristos 
1277a5a4af3bSchristos /* Descriptor for a special-purpose register. */
1278a5a4af3bSchristos struct tilegx_spr
1279a5a4af3bSchristos {
1280a5a4af3bSchristos   /* The number */
1281a5a4af3bSchristos   int number;
1282a5a4af3bSchristos 
1283a5a4af3bSchristos   /* The name */
1284a5a4af3bSchristos   const char *name;
1285a5a4af3bSchristos };
1286a5a4af3bSchristos 
1287a5a4af3bSchristos /* List of all the SPRs; ordered by increasing number. */
1288a5a4af3bSchristos extern const struct tilegx_spr tilegx_sprs[];
1289a5a4af3bSchristos 
1290a5a4af3bSchristos /* Number of special-purpose registers. */
1291a5a4af3bSchristos extern const int tilegx_num_sprs;
1292a5a4af3bSchristos 
1293a5a4af3bSchristos extern const char *
1294a5a4af3bSchristos get_tilegx_spr_name (int num);
1295a5a4af3bSchristos #endif /* !__KERNEL__ && !_LIBC */
1296a5a4af3bSchristos 
1297a5a4af3bSchristos /* Make a few "tile_" variables to simply common code between
1298a5a4af3bSchristos    architectures.  */
1299a5a4af3bSchristos 
1300a5a4af3bSchristos typedef tilegx_bundle_bits tile_bundle_bits;
1301a5a4af3bSchristos #define TILE_BUNDLE_SIZE_IN_BYTES TILEGX_BUNDLE_SIZE_IN_BYTES
1302a5a4af3bSchristos #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES
1303a5a4af3bSchristos #define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \
1304a5a4af3bSchristos   TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
1305a5a4af3bSchristos 
1306a5a4af3bSchristos #ifdef __cplusplus
1307a5a4af3bSchristos }
1308a5a4af3bSchristos #endif
1309a5a4af3bSchristos 
1310a5a4af3bSchristos #endif /* opcode_tilegx_h */
1311