oops - update date in ChangeLog entry
[binutils.git] / opcodes / m32r-opc.c
blobb60c1bf36e0c51a0761f0b8327b87231c35493ec
1 /* Instruction opcode table for m32r.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
9 This program 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 2, or (at your option)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
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 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include "sysdep.h"
26 #include "ansidecl.h"
27 #include "bfd.h"
28 #include "symcat.h"
29 #include "m32r-desc.h"
30 #include "m32r-opc.h"
31 #include "libiberty.h"
33 /* The hash functions are recorded here to help keep assembler code out of
34 the disassembler and vice versa. */
36 static int asm_hash_insn_p PARAMS ((const CGEN_INSN *));
37 static unsigned int asm_hash_insn PARAMS ((const char *));
38 static int dis_hash_insn_p PARAMS ((const CGEN_INSN *));
39 static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT));
41 /* Instruction formats. */
43 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
44 #define F(f) & m32r_cgen_ifld_table[M32R_##f]
45 #else
46 #define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
47 #endif
48 static const CGEN_IFMT ifmt_empty = {
49 0, 0, 0x0, { { 0 } }
52 static const CGEN_IFMT ifmt_add = {
53 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
56 static const CGEN_IFMT ifmt_add3 = {
57 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
60 static const CGEN_IFMT ifmt_and3 = {
61 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
64 static const CGEN_IFMT ifmt_or3 = {
65 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
68 static const CGEN_IFMT ifmt_addi = {
69 16, 16, 0xf000, { { F (F_OP1) }, { F (F_R1) }, { F (F_SIMM8) }, { 0 } }
72 static const CGEN_IFMT ifmt_addv3 = {
73 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
76 static const CGEN_IFMT ifmt_bc8 = {
77 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
80 static const CGEN_IFMT ifmt_bc24 = {
81 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
84 static const CGEN_IFMT ifmt_beq = {
85 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_DISP16) }, { 0 } }
88 static const CGEN_IFMT ifmt_beqz = {
89 32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_DISP16) }, { 0 } }
92 static const CGEN_IFMT ifmt_cmp = {
93 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
96 static const CGEN_IFMT ifmt_cmpi = {
97 32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
100 static const CGEN_IFMT ifmt_cmpz = {
101 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
104 static const CGEN_IFMT ifmt_div = {
105 32, 32, 0xf0f0ffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
108 static const CGEN_IFMT ifmt_jc = {
109 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
112 static const CGEN_IFMT ifmt_ld24 = {
113 32, 32, 0xf0000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_UIMM24) }, { 0 } }
116 static const CGEN_IFMT ifmt_ldi16 = {
117 32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
120 static const CGEN_IFMT ifmt_machi_a = {
121 16, 16, 0xf070, { { F (F_OP1) }, { F (F_R1) }, { F (F_ACC) }, { F (F_OP23) }, { F (F_R2) }, { 0 } }
124 static const CGEN_IFMT ifmt_mvfachi = {
125 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
128 static const CGEN_IFMT ifmt_mvfachi_a = {
129 16, 16, 0xf0f3, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_OP3) }, { 0 } }
132 static const CGEN_IFMT ifmt_mvfc = {
133 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
136 static const CGEN_IFMT ifmt_mvtachi = {
137 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
140 static const CGEN_IFMT ifmt_mvtachi_a = {
141 16, 16, 0xf0f3, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_OP3) }, { 0 } }
144 static const CGEN_IFMT ifmt_mvtc = {
145 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
148 static const CGEN_IFMT ifmt_nop = {
149 16, 16, 0xffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
152 static const CGEN_IFMT ifmt_rac_dsi = {
153 16, 16, 0xf3f2, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
156 static const CGEN_IFMT ifmt_seth = {
157 32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_HI16) }, { 0 } }
160 static const CGEN_IFMT ifmt_slli = {
161 16, 16, 0xf0e0, { { F (F_OP1) }, { F (F_R1) }, { F (F_SHIFT_OP2) }, { F (F_UIMM5) }, { 0 } }
164 static const CGEN_IFMT ifmt_st_d = {
165 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
168 static const CGEN_IFMT ifmt_trap = {
169 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_UIMM4) }, { 0 } }
172 static const CGEN_IFMT ifmt_satb = {
173 32, 32, 0xf0f0ffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
176 #undef F
178 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
179 #define A(a) (1 << CGEN_INSN_##a)
180 #else
181 #define A(a) (1 << CGEN_INSN_/**/a)
182 #endif
183 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
184 #define OPERAND(op) M32R_OPERAND_##op
185 #else
186 #define OPERAND(op) M32R_OPERAND_/**/op
187 #endif
188 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
189 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
191 /* The instruction table. */
193 static const CGEN_OPCODE m32r_cgen_insn_opcode_table[MAX_INSNS] =
195 /* Special null first entry.
196 A `num' value of zero is thus invalid.
197 Also, the special `invalid' insn resides here. */
198 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
199 /* add $dr,$sr */
201 { 0, 0, 0, 0 },
202 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
203 & ifmt_add, { 0xa0 }
205 /* add3 $dr,$sr,$hash$slo16 */
207 { 0, 0, 0, 0 },
208 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (HASH), OP (SLO16), 0 } },
209 & ifmt_add3, { 0x80a00000 }
211 /* and $dr,$sr */
213 { 0, 0, 0, 0 },
214 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
215 & ifmt_add, { 0xc0 }
217 /* and3 $dr,$sr,$uimm16 */
219 { 0, 0, 0, 0 },
220 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (UIMM16), 0 } },
221 & ifmt_and3, { 0x80c00000 }
223 /* or $dr,$sr */
225 { 0, 0, 0, 0 },
226 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
227 & ifmt_add, { 0xe0 }
229 /* or3 $dr,$sr,$hash$ulo16 */
231 { 0, 0, 0, 0 },
232 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (HASH), OP (ULO16), 0 } },
233 & ifmt_or3, { 0x80e00000 }
235 /* xor $dr,$sr */
237 { 0, 0, 0, 0 },
238 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
239 & ifmt_add, { 0xd0 }
241 /* xor3 $dr,$sr,$uimm16 */
243 { 0, 0, 0, 0 },
244 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (UIMM16), 0 } },
245 & ifmt_and3, { 0x80d00000 }
247 /* addi $dr,$simm8 */
249 { 0, 0, 0, 0 },
250 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
251 & ifmt_addi, { 0x4000 }
253 /* addv $dr,$sr */
255 { 0, 0, 0, 0 },
256 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
257 & ifmt_add, { 0x80 }
259 /* addv3 $dr,$sr,$simm16 */
261 { 0, 0, 0, 0 },
262 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
263 & ifmt_addv3, { 0x80800000 }
265 /* addx $dr,$sr */
267 { 0, 0, 0, 0 },
268 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
269 & ifmt_add, { 0x90 }
271 /* bc.s $disp8 */
273 { 0, 0, 0, 0 },
274 { { MNEM, ' ', OP (DISP8), 0 } },
275 & ifmt_bc8, { 0x7c00 }
277 /* bc.l $disp24 */
279 { 0, 0, 0, 0 },
280 { { MNEM, ' ', OP (DISP24), 0 } },
281 & ifmt_bc24, { 0xfc000000 }
283 /* beq $src1,$src2,$disp16 */
285 { 0, 0, 0, 0 },
286 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (DISP16), 0 } },
287 & ifmt_beq, { 0xb0000000 }
289 /* beqz $src2,$disp16 */
291 { 0, 0, 0, 0 },
292 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
293 & ifmt_beqz, { 0xb0800000 }
295 /* bgez $src2,$disp16 */
297 { 0, 0, 0, 0 },
298 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
299 & ifmt_beqz, { 0xb0b00000 }
301 /* bgtz $src2,$disp16 */
303 { 0, 0, 0, 0 },
304 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
305 & ifmt_beqz, { 0xb0d00000 }
307 /* blez $src2,$disp16 */
309 { 0, 0, 0, 0 },
310 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
311 & ifmt_beqz, { 0xb0c00000 }
313 /* bltz $src2,$disp16 */
315 { 0, 0, 0, 0 },
316 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
317 & ifmt_beqz, { 0xb0a00000 }
319 /* bnez $src2,$disp16 */
321 { 0, 0, 0, 0 },
322 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
323 & ifmt_beqz, { 0xb0900000 }
325 /* bl.s $disp8 */
327 { 0, 0, 0, 0 },
328 { { MNEM, ' ', OP (DISP8), 0 } },
329 & ifmt_bc8, { 0x7e00 }
331 /* bl.l $disp24 */
333 { 0, 0, 0, 0 },
334 { { MNEM, ' ', OP (DISP24), 0 } },
335 & ifmt_bc24, { 0xfe000000 }
337 /* bcl.s $disp8 */
339 { 0, 0, 0, 0 },
340 { { MNEM, ' ', OP (DISP8), 0 } },
341 & ifmt_bc8, { 0x7800 }
343 /* bcl.l $disp24 */
345 { 0, 0, 0, 0 },
346 { { MNEM, ' ', OP (DISP24), 0 } },
347 & ifmt_bc24, { 0xf8000000 }
349 /* bnc.s $disp8 */
351 { 0, 0, 0, 0 },
352 { { MNEM, ' ', OP (DISP8), 0 } },
353 & ifmt_bc8, { 0x7d00 }
355 /* bnc.l $disp24 */
357 { 0, 0, 0, 0 },
358 { { MNEM, ' ', OP (DISP24), 0 } },
359 & ifmt_bc24, { 0xfd000000 }
361 /* bne $src1,$src2,$disp16 */
363 { 0, 0, 0, 0 },
364 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (DISP16), 0 } },
365 & ifmt_beq, { 0xb0100000 }
367 /* bra.s $disp8 */
369 { 0, 0, 0, 0 },
370 { { MNEM, ' ', OP (DISP8), 0 } },
371 & ifmt_bc8, { 0x7f00 }
373 /* bra.l $disp24 */
375 { 0, 0, 0, 0 },
376 { { MNEM, ' ', OP (DISP24), 0 } },
377 & ifmt_bc24, { 0xff000000 }
379 /* bncl.s $disp8 */
381 { 0, 0, 0, 0 },
382 { { MNEM, ' ', OP (DISP8), 0 } },
383 & ifmt_bc8, { 0x7900 }
385 /* bncl.l $disp24 */
387 { 0, 0, 0, 0 },
388 { { MNEM, ' ', OP (DISP24), 0 } },
389 & ifmt_bc24, { 0xf9000000 }
391 /* cmp $src1,$src2 */
393 { 0, 0, 0, 0 },
394 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
395 & ifmt_cmp, { 0x40 }
397 /* cmpi $src2,$simm16 */
399 { 0, 0, 0, 0 },
400 { { MNEM, ' ', OP (SRC2), ',', OP (SIMM16), 0 } },
401 & ifmt_cmpi, { 0x80400000 }
403 /* cmpu $src1,$src2 */
405 { 0, 0, 0, 0 },
406 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
407 & ifmt_cmp, { 0x50 }
409 /* cmpui $src2,$simm16 */
411 { 0, 0, 0, 0 },
412 { { MNEM, ' ', OP (SRC2), ',', OP (SIMM16), 0 } },
413 & ifmt_cmpi, { 0x80500000 }
415 /* cmpeq $src1,$src2 */
417 { 0, 0, 0, 0 },
418 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
419 & ifmt_cmp, { 0x60 }
421 /* cmpz $src2 */
423 { 0, 0, 0, 0 },
424 { { MNEM, ' ', OP (SRC2), 0 } },
425 & ifmt_cmpz, { 0x70 }
427 /* div $dr,$sr */
429 { 0, 0, 0, 0 },
430 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
431 & ifmt_div, { 0x90000000 }
433 /* divu $dr,$sr */
435 { 0, 0, 0, 0 },
436 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
437 & ifmt_div, { 0x90100000 }
439 /* rem $dr,$sr */
441 { 0, 0, 0, 0 },
442 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
443 & ifmt_div, { 0x90200000 }
445 /* remu $dr,$sr */
447 { 0, 0, 0, 0 },
448 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
449 & ifmt_div, { 0x90300000 }
451 /* divh $dr,$sr */
453 { 0, 0, 0, 0 },
454 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
455 & ifmt_div, { 0x90000010 }
457 /* jc $sr */
459 { 0, 0, 0, 0 },
460 { { MNEM, ' ', OP (SR), 0 } },
461 & ifmt_jc, { 0x1cc0 }
463 /* jnc $sr */
465 { 0, 0, 0, 0 },
466 { { MNEM, ' ', OP (SR), 0 } },
467 & ifmt_jc, { 0x1dc0 }
469 /* jl $sr */
471 { 0, 0, 0, 0 },
472 { { MNEM, ' ', OP (SR), 0 } },
473 & ifmt_jc, { 0x1ec0 }
475 /* jmp $sr */
477 { 0, 0, 0, 0 },
478 { { MNEM, ' ', OP (SR), 0 } },
479 & ifmt_jc, { 0x1fc0 }
481 /* ld $dr,@$sr */
483 { 0, 0, 0, 0 },
484 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
485 & ifmt_add, { 0x20c0 }
487 /* ld $dr,@($slo16,$sr) */
489 { 0, 0, 0, 0 },
490 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
491 & ifmt_add3, { 0xa0c00000 }
493 /* ldb $dr,@$sr */
495 { 0, 0, 0, 0 },
496 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
497 & ifmt_add, { 0x2080 }
499 /* ldb $dr,@($slo16,$sr) */
501 { 0, 0, 0, 0 },
502 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
503 & ifmt_add3, { 0xa0800000 }
505 /* ldh $dr,@$sr */
507 { 0, 0, 0, 0 },
508 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
509 & ifmt_add, { 0x20a0 }
511 /* ldh $dr,@($slo16,$sr) */
513 { 0, 0, 0, 0 },
514 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
515 & ifmt_add3, { 0xa0a00000 }
517 /* ldub $dr,@$sr */
519 { 0, 0, 0, 0 },
520 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
521 & ifmt_add, { 0x2090 }
523 /* ldub $dr,@($slo16,$sr) */
525 { 0, 0, 0, 0 },
526 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
527 & ifmt_add3, { 0xa0900000 }
529 /* lduh $dr,@$sr */
531 { 0, 0, 0, 0 },
532 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
533 & ifmt_add, { 0x20b0 }
535 /* lduh $dr,@($slo16,$sr) */
537 { 0, 0, 0, 0 },
538 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
539 & ifmt_add3, { 0xa0b00000 }
541 /* ld $dr,@$sr+ */
543 { 0, 0, 0, 0 },
544 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), '+', 0 } },
545 & ifmt_add, { 0x20e0 }
547 /* ld24 $dr,$uimm24 */
549 { 0, 0, 0, 0 },
550 { { MNEM, ' ', OP (DR), ',', OP (UIMM24), 0 } },
551 & ifmt_ld24, { 0xe0000000 }
553 /* ldi8 $dr,$simm8 */
555 { 0, 0, 0, 0 },
556 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
557 & ifmt_addi, { 0x6000 }
559 /* ldi16 $dr,$hash$slo16 */
561 { 0, 0, 0, 0 },
562 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (SLO16), 0 } },
563 & ifmt_ldi16, { 0x90f00000 }
565 /* lock $dr,@$sr */
567 { 0, 0, 0, 0 },
568 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
569 & ifmt_add, { 0x20d0 }
571 /* machi $src1,$src2 */
573 { 0, 0, 0, 0 },
574 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
575 & ifmt_cmp, { 0x3040 }
577 /* machi $src1,$src2,$acc */
579 { 0, 0, 0, 0 },
580 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
581 & ifmt_machi_a, { 0x3040 }
583 /* maclo $src1,$src2 */
585 { 0, 0, 0, 0 },
586 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
587 & ifmt_cmp, { 0x3050 }
589 /* maclo $src1,$src2,$acc */
591 { 0, 0, 0, 0 },
592 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
593 & ifmt_machi_a, { 0x3050 }
595 /* macwhi $src1,$src2 */
597 { 0, 0, 0, 0 },
598 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
599 & ifmt_cmp, { 0x3060 }
601 /* macwhi $src1,$src2,$acc */
603 { 0, 0, 0, 0 },
604 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
605 & ifmt_machi_a, { 0x3060 }
607 /* macwlo $src1,$src2 */
609 { 0, 0, 0, 0 },
610 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
611 & ifmt_cmp, { 0x3070 }
613 /* macwlo $src1,$src2,$acc */
615 { 0, 0, 0, 0 },
616 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
617 & ifmt_machi_a, { 0x3070 }
619 /* mul $dr,$sr */
621 { 0, 0, 0, 0 },
622 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
623 & ifmt_add, { 0x1060 }
625 /* mulhi $src1,$src2 */
627 { 0, 0, 0, 0 },
628 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
629 & ifmt_cmp, { 0x3000 }
631 /* mulhi $src1,$src2,$acc */
633 { 0, 0, 0, 0 },
634 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
635 & ifmt_machi_a, { 0x3000 }
637 /* mullo $src1,$src2 */
639 { 0, 0, 0, 0 },
640 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
641 & ifmt_cmp, { 0x3010 }
643 /* mullo $src1,$src2,$acc */
645 { 0, 0, 0, 0 },
646 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
647 & ifmt_machi_a, { 0x3010 }
649 /* mulwhi $src1,$src2 */
651 { 0, 0, 0, 0 },
652 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
653 & ifmt_cmp, { 0x3020 }
655 /* mulwhi $src1,$src2,$acc */
657 { 0, 0, 0, 0 },
658 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
659 & ifmt_machi_a, { 0x3020 }
661 /* mulwlo $src1,$src2 */
663 { 0, 0, 0, 0 },
664 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
665 & ifmt_cmp, { 0x3030 }
667 /* mulwlo $src1,$src2,$acc */
669 { 0, 0, 0, 0 },
670 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
671 & ifmt_machi_a, { 0x3030 }
673 /* mv $dr,$sr */
675 { 0, 0, 0, 0 },
676 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
677 & ifmt_add, { 0x1080 }
679 /* mvfachi $dr */
681 { 0, 0, 0, 0 },
682 { { MNEM, ' ', OP (DR), 0 } },
683 & ifmt_mvfachi, { 0x50f0 }
685 /* mvfachi $dr,$accs */
687 { 0, 0, 0, 0 },
688 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
689 & ifmt_mvfachi_a, { 0x50f0 }
691 /* mvfaclo $dr */
693 { 0, 0, 0, 0 },
694 { { MNEM, ' ', OP (DR), 0 } },
695 & ifmt_mvfachi, { 0x50f1 }
697 /* mvfaclo $dr,$accs */
699 { 0, 0, 0, 0 },
700 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
701 & ifmt_mvfachi_a, { 0x50f1 }
703 /* mvfacmi $dr */
705 { 0, 0, 0, 0 },
706 { { MNEM, ' ', OP (DR), 0 } },
707 & ifmt_mvfachi, { 0x50f2 }
709 /* mvfacmi $dr,$accs */
711 { 0, 0, 0, 0 },
712 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
713 & ifmt_mvfachi_a, { 0x50f2 }
715 /* mvfc $dr,$scr */
717 { 0, 0, 0, 0 },
718 { { MNEM, ' ', OP (DR), ',', OP (SCR), 0 } },
719 & ifmt_mvfc, { 0x1090 }
721 /* mvtachi $src1 */
723 { 0, 0, 0, 0 },
724 { { MNEM, ' ', OP (SRC1), 0 } },
725 & ifmt_mvtachi, { 0x5070 }
727 /* mvtachi $src1,$accs */
729 { 0, 0, 0, 0 },
730 { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
731 & ifmt_mvtachi_a, { 0x5070 }
733 /* mvtaclo $src1 */
735 { 0, 0, 0, 0 },
736 { { MNEM, ' ', OP (SRC1), 0 } },
737 & ifmt_mvtachi, { 0x5071 }
739 /* mvtaclo $src1,$accs */
741 { 0, 0, 0, 0 },
742 { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
743 & ifmt_mvtachi_a, { 0x5071 }
745 /* mvtc $sr,$dcr */
747 { 0, 0, 0, 0 },
748 { { MNEM, ' ', OP (SR), ',', OP (DCR), 0 } },
749 & ifmt_mvtc, { 0x10a0 }
751 /* neg $dr,$sr */
753 { 0, 0, 0, 0 },
754 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
755 & ifmt_add, { 0x30 }
757 /* nop */
759 { 0, 0, 0, 0 },
760 { { MNEM, 0 } },
761 & ifmt_nop, { 0x7000 }
763 /* not $dr,$sr */
765 { 0, 0, 0, 0 },
766 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
767 & ifmt_add, { 0xb0 }
769 /* rac */
771 { 0, 0, 0, 0 },
772 { { MNEM, 0 } },
773 & ifmt_nop, { 0x5090 }
775 /* rac $accd,$accs,$imm1 */
777 { 0, 0, 0, 0 },
778 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
779 & ifmt_rac_dsi, { 0x5090 }
781 /* rach */
783 { 0, 0, 0, 0 },
784 { { MNEM, 0 } },
785 & ifmt_nop, { 0x5080 }
787 /* rach $accd,$accs,$imm1 */
789 { 0, 0, 0, 0 },
790 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
791 & ifmt_rac_dsi, { 0x5080 }
793 /* rte */
795 { 0, 0, 0, 0 },
796 { { MNEM, 0 } },
797 & ifmt_nop, { 0x10d6 }
799 /* seth $dr,$hash$hi16 */
801 { 0, 0, 0, 0 },
802 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (HI16), 0 } },
803 & ifmt_seth, { 0xd0c00000 }
805 /* sll $dr,$sr */
807 { 0, 0, 0, 0 },
808 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
809 & ifmt_add, { 0x1040 }
811 /* sll3 $dr,$sr,$simm16 */
813 { 0, 0, 0, 0 },
814 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
815 & ifmt_addv3, { 0x90c00000 }
817 /* slli $dr,$uimm5 */
819 { 0, 0, 0, 0 },
820 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
821 & ifmt_slli, { 0x5040 }
823 /* sra $dr,$sr */
825 { 0, 0, 0, 0 },
826 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
827 & ifmt_add, { 0x1020 }
829 /* sra3 $dr,$sr,$simm16 */
831 { 0, 0, 0, 0 },
832 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
833 & ifmt_addv3, { 0x90a00000 }
835 /* srai $dr,$uimm5 */
837 { 0, 0, 0, 0 },
838 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
839 & ifmt_slli, { 0x5020 }
841 /* srl $dr,$sr */
843 { 0, 0, 0, 0 },
844 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
845 & ifmt_add, { 0x1000 }
847 /* srl3 $dr,$sr,$simm16 */
849 { 0, 0, 0, 0 },
850 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
851 & ifmt_addv3, { 0x90800000 }
853 /* srli $dr,$uimm5 */
855 { 0, 0, 0, 0 },
856 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
857 & ifmt_slli, { 0x5000 }
859 /* st $src1,@$src2 */
861 { 0, 0, 0, 0 },
862 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
863 & ifmt_cmp, { 0x2040 }
865 /* st $src1,@($slo16,$src2) */
867 { 0, 0, 0, 0 },
868 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
869 & ifmt_st_d, { 0xa0400000 }
871 /* stb $src1,@$src2 */
873 { 0, 0, 0, 0 },
874 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
875 & ifmt_cmp, { 0x2000 }
877 /* stb $src1,@($slo16,$src2) */
879 { 0, 0, 0, 0 },
880 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
881 & ifmt_st_d, { 0xa0000000 }
883 /* sth $src1,@$src2 */
885 { 0, 0, 0, 0 },
886 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
887 & ifmt_cmp, { 0x2020 }
889 /* sth $src1,@($slo16,$src2) */
891 { 0, 0, 0, 0 },
892 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
893 & ifmt_st_d, { 0xa0200000 }
895 /* st $src1,@+$src2 */
897 { 0, 0, 0, 0 },
898 { { MNEM, ' ', OP (SRC1), ',', '@', '+', OP (SRC2), 0 } },
899 & ifmt_cmp, { 0x2060 }
901 /* st $src1,@-$src2 */
903 { 0, 0, 0, 0 },
904 { { MNEM, ' ', OP (SRC1), ',', '@', '-', OP (SRC2), 0 } },
905 & ifmt_cmp, { 0x2070 }
907 /* sub $dr,$sr */
909 { 0, 0, 0, 0 },
910 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
911 & ifmt_add, { 0x20 }
913 /* subv $dr,$sr */
915 { 0, 0, 0, 0 },
916 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
917 & ifmt_add, { 0x0 }
919 /* subx $dr,$sr */
921 { 0, 0, 0, 0 },
922 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
923 & ifmt_add, { 0x10 }
925 /* trap $uimm4 */
927 { 0, 0, 0, 0 },
928 { { MNEM, ' ', OP (UIMM4), 0 } },
929 & ifmt_trap, { 0x10f0 }
931 /* unlock $src1,@$src2 */
933 { 0, 0, 0, 0 },
934 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
935 & ifmt_cmp, { 0x2050 }
937 /* satb $dr,$sr */
939 { 0, 0, 0, 0 },
940 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
941 & ifmt_satb, { 0x80600300 }
943 /* sath $dr,$sr */
945 { 0, 0, 0, 0 },
946 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
947 & ifmt_satb, { 0x80600200 }
949 /* sat $dr,$sr */
951 { 0, 0, 0, 0 },
952 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
953 & ifmt_satb, { 0x80600000 }
955 /* pcmpbz $src2 */
957 { 0, 0, 0, 0 },
958 { { MNEM, ' ', OP (SRC2), 0 } },
959 & ifmt_cmpz, { 0x370 }
961 /* sadd */
963 { 0, 0, 0, 0 },
964 { { MNEM, 0 } },
965 & ifmt_nop, { 0x50e4 }
967 /* macwu1 $src1,$src2 */
969 { 0, 0, 0, 0 },
970 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
971 & ifmt_cmp, { 0x50b0 }
973 /* msblo $src1,$src2 */
975 { 0, 0, 0, 0 },
976 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
977 & ifmt_cmp, { 0x50d0 }
979 /* mulwu1 $src1,$src2 */
981 { 0, 0, 0, 0 },
982 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
983 & ifmt_cmp, { 0x50a0 }
985 /* maclh1 $src1,$src2 */
987 { 0, 0, 0, 0 },
988 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
989 & ifmt_cmp, { 0x50c0 }
991 /* sc */
993 { 0, 0, 0, 0 },
994 { { MNEM, 0 } },
995 & ifmt_nop, { 0x7401 }
997 /* snc */
999 { 0, 0, 0, 0 },
1000 { { MNEM, 0 } },
1001 & ifmt_nop, { 0x7501 }
1005 #undef A
1006 #undef OPERAND
1007 #undef MNEM
1008 #undef OP
1010 /* Formats for ALIAS macro-insns. */
1012 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1013 #define F(f) & m32r_cgen_ifld_table[M32R_##f]
1014 #else
1015 #define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
1016 #endif
1017 static const CGEN_IFMT ifmt_bc8r = {
1018 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1021 static const CGEN_IFMT ifmt_bc24r = {
1022 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1025 static const CGEN_IFMT ifmt_bl8r = {
1026 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1029 static const CGEN_IFMT ifmt_bl24r = {
1030 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1033 static const CGEN_IFMT ifmt_bcl8r = {
1034 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1037 static const CGEN_IFMT ifmt_bcl24r = {
1038 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1041 static const CGEN_IFMT ifmt_bnc8r = {
1042 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1045 static const CGEN_IFMT ifmt_bnc24r = {
1046 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1049 static const CGEN_IFMT ifmt_bra8r = {
1050 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1053 static const CGEN_IFMT ifmt_bra24r = {
1054 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1057 static const CGEN_IFMT ifmt_bncl8r = {
1058 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1061 static const CGEN_IFMT ifmt_bncl24r = {
1062 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1065 static const CGEN_IFMT ifmt_ld_2 = {
1066 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1069 static const CGEN_IFMT ifmt_ld_d2 = {
1070 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1073 static const CGEN_IFMT ifmt_ldb_2 = {
1074 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1077 static const CGEN_IFMT ifmt_ldb_d2 = {
1078 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1081 static const CGEN_IFMT ifmt_ldh_2 = {
1082 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1085 static const CGEN_IFMT ifmt_ldh_d2 = {
1086 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1089 static const CGEN_IFMT ifmt_ldub_2 = {
1090 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1093 static const CGEN_IFMT ifmt_ldub_d2 = {
1094 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1097 static const CGEN_IFMT ifmt_lduh_2 = {
1098 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1101 static const CGEN_IFMT ifmt_lduh_d2 = {
1102 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1105 static const CGEN_IFMT ifmt_pop = {
1106 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
1109 static const CGEN_IFMT ifmt_ldi8a = {
1110 16, 16, 0xf000, { { F (F_OP1) }, { F (F_R1) }, { F (F_SIMM8) }, { 0 } }
1113 static const CGEN_IFMT ifmt_ldi16a = {
1114 32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_R1) }, { F (F_SIMM16) }, { 0 } }
1117 static const CGEN_IFMT ifmt_rac_d = {
1118 16, 16, 0xf3ff, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
1121 static const CGEN_IFMT ifmt_rac_ds = {
1122 16, 16, 0xf3f3, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
1125 static const CGEN_IFMT ifmt_rach_d = {
1126 16, 16, 0xf3ff, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
1129 static const CGEN_IFMT ifmt_rach_ds = {
1130 16, 16, 0xf3f3, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
1133 static const CGEN_IFMT ifmt_st_2 = {
1134 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1137 static const CGEN_IFMT ifmt_st_d2 = {
1138 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1141 static const CGEN_IFMT ifmt_stb_2 = {
1142 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1145 static const CGEN_IFMT ifmt_stb_d2 = {
1146 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1149 static const CGEN_IFMT ifmt_sth_2 = {
1150 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1153 static const CGEN_IFMT ifmt_sth_d2 = {
1154 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1157 static const CGEN_IFMT ifmt_push = {
1158 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1161 #undef F
1163 /* Each non-simple macro entry points to an array of expansion possibilities. */
1165 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1166 #define A(a) (1 << CGEN_INSN_##a)
1167 #else
1168 #define A(a) (1 << CGEN_INSN_/**/a)
1169 #endif
1170 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1171 #define OPERAND(op) M32R_OPERAND_##op
1172 #else
1173 #define OPERAND(op) M32R_OPERAND_/**/op
1174 #endif
1175 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
1176 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
1178 /* The macro instruction table. */
1180 static const CGEN_IBASE m32r_cgen_macro_insn_table[] =
1182 /* bc $disp8 */
1184 -1, "bc8r", "bc", 16,
1185 { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1187 /* bc $disp24 */
1189 -1, "bc24r", "bc", 32,
1190 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1192 /* bl $disp8 */
1194 -1, "bl8r", "bl", 16,
1195 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1197 /* bl $disp24 */
1199 -1, "bl24r", "bl", 32,
1200 { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1202 /* bcl $disp8 */
1204 -1, "bcl8r", "bcl", 16,
1205 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } }
1207 /* bcl $disp24 */
1209 -1, "bcl24r", "bcl", 32,
1210 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } }
1212 /* bnc $disp8 */
1214 -1, "bnc8r", "bnc", 16,
1215 { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1217 /* bnc $disp24 */
1219 -1, "bnc24r", "bnc", 32,
1220 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1222 /* bra $disp8 */
1224 -1, "bra8r", "bra", 16,
1225 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1227 /* bra $disp24 */
1229 -1, "bra24r", "bra", 32,
1230 { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1232 /* bncl $disp8 */
1234 -1, "bncl8r", "bncl", 16,
1235 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } }
1237 /* bncl $disp24 */
1239 -1, "bncl24r", "bncl", 32,
1240 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } }
1242 /* ld $dr,@($sr) */
1244 -1, "ld-2", "ld", 16,
1245 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1247 /* ld $dr,@($sr,$slo16) */
1249 -1, "ld-d2", "ld", 32,
1250 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1252 /* ldb $dr,@($sr) */
1254 -1, "ldb-2", "ldb", 16,
1255 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1257 /* ldb $dr,@($sr,$slo16) */
1259 -1, "ldb-d2", "ldb", 32,
1260 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1262 /* ldh $dr,@($sr) */
1264 -1, "ldh-2", "ldh", 16,
1265 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1267 /* ldh $dr,@($sr,$slo16) */
1269 -1, "ldh-d2", "ldh", 32,
1270 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1272 /* ldub $dr,@($sr) */
1274 -1, "ldub-2", "ldub", 16,
1275 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1277 /* ldub $dr,@($sr,$slo16) */
1279 -1, "ldub-d2", "ldub", 32,
1280 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1282 /* lduh $dr,@($sr) */
1284 -1, "lduh-2", "lduh", 16,
1285 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1287 /* lduh $dr,@($sr,$slo16) */
1289 -1, "lduh-d2", "lduh", 32,
1290 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1292 /* pop $dr */
1294 -1, "pop", "pop", 16,
1295 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1297 /* ldi $dr,$simm8 */
1299 -1, "ldi8a", "ldi", 16,
1300 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_OS } }
1302 /* ldi $dr,$hash$slo16 */
1304 -1, "ldi16a", "ldi", 32,
1305 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1307 /* rac $accd */
1309 -1, "rac-d", "rac", 16,
1310 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1312 /* rac $accd,$accs */
1314 -1, "rac-ds", "rac", 16,
1315 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1317 /* rach $accd */
1319 -1, "rach-d", "rach", 16,
1320 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1322 /* rach $accd,$accs */
1324 -1, "rach-ds", "rach", 16,
1325 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1327 /* st $src1,@($src2) */
1329 -1, "st-2", "st", 16,
1330 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1332 /* st $src1,@($src2,$slo16) */
1334 -1, "st-d2", "st", 32,
1335 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1337 /* stb $src1,@($src2) */
1339 -1, "stb-2", "stb", 16,
1340 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1342 /* stb $src1,@($src2,$slo16) */
1344 -1, "stb-d2", "stb", 32,
1345 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1347 /* sth $src1,@($src2) */
1349 -1, "sth-2", "sth", 16,
1350 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1352 /* sth $src1,@($src2,$slo16) */
1354 -1, "sth-d2", "sth", 32,
1355 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1357 /* push $src1 */
1359 -1, "push", "push", 16,
1360 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1364 /* The macro instruction opcode table. */
1366 static const CGEN_OPCODE m32r_cgen_macro_insn_opcode_table[] =
1368 /* bc $disp8 */
1370 { 0, 0, 0, 0 },
1371 { { MNEM, ' ', OP (DISP8), 0 } },
1372 & ifmt_bc8r, { 0x7c00 }
1374 /* bc $disp24 */
1376 { 0, 0, 0, 0 },
1377 { { MNEM, ' ', OP (DISP24), 0 } },
1378 & ifmt_bc24r, { 0xfc000000 }
1380 /* bl $disp8 */
1382 { 0, 0, 0, 0 },
1383 { { MNEM, ' ', OP (DISP8), 0 } },
1384 & ifmt_bl8r, { 0x7e00 }
1386 /* bl $disp24 */
1388 { 0, 0, 0, 0 },
1389 { { MNEM, ' ', OP (DISP24), 0 } },
1390 & ifmt_bl24r, { 0xfe000000 }
1392 /* bcl $disp8 */
1394 { 0, 0, 0, 0 },
1395 { { MNEM, ' ', OP (DISP8), 0 } },
1396 & ifmt_bcl8r, { 0x7800 }
1398 /* bcl $disp24 */
1400 { 0, 0, 0, 0 },
1401 { { MNEM, ' ', OP (DISP24), 0 } },
1402 & ifmt_bcl24r, { 0xf8000000 }
1404 /* bnc $disp8 */
1406 { 0, 0, 0, 0 },
1407 { { MNEM, ' ', OP (DISP8), 0 } },
1408 & ifmt_bnc8r, { 0x7d00 }
1410 /* bnc $disp24 */
1412 { 0, 0, 0, 0 },
1413 { { MNEM, ' ', OP (DISP24), 0 } },
1414 & ifmt_bnc24r, { 0xfd000000 }
1416 /* bra $disp8 */
1418 { 0, 0, 0, 0 },
1419 { { MNEM, ' ', OP (DISP8), 0 } },
1420 & ifmt_bra8r, { 0x7f00 }
1422 /* bra $disp24 */
1424 { 0, 0, 0, 0 },
1425 { { MNEM, ' ', OP (DISP24), 0 } },
1426 & ifmt_bra24r, { 0xff000000 }
1428 /* bncl $disp8 */
1430 { 0, 0, 0, 0 },
1431 { { MNEM, ' ', OP (DISP8), 0 } },
1432 & ifmt_bncl8r, { 0x7900 }
1434 /* bncl $disp24 */
1436 { 0, 0, 0, 0 },
1437 { { MNEM, ' ', OP (DISP24), 0 } },
1438 & ifmt_bncl24r, { 0xf9000000 }
1440 /* ld $dr,@($sr) */
1442 { 0, 0, 0, 0 },
1443 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1444 & ifmt_ld_2, { 0x20c0 }
1446 /* ld $dr,@($sr,$slo16) */
1448 { 0, 0, 0, 0 },
1449 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1450 & ifmt_ld_d2, { 0xa0c00000 }
1452 /* ldb $dr,@($sr) */
1454 { 0, 0, 0, 0 },
1455 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1456 & ifmt_ldb_2, { 0x2080 }
1458 /* ldb $dr,@($sr,$slo16) */
1460 { 0, 0, 0, 0 },
1461 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1462 & ifmt_ldb_d2, { 0xa0800000 }
1464 /* ldh $dr,@($sr) */
1466 { 0, 0, 0, 0 },
1467 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1468 & ifmt_ldh_2, { 0x20a0 }
1470 /* ldh $dr,@($sr,$slo16) */
1472 { 0, 0, 0, 0 },
1473 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1474 & ifmt_ldh_d2, { 0xa0a00000 }
1476 /* ldub $dr,@($sr) */
1478 { 0, 0, 0, 0 },
1479 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1480 & ifmt_ldub_2, { 0x2090 }
1482 /* ldub $dr,@($sr,$slo16) */
1484 { 0, 0, 0, 0 },
1485 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1486 & ifmt_ldub_d2, { 0xa0900000 }
1488 /* lduh $dr,@($sr) */
1490 { 0, 0, 0, 0 },
1491 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1492 & ifmt_lduh_2, { 0x20b0 }
1494 /* lduh $dr,@($sr,$slo16) */
1496 { 0, 0, 0, 0 },
1497 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1498 & ifmt_lduh_d2, { 0xa0b00000 }
1500 /* pop $dr */
1502 { 0, 0, 0, 0 },
1503 { { MNEM, ' ', OP (DR), 0 } },
1504 & ifmt_pop, { 0x20ef }
1506 /* ldi $dr,$simm8 */
1508 { 0, 0, 0, 0 },
1509 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
1510 & ifmt_ldi8a, { 0x6000 }
1512 /* ldi $dr,$hash$slo16 */
1514 { 0, 0, 0, 0 },
1515 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (SLO16), 0 } },
1516 & ifmt_ldi16a, { 0x90f00000 }
1518 /* rac $accd */
1520 { 0, 0, 0, 0 },
1521 { { MNEM, ' ', OP (ACCD), 0 } },
1522 & ifmt_rac_d, { 0x5090 }
1524 /* rac $accd,$accs */
1526 { 0, 0, 0, 0 },
1527 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
1528 & ifmt_rac_ds, { 0x5090 }
1530 /* rach $accd */
1532 { 0, 0, 0, 0 },
1533 { { MNEM, ' ', OP (ACCD), 0 } },
1534 & ifmt_rach_d, { 0x5080 }
1536 /* rach $accd,$accs */
1538 { 0, 0, 0, 0 },
1539 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
1540 & ifmt_rach_ds, { 0x5080 }
1542 /* st $src1,@($src2) */
1544 { 0, 0, 0, 0 },
1545 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1546 & ifmt_st_2, { 0x2040 }
1548 /* st $src1,@($src2,$slo16) */
1550 { 0, 0, 0, 0 },
1551 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1552 & ifmt_st_d2, { 0xa0400000 }
1554 /* stb $src1,@($src2) */
1556 { 0, 0, 0, 0 },
1557 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1558 & ifmt_stb_2, { 0x2000 }
1560 /* stb $src1,@($src2,$slo16) */
1562 { 0, 0, 0, 0 },
1563 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1564 & ifmt_stb_d2, { 0xa0000000 }
1566 /* sth $src1,@($src2) */
1568 { 0, 0, 0, 0 },
1569 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1570 & ifmt_sth_2, { 0x2020 }
1572 /* sth $src1,@($src2,$slo16) */
1574 { 0, 0, 0, 0 },
1575 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1576 & ifmt_sth_d2, { 0xa0200000 }
1578 /* push $src1 */
1580 { 0, 0, 0, 0 },
1581 { { MNEM, ' ', OP (SRC1), 0 } },
1582 & ifmt_push, { 0x207f }
1586 #undef A
1587 #undef OPERAND
1588 #undef MNEM
1589 #undef OP
1591 #ifndef CGEN_ASM_HASH_P
1592 #define CGEN_ASM_HASH_P(insn) 1
1593 #endif
1595 #ifndef CGEN_DIS_HASH_P
1596 #define CGEN_DIS_HASH_P(insn) 1
1597 #endif
1599 /* Return non-zero if INSN is to be added to the hash table.
1600 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
1602 static int
1603 asm_hash_insn_p (insn)
1604 const CGEN_INSN *insn ATTRIBUTE_UNUSED;
1606 return CGEN_ASM_HASH_P (insn);
1609 static int
1610 dis_hash_insn_p (insn)
1611 const CGEN_INSN *insn;
1613 /* If building the hash table and the NO-DIS attribute is present,
1614 ignore. */
1615 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
1616 return 0;
1617 return CGEN_DIS_HASH_P (insn);
1620 #ifndef CGEN_ASM_HASH
1621 #define CGEN_ASM_HASH_SIZE 127
1622 #ifdef CGEN_MNEMONIC_OPERANDS
1623 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1624 #else
1625 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1626 #endif
1627 #endif
1629 /* It doesn't make much sense to provide a default here,
1630 but while this is under development we do.
1631 BUFFER is a pointer to the bytes of the insn, target order.
1632 VALUE is the first base_insn_bitsize bits as an int in host order. */
1634 #ifndef CGEN_DIS_HASH
1635 #define CGEN_DIS_HASH_SIZE 256
1636 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1637 #endif
1639 /* The result is the hash value of the insn.
1640 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1642 static unsigned int
1643 asm_hash_insn (mnem)
1644 const char * mnem;
1646 return CGEN_ASM_HASH (mnem);
1649 /* BUF is a pointer to the bytes of the insn, target order.
1650 VALUE is the first base_insn_bitsize bits as an int in host order. */
1652 static unsigned int
1653 dis_hash_insn (buf, value)
1654 const char * buf ATTRIBUTE_UNUSED;
1655 CGEN_INSN_INT value ATTRIBUTE_UNUSED;
1657 return CGEN_DIS_HASH (buf, value);
1660 static void set_fields_bitsize PARAMS ((CGEN_FIELDS *, int));
1662 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1664 static void
1665 set_fields_bitsize (fields, size)
1666 CGEN_FIELDS *fields;
1667 int size;
1669 CGEN_FIELDS_BITSIZE (fields) = size;
1672 /* Function to call before using the operand instance table.
1673 This plugs the opcode entries and macro instructions into the cpu table. */
1675 void
1676 m32r_cgen_init_opcode_table (cd)
1677 CGEN_CPU_DESC cd;
1679 int i;
1680 int num_macros = (sizeof (m32r_cgen_macro_insn_table) /
1681 sizeof (m32r_cgen_macro_insn_table[0]));
1682 const CGEN_IBASE *ib = & m32r_cgen_macro_insn_table[0];
1683 const CGEN_OPCODE *oc = & m32r_cgen_macro_insn_opcode_table[0];
1684 CGEN_INSN *insns = (CGEN_INSN *) xmalloc (num_macros * sizeof (CGEN_INSN));
1685 memset (insns, 0, num_macros * sizeof (CGEN_INSN));
1686 for (i = 0; i < num_macros; ++i)
1688 insns[i].base = &ib[i];
1689 insns[i].opcode = &oc[i];
1690 m32r_cgen_build_insn_regex (& insns[i]);
1692 cd->macro_insn_table.init_entries = insns;
1693 cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
1694 cd->macro_insn_table.num_init_entries = num_macros;
1696 oc = & m32r_cgen_insn_opcode_table[0];
1697 insns = (CGEN_INSN *) cd->insn_table.init_entries;
1698 for (i = 0; i < MAX_INSNS; ++i)
1700 insns[i].opcode = &oc[i];
1701 m32r_cgen_build_insn_regex (& insns[i]);
1704 cd->sizeof_fields = sizeof (CGEN_FIELDS);
1705 cd->set_fields_bitsize = set_fields_bitsize;
1707 cd->asm_hash_p = asm_hash_insn_p;
1708 cd->asm_hash = asm_hash_insn;
1709 cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
1711 cd->dis_hash_p = dis_hash_insn_p;
1712 cd->dis_hash = dis_hash_insn;
1713 cd->dis_hash_size = CGEN_DIS_HASH_SIZE;