1 /* Instruction opcode table for m32r.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2010 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
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)
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.
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.
29 #include "m32r-desc.h"
31 #include "libiberty.h"
35 m32r_cgen_dis_hash (const char * buf ATTRIBUTE_UNUSED, CGEN_INSN_INT value)
39 if (value & 0xffff0000) /* 32bit instructions. */
40 value = (value >> 16) & 0xffff;
42 x = (value >> 8) & 0xf0;
43 if (x == 0x40 || x == 0xe0 || x == 0x60 || x == 0x50)
46 if (x == 0x70 || x == 0xf0)
47 return x | ((value >> 8) & 0x0f);
50 return x | ((value & 0x70) >> 4);
52 return x | ((value & 0xf0) >> 4);
56 /* The hash functions are recorded here to help keep assembler code out of
57 the disassembler and vice versa. */
59 static int asm_hash_insn_p (const CGEN_INSN *);
60 static unsigned int asm_hash_insn (const char *);
61 static int dis_hash_insn_p (const CGEN_INSN *);
62 static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
64 /* Instruction formats. */
66 #define F(f) & m32r_cgen_ifld_table[M32R_##f]
67 static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
71 static const CGEN_IFMT ifmt_add ATTRIBUTE_UNUSED = {
72 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
75 static const CGEN_IFMT ifmt_add3 ATTRIBUTE_UNUSED = {
76 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
79 static const CGEN_IFMT ifmt_and3 ATTRIBUTE_UNUSED = {
80 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
83 static const CGEN_IFMT ifmt_or3 ATTRIBUTE_UNUSED = {
84 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
87 static const CGEN_IFMT ifmt_addi ATTRIBUTE_UNUSED = {
88 16, 16, 0xf000, { { F (F_OP1) }, { F (F_R1) }, { F (F_SIMM8) }, { 0 } }
91 static const CGEN_IFMT ifmt_addv3 ATTRIBUTE_UNUSED = {
92 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
95 static const CGEN_IFMT ifmt_bc8 ATTRIBUTE_UNUSED = {
96 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
99 static const CGEN_IFMT ifmt_bc24 ATTRIBUTE_UNUSED = {
100 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
103 static const CGEN_IFMT ifmt_beq ATTRIBUTE_UNUSED = {
104 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_DISP16) }, { 0 } }
107 static const CGEN_IFMT ifmt_beqz ATTRIBUTE_UNUSED = {
108 32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_DISP16) }, { 0 } }
111 static const CGEN_IFMT ifmt_cmp ATTRIBUTE_UNUSED = {
112 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
115 static const CGEN_IFMT ifmt_cmpi ATTRIBUTE_UNUSED = {
116 32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
119 static const CGEN_IFMT ifmt_cmpz ATTRIBUTE_UNUSED = {
120 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
123 static const CGEN_IFMT ifmt_div ATTRIBUTE_UNUSED = {
124 32, 32, 0xf0f0ffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
127 static const CGEN_IFMT ifmt_jc ATTRIBUTE_UNUSED = {
128 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
131 static const CGEN_IFMT ifmt_ld24 ATTRIBUTE_UNUSED = {
132 32, 32, 0xf0000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_UIMM24) }, { 0 } }
135 static const CGEN_IFMT ifmt_ldi16 ATTRIBUTE_UNUSED = {
136 32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
139 static const CGEN_IFMT ifmt_machi_a ATTRIBUTE_UNUSED = {
140 16, 16, 0xf070, { { F (F_OP1) }, { F (F_R1) }, { F (F_ACC) }, { F (F_OP23) }, { F (F_R2) }, { 0 } }
143 static const CGEN_IFMT ifmt_mvfachi ATTRIBUTE_UNUSED = {
144 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
147 static const CGEN_IFMT ifmt_mvfachi_a ATTRIBUTE_UNUSED = {
148 16, 16, 0xf0f3, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_OP3) }, { 0 } }
151 static const CGEN_IFMT ifmt_mvfc ATTRIBUTE_UNUSED = {
152 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
155 static const CGEN_IFMT ifmt_mvtachi ATTRIBUTE_UNUSED = {
156 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
159 static const CGEN_IFMT ifmt_mvtachi_a ATTRIBUTE_UNUSED = {
160 16, 16, 0xf0f3, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_OP3) }, { 0 } }
163 static const CGEN_IFMT ifmt_mvtc ATTRIBUTE_UNUSED = {
164 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
167 static const CGEN_IFMT ifmt_nop ATTRIBUTE_UNUSED = {
168 16, 16, 0xffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
171 static const CGEN_IFMT ifmt_rac_dsi ATTRIBUTE_UNUSED = {
172 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 } }
175 static const CGEN_IFMT ifmt_seth ATTRIBUTE_UNUSED = {
176 32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_HI16) }, { 0 } }
179 static const CGEN_IFMT ifmt_slli ATTRIBUTE_UNUSED = {
180 16, 16, 0xf0e0, { { F (F_OP1) }, { F (F_R1) }, { F (F_SHIFT_OP2) }, { F (F_UIMM5) }, { 0 } }
183 static const CGEN_IFMT ifmt_st_d ATTRIBUTE_UNUSED = {
184 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
187 static const CGEN_IFMT ifmt_trap ATTRIBUTE_UNUSED = {
188 16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_UIMM4) }, { 0 } }
191 static const CGEN_IFMT ifmt_satb ATTRIBUTE_UNUSED = {
192 32, 32, 0xf0f0ffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
195 static const CGEN_IFMT ifmt_clrpsw ATTRIBUTE_UNUSED = {
196 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_UIMM8) }, { 0 } }
199 static const CGEN_IFMT ifmt_bset ATTRIBUTE_UNUSED = {
200 32, 32, 0xf8f00000, { { F (F_OP1) }, { F (F_BIT4) }, { F (F_UIMM3) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
203 static const CGEN_IFMT ifmt_btst ATTRIBUTE_UNUSED = {
204 16, 16, 0xf8f0, { { F (F_OP1) }, { F (F_BIT4) }, { F (F_UIMM3) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
209 #define A(a) (1 << CGEN_INSN_##a)
210 #define OPERAND(op) M32R_OPERAND_##op
211 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
212 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
214 /* The instruction table. */
216 static const CGEN_OPCODE m32r_cgen_insn_opcode_table[MAX_INSNS] =
218 /* Special null first entry.
219 A `num' value of zero is thus invalid.
220 Also, the special `invalid' insn resides here. */
221 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
225 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
228 /* add3 $dr,$sr,$hash$slo16 */
231 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (HASH), OP (SLO16), 0 } },
232 & ifmt_add3, { 0x80a00000 }
237 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
240 /* and3 $dr,$sr,$uimm16 */
243 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (UIMM16), 0 } },
244 & ifmt_and3, { 0x80c00000 }
249 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
252 /* or3 $dr,$sr,$hash$ulo16 */
255 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (HASH), OP (ULO16), 0 } },
256 & ifmt_or3, { 0x80e00000 }
261 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
264 /* xor3 $dr,$sr,$uimm16 */
267 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (UIMM16), 0 } },
268 & ifmt_and3, { 0x80d00000 }
270 /* addi $dr,$simm8 */
273 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
274 & ifmt_addi, { 0x4000 }
279 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
282 /* addv3 $dr,$sr,$simm16 */
285 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
286 & ifmt_addv3, { 0x80800000 }
291 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
297 { { MNEM, ' ', OP (DISP8), 0 } },
298 & ifmt_bc8, { 0x7c00 }
303 { { MNEM, ' ', OP (DISP24), 0 } },
304 & ifmt_bc24, { 0xfc000000 }
306 /* beq $src1,$src2,$disp16 */
309 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (DISP16), 0 } },
310 & ifmt_beq, { 0xb0000000 }
312 /* beqz $src2,$disp16 */
315 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
316 & ifmt_beqz, { 0xb0800000 }
318 /* bgez $src2,$disp16 */
321 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
322 & ifmt_beqz, { 0xb0b00000 }
324 /* bgtz $src2,$disp16 */
327 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
328 & ifmt_beqz, { 0xb0d00000 }
330 /* blez $src2,$disp16 */
333 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
334 & ifmt_beqz, { 0xb0c00000 }
336 /* bltz $src2,$disp16 */
339 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
340 & ifmt_beqz, { 0xb0a00000 }
342 /* bnez $src2,$disp16 */
345 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
346 & ifmt_beqz, { 0xb0900000 }
351 { { MNEM, ' ', OP (DISP8), 0 } },
352 & ifmt_bc8, { 0x7e00 }
357 { { MNEM, ' ', OP (DISP24), 0 } },
358 & ifmt_bc24, { 0xfe000000 }
363 { { MNEM, ' ', OP (DISP8), 0 } },
364 & ifmt_bc8, { 0x7800 }
369 { { MNEM, ' ', OP (DISP24), 0 } },
370 & ifmt_bc24, { 0xf8000000 }
375 { { MNEM, ' ', OP (DISP8), 0 } },
376 & ifmt_bc8, { 0x7d00 }
381 { { MNEM, ' ', OP (DISP24), 0 } },
382 & ifmt_bc24, { 0xfd000000 }
384 /* bne $src1,$src2,$disp16 */
387 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (DISP16), 0 } },
388 & ifmt_beq, { 0xb0100000 }
393 { { MNEM, ' ', OP (DISP8), 0 } },
394 & ifmt_bc8, { 0x7f00 }
399 { { MNEM, ' ', OP (DISP24), 0 } },
400 & ifmt_bc24, { 0xff000000 }
405 { { MNEM, ' ', OP (DISP8), 0 } },
406 & ifmt_bc8, { 0x7900 }
411 { { MNEM, ' ', OP (DISP24), 0 } },
412 & ifmt_bc24, { 0xf9000000 }
414 /* cmp $src1,$src2 */
417 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
420 /* cmpi $src2,$simm16 */
423 { { MNEM, ' ', OP (SRC2), ',', OP (SIMM16), 0 } },
424 & ifmt_cmpi, { 0x80400000 }
426 /* cmpu $src1,$src2 */
429 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
432 /* cmpui $src2,$simm16 */
435 { { MNEM, ' ', OP (SRC2), ',', OP (SIMM16), 0 } },
436 & ifmt_cmpi, { 0x80500000 }
438 /* cmpeq $src1,$src2 */
441 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
447 { { MNEM, ' ', OP (SRC2), 0 } },
448 & ifmt_cmpz, { 0x70 }
453 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
454 & ifmt_div, { 0x90000000 }
459 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
460 & ifmt_div, { 0x90100000 }
465 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
466 & ifmt_div, { 0x90200000 }
471 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
472 & ifmt_div, { 0x90300000 }
477 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
478 & ifmt_div, { 0x90200010 }
483 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
484 & ifmt_div, { 0x90300010 }
489 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
490 & ifmt_div, { 0x90200018 }
495 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
496 & ifmt_div, { 0x90300018 }
501 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
502 & ifmt_div, { 0x90100010 }
507 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
508 & ifmt_div, { 0x90000018 }
513 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
514 & ifmt_div, { 0x90100018 }
519 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
520 & ifmt_div, { 0x90000010 }
525 { { MNEM, ' ', OP (SR), 0 } },
526 & ifmt_jc, { 0x1cc0 }
531 { { MNEM, ' ', OP (SR), 0 } },
532 & ifmt_jc, { 0x1dc0 }
537 { { MNEM, ' ', OP (SR), 0 } },
538 & ifmt_jc, { 0x1ec0 }
543 { { MNEM, ' ', OP (SR), 0 } },
544 & ifmt_jc, { 0x1fc0 }
549 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
550 & ifmt_add, { 0x20c0 }
552 /* ld $dr,@($slo16,$sr) */
555 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
556 & ifmt_add3, { 0xa0c00000 }
561 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
562 & ifmt_add, { 0x2080 }
564 /* ldb $dr,@($slo16,$sr) */
567 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
568 & ifmt_add3, { 0xa0800000 }
573 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
574 & ifmt_add, { 0x20a0 }
576 /* ldh $dr,@($slo16,$sr) */
579 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
580 & ifmt_add3, { 0xa0a00000 }
585 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
586 & ifmt_add, { 0x2090 }
588 /* ldub $dr,@($slo16,$sr) */
591 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
592 & ifmt_add3, { 0xa0900000 }
597 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
598 & ifmt_add, { 0x20b0 }
600 /* lduh $dr,@($slo16,$sr) */
603 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
604 & ifmt_add3, { 0xa0b00000 }
609 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), '+', 0 } },
610 & ifmt_add, { 0x20e0 }
612 /* ld24 $dr,$uimm24 */
615 { { MNEM, ' ', OP (DR), ',', OP (UIMM24), 0 } },
616 & ifmt_ld24, { 0xe0000000 }
618 /* ldi8 $dr,$simm8 */
621 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
622 & ifmt_addi, { 0x6000 }
624 /* ldi16 $dr,$hash$slo16 */
627 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (SLO16), 0 } },
628 & ifmt_ldi16, { 0x90f00000 }
633 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
634 & ifmt_add, { 0x20d0 }
636 /* machi $src1,$src2 */
639 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
640 & ifmt_cmp, { 0x3040 }
642 /* machi $src1,$src2,$acc */
645 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
646 & ifmt_machi_a, { 0x3040 }
648 /* maclo $src1,$src2 */
651 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
652 & ifmt_cmp, { 0x3050 }
654 /* maclo $src1,$src2,$acc */
657 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
658 & ifmt_machi_a, { 0x3050 }
660 /* macwhi $src1,$src2 */
663 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
664 & ifmt_cmp, { 0x3060 }
666 /* macwhi $src1,$src2,$acc */
669 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
670 & ifmt_machi_a, { 0x3060 }
672 /* macwlo $src1,$src2 */
675 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
676 & ifmt_cmp, { 0x3070 }
678 /* macwlo $src1,$src2,$acc */
681 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
682 & ifmt_machi_a, { 0x3070 }
687 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
688 & ifmt_add, { 0x1060 }
690 /* mulhi $src1,$src2 */
693 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
694 & ifmt_cmp, { 0x3000 }
696 /* mulhi $src1,$src2,$acc */
699 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
700 & ifmt_machi_a, { 0x3000 }
702 /* mullo $src1,$src2 */
705 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
706 & ifmt_cmp, { 0x3010 }
708 /* mullo $src1,$src2,$acc */
711 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
712 & ifmt_machi_a, { 0x3010 }
714 /* mulwhi $src1,$src2 */
717 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
718 & ifmt_cmp, { 0x3020 }
720 /* mulwhi $src1,$src2,$acc */
723 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
724 & ifmt_machi_a, { 0x3020 }
726 /* mulwlo $src1,$src2 */
729 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
730 & ifmt_cmp, { 0x3030 }
732 /* mulwlo $src1,$src2,$acc */
735 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
736 & ifmt_machi_a, { 0x3030 }
741 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
742 & ifmt_add, { 0x1080 }
747 { { MNEM, ' ', OP (DR), 0 } },
748 & ifmt_mvfachi, { 0x50f0 }
750 /* mvfachi $dr,$accs */
753 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
754 & ifmt_mvfachi_a, { 0x50f0 }
759 { { MNEM, ' ', OP (DR), 0 } },
760 & ifmt_mvfachi, { 0x50f1 }
762 /* mvfaclo $dr,$accs */
765 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
766 & ifmt_mvfachi_a, { 0x50f1 }
771 { { MNEM, ' ', OP (DR), 0 } },
772 & ifmt_mvfachi, { 0x50f2 }
774 /* mvfacmi $dr,$accs */
777 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
778 & ifmt_mvfachi_a, { 0x50f2 }
783 { { MNEM, ' ', OP (DR), ',', OP (SCR), 0 } },
784 & ifmt_mvfc, { 0x1090 }
789 { { MNEM, ' ', OP (SRC1), 0 } },
790 & ifmt_mvtachi, { 0x5070 }
792 /* mvtachi $src1,$accs */
795 { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
796 & ifmt_mvtachi_a, { 0x5070 }
801 { { MNEM, ' ', OP (SRC1), 0 } },
802 & ifmt_mvtachi, { 0x5071 }
804 /* mvtaclo $src1,$accs */
807 { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
808 & ifmt_mvtachi_a, { 0x5071 }
813 { { MNEM, ' ', OP (SR), ',', OP (DCR), 0 } },
814 & ifmt_mvtc, { 0x10a0 }
819 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
826 & ifmt_nop, { 0x7000 }
831 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
838 & ifmt_nop, { 0x5090 }
840 /* rac $accd,$accs,$imm1 */
843 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
844 & ifmt_rac_dsi, { 0x5090 }
850 & ifmt_nop, { 0x5080 }
852 /* rach $accd,$accs,$imm1 */
855 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
856 & ifmt_rac_dsi, { 0x5080 }
862 & ifmt_nop, { 0x10d6 }
864 /* seth $dr,$hash$hi16 */
867 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (HI16), 0 } },
868 & ifmt_seth, { 0xd0c00000 }
873 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
874 & ifmt_add, { 0x1040 }
876 /* sll3 $dr,$sr,$simm16 */
879 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
880 & ifmt_addv3, { 0x90c00000 }
882 /* slli $dr,$uimm5 */
885 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
886 & ifmt_slli, { 0x5040 }
891 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
892 & ifmt_add, { 0x1020 }
894 /* sra3 $dr,$sr,$simm16 */
897 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
898 & ifmt_addv3, { 0x90a00000 }
900 /* srai $dr,$uimm5 */
903 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
904 & ifmt_slli, { 0x5020 }
909 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
910 & ifmt_add, { 0x1000 }
912 /* srl3 $dr,$sr,$simm16 */
915 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
916 & ifmt_addv3, { 0x90800000 }
918 /* srli $dr,$uimm5 */
921 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
922 & ifmt_slli, { 0x5000 }
924 /* st $src1,@$src2 */
927 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
928 & ifmt_cmp, { 0x2040 }
930 /* st $src1,@($slo16,$src2) */
933 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
934 & ifmt_st_d, { 0xa0400000 }
936 /* stb $src1,@$src2 */
939 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
940 & ifmt_cmp, { 0x2000 }
942 /* stb $src1,@($slo16,$src2) */
945 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
946 & ifmt_st_d, { 0xa0000000 }
948 /* sth $src1,@$src2 */
951 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
952 & ifmt_cmp, { 0x2020 }
954 /* sth $src1,@($slo16,$src2) */
957 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
958 & ifmt_st_d, { 0xa0200000 }
960 /* st $src1,@+$src2 */
963 { { MNEM, ' ', OP (SRC1), ',', '@', '+', OP (SRC2), 0 } },
964 & ifmt_cmp, { 0x2060 }
966 /* sth $src1,@$src2+ */
969 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), '+', 0 } },
970 & ifmt_cmp, { 0x2030 }
972 /* stb $src1,@$src2+ */
975 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), '+', 0 } },
976 & ifmt_cmp, { 0x2010 }
978 /* st $src1,@-$src2 */
981 { { MNEM, ' ', OP (SRC1), ',', '@', '-', OP (SRC2), 0 } },
982 & ifmt_cmp, { 0x2070 }
987 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
993 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
999 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
1000 & ifmt_add, { 0x10 }
1005 { { MNEM, ' ', OP (UIMM4), 0 } },
1006 & ifmt_trap, { 0x10f0 }
1008 /* unlock $src1,@$src2 */
1011 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
1012 & ifmt_cmp, { 0x2050 }
1017 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
1018 & ifmt_satb, { 0x80600300 }
1023 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
1024 & ifmt_satb, { 0x80600200 }
1029 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
1030 & ifmt_satb, { 0x80600000 }
1035 { { MNEM, ' ', OP (SRC2), 0 } },
1036 & ifmt_cmpz, { 0x370 }
1042 & ifmt_nop, { 0x50e4 }
1044 /* macwu1 $src1,$src2 */
1047 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
1048 & ifmt_cmp, { 0x50b0 }
1050 /* msblo $src1,$src2 */
1053 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
1054 & ifmt_cmp, { 0x50d0 }
1056 /* mulwu1 $src1,$src2 */
1059 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
1060 & ifmt_cmp, { 0x50a0 }
1062 /* maclh1 $src1,$src2 */
1065 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
1066 & ifmt_cmp, { 0x50c0 }
1072 & ifmt_nop, { 0x7401 }
1078 & ifmt_nop, { 0x7501 }
1083 { { MNEM, ' ', OP (UIMM8), 0 } },
1084 & ifmt_clrpsw, { 0x7200 }
1089 { { MNEM, ' ', OP (UIMM8), 0 } },
1090 & ifmt_clrpsw, { 0x7100 }
1092 /* bset $uimm3,@($slo16,$sr) */
1095 { { MNEM, ' ', OP (UIMM3), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
1096 & ifmt_bset, { 0xa0600000 }
1098 /* bclr $uimm3,@($slo16,$sr) */
1101 { { MNEM, ' ', OP (UIMM3), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
1102 & ifmt_bset, { 0xa0700000 }
1104 /* btst $uimm3,$sr */
1107 { { MNEM, ' ', OP (UIMM3), ',', OP (SR), 0 } },
1108 & ifmt_btst, { 0xf0 }
1117 /* Formats for ALIAS macro-insns. */
1119 #define F(f) & m32r_cgen_ifld_table[M32R_##f]
1120 static const CGEN_IFMT ifmt_bc8r ATTRIBUTE_UNUSED = {
1121 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1124 static const CGEN_IFMT ifmt_bc24r ATTRIBUTE_UNUSED = {
1125 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1128 static const CGEN_IFMT ifmt_bl8r ATTRIBUTE_UNUSED = {
1129 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1132 static const CGEN_IFMT ifmt_bl24r ATTRIBUTE_UNUSED = {
1133 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1136 static const CGEN_IFMT ifmt_bcl8r ATTRIBUTE_UNUSED = {
1137 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1140 static const CGEN_IFMT ifmt_bcl24r ATTRIBUTE_UNUSED = {
1141 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1144 static const CGEN_IFMT ifmt_bnc8r ATTRIBUTE_UNUSED = {
1145 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1148 static const CGEN_IFMT ifmt_bnc24r ATTRIBUTE_UNUSED = {
1149 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1152 static const CGEN_IFMT ifmt_bra8r ATTRIBUTE_UNUSED = {
1153 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1156 static const CGEN_IFMT ifmt_bra24r ATTRIBUTE_UNUSED = {
1157 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1160 static const CGEN_IFMT ifmt_bncl8r ATTRIBUTE_UNUSED = {
1161 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
1164 static const CGEN_IFMT ifmt_bncl24r ATTRIBUTE_UNUSED = {
1165 32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
1168 static const CGEN_IFMT ifmt_ld_2 ATTRIBUTE_UNUSED = {
1169 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1172 static const CGEN_IFMT ifmt_ld_d2 ATTRIBUTE_UNUSED = {
1173 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1176 static const CGEN_IFMT ifmt_ldb_2 ATTRIBUTE_UNUSED = {
1177 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1180 static const CGEN_IFMT ifmt_ldb_d2 ATTRIBUTE_UNUSED = {
1181 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1184 static const CGEN_IFMT ifmt_ldh_2 ATTRIBUTE_UNUSED = {
1185 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1188 static const CGEN_IFMT ifmt_ldh_d2 ATTRIBUTE_UNUSED = {
1189 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1192 static const CGEN_IFMT ifmt_ldub_2 ATTRIBUTE_UNUSED = {
1193 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1196 static const CGEN_IFMT ifmt_ldub_d2 ATTRIBUTE_UNUSED = {
1197 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1200 static const CGEN_IFMT ifmt_lduh_2 ATTRIBUTE_UNUSED = {
1201 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1204 static const CGEN_IFMT ifmt_lduh_d2 ATTRIBUTE_UNUSED = {
1205 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1208 static const CGEN_IFMT ifmt_pop ATTRIBUTE_UNUSED = {
1209 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
1212 static const CGEN_IFMT ifmt_ldi8a ATTRIBUTE_UNUSED = {
1213 16, 16, 0xf000, { { F (F_OP1) }, { F (F_R1) }, { F (F_SIMM8) }, { 0 } }
1216 static const CGEN_IFMT ifmt_ldi16a ATTRIBUTE_UNUSED = {
1217 32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_R1) }, { F (F_SIMM16) }, { 0 } }
1220 static const CGEN_IFMT ifmt_rac_d ATTRIBUTE_UNUSED = {
1221 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 } }
1224 static const CGEN_IFMT ifmt_rac_ds ATTRIBUTE_UNUSED = {
1225 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 } }
1228 static const CGEN_IFMT ifmt_rach_d ATTRIBUTE_UNUSED = {
1229 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 } }
1232 static const CGEN_IFMT ifmt_rach_ds ATTRIBUTE_UNUSED = {
1233 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 } }
1236 static const CGEN_IFMT ifmt_st_2 ATTRIBUTE_UNUSED = {
1237 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1240 static const CGEN_IFMT ifmt_st_d2 ATTRIBUTE_UNUSED = {
1241 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1244 static const CGEN_IFMT ifmt_stb_2 ATTRIBUTE_UNUSED = {
1245 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1248 static const CGEN_IFMT ifmt_stb_d2 ATTRIBUTE_UNUSED = {
1249 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1252 static const CGEN_IFMT ifmt_sth_2 ATTRIBUTE_UNUSED = {
1253 16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1256 static const CGEN_IFMT ifmt_sth_d2 ATTRIBUTE_UNUSED = {
1257 32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
1260 static const CGEN_IFMT ifmt_push ATTRIBUTE_UNUSED = {
1261 16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
1266 /* Each non-simple macro entry points to an array of expansion possibilities. */
1268 #define A(a) (1 << CGEN_INSN_##a)
1269 #define OPERAND(op) M32R_OPERAND_##op
1270 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
1271 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
1273 /* The macro instruction table. */
1275 static const CGEN_IBASE m32r_cgen_macro_insn_table[] =
1279 -1, "bc8r", "bc", 16,
1280 { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1284 -1, "bc24r", "bc", 32,
1285 { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1289 -1, "bl8r", "bl", 16,
1290 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1294 -1, "bl24r", "bl", 32,
1295 { 0|A(RELAXED)|A(UNCOND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1299 -1, "bcl8r", "bcl", 16,
1300 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_O, 0 } } } }
1304 -1, "bcl24r", "bcl", 32,
1305 { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_NONE, 0 } } } }
1309 -1, "bnc8r", "bnc", 16,
1310 { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1314 -1, "bnc24r", "bnc", 32,
1315 { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1319 -1, "bra8r", "bra", 16,
1320 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1324 -1, "bra24r", "bra", 32,
1325 { 0|A(RELAXED)|A(UNCOND_CTI)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1329 -1, "bncl8r", "bncl", 16,
1330 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_O, 0 } } } }
1334 -1, "bncl24r", "bncl", 32,
1335 { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_NONE, 0 } } } }
1339 -1, "ld-2", "ld", 16,
1340 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1342 /* ld $dr,@($sr,$slo16) */
1344 -1, "ld-d2", "ld", 32,
1345 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1347 /* ldb $dr,@($sr) */
1349 -1, "ldb-2", "ldb", 16,
1350 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1352 /* ldb $dr,@($sr,$slo16) */
1354 -1, "ldb-d2", "ldb", 32,
1355 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1357 /* ldh $dr,@($sr) */
1359 -1, "ldh-2", "ldh", 16,
1360 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1362 /* ldh $dr,@($sr,$slo16) */
1364 -1, "ldh-d2", "ldh", 32,
1365 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1367 /* ldub $dr,@($sr) */
1369 -1, "ldub-2", "ldub", 16,
1370 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1372 /* ldub $dr,@($sr,$slo16) */
1374 -1, "ldub-d2", "ldub", 32,
1375 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1377 /* lduh $dr,@($sr) */
1379 -1, "lduh-2", "lduh", 16,
1380 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1382 /* lduh $dr,@($sr,$slo16) */
1384 -1, "lduh-d2", "lduh", 32,
1385 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1389 -1, "pop", "pop", 16,
1390 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1392 /* ldi $dr,$simm8 */
1394 -1, "ldi8a", "ldi", 16,
1395 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_OS, 0 } } } }
1397 /* ldi $dr,$hash$slo16 */
1399 -1, "ldi16a", "ldi", 32,
1400 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1404 -1, "rac-d", "rac", 16,
1405 { 0|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_S, 0 } } } }
1407 /* rac $accd,$accs */
1409 -1, "rac-ds", "rac", 16,
1410 { 0|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_S, 0 } } } }
1414 -1, "rach-d", "rach", 16,
1415 { 0|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_S, 0 } } } }
1417 /* rach $accd,$accs */
1419 -1, "rach-ds", "rach", 16,
1420 { 0|A(ALIAS), { { { (1<<MACH_M32RX)|(1<<MACH_M32R2), 0 } }, { { PIPE_S, 0 } } } }
1422 /* st $src1,@($src2) */
1424 -1, "st-2", "st", 16,
1425 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1427 /* st $src1,@($src2,$slo16) */
1429 -1, "st-d2", "st", 32,
1430 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1432 /* stb $src1,@($src2) */
1434 -1, "stb-2", "stb", 16,
1435 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1437 /* stb $src1,@($src2,$slo16) */
1439 -1, "stb-d2", "stb", 32,
1440 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1442 /* sth $src1,@($src2) */
1444 -1, "sth-2", "sth", 16,
1445 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1447 /* sth $src1,@($src2,$slo16) */
1449 -1, "sth-d2", "sth", 32,
1450 { 0|A(NO_DIS)|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_NONE, 0 } } } }
1454 -1, "push", "push", 16,
1455 { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } }, { { PIPE_O, 0 } } } }
1459 /* The macro instruction opcode table. */
1461 static const CGEN_OPCODE m32r_cgen_macro_insn_opcode_table[] =
1466 { { MNEM, ' ', OP (DISP8), 0 } },
1467 & ifmt_bc8r, { 0x7c00 }
1472 { { MNEM, ' ', OP (DISP24), 0 } },
1473 & ifmt_bc24r, { 0xfc000000 }
1478 { { MNEM, ' ', OP (DISP8), 0 } },
1479 & ifmt_bl8r, { 0x7e00 }
1484 { { MNEM, ' ', OP (DISP24), 0 } },
1485 & ifmt_bl24r, { 0xfe000000 }
1490 { { MNEM, ' ', OP (DISP8), 0 } },
1491 & ifmt_bcl8r, { 0x7800 }
1496 { { MNEM, ' ', OP (DISP24), 0 } },
1497 & ifmt_bcl24r, { 0xf8000000 }
1502 { { MNEM, ' ', OP (DISP8), 0 } },
1503 & ifmt_bnc8r, { 0x7d00 }
1508 { { MNEM, ' ', OP (DISP24), 0 } },
1509 & ifmt_bnc24r, { 0xfd000000 }
1514 { { MNEM, ' ', OP (DISP8), 0 } },
1515 & ifmt_bra8r, { 0x7f00 }
1520 { { MNEM, ' ', OP (DISP24), 0 } },
1521 & ifmt_bra24r, { 0xff000000 }
1526 { { MNEM, ' ', OP (DISP8), 0 } },
1527 & ifmt_bncl8r, { 0x7900 }
1532 { { MNEM, ' ', OP (DISP24), 0 } },
1533 & ifmt_bncl24r, { 0xf9000000 }
1538 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1539 & ifmt_ld_2, { 0x20c0 }
1541 /* ld $dr,@($sr,$slo16) */
1544 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1545 & ifmt_ld_d2, { 0xa0c00000 }
1547 /* ldb $dr,@($sr) */
1550 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1551 & ifmt_ldb_2, { 0x2080 }
1553 /* ldb $dr,@($sr,$slo16) */
1556 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1557 & ifmt_ldb_d2, { 0xa0800000 }
1559 /* ldh $dr,@($sr) */
1562 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1563 & ifmt_ldh_2, { 0x20a0 }
1565 /* ldh $dr,@($sr,$slo16) */
1568 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1569 & ifmt_ldh_d2, { 0xa0a00000 }
1571 /* ldub $dr,@($sr) */
1574 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1575 & ifmt_ldub_2, { 0x2090 }
1577 /* ldub $dr,@($sr,$slo16) */
1580 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1581 & ifmt_ldub_d2, { 0xa0900000 }
1583 /* lduh $dr,@($sr) */
1586 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1587 & ifmt_lduh_2, { 0x20b0 }
1589 /* lduh $dr,@($sr,$slo16) */
1592 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1593 & ifmt_lduh_d2, { 0xa0b00000 }
1598 { { MNEM, ' ', OP (DR), 0 } },
1599 & ifmt_pop, { 0x20ef }
1601 /* ldi $dr,$simm8 */
1604 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
1605 & ifmt_ldi8a, { 0x6000 }
1607 /* ldi $dr,$hash$slo16 */
1610 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (SLO16), 0 } },
1611 & ifmt_ldi16a, { 0x90f00000 }
1616 { { MNEM, ' ', OP (ACCD), 0 } },
1617 & ifmt_rac_d, { 0x5090 }
1619 /* rac $accd,$accs */
1622 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
1623 & ifmt_rac_ds, { 0x5090 }
1628 { { MNEM, ' ', OP (ACCD), 0 } },
1629 & ifmt_rach_d, { 0x5080 }
1631 /* rach $accd,$accs */
1634 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
1635 & ifmt_rach_ds, { 0x5080 }
1637 /* st $src1,@($src2) */
1640 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1641 & ifmt_st_2, { 0x2040 }
1643 /* st $src1,@($src2,$slo16) */
1646 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1647 & ifmt_st_d2, { 0xa0400000 }
1649 /* stb $src1,@($src2) */
1652 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1653 & ifmt_stb_2, { 0x2000 }
1655 /* stb $src1,@($src2,$slo16) */
1658 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1659 & ifmt_stb_d2, { 0xa0000000 }
1661 /* sth $src1,@($src2) */
1664 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1665 & ifmt_sth_2, { 0x2020 }
1667 /* sth $src1,@($src2,$slo16) */
1670 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1671 & ifmt_sth_d2, { 0xa0200000 }
1676 { { MNEM, ' ', OP (SRC1), 0 } },
1677 & ifmt_push, { 0x207f }
1686 #ifndef CGEN_ASM_HASH_P
1687 #define CGEN_ASM_HASH_P(insn) 1
1690 #ifndef CGEN_DIS_HASH_P
1691 #define CGEN_DIS_HASH_P(insn) 1
1694 /* Return non-zero if INSN is to be added to the hash table.
1695 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
1698 asm_hash_insn_p (insn)
1699 const CGEN_INSN *insn ATTRIBUTE_UNUSED;
1701 return CGEN_ASM_HASH_P (insn);
1705 dis_hash_insn_p (insn)
1706 const CGEN_INSN *insn;
1708 /* If building the hash table and the NO-DIS attribute is present,
1710 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
1712 return CGEN_DIS_HASH_P (insn);
1715 #ifndef CGEN_ASM_HASH
1716 #define CGEN_ASM_HASH_SIZE 127
1717 #ifdef CGEN_MNEMONIC_OPERANDS
1718 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1720 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1724 /* It doesn't make much sense to provide a default here,
1725 but while this is under development we do.
1726 BUFFER is a pointer to the bytes of the insn, target order.
1727 VALUE is the first base_insn_bitsize bits as an int in host order. */
1729 #ifndef CGEN_DIS_HASH
1730 #define CGEN_DIS_HASH_SIZE 256
1731 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1734 /* The result is the hash value of the insn.
1735 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1738 asm_hash_insn (mnem)
1741 return CGEN_ASM_HASH (mnem);
1744 /* BUF is a pointer to the bytes of the insn, target order.
1745 VALUE is the first base_insn_bitsize bits as an int in host order. */
1748 dis_hash_insn (buf, value)
1749 const char * buf ATTRIBUTE_UNUSED;
1750 CGEN_INSN_INT value ATTRIBUTE_UNUSED;
1752 return CGEN_DIS_HASH (buf, value);
1755 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1758 set_fields_bitsize (CGEN_FIELDS *fields, int size)
1760 CGEN_FIELDS_BITSIZE (fields) = size;
1763 /* Function to call before using the operand instance table.
1764 This plugs the opcode entries and macro instructions into the cpu table. */
1767 m32r_cgen_init_opcode_table (CGEN_CPU_DESC cd)
1770 int num_macros = (sizeof (m32r_cgen_macro_insn_table) /
1771 sizeof (m32r_cgen_macro_insn_table[0]));
1772 const CGEN_IBASE *ib = & m32r_cgen_macro_insn_table[0];
1773 const CGEN_OPCODE *oc = & m32r_cgen_macro_insn_opcode_table[0];
1774 CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
1776 /* This test has been added to avoid a warning generated
1777 if memset is called with a third argument of value zero. */
1778 if (num_macros >= 1)
1779 memset (insns, 0, num_macros * sizeof (CGEN_INSN));
1780 for (i = 0; i < num_macros; ++i)
1782 insns[i].base = &ib[i];
1783 insns[i].opcode = &oc[i];
1784 m32r_cgen_build_insn_regex (& insns[i]);
1786 cd->macro_insn_table.init_entries = insns;
1787 cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
1788 cd->macro_insn_table.num_init_entries = num_macros;
1790 oc = & m32r_cgen_insn_opcode_table[0];
1791 insns = (CGEN_INSN *) cd->insn_table.init_entries;
1792 for (i = 0; i < MAX_INSNS; ++i)
1794 insns[i].opcode = &oc[i];
1795 m32r_cgen_build_insn_regex (& insns[i]);
1798 cd->sizeof_fields = sizeof (CGEN_FIELDS);
1799 cd->set_fields_bitsize = set_fields_bitsize;
1801 cd->asm_hash_p = asm_hash_insn_p;
1802 cd->asm_hash = asm_hash_insn;
1803 cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
1805 cd->dis_hash_p = dis_hash_insn_p;
1806 cd->dis_hash = dis_hash_insn;
1807 cd->dis_hash_size = CGEN_DIS_HASH_SIZE;