1 /* Instruction opcode table for m32r.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
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"
35 m32r_cgen_dis_hash (buf
, value
)
36 const char * buf ATTRIBUTE_UNUSED
;
41 if (value
& 0xffff0000) /* 32bit instructions */
42 value
= (value
>> 16) & 0xffff;
44 x
= (value
>>8) & 0xf0;
45 if (x
== 0x40 || x
== 0xe0 || x
== 0x60 || x
== 0x50)
48 if (x
== 0x70 || x
== 0xf0)
49 return x
| ((value
>>8) & 0x0f);
52 return x
| ((value
& 0x70) >> 4);
54 return x
| ((value
& 0xf0) >> 4);
58 /* The hash functions are recorded here to help keep assembler code out of
59 the disassembler and vice versa. */
61 static int asm_hash_insn_p
PARAMS ((const CGEN_INSN
*));
62 static unsigned int asm_hash_insn
PARAMS ((const char *));
63 static int dis_hash_insn_p
PARAMS ((const CGEN_INSN
*));
64 static unsigned int dis_hash_insn
PARAMS ((const char *, CGEN_INSN_INT
));
66 /* Instruction formats. */
68 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
69 #define F(f) & m32r_cgen_ifld_table[M32R_##f]
71 #define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
73 static const CGEN_IFMT ifmt_empty
= {
77 static const CGEN_IFMT ifmt_add
= {
78 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
81 static const CGEN_IFMT ifmt_add3
= {
82 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
85 static const CGEN_IFMT ifmt_and3
= {
86 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
89 static const CGEN_IFMT ifmt_or3
= {
90 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
93 static const CGEN_IFMT ifmt_addi
= {
94 16, 16, 0xf000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_SIMM8
) }, { 0 } }
97 static const CGEN_IFMT ifmt_addv3
= {
98 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
101 static const CGEN_IFMT ifmt_bc8
= {
102 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP8
) }, { 0 } }
105 static const CGEN_IFMT ifmt_bc24
= {
106 32, 32, 0xff000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP24
) }, { 0 } }
109 static const CGEN_IFMT ifmt_beq
= {
110 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_DISP16
) }, { 0 } }
113 static const CGEN_IFMT ifmt_beqz
= {
114 32, 32, 0xfff00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_DISP16
) }, { 0 } }
117 static const CGEN_IFMT ifmt_cmp
= {
118 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
121 static const CGEN_IFMT ifmt_cmpi
= {
122 32, 32, 0xfff00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
125 static const CGEN_IFMT ifmt_cmpz
= {
126 16, 16, 0xfff0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
129 static const CGEN_IFMT ifmt_div
= {
130 32, 32, 0xf0f0ffff, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
133 static const CGEN_IFMT ifmt_jc
= {
134 16, 16, 0xfff0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
137 static const CGEN_IFMT ifmt_ld24
= {
138 32, 32, 0xf0000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_UIMM24
) }, { 0 } }
141 static const CGEN_IFMT ifmt_ldi16
= {
142 32, 32, 0xf0ff0000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
145 static const CGEN_IFMT ifmt_machi_a
= {
146 16, 16, 0xf070, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_ACC
) }, { F (F_OP23
) }, { F (F_R2
) }, { 0 } }
149 static const CGEN_IFMT ifmt_mvfachi
= {
150 16, 16, 0xf0ff, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
153 static const CGEN_IFMT ifmt_mvfachi_a
= {
154 16, 16, 0xf0f3, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_ACCS
) }, { F (F_OP3
) }, { 0 } }
157 static const CGEN_IFMT ifmt_mvfc
= {
158 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
161 static const CGEN_IFMT ifmt_mvtachi
= {
162 16, 16, 0xf0ff, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
165 static const CGEN_IFMT ifmt_mvtachi_a
= {
166 16, 16, 0xf0f3, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_ACCS
) }, { F (F_OP3
) }, { 0 } }
169 static const CGEN_IFMT ifmt_mvtc
= {
170 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
173 static const CGEN_IFMT ifmt_nop
= {
174 16, 16, 0xffff, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
177 static const CGEN_IFMT ifmt_rac_dsi
= {
178 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 } }
181 static const CGEN_IFMT ifmt_seth
= {
182 32, 32, 0xf0ff0000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_HI16
) }, { 0 } }
185 static const CGEN_IFMT ifmt_slli
= {
186 16, 16, 0xf0e0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_SHIFT_OP2
) }, { F (F_UIMM5
) }, { 0 } }
189 static const CGEN_IFMT ifmt_st_d
= {
190 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
193 static const CGEN_IFMT ifmt_trap
= {
194 16, 16, 0xfff0, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_UIMM4
) }, { 0 } }
197 static const CGEN_IFMT ifmt_satb
= {
198 32, 32, 0xf0f0ffff, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
201 static const CGEN_IFMT ifmt_clrpsw
= {
202 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_UIMM8
) }, { 0 } }
205 static const CGEN_IFMT ifmt_bset
= {
206 32, 32, 0xf8f00000, { { F (F_OP1
) }, { F (F_BIT4
) }, { F (F_UIMM3
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
209 static const CGEN_IFMT ifmt_btst
= {
210 16, 16, 0xf8f0, { { F (F_OP1
) }, { F (F_BIT4
) }, { F (F_UIMM3
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
215 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
216 #define A(a) (1 << CGEN_INSN_##a)
218 #define A(a) (1 << CGEN_INSN_/**/a)
220 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
221 #define OPERAND(op) M32R_OPERAND_##op
223 #define OPERAND(op) M32R_OPERAND_/**/op
225 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
226 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
228 /* The instruction table. */
230 static const CGEN_OPCODE m32r_cgen_insn_opcode_table
[MAX_INSNS
] =
232 /* Special null first entry.
233 A `num' value of zero is thus invalid.
234 Also, the special `invalid' insn resides here. */
235 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
239 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
242 /* add3 $dr,$sr,$hash$slo16 */
245 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (HASH
), OP (SLO16
), 0 } },
246 & ifmt_add3
, { 0x80a00000 }
251 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
254 /* and3 $dr,$sr,$uimm16 */
257 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (UIMM16
), 0 } },
258 & ifmt_and3
, { 0x80c00000 }
263 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
266 /* or3 $dr,$sr,$hash$ulo16 */
269 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (HASH
), OP (ULO16
), 0 } },
270 & ifmt_or3
, { 0x80e00000 }
275 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
278 /* xor3 $dr,$sr,$uimm16 */
281 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (UIMM16
), 0 } },
282 & ifmt_and3
, { 0x80d00000 }
284 /* addi $dr,$simm8 */
287 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
288 & ifmt_addi
, { 0x4000 }
293 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
296 /* addv3 $dr,$sr,$simm16 */
299 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
300 & ifmt_addv3
, { 0x80800000 }
305 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
311 { { MNEM
, ' ', OP (DISP8
), 0 } },
312 & ifmt_bc8
, { 0x7c00 }
317 { { MNEM
, ' ', OP (DISP24
), 0 } },
318 & ifmt_bc24
, { 0xfc000000 }
320 /* beq $src1,$src2,$disp16 */
323 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (DISP16
), 0 } },
324 & ifmt_beq
, { 0xb0000000 }
326 /* beqz $src2,$disp16 */
329 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
330 & ifmt_beqz
, { 0xb0800000 }
332 /* bgez $src2,$disp16 */
335 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
336 & ifmt_beqz
, { 0xb0b00000 }
338 /* bgtz $src2,$disp16 */
341 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
342 & ifmt_beqz
, { 0xb0d00000 }
344 /* blez $src2,$disp16 */
347 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
348 & ifmt_beqz
, { 0xb0c00000 }
350 /* bltz $src2,$disp16 */
353 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
354 & ifmt_beqz
, { 0xb0a00000 }
356 /* bnez $src2,$disp16 */
359 { { MNEM
, ' ', OP (SRC2
), ',', OP (DISP16
), 0 } },
360 & ifmt_beqz
, { 0xb0900000 }
365 { { MNEM
, ' ', OP (DISP8
), 0 } },
366 & ifmt_bc8
, { 0x7e00 }
371 { { MNEM
, ' ', OP (DISP24
), 0 } },
372 & ifmt_bc24
, { 0xfe000000 }
377 { { MNEM
, ' ', OP (DISP8
), 0 } },
378 & ifmt_bc8
, { 0x7800 }
383 { { MNEM
, ' ', OP (DISP24
), 0 } },
384 & ifmt_bc24
, { 0xf8000000 }
389 { { MNEM
, ' ', OP (DISP8
), 0 } },
390 & ifmt_bc8
, { 0x7d00 }
395 { { MNEM
, ' ', OP (DISP24
), 0 } },
396 & ifmt_bc24
, { 0xfd000000 }
398 /* bne $src1,$src2,$disp16 */
401 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (DISP16
), 0 } },
402 & ifmt_beq
, { 0xb0100000 }
407 { { MNEM
, ' ', OP (DISP8
), 0 } },
408 & ifmt_bc8
, { 0x7f00 }
413 { { MNEM
, ' ', OP (DISP24
), 0 } },
414 & ifmt_bc24
, { 0xff000000 }
419 { { MNEM
, ' ', OP (DISP8
), 0 } },
420 & ifmt_bc8
, { 0x7900 }
425 { { MNEM
, ' ', OP (DISP24
), 0 } },
426 & ifmt_bc24
, { 0xf9000000 }
428 /* cmp $src1,$src2 */
431 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
434 /* cmpi $src2,$simm16 */
437 { { MNEM
, ' ', OP (SRC2
), ',', OP (SIMM16
), 0 } },
438 & ifmt_cmpi
, { 0x80400000 }
440 /* cmpu $src1,$src2 */
443 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
446 /* cmpui $src2,$simm16 */
449 { { MNEM
, ' ', OP (SRC2
), ',', OP (SIMM16
), 0 } },
450 & ifmt_cmpi
, { 0x80500000 }
452 /* cmpeq $src1,$src2 */
455 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
461 { { MNEM
, ' ', OP (SRC2
), 0 } },
462 & ifmt_cmpz
, { 0x70 }
467 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
468 & ifmt_div
, { 0x90000000 }
473 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
474 & ifmt_div
, { 0x90100000 }
479 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
480 & ifmt_div
, { 0x90200000 }
485 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
486 & ifmt_div
, { 0x90300000 }
491 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
492 & ifmt_div
, { 0x90200010 }
497 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
498 & ifmt_div
, { 0x90300010 }
503 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
504 & ifmt_div
, { 0x90200018 }
509 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
510 & ifmt_div
, { 0x90300018 }
515 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
516 & ifmt_div
, { 0x90100010 }
521 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
522 & ifmt_div
, { 0x90000018 }
527 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
528 & ifmt_div
, { 0x90100018 }
533 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
534 & ifmt_div
, { 0x90000010 }
539 { { MNEM
, ' ', OP (SR
), 0 } },
540 & ifmt_jc
, { 0x1cc0 }
545 { { MNEM
, ' ', OP (SR
), 0 } },
546 & ifmt_jc
, { 0x1dc0 }
551 { { MNEM
, ' ', OP (SR
), 0 } },
552 & ifmt_jc
, { 0x1ec0 }
557 { { MNEM
, ' ', OP (SR
), 0 } },
558 & ifmt_jc
, { 0x1fc0 }
563 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
564 & ifmt_add
, { 0x20c0 }
566 /* ld $dr,@($slo16,$sr) */
569 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
570 & ifmt_add3
, { 0xa0c00000 }
575 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
576 & ifmt_add
, { 0x2080 }
578 /* ldb $dr,@($slo16,$sr) */
581 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
582 & ifmt_add3
, { 0xa0800000 }
587 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
588 & ifmt_add
, { 0x20a0 }
590 /* ldh $dr,@($slo16,$sr) */
593 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
594 & ifmt_add3
, { 0xa0a00000 }
599 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
600 & ifmt_add
, { 0x2090 }
602 /* ldub $dr,@($slo16,$sr) */
605 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
606 & ifmt_add3
, { 0xa0900000 }
611 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
612 & ifmt_add
, { 0x20b0 }
614 /* lduh $dr,@($slo16,$sr) */
617 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
618 & ifmt_add3
, { 0xa0b00000 }
623 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), '+', 0 } },
624 & ifmt_add
, { 0x20e0 }
626 /* ld24 $dr,$uimm24 */
629 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM24
), 0 } },
630 & ifmt_ld24
, { 0xe0000000 }
632 /* ldi8 $dr,$simm8 */
635 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
636 & ifmt_addi
, { 0x6000 }
638 /* ldi16 $dr,$hash$slo16 */
641 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (SLO16
), 0 } },
642 & ifmt_ldi16
, { 0x90f00000 }
647 { { MNEM
, ' ', OP (DR
), ',', '@', OP (SR
), 0 } },
648 & ifmt_add
, { 0x20d0 }
650 /* machi $src1,$src2 */
653 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
654 & ifmt_cmp
, { 0x3040 }
656 /* machi $src1,$src2,$acc */
659 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
660 & ifmt_machi_a
, { 0x3040 }
662 /* maclo $src1,$src2 */
665 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
666 & ifmt_cmp
, { 0x3050 }
668 /* maclo $src1,$src2,$acc */
671 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
672 & ifmt_machi_a
, { 0x3050 }
674 /* macwhi $src1,$src2 */
677 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
678 & ifmt_cmp
, { 0x3060 }
680 /* macwhi $src1,$src2,$acc */
683 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
684 & ifmt_machi_a
, { 0x3060 }
686 /* macwlo $src1,$src2 */
689 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
690 & ifmt_cmp
, { 0x3070 }
692 /* macwlo $src1,$src2,$acc */
695 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
696 & ifmt_machi_a
, { 0x3070 }
701 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
702 & ifmt_add
, { 0x1060 }
704 /* mulhi $src1,$src2 */
707 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
708 & ifmt_cmp
, { 0x3000 }
710 /* mulhi $src1,$src2,$acc */
713 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
714 & ifmt_machi_a
, { 0x3000 }
716 /* mullo $src1,$src2 */
719 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
720 & ifmt_cmp
, { 0x3010 }
722 /* mullo $src1,$src2,$acc */
725 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
726 & ifmt_machi_a
, { 0x3010 }
728 /* mulwhi $src1,$src2 */
731 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
732 & ifmt_cmp
, { 0x3020 }
734 /* mulwhi $src1,$src2,$acc */
737 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
738 & ifmt_machi_a
, { 0x3020 }
740 /* mulwlo $src1,$src2 */
743 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
744 & ifmt_cmp
, { 0x3030 }
746 /* mulwlo $src1,$src2,$acc */
749 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), ',', OP (ACC
), 0 } },
750 & ifmt_machi_a
, { 0x3030 }
755 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
756 & ifmt_add
, { 0x1080 }
761 { { MNEM
, ' ', OP (DR
), 0 } },
762 & ifmt_mvfachi
, { 0x50f0 }
764 /* mvfachi $dr,$accs */
767 { { MNEM
, ' ', OP (DR
), ',', OP (ACCS
), 0 } },
768 & ifmt_mvfachi_a
, { 0x50f0 }
773 { { MNEM
, ' ', OP (DR
), 0 } },
774 & ifmt_mvfachi
, { 0x50f1 }
776 /* mvfaclo $dr,$accs */
779 { { MNEM
, ' ', OP (DR
), ',', OP (ACCS
), 0 } },
780 & ifmt_mvfachi_a
, { 0x50f1 }
785 { { MNEM
, ' ', OP (DR
), 0 } },
786 & ifmt_mvfachi
, { 0x50f2 }
788 /* mvfacmi $dr,$accs */
791 { { MNEM
, ' ', OP (DR
), ',', OP (ACCS
), 0 } },
792 & ifmt_mvfachi_a
, { 0x50f2 }
797 { { MNEM
, ' ', OP (DR
), ',', OP (SCR
), 0 } },
798 & ifmt_mvfc
, { 0x1090 }
803 { { MNEM
, ' ', OP (SRC1
), 0 } },
804 & ifmt_mvtachi
, { 0x5070 }
806 /* mvtachi $src1,$accs */
809 { { MNEM
, ' ', OP (SRC1
), ',', OP (ACCS
), 0 } },
810 & ifmt_mvtachi_a
, { 0x5070 }
815 { { MNEM
, ' ', OP (SRC1
), 0 } },
816 & ifmt_mvtachi
, { 0x5071 }
818 /* mvtaclo $src1,$accs */
821 { { MNEM
, ' ', OP (SRC1
), ',', OP (ACCS
), 0 } },
822 & ifmt_mvtachi_a
, { 0x5071 }
827 { { MNEM
, ' ', OP (SR
), ',', OP (DCR
), 0 } },
828 & ifmt_mvtc
, { 0x10a0 }
833 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
840 & ifmt_nop
, { 0x7000 }
845 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
852 & ifmt_nop
, { 0x5090 }
854 /* rac $accd,$accs,$imm1 */
857 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), ',', OP (IMM1
), 0 } },
858 & ifmt_rac_dsi
, { 0x5090 }
864 & ifmt_nop
, { 0x5080 }
866 /* rach $accd,$accs,$imm1 */
869 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), ',', OP (IMM1
), 0 } },
870 & ifmt_rac_dsi
, { 0x5080 }
876 & ifmt_nop
, { 0x10d6 }
878 /* seth $dr,$hash$hi16 */
881 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (HI16
), 0 } },
882 & ifmt_seth
, { 0xd0c00000 }
887 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
888 & ifmt_add
, { 0x1040 }
890 /* sll3 $dr,$sr,$simm16 */
893 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
894 & ifmt_addv3
, { 0x90c00000 }
896 /* slli $dr,$uimm5 */
899 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
900 & ifmt_slli
, { 0x5040 }
905 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
906 & ifmt_add
, { 0x1020 }
908 /* sra3 $dr,$sr,$simm16 */
911 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
912 & ifmt_addv3
, { 0x90a00000 }
914 /* srai $dr,$uimm5 */
917 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
918 & ifmt_slli
, { 0x5020 }
923 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
924 & ifmt_add
, { 0x1000 }
926 /* srl3 $dr,$sr,$simm16 */
929 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), ',', OP (SIMM16
), 0 } },
930 & ifmt_addv3
, { 0x90800000 }
932 /* srli $dr,$uimm5 */
935 { { MNEM
, ' ', OP (DR
), ',', OP (UIMM5
), 0 } },
936 & ifmt_slli
, { 0x5000 }
938 /* st $src1,@$src2 */
941 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
942 & ifmt_cmp
, { 0x2040 }
944 /* st $src1,@($slo16,$src2) */
947 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
948 & ifmt_st_d
, { 0xa0400000 }
950 /* stb $src1,@$src2 */
953 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
954 & ifmt_cmp
, { 0x2000 }
956 /* stb $src1,@($slo16,$src2) */
959 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
960 & ifmt_st_d
, { 0xa0000000 }
962 /* sth $src1,@$src2 */
965 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
966 & ifmt_cmp
, { 0x2020 }
968 /* sth $src1,@($slo16,$src2) */
971 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SLO16
), ',', OP (SRC2
), ')', 0 } },
972 & ifmt_st_d
, { 0xa0200000 }
974 /* st $src1,@+$src2 */
977 { { MNEM
, ' ', OP (SRC1
), ',', '@', '+', OP (SRC2
), 0 } },
978 & ifmt_cmp
, { 0x2060 }
980 /* sth $src1,@$src2+ */
983 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), '+', 0 } },
984 & ifmt_cmp
, { 0x2030 }
986 /* stb $src1,@$src2+ */
989 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), '+', 0 } },
990 & ifmt_cmp
, { 0x2010 }
992 /* st $src1,@-$src2 */
995 { { MNEM
, ' ', OP (SRC1
), ',', '@', '-', OP (SRC2
), 0 } },
996 & ifmt_cmp
, { 0x2070 }
1001 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
1002 & ifmt_add
, { 0x20 }
1007 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
1013 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
1014 & ifmt_add
, { 0x10 }
1019 { { MNEM
, ' ', OP (UIMM4
), 0 } },
1020 & ifmt_trap
, { 0x10f0 }
1022 /* unlock $src1,@$src2 */
1025 { { MNEM
, ' ', OP (SRC1
), ',', '@', OP (SRC2
), 0 } },
1026 & ifmt_cmp
, { 0x2050 }
1031 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
1032 & ifmt_satb
, { 0x80600300 }
1037 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
1038 & ifmt_satb
, { 0x80600200 }
1043 { { MNEM
, ' ', OP (DR
), ',', OP (SR
), 0 } },
1044 & ifmt_satb
, { 0x80600000 }
1049 { { MNEM
, ' ', OP (SRC2
), 0 } },
1050 & ifmt_cmpz
, { 0x370 }
1056 & ifmt_nop
, { 0x50e4 }
1058 /* macwu1 $src1,$src2 */
1061 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
1062 & ifmt_cmp
, { 0x50b0 }
1064 /* msblo $src1,$src2 */
1067 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
1068 & ifmt_cmp
, { 0x50d0 }
1070 /* mulwu1 $src1,$src2 */
1073 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
1074 & ifmt_cmp
, { 0x50a0 }
1076 /* maclh1 $src1,$src2 */
1079 { { MNEM
, ' ', OP (SRC1
), ',', OP (SRC2
), 0 } },
1080 & ifmt_cmp
, { 0x50c0 }
1086 & ifmt_nop
, { 0x7401 }
1092 & ifmt_nop
, { 0x7501 }
1097 { { MNEM
, ' ', OP (UIMM8
), 0 } },
1098 & ifmt_clrpsw
, { 0x7200 }
1103 { { MNEM
, ' ', OP (UIMM8
), 0 } },
1104 & ifmt_clrpsw
, { 0x7100 }
1106 /* bset $uimm3,@($slo16,$sr) */
1109 { { MNEM
, ' ', OP (UIMM3
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
1110 & ifmt_bset
, { 0xa0600000 }
1112 /* bclr $uimm3,@($slo16,$sr) */
1115 { { MNEM
, ' ', OP (UIMM3
), ',', '@', '(', OP (SLO16
), ',', OP (SR
), ')', 0 } },
1116 & ifmt_bset
, { 0xa0700000 }
1118 /* btst $uimm3,$sr */
1121 { { MNEM
, ' ', OP (UIMM3
), ',', OP (SR
), 0 } },
1122 & ifmt_btst
, { 0xf0 }
1131 /* Formats for ALIAS macro-insns. */
1133 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1134 #define F(f) & m32r_cgen_ifld_table[M32R_##f]
1136 #define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
1138 static const CGEN_IFMT ifmt_bc8r
= {
1139 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP8
) }, { 0 } }
1142 static const CGEN_IFMT ifmt_bc24r
= {
1143 32, 32, 0xff000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP24
) }, { 0 } }
1146 static const CGEN_IFMT ifmt_bl8r
= {
1147 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP8
) }, { 0 } }
1150 static const CGEN_IFMT ifmt_bl24r
= {
1151 32, 32, 0xff000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP24
) }, { 0 } }
1154 static const CGEN_IFMT ifmt_bcl8r
= {
1155 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP8
) }, { 0 } }
1158 static const CGEN_IFMT ifmt_bcl24r
= {
1159 32, 32, 0xff000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP24
) }, { 0 } }
1162 static const CGEN_IFMT ifmt_bnc8r
= {
1163 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP8
) }, { 0 } }
1166 static const CGEN_IFMT ifmt_bnc24r
= {
1167 32, 32, 0xff000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP24
) }, { 0 } }
1170 static const CGEN_IFMT ifmt_bra8r
= {
1171 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP8
) }, { 0 } }
1174 static const CGEN_IFMT ifmt_bra24r
= {
1175 32, 32, 0xff000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP24
) }, { 0 } }
1178 static const CGEN_IFMT ifmt_bncl8r
= {
1179 16, 16, 0xff00, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP8
) }, { 0 } }
1182 static const CGEN_IFMT ifmt_bncl24r
= {
1183 32, 32, 0xff000000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_DISP24
) }, { 0 } }
1186 static const CGEN_IFMT ifmt_ld_2
= {
1187 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1190 static const CGEN_IFMT ifmt_ld_d2
= {
1191 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1194 static const CGEN_IFMT ifmt_ldb_2
= {
1195 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1198 static const CGEN_IFMT ifmt_ldb_d2
= {
1199 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1202 static const CGEN_IFMT ifmt_ldh_2
= {
1203 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1206 static const CGEN_IFMT ifmt_ldh_d2
= {
1207 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1210 static const CGEN_IFMT ifmt_ldub_2
= {
1211 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1214 static const CGEN_IFMT ifmt_ldub_d2
= {
1215 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1218 static const CGEN_IFMT ifmt_lduh_2
= {
1219 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1222 static const CGEN_IFMT ifmt_lduh_d2
= {
1223 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1226 static const CGEN_IFMT ifmt_pop
= {
1227 16, 16, 0xf0ff, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_OP2
) }, { F (F_R2
) }, { 0 } }
1230 static const CGEN_IFMT ifmt_ldi8a
= {
1231 16, 16, 0xf000, { { F (F_OP1
) }, { F (F_R1
) }, { F (F_SIMM8
) }, { 0 } }
1234 static const CGEN_IFMT ifmt_ldi16a
= {
1235 32, 32, 0xf0ff0000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R2
) }, { F (F_R1
) }, { F (F_SIMM16
) }, { 0 } }
1238 static const CGEN_IFMT ifmt_rac_d
= {
1239 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 } }
1242 static const CGEN_IFMT ifmt_rac_ds
= {
1243 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 } }
1246 static const CGEN_IFMT ifmt_rach_d
= {
1247 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 } }
1250 static const CGEN_IFMT ifmt_rach_ds
= {
1251 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 } }
1254 static const CGEN_IFMT ifmt_st_2
= {
1255 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1258 static const CGEN_IFMT ifmt_st_d2
= {
1259 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1262 static const CGEN_IFMT ifmt_stb_2
= {
1263 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1266 static const CGEN_IFMT ifmt_stb_d2
= {
1267 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1270 static const CGEN_IFMT ifmt_sth_2
= {
1271 16, 16, 0xf0f0, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1274 static const CGEN_IFMT ifmt_sth_d2
= {
1275 32, 32, 0xf0f00000, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
1278 static const CGEN_IFMT ifmt_push
= {
1279 16, 16, 0xf0ff, { { F (F_OP1
) }, { F (F_OP2
) }, { F (F_R1
) }, { F (F_R2
) }, { 0 } }
1284 /* Each non-simple macro entry points to an array of expansion possibilities. */
1286 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1287 #define A(a) (1 << CGEN_INSN_##a)
1289 #define A(a) (1 << CGEN_INSN_/**/a)
1291 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
1292 #define OPERAND(op) M32R_OPERAND_##op
1294 #define OPERAND(op) M32R_OPERAND_/**/op
1296 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
1297 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
1299 /* The macro instruction table. */
1301 static const CGEN_IBASE m32r_cgen_macro_insn_table
[] =
1305 -1, "bc8r", "bc", 16,
1306 { 0|A(RELAXABLE
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1310 -1, "bc24r", "bc", 32,
1311 { 0|A(RELAXED
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1315 -1, "bl8r", "bl", 16,
1316 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1320 -1, "bl24r", "bl", 32,
1321 { 0|A(RELAXED
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1325 -1, "bcl8r", "bcl", 16,
1326 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_O
} }
1330 -1, "bcl24r", "bcl", 32,
1331 { 0|A(RELAXED
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_NONE
} }
1335 -1, "bnc8r", "bnc", 16,
1336 { 0|A(RELAXABLE
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1340 -1, "bnc24r", "bnc", 32,
1341 { 0|A(RELAXED
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1345 -1, "bra8r", "bra", 16,
1346 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1350 -1, "bra24r", "bra", 32,
1351 { 0|A(RELAXED
)|A(UNCOND_CTI
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1355 -1, "bncl8r", "bncl", 16,
1356 { 0|A(RELAXABLE
)|A(FILL_SLOT
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_O
} }
1360 -1, "bncl24r", "bncl", 32,
1361 { 0|A(RELAXED
)|A(COND_CTI
)|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_NONE
} }
1365 -1, "ld-2", "ld", 16,
1366 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1368 /* ld $dr,@($sr,$slo16) */
1370 -1, "ld-d2", "ld", 32,
1371 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1373 /* ldb $dr,@($sr) */
1375 -1, "ldb-2", "ldb", 16,
1376 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1378 /* ldb $dr,@($sr,$slo16) */
1380 -1, "ldb-d2", "ldb", 32,
1381 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1383 /* ldh $dr,@($sr) */
1385 -1, "ldh-2", "ldh", 16,
1386 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1388 /* ldh $dr,@($sr,$slo16) */
1390 -1, "ldh-d2", "ldh", 32,
1391 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1393 /* ldub $dr,@($sr) */
1395 -1, "ldub-2", "ldub", 16,
1396 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1398 /* ldub $dr,@($sr,$slo16) */
1400 -1, "ldub-d2", "ldub", 32,
1401 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1403 /* lduh $dr,@($sr) */
1405 -1, "lduh-2", "lduh", 16,
1406 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1408 /* lduh $dr,@($sr,$slo16) */
1410 -1, "lduh-d2", "lduh", 32,
1411 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1415 -1, "pop", "pop", 16,
1416 { 0|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1418 /* ldi $dr,$simm8 */
1420 -1, "ldi8a", "ldi", 16,
1421 { 0|A(ALIAS
), { (1<<MACH_BASE
), PIPE_OS
} }
1423 /* ldi $dr,$hash$slo16 */
1425 -1, "ldi16a", "ldi", 32,
1426 { 0|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1430 -1, "rac-d", "rac", 16,
1431 { 0|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_S
} }
1433 /* rac $accd,$accs */
1435 -1, "rac-ds", "rac", 16,
1436 { 0|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_S
} }
1440 -1, "rach-d", "rach", 16,
1441 { 0|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_S
} }
1443 /* rach $accd,$accs */
1445 -1, "rach-ds", "rach", 16,
1446 { 0|A(ALIAS
), { (1<<MACH_M32RX
)|(1<<MACH_M32R2
), PIPE_S
} }
1448 /* st $src1,@($src2) */
1450 -1, "st-2", "st", 16,
1451 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1453 /* st $src1,@($src2,$slo16) */
1455 -1, "st-d2", "st", 32,
1456 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1458 /* stb $src1,@($src2) */
1460 -1, "stb-2", "stb", 16,
1461 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1463 /* stb $src1,@($src2,$slo16) */
1465 -1, "stb-d2", "stb", 32,
1466 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1468 /* sth $src1,@($src2) */
1470 -1, "sth-2", "sth", 16,
1471 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1473 /* sth $src1,@($src2,$slo16) */
1475 -1, "sth-d2", "sth", 32,
1476 { 0|A(NO_DIS
)|A(ALIAS
), { (1<<MACH_BASE
), PIPE_NONE
} }
1480 -1, "push", "push", 16,
1481 { 0|A(ALIAS
), { (1<<MACH_BASE
), PIPE_O
} }
1485 /* The macro instruction opcode table. */
1487 static const CGEN_OPCODE m32r_cgen_macro_insn_opcode_table
[] =
1492 { { MNEM
, ' ', OP (DISP8
), 0 } },
1493 & ifmt_bc8r
, { 0x7c00 }
1498 { { MNEM
, ' ', OP (DISP24
), 0 } },
1499 & ifmt_bc24r
, { 0xfc000000 }
1504 { { MNEM
, ' ', OP (DISP8
), 0 } },
1505 & ifmt_bl8r
, { 0x7e00 }
1510 { { MNEM
, ' ', OP (DISP24
), 0 } },
1511 & ifmt_bl24r
, { 0xfe000000 }
1516 { { MNEM
, ' ', OP (DISP8
), 0 } },
1517 & ifmt_bcl8r
, { 0x7800 }
1522 { { MNEM
, ' ', OP (DISP24
), 0 } },
1523 & ifmt_bcl24r
, { 0xf8000000 }
1528 { { MNEM
, ' ', OP (DISP8
), 0 } },
1529 & ifmt_bnc8r
, { 0x7d00 }
1534 { { MNEM
, ' ', OP (DISP24
), 0 } },
1535 & ifmt_bnc24r
, { 0xfd000000 }
1540 { { MNEM
, ' ', OP (DISP8
), 0 } },
1541 & ifmt_bra8r
, { 0x7f00 }
1546 { { MNEM
, ' ', OP (DISP24
), 0 } },
1547 & ifmt_bra24r
, { 0xff000000 }
1552 { { MNEM
, ' ', OP (DISP8
), 0 } },
1553 & ifmt_bncl8r
, { 0x7900 }
1558 { { MNEM
, ' ', OP (DISP24
), 0 } },
1559 & ifmt_bncl24r
, { 0xf9000000 }
1564 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1565 & ifmt_ld_2
, { 0x20c0 }
1567 /* ld $dr,@($sr,$slo16) */
1570 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1571 & ifmt_ld_d2
, { 0xa0c00000 }
1573 /* ldb $dr,@($sr) */
1576 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1577 & ifmt_ldb_2
, { 0x2080 }
1579 /* ldb $dr,@($sr,$slo16) */
1582 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1583 & ifmt_ldb_d2
, { 0xa0800000 }
1585 /* ldh $dr,@($sr) */
1588 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1589 & ifmt_ldh_2
, { 0x20a0 }
1591 /* ldh $dr,@($sr,$slo16) */
1594 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1595 & ifmt_ldh_d2
, { 0xa0a00000 }
1597 /* ldub $dr,@($sr) */
1600 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1601 & ifmt_ldub_2
, { 0x2090 }
1603 /* ldub $dr,@($sr,$slo16) */
1606 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1607 & ifmt_ldub_d2
, { 0xa0900000 }
1609 /* lduh $dr,@($sr) */
1612 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ')', 0 } },
1613 & ifmt_lduh_2
, { 0x20b0 }
1615 /* lduh $dr,@($sr,$slo16) */
1618 { { MNEM
, ' ', OP (DR
), ',', '@', '(', OP (SR
), ',', OP (SLO16
), ')', 0 } },
1619 & ifmt_lduh_d2
, { 0xa0b00000 }
1624 { { MNEM
, ' ', OP (DR
), 0 } },
1625 & ifmt_pop
, { 0x20ef }
1627 /* ldi $dr,$simm8 */
1630 { { MNEM
, ' ', OP (DR
), ',', OP (SIMM8
), 0 } },
1631 & ifmt_ldi8a
, { 0x6000 }
1633 /* ldi $dr,$hash$slo16 */
1636 { { MNEM
, ' ', OP (DR
), ',', OP (HASH
), OP (SLO16
), 0 } },
1637 & ifmt_ldi16a
, { 0x90f00000 }
1642 { { MNEM
, ' ', OP (ACCD
), 0 } },
1643 & ifmt_rac_d
, { 0x5090 }
1645 /* rac $accd,$accs */
1648 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), 0 } },
1649 & ifmt_rac_ds
, { 0x5090 }
1654 { { MNEM
, ' ', OP (ACCD
), 0 } },
1655 & ifmt_rach_d
, { 0x5080 }
1657 /* rach $accd,$accs */
1660 { { MNEM
, ' ', OP (ACCD
), ',', OP (ACCS
), 0 } },
1661 & ifmt_rach_ds
, { 0x5080 }
1663 /* st $src1,@($src2) */
1666 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1667 & ifmt_st_2
, { 0x2040 }
1669 /* st $src1,@($src2,$slo16) */
1672 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1673 & ifmt_st_d2
, { 0xa0400000 }
1675 /* stb $src1,@($src2) */
1678 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1679 & ifmt_stb_2
, { 0x2000 }
1681 /* stb $src1,@($src2,$slo16) */
1684 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1685 & ifmt_stb_d2
, { 0xa0000000 }
1687 /* sth $src1,@($src2) */
1690 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ')', 0 } },
1691 & ifmt_sth_2
, { 0x2020 }
1693 /* sth $src1,@($src2,$slo16) */
1696 { { MNEM
, ' ', OP (SRC1
), ',', '@', '(', OP (SRC2
), ',', OP (SLO16
), ')', 0 } },
1697 & ifmt_sth_d2
, { 0xa0200000 }
1702 { { MNEM
, ' ', OP (SRC1
), 0 } },
1703 & ifmt_push
, { 0x207f }
1712 #ifndef CGEN_ASM_HASH_P
1713 #define CGEN_ASM_HASH_P(insn) 1
1716 #ifndef CGEN_DIS_HASH_P
1717 #define CGEN_DIS_HASH_P(insn) 1
1720 /* Return non-zero if INSN is to be added to the hash table.
1721 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
1724 asm_hash_insn_p (insn
)
1725 const CGEN_INSN
*insn ATTRIBUTE_UNUSED
;
1727 return CGEN_ASM_HASH_P (insn
);
1731 dis_hash_insn_p (insn
)
1732 const CGEN_INSN
*insn
;
1734 /* If building the hash table and the NO-DIS attribute is present,
1736 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_NO_DIS
))
1738 return CGEN_DIS_HASH_P (insn
);
1741 #ifndef CGEN_ASM_HASH
1742 #define CGEN_ASM_HASH_SIZE 127
1743 #ifdef CGEN_MNEMONIC_OPERANDS
1744 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1746 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1750 /* It doesn't make much sense to provide a default here,
1751 but while this is under development we do.
1752 BUFFER is a pointer to the bytes of the insn, target order.
1753 VALUE is the first base_insn_bitsize bits as an int in host order. */
1755 #ifndef CGEN_DIS_HASH
1756 #define CGEN_DIS_HASH_SIZE 256
1757 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1760 /* The result is the hash value of the insn.
1761 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1764 asm_hash_insn (mnem
)
1767 return CGEN_ASM_HASH (mnem
);
1770 /* BUF is a pointer to the bytes of the insn, target order.
1771 VALUE is the first base_insn_bitsize bits as an int in host order. */
1774 dis_hash_insn (buf
, value
)
1775 const char * buf ATTRIBUTE_UNUSED
;
1776 CGEN_INSN_INT value ATTRIBUTE_UNUSED
;
1778 return CGEN_DIS_HASH (buf
, value
);
1781 static void set_fields_bitsize
PARAMS ((CGEN_FIELDS
*, int));
1783 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1786 set_fields_bitsize (fields
, size
)
1787 CGEN_FIELDS
*fields
;
1790 CGEN_FIELDS_BITSIZE (fields
) = size
;
1793 /* Function to call before using the operand instance table.
1794 This plugs the opcode entries and macro instructions into the cpu table. */
1797 m32r_cgen_init_opcode_table (cd
)
1801 int num_macros
= (sizeof (m32r_cgen_macro_insn_table
) /
1802 sizeof (m32r_cgen_macro_insn_table
[0]));
1803 const CGEN_IBASE
*ib
= & m32r_cgen_macro_insn_table
[0];
1804 const CGEN_OPCODE
*oc
= & m32r_cgen_macro_insn_opcode_table
[0];
1805 CGEN_INSN
*insns
= (CGEN_INSN
*) xmalloc (num_macros
* sizeof (CGEN_INSN
));
1806 memset (insns
, 0, num_macros
* sizeof (CGEN_INSN
));
1807 for (i
= 0; i
< num_macros
; ++i
)
1809 insns
[i
].base
= &ib
[i
];
1810 insns
[i
].opcode
= &oc
[i
];
1811 m32r_cgen_build_insn_regex (& insns
[i
]);
1813 cd
->macro_insn_table
.init_entries
= insns
;
1814 cd
->macro_insn_table
.entry_size
= sizeof (CGEN_IBASE
);
1815 cd
->macro_insn_table
.num_init_entries
= num_macros
;
1817 oc
= & m32r_cgen_insn_opcode_table
[0];
1818 insns
= (CGEN_INSN
*) cd
->insn_table
.init_entries
;
1819 for (i
= 0; i
< MAX_INSNS
; ++i
)
1821 insns
[i
].opcode
= &oc
[i
];
1822 m32r_cgen_build_insn_regex (& insns
[i
]);
1825 cd
->sizeof_fields
= sizeof (CGEN_FIELDS
);
1826 cd
->set_fields_bitsize
= set_fields_bitsize
;
1828 cd
->asm_hash_p
= asm_hash_insn_p
;
1829 cd
->asm_hash
= asm_hash_insn
;
1830 cd
->asm_hash_size
= CGEN_ASM_HASH_SIZE
;
1832 cd
->dis_hash_p
= dis_hash_insn_p
;
1833 cd
->dis_hash
= dis_hash_insn
;
1834 cd
->dis_hash_size
= CGEN_DIS_HASH_SIZE
;