file configure.info-2 was initially added on branch binutils-2_10-branch.
[binutils.git] / opcodes / m32r-opc.c
bloba1efecc3c8d91bba4da0b6ef1c19b618232449e0
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)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include "sysdep.h"
26 #include "ansidecl.h"
27 #include "bfd.h"
28 #include "symcat.h"
29 #include "m32r-desc.h"
30 #include "m32r-opc.h"
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 = {
45 0, 0, 0x0, { 0 }
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_cmpz = {
97 16, 16, 0xfff0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
100 static const CGEN_IFMT ifmt_div = {
101 32, 32, 0xf0f0ffff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
104 static const CGEN_IFMT ifmt_jc = {
105 16, 16, 0xfff0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
108 static const CGEN_IFMT ifmt_ld24 = {
109 32, 32, 0xf0000000, { F (F_OP1), F (F_R1), F (F_UIMM24), 0 }
112 static const CGEN_IFMT ifmt_ldi16 = {
113 32, 32, 0xf0ff0000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
116 static const CGEN_IFMT ifmt_machi_a = {
117 16, 16, 0xf070, { F (F_OP1), F (F_R1), F (F_ACC), F (F_OP23), F (F_R2), 0 }
120 static const CGEN_IFMT ifmt_mvfachi = {
121 16, 16, 0xf0ff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
124 static const CGEN_IFMT ifmt_mvfachi_a = {
125 16, 16, 0xf0f3, { F (F_OP1), F (F_R1), F (F_OP2), F (F_ACCS), F (F_OP3), 0 }
128 static const CGEN_IFMT ifmt_mvfc = {
129 16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
132 static const CGEN_IFMT ifmt_mvtachi = {
133 16, 16, 0xf0ff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
136 static const CGEN_IFMT ifmt_mvtachi_a = {
137 16, 16, 0xf0f3, { F (F_OP1), F (F_R1), F (F_OP2), F (F_ACCS), F (F_OP3), 0 }
140 static const CGEN_IFMT ifmt_mvtc = {
141 16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
144 static const CGEN_IFMT ifmt_nop = {
145 16, 16, 0xffff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
148 static const CGEN_IFMT ifmt_rac_dsi = {
149 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 }
152 static const CGEN_IFMT ifmt_seth = {
153 32, 32, 0xf0ff0000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_HI16), 0 }
156 static const CGEN_IFMT ifmt_slli = {
157 16, 16, 0xf0e0, { F (F_OP1), F (F_R1), F (F_SHIFT_OP2), F (F_UIMM5), 0 }
160 static const CGEN_IFMT ifmt_st_d = {
161 32, 32, 0xf0f00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
164 static const CGEN_IFMT ifmt_trap = {
165 16, 16, 0xfff0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_UIMM4), 0 }
168 static const CGEN_IFMT ifmt_satb = {
169 32, 32, 0xf0f0ffff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_UIMM16), 0 }
172 #undef F
174 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
175 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
176 #define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
177 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
179 /* The instruction table. */
181 static const CGEN_OPCODE m32r_cgen_insn_opcode_table[MAX_INSNS] =
183 /* Special null first entry.
184 A `num' value of zero is thus invalid.
185 Also, the special `invalid' insn resides here. */
186 { { 0 } },
187 /* add $dr,$sr */
189 { 0, 0, 0, 0 },
190 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
191 & ifmt_add, { 0xa0 }
193 /* add3 $dr,$sr,$hash$slo16 */
195 { 0, 0, 0, 0 },
196 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (HASH), OP (SLO16), 0 } },
197 & ifmt_add3, { 0x80a00000 }
199 /* and $dr,$sr */
201 { 0, 0, 0, 0 },
202 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
203 & ifmt_add, { 0xc0 }
205 /* and3 $dr,$sr,$uimm16 */
207 { 0, 0, 0, 0 },
208 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (UIMM16), 0 } },
209 & ifmt_and3, { 0x80c00000 }
211 /* or $dr,$sr */
213 { 0, 0, 0, 0 },
214 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
215 & ifmt_add, { 0xe0 }
217 /* or3 $dr,$sr,$hash$ulo16 */
219 { 0, 0, 0, 0 },
220 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (HASH), OP (ULO16), 0 } },
221 & ifmt_or3, { 0x80e00000 }
223 /* xor $dr,$sr */
225 { 0, 0, 0, 0 },
226 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
227 & ifmt_add, { 0xd0 }
229 /* xor3 $dr,$sr,$uimm16 */
231 { 0, 0, 0, 0 },
232 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (UIMM16), 0 } },
233 & ifmt_and3, { 0x80d00000 }
235 /* addi $dr,$simm8 */
237 { 0, 0, 0, 0 },
238 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
239 & ifmt_addi, { 0x4000 }
241 /* addv $dr,$sr */
243 { 0, 0, 0, 0 },
244 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
245 & ifmt_add, { 0x80 }
247 /* addv3 $dr,$sr,$simm16 */
249 { 0, 0, 0, 0 },
250 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
251 & ifmt_addv3, { 0x80800000 }
253 /* addx $dr,$sr */
255 { 0, 0, 0, 0 },
256 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
257 & ifmt_add, { 0x90 }
259 /* bc.s $disp8 */
261 { 0, 0, 0, 0 },
262 { { MNEM, ' ', OP (DISP8), 0 } },
263 & ifmt_bc8, { 0x7c00 }
265 /* bc.l $disp24 */
267 { 0, 0, 0, 0 },
268 { { MNEM, ' ', OP (DISP24), 0 } },
269 & ifmt_bc24, { 0xfc000000 }
271 /* beq $src1,$src2,$disp16 */
273 { 0, 0, 0, 0 },
274 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (DISP16), 0 } },
275 & ifmt_beq, { 0xb0000000 }
277 /* beqz $src2,$disp16 */
279 { 0, 0, 0, 0 },
280 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
281 & ifmt_beqz, { 0xb0800000 }
283 /* bgez $src2,$disp16 */
285 { 0, 0, 0, 0 },
286 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
287 & ifmt_beqz, { 0xb0b00000 }
289 /* bgtz $src2,$disp16 */
291 { 0, 0, 0, 0 },
292 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
293 & ifmt_beqz, { 0xb0d00000 }
295 /* blez $src2,$disp16 */
297 { 0, 0, 0, 0 },
298 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
299 & ifmt_beqz, { 0xb0c00000 }
301 /* bltz $src2,$disp16 */
303 { 0, 0, 0, 0 },
304 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
305 & ifmt_beqz, { 0xb0a00000 }
307 /* bnez $src2,$disp16 */
309 { 0, 0, 0, 0 },
310 { { MNEM, ' ', OP (SRC2), ',', OP (DISP16), 0 } },
311 & ifmt_beqz, { 0xb0900000 }
313 /* bl.s $disp8 */
315 { 0, 0, 0, 0 },
316 { { MNEM, ' ', OP (DISP8), 0 } },
317 & ifmt_bc8, { 0x7e00 }
319 /* bl.l $disp24 */
321 { 0, 0, 0, 0 },
322 { { MNEM, ' ', OP (DISP24), 0 } },
323 & ifmt_bc24, { 0xfe000000 }
325 /* bcl.s $disp8 */
327 { 0, 0, 0, 0 },
328 { { MNEM, ' ', OP (DISP8), 0 } },
329 & ifmt_bc8, { 0x7800 }
331 /* bcl.l $disp24 */
333 { 0, 0, 0, 0 },
334 { { MNEM, ' ', OP (DISP24), 0 } },
335 & ifmt_bc24, { 0xf8000000 }
337 /* bnc.s $disp8 */
339 { 0, 0, 0, 0 },
340 { { MNEM, ' ', OP (DISP8), 0 } },
341 & ifmt_bc8, { 0x7d00 }
343 /* bnc.l $disp24 */
345 { 0, 0, 0, 0 },
346 { { MNEM, ' ', OP (DISP24), 0 } },
347 & ifmt_bc24, { 0xfd000000 }
349 /* bne $src1,$src2,$disp16 */
351 { 0, 0, 0, 0 },
352 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (DISP16), 0 } },
353 & ifmt_beq, { 0xb0100000 }
355 /* bra.s $disp8 */
357 { 0, 0, 0, 0 },
358 { { MNEM, ' ', OP (DISP8), 0 } },
359 & ifmt_bc8, { 0x7f00 }
361 /* bra.l $disp24 */
363 { 0, 0, 0, 0 },
364 { { MNEM, ' ', OP (DISP24), 0 } },
365 & ifmt_bc24, { 0xff000000 }
367 /* bncl.s $disp8 */
369 { 0, 0, 0, 0 },
370 { { MNEM, ' ', OP (DISP8), 0 } },
371 & ifmt_bc8, { 0x7900 }
373 /* bncl.l $disp24 */
375 { 0, 0, 0, 0 },
376 { { MNEM, ' ', OP (DISP24), 0 } },
377 & ifmt_bc24, { 0xf9000000 }
379 /* cmp $src1,$src2 */
381 { 0, 0, 0, 0 },
382 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
383 & ifmt_cmp, { 0x40 }
385 /* cmpi $src2,$simm16 */
387 { 0, 0, 0, 0 },
388 { { MNEM, ' ', OP (SRC2), ',', OP (SIMM16), 0 } },
389 & ifmt_cmpi, { 0x80400000 }
391 /* cmpu $src1,$src2 */
393 { 0, 0, 0, 0 },
394 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
395 & ifmt_cmp, { 0x50 }
397 /* cmpui $src2,$simm16 */
399 { 0, 0, 0, 0 },
400 { { MNEM, ' ', OP (SRC2), ',', OP (SIMM16), 0 } },
401 & ifmt_cmpi, { 0x80500000 }
403 /* cmpeq $src1,$src2 */
405 { 0, 0, 0, 0 },
406 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
407 & ifmt_cmp, { 0x60 }
409 /* cmpz $src2 */
411 { 0, 0, 0, 0 },
412 { { MNEM, ' ', OP (SRC2), 0 } },
413 & ifmt_cmpz, { 0x70 }
415 /* div $dr,$sr */
417 { 0, 0, 0, 0 },
418 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
419 & ifmt_div, { 0x90000000 }
421 /* divu $dr,$sr */
423 { 0, 0, 0, 0 },
424 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
425 & ifmt_div, { 0x90100000 }
427 /* rem $dr,$sr */
429 { 0, 0, 0, 0 },
430 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
431 & ifmt_div, { 0x90200000 }
433 /* remu $dr,$sr */
435 { 0, 0, 0, 0 },
436 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
437 & ifmt_div, { 0x90300000 }
439 /* divh $dr,$sr */
441 { 0, 0, 0, 0 },
442 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
443 & ifmt_div, { 0x90000010 }
445 /* jc $sr */
447 { 0, 0, 0, 0 },
448 { { MNEM, ' ', OP (SR), 0 } },
449 & ifmt_jc, { 0x1cc0 }
451 /* jnc $sr */
453 { 0, 0, 0, 0 },
454 { { MNEM, ' ', OP (SR), 0 } },
455 & ifmt_jc, { 0x1dc0 }
457 /* jl $sr */
459 { 0, 0, 0, 0 },
460 { { MNEM, ' ', OP (SR), 0 } },
461 & ifmt_jc, { 0x1ec0 }
463 /* jmp $sr */
465 { 0, 0, 0, 0 },
466 { { MNEM, ' ', OP (SR), 0 } },
467 & ifmt_jc, { 0x1fc0 }
469 /* ld $dr,@$sr */
471 { 0, 0, 0, 0 },
472 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
473 & ifmt_add, { 0x20c0 }
475 /* ld $dr,@($slo16,$sr) */
477 { 0, 0, 0, 0 },
478 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
479 & ifmt_add3, { 0xa0c00000 }
481 /* ldb $dr,@$sr */
483 { 0, 0, 0, 0 },
484 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
485 & ifmt_add, { 0x2080 }
487 /* ldb $dr,@($slo16,$sr) */
489 { 0, 0, 0, 0 },
490 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
491 & ifmt_add3, { 0xa0800000 }
493 /* ldh $dr,@$sr */
495 { 0, 0, 0, 0 },
496 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
497 & ifmt_add, { 0x20a0 }
499 /* ldh $dr,@($slo16,$sr) */
501 { 0, 0, 0, 0 },
502 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
503 & ifmt_add3, { 0xa0a00000 }
505 /* ldub $dr,@$sr */
507 { 0, 0, 0, 0 },
508 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
509 & ifmt_add, { 0x2090 }
511 /* ldub $dr,@($slo16,$sr) */
513 { 0, 0, 0, 0 },
514 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
515 & ifmt_add3, { 0xa0900000 }
517 /* lduh $dr,@$sr */
519 { 0, 0, 0, 0 },
520 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
521 & ifmt_add, { 0x20b0 }
523 /* lduh $dr,@($slo16,$sr) */
525 { 0, 0, 0, 0 },
526 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } },
527 & ifmt_add3, { 0xa0b00000 }
529 /* ld $dr,@$sr+ */
531 { 0, 0, 0, 0 },
532 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), '+', 0 } },
533 & ifmt_add, { 0x20e0 }
535 /* ld24 $dr,$uimm24 */
537 { 0, 0, 0, 0 },
538 { { MNEM, ' ', OP (DR), ',', OP (UIMM24), 0 } },
539 & ifmt_ld24, { 0xe0000000 }
541 /* ldi8 $dr,$simm8 */
543 { 0, 0, 0, 0 },
544 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
545 & ifmt_addi, { 0x6000 }
547 /* ldi16 $dr,$hash$slo16 */
549 { 0, 0, 0, 0 },
550 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (SLO16), 0 } },
551 & ifmt_ldi16, { 0x90f00000 }
553 /* lock $dr,@$sr */
555 { 0, 0, 0, 0 },
556 { { MNEM, ' ', OP (DR), ',', '@', OP (SR), 0 } },
557 & ifmt_add, { 0x20d0 }
559 /* machi $src1,$src2 */
561 { 0, 0, 0, 0 },
562 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
563 & ifmt_cmp, { 0x3040 }
565 /* machi $src1,$src2,$acc */
567 { 0, 0, 0, 0 },
568 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
569 & ifmt_machi_a, { 0x3040 }
571 /* maclo $src1,$src2 */
573 { 0, 0, 0, 0 },
574 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
575 & ifmt_cmp, { 0x3050 }
577 /* maclo $src1,$src2,$acc */
579 { 0, 0, 0, 0 },
580 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
581 & ifmt_machi_a, { 0x3050 }
583 /* macwhi $src1,$src2 */
585 { 0, 0, 0, 0 },
586 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
587 & ifmt_cmp, { 0x3060 }
589 /* macwhi $src1,$src2,$acc */
591 { 0, 0, 0, 0 },
592 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
593 & ifmt_machi_a, { 0x3060 }
595 /* macwlo $src1,$src2 */
597 { 0, 0, 0, 0 },
598 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
599 & ifmt_cmp, { 0x3070 }
601 /* macwlo $src1,$src2,$acc */
603 { 0, 0, 0, 0 },
604 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
605 & ifmt_machi_a, { 0x3070 }
607 /* mul $dr,$sr */
609 { 0, 0, 0, 0 },
610 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
611 & ifmt_add, { 0x1060 }
613 /* mulhi $src1,$src2 */
615 { 0, 0, 0, 0 },
616 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
617 & ifmt_cmp, { 0x3000 }
619 /* mulhi $src1,$src2,$acc */
621 { 0, 0, 0, 0 },
622 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
623 & ifmt_machi_a, { 0x3000 }
625 /* mullo $src1,$src2 */
627 { 0, 0, 0, 0 },
628 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
629 & ifmt_cmp, { 0x3010 }
631 /* mullo $src1,$src2,$acc */
633 { 0, 0, 0, 0 },
634 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
635 & ifmt_machi_a, { 0x3010 }
637 /* mulwhi $src1,$src2 */
639 { 0, 0, 0, 0 },
640 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
641 & ifmt_cmp, { 0x3020 }
643 /* mulwhi $src1,$src2,$acc */
645 { 0, 0, 0, 0 },
646 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
647 & ifmt_machi_a, { 0x3020 }
649 /* mulwlo $src1,$src2 */
651 { 0, 0, 0, 0 },
652 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
653 & ifmt_cmp, { 0x3030 }
655 /* mulwlo $src1,$src2,$acc */
657 { 0, 0, 0, 0 },
658 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), ',', OP (ACC), 0 } },
659 & ifmt_machi_a, { 0x3030 }
661 /* mv $dr,$sr */
663 { 0, 0, 0, 0 },
664 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
665 & ifmt_add, { 0x1080 }
667 /* mvfachi $dr */
669 { 0, 0, 0, 0 },
670 { { MNEM, ' ', OP (DR), 0 } },
671 & ifmt_mvfachi, { 0x50f0 }
673 /* mvfachi $dr,$accs */
675 { 0, 0, 0, 0 },
676 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
677 & ifmt_mvfachi_a, { 0x50f0 }
679 /* mvfaclo $dr */
681 { 0, 0, 0, 0 },
682 { { MNEM, ' ', OP (DR), 0 } },
683 & ifmt_mvfachi, { 0x50f1 }
685 /* mvfaclo $dr,$accs */
687 { 0, 0, 0, 0 },
688 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
689 & ifmt_mvfachi_a, { 0x50f1 }
691 /* mvfacmi $dr */
693 { 0, 0, 0, 0 },
694 { { MNEM, ' ', OP (DR), 0 } },
695 & ifmt_mvfachi, { 0x50f2 }
697 /* mvfacmi $dr,$accs */
699 { 0, 0, 0, 0 },
700 { { MNEM, ' ', OP (DR), ',', OP (ACCS), 0 } },
701 & ifmt_mvfachi_a, { 0x50f2 }
703 /* mvfc $dr,$scr */
705 { 0, 0, 0, 0 },
706 { { MNEM, ' ', OP (DR), ',', OP (SCR), 0 } },
707 & ifmt_mvfc, { 0x1090 }
709 /* mvtachi $src1 */
711 { 0, 0, 0, 0 },
712 { { MNEM, ' ', OP (SRC1), 0 } },
713 & ifmt_mvtachi, { 0x5070 }
715 /* mvtachi $src1,$accs */
717 { 0, 0, 0, 0 },
718 { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
719 & ifmt_mvtachi_a, { 0x5070 }
721 /* mvtaclo $src1 */
723 { 0, 0, 0, 0 },
724 { { MNEM, ' ', OP (SRC1), 0 } },
725 & ifmt_mvtachi, { 0x5071 }
727 /* mvtaclo $src1,$accs */
729 { 0, 0, 0, 0 },
730 { { MNEM, ' ', OP (SRC1), ',', OP (ACCS), 0 } },
731 & ifmt_mvtachi_a, { 0x5071 }
733 /* mvtc $sr,$dcr */
735 { 0, 0, 0, 0 },
736 { { MNEM, ' ', OP (SR), ',', OP (DCR), 0 } },
737 & ifmt_mvtc, { 0x10a0 }
739 /* neg $dr,$sr */
741 { 0, 0, 0, 0 },
742 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
743 & ifmt_add, { 0x30 }
745 /* nop */
747 { 0, 0, 0, 0 },
748 { { MNEM, 0 } },
749 & ifmt_nop, { 0x7000 }
751 /* not $dr,$sr */
753 { 0, 0, 0, 0 },
754 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
755 & ifmt_add, { 0xb0 }
757 /* rac */
759 { 0, 0, 0, 0 },
760 { { MNEM, 0 } },
761 & ifmt_nop, { 0x5090 }
763 /* rac $accd,$accs,$imm1 */
765 { 0, 0, 0, 0 },
766 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
767 & ifmt_rac_dsi, { 0x5090 }
769 /* rach */
771 { 0, 0, 0, 0 },
772 { { MNEM, 0 } },
773 & ifmt_nop, { 0x5080 }
775 /* rach $accd,$accs,$imm1 */
777 { 0, 0, 0, 0 },
778 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), ',', OP (IMM1), 0 } },
779 & ifmt_rac_dsi, { 0x5080 }
781 /* rte */
783 { 0, 0, 0, 0 },
784 { { MNEM, 0 } },
785 & ifmt_nop, { 0x10d6 }
787 /* seth $dr,$hash$hi16 */
789 { 0, 0, 0, 0 },
790 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (HI16), 0 } },
791 & ifmt_seth, { 0xd0c00000 }
793 /* sll $dr,$sr */
795 { 0, 0, 0, 0 },
796 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
797 & ifmt_add, { 0x1040 }
799 /* sll3 $dr,$sr,$simm16 */
801 { 0, 0, 0, 0 },
802 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
803 & ifmt_addv3, { 0x90c00000 }
805 /* slli $dr,$uimm5 */
807 { 0, 0, 0, 0 },
808 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
809 & ifmt_slli, { 0x5040 }
811 /* sra $dr,$sr */
813 { 0, 0, 0, 0 },
814 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
815 & ifmt_add, { 0x1020 }
817 /* sra3 $dr,$sr,$simm16 */
819 { 0, 0, 0, 0 },
820 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
821 & ifmt_addv3, { 0x90a00000 }
823 /* srai $dr,$uimm5 */
825 { 0, 0, 0, 0 },
826 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
827 & ifmt_slli, { 0x5020 }
829 /* srl $dr,$sr */
831 { 0, 0, 0, 0 },
832 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
833 & ifmt_add, { 0x1000 }
835 /* srl3 $dr,$sr,$simm16 */
837 { 0, 0, 0, 0 },
838 { { MNEM, ' ', OP (DR), ',', OP (SR), ',', OP (SIMM16), 0 } },
839 & ifmt_addv3, { 0x90800000 }
841 /* srli $dr,$uimm5 */
843 { 0, 0, 0, 0 },
844 { { MNEM, ' ', OP (DR), ',', OP (UIMM5), 0 } },
845 & ifmt_slli, { 0x5000 }
847 /* st $src1,@$src2 */
849 { 0, 0, 0, 0 },
850 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
851 & ifmt_cmp, { 0x2040 }
853 /* st $src1,@($slo16,$src2) */
855 { 0, 0, 0, 0 },
856 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
857 & ifmt_st_d, { 0xa0400000 }
859 /* stb $src1,@$src2 */
861 { 0, 0, 0, 0 },
862 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
863 & ifmt_cmp, { 0x2000 }
865 /* stb $src1,@($slo16,$src2) */
867 { 0, 0, 0, 0 },
868 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
869 & ifmt_st_d, { 0xa0000000 }
871 /* sth $src1,@$src2 */
873 { 0, 0, 0, 0 },
874 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
875 & ifmt_cmp, { 0x2020 }
877 /* sth $src1,@($slo16,$src2) */
879 { 0, 0, 0, 0 },
880 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SLO16), ',', OP (SRC2), ')', 0 } },
881 & ifmt_st_d, { 0xa0200000 }
883 /* st $src1,@+$src2 */
885 { 0, 0, 0, 0 },
886 { { MNEM, ' ', OP (SRC1), ',', '@', '+', OP (SRC2), 0 } },
887 & ifmt_cmp, { 0x2060 }
889 /* st $src1,@-$src2 */
891 { 0, 0, 0, 0 },
892 { { MNEM, ' ', OP (SRC1), ',', '@', '-', OP (SRC2), 0 } },
893 & ifmt_cmp, { 0x2070 }
895 /* sub $dr,$sr */
897 { 0, 0, 0, 0 },
898 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
899 & ifmt_add, { 0x20 }
901 /* subv $dr,$sr */
903 { 0, 0, 0, 0 },
904 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
905 & ifmt_add, { 0x0 }
907 /* subx $dr,$sr */
909 { 0, 0, 0, 0 },
910 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
911 & ifmt_add, { 0x10 }
913 /* trap $uimm4 */
915 { 0, 0, 0, 0 },
916 { { MNEM, ' ', OP (UIMM4), 0 } },
917 & ifmt_trap, { 0x10f0 }
919 /* unlock $src1,@$src2 */
921 { 0, 0, 0, 0 },
922 { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), 0 } },
923 & ifmt_cmp, { 0x2050 }
925 /* satb $dr,$sr */
927 { 0, 0, 0, 0 },
928 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
929 & ifmt_satb, { 0x80600300 }
931 /* sath $dr,$sr */
933 { 0, 0, 0, 0 },
934 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
935 & ifmt_satb, { 0x80600200 }
937 /* sat $dr,$sr */
939 { 0, 0, 0, 0 },
940 { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } },
941 & ifmt_satb, { 0x80600000 }
943 /* pcmpbz $src2 */
945 { 0, 0, 0, 0 },
946 { { MNEM, ' ', OP (SRC2), 0 } },
947 & ifmt_cmpz, { 0x370 }
949 /* sadd */
951 { 0, 0, 0, 0 },
952 { { MNEM, 0 } },
953 & ifmt_nop, { 0x50e4 }
955 /* macwu1 $src1,$src2 */
957 { 0, 0, 0, 0 },
958 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
959 & ifmt_cmp, { 0x50b0 }
961 /* msblo $src1,$src2 */
963 { 0, 0, 0, 0 },
964 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
965 & ifmt_cmp, { 0x50d0 }
967 /* mulwu1 $src1,$src2 */
969 { 0, 0, 0, 0 },
970 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
971 & ifmt_cmp, { 0x50a0 }
973 /* maclh1 $src1,$src2 */
975 { 0, 0, 0, 0 },
976 { { MNEM, ' ', OP (SRC1), ',', OP (SRC2), 0 } },
977 & ifmt_cmp, { 0x50c0 }
979 /* sc */
981 { 0, 0, 0, 0 },
982 { { MNEM, 0 } },
983 & ifmt_nop, { 0x7401 }
985 /* snc */
987 { 0, 0, 0, 0 },
988 { { MNEM, 0 } },
989 & ifmt_nop, { 0x7501 }
993 #undef A
994 #undef MNEM
995 #undef OPERAND
996 #undef OP
998 /* Formats for ALIAS macro-insns. */
1000 #define F(f) & m32r_cgen_ifld_table[CONCAT2 (M32R_,f)]
1002 static const CGEN_IFMT ifmt_bc8r = {
1003 16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
1006 static const CGEN_IFMT ifmt_bc24r = {
1007 32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
1010 static const CGEN_IFMT ifmt_bl8r = {
1011 16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
1014 static const CGEN_IFMT ifmt_bl24r = {
1015 32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
1018 static const CGEN_IFMT ifmt_bcl8r = {
1019 16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
1022 static const CGEN_IFMT ifmt_bcl24r = {
1023 32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
1026 static const CGEN_IFMT ifmt_bnc8r = {
1027 16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
1030 static const CGEN_IFMT ifmt_bnc24r = {
1031 32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
1034 static const CGEN_IFMT ifmt_bra8r = {
1035 16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
1038 static const CGEN_IFMT ifmt_bra24r = {
1039 32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
1042 static const CGEN_IFMT ifmt_bncl8r = {
1043 16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
1046 static const CGEN_IFMT ifmt_bncl24r = {
1047 32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
1050 static const CGEN_IFMT ifmt_ld_2 = {
1051 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1054 static const CGEN_IFMT ifmt_ld_d2 = {
1055 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1058 static const CGEN_IFMT ifmt_ldb_2 = {
1059 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1062 static const CGEN_IFMT ifmt_ldb_d2 = {
1063 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1066 static const CGEN_IFMT ifmt_ldh_2 = {
1067 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1070 static const CGEN_IFMT ifmt_ldh_d2 = {
1071 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1074 static const CGEN_IFMT ifmt_ldub_2 = {
1075 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1078 static const CGEN_IFMT ifmt_ldub_d2 = {
1079 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1082 static const CGEN_IFMT ifmt_lduh_2 = {
1083 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1086 static const CGEN_IFMT ifmt_lduh_d2 = {
1087 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1090 static const CGEN_IFMT ifmt_pop = {
1091 16, 16, 0xf0ff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
1094 static const CGEN_IFMT ifmt_ldi8a = {
1095 16, 16, 0xf000, { F (F_OP1), F (F_R1), F (F_SIMM8), 0 }
1098 static const CGEN_IFMT ifmt_ldi16a = {
1099 32, 32, 0xf0ff0000, { F (F_OP1), F (F_OP2), F (F_R2), F (F_R1), F (F_SIMM16), 0 }
1102 static const CGEN_IFMT ifmt_rac_d = {
1103 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 }
1106 static const CGEN_IFMT ifmt_rac_ds = {
1107 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 }
1110 static const CGEN_IFMT ifmt_rach_d = {
1111 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 }
1114 static const CGEN_IFMT ifmt_rach_ds = {
1115 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 }
1118 static const CGEN_IFMT ifmt_st_2 = {
1119 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1122 static const CGEN_IFMT ifmt_st_d2 = {
1123 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1126 static const CGEN_IFMT ifmt_stb_2 = {
1127 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1130 static const CGEN_IFMT ifmt_stb_d2 = {
1131 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1134 static const CGEN_IFMT ifmt_sth_2 = {
1135 16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1138 static const CGEN_IFMT ifmt_sth_d2 = {
1139 32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
1142 static const CGEN_IFMT ifmt_push = {
1143 16, 16, 0xf0ff, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
1146 #undef F
1148 /* Each non-simple macro entry points to an array of expansion possibilities. */
1150 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
1151 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
1152 #define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
1153 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
1155 /* The macro instruction table. */
1157 static const CGEN_IBASE m32r_cgen_macro_insn_table[] =
1159 /* bc $disp8 */
1161 -1, "bc8r", "bc", 16,
1162 { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1164 /* bc $disp24 */
1166 -1, "bc24r", "bc", 32,
1167 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1169 /* bl $disp8 */
1171 -1, "bl8r", "bl", 16,
1172 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1174 /* bl $disp24 */
1176 -1, "bl24r", "bl", 32,
1177 { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1179 /* bcl $disp8 */
1181 -1, "bcl8r", "bcl", 16,
1182 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } }
1184 /* bcl $disp24 */
1186 -1, "bcl24r", "bcl", 32,
1187 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } }
1189 /* bnc $disp8 */
1191 -1, "bnc8r", "bnc", 16,
1192 { 0|A(RELAXABLE)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1194 /* bnc $disp24 */
1196 -1, "bnc24r", "bnc", 32,
1197 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1199 /* bra $disp8 */
1201 -1, "bra8r", "bra", 16,
1202 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1204 /* bra $disp24 */
1206 -1, "bra24r", "bra", 32,
1207 { 0|A(RELAX)|A(UNCOND_CTI)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1209 /* bncl $disp8 */
1211 -1, "bncl8r", "bncl", 16,
1212 { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } }
1214 /* bncl $disp24 */
1216 -1, "bncl24r", "bncl", 32,
1217 { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } }
1219 /* ld $dr,@($sr) */
1221 -1, "ld-2", "ld", 16,
1222 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1224 /* ld $dr,@($sr,$slo16) */
1226 -1, "ld-d2", "ld", 32,
1227 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1229 /* ldb $dr,@($sr) */
1231 -1, "ldb-2", "ldb", 16,
1232 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1234 /* ldb $dr,@($sr,$slo16) */
1236 -1, "ldb-d2", "ldb", 32,
1237 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1239 /* ldh $dr,@($sr) */
1241 -1, "ldh-2", "ldh", 16,
1242 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1244 /* ldh $dr,@($sr,$slo16) */
1246 -1, "ldh-d2", "ldh", 32,
1247 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1249 /* ldub $dr,@($sr) */
1251 -1, "ldub-2", "ldub", 16,
1252 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1254 /* ldub $dr,@($sr,$slo16) */
1256 -1, "ldub-d2", "ldub", 32,
1257 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1259 /* lduh $dr,@($sr) */
1261 -1, "lduh-2", "lduh", 16,
1262 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1264 /* lduh $dr,@($sr,$slo16) */
1266 -1, "lduh-d2", "lduh", 32,
1267 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1269 /* pop $dr */
1271 -1, "pop", "pop", 16,
1272 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1274 /* ldi $dr,$simm8 */
1276 -1, "ldi8a", "ldi", 16,
1277 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_OS } }
1279 /* ldi $dr,$hash$slo16 */
1281 -1, "ldi16a", "ldi", 32,
1282 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1284 /* rac $accd */
1286 -1, "rac-d", "rac", 16,
1287 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1289 /* rac $accd,$accs */
1291 -1, "rac-ds", "rac", 16,
1292 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1294 /* rach $accd */
1296 -1, "rach-d", "rach", 16,
1297 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1299 /* rach $accd,$accs */
1301 -1, "rach-ds", "rach", 16,
1302 { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } }
1304 /* st $src1,@($src2) */
1306 -1, "st-2", "st", 16,
1307 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1309 /* st $src1,@($src2,$slo16) */
1311 -1, "st-d2", "st", 32,
1312 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1314 /* stb $src1,@($src2) */
1316 -1, "stb-2", "stb", 16,
1317 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1319 /* stb $src1,@($src2,$slo16) */
1321 -1, "stb-d2", "stb", 32,
1322 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1324 /* sth $src1,@($src2) */
1326 -1, "sth-2", "sth", 16,
1327 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_O } }
1329 /* sth $src1,@($src2,$slo16) */
1331 -1, "sth-d2", "sth", 32,
1332 { 0|A(NO_DIS)|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1334 /* push $src1 */
1336 -1, "push", "push", 16,
1337 { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } }
1341 /* The macro instruction opcode table. */
1343 static const CGEN_OPCODE m32r_cgen_macro_insn_opcode_table[] =
1345 /* bc $disp8 */
1347 { 0, 0, 0, 0 },
1348 { { MNEM, ' ', OP (DISP8), 0 } },
1349 & ifmt_bc8r, { 0x7c00 }
1351 /* bc $disp24 */
1353 { 0, 0, 0, 0 },
1354 { { MNEM, ' ', OP (DISP24), 0 } },
1355 & ifmt_bc24r, { 0xfc000000 }
1357 /* bl $disp8 */
1359 { 0, 0, 0, 0 },
1360 { { MNEM, ' ', OP (DISP8), 0 } },
1361 & ifmt_bl8r, { 0x7e00 }
1363 /* bl $disp24 */
1365 { 0, 0, 0, 0 },
1366 { { MNEM, ' ', OP (DISP24), 0 } },
1367 & ifmt_bl24r, { 0xfe000000 }
1369 /* bcl $disp8 */
1371 { 0, 0, 0, 0 },
1372 { { MNEM, ' ', OP (DISP8), 0 } },
1373 & ifmt_bcl8r, { 0x7800 }
1375 /* bcl $disp24 */
1377 { 0, 0, 0, 0 },
1378 { { MNEM, ' ', OP (DISP24), 0 } },
1379 & ifmt_bcl24r, { 0xf8000000 }
1381 /* bnc $disp8 */
1383 { 0, 0, 0, 0 },
1384 { { MNEM, ' ', OP (DISP8), 0 } },
1385 & ifmt_bnc8r, { 0x7d00 }
1387 /* bnc $disp24 */
1389 { 0, 0, 0, 0 },
1390 { { MNEM, ' ', OP (DISP24), 0 } },
1391 & ifmt_bnc24r, { 0xfd000000 }
1393 /* bra $disp8 */
1395 { 0, 0, 0, 0 },
1396 { { MNEM, ' ', OP (DISP8), 0 } },
1397 & ifmt_bra8r, { 0x7f00 }
1399 /* bra $disp24 */
1401 { 0, 0, 0, 0 },
1402 { { MNEM, ' ', OP (DISP24), 0 } },
1403 & ifmt_bra24r, { 0xff000000 }
1405 /* bncl $disp8 */
1407 { 0, 0, 0, 0 },
1408 { { MNEM, ' ', OP (DISP8), 0 } },
1409 & ifmt_bncl8r, { 0x7900 }
1411 /* bncl $disp24 */
1413 { 0, 0, 0, 0 },
1414 { { MNEM, ' ', OP (DISP24), 0 } },
1415 & ifmt_bncl24r, { 0xf9000000 }
1417 /* ld $dr,@($sr) */
1419 { 0, 0, 0, 0 },
1420 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1421 & ifmt_ld_2, { 0x20c0 }
1423 /* ld $dr,@($sr,$slo16) */
1425 { 0, 0, 0, 0 },
1426 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1427 & ifmt_ld_d2, { 0xa0c00000 }
1429 /* ldb $dr,@($sr) */
1431 { 0, 0, 0, 0 },
1432 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1433 & ifmt_ldb_2, { 0x2080 }
1435 /* ldb $dr,@($sr,$slo16) */
1437 { 0, 0, 0, 0 },
1438 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1439 & ifmt_ldb_d2, { 0xa0800000 }
1441 /* ldh $dr,@($sr) */
1443 { 0, 0, 0, 0 },
1444 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1445 & ifmt_ldh_2, { 0x20a0 }
1447 /* ldh $dr,@($sr,$slo16) */
1449 { 0, 0, 0, 0 },
1450 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1451 & ifmt_ldh_d2, { 0xa0a00000 }
1453 /* ldub $dr,@($sr) */
1455 { 0, 0, 0, 0 },
1456 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1457 & ifmt_ldub_2, { 0x2090 }
1459 /* ldub $dr,@($sr,$slo16) */
1461 { 0, 0, 0, 0 },
1462 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1463 & ifmt_ldub_d2, { 0xa0900000 }
1465 /* lduh $dr,@($sr) */
1467 { 0, 0, 0, 0 },
1468 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ')', 0 } },
1469 & ifmt_lduh_2, { 0x20b0 }
1471 /* lduh $dr,@($sr,$slo16) */
1473 { 0, 0, 0, 0 },
1474 { { MNEM, ' ', OP (DR), ',', '@', '(', OP (SR), ',', OP (SLO16), ')', 0 } },
1475 & ifmt_lduh_d2, { 0xa0b00000 }
1477 /* pop $dr */
1479 { 0, 0, 0, 0 },
1480 { { MNEM, ' ', OP (DR), 0 } },
1481 & ifmt_pop, { 0x20ef }
1483 /* ldi $dr,$simm8 */
1485 { 0, 0, 0, 0 },
1486 { { MNEM, ' ', OP (DR), ',', OP (SIMM8), 0 } },
1487 & ifmt_ldi8a, { 0x6000 }
1489 /* ldi $dr,$hash$slo16 */
1491 { 0, 0, 0, 0 },
1492 { { MNEM, ' ', OP (DR), ',', OP (HASH), OP (SLO16), 0 } },
1493 & ifmt_ldi16a, { 0x90f00000 }
1495 /* rac $accd */
1497 { 0, 0, 0, 0 },
1498 { { MNEM, ' ', OP (ACCD), 0 } },
1499 & ifmt_rac_d, { 0x5090 }
1501 /* rac $accd,$accs */
1503 { 0, 0, 0, 0 },
1504 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
1505 & ifmt_rac_ds, { 0x5090 }
1507 /* rach $accd */
1509 { 0, 0, 0, 0 },
1510 { { MNEM, ' ', OP (ACCD), 0 } },
1511 & ifmt_rach_d, { 0x5080 }
1513 /* rach $accd,$accs */
1515 { 0, 0, 0, 0 },
1516 { { MNEM, ' ', OP (ACCD), ',', OP (ACCS), 0 } },
1517 & ifmt_rach_ds, { 0x5080 }
1519 /* st $src1,@($src2) */
1521 { 0, 0, 0, 0 },
1522 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1523 & ifmt_st_2, { 0x2040 }
1525 /* st $src1,@($src2,$slo16) */
1527 { 0, 0, 0, 0 },
1528 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1529 & ifmt_st_d2, { 0xa0400000 }
1531 /* stb $src1,@($src2) */
1533 { 0, 0, 0, 0 },
1534 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1535 & ifmt_stb_2, { 0x2000 }
1537 /* stb $src1,@($src2,$slo16) */
1539 { 0, 0, 0, 0 },
1540 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1541 & ifmt_stb_d2, { 0xa0000000 }
1543 /* sth $src1,@($src2) */
1545 { 0, 0, 0, 0 },
1546 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ')', 0 } },
1547 & ifmt_sth_2, { 0x2020 }
1549 /* sth $src1,@($src2,$slo16) */
1551 { 0, 0, 0, 0 },
1552 { { MNEM, ' ', OP (SRC1), ',', '@', '(', OP (SRC2), ',', OP (SLO16), ')', 0 } },
1553 & ifmt_sth_d2, { 0xa0200000 }
1555 /* push $src1 */
1557 { 0, 0, 0, 0 },
1558 { { MNEM, ' ', OP (SRC1), 0 } },
1559 & ifmt_push, { 0x207f }
1563 #undef A
1564 #undef MNEM
1565 #undef OPERAND
1566 #undef OP
1568 #ifndef CGEN_ASM_HASH_P
1569 #define CGEN_ASM_HASH_P(insn) 1
1570 #endif
1572 #ifndef CGEN_DIS_HASH_P
1573 #define CGEN_DIS_HASH_P(insn) 1
1574 #endif
1576 /* Return non-zero if INSN is to be added to the hash table.
1577 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
1579 static int
1580 asm_hash_insn_p (insn)
1581 const CGEN_INSN *insn;
1583 return CGEN_ASM_HASH_P (insn);
1586 static int
1587 dis_hash_insn_p (insn)
1588 const CGEN_INSN *insn;
1590 /* If building the hash table and the NO-DIS attribute is present,
1591 ignore. */
1592 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
1593 return 0;
1594 return CGEN_DIS_HASH_P (insn);
1597 #ifndef CGEN_ASM_HASH
1598 #define CGEN_ASM_HASH_SIZE 127
1599 #ifdef CGEN_MNEMONIC_OPERANDS
1600 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
1601 #else
1602 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
1603 #endif
1604 #endif
1606 /* It doesn't make much sense to provide a default here,
1607 but while this is under development we do.
1608 BUFFER is a pointer to the bytes of the insn, target order.
1609 VALUE is the first base_insn_bitsize bits as an int in host order. */
1611 #ifndef CGEN_DIS_HASH
1612 #define CGEN_DIS_HASH_SIZE 256
1613 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1614 #endif
1616 /* The result is the hash value of the insn.
1617 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1619 static unsigned int
1620 asm_hash_insn (mnem)
1621 const char * mnem;
1623 return CGEN_ASM_HASH (mnem);
1626 /* BUF is a pointer to the bytes of the insn, target order.
1627 VALUE is the first base_insn_bitsize bits as an int in host order. */
1629 static unsigned int
1630 dis_hash_insn (buf, value)
1631 const char * buf;
1632 CGEN_INSN_INT value;
1634 return CGEN_DIS_HASH (buf, value);
1637 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1639 static void
1640 set_fields_bitsize (fields, size)
1641 CGEN_FIELDS *fields;
1642 int size;
1644 CGEN_FIELDS_BITSIZE (fields) = size;
1647 /* Function to call before using the operand instance table.
1648 This plugs the opcode entries and macro instructions into the cpu table. */
1650 void
1651 m32r_cgen_init_opcode_table (cd)
1652 CGEN_CPU_DESC cd;
1654 int i;
1655 int num_macros = (sizeof (m32r_cgen_macro_insn_table) /
1656 sizeof (m32r_cgen_macro_insn_table[0]));
1657 const CGEN_IBASE *ib = & m32r_cgen_macro_insn_table[0];
1658 const CGEN_OPCODE *oc = & m32r_cgen_macro_insn_opcode_table[0];
1659 CGEN_INSN *insns = (CGEN_INSN *) xmalloc (num_macros * sizeof (CGEN_INSN));
1660 memset (insns, 0, num_macros * sizeof (CGEN_INSN));
1661 for (i = 0; i < num_macros; ++i)
1663 insns[i].base = &ib[i];
1664 insns[i].opcode = &oc[i];
1666 cd->macro_insn_table.init_entries = insns;
1667 cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
1668 cd->macro_insn_table.num_init_entries = num_macros;
1670 oc = & m32r_cgen_insn_opcode_table[0];
1671 insns = (CGEN_INSN *) cd->insn_table.init_entries;
1672 for (i = 0; i < MAX_INSNS; ++i)
1673 insns[i].opcode = &oc[i];
1675 cd->sizeof_fields = sizeof (CGEN_FIELDS);
1676 cd->set_fields_bitsize = set_fields_bitsize;
1678 cd->asm_hash_p = asm_hash_insn_p;
1679 cd->asm_hash = asm_hash_insn;
1680 cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
1682 cd->dis_hash_p = dis_hash_insn_p;
1683 cd->dis_hash = dis_hash_insn;
1684 cd->dis_hash_size = CGEN_DIS_HASH_SIZE;