1 /* Instruction opcode table for m32r.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 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)
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.
29 #include "m32r-desc.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]
46 #define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
48 static const CGEN_IFMT ifmt_empty
= {
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 } }
178 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
179 #define A(a) (1 << CGEN_INSN_##a)
181 #define A(a) (1 << CGEN_INSN_/**/a)
183 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
184 #define OPERAND(op) M32R_OPERAND_##op
186 #define OPERAND(op) M32R_OPERAND_/**/op
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}},
202 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
205 /* add3 $dr,$sr,$hash$slo16 */
208 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (HASH
), OP (SLO16
), 0 } },
209 & ifmt_add3
, { 0x80a00000 }
214 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
217 /* and3 $dr,$sr,$uimm16 */
220 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (UIMM16
), 0 } },
221 & ifmt_and3
, { 0x80c00000 }
226 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
229 /* or3 $dr,$sr,$hash$ulo16 */
232 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (HASH
), OP (ULO16
), 0 } },
233 & ifmt_or3
, { 0x80e00000 }
238 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
241 /* xor3 $dr,$sr,$uimm16 */
244 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (UIMM16
), 0 } },
245 & ifmt_and3
, { 0x80d00000 }
247 /* addi $dr,$simm8 */
250 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
251 & ifmt_addi
, { 0x4000 }
256 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
259 /* addv3 $dr,$sr,$simm16 */
262 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
263 & ifmt_addv3
, { 0x80800000 }
268 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
274 { { MNEM
, ' ', OP (DISP8
), 0 } },
275 & ifmt_bc8
, { 0x7c00 }
280 { { MNEM
, ' ', OP (DISP24
), 0 } },
281 & ifmt_bc24
, { 0xfc000000 }
283 /* beq $src1,$src2,$disp16 */
286 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (DISP16
), 0 } },
287 & ifmt_beq
, { 0xb0000000 }
289 /* beqz $src2,$disp16 */
292 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
293 & ifmt_beqz
, { 0xb0800000 }
295 /* bgez $src2,$disp16 */
298 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
299 & ifmt_beqz
, { 0xb0b00000 }
301 /* bgtz $src2,$disp16 */
304 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
305 & ifmt_beqz
, { 0xb0d00000 }
307 /* blez $src2,$disp16 */
310 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
311 & ifmt_beqz
, { 0xb0c00000 }
313 /* bltz $src2,$disp16 */
316 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
317 & ifmt_beqz
, { 0xb0a00000 }
319 /* bnez $src2,$disp16 */
322 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
323 & ifmt_beqz
, { 0xb0900000 }
328 { { MNEM
, ' ', OP (DISP8
), 0 } },
329 & ifmt_bc8
, { 0x7e00 }
334 { { MNEM
, ' ', OP (DISP24
), 0 } },
335 & ifmt_bc24
, { 0xfe000000 }
340 { { MNEM
, ' ', OP (DISP8
), 0 } },
341 & ifmt_bc8
, { 0x7800 }
346 { { MNEM
, ' ', OP (DISP24
), 0 } },
347 & ifmt_bc24
, { 0xf8000000 }
352 { { MNEM
, ' ', OP (DISP8
), 0 } },
353 & ifmt_bc8
, { 0x7d00 }
358 { { MNEM
, ' ', OP (DISP24
), 0 } },
359 & ifmt_bc24
, { 0xfd000000 }
361 /* bne $src1,$src2,$disp16 */
364 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (DISP16
), 0 } },
365 & ifmt_beq
, { 0xb0100000 }
370 { { MNEM
, ' ', OP (DISP8
), 0 } },
371 & ifmt_bc8
, { 0x7f00 }
376 { { MNEM
, ' ', OP (DISP24
), 0 } },
377 & ifmt_bc24
, { 0xff000000 }
382 { { MNEM
, ' ', OP (DISP8
), 0 } },
383 & ifmt_bc8
, { 0x7900 }
388 { { MNEM
, ' ', OP (DISP24
), 0 } },
389 & ifmt_bc24
, { 0xf9000000 }
391 /* cmp $src1,$src2 */
394 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
397 /* cmpi $src2,$simm16 */
400 { { MNEM
, ' ', OP (SRC2
), ',', OP (SIMM16
), 0 } },
401 & ifmt_cmpi
, { 0x80400000 }
403 /* cmpu $src1,$src2 */
406 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
409 /* cmpui $src2,$simm16 */
412 { { MNEM
, ' ', OP (SRC2
), ',', OP (SIMM16
), 0 } },
413 & ifmt_cmpi
, { 0x80500000 }
415 /* cmpeq $src1,$src2 */
418 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
424 { { MNEM
, ' ', OP (SRC2
), 0 } },
425 & ifmt_cmpz
, { 0x70 }
430 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
431 & ifmt_div
, { 0x90000000 }
436 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
437 & ifmt_div
, { 0x90100000 }
442 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
443 & ifmt_div
, { 0x90200000 }
448 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
449 & ifmt_div
, { 0x90300000 }
454 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
455 & ifmt_div
, { 0x90000010 }
460 { { MNEM
, ' ', OP (SR
), 0 } },
461 & ifmt_jc
, { 0x1cc0 }
466 { { MNEM
, ' ', OP (SR
), 0 } },
467 & ifmt_jc
, { 0x1dc0 }
472 { { MNEM
, ' ', OP (SR
), 0 } },
473 & ifmt_jc
, { 0x1ec0 }
478 { { MNEM
, ' ', OP (SR
), 0 } },
479 & ifmt_jc
, { 0x1fc0 }
484 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
485 & ifmt_add
, { 0x20c0 }
487 /* ld $dr,@($slo16,$sr) */
490 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
491 & ifmt_add3
, { 0xa0c00000 }
496 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
497 & ifmt_add
, { 0x2080 }
499 /* ldb $dr,@($slo16,$sr) */
502 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
503 & ifmt_add3
, { 0xa0800000 }
508 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
509 & ifmt_add
, { 0x20a0 }
511 /* ldh $dr,@($slo16,$sr) */
514 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
515 & ifmt_add3
, { 0xa0a00000 }
520 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
521 & ifmt_add
, { 0x2090 }
523 /* ldub $dr,@($slo16,$sr) */
526 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
527 & ifmt_add3
, { 0xa0900000 }
532 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
533 & ifmt_add
, { 0x20b0 }
535 /* lduh $dr,@($slo16,$sr) */
538 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
539 & ifmt_add3
, { 0xa0b00000 }
544 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), '+', 0 } },
545 & ifmt_add
, { 0x20e0 }
547 /* ld24 $dr,$uimm24 */
550 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM24
), 0 } },
551 & ifmt_ld24
, { 0xe0000000 }
553 /* ldi8 $dr,$simm8 */
556 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
557 & ifmt_addi
, { 0x6000 }
559 /* ldi16 $dr,$hash$slo16 */
562 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (SLO16
), 0 } },
563 & ifmt_ldi16
, { 0x90f00000 }
568 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
569 & ifmt_add
, { 0x20d0 }
571 /* machi $src1,$src2 */
574 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
575 & ifmt_cmp
, { 0x3040 }
577 /* machi $src1,$src2,$acc */
580 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
581 & ifmt_machi_a
, { 0x3040 }
583 /* maclo $src1,$src2 */
586 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
587 & ifmt_cmp
, { 0x3050 }
589 /* maclo $src1,$src2,$acc */
592 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
593 & ifmt_machi_a
, { 0x3050 }
595 /* macwhi $src1,$src2 */
598 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
599 & ifmt_cmp
, { 0x3060 }
601 /* macwhi $src1,$src2,$acc */
604 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
605 & ifmt_machi_a
, { 0x3060 }
607 /* macwlo $src1,$src2 */
610 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
611 & ifmt_cmp
, { 0x3070 }
613 /* macwlo $src1,$src2,$acc */
616 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
617 & ifmt_machi_a
, { 0x3070 }
622 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
623 & ifmt_add
, { 0x1060 }
625 /* mulhi $src1,$src2 */
628 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
629 & ifmt_cmp
, { 0x3000 }
631 /* mulhi $src1,$src2,$acc */
634 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
635 & ifmt_machi_a
, { 0x3000 }
637 /* mullo $src1,$src2 */
640 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
641 & ifmt_cmp
, { 0x3010 }
643 /* mullo $src1,$src2,$acc */
646 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
647 & ifmt_machi_a
, { 0x3010 }
649 /* mulwhi $src1,$src2 */
652 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
653 & ifmt_cmp
, { 0x3020 }
655 /* mulwhi $src1,$src2,$acc */
658 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
659 & ifmt_machi_a
, { 0x3020 }
661 /* mulwlo $src1,$src2 */
664 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
665 & ifmt_cmp
, { 0x3030 }
667 /* mulwlo $src1,$src2,$acc */
670 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
671 & ifmt_machi_a
, { 0x3030 }
676 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
677 & ifmt_add
, { 0x1080 }
682 { { MNEM
, ' ', OP (DR
), 0 } },
683 & ifmt_mvfachi
, { 0x50f0 }
685 /* mvfachi $dr,$accs */
688 { { MNEM
, ' ', OP (DR
), ',', OP (ACCS
), 0 } },
689 & ifmt_mvfachi_a
, { 0x50f0 }
694 { { MNEM
, ' ', OP (DR
), 0 } },
695 & ifmt_mvfachi
, { 0x50f1 }
697 /* mvfaclo $dr,$accs */
700 { { MNEM
, ' ', OP (DR
), ',', OP (ACCS
), 0 } },
701 & ifmt_mvfachi_a
, { 0x50f1 }
706 { { MNEM
, ' ', OP (DR
), 0 } },
707 & ifmt_mvfachi
, { 0x50f2 }
709 /* mvfacmi $dr,$accs */
712 { { MNEM
, ' ', OP (DR
), ',', OP (ACCS
), 0 } },
713 & ifmt_mvfachi_a
, { 0x50f2 }
718 { { MNEM
, ' ', OP (DR
), ',', OP (SCR
), 0 } },
719 & ifmt_mvfc
, { 0x1090 }
724 { { MNEM
, ' ', OP (SRC1
), 0 } },
725 & ifmt_mvtachi
, { 0x5070 }
727 /* mvtachi $src1,$accs */
730 { { MNEM
, ' ', OP (SRC1
), ',', OP (ACCS
), 0 } },
731 & ifmt_mvtachi_a
, { 0x5070 }
736 { { MNEM
, ' ', OP (SRC1
), 0 } },
737 & ifmt_mvtachi
, { 0x5071 }
739 /* mvtaclo $src1,$accs */
742 { { MNEM
, ' ', OP (SRC1
), ',', OP (ACCS
), 0 } },
743 & ifmt_mvtachi_a
, { 0x5071 }
748 { { MNEM
, ' ', OP (SR
), ',', OP (DCR
), 0 } },
749 & ifmt_mvtc
, { 0x10a0 }
754 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
761 & ifmt_nop
, { 0x7000 }
766 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
773 & ifmt_nop
, { 0x5090 }
775 /* rac $accd,$accs,$imm1 */
778 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), ',', OP (IMM1
), 0 } },
779 & ifmt_rac_dsi
, { 0x5090 }
785 & ifmt_nop
, { 0x5080 }
787 /* rach $accd,$accs,$imm1 */
790 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), ',', OP (IMM1
), 0 } },
791 & ifmt_rac_dsi
, { 0x5080 }
797 & ifmt_nop
, { 0x10d6 }
799 /* seth $dr,$hash$hi16 */
802 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (HI16
), 0 } },
803 & ifmt_seth
, { 0xd0c00000 }
808 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
809 & ifmt_add
, { 0x1040 }
811 /* sll3 $dr,$sr,$simm16 */
814 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
815 & ifmt_addv3
, { 0x90c00000 }
817 /* slli $dr,$uimm5 */
820 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
821 & ifmt_slli
, { 0x5040 }
826 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
827 & ifmt_add
, { 0x1020 }
829 /* sra3 $dr,$sr,$simm16 */
832 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
833 & ifmt_addv3
, { 0x90a00000 }
835 /* srai $dr,$uimm5 */
838 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
839 & ifmt_slli
, { 0x5020 }
844 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
845 & ifmt_add
, { 0x1000 }
847 /* srl3 $dr,$sr,$simm16 */
850 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
851 & ifmt_addv3
, { 0x90800000 }
853 /* srli $dr,$uimm5 */
856 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
857 & ifmt_slli
, { 0x5000 }
859 /* st $src1,@$src2 */
862 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
863 & ifmt_cmp
, { 0x2040 }
865 /* st $src1,@($slo16,$src2) */
868 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
869 & ifmt_st_d
, { 0xa0400000 }
871 /* stb $src1,@$src2 */
874 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
875 & ifmt_cmp
, { 0x2000 }
877 /* stb $src1,@($slo16,$src2) */
880 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
881 & ifmt_st_d
, { 0xa0000000 }
883 /* sth $src1,@$src2 */
886 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
887 & ifmt_cmp
, { 0x2020 }
889 /* sth $src1,@($slo16,$src2) */
892 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
893 & ifmt_st_d
, { 0xa0200000 }
895 /* st $src1,@+$src2 */
898 { { MNEM
, ' ', OP (SRC1
), ',', '@', '+', OP (SRC2
), 0 } },
899 & ifmt_cmp
, { 0x2060 }
901 /* st $src1,@-$src2 */
904 { { MNEM
, ' ', OP (SRC1
), ',', '@', '-', OP (SRC2
), 0 } },
905 & ifmt_cmp
, { 0x2070 }
910 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
916 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
922 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
928 { { MNEM
, ' ', OP (UIMM4
), 0 } },
929 & ifmt_trap
, { 0x10f0 }
931 /* unlock $src1,@$src2 */
934 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
935 & ifmt_cmp
, { 0x2050 }
940 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
941 & ifmt_satb
, { 0x80600300 }
946 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
947 & ifmt_satb
, { 0x80600200 }
952 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
953 & ifmt_satb
, { 0x80600000 }
958 { { MNEM
, ' ', OP (SRC2
), 0 } },
959 & ifmt_cmpz
, { 0x370 }
965 & ifmt_nop
, { 0x50e4 }
967 /* macwu1 $src1,$src2 */
970 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
971 & ifmt_cmp
, { 0x50b0 }
973 /* msblo $src1,$src2 */
976 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
977 & ifmt_cmp
, { 0x50d0 }
979 /* mulwu1 $src1,$src2 */
982 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
983 & ifmt_cmp
, { 0x50a0 }
985 /* maclh1 $src1,$src2 */
988 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
989 & ifmt_cmp
, { 0x50c0 }
995 & ifmt_nop
, { 0x7401 }
1001 & ifmt_nop
, { 0x7501 }
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]
1015 #define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
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 } }
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)
1168 #define A(a) (1 << CGEN_INSN_/**/a)
1170 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1171 #define OPERAND(op) M32R_OPERAND_##op
1173 #define OPERAND(op) M32R_OPERAND_/**/op
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
[] =
1184 -1, "bc8r", "bc", 16,
1185 { 0|A(RELAXABLE
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1189 -1, "bc24r", "bc", 32,
1190 { 0|A(RELAX
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1194 -1, "bl8r", "bl", 16,
1195 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1199 -1, "bl24r", "bl", 32,
1200 { 0|A(RELAX
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1204 -1, "bcl8r", "bcl", 16,
1205 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
), PIPE_O
} }
1209 -1, "bcl24r", "bcl", 32,
1210 { 0|A(RELAX
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
), PIPE_NONE
} }
1214 -1, "bnc8r", "bnc", 16,
1215 { 0|A(RELAXABLE
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1219 -1, "bnc24r", "bnc", 32,
1220 { 0|A(RELAX
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1224 -1, "bra8r", "bra", 16,
1225 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1229 -1, "bra24r", "bra", 32,
1230 { 0|A(RELAX
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1234 -1, "bncl8r", "bncl", 16,
1235 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
), PIPE_O
} }
1239 -1, "bncl24r", "bncl", 32,
1240 { 0|A(RELAX
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
), PIPE_NONE
} }
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
} }
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
} }
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
} }
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
} }
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
[] =
1371 { { MNEM
, ' ', OP (DISP8
), 0 } },
1372 & ifmt_bc8r
, { 0x7c00 }
1377 { { MNEM
, ' ', OP (DISP24
), 0 } },
1378 & ifmt_bc24r
, { 0xfc000000 }
1383 { { MNEM
, ' ', OP (DISP8
), 0 } },
1384 & ifmt_bl8r
, { 0x7e00 }
1389 { { MNEM
, ' ', OP (DISP24
), 0 } },
1390 & ifmt_bl24r
, { 0xfe000000 }
1395 { { MNEM
, ' ', OP (DISP8
), 0 } },
1396 & ifmt_bcl8r
, { 0x7800 }
1401 { { MNEM
, ' ', OP (DISP24
), 0 } },
1402 & ifmt_bcl24r
, { 0xf8000000 }
1407 { { MNEM
, ' ', OP (DISP8
), 0 } },
1408 & ifmt_bnc8r
, { 0x7d00 }
1413 { { MNEM
, ' ', OP (DISP24
), 0 } },
1414 & ifmt_bnc24r
, { 0xfd000000 }
1419 { { MNEM
, ' ', OP (DISP8
), 0 } },
1420 & ifmt_bra8r
, { 0x7f00 }
1425 { { MNEM
, ' ', OP (DISP24
), 0 } },
1426 & ifmt_bra24r
, { 0xff000000 }
1431 { { MNEM
, ' ', OP (DISP8
), 0 } },
1432 & ifmt_bncl8r
, { 0x7900 }
1437 { { MNEM
, ' ', OP (DISP24
), 0 } },
1438 & ifmt_bncl24r
, { 0xf9000000 }
1443 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1444 & ifmt_ld_2
, { 0x20c0 }
1446 /* ld $dr,@($sr,$slo16) */
1449 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1450 & ifmt_ld_d2
, { 0xa0c00000 }
1452 /* ldb $dr,@($sr) */
1455 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1456 & ifmt_ldb_2
, { 0x2080 }
1458 /* ldb $dr,@($sr,$slo16) */
1461 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1462 & ifmt_ldb_d2
, { 0xa0800000 }
1464 /* ldh $dr,@($sr) */
1467 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1468 & ifmt_ldh_2
, { 0x20a0 }
1470 /* ldh $dr,@($sr,$slo16) */
1473 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1474 & ifmt_ldh_d2
, { 0xa0a00000 }
1476 /* ldub $dr,@($sr) */
1479 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1480 & ifmt_ldub_2
, { 0x2090 }
1482 /* ldub $dr,@($sr,$slo16) */
1485 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1486 & ifmt_ldub_d2
, { 0xa0900000 }
1488 /* lduh $dr,@($sr) */
1491 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1492 & ifmt_lduh_2
, { 0x20b0 }
1494 /* lduh $dr,@($sr,$slo16) */
1497 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1498 & ifmt_lduh_d2
, { 0xa0b00000 }
1503 { { MNEM
, ' ', OP (DR
), 0 } },
1504 & ifmt_pop
, { 0x20ef }
1506 /* ldi $dr,$simm8 */
1509 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
1510 & ifmt_ldi8a
, { 0x6000 }
1512 /* ldi $dr,$hash$slo16 */
1515 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (SLO16
), 0 } },
1516 & ifmt_ldi16a
, { 0x90f00000 }
1521 { { MNEM
, ' ', OP (ACCD
), 0 } },
1522 & ifmt_rac_d
, { 0x5090 }
1524 /* rac $accd,$accs */
1527 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), 0 } },
1528 & ifmt_rac_ds
, { 0x5090 }
1533 { { MNEM
, ' ', OP (ACCD
), 0 } },
1534 & ifmt_rach_d
, { 0x5080 }
1536 /* rach $accd,$accs */
1539 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), 0 } },
1540 & ifmt_rach_ds
, { 0x5080 }
1542 /* st $src1,@($src2) */
1545 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1546 & ifmt_st_2
, { 0x2040 }
1548 /* st $src1,@($src2,$slo16) */
1551 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1552 & ifmt_st_d2
, { 0xa0400000 }
1554 /* stb $src1,@($src2) */
1557 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1558 & ifmt_stb_2
, { 0x2000 }
1560 /* stb $src1,@($src2,$slo16) */
1563 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1564 & ifmt_stb_d2
, { 0xa0000000 }
1566 /* sth $src1,@($src2) */
1569 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1570 & ifmt_sth_2
, { 0x2020 }
1572 /* sth $src1,@($src2,$slo16) */
1575 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1576 & ifmt_sth_d2
, { 0xa0200000 }
1581 { { MNEM
, ' ', OP (SRC1
), 0 } },
1582 & ifmt_push
, { 0x207f }
1591 #ifndef CGEN_ASM_HASH_P
1592 #define CGEN_ASM_HASH_P(insn) 1
1595 #ifndef CGEN_DIS_HASH_P
1596 #define CGEN_DIS_HASH_P(insn) 1
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. */
1603 asm_hash_insn_p (insn
)
1604 const CGEN_INSN
*insn ATTRIBUTE_UNUSED
;
1606 return CGEN_ASM_HASH_P (insn
);
1610 dis_hash_insn_p (insn
)
1611 const CGEN_INSN
*insn
;
1613 /* If building the hash table and the NO-DIS attribute is present,
1615 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_NO_DIS
))
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)
1625 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
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))
1639 /* The result is the hash value of the insn.
1640 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1643 asm_hash_insn (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. */
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. */
1665 set_fields_bitsize (fields
, size
)
1666 CGEN_FIELDS
*fields
;
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. */
1676 m32r_cgen_init_opcode_table (cd
)
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
;