bd298cb38cbcca54344b08c19eedece100f98e9e
[external/binutils.git] / opcodes / mep-opc.c
1 /* Instruction opcode table for mep.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright 1996-2007 Free Software Foundation, Inc.
6
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
8
9    This file is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3, or (at your option)
12    any later version.
13
14    It is distributed in the hope that it will be useful, but WITHOUT
15    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
17    License for more details.
18
19    You should have received a copy of the GNU General Public License along
20    with this program; if not, write to the Free Software Foundation, Inc.,
21    51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
22
23 */
24
25 #include "sysdep.h"
26 #include "ansidecl.h"
27 #include "bfd.h"
28 #include "symcat.h"
29 #include "mep-desc.h"
30 #include "mep-opc.h"
31 #include "libiberty.h"
32
33 /* -- opc.c */
34 #include "elf/mep.h"
35
36 /* A mask for all ISAs executed by the core. */
37 CGEN_ATTR_VALUE_BITSET_TYPE mep_all_core_isas_mask = {0, 0};
38
39 void
40 init_mep_all_core_isas_mask (void)
41 {
42   if (mep_all_core_isas_mask.length != 0)
43     return;
44   cgen_bitset_init (& mep_all_core_isas_mask, ISA_MAX);
45   cgen_bitset_set (& mep_all_core_isas_mask, ISA_MEP);
46   /* begin-all-core-isas */
47   cgen_bitset_add (& mep_all_core_isas_mask, ISA_EXT_CORE1);
48   /* end-all-core-isas */
49 }
50
51 CGEN_ATTR_VALUE_BITSET_TYPE mep_all_cop_isas_mask = {0, 0};
52
53 void
54 init_mep_all_cop_isas_mask (void)
55 {
56   if (mep_all_cop_isas_mask.length != 0)
57     return;
58   cgen_bitset_init (& mep_all_cop_isas_mask, ISA_MAX);
59   /* begin-all-cop-isas */
60   /* end-all-cop-isas */
61 }
62
63 int
64 mep_insn_supported_by_isa (const CGEN_INSN *insn, CGEN_ATTR_VALUE_BITSET_TYPE *isa_mask)
65 {
66   CGEN_BITSET insn_isas = CGEN_INSN_BITSET_ATTR_VALUE (insn, CGEN_INSN_ISA);
67   return cgen_bitset_intersect_p (& insn_isas, isa_mask);
68 }
69
70 #define OPTION_MASK \
71         ( (1 << CGEN_INSN_OPTIONAL_BIT_INSN) \
72         | (1 << CGEN_INSN_OPTIONAL_MUL_INSN) \
73         | (1 << CGEN_INSN_OPTIONAL_DIV_INSN) \
74         | (1 << CGEN_INSN_OPTIONAL_DEBUG_INSN) \
75         | (1 << CGEN_INSN_OPTIONAL_LDZ_INSN) \
76         | (1 << CGEN_INSN_OPTIONAL_ABS_INSN) \
77         | (1 << CGEN_INSN_OPTIONAL_AVE_INSN) \
78         | (1 << CGEN_INSN_OPTIONAL_MINMAX_INSN) \
79         | (1 << CGEN_INSN_OPTIONAL_CLIP_INSN) \
80         | (1 << CGEN_INSN_OPTIONAL_SAT_INSN) \
81         | (1 << CGEN_INSN_OPTIONAL_UCI_INSN) \
82         | (1 << CGEN_INSN_OPTIONAL_DSP_INSN) \
83         | (1 << CGEN_INSN_OPTIONAL_CP_INSN) \
84         | (1 << CGEN_INSN_OPTIONAL_CP64_INSN) )
85
86
87 mep_config_map_struct mep_config_map[] =
88 {
89   /* config-map-start */
90   /* Default entry: mep core only, all options enabled. */
91   { "", 0, EF_MEP_CPU_C5, 1, 0, {1,"\x0"}, {1,"\x0"}, {1,"\x0"}, {1,"\x0"}, {1,"\x0"}, {1,"\x80"}, OPTION_MASK },
92   { "default", CONFIG_DEFAULT, EF_MEP_CPU_C5, 0, 0, { 1, "\x0" }, { 1, "\x0" }, { 1, "\x0" }, { 1, "\x0" }, { 1, "\x0" }, { 1, "\xc0" },
93           0
94         | (1 << CGEN_INSN_OPTIONAL_MUL_INSN)
95         | (1 << CGEN_INSN_OPTIONAL_DIV_INSN)
96         | (1 << CGEN_INSN_OPTIONAL_BIT_INSN)
97         | (1 << CGEN_INSN_OPTIONAL_LDZ_INSN)
98         | (1 << CGEN_INSN_OPTIONAL_ABS_INSN)
99         | (1 << CGEN_INSN_OPTIONAL_AVE_INSN)
100         | (1 << CGEN_INSN_OPTIONAL_MINMAX_INSN)
101         | (1 << CGEN_INSN_OPTIONAL_CLIP_INSN)
102         | (1 << CGEN_INSN_OPTIONAL_SAT_INSN) },
103   /* config-map-end */
104   { 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, 0 }
105 };
106
107 int mep_config_index = 0;
108
109 static int
110 check_configured_mach (int machs)
111 {
112   /* All base insns are supported.  */
113   int mach = 1 << MACH_BASE;
114   switch (MEP_CPU)
115     {
116     case EF_MEP_CPU_C2:
117     case EF_MEP_CPU_C3:
118       mach |= (1 << MACH_MEP);
119       break;
120     case EF_MEP_CPU_H1:
121       mach |= (1 << MACH_H1);
122       break;
123     case EF_MEP_CPU_C5:
124       mach |= (1 << MACH_MEP);
125       mach |= (1 << MACH_C5);
126       break;
127     default:
128       break;
129     }
130   return machs & mach;
131 }
132
133 int
134 mep_cgen_insn_supported (CGEN_CPU_DESC cd, const CGEN_INSN *insn)
135 {
136   int iconfig = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_CONFIG);
137   int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH);
138   CGEN_BITSET isas = CGEN_INSN_BITSET_ATTR_VALUE (insn, CGEN_INSN_ISA);
139   int ok1;
140   int ok2;
141   int ok3;
142
143   /* If the insn has an option bit set that we don't want,
144      reject it.  */
145   if (CGEN_INSN_ATTRS (insn)->bool & OPTION_MASK & ~MEP_OMASK)
146     return 0;
147
148   /* If attributes are absent, assume no restriction. */
149   if (machs == 0)
150     machs = ~0;
151
152   ok1 = ((machs & cd->machs) && cgen_bitset_intersect_p (& isas, cd->isas));
153   /* If the insn is config-specific, make sure it matches.  */
154   ok2 =  (iconfig == 0 || iconfig == MEP_CONFIG);
155   /* Make sure the insn is supported by the configured mach  */
156   ok3 = check_configured_mach (machs);
157
158   return (ok1 && ok2 && ok3);
159 }
160 /* The hash functions are recorded here to help keep assembler code out of
161    the disassembler and vice versa.  */
162
163 static int asm_hash_insn_p        (const CGEN_INSN *);
164 static unsigned int asm_hash_insn (const char *);
165 static int dis_hash_insn_p        (const CGEN_INSN *);
166 static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
167
168 /* Instruction formats.  */
169
170 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
171 #define F(f) & mep_cgen_ifld_table[MEP_##f]
172 #else
173 #define F(f) & mep_cgen_ifld_table[MEP_/**/f]
174 #endif
175 static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
176   0, 0, 0x0, { { 0 } }
177 };
178
179 static const CGEN_IFMT ifmt_stcb_r ATTRIBUTE_UNUSED = {
180   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
181 };
182
183 static const CGEN_IFMT ifmt_pref ATTRIBUTE_UNUSED = {
184   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
185 };
186
187 static const CGEN_IFMT ifmt_prefd ATTRIBUTE_UNUSED = {
188   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
189 };
190
191 static const CGEN_IFMT ifmt_casb3 ATTRIBUTE_UNUSED = {
192   32, 32, 0xf00ff0ff, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_C5N4) }, { F (F_RL5) }, { F (F_C5N6) }, { F (F_C5N7) }, { 0 } }
193 };
194
195 static const CGEN_IFMT ifmt_sbcp ATTRIBUTE_UNUSED = {
196   32, 32, 0xf00ff000, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_EXT4) }, { F (F_12S20) }, { 0 } }
197 };
198
199 static const CGEN_IFMT ifmt_lbucpa ATTRIBUTE_UNUSED = {
200   32, 32, 0xf00ffc00, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_EXT4) }, { F (F_EXT62) }, { F (F_CDISP10) }, { 0 } }
201 };
202
203 static const CGEN_IFMT ifmt_lhucpa ATTRIBUTE_UNUSED = {
204   32, 32, 0xf00ffc00, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_EXT4) }, { F (F_EXT62) }, { F (F_CDISP10) }, { 0 } }
205 };
206
207 static const CGEN_IFMT ifmt_uci ATTRIBUTE_UNUSED = {
208   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
209 };
210
211 static const CGEN_IFMT ifmt_dsp ATTRIBUTE_UNUSED = {
212   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16U16) }, { 0 } }
213 };
214
215 static const CGEN_IFMT ifmt_sb ATTRIBUTE_UNUSED = {
216   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
217 };
218
219 static const CGEN_IFMT ifmt_sh ATTRIBUTE_UNUSED = {
220   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
221 };
222
223 static const CGEN_IFMT ifmt_sw ATTRIBUTE_UNUSED = {
224   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
225 };
226
227 static const CGEN_IFMT ifmt_lbu ATTRIBUTE_UNUSED = {
228   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
229 };
230
231 static const CGEN_IFMT ifmt_lhu ATTRIBUTE_UNUSED = {
232   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
233 };
234
235 static const CGEN_IFMT ifmt_sw_sp ATTRIBUTE_UNUSED = {
236   16, 16, 0xf083, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_8) }, { F (F_7U9A4) }, { F (F_SUB2) }, { 0 } }
237 };
238
239 static const CGEN_IFMT ifmt_sb_tp ATTRIBUTE_UNUSED = {
240   16, 16, 0xf880, { { F (F_MAJOR) }, { F (F_4) }, { F (F_RN3) }, { F (F_8) }, { F (F_7U9) }, { 0 } }
241 };
242
243 static const CGEN_IFMT ifmt_sh_tp ATTRIBUTE_UNUSED = {
244   16, 16, 0xf881, { { F (F_MAJOR) }, { F (F_4) }, { F (F_RN3) }, { F (F_8) }, { F (F_7U9A2) }, { F (F_15) }, { 0 } }
245 };
246
247 static const CGEN_IFMT ifmt_sw_tp ATTRIBUTE_UNUSED = {
248   16, 16, 0xf883, { { F (F_MAJOR) }, { F (F_4) }, { F (F_RN3) }, { F (F_8) }, { F (F_7U9A4) }, { F (F_SUB2) }, { 0 } }
249 };
250
251 static const CGEN_IFMT ifmt_lbu_tp ATTRIBUTE_UNUSED = {
252   16, 16, 0xf880, { { F (F_MAJOR) }, { F (F_4) }, { F (F_RN3) }, { F (F_8) }, { F (F_7U9) }, { 0 } }
253 };
254
255 static const CGEN_IFMT ifmt_lhu_tp ATTRIBUTE_UNUSED = {
256   16, 16, 0xf881, { { F (F_MAJOR) }, { F (F_4) }, { F (F_RN3) }, { F (F_8) }, { F (F_7U9A2) }, { F (F_15) }, { 0 } }
257 };
258
259 static const CGEN_IFMT ifmt_sb16 ATTRIBUTE_UNUSED = {
260   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
261 };
262
263 static const CGEN_IFMT ifmt_sh16 ATTRIBUTE_UNUSED = {
264   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
265 };
266
267 static const CGEN_IFMT ifmt_sw16 ATTRIBUTE_UNUSED = {
268   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
269 };
270
271 static const CGEN_IFMT ifmt_lbu16 ATTRIBUTE_UNUSED = {
272   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
273 };
274
275 static const CGEN_IFMT ifmt_lhu16 ATTRIBUTE_UNUSED = {
276   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
277 };
278
279 static const CGEN_IFMT ifmt_sw24 ATTRIBUTE_UNUSED = {
280   32, 32, 0xf0030000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_24U8A4N) }, { F (F_SUB2) }, { 0 } }
281 };
282
283 static const CGEN_IFMT ifmt_extb ATTRIBUTE_UNUSED = {
284   16, 16, 0xf0ff, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
285 };
286
287 static const CGEN_IFMT ifmt_ssarb ATTRIBUTE_UNUSED = {
288   16, 16, 0xfc0f, { { F (F_MAJOR) }, { F (F_4) }, { F (F_5) }, { F (F_2U6) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
289 };
290
291 static const CGEN_IFMT ifmt_mov ATTRIBUTE_UNUSED = {
292   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
293 };
294
295 static const CGEN_IFMT ifmt_movi8 ATTRIBUTE_UNUSED = {
296   16, 16, 0xf000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_8S8) }, { 0 } }
297 };
298
299 static const CGEN_IFMT ifmt_movi16 ATTRIBUTE_UNUSED = {
300   32, 32, 0xf0ff0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
301 };
302
303 static const CGEN_IFMT ifmt_movu24 ATTRIBUTE_UNUSED = {
304   32, 32, 0xf8000000, { { F (F_MAJOR) }, { F (F_4) }, { F (F_RN3) }, { F (F_24U8N) }, { 0 } }
305 };
306
307 static const CGEN_IFMT ifmt_movu16 ATTRIBUTE_UNUSED = {
308   32, 32, 0xf0ff0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16U16) }, { 0 } }
309 };
310
311 static const CGEN_IFMT ifmt_add3 ATTRIBUTE_UNUSED = {
312   16, 16, 0xf000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_RL) }, { 0 } }
313 };
314
315 static const CGEN_IFMT ifmt_add ATTRIBUTE_UNUSED = {
316   16, 16, 0xf003, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_6S8) }, { F (F_SUB2) }, { 0 } }
317 };
318
319 static const CGEN_IFMT ifmt_add3i ATTRIBUTE_UNUSED = {
320   16, 16, 0xf083, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_8) }, { F (F_7U9A4) }, { F (F_SUB2) }, { 0 } }
321 };
322
323 static const CGEN_IFMT ifmt_slt3i ATTRIBUTE_UNUSED = {
324   16, 16, 0xf007, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_5U8) }, { F (F_SUB3) }, { 0 } }
325 };
326
327 static const CGEN_IFMT ifmt_bra ATTRIBUTE_UNUSED = {
328   16, 16, 0xf001, { { F (F_MAJOR) }, { F (F_12S4A2) }, { F (F_15) }, { 0 } }
329 };
330
331 static const CGEN_IFMT ifmt_beqz ATTRIBUTE_UNUSED = {
332   16, 16, 0xf001, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_8S8A2) }, { F (F_15) }, { 0 } }
333 };
334
335 static const CGEN_IFMT ifmt_beqi ATTRIBUTE_UNUSED = {
336   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_4U8) }, { F (F_SUB4) }, { F (F_17S16A2) }, { 0 } }
337 };
338
339 static const CGEN_IFMT ifmt_beq ATTRIBUTE_UNUSED = {
340   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_17S16A2) }, { 0 } }
341 };
342
343 static const CGEN_IFMT ifmt_bsr24 ATTRIBUTE_UNUSED = {
344   32, 32, 0xf80f0000, { { F (F_MAJOR) }, { F (F_4) }, { F (F_24S5A2N) }, { F (F_SUB4) }, { 0 } }
345 };
346
347 static const CGEN_IFMT ifmt_jmp ATTRIBUTE_UNUSED = {
348   16, 16, 0xff0f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
349 };
350
351 static const CGEN_IFMT ifmt_jmp24 ATTRIBUTE_UNUSED = {
352   32, 32, 0xf80f0000, { { F (F_MAJOR) }, { F (F_4) }, { F (F_24U5A2N) }, { F (F_SUB4) }, { 0 } }
353 };
354
355 static const CGEN_IFMT ifmt_ret ATTRIBUTE_UNUSED = {
356   16, 16, 0xffff, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
357 };
358
359 static const CGEN_IFMT ifmt_repeat ATTRIBUTE_UNUSED = {
360   32, 32, 0xf0ff0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_17S16A2) }, { 0 } }
361 };
362
363 static const CGEN_IFMT ifmt_erepeat ATTRIBUTE_UNUSED = {
364   32, 32, 0xffff0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_17S16A2) }, { 0 } }
365 };
366
367 static const CGEN_IFMT ifmt_stc_lp ATTRIBUTE_UNUSED = {
368   16, 16, 0xf0ff, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_CSRN_LO) }, { F (F_12) }, { F (F_13) }, { F (F_14) }, { F (F_CSRN_HI) }, { 0 } }
369 };
370
371 static const CGEN_IFMT ifmt_stc ATTRIBUTE_UNUSED = {
372   16, 16, 0xf00e, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_CSRN) }, { F (F_12) }, { F (F_13) }, { F (F_14) }, { 0 } }
373 };
374
375 static const CGEN_IFMT ifmt_swi ATTRIBUTE_UNUSED = {
376   16, 16, 0xffcf, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_8) }, { F (F_9) }, { F (F_2U10) }, { F (F_SUB4) }, { 0 } }
377 };
378
379 static const CGEN_IFMT ifmt_bsetm ATTRIBUTE_UNUSED = {
380   16, 16, 0xf80f, { { F (F_MAJOR) }, { F (F_4) }, { F (F_3U5) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
381 };
382
383 static const CGEN_IFMT ifmt_madd ATTRIBUTE_UNUSED = {
384   32, 32, 0xf00fffff, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16U16) }, { 0 } }
385 };
386
387 static const CGEN_IFMT ifmt_clip ATTRIBUTE_UNUSED = {
388   32, 32, 0xf0ffff07, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_EXT) }, { F (F_5U24) }, { F (F_29) }, { F (F_30) }, { F (F_31) }, { 0 } }
389 };
390
391 static const CGEN_IFMT ifmt_swcp ATTRIBUTE_UNUSED = {
392   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
393 };
394
395 static const CGEN_IFMT ifmt_smcp ATTRIBUTE_UNUSED = {
396   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
397 };
398
399 static const CGEN_IFMT ifmt_swcp16 ATTRIBUTE_UNUSED = {
400   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
401 };
402
403 static const CGEN_IFMT ifmt_smcp16 ATTRIBUTE_UNUSED = {
404   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16S16) }, { 0 } }
405 };
406
407 static const CGEN_IFMT ifmt_swcpa ATTRIBUTE_UNUSED = {
408   32, 32, 0xf00ffc00, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_EXT4) }, { F (F_EXT62) }, { F (F_CDISP10) }, { 0 } }
409 };
410
411 static const CGEN_IFMT ifmt_smcpa ATTRIBUTE_UNUSED = {
412   32, 32, 0xf00ffc00, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_EXT4) }, { F (F_EXT62) }, { F (F_CDISP10) }, { 0 } }
413 };
414
415 static const CGEN_IFMT ifmt_bcpeq ATTRIBUTE_UNUSED = {
416   32, 32, 0xff0f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_17S16A2) }, { 0 } }
417 };
418
419 static const CGEN_IFMT ifmt_sim_syscall ATTRIBUTE_UNUSED = {
420   16, 16, 0xf8ef, { { F (F_MAJOR) }, { F (F_4) }, { F (F_CALLNUM) }, { F (F_8) }, { F (F_9) }, { F (F_10) }, { F (F_SUB4) }, { 0 } }
421 };
422
423 #undef F
424
425 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
426 #define A(a) (1 << CGEN_INSN_##a)
427 #else
428 #define A(a) (1 << CGEN_INSN_/**/a)
429 #endif
430 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
431 #define OPERAND(op) MEP_OPERAND_##op
432 #else
433 #define OPERAND(op) MEP_OPERAND_/**/op
434 #endif
435 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
436 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
437
438 /* The instruction table.  */
439
440 static const CGEN_OPCODE mep_cgen_insn_opcode_table[MAX_INSNS] =
441 {
442   /* Special null first entry.
443      A `num' value of zero is thus invalid.
444      Also, the special `invalid' insn resides here.  */
445   { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
446 /* stcb $rn,($rma) */
447   {
448     { 0, 0, 0, 0 },
449     { { MNEM, ' ', OP (RN), ',', '(', OP (RMA), ')', 0 } },
450     & ifmt_stcb_r, { 0x700c }
451   },
452 /* ldcb $rn,($rma) */
453   {
454     { 0, 0, 0, 0 },
455     { { MNEM, ' ', OP (RN), ',', '(', OP (RMA), ')', 0 } },
456     & ifmt_stcb_r, { 0x700d }
457   },
458 /* pref $cimm4,($rma) */
459   {
460     { 0, 0, 0, 0 },
461     { { MNEM, ' ', OP (CIMM4), ',', '(', OP (RMA), ')', 0 } },
462     & ifmt_pref, { 0x7005 }
463   },
464 /* pref $cimm4,$sdisp16($rma) */
465   {
466     { 0, 0, 0, 0 },
467     { { MNEM, ' ', OP (CIMM4), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
468     & ifmt_prefd, { 0xf0030000 }
469   },
470 /* casb3 $rl5,$rn,($rm) */
471   {
472     { 0, 0, 0, 0 },
473     { { MNEM, ' ', OP (RL5), ',', OP (RN), ',', '(', OP (RM), ')', 0 } },
474     & ifmt_casb3, { 0xf0012000 }
475   },
476 /* cash3 $rl5,$rn,($rm) */
477   {
478     { 0, 0, 0, 0 },
479     { { MNEM, ' ', OP (RL5), ',', OP (RN), ',', '(', OP (RM), ')', 0 } },
480     & ifmt_casb3, { 0xf0012001 }
481   },
482 /* casw3 $rl5,$rn,($rm) */
483   {
484     { 0, 0, 0, 0 },
485     { { MNEM, ' ', OP (RL5), ',', OP (RN), ',', '(', OP (RM), ')', 0 } },
486     & ifmt_casb3, { 0xf0012002 }
487   },
488 /* sbcp $crn,$cdisp12($rma) */
489   {
490     { 0, 0, 0, 0 },
491     { { MNEM, ' ', OP (CRN), ',', OP (CDISP12), '(', OP (RMA), ')', 0 } },
492     & ifmt_sbcp, { 0xf0060000 }
493   },
494 /* lbcp $crn,$cdisp12($rma) */
495   {
496     { 0, 0, 0, 0 },
497     { { MNEM, ' ', OP (CRN), ',', OP (CDISP12), '(', OP (RMA), ')', 0 } },
498     & ifmt_sbcp, { 0xf0064000 }
499   },
500 /* lbucp $crn,$cdisp12($rma) */
501   {
502     { 0, 0, 0, 0 },
503     { { MNEM, ' ', OP (CRN), ',', OP (CDISP12), '(', OP (RMA), ')', 0 } },
504     & ifmt_sbcp, { 0xf006c000 }
505   },
506 /* shcp $crn,$cdisp12($rma) */
507   {
508     { 0, 0, 0, 0 },
509     { { MNEM, ' ', OP (CRN), ',', OP (CDISP12), '(', OP (RMA), ')', 0 } },
510     & ifmt_sbcp, { 0xf0061000 }
511   },
512 /* lhcp $crn,$cdisp12($rma) */
513   {
514     { 0, 0, 0, 0 },
515     { { MNEM, ' ', OP (CRN), ',', OP (CDISP12), '(', OP (RMA), ')', 0 } },
516     & ifmt_sbcp, { 0xf0065000 }
517   },
518 /* lhucp $crn,$cdisp12($rma) */
519   {
520     { 0, 0, 0, 0 },
521     { { MNEM, ' ', OP (CRN), ',', OP (CDISP12), '(', OP (RMA), ')', 0 } },
522     & ifmt_sbcp, { 0xf006d000 }
523   },
524 /* lbucpa $crn,($rma+),$cdisp10 */
525   {
526     { 0, 0, 0, 0 },
527     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
528     & ifmt_lbucpa, { 0xf005c000 }
529   },
530 /* lhucpa $crn,($rma+),$cdisp10a2 */
531   {
532     { 0, 0, 0, 0 },
533     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
534     & ifmt_lhucpa, { 0xf005d000 }
535   },
536 /* lbucpm0 $crn,($rma+),$cdisp10 */
537   {
538     { 0, 0, 0, 0 },
539     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
540     & ifmt_lbucpa, { 0xf005c800 }
541   },
542 /* lhucpm0 $crn,($rma+),$cdisp10a2 */
543   {
544     { 0, 0, 0, 0 },
545     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
546     & ifmt_lhucpa, { 0xf005d800 }
547   },
548 /* lbucpm1 $crn,($rma+),$cdisp10 */
549   {
550     { 0, 0, 0, 0 },
551     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
552     & ifmt_lbucpa, { 0xf005cc00 }
553   },
554 /* lhucpm1 $crn,($rma+),$cdisp10a2 */
555   {
556     { 0, 0, 0, 0 },
557     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
558     & ifmt_lhucpa, { 0xf005dc00 }
559   },
560 /* uci $rn,$rm,$uimm16 */
561   {
562     { 0, 0, 0, 0 },
563     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (UIMM16), 0 } },
564     & ifmt_uci, { 0xf0020000 }
565   },
566 /* dsp $rn,$rm,$uimm16 */
567   {
568     { 0, 0, 0, 0 },
569     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (UIMM16), 0 } },
570     & ifmt_dsp, { 0xf0000000 }
571   },
572 /* sb $rnc,($rma) */
573   {
574     { 0, 0, 0, 0 },
575     { { MNEM, ' ', OP (RNC), ',', '(', OP (RMA), ')', 0 } },
576     & ifmt_sb, { 0x8 }
577   },
578 /* sh $rns,($rma) */
579   {
580     { 0, 0, 0, 0 },
581     { { MNEM, ' ', OP (RNS), ',', '(', OP (RMA), ')', 0 } },
582     & ifmt_sh, { 0x9 }
583   },
584 /* sw $rnl,($rma) */
585   {
586     { 0, 0, 0, 0 },
587     { { MNEM, ' ', OP (RNL), ',', '(', OP (RMA), ')', 0 } },
588     & ifmt_sw, { 0xa }
589   },
590 /* lb $rnc,($rma) */
591   {
592     { 0, 0, 0, 0 },
593     { { MNEM, ' ', OP (RNC), ',', '(', OP (RMA), ')', 0 } },
594     & ifmt_sb, { 0xc }
595   },
596 /* lh $rns,($rma) */
597   {
598     { 0, 0, 0, 0 },
599     { { MNEM, ' ', OP (RNS), ',', '(', OP (RMA), ')', 0 } },
600     & ifmt_sh, { 0xd }
601   },
602 /* lw $rnl,($rma) */
603   {
604     { 0, 0, 0, 0 },
605     { { MNEM, ' ', OP (RNL), ',', '(', OP (RMA), ')', 0 } },
606     & ifmt_sw, { 0xe }
607   },
608 /* lbu $rnuc,($rma) */
609   {
610     { 0, 0, 0, 0 },
611     { { MNEM, ' ', OP (RNUC), ',', '(', OP (RMA), ')', 0 } },
612     & ifmt_lbu, { 0xb }
613   },
614 /* lhu $rnus,($rma) */
615   {
616     { 0, 0, 0, 0 },
617     { { MNEM, ' ', OP (RNUS), ',', '(', OP (RMA), ')', 0 } },
618     & ifmt_lhu, { 0xf }
619   },
620 /* sw $rnl,$udisp7a4($spr) */
621   {
622     { 0, 0, 0, 0 },
623     { { MNEM, ' ', OP (RNL), ',', OP (UDISP7A4), '(', OP (SPR), ')', 0 } },
624     & ifmt_sw_sp, { 0x4002 }
625   },
626 /* lw $rnl,$udisp7a4($spr) */
627   {
628     { 0, 0, 0, 0 },
629     { { MNEM, ' ', OP (RNL), ',', OP (UDISP7A4), '(', OP (SPR), ')', 0 } },
630     & ifmt_sw_sp, { 0x4003 }
631   },
632 /* sb $rn3c,$udisp7($tpr) */
633   {
634     { 0, 0, 0, 0 },
635     { { MNEM, ' ', OP (RN3C), ',', OP (UDISP7), '(', OP (TPR), ')', 0 } },
636     & ifmt_sb_tp, { 0x8000 }
637   },
638 /* sh $rn3s,$udisp7a2($tpr) */
639   {
640     { 0, 0, 0, 0 },
641     { { MNEM, ' ', OP (RN3S), ',', OP (UDISP7A2), '(', OP (TPR), ')', 0 } },
642     & ifmt_sh_tp, { 0x8080 }
643   },
644 /* sw $rn3l,$udisp7a4($tpr) */
645   {
646     { 0, 0, 0, 0 },
647     { { MNEM, ' ', OP (RN3L), ',', OP (UDISP7A4), '(', OP (TPR), ')', 0 } },
648     & ifmt_sw_tp, { 0x4082 }
649   },
650 /* lb $rn3c,$udisp7($tpr) */
651   {
652     { 0, 0, 0, 0 },
653     { { MNEM, ' ', OP (RN3C), ',', OP (UDISP7), '(', OP (TPR), ')', 0 } },
654     & ifmt_sb_tp, { 0x8800 }
655   },
656 /* lh $rn3s,$udisp7a2($tpr) */
657   {
658     { 0, 0, 0, 0 },
659     { { MNEM, ' ', OP (RN3S), ',', OP (UDISP7A2), '(', OP (TPR), ')', 0 } },
660     & ifmt_sh_tp, { 0x8880 }
661   },
662 /* lw $rn3l,$udisp7a4($tpr) */
663   {
664     { 0, 0, 0, 0 },
665     { { MNEM, ' ', OP (RN3L), ',', OP (UDISP7A4), '(', OP (TPR), ')', 0 } },
666     & ifmt_sw_tp, { 0x4083 }
667   },
668 /* lbu $rn3uc,$udisp7($tpr) */
669   {
670     { 0, 0, 0, 0 },
671     { { MNEM, ' ', OP (RN3UC), ',', OP (UDISP7), '(', OP (TPR), ')', 0 } },
672     & ifmt_lbu_tp, { 0x4880 }
673   },
674 /* lhu $rn3us,$udisp7a2($tpr) */
675   {
676     { 0, 0, 0, 0 },
677     { { MNEM, ' ', OP (RN3US), ',', OP (UDISP7A2), '(', OP (TPR), ')', 0 } },
678     & ifmt_lhu_tp, { 0x8881 }
679   },
680 /* sb $rnc,$sdisp16($rma) */
681   {
682     { 0, 0, 0, 0 },
683     { { MNEM, ' ', OP (RNC), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
684     & ifmt_sb16, { 0xc0080000 }
685   },
686 /* sh $rns,$sdisp16($rma) */
687   {
688     { 0, 0, 0, 0 },
689     { { MNEM, ' ', OP (RNS), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
690     & ifmt_sh16, { 0xc0090000 }
691   },
692 /* sw $rnl,$sdisp16($rma) */
693   {
694     { 0, 0, 0, 0 },
695     { { MNEM, ' ', OP (RNL), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
696     & ifmt_sw16, { 0xc00a0000 }
697   },
698 /* lb $rnc,$sdisp16($rma) */
699   {
700     { 0, 0, 0, 0 },
701     { { MNEM, ' ', OP (RNC), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
702     & ifmt_sb16, { 0xc00c0000 }
703   },
704 /* lh $rns,$sdisp16($rma) */
705   {
706     { 0, 0, 0, 0 },
707     { { MNEM, ' ', OP (RNS), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
708     & ifmt_sh16, { 0xc00d0000 }
709   },
710 /* lw $rnl,$sdisp16($rma) */
711   {
712     { 0, 0, 0, 0 },
713     { { MNEM, ' ', OP (RNL), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
714     & ifmt_sw16, { 0xc00e0000 }
715   },
716 /* lbu $rnuc,$sdisp16($rma) */
717   {
718     { 0, 0, 0, 0 },
719     { { MNEM, ' ', OP (RNUC), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
720     & ifmt_lbu16, { 0xc00b0000 }
721   },
722 /* lhu $rnus,$sdisp16($rma) */
723   {
724     { 0, 0, 0, 0 },
725     { { MNEM, ' ', OP (RNUS), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
726     & ifmt_lhu16, { 0xc00f0000 }
727   },
728 /* sw $rnl,($addr24a4) */
729   {
730     { 0, 0, 0, 0 },
731     { { MNEM, ' ', OP (RNL), ',', '(', OP (ADDR24A4), ')', 0 } },
732     & ifmt_sw24, { 0xe0020000 }
733   },
734 /* lw $rnl,($addr24a4) */
735   {
736     { 0, 0, 0, 0 },
737     { { MNEM, ' ', OP (RNL), ',', '(', OP (ADDR24A4), ')', 0 } },
738     & ifmt_sw24, { 0xe0030000 }
739   },
740 /* extb $rn */
741   {
742     { 0, 0, 0, 0 },
743     { { MNEM, ' ', OP (RN), 0 } },
744     & ifmt_extb, { 0x100d }
745   },
746 /* exth $rn */
747   {
748     { 0, 0, 0, 0 },
749     { { MNEM, ' ', OP (RN), 0 } },
750     & ifmt_extb, { 0x102d }
751   },
752 /* extub $rn */
753   {
754     { 0, 0, 0, 0 },
755     { { MNEM, ' ', OP (RN), 0 } },
756     & ifmt_extb, { 0x108d }
757   },
758 /* extuh $rn */
759   {
760     { 0, 0, 0, 0 },
761     { { MNEM, ' ', OP (RN), 0 } },
762     & ifmt_extb, { 0x10ad }
763   },
764 /* ssarb $udisp2($rm) */
765   {
766     { 0, 0, 0, 0 },
767     { { MNEM, ' ', OP (UDISP2), '(', OP (RM), ')', 0 } },
768     & ifmt_ssarb, { 0x100c }
769   },
770 /* mov $rn,$rm */
771   {
772     { 0, 0, 0, 0 },
773     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
774     & ifmt_mov, { 0x0 }
775   },
776 /* mov $rn,$simm8 */
777   {
778     { 0, 0, 0, 0 },
779     { { MNEM, ' ', OP (RN), ',', OP (SIMM8), 0 } },
780     & ifmt_movi8, { 0x5000 }
781   },
782 /* mov $rn,$simm16 */
783   {
784     { 0, 0, 0, 0 },
785     { { MNEM, ' ', OP (RN), ',', OP (SIMM16), 0 } },
786     & ifmt_movi16, { 0xc0010000 }
787   },
788 /* movu $rn3,$uimm24 */
789   {
790     { 0, 0, 0, 0 },
791     { { MNEM, ' ', OP (RN3), ',', OP (UIMM24), 0 } },
792     & ifmt_movu24, { 0xd0000000 }
793   },
794 /* movu $rn,$uimm16 */
795   {
796     { 0, 0, 0, 0 },
797     { { MNEM, ' ', OP (RN), ',', OP (UIMM16), 0 } },
798     & ifmt_movu16, { 0xc0110000 }
799   },
800 /* movh $rn,$uimm16 */
801   {
802     { 0, 0, 0, 0 },
803     { { MNEM, ' ', OP (RN), ',', OP (UIMM16), 0 } },
804     & ifmt_movu16, { 0xc0210000 }
805   },
806 /* add3 $rl,$rn,$rm */
807   {
808     { 0, 0, 0, 0 },
809     { { MNEM, ' ', OP (RL), ',', OP (RN), ',', OP (RM), 0 } },
810     & ifmt_add3, { 0x9000 }
811   },
812 /* add $rn,$simm6 */
813   {
814     { 0, 0, 0, 0 },
815     { { MNEM, ' ', OP (RN), ',', OP (SIMM6), 0 } },
816     & ifmt_add, { 0x6000 }
817   },
818 /* add3 $rn,$spr,$uimm7a4 */
819   {
820     { 0, 0, 0, 0 },
821     { { MNEM, ' ', OP (RN), ',', OP (SPR), ',', OP (UIMM7A4), 0 } },
822     & ifmt_add3i, { 0x4000 }
823   },
824 /* advck3 \$0,$rn,$rm */
825   {
826     { 0, 0, 0, 0 },
827     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (RM), 0 } },
828     & ifmt_mov, { 0x7 }
829   },
830 /* sub $rn,$rm */
831   {
832     { 0, 0, 0, 0 },
833     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
834     & ifmt_mov, { 0x4 }
835   },
836 /* sbvck3 \$0,$rn,$rm */
837   {
838     { 0, 0, 0, 0 },
839     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (RM), 0 } },
840     & ifmt_mov, { 0x5 }
841   },
842 /* neg $rn,$rm */
843   {
844     { 0, 0, 0, 0 },
845     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
846     & ifmt_mov, { 0x1 }
847   },
848 /* slt3 \$0,$rn,$rm */
849   {
850     { 0, 0, 0, 0 },
851     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (RM), 0 } },
852     & ifmt_mov, { 0x2 }
853   },
854 /* sltu3 \$0,$rn,$rm */
855   {
856     { 0, 0, 0, 0 },
857     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (RM), 0 } },
858     & ifmt_mov, { 0x3 }
859   },
860 /* slt3 \$0,$rn,$uimm5 */
861   {
862     { 0, 0, 0, 0 },
863     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (UIMM5), 0 } },
864     & ifmt_slt3i, { 0x6001 }
865   },
866 /* sltu3 \$0,$rn,$uimm5 */
867   {
868     { 0, 0, 0, 0 },
869     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (UIMM5), 0 } },
870     & ifmt_slt3i, { 0x6005 }
871   },
872 /* sl1ad3 \$0,$rn,$rm */
873   {
874     { 0, 0, 0, 0 },
875     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (RM), 0 } },
876     & ifmt_mov, { 0x2006 }
877   },
878 /* sl2ad3 \$0,$rn,$rm */
879   {
880     { 0, 0, 0, 0 },
881     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (RM), 0 } },
882     & ifmt_mov, { 0x2007 }
883   },
884 /* add3 $rn,$rm,$simm16 */
885   {
886     { 0, 0, 0, 0 },
887     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (SIMM16), 0 } },
888     & ifmt_uci, { 0xc0000000 }
889   },
890 /* slt3 $rn,$rm,$simm16 */
891   {
892     { 0, 0, 0, 0 },
893     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (SIMM16), 0 } },
894     & ifmt_uci, { 0xc0020000 }
895   },
896 /* sltu3 $rn,$rm,$uimm16 */
897   {
898     { 0, 0, 0, 0 },
899     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (UIMM16), 0 } },
900     & ifmt_dsp, { 0xc0030000 }
901   },
902 /* or $rn,$rm */
903   {
904     { 0, 0, 0, 0 },
905     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
906     & ifmt_mov, { 0x1000 }
907   },
908 /* and $rn,$rm */
909   {
910     { 0, 0, 0, 0 },
911     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
912     & ifmt_mov, { 0x1001 }
913   },
914 /* xor $rn,$rm */
915   {
916     { 0, 0, 0, 0 },
917     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
918     & ifmt_mov, { 0x1002 }
919   },
920 /* nor $rn,$rm */
921   {
922     { 0, 0, 0, 0 },
923     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
924     & ifmt_mov, { 0x1003 }
925   },
926 /* or3 $rn,$rm,$uimm16 */
927   {
928     { 0, 0, 0, 0 },
929     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (UIMM16), 0 } },
930     & ifmt_dsp, { 0xc0040000 }
931   },
932 /* and3 $rn,$rm,$uimm16 */
933   {
934     { 0, 0, 0, 0 },
935     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (UIMM16), 0 } },
936     & ifmt_dsp, { 0xc0050000 }
937   },
938 /* xor3 $rn,$rm,$uimm16 */
939   {
940     { 0, 0, 0, 0 },
941     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (UIMM16), 0 } },
942     & ifmt_dsp, { 0xc0060000 }
943   },
944 /* sra $rn,$rm */
945   {
946     { 0, 0, 0, 0 },
947     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
948     & ifmt_mov, { 0x200d }
949   },
950 /* srl $rn,$rm */
951   {
952     { 0, 0, 0, 0 },
953     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
954     & ifmt_mov, { 0x200c }
955   },
956 /* sll $rn,$rm */
957   {
958     { 0, 0, 0, 0 },
959     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
960     & ifmt_mov, { 0x200e }
961   },
962 /* sra $rn,$uimm5 */
963   {
964     { 0, 0, 0, 0 },
965     { { MNEM, ' ', OP (RN), ',', OP (UIMM5), 0 } },
966     & ifmt_slt3i, { 0x6003 }
967   },
968 /* srl $rn,$uimm5 */
969   {
970     { 0, 0, 0, 0 },
971     { { MNEM, ' ', OP (RN), ',', OP (UIMM5), 0 } },
972     & ifmt_slt3i, { 0x6002 }
973   },
974 /* sll $rn,$uimm5 */
975   {
976     { 0, 0, 0, 0 },
977     { { MNEM, ' ', OP (RN), ',', OP (UIMM5), 0 } },
978     & ifmt_slt3i, { 0x6006 }
979   },
980 /* sll3 \$0,$rn,$uimm5 */
981   {
982     { 0, 0, 0, 0 },
983     { { MNEM, ' ', '$', '0', ',', OP (RN), ',', OP (UIMM5), 0 } },
984     & ifmt_slt3i, { 0x6007 }
985   },
986 /* fsft $rn,$rm */
987   {
988     { 0, 0, 0, 0 },
989     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
990     & ifmt_mov, { 0x200f }
991   },
992 /* bra $pcrel12a2 */
993   {
994     { 0, 0, 0, 0 },
995     { { MNEM, ' ', OP (PCREL12A2), 0 } },
996     & ifmt_bra, { 0xb000 }
997   },
998 /* beqz $rn,$pcrel8a2 */
999   {
1000     { 0, 0, 0, 0 },
1001     { { MNEM, ' ', OP (RN), ',', OP (PCREL8A2), 0 } },
1002     & ifmt_beqz, { 0xa000 }
1003   },
1004 /* bnez $rn,$pcrel8a2 */
1005   {
1006     { 0, 0, 0, 0 },
1007     { { MNEM, ' ', OP (RN), ',', OP (PCREL8A2), 0 } },
1008     & ifmt_beqz, { 0xa001 }
1009   },
1010 /* beqi $rn,$uimm4,$pcrel17a2 */
1011   {
1012     { 0, 0, 0, 0 },
1013     { { MNEM, ' ', OP (RN), ',', OP (UIMM4), ',', OP (PCREL17A2), 0 } },
1014     & ifmt_beqi, { 0xe0000000 }
1015   },
1016 /* bnei $rn,$uimm4,$pcrel17a2 */
1017   {
1018     { 0, 0, 0, 0 },
1019     { { MNEM, ' ', OP (RN), ',', OP (UIMM4), ',', OP (PCREL17A2), 0 } },
1020     & ifmt_beqi, { 0xe0040000 }
1021   },
1022 /* blti $rn,$uimm4,$pcrel17a2 */
1023   {
1024     { 0, 0, 0, 0 },
1025     { { MNEM, ' ', OP (RN), ',', OP (UIMM4), ',', OP (PCREL17A2), 0 } },
1026     & ifmt_beqi, { 0xe00c0000 }
1027   },
1028 /* bgei $rn,$uimm4,$pcrel17a2 */
1029   {
1030     { 0, 0, 0, 0 },
1031     { { MNEM, ' ', OP (RN), ',', OP (UIMM4), ',', OP (PCREL17A2), 0 } },
1032     & ifmt_beqi, { 0xe0080000 }
1033   },
1034 /* beq $rn,$rm,$pcrel17a2 */
1035   {
1036     { 0, 0, 0, 0 },
1037     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (PCREL17A2), 0 } },
1038     & ifmt_beq, { 0xe0010000 }
1039   },
1040 /* bne $rn,$rm,$pcrel17a2 */
1041   {
1042     { 0, 0, 0, 0 },
1043     { { MNEM, ' ', OP (RN), ',', OP (RM), ',', OP (PCREL17A2), 0 } },
1044     & ifmt_beq, { 0xe0050000 }
1045   },
1046 /* bsr $pcrel12a2 */
1047   {
1048     { 0, 0, 0, 0 },
1049     { { MNEM, ' ', OP (PCREL12A2), 0 } },
1050     & ifmt_bra, { 0xb001 }
1051   },
1052 /* bsr $pcrel24a2 */
1053   {
1054     { 0, 0, 0, 0 },
1055     { { MNEM, ' ', OP (PCREL24A2), 0 } },
1056     & ifmt_bsr24, { 0xd8090000 }
1057   },
1058 /* jmp $rm */
1059   {
1060     { 0, 0, 0, 0 },
1061     { { MNEM, ' ', OP (RM), 0 } },
1062     & ifmt_jmp, { 0x100e }
1063   },
1064 /* jmp $pcabs24a2 */
1065   {
1066     { 0, 0, 0, 0 },
1067     { { MNEM, ' ', OP (PCABS24A2), 0 } },
1068     & ifmt_jmp24, { 0xd8080000 }
1069   },
1070 /* jsr $rm */
1071   {
1072     { 0, 0, 0, 0 },
1073     { { MNEM, ' ', OP (RM), 0 } },
1074     & ifmt_jmp, { 0x100f }
1075   },
1076 /* ret */
1077   {
1078     { 0, 0, 0, 0 },
1079     { { MNEM, 0 } },
1080     & ifmt_ret, { 0x7002 }
1081   },
1082 /* repeat $rn,$pcrel17a2 */
1083   {
1084     { 0, 0, 0, 0 },
1085     { { MNEM, ' ', OP (RN), ',', OP (PCREL17A2), 0 } },
1086     & ifmt_repeat, { 0xe0090000 }
1087   },
1088 /* erepeat $pcrel17a2 */
1089   {
1090     { 0, 0, 0, 0 },
1091     { { MNEM, ' ', OP (PCREL17A2), 0 } },
1092     & ifmt_erepeat, { 0xe0190000 }
1093   },
1094 /* stc $rn,\$lp */
1095   {
1096     { 0, 0, 0, 0 },
1097     { { MNEM, ' ', OP (RN), ',', '$', 'l', 'p', 0 } },
1098     & ifmt_stc_lp, { 0x7018 }
1099   },
1100 /* stc $rn,\$hi */
1101   {
1102     { 0, 0, 0, 0 },
1103     { { MNEM, ' ', OP (RN), ',', '$', 'h', 'i', 0 } },
1104     & ifmt_stc_lp, { 0x7078 }
1105   },
1106 /* stc $rn,\$lo */
1107   {
1108     { 0, 0, 0, 0 },
1109     { { MNEM, ' ', OP (RN), ',', '$', 'l', 'o', 0 } },
1110     & ifmt_stc_lp, { 0x7088 }
1111   },
1112 /* stc $rn,$csrn */
1113   {
1114     { 0, 0, 0, 0 },
1115     { { MNEM, ' ', OP (RN), ',', OP (CSRN), 0 } },
1116     & ifmt_stc, { 0x7008 }
1117   },
1118 /* ldc $rn,\$lp */
1119   {
1120     { 0, 0, 0, 0 },
1121     { { MNEM, ' ', OP (RN), ',', '$', 'l', 'p', 0 } },
1122     & ifmt_stc_lp, { 0x701a }
1123   },
1124 /* ldc $rn,\$hi */
1125   {
1126     { 0, 0, 0, 0 },
1127     { { MNEM, ' ', OP (RN), ',', '$', 'h', 'i', 0 } },
1128     & ifmt_stc_lp, { 0x707a }
1129   },
1130 /* ldc $rn,\$lo */
1131   {
1132     { 0, 0, 0, 0 },
1133     { { MNEM, ' ', OP (RN), ',', '$', 'l', 'o', 0 } },
1134     & ifmt_stc_lp, { 0x708a }
1135   },
1136 /* ldc $rn,$csrn */
1137   {
1138     { 0, 0, 0, 0 },
1139     { { MNEM, ' ', OP (RN), ',', OP (CSRN), 0 } },
1140     & ifmt_stc, { 0x700a }
1141   },
1142 /* di */
1143   {
1144     { 0, 0, 0, 0 },
1145     { { MNEM, 0 } },
1146     & ifmt_ret, { 0x7000 }
1147   },
1148 /* ei */
1149   {
1150     { 0, 0, 0, 0 },
1151     { { MNEM, 0 } },
1152     & ifmt_ret, { 0x7010 }
1153   },
1154 /* reti */
1155   {
1156     { 0, 0, 0, 0 },
1157     { { MNEM, 0 } },
1158     & ifmt_ret, { 0x7012 }
1159   },
1160 /* halt */
1161   {
1162     { 0, 0, 0, 0 },
1163     { { MNEM, 0 } },
1164     & ifmt_ret, { 0x7022 }
1165   },
1166 /* sleep */
1167   {
1168     { 0, 0, 0, 0 },
1169     { { MNEM, 0 } },
1170     & ifmt_ret, { 0x7062 }
1171   },
1172 /* swi $uimm2 */
1173   {
1174     { 0, 0, 0, 0 },
1175     { { MNEM, ' ', OP (UIMM2), 0 } },
1176     & ifmt_swi, { 0x7006 }
1177   },
1178 /* break */
1179   {
1180     { 0, 0, 0, 0 },
1181     { { MNEM, 0 } },
1182     & ifmt_ret, { 0x7032 }
1183   },
1184 /* syncm */
1185   {
1186     { 0, 0, 0, 0 },
1187     { { MNEM, 0 } },
1188     & ifmt_ret, { 0x7011 }
1189   },
1190 /* stcb $rn,$uimm16 */
1191   {
1192     { 0, 0, 0, 0 },
1193     { { MNEM, ' ', OP (RN), ',', OP (UIMM16), 0 } },
1194     & ifmt_movu16, { 0xf0040000 }
1195   },
1196 /* ldcb $rn,$uimm16 */
1197   {
1198     { 0, 0, 0, 0 },
1199     { { MNEM, ' ', OP (RN), ',', OP (UIMM16), 0 } },
1200     & ifmt_movu16, { 0xf0140000 }
1201   },
1202 /* bsetm ($rma),$uimm3 */
1203   {
1204     { 0, 0, 0, 0 },
1205     { { MNEM, ' ', '(', OP (RMA), ')', ',', OP (UIMM3), 0 } },
1206     & ifmt_bsetm, { 0x2000 }
1207   },
1208 /* bclrm ($rma),$uimm3 */
1209   {
1210     { 0, 0, 0, 0 },
1211     { { MNEM, ' ', '(', OP (RMA), ')', ',', OP (UIMM3), 0 } },
1212     & ifmt_bsetm, { 0x2001 }
1213   },
1214 /* bnotm ($rma),$uimm3 */
1215   {
1216     { 0, 0, 0, 0 },
1217     { { MNEM, ' ', '(', OP (RMA), ')', ',', OP (UIMM3), 0 } },
1218     & ifmt_bsetm, { 0x2002 }
1219   },
1220 /* btstm \$0,($rma),$uimm3 */
1221   {
1222     { 0, 0, 0, 0 },
1223     { { MNEM, ' ', '$', '0', ',', '(', OP (RMA), ')', ',', OP (UIMM3), 0 } },
1224     & ifmt_bsetm, { 0x2003 }
1225   },
1226 /* tas $rn,($rma) */
1227   {
1228     { 0, 0, 0, 0 },
1229     { { MNEM, ' ', OP (RN), ',', '(', OP (RMA), ')', 0 } },
1230     & ifmt_stcb_r, { 0x2004 }
1231   },
1232 /* cache $cimm4,($rma) */
1233   {
1234     { 0, 0, 0, 0 },
1235     { { MNEM, ' ', OP (CIMM4), ',', '(', OP (RMA), ')', 0 } },
1236     & ifmt_pref, { 0x7004 }
1237   },
1238 /* mul $rn,$rm */
1239   {
1240     { 0, 0, 0, 0 },
1241     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1242     & ifmt_mov, { 0x1004 }
1243   },
1244 /* mulu $rn,$rm */
1245   {
1246     { 0, 0, 0, 0 },
1247     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1248     & ifmt_mov, { 0x1005 }
1249   },
1250 /* mulr $rn,$rm */
1251   {
1252     { 0, 0, 0, 0 },
1253     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1254     & ifmt_mov, { 0x1006 }
1255   },
1256 /* mulru $rn,$rm */
1257   {
1258     { 0, 0, 0, 0 },
1259     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1260     & ifmt_mov, { 0x1007 }
1261   },
1262 /* madd $rn,$rm */
1263   {
1264     { 0, 0, 0, 0 },
1265     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1266     & ifmt_madd, { 0xf0013004 }
1267   },
1268 /* maddu $rn,$rm */
1269   {
1270     { 0, 0, 0, 0 },
1271     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1272     & ifmt_madd, { 0xf0013005 }
1273   },
1274 /* maddr $rn,$rm */
1275   {
1276     { 0, 0, 0, 0 },
1277     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1278     & ifmt_madd, { 0xf0013006 }
1279   },
1280 /* maddru $rn,$rm */
1281   {
1282     { 0, 0, 0, 0 },
1283     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1284     & ifmt_madd, { 0xf0013007 }
1285   },
1286 /* div $rn,$rm */
1287   {
1288     { 0, 0, 0, 0 },
1289     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1290     & ifmt_mov, { 0x1008 }
1291   },
1292 /* divu $rn,$rm */
1293   {
1294     { 0, 0, 0, 0 },
1295     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1296     & ifmt_mov, { 0x1009 }
1297   },
1298 /* dret */
1299   {
1300     { 0, 0, 0, 0 },
1301     { { MNEM, 0 } },
1302     & ifmt_ret, { 0x7013 }
1303   },
1304 /* dbreak */
1305   {
1306     { 0, 0, 0, 0 },
1307     { { MNEM, 0 } },
1308     & ifmt_ret, { 0x7033 }
1309   },
1310 /* ldz $rn,$rm */
1311   {
1312     { 0, 0, 0, 0 },
1313     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1314     & ifmt_madd, { 0xf0010000 }
1315   },
1316 /* abs $rn,$rm */
1317   {
1318     { 0, 0, 0, 0 },
1319     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1320     & ifmt_madd, { 0xf0010003 }
1321   },
1322 /* ave $rn,$rm */
1323   {
1324     { 0, 0, 0, 0 },
1325     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1326     & ifmt_madd, { 0xf0010002 }
1327   },
1328 /* min $rn,$rm */
1329   {
1330     { 0, 0, 0, 0 },
1331     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1332     & ifmt_madd, { 0xf0010004 }
1333   },
1334 /* max $rn,$rm */
1335   {
1336     { 0, 0, 0, 0 },
1337     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1338     & ifmt_madd, { 0xf0010005 }
1339   },
1340 /* minu $rn,$rm */
1341   {
1342     { 0, 0, 0, 0 },
1343     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1344     & ifmt_madd, { 0xf0010006 }
1345   },
1346 /* maxu $rn,$rm */
1347   {
1348     { 0, 0, 0, 0 },
1349     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1350     & ifmt_madd, { 0xf0010007 }
1351   },
1352 /* clip $rn,$cimm5 */
1353   {
1354     { 0, 0, 0, 0 },
1355     { { MNEM, ' ', OP (RN), ',', OP (CIMM5), 0 } },
1356     & ifmt_clip, { 0xf0011000 }
1357   },
1358 /* clipu $rn,$cimm5 */
1359   {
1360     { 0, 0, 0, 0 },
1361     { { MNEM, ' ', OP (RN), ',', OP (CIMM5), 0 } },
1362     & ifmt_clip, { 0xf0011001 }
1363   },
1364 /* sadd $rn,$rm */
1365   {
1366     { 0, 0, 0, 0 },
1367     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1368     & ifmt_madd, { 0xf0010008 }
1369   },
1370 /* ssub $rn,$rm */
1371   {
1372     { 0, 0, 0, 0 },
1373     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1374     & ifmt_madd, { 0xf001000a }
1375   },
1376 /* saddu $rn,$rm */
1377   {
1378     { 0, 0, 0, 0 },
1379     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1380     & ifmt_madd, { 0xf0010009 }
1381   },
1382 /* ssubu $rn,$rm */
1383   {
1384     { 0, 0, 0, 0 },
1385     { { MNEM, ' ', OP (RN), ',', OP (RM), 0 } },
1386     & ifmt_madd, { 0xf001000b }
1387   },
1388 /* swcp $crn,($rma) */
1389   {
1390     { 0, 0, 0, 0 },
1391     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), ')', 0 } },
1392     & ifmt_swcp, { 0x3008 }
1393   },
1394 /* lwcp $crn,($rma) */
1395   {
1396     { 0, 0, 0, 0 },
1397     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), ')', 0 } },
1398     & ifmt_swcp, { 0x3009 }
1399   },
1400 /* smcp $crn64,($rma) */
1401   {
1402     { 0, 0, 0, 0 },
1403     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), ')', 0 } },
1404     & ifmt_smcp, { 0x300a }
1405   },
1406 /* lmcp $crn64,($rma) */
1407   {
1408     { 0, 0, 0, 0 },
1409     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), ')', 0 } },
1410     & ifmt_smcp, { 0x300b }
1411   },
1412 /* swcpi $crn,($rma+) */
1413   {
1414     { 0, 0, 0, 0 },
1415     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', 0 } },
1416     & ifmt_swcp, { 0x3000 }
1417   },
1418 /* lwcpi $crn,($rma+) */
1419   {
1420     { 0, 0, 0, 0 },
1421     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', 0 } },
1422     & ifmt_swcp, { 0x3001 }
1423   },
1424 /* smcpi $crn64,($rma+) */
1425   {
1426     { 0, 0, 0, 0 },
1427     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', 0 } },
1428     & ifmt_smcp, { 0x3002 }
1429   },
1430 /* lmcpi $crn64,($rma+) */
1431   {
1432     { 0, 0, 0, 0 },
1433     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', 0 } },
1434     & ifmt_smcp, { 0x3003 }
1435   },
1436 /* swcp $crn,$sdisp16($rma) */
1437   {
1438     { 0, 0, 0, 0 },
1439     { { MNEM, ' ', OP (CRN), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
1440     & ifmt_swcp16, { 0xf00c0000 }
1441   },
1442 /* lwcp $crn,$sdisp16($rma) */
1443   {
1444     { 0, 0, 0, 0 },
1445     { { MNEM, ' ', OP (CRN), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
1446     & ifmt_swcp16, { 0xf00d0000 }
1447   },
1448 /* smcp $crn64,$sdisp16($rma) */
1449   {
1450     { 0, 0, 0, 0 },
1451     { { MNEM, ' ', OP (CRN64), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
1452     & ifmt_smcp16, { 0xf00e0000 }
1453   },
1454 /* lmcp $crn64,$sdisp16($rma) */
1455   {
1456     { 0, 0, 0, 0 },
1457     { { MNEM, ' ', OP (CRN64), ',', OP (SDISP16), '(', OP (RMA), ')', 0 } },
1458     & ifmt_smcp16, { 0xf00f0000 }
1459   },
1460 /* sbcpa $crn,($rma+),$cdisp10 */
1461   {
1462     { 0, 0, 0, 0 },
1463     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
1464     & ifmt_lbucpa, { 0xf0050000 }
1465   },
1466 /* lbcpa $crn,($rma+),$cdisp10 */
1467   {
1468     { 0, 0, 0, 0 },
1469     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
1470     & ifmt_lbucpa, { 0xf0054000 }
1471   },
1472 /* shcpa $crn,($rma+),$cdisp10a2 */
1473   {
1474     { 0, 0, 0, 0 },
1475     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
1476     & ifmt_lhucpa, { 0xf0051000 }
1477   },
1478 /* lhcpa $crn,($rma+),$cdisp10a2 */
1479   {
1480     { 0, 0, 0, 0 },
1481     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
1482     & ifmt_lhucpa, { 0xf0055000 }
1483   },
1484 /* swcpa $crn,($rma+),$cdisp10a4 */
1485   {
1486     { 0, 0, 0, 0 },
1487     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A4), 0 } },
1488     & ifmt_swcpa, { 0xf0052000 }
1489   },
1490 /* lwcpa $crn,($rma+),$cdisp10a4 */
1491   {
1492     { 0, 0, 0, 0 },
1493     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A4), 0 } },
1494     & ifmt_swcpa, { 0xf0056000 }
1495   },
1496 /* smcpa $crn64,($rma+),$cdisp10a8 */
1497   {
1498     { 0, 0, 0, 0 },
1499     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A8), 0 } },
1500     & ifmt_smcpa, { 0xf0053000 }
1501   },
1502 /* lmcpa $crn64,($rma+),$cdisp10a8 */
1503   {
1504     { 0, 0, 0, 0 },
1505     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A8), 0 } },
1506     & ifmt_smcpa, { 0xf0057000 }
1507   },
1508 /* sbcpm0 $crn,($rma+),$cdisp10 */
1509   {
1510     { 0, 0, 0, 0 },
1511     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
1512     & ifmt_lbucpa, { 0xf0050800 }
1513   },
1514 /* lbcpm0 $crn,($rma+),$cdisp10 */
1515   {
1516     { 0, 0, 0, 0 },
1517     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
1518     & ifmt_lbucpa, { 0xf0054800 }
1519   },
1520 /* shcpm0 $crn,($rma+),$cdisp10a2 */
1521   {
1522     { 0, 0, 0, 0 },
1523     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
1524     & ifmt_lhucpa, { 0xf0051800 }
1525   },
1526 /* lhcpm0 $crn,($rma+),$cdisp10a2 */
1527   {
1528     { 0, 0, 0, 0 },
1529     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
1530     & ifmt_lhucpa, { 0xf0055800 }
1531   },
1532 /* swcpm0 $crn,($rma+),$cdisp10a4 */
1533   {
1534     { 0, 0, 0, 0 },
1535     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A4), 0 } },
1536     & ifmt_swcpa, { 0xf0052800 }
1537   },
1538 /* lwcpm0 $crn,($rma+),$cdisp10a4 */
1539   {
1540     { 0, 0, 0, 0 },
1541     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A4), 0 } },
1542     & ifmt_swcpa, { 0xf0056800 }
1543   },
1544 /* smcpm0 $crn64,($rma+),$cdisp10a8 */
1545   {
1546     { 0, 0, 0, 0 },
1547     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A8), 0 } },
1548     & ifmt_smcpa, { 0xf0053800 }
1549   },
1550 /* lmcpm0 $crn64,($rma+),$cdisp10a8 */
1551   {
1552     { 0, 0, 0, 0 },
1553     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A8), 0 } },
1554     & ifmt_smcpa, { 0xf0057800 }
1555   },
1556 /* sbcpm1 $crn,($rma+),$cdisp10 */
1557   {
1558     { 0, 0, 0, 0 },
1559     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
1560     & ifmt_lbucpa, { 0xf0050c00 }
1561   },
1562 /* lbcpm1 $crn,($rma+),$cdisp10 */
1563   {
1564     { 0, 0, 0, 0 },
1565     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10), 0 } },
1566     & ifmt_lbucpa, { 0xf0054c00 }
1567   },
1568 /* shcpm1 $crn,($rma+),$cdisp10a2 */
1569   {
1570     { 0, 0, 0, 0 },
1571     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
1572     & ifmt_lhucpa, { 0xf0051c00 }
1573   },
1574 /* lhcpm1 $crn,($rma+),$cdisp10a2 */
1575   {
1576     { 0, 0, 0, 0 },
1577     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A2), 0 } },
1578     & ifmt_lhucpa, { 0xf0055c00 }
1579   },
1580 /* swcpm1 $crn,($rma+),$cdisp10a4 */
1581   {
1582     { 0, 0, 0, 0 },
1583     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A4), 0 } },
1584     & ifmt_swcpa, { 0xf0052c00 }
1585   },
1586 /* lwcpm1 $crn,($rma+),$cdisp10a4 */
1587   {
1588     { 0, 0, 0, 0 },
1589     { { MNEM, ' ', OP (CRN), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A4), 0 } },
1590     & ifmt_swcpa, { 0xf0056c00 }
1591   },
1592 /* smcpm1 $crn64,($rma+),$cdisp10a8 */
1593   {
1594     { 0, 0, 0, 0 },
1595     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A8), 0 } },
1596     & ifmt_smcpa, { 0xf0053c00 }
1597   },
1598 /* lmcpm1 $crn64,($rma+),$cdisp10a8 */
1599   {
1600     { 0, 0, 0, 0 },
1601     { { MNEM, ' ', OP (CRN64), ',', '(', OP (RMA), '+', ')', ',', OP (CDISP10A8), 0 } },
1602     & ifmt_smcpa, { 0xf0057c00 }
1603   },
1604 /* bcpeq $cccc,$pcrel17a2 */
1605   {
1606     { 0, 0, 0, 0 },
1607     { { MNEM, ' ', OP (CCCC), ',', OP (PCREL17A2), 0 } },
1608     & ifmt_bcpeq, { 0xd8040000 }
1609   },
1610 /* bcpne $cccc,$pcrel17a2 */
1611   {
1612     { 0, 0, 0, 0 },
1613     { { MNEM, ' ', OP (CCCC), ',', OP (PCREL17A2), 0 } },
1614     & ifmt_bcpeq, { 0xd8050000 }
1615   },
1616 /* bcpat $cccc,$pcrel17a2 */
1617   {
1618     { 0, 0, 0, 0 },
1619     { { MNEM, ' ', OP (CCCC), ',', OP (PCREL17A2), 0 } },
1620     & ifmt_bcpeq, { 0xd8060000 }
1621   },
1622 /* bcpaf $cccc,$pcrel17a2 */
1623   {
1624     { 0, 0, 0, 0 },
1625     { { MNEM, ' ', OP (CCCC), ',', OP (PCREL17A2), 0 } },
1626     & ifmt_bcpeq, { 0xd8070000 }
1627   },
1628 /* synccp */
1629   {
1630     { 0, 0, 0, 0 },
1631     { { MNEM, 0 } },
1632     & ifmt_ret, { 0x7021 }
1633   },
1634 /* jsrv $rm */
1635   {
1636     { 0, 0, 0, 0 },
1637     { { MNEM, ' ', OP (RM), 0 } },
1638     & ifmt_jmp, { 0x180f }
1639   },
1640 /* bsrv $pcrel24a2 */
1641   {
1642     { 0, 0, 0, 0 },
1643     { { MNEM, ' ', OP (PCREL24A2), 0 } },
1644     & ifmt_bsr24, { 0xd80b0000 }
1645   },
1646 /* --unused-- */
1647   {
1648     { 0, 0, 0, 0 },
1649     { { MNEM, 0 } },
1650     & ifmt_sim_syscall, { 0x7800 }
1651   },
1652 /* --reserved-- */
1653   {
1654     { 0, 0, 0, 0 },
1655     { { MNEM, 0 } },
1656     & ifmt_mov, { 0x6 }
1657   },
1658 /* --reserved-- */
1659   {
1660     { 0, 0, 0, 0 },
1661     { { MNEM, 0 } },
1662     & ifmt_mov, { 0x100a }
1663   },
1664 /* --reserved-- */
1665   {
1666     { 0, 0, 0, 0 },
1667     { { MNEM, 0 } },
1668     & ifmt_mov, { 0x100b }
1669   },
1670 /* --reserved-- */
1671   {
1672     { 0, 0, 0, 0 },
1673     { { MNEM, 0 } },
1674     & ifmt_mov, { 0x2005 }
1675   },
1676 /* --reserved-- */
1677   {
1678     { 0, 0, 0, 0 },
1679     { { MNEM, 0 } },
1680     & ifmt_mov, { 0x2008 }
1681   },
1682 /* --reserved-- */
1683   {
1684     { 0, 0, 0, 0 },
1685     { { MNEM, 0 } },
1686     & ifmt_mov, { 0x2009 }
1687   },
1688 /* --reserved-- */
1689   {
1690     { 0, 0, 0, 0 },
1691     { { MNEM, 0 } },
1692     & ifmt_mov, { 0x200a }
1693   },
1694 /* --reserved-- */
1695   {
1696     { 0, 0, 0, 0 },
1697     { { MNEM, 0 } },
1698     & ifmt_mov, { 0x200b }
1699   },
1700 /* --reserved-- */
1701   {
1702     { 0, 0, 0, 0 },
1703     { { MNEM, 0 } },
1704     & ifmt_mov, { 0x3004 }
1705   },
1706 /* --reserved-- */
1707   {
1708     { 0, 0, 0, 0 },
1709     { { MNEM, 0 } },
1710     & ifmt_mov, { 0x3005 }
1711   },
1712 /* --reserved-- */
1713   {
1714     { 0, 0, 0, 0 },
1715     { { MNEM, 0 } },
1716     & ifmt_mov, { 0x3006 }
1717   },
1718 /* --reserved-- */
1719   {
1720     { 0, 0, 0, 0 },
1721     { { MNEM, 0 } },
1722     & ifmt_mov, { 0x3007 }
1723   },
1724 /* --reserved-- */
1725   {
1726     { 0, 0, 0, 0 },
1727     { { MNEM, 0 } },
1728     & ifmt_mov, { 0x300c }
1729   },
1730 /* --reserved-- */
1731   {
1732     { 0, 0, 0, 0 },
1733     { { MNEM, 0 } },
1734     & ifmt_mov, { 0x300d }
1735   },
1736 /* --reserved-- */
1737   {
1738     { 0, 0, 0, 0 },
1739     { { MNEM, 0 } },
1740     & ifmt_mov, { 0x300e }
1741   },
1742 /* --reserved-- */
1743   {
1744     { 0, 0, 0, 0 },
1745     { { MNEM, 0 } },
1746     & ifmt_mov, { 0x300f }
1747   },
1748 /* --reserved-- */
1749   {
1750     { 0, 0, 0, 0 },
1751     { { MNEM, 0 } },
1752     & ifmt_mov, { 0x7007 }
1753   },
1754 /* --reserved-- */
1755   {
1756     { 0, 0, 0, 0 },
1757     { { MNEM, 0 } },
1758     & ifmt_mov, { 0x700e }
1759   },
1760 /* --reserved-- */
1761   {
1762     { 0, 0, 0, 0 },
1763     { { MNEM, 0 } },
1764     & ifmt_mov, { 0x700f }
1765   },
1766 /* --reserved-- */
1767   {
1768     { 0, 0, 0, 0 },
1769     { { MNEM, 0 } },
1770     & ifmt_mov, { 0xc007 }
1771   },
1772 /* --reserved-- */
1773   {
1774     { 0, 0, 0, 0 },
1775     { { MNEM, 0 } },
1776     & ifmt_mov, { 0xe00d }
1777   },
1778 /* --reserved-- */
1779   {
1780     { 0, 0, 0, 0 },
1781     { { MNEM, 0 } },
1782     & ifmt_mov, { 0xf008 }
1783   },
1784 };
1785
1786 #undef A
1787 #undef OPERAND
1788 #undef MNEM
1789 #undef OP
1790
1791 /* Formats for ALIAS macro-insns.  */
1792
1793 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1794 #define F(f) & mep_cgen_ifld_table[MEP_##f]
1795 #else
1796 #define F(f) & mep_cgen_ifld_table[MEP_/**/f]
1797 #endif
1798 static const CGEN_IFMT ifmt_dsp0 ATTRIBUTE_UNUSED = {
1799   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16U16) }, { 0 } }
1800 };
1801
1802 static const CGEN_IFMT ifmt_dsp1 ATTRIBUTE_UNUSED = {
1803   32, 32, 0xf00f0000, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { F (F_16U16) }, { 0 } }
1804 };
1805
1806 static const CGEN_IFMT ifmt_nop ATTRIBUTE_UNUSED = {
1807   16, 16, 0xffff, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1808 };
1809
1810 static const CGEN_IFMT ifmt_sb16_0 ATTRIBUTE_UNUSED = {
1811   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1812 };
1813
1814 static const CGEN_IFMT ifmt_sh16_0 ATTRIBUTE_UNUSED = {
1815   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1816 };
1817
1818 static const CGEN_IFMT ifmt_sw16_0 ATTRIBUTE_UNUSED = {
1819   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1820 };
1821
1822 static const CGEN_IFMT ifmt_lb16_0 ATTRIBUTE_UNUSED = {
1823   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1824 };
1825
1826 static const CGEN_IFMT ifmt_lh16_0 ATTRIBUTE_UNUSED = {
1827   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1828 };
1829
1830 static const CGEN_IFMT ifmt_lw16_0 ATTRIBUTE_UNUSED = {
1831   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1832 };
1833
1834 static const CGEN_IFMT ifmt_lbu16_0 ATTRIBUTE_UNUSED = {
1835   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1836 };
1837
1838 static const CGEN_IFMT ifmt_lhu16_0 ATTRIBUTE_UNUSED = {
1839   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_RN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1840 };
1841
1842 static const CGEN_IFMT ifmt_swcp16_0 ATTRIBUTE_UNUSED = {
1843   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1844 };
1845
1846 static const CGEN_IFMT ifmt_lwcp16_0 ATTRIBUTE_UNUSED = {
1847   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1848 };
1849
1850 static const CGEN_IFMT ifmt_smcp16_0 ATTRIBUTE_UNUSED = {
1851   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1852 };
1853
1854 static const CGEN_IFMT ifmt_lmcp16_0 ATTRIBUTE_UNUSED = {
1855   16, 16, 0xf00f, { { F (F_MAJOR) }, { F (F_CRN) }, { F (F_RM) }, { F (F_SUB4) }, { 0 } }
1856 };
1857
1858 #undef F
1859
1860 /* Each non-simple macro entry points to an array of expansion possibilities.  */
1861
1862 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1863 #define A(a) (1 << CGEN_INSN_##a)
1864 #else
1865 #define A(a) (1 << CGEN_INSN_/**/a)
1866 #endif
1867 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1868 #define OPERAND(op) MEP_OPERAND_##op
1869 #else
1870 #define OPERAND(op) MEP_OPERAND_/**/op
1871 #endif
1872 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
1873 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
1874
1875 /* The macro instruction table.  */
1876
1877 static const CGEN_IBASE mep_cgen_macro_insn_table[] =
1878 {
1879 /* dsp0 $c5rnmuimm24 */
1880   {
1881     -1, "dsp0", "dsp0", 32,
1882     { 0|A(VOLATILE)|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_C5), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1883   },
1884 /* dsp1 $rn,$c5rmuimm20 */
1885   {
1886     -1, "dsp1", "dsp1", 32,
1887     { 0|A(VOLATILE)|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_C5), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1888   },
1889 /* nop */
1890   {
1891     -1, "nop", "nop", 16,
1892     { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\x80" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1893   },
1894 /* sb $rnc,$zero($rma) */
1895   {
1896     -1, "sb16-0", "sb", 16,
1897     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1898   },
1899 /* sh $rns,$zero($rma) */
1900   {
1901     -1, "sh16-0", "sh", 16,
1902     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1903   },
1904 /* sw $rnl,$zero($rma) */
1905   {
1906     -1, "sw16-0", "sw", 16,
1907     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1908   },
1909 /* lb $rnc,$zero($rma) */
1910   {
1911     -1, "lb16-0", "lb", 16,
1912     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1913   },
1914 /* lh $rns,$zero($rma) */
1915   {
1916     -1, "lh16-0", "lh", 16,
1917     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1918   },
1919 /* lw $rnl,$zero($rma) */
1920   {
1921     -1, "lw16-0", "lw", 16,
1922     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1923   },
1924 /* lbu $rnuc,$zero($rma) */
1925   {
1926     -1, "lbu16-0", "lbu", 16,
1927     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1928   },
1929 /* lhu $rnus,$zero($rma) */
1930   {
1931     -1, "lhu16-0", "lhu", 16,
1932     { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1933   },
1934 /* swcp $crn,$zero($rma) */
1935   {
1936     -1, "swcp16-0", "swcp", 16,
1937     { 0|A(NO_DIS)|A(OPTIONAL_CP_INSN)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1938   },
1939 /* lwcp $crn,$zero($rma) */
1940   {
1941     -1, "lwcp16-0", "lwcp", 16,
1942     { 0|A(NO_DIS)|A(OPTIONAL_CP_INSN)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1943   },
1944 /* smcp $crn64,$zero($rma) */
1945   {
1946     -1, "smcp16-0", "smcp", 16,
1947     { 0|A(NO_DIS)|A(OPTIONAL_CP64_INSN)|A(OPTIONAL_CP_INSN)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1948   },
1949 /* lmcp $crn64,$zero($rma) */
1950   {
1951     -1, "lmcp16-0", "lmcp", 16,
1952     { 0|A(NO_DIS)|A(OPTIONAL_CP64_INSN)|A(OPTIONAL_CP_INSN)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xc0" } }, { { 0, 0 } }, { { CONFIG_NONE, 0 } } } }
1953   },
1954 };
1955
1956 /* The macro instruction opcode table.  */
1957
1958 static const CGEN_OPCODE mep_cgen_macro_insn_opcode_table[] =
1959 {
1960 /* dsp0 $c5rnmuimm24 */
1961   {
1962     { 0, 0, 0, 0 },
1963     { { MNEM, ' ', OP (C5RNMUIMM24), 0 } },
1964     & ifmt_dsp0, { 0xf0000000 }
1965   },
1966 /* dsp1 $rn,$c5rmuimm20 */
1967   {
1968     { 0, 0, 0, 0 },
1969     { { MNEM, ' ', OP (RN), ',', OP (C5RMUIMM20), 0 } },
1970     & ifmt_dsp1, { 0xf0000000 }
1971   },
1972 /* nop */
1973   {
1974     { 0, 0, 0, 0 },
1975     { { MNEM, 0 } },
1976     & ifmt_nop, { 0x0 }
1977   },
1978 /* sb $rnc,$zero($rma) */
1979   {
1980     { 0, 0, 0, 0 },
1981     { { MNEM, ' ', OP (RNC), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
1982     & ifmt_sb16_0, { 0x8 }
1983   },
1984 /* sh $rns,$zero($rma) */
1985   {
1986     { 0, 0, 0, 0 },
1987     { { MNEM, ' ', OP (RNS), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
1988     & ifmt_sh16_0, { 0x9 }
1989   },
1990 /* sw $rnl,$zero($rma) */
1991   {
1992     { 0, 0, 0, 0 },
1993     { { MNEM, ' ', OP (RNL), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
1994     & ifmt_sw16_0, { 0xa }
1995   },
1996 /* lb $rnc,$zero($rma) */
1997   {
1998     { 0, 0, 0, 0 },
1999     { { MNEM, ' ', OP (RNC), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2000     & ifmt_lb16_0, { 0xc }
2001   },
2002 /* lh $rns,$zero($rma) */
2003   {
2004     { 0, 0, 0, 0 },
2005     { { MNEM, ' ', OP (RNS), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2006     & ifmt_lh16_0, { 0xd }
2007   },
2008 /* lw $rnl,$zero($rma) */
2009   {
2010     { 0, 0, 0, 0 },
2011     { { MNEM, ' ', OP (RNL), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2012     & ifmt_lw16_0, { 0xe }
2013   },
2014 /* lbu $rnuc,$zero($rma) */
2015   {
2016     { 0, 0, 0, 0 },
2017     { { MNEM, ' ', OP (RNUC), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2018     & ifmt_lbu16_0, { 0xb }
2019   },
2020 /* lhu $rnus,$zero($rma) */
2021   {
2022     { 0, 0, 0, 0 },
2023     { { MNEM, ' ', OP (RNUS), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2024     & ifmt_lhu16_0, { 0xf }
2025   },
2026 /* swcp $crn,$zero($rma) */
2027   {
2028     { 0, 0, 0, 0 },
2029     { { MNEM, ' ', OP (CRN), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2030     & ifmt_swcp16_0, { 0x3008 }
2031   },
2032 /* lwcp $crn,$zero($rma) */
2033   {
2034     { 0, 0, 0, 0 },
2035     { { MNEM, ' ', OP (CRN), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2036     & ifmt_lwcp16_0, { 0x3009 }
2037   },
2038 /* smcp $crn64,$zero($rma) */
2039   {
2040     { 0, 0, 0, 0 },
2041     { { MNEM, ' ', OP (CRN64), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2042     & ifmt_smcp16_0, { 0x300a }
2043   },
2044 /* lmcp $crn64,$zero($rma) */
2045   {
2046     { 0, 0, 0, 0 },
2047     { { MNEM, ' ', OP (CRN64), ',', OP (ZERO), '(', OP (RMA), ')', 0 } },
2048     & ifmt_lmcp16_0, { 0x300b }
2049   },
2050 };
2051
2052 #undef A
2053 #undef OPERAND
2054 #undef MNEM
2055 #undef OP
2056
2057 #ifndef CGEN_ASM_HASH_P
2058 #define CGEN_ASM_HASH_P(insn) 1
2059 #endif
2060
2061 #ifndef CGEN_DIS_HASH_P
2062 #define CGEN_DIS_HASH_P(insn) 1
2063 #endif
2064
2065 /* Return non-zero if INSN is to be added to the hash table.
2066    Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file.  */
2067
2068 static int
2069 asm_hash_insn_p (insn)
2070      const CGEN_INSN *insn ATTRIBUTE_UNUSED;
2071 {
2072   return CGEN_ASM_HASH_P (insn);
2073 }
2074
2075 static int
2076 dis_hash_insn_p (insn)
2077      const CGEN_INSN *insn;
2078 {
2079   /* If building the hash table and the NO-DIS attribute is present,
2080      ignore.  */
2081   if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
2082     return 0;
2083   return CGEN_DIS_HASH_P (insn);
2084 }
2085
2086 #ifndef CGEN_ASM_HASH
2087 #define CGEN_ASM_HASH_SIZE 127
2088 #ifdef CGEN_MNEMONIC_OPERANDS
2089 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
2090 #else
2091 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
2092 #endif
2093 #endif
2094
2095 /* It doesn't make much sense to provide a default here,
2096    but while this is under development we do.
2097    BUFFER is a pointer to the bytes of the insn, target order.
2098    VALUE is the first base_insn_bitsize bits as an int in host order.  */
2099
2100 #ifndef CGEN_DIS_HASH
2101 #define CGEN_DIS_HASH_SIZE 256
2102 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
2103 #endif
2104
2105 /* The result is the hash value of the insn.
2106    Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file.  */
2107
2108 static unsigned int
2109 asm_hash_insn (mnem)
2110      const char * mnem;
2111 {
2112   return CGEN_ASM_HASH (mnem);
2113 }
2114
2115 /* BUF is a pointer to the bytes of the insn, target order.
2116    VALUE is the first base_insn_bitsize bits as an int in host order.  */
2117
2118 static unsigned int
2119 dis_hash_insn (buf, value)
2120      const char * buf ATTRIBUTE_UNUSED;
2121      CGEN_INSN_INT value ATTRIBUTE_UNUSED;
2122 {
2123   return CGEN_DIS_HASH (buf, value);
2124 }
2125
2126 /* Set the recorded length of the insn in the CGEN_FIELDS struct.  */
2127
2128 static void
2129 set_fields_bitsize (CGEN_FIELDS *fields, int size)
2130 {
2131   CGEN_FIELDS_BITSIZE (fields) = size;
2132 }
2133
2134 /* Function to call before using the operand instance table.
2135    This plugs the opcode entries and macro instructions into the cpu table.  */
2136
2137 void
2138 mep_cgen_init_opcode_table (CGEN_CPU_DESC cd)
2139 {
2140   int i;
2141   int num_macros = (sizeof (mep_cgen_macro_insn_table) /
2142                     sizeof (mep_cgen_macro_insn_table[0]));
2143   const CGEN_IBASE *ib = & mep_cgen_macro_insn_table[0];
2144   const CGEN_OPCODE *oc = & mep_cgen_macro_insn_opcode_table[0];
2145   CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
2146
2147   /* This test has been added to avoid a warning generated
2148      if memset is called with a third argument of value zero.  */
2149   if (num_macros >= 1)
2150     memset (insns, 0, num_macros * sizeof (CGEN_INSN));
2151   for (i = 0; i < num_macros; ++i)
2152     {
2153       insns[i].base = &ib[i];
2154       insns[i].opcode = &oc[i];
2155       mep_cgen_build_insn_regex (& insns[i]);
2156     }
2157   cd->macro_insn_table.init_entries = insns;
2158   cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
2159   cd->macro_insn_table.num_init_entries = num_macros;
2160
2161   oc = & mep_cgen_insn_opcode_table[0];
2162   insns = (CGEN_INSN *) cd->insn_table.init_entries;
2163   for (i = 0; i < MAX_INSNS; ++i)
2164     {
2165       insns[i].opcode = &oc[i];
2166       mep_cgen_build_insn_regex (& insns[i]);
2167     }
2168
2169   cd->sizeof_fields = sizeof (CGEN_FIELDS);
2170   cd->set_fields_bitsize = set_fields_bitsize;
2171
2172   cd->asm_hash_p = asm_hash_insn_p;
2173   cd->asm_hash = asm_hash_insn;
2174   cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
2175
2176   cd->dis_hash_p = dis_hash_insn_p;
2177   cd->dis_hash = dis_hash_insn;
2178   cd->dis_hash_size = CGEN_DIS_HASH_SIZE;
2179 }