1 /* Instruction opcode table for m32r.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 1996, 1997, 1998, 1999 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"
32 /* The hash functions are recorded here to help keep assembler code out of
33 the disassembler and vice versa. */
35 static int asm_hash_insn_p
PARAMS ((const CGEN_INSN
*));
36 static unsigned int asm_hash_insn
PARAMS ((const char *));
37 static int dis_hash_insn_p
PARAMS ((const CGEN_INSN
*));
38 static unsigned int dis_hash_insn
PARAMS ((const char *, CGEN_INSN_INT
));
40 /* Instruction formats. */
42 #define F(f) & m32r_cgen_ifld_table[CONCAT2 (M32R_,f)]
44 static const CGEN_IFMT ifmt_empty
= {
48 static const CGEN_IFMT ifmt_add
= {
49 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
52 static const CGEN_IFMT ifmt_add3
= {
53 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
56 static const CGEN_IFMT ifmt_and3
= {
57 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_UIMM16
), 0 }
60 static const CGEN_IFMT ifmt_or3
= {
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_addi
= {
65 16, 16, 0xf000, { F (F_OP1
), F (F_R1
), F (F_SIMM8
), 0 }
68 static const CGEN_IFMT ifmt_addv3
= {
69 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
72 static const CGEN_IFMT ifmt_bc8
= {
73 16, 16, 0xff00, { F (F_OP1
), F (F_R1
), F (F_DISP8
), 0 }
76 static const CGEN_IFMT ifmt_bc24
= {
77 32, 32, 0xff000000, { F (F_OP1
), F (F_R1
), F (F_DISP24
), 0 }
80 static const CGEN_IFMT ifmt_beq
= {
81 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_DISP16
), 0 }
84 static const CGEN_IFMT ifmt_beqz
= {
85 32, 32, 0xfff00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_DISP16
), 0 }
88 static const CGEN_IFMT ifmt_cmp
= {
89 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
92 static const CGEN_IFMT ifmt_cmpi
= {
93 32, 32, 0xfff00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
96 static const CGEN_IFMT ifmt_div
= {
97 32, 32, 0xf0f0ffff, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
100 static const CGEN_IFMT ifmt_jl
= {
101 16, 16, 0xfff0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
104 static const CGEN_IFMT ifmt_ld24
= {
105 32, 32, 0xf0000000, { F (F_OP1
), F (F_R1
), F (F_UIMM24
), 0 }
108 static const CGEN_IFMT ifmt_ldi16
= {
109 32, 32, 0xf0ff0000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
112 static const CGEN_IFMT ifmt_mvfachi
= {
113 16, 16, 0xf0ff, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
116 static const CGEN_IFMT ifmt_mvfc
= {
117 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
120 static const CGEN_IFMT ifmt_mvtachi
= {
121 16, 16, 0xf0ff, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
124 static const CGEN_IFMT ifmt_mvtc
= {
125 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
128 static const CGEN_IFMT ifmt_nop
= {
129 16, 16, 0xffff, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
132 static const CGEN_IFMT ifmt_seth
= {
133 32, 32, 0xf0ff0000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_HI16
), 0 }
136 static const CGEN_IFMT ifmt_slli
= {
137 16, 16, 0xf0e0, { F (F_OP1
), F (F_R1
), F (F_SHIFT_OP2
), F (F_UIMM5
), 0 }
140 static const CGEN_IFMT ifmt_st_d
= {
141 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
144 static const CGEN_IFMT ifmt_trap
= {
145 16, 16, 0xfff0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_UIMM4
), 0 }
150 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
151 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
152 #define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
153 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
155 /* The instruction table. */
157 static const CGEN_OPCODE m32r_cgen_insn_opcode_table
[MAX_INSNS
] =
159 /* Special null first entry.
160 A `num' value of zero is thus invalid.
161 Also, the special `invalid' insn resides here. */
166 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
169 /* add3 $dr,$sr,$hash$slo16 */
172 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (HASH
), OP (SLO16
), 0 } },
173 & ifmt_add3
, { 0x80a00000 }
178 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
181 /* and3 $dr,$sr,$uimm16 */
184 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (UIMM16
), 0 } },
185 & ifmt_and3
, { 0x80c00000 }
190 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
193 /* or3 $dr,$sr,$hash$ulo16 */
196 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (HASH
), OP (ULO16
), 0 } },
197 & ifmt_or3
, { 0x80e00000 }
202 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
205 /* xor3 $dr,$sr,$uimm16 */
208 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (UIMM16
), 0 } },
209 & ifmt_and3
, { 0x80d00000 }
211 /* addi $dr,$simm8 */
214 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
215 & ifmt_addi
, { 0x4000 }
220 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
223 /* addv3 $dr,$sr,$simm16 */
226 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
227 & ifmt_addv3
, { 0x80800000 }
232 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
238 { { MNEM
, ' ', OP (DISP8
), 0 } },
239 & ifmt_bc8
, { 0x7c00 }
244 { { MNEM
, ' ', OP (DISP24
), 0 } },
245 & ifmt_bc24
, { 0xfc000000 }
247 /* beq $src1,$src2,$disp16 */
250 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (DISP16
), 0 } },
251 & ifmt_beq
, { 0xb0000000 }
253 /* beqz $src2,$disp16 */
256 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
257 & ifmt_beqz
, { 0xb0800000 }
259 /* bgez $src2,$disp16 */
262 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
263 & ifmt_beqz
, { 0xb0b00000 }
265 /* bgtz $src2,$disp16 */
268 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
269 & ifmt_beqz
, { 0xb0d00000 }
271 /* blez $src2,$disp16 */
274 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
275 & ifmt_beqz
, { 0xb0c00000 }
277 /* bltz $src2,$disp16 */
280 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
281 & ifmt_beqz
, { 0xb0a00000 }
283 /* bnez $src2,$disp16 */
286 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
287 & ifmt_beqz
, { 0xb0900000 }
292 { { MNEM
, ' ', OP (DISP8
), 0 } },
293 & ifmt_bc8
, { 0x7e00 }
298 { { MNEM
, ' ', OP (DISP24
), 0 } },
299 & ifmt_bc24
, { 0xfe000000 }
304 { { MNEM
, ' ', OP (DISP8
), 0 } },
305 & ifmt_bc8
, { 0x7d00 }
310 { { MNEM
, ' ', OP (DISP24
), 0 } },
311 & ifmt_bc24
, { 0xfd000000 }
313 /* bne $src1,$src2,$disp16 */
316 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (DISP16
), 0 } },
317 & ifmt_beq
, { 0xb0100000 }
322 { { MNEM
, ' ', OP (DISP8
), 0 } },
323 & ifmt_bc8
, { 0x7f00 }
328 { { MNEM
, ' ', OP (DISP24
), 0 } },
329 & ifmt_bc24
, { 0xff000000 }
331 /* cmp $src1,$src2 */
334 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
337 /* cmpi $src2,$simm16 */
340 { { MNEM
, ' ', OP (SRC2
), ',', OP (SIMM16
), 0 } },
341 & ifmt_cmpi
, { 0x80400000 }
343 /* cmpu $src1,$src2 */
346 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
349 /* cmpui $src2,$simm16 */
352 { { MNEM
, ' ', OP (SRC2
), ',', OP (SIMM16
), 0 } },
353 & ifmt_cmpi
, { 0x80500000 }
358 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
359 & ifmt_div
, { 0x90000000 }
364 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
365 & ifmt_div
, { 0x90100000 }
370 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
371 & ifmt_div
, { 0x90200000 }
376 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
377 & ifmt_div
, { 0x90300000 }
382 { { MNEM
, ' ', OP (SR
), 0 } },
383 & ifmt_jl
, { 0x1ec0 }
388 { { MNEM
, ' ', OP (SR
), 0 } },
389 & ifmt_jl
, { 0x1fc0 }
394 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
395 & ifmt_add
, { 0x20c0 }
397 /* ld $dr,@($slo16,$sr) */
400 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
401 & ifmt_add3
, { 0xa0c00000 }
406 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
407 & ifmt_add
, { 0x2080 }
409 /* ldb $dr,@($slo16,$sr) */
412 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
413 & ifmt_add3
, { 0xa0800000 }
418 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
419 & ifmt_add
, { 0x20a0 }
421 /* ldh $dr,@($slo16,$sr) */
424 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
425 & ifmt_add3
, { 0xa0a00000 }
430 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
431 & ifmt_add
, { 0x2090 }
433 /* ldub $dr,@($slo16,$sr) */
436 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
437 & ifmt_add3
, { 0xa0900000 }
442 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
443 & ifmt_add
, { 0x20b0 }
445 /* lduh $dr,@($slo16,$sr) */
448 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
449 & ifmt_add3
, { 0xa0b00000 }
454 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), '+', 0 } },
455 & ifmt_add
, { 0x20e0 }
457 /* ld24 $dr,$uimm24 */
460 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM24
), 0 } },
461 & ifmt_ld24
, { 0xe0000000 }
463 /* ldi8 $dr,$simm8 */
466 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
467 & ifmt_addi
, { 0x6000 }
469 /* ldi16 $dr,$hash$slo16 */
472 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (SLO16
), 0 } },
473 & ifmt_ldi16
, { 0x90f00000 }
478 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
479 & ifmt_add
, { 0x20d0 }
481 /* machi $src1,$src2 */
484 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
485 & ifmt_cmp
, { 0x3040 }
487 /* maclo $src1,$src2 */
490 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
491 & ifmt_cmp
, { 0x3050 }
493 /* macwhi $src1,$src2 */
496 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
497 & ifmt_cmp
, { 0x3060 }
499 /* macwlo $src1,$src2 */
502 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
503 & ifmt_cmp
, { 0x3070 }
508 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
509 & ifmt_add
, { 0x1060 }
511 /* mulhi $src1,$src2 */
514 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
515 & ifmt_cmp
, { 0x3000 }
517 /* mullo $src1,$src2 */
520 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
521 & ifmt_cmp
, { 0x3010 }
523 /* mulwhi $src1,$src2 */
526 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
527 & ifmt_cmp
, { 0x3020 }
529 /* mulwlo $src1,$src2 */
532 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
533 & ifmt_cmp
, { 0x3030 }
538 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
539 & ifmt_add
, { 0x1080 }
544 { { MNEM
, ' ', OP (DR
), 0 } },
545 & ifmt_mvfachi
, { 0x50f0 }
550 { { MNEM
, ' ', OP (DR
), 0 } },
551 & ifmt_mvfachi
, { 0x50f1 }
556 { { MNEM
, ' ', OP (DR
), 0 } },
557 & ifmt_mvfachi
, { 0x50f2 }
562 { { MNEM
, ' ', OP (DR
), ',', OP (SCR
), 0 } },
563 & ifmt_mvfc
, { 0x1090 }
568 { { MNEM
, ' ', OP (SRC1
), 0 } },
569 & ifmt_mvtachi
, { 0x5070 }
574 { { MNEM
, ' ', OP (SRC1
), 0 } },
575 & ifmt_mvtachi
, { 0x5071 }
580 { { MNEM
, ' ', OP (SR
), ',', OP (DCR
), 0 } },
581 & ifmt_mvtc
, { 0x10a0 }
586 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
593 & ifmt_nop
, { 0x7000 }
598 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
605 & ifmt_nop
, { 0x5090 }
611 & ifmt_nop
, { 0x5080 }
617 & ifmt_nop
, { 0x10d6 }
619 /* seth $dr,$hash$hi16 */
622 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (HI16
), 0 } },
623 & ifmt_seth
, { 0xd0c00000 }
628 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
629 & ifmt_add
, { 0x1040 }
631 /* sll3 $dr,$sr,$simm16 */
634 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
635 & ifmt_addv3
, { 0x90c00000 }
637 /* slli $dr,$uimm5 */
640 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
641 & ifmt_slli
, { 0x5040 }
646 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
647 & ifmt_add
, { 0x1020 }
649 /* sra3 $dr,$sr,$simm16 */
652 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
653 & ifmt_addv3
, { 0x90a00000 }
655 /* srai $dr,$uimm5 */
658 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
659 & ifmt_slli
, { 0x5020 }
664 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
665 & ifmt_add
, { 0x1000 }
667 /* srl3 $dr,$sr,$simm16 */
670 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
671 & ifmt_addv3
, { 0x90800000 }
673 /* srli $dr,$uimm5 */
676 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
677 & ifmt_slli
, { 0x5000 }
679 /* st $src1,@$src2 */
682 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
683 & ifmt_cmp
, { 0x2040 }
685 /* st $src1,@($slo16,$src2) */
688 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
689 & ifmt_st_d
, { 0xa0400000 }
691 /* stb $src1,@$src2 */
694 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
695 & ifmt_cmp
, { 0x2000 }
697 /* stb $src1,@($slo16,$src2) */
700 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
701 & ifmt_st_d
, { 0xa0000000 }
703 /* sth $src1,@$src2 */
706 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
707 & ifmt_cmp
, { 0x2020 }
709 /* sth $src1,@($slo16,$src2) */
712 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
713 & ifmt_st_d
, { 0xa0200000 }
715 /* st $src1,@+$src2 */
718 { { MNEM
, ' ', OP (SRC1
), ',', '@', '+', OP (SRC2
), 0 } },
719 & ifmt_cmp
, { 0x2060 }
721 /* st $src1,@-$src2 */
724 { { MNEM
, ' ', OP (SRC1
), ',', '@', '-', OP (SRC2
), 0 } },
725 & ifmt_cmp
, { 0x2070 }
730 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
736 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
742 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
748 { { MNEM
, ' ', OP (UIMM4
), 0 } },
749 & ifmt_trap
, { 0x10f0 }
751 /* unlock $src1,@$src2 */
754 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
755 & ifmt_cmp
, { 0x2050 }
764 /* Formats for ALIAS macro-insns. */
766 #define F(f) & m32r_cgen_ifld_table[CONCAT2 (M32R_,f)]
768 static const CGEN_IFMT ifmt_bc8r
= {
769 16, 16, 0xff00, { F (F_OP1
), F (F_R1
), F (F_DISP8
), 0 }
772 static const CGEN_IFMT ifmt_bc24r
= {
773 32, 32, 0xff000000, { F (F_OP1
), F (F_R1
), F (F_DISP24
), 0 }
776 static const CGEN_IFMT ifmt_bl8r
= {
777 16, 16, 0xff00, { F (F_OP1
), F (F_R1
), F (F_DISP8
), 0 }
780 static const CGEN_IFMT ifmt_bl24r
= {
781 32, 32, 0xff000000, { F (F_OP1
), F (F_R1
), F (F_DISP24
), 0 }
784 static const CGEN_IFMT ifmt_bnc8r
= {
785 16, 16, 0xff00, { F (F_OP1
), F (F_R1
), F (F_DISP8
), 0 }
788 static const CGEN_IFMT ifmt_bnc24r
= {
789 32, 32, 0xff000000, { F (F_OP1
), F (F_R1
), F (F_DISP24
), 0 }
792 static const CGEN_IFMT ifmt_bra8r
= {
793 16, 16, 0xff00, { F (F_OP1
), F (F_R1
), F (F_DISP8
), 0 }
796 static const CGEN_IFMT ifmt_bra24r
= {
797 32, 32, 0xff000000, { F (F_OP1
), F (F_R1
), F (F_DISP24
), 0 }
800 static const CGEN_IFMT ifmt_ld_2
= {
801 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
804 static const CGEN_IFMT ifmt_ld_d2
= {
805 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
808 static const CGEN_IFMT ifmt_ldb_2
= {
809 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
812 static const CGEN_IFMT ifmt_ldb_d2
= {
813 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
816 static const CGEN_IFMT ifmt_ldh_2
= {
817 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
820 static const CGEN_IFMT ifmt_ldh_d2
= {
821 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
824 static const CGEN_IFMT ifmt_ldub_2
= {
825 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
828 static const CGEN_IFMT ifmt_ldub_d2
= {
829 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
832 static const CGEN_IFMT ifmt_lduh_2
= {
833 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
836 static const CGEN_IFMT ifmt_lduh_d2
= {
837 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
840 static const CGEN_IFMT ifmt_pop
= {
841 16, 16, 0xf0ff, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
844 static const CGEN_IFMT ifmt_ldi8a
= {
845 16, 16, 0xf000, { F (F_OP1
), F (F_R1
), F (F_SIMM8
), 0 }
848 static const CGEN_IFMT ifmt_ldi16a
= {
849 32, 32, 0xf0ff0000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
852 static const CGEN_IFMT ifmt_st_2
= {
853 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
856 static const CGEN_IFMT ifmt_st_d2
= {
857 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
860 static const CGEN_IFMT ifmt_stb_2
= {
861 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
864 static const CGEN_IFMT ifmt_stb_d2
= {
865 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
868 static const CGEN_IFMT ifmt_sth_2
= {
869 16, 16, 0xf0f0, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
872 static const CGEN_IFMT ifmt_sth_d2
= {
873 32, 32, 0xf0f00000, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), F (F_SIMM16
), 0 }
876 static const CGEN_IFMT ifmt_push
= {
877 16, 16, 0xf0ff, { F (F_OP1
), F (F_R1
), F (F_OP2
), F (F_R2
), 0 }
882 /* Each non-simple macro entry points to an array of expansion possibilities. */
884 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
885 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
886 #define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
887 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
889 /* The macro instruction table. */
891 static const CGEN_IBASE m32r_cgen_macro_insn_table
[] =
895 -1, "bc8r", "bc", 16,
896 { 0|A(RELAXABLE
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
900 -1, "bc24r", "bc", 32,
901 { 0|A(RELAX
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
905 -1, "bl8r", "bl", 16,
906 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
910 -1, "bl24r", "bl", 32,
911 { 0|A(RELAX
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
915 -1, "bnc8r", "bnc", 16,
916 { 0|A(RELAXABLE
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
920 -1, "bnc24r", "bnc", 32,
921 { 0|A(RELAX
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
925 -1, "bra8r", "bra", 16,
926 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
930 -1, "bra24r", "bra", 32,
931 { 0|A(RELAX
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
) } }
935 -1, "ld-2", "ld", 16,
936 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
938 /* ld $dr,@($sr,$slo16) */
940 -1, "ld-d2", "ld", 32,
941 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
945 -1, "ldb-2", "ldb", 16,
946 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
948 /* ldb $dr,@($sr,$slo16) */
950 -1, "ldb-d2", "ldb", 32,
951 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
955 -1, "ldh-2", "ldh", 16,
956 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
958 /* ldh $dr,@($sr,$slo16) */
960 -1, "ldh-d2", "ldh", 32,
961 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
963 /* ldub $dr,@($sr) */
965 -1, "ldub-2", "ldub", 16,
966 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
968 /* ldub $dr,@($sr,$slo16) */
970 -1, "ldub-d2", "ldub", 32,
971 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
973 /* lduh $dr,@($sr) */
975 -1, "lduh-2", "lduh", 16,
976 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
978 /* lduh $dr,@($sr,$slo16) */
980 -1, "lduh-d2", "lduh", 32,
981 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
985 -1, "pop", "pop", 16,
986 { 0|A(ALIAS
), { (1<<MACH_BASE
) } }
990 -1, "ldi8a", "ldi", 16,
991 { 0|A(ALIAS
), { (1<<MACH_BASE
) } }
993 /* ldi $dr,$hash$slo16 */
995 -1, "ldi16a", "ldi", 32,
996 { 0|A(ALIAS
), { (1<<MACH_BASE
) } }
998 /* st $src1,@($src2) */
1000 -1, "st-2", "st", 16,
1001 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
1003 /* st $src1,@($src2,$slo16) */
1005 -1, "st-d2", "st", 32,
1006 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
1008 /* stb $src1,@($src2) */
1010 -1, "stb-2", "stb", 16,
1011 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
1013 /* stb $src1,@($src2,$slo16) */
1015 -1, "stb-d2", "stb", 32,
1016 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
1018 /* sth $src1,@($src2) */
1020 -1, "sth-2", "sth", 16,
1021 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
1023 /* sth $src1,@($src2,$slo16) */
1025 -1, "sth-d2", "sth", 32,
1026 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
) } }
1030 -1, "push", "push", 16,
1031 { 0|A(ALIAS
), { (1<<MACH_BASE
) } }
1035 /* The macro instruction opcode table. */
1037 static const CGEN_OPCODE m32r_cgen_macro_insn_opcode_table
[] =
1042 { { MNEM
, ' ', OP (DISP8
), 0 } },
1043 & ifmt_bc8r
, { 0x7c00 }
1048 { { MNEM
, ' ', OP (DISP24
), 0 } },
1049 & ifmt_bc24r
, { 0xfc000000 }
1054 { { MNEM
, ' ', OP (DISP8
), 0 } },
1055 & ifmt_bl8r
, { 0x7e00 }
1060 { { MNEM
, ' ', OP (DISP24
), 0 } },
1061 & ifmt_bl24r
, { 0xfe000000 }
1066 { { MNEM
, ' ', OP (DISP8
), 0 } },
1067 & ifmt_bnc8r
, { 0x7d00 }
1072 { { MNEM
, ' ', OP (DISP24
), 0 } },
1073 & ifmt_bnc24r
, { 0xfd000000 }
1078 { { MNEM
, ' ', OP (DISP8
), 0 } },
1079 & ifmt_bra8r
, { 0x7f00 }
1084 { { MNEM
, ' ', OP (DISP24
), 0 } },
1085 & ifmt_bra24r
, { 0xff000000 }
1090 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1091 & ifmt_ld_2
, { 0x20c0 }
1093 /* ld $dr,@($sr,$slo16) */
1096 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1097 & ifmt_ld_d2
, { 0xa0c00000 }
1099 /* ldb $dr,@($sr) */
1102 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1103 & ifmt_ldb_2
, { 0x2080 }
1105 /* ldb $dr,@($sr,$slo16) */
1108 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1109 & ifmt_ldb_d2
, { 0xa0800000 }
1111 /* ldh $dr,@($sr) */
1114 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1115 & ifmt_ldh_2
, { 0x20a0 }
1117 /* ldh $dr,@($sr,$slo16) */
1120 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1121 & ifmt_ldh_d2
, { 0xa0a00000 }
1123 /* ldub $dr,@($sr) */
1126 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1127 & ifmt_ldub_2
, { 0x2090 }
1129 /* ldub $dr,@($sr,$slo16) */
1132 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1133 & ifmt_ldub_d2
, { 0xa0900000 }
1135 /* lduh $dr,@($sr) */
1138 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1139 & ifmt_lduh_2
, { 0x20b0 }
1141 /* lduh $dr,@($sr,$slo16) */
1144 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1145 & ifmt_lduh_d2
, { 0xa0b00000 }
1150 { { MNEM
, ' ', OP (DR
), 0 } },
1151 & ifmt_pop
, { 0x20ef }
1153 /* ldi $dr,$simm8 */
1156 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
1157 & ifmt_ldi8a
, { 0x6000 }
1159 /* ldi $dr,$hash$slo16 */
1162 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (SLO16
), 0 } },
1163 & ifmt_ldi16a
, { 0x90f00000 }
1165 /* st $src1,@($src2) */
1168 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1169 & ifmt_st_2
, { 0x2040 }
1171 /* st $src1,@($src2,$slo16) */
1174 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1175 & ifmt_st_d2
, { 0xa0400000 }
1177 /* stb $src1,@($src2) */
1180 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1181 & ifmt_stb_2
, { 0x2000 }
1183 /* stb $src1,@($src2,$slo16) */
1186 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1187 & ifmt_stb_d2
, { 0xa0000000 }
1189 /* sth $src1,@($src2) */
1192 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1193 & ifmt_sth_2
, { 0x2020 }
1195 /* sth $src1,@($src2,$slo16) */
1198 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1199 & ifmt_sth_d2
, { 0xa0200000 }
1204 { { MNEM
, ' ', OP (SRC1
), 0 } },
1205 & ifmt_push
, { 0x207f }
1214 #ifndef CGEN_ASM_HASH_P
1215 #define CGEN_ASM_HASH_P(insn) 1
1218 #ifndef CGEN_DIS_HASH_P
1219 #define CGEN_DIS_HASH_P(insn) 1
1222 /* Return non-zero if INSN is to be added to the hash table.
1223 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
1226 asm_hash_insn_p (insn
)
1227 const CGEN_INSN
*insn
;
1229 return CGEN_ASM_HASH_P (insn
);
1233 dis_hash_insn_p (insn
)
1234 const CGEN_INSN
*insn
;
1236 /* If building the hash table and the NO-DIS attribute is present,
1238 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_NO_DIS
))
1240 return CGEN_DIS_HASH_P (insn
);
1243 #ifndef CGEN_ASM_HASH
1244 #define CGEN_ASM_HASH_SIZE 127
1245 #ifdef CGEN_MNEMONIC_OPERANDS
1246 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1248 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1252 /* It doesn't make much sense to provide a default here,
1253 but while this is under development we do.
1254 BUFFER is a pointer to the bytes of the insn, target order.
1255 VALUE is the first base_insn_bitsize bits as an int in host order. */
1257 #ifndef CGEN_DIS_HASH
1258 #define CGEN_DIS_HASH_SIZE 256
1259 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1262 /* The result is the hash value of the insn.
1263 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1266 asm_hash_insn (mnem
)
1269 return CGEN_ASM_HASH (mnem
);
1272 /* BUF is a pointer to the bytes of the insn, target order.
1273 VALUE is the first base_insn_bitsize bits as an int in host order. */
1276 dis_hash_insn (buf
, value
)
1278 CGEN_INSN_INT value
;
1280 return CGEN_DIS_HASH (buf
, value
);
1283 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1286 set_fields_bitsize (fields
, size
)
1287 CGEN_FIELDS
*fields
;
1290 CGEN_FIELDS_BITSIZE (fields
) = size
;
1293 /* Function to call before using the operand instance table.
1294 This plugs the opcode entries and macro instructions into the cpu table. */
1297 m32r_cgen_init_opcode_table (cd
)
1301 int num_macros
= (sizeof (m32r_cgen_macro_insn_table
) /
1302 sizeof (m32r_cgen_macro_insn_table
[0]));
1303 const CGEN_IBASE
*ib
= & m32r_cgen_macro_insn_table
[0];
1304 const CGEN_OPCODE
*oc
= & m32r_cgen_macro_insn_opcode_table
[0];
1305 CGEN_INSN
*insns
= (CGEN_INSN
*) xmalloc (num_macros
* sizeof (CGEN_INSN
));
1306 memset (insns
, 0, num_macros
* sizeof (CGEN_INSN
));
1307 for (i
= 0; i
< num_macros
; ++i
)
1309 insns
[i
].base
= &ib
[i
];
1310 insns
[i
].opcode
= &oc
[i
];
1312 cd
->macro_insn_table
.init_entries
= insns
;
1313 cd
->macro_insn_table
.entry_size
= sizeof (CGEN_IBASE
);
1314 cd
->macro_insn_table
.num_init_entries
= num_macros
;
1316 oc
= & m32r_cgen_insn_opcode_table
[0];
1317 insns
= (CGEN_INSN
*) cd
->insn_table
.init_entries
;
1318 for (i
= 0; i
< MAX_INSNS
; ++i
)
1319 insns
[i
].opcode
= &oc
[i
];
1321 cd
->sizeof_fields
= sizeof (CGEN_FIELDS
);
1322 cd
->set_fields_bitsize
= set_fields_bitsize
;
1324 cd
->asm_hash_p
= asm_hash_insn_p
;
1325 cd
->asm_hash
= asm_hash_insn
;
1326 cd
->asm_hash_size
= CGEN_ASM_HASH_SIZE
;
1328 cd
->dis_hash_p
= dis_hash_insn_p
;
1329 cd
->dis_hash
= dis_hash_insn
;
1330 cd
->dis_hash_size
= CGEN_DIS_HASH_SIZE
;