1 /* CPU family header for m32rx.
3 Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
5 This file is part of the GNU Simulators.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 /* Maximum number of instructions that are fetched at a time.
27 This is for LIW type instructions sets (e.g. m32r). */
28 #define MAX_LIW_INSNS 2
30 /* Maximum number of instructions that can be executed in parallel. */
31 #define MAX_PARALLEL_INSNS 2
33 /* CPU state information. */
35 /* Hardware elements. */
39 #define GET_H_PC() CPU (h_pc)
40 #define SET_H_PC(x) (CPU (h_pc) = (x))
41 /* general registers */
43 #define GET_H_GR(a1) CPU (h_gr)[a1]
44 #define SET_H_GR(a1, x) (CPU (h_gr)[a1] = (x))
45 /* control registers */
47 #define GET_H_CR(a1) CPU (h_cr)[a1]
48 #define SET_H_CR(a1, x) (CPU (h_cr)[a1] = (x))
51 #define GET_H_ACCUM() CPU (h_accum)
52 #define SET_H_ACCUM(x) (CPU (h_accum) = (x))
55 #define GET_H_ACCUMS(a1) CPU (h_accums)[a1]
56 #define SET_H_ACCUMS(a1, x) (CPU (h_accums)[a1] = (x))
59 #define GET_H_ABORT() CPU (h_abort)
60 #define SET_H_ABORT(x) (CPU (h_abort) = (x))
63 #define GET_H_COND() CPU (h_cond)
64 #define SET_H_COND(x) (CPU (h_cond) = (x))
67 #define GET_H_SM() CPU (h_sm)
68 #define SET_H_SM(x) (CPU (h_sm) = (x))
71 #define GET_H_BSM() CPU (h_bsm)
72 #define SET_H_BSM(x) (CPU (h_bsm) = (x))
75 #define GET_H_IE() CPU (h_ie)
76 #define SET_H_IE(x) (CPU (h_ie) = (x))
79 #define GET_H_BIE() CPU (h_bie)
80 #define SET_H_BIE(x) (CPU (h_bie) = (x))
83 #define GET_H_BCOND() CPU (h_bcond)
84 #define SET_H_BCOND(x) (CPU (h_bcond) = (x))
87 #define GET_H_BPC() CPU (h_bpc)
88 #define SET_H_BPC(x) (CPU (h_bpc) = (x))
90 #define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
91 /* CPU profiling state information. */
93 /* general registers */
96 #define CPU_CGEN_PROFILE(cpu) (& (cpu)->cpu_data.profile)
99 /* FIXME: length parm to decode() is currently unneeded. */
100 extern DECODE *m32rx_decode (SIM_CPU *, insn_t /*, int*/);
102 /* The ARGBUF struct. */
104 /* These are the baseclass definitions. */
107 const struct cgen_insn *opcode;
108 /* unsigned long insn; - no longer needed */
109 /* cpu specific data follows */
111 struct { /* e.g. add $dr,$sr */
115 struct { /* e.g. add3 $dr,$sr,#$slo16 */
120 struct { /* e.g. and3 $dr,$sr,#$uimm16 */
125 struct { /* e.g. or3 $dr,$sr,#$ulo16 */
130 struct { /* e.g. addi $dr,#$simm8 */
134 struct { /* e.g. addv3 $dr,$sr,#$simm16 */
139 struct { /* e.g. addx $dr,$sr */
143 struct { /* e.g. bc $disp8 */
146 struct { /* e.g. bc $disp24 */
149 struct { /* e.g. beq $src1,$src2,$disp16 */
154 struct { /* e.g. beqz $src2,$disp16 */
158 struct { /* e.g. bl $disp8 */
161 struct { /* e.g. bl $disp24 */
164 struct { /* e.g. bcl $disp8 */
167 struct { /* e.g. bcl $disp24 */
170 struct { /* e.g. bra $disp8 */
173 struct { /* e.g. bra $disp24 */
176 struct { /* e.g. cmp $src1,$src2 */
180 struct { /* e.g. cmpi $src2,#$simm16 */
184 struct { /* e.g. cmpui $src2,#$uimm16 */
188 struct { /* e.g. cmpz $src2 */
191 struct { /* e.g. div $dr,$sr */
195 struct { /* e.g. jc $sr */
198 struct { /* e.g. jl $sr */
201 struct { /* e.g. jmp $sr */
204 struct { /* e.g. ld $dr,@$sr */
208 struct { /* e.g. ld $dr,@($slo16,$sr) */
213 struct { /* e.g. ldb $dr,@$sr */
217 struct { /* e.g. ldb $dr,@($slo16,$sr) */
222 struct { /* e.g. ldh $dr,@$sr */
226 struct { /* e.g. ldh $dr,@($slo16,$sr) */
231 struct { /* e.g. ld24 $dr,#$uimm24 */
235 struct { /* e.g. ldi $dr,#$simm8 */
239 struct { /* e.g. ldi $dr,$slo16 */
243 struct { /* e.g. machi $src1,$src2 */
247 struct { /* e.g. machi $src1,$src2,$acc */
252 struct { /* e.g. mulhi $src1,$src2,$acc */
257 struct { /* e.g. mv $dr,$sr */
261 struct { /* e.g. mvfachi $dr */
264 struct { /* e.g. mvfachi $dr,$accs */
268 struct { /* e.g. mvfc $dr,$scr */
272 struct { /* e.g. mvtachi $src1 */
275 struct { /* e.g. mvtachi $src1,$accs */
279 struct { /* e.g. mvtc $sr,$dcr */
283 struct { /* e.g. nop */
286 struct { /* e.g. rac */
289 struct { /* e.g. rac $accs */
292 struct { /* e.g. seth $dr,$hi16 */
296 struct { /* e.g. slli $dr,#$uimm5 */
300 struct { /* e.g. st $src1,@($slo16,$src2) */
305 struct { /* e.g. trap #$uimm4 */
308 struct { /* e.g. satb $dr,$src2 */
312 struct { /* e.g. pcmpbz $src2 */
315 struct { /* e.g. sadd */
318 struct { /* e.g. macwu1 $src1,$src2 */
322 struct { /* e.g. sc */
326 #if 1 || WITH_PROFILE_MODEL_P /*FIXME:wip*/
327 unsigned long h_gr_get;
328 unsigned long h_gr_set;
333 This is also used in the non-scache case. In this situation we assume
334 the cache size is 1, and do a few things a little differently. */
339 #if ! WITH_SEM_SWITCH_FULL
342 #if ! WITH_SEM_SWITCH_FAST
344 SEMANTIC_CACHE_FN *sem_fast_fn;
346 SEMANTIC_FN *sem_fast_fn;
349 #if WITH_SEM_SWITCH_FULL || WITH_SEM_SWITCH_FAST
357 struct argbuf argbuf;
360 /* Macros to simplify extraction, reading and semantic code.
361 These define and assign the local vars that contain the insn's fields. */
363 #define EXTRACT_FMT_0_ADD_VARS \
364 /* Instruction fields. */ \
370 #define EXTRACT_FMT_0_ADD_CODE \
372 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
373 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
374 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
375 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
377 #define EXTRACT_FMT_1_ADD3_VARS \
378 /* Instruction fields. */ \
385 #define EXTRACT_FMT_1_ADD3_CODE \
387 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
388 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
389 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
390 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
391 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
393 #define EXTRACT_FMT_2_AND3_VARS \
394 /* Instruction fields. */ \
401 #define EXTRACT_FMT_2_AND3_CODE \
403 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
404 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
405 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
406 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
407 f_uimm16 = EXTRACT_UNSIGNED (insn, 32, 16, 16); \
409 #define EXTRACT_FMT_3_OR3_VARS \
410 /* Instruction fields. */ \
417 #define EXTRACT_FMT_3_OR3_CODE \
419 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
420 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
421 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
422 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
423 f_uimm16 = EXTRACT_UNSIGNED (insn, 32, 16, 16); \
425 #define EXTRACT_FMT_4_ADDI_VARS \
426 /* Instruction fields. */ \
431 #define EXTRACT_FMT_4_ADDI_CODE \
433 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
434 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
435 f_simm8 = EXTRACT_SIGNED (insn, 16, 8, 8); \
437 #define EXTRACT_FMT_5_ADDV3_VARS \
438 /* Instruction fields. */ \
445 #define EXTRACT_FMT_5_ADDV3_CODE \
447 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
448 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
449 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
450 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
451 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
453 #define EXTRACT_FMT_6_ADDX_VARS \
454 /* Instruction fields. */ \
460 #define EXTRACT_FMT_6_ADDX_CODE \
462 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
463 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
464 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
465 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
467 #define EXTRACT_FMT_7_BC8_VARS \
468 /* Instruction fields. */ \
473 #define EXTRACT_FMT_7_BC8_CODE \
475 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
476 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
477 f_disp8 = EXTRACT_SIGNED (insn, 16, 8, 8) << 2; \
479 #define EXTRACT_FMT_8_BC24_VARS \
480 /* Instruction fields. */ \
485 #define EXTRACT_FMT_8_BC24_CODE \
487 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
488 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
489 f_disp24 = EXTRACT_SIGNED (insn, 32, 8, 24) << 2; \
491 #define EXTRACT_FMT_9_BEQ_VARS \
492 /* Instruction fields. */ \
499 #define EXTRACT_FMT_9_BEQ_CODE \
501 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
502 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
503 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
504 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
505 f_disp16 = EXTRACT_SIGNED (insn, 32, 16, 16) << 2; \
507 #define EXTRACT_FMT_10_BEQZ_VARS \
508 /* Instruction fields. */ \
515 #define EXTRACT_FMT_10_BEQZ_CODE \
517 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
518 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
519 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
520 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
521 f_disp16 = EXTRACT_SIGNED (insn, 32, 16, 16) << 2; \
523 #define EXTRACT_FMT_11_BL8_VARS \
524 /* Instruction fields. */ \
529 #define EXTRACT_FMT_11_BL8_CODE \
531 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
532 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
533 f_disp8 = EXTRACT_SIGNED (insn, 16, 8, 8) << 2; \
535 #define EXTRACT_FMT_12_BL24_VARS \
536 /* Instruction fields. */ \
541 #define EXTRACT_FMT_12_BL24_CODE \
543 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
544 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
545 f_disp24 = EXTRACT_SIGNED (insn, 32, 8, 24) << 2; \
547 #define EXTRACT_FMT_13_BCL8_VARS \
548 /* Instruction fields. */ \
553 #define EXTRACT_FMT_13_BCL8_CODE \
555 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
556 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
557 f_disp8 = EXTRACT_SIGNED (insn, 16, 8, 8) << 2; \
559 #define EXTRACT_FMT_14_BCL24_VARS \
560 /* Instruction fields. */ \
565 #define EXTRACT_FMT_14_BCL24_CODE \
567 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
568 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
569 f_disp24 = EXTRACT_SIGNED (insn, 32, 8, 24) << 2; \
571 #define EXTRACT_FMT_15_BRA8_VARS \
572 /* Instruction fields. */ \
577 #define EXTRACT_FMT_15_BRA8_CODE \
579 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
580 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
581 f_disp8 = EXTRACT_SIGNED (insn, 16, 8, 8) << 2; \
583 #define EXTRACT_FMT_16_BRA24_VARS \
584 /* Instruction fields. */ \
589 #define EXTRACT_FMT_16_BRA24_CODE \
591 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
592 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
593 f_disp24 = EXTRACT_SIGNED (insn, 32, 8, 24) << 2; \
595 #define EXTRACT_FMT_17_CMP_VARS \
596 /* Instruction fields. */ \
602 #define EXTRACT_FMT_17_CMP_CODE \
604 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
605 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
606 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
607 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
609 #define EXTRACT_FMT_18_CMPI_VARS \
610 /* Instruction fields. */ \
617 #define EXTRACT_FMT_18_CMPI_CODE \
619 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
620 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
621 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
622 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
623 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
625 #define EXTRACT_FMT_19_CMPUI_VARS \
626 /* Instruction fields. */ \
633 #define EXTRACT_FMT_19_CMPUI_CODE \
635 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
636 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
637 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
638 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
639 f_uimm16 = EXTRACT_UNSIGNED (insn, 32, 16, 16); \
641 #define EXTRACT_FMT_20_CMPZ_VARS \
642 /* Instruction fields. */ \
648 #define EXTRACT_FMT_20_CMPZ_CODE \
650 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
651 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
652 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
653 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
655 #define EXTRACT_FMT_21_DIV_VARS \
656 /* Instruction fields. */ \
663 #define EXTRACT_FMT_21_DIV_CODE \
665 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
666 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
667 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
668 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
669 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
671 #define EXTRACT_FMT_22_JC_VARS \
672 /* Instruction fields. */ \
678 #define EXTRACT_FMT_22_JC_CODE \
680 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
681 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
682 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
683 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
685 #define EXTRACT_FMT_23_JL_VARS \
686 /* Instruction fields. */ \
692 #define EXTRACT_FMT_23_JL_CODE \
694 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
695 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
696 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
697 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
699 #define EXTRACT_FMT_24_JMP_VARS \
700 /* Instruction fields. */ \
706 #define EXTRACT_FMT_24_JMP_CODE \
708 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
709 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
710 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
711 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
713 #define EXTRACT_FMT_25_LD_VARS \
714 /* Instruction fields. */ \
720 #define EXTRACT_FMT_25_LD_CODE \
722 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
723 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
724 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
725 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
727 #define EXTRACT_FMT_26_LD_D_VARS \
728 /* Instruction fields. */ \
735 #define EXTRACT_FMT_26_LD_D_CODE \
737 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
738 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
739 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
740 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
741 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
743 #define EXTRACT_FMT_27_LDB_VARS \
744 /* Instruction fields. */ \
750 #define EXTRACT_FMT_27_LDB_CODE \
752 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
753 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
754 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
755 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
757 #define EXTRACT_FMT_28_LDB_D_VARS \
758 /* Instruction fields. */ \
765 #define EXTRACT_FMT_28_LDB_D_CODE \
767 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
768 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
769 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
770 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
771 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
773 #define EXTRACT_FMT_29_LDH_VARS \
774 /* Instruction fields. */ \
780 #define EXTRACT_FMT_29_LDH_CODE \
782 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
783 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
784 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
785 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
787 #define EXTRACT_FMT_30_LDH_D_VARS \
788 /* Instruction fields. */ \
795 #define EXTRACT_FMT_30_LDH_D_CODE \
797 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
798 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
799 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
800 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
801 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
803 #define EXTRACT_FMT_31_LD24_VARS \
804 /* Instruction fields. */ \
809 #define EXTRACT_FMT_31_LD24_CODE \
811 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
812 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
813 f_uimm24 = EXTRACT_UNSIGNED (insn, 32, 8, 24); \
815 #define EXTRACT_FMT_32_LDI8_VARS \
816 /* Instruction fields. */ \
821 #define EXTRACT_FMT_32_LDI8_CODE \
823 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
824 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
825 f_simm8 = EXTRACT_SIGNED (insn, 16, 8, 8); \
827 #define EXTRACT_FMT_33_LDI16_VARS \
828 /* Instruction fields. */ \
835 #define EXTRACT_FMT_33_LDI16_CODE \
837 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
838 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
839 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
840 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
841 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
843 #define EXTRACT_FMT_34_MACHI_VARS \
844 /* Instruction fields. */ \
850 #define EXTRACT_FMT_34_MACHI_CODE \
852 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
853 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
854 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
855 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
857 #define EXTRACT_FMT_35_MACHI_A_VARS \
858 /* Instruction fields. */ \
865 #define EXTRACT_FMT_35_MACHI_A_CODE \
867 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
868 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
869 f_acc = EXTRACT_UNSIGNED (insn, 16, 8, 1); \
870 f_op23 = EXTRACT_UNSIGNED (insn, 16, 9, 3); \
871 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
873 #define EXTRACT_FMT_36_MULHI_A_VARS \
874 /* Instruction fields. */ \
881 #define EXTRACT_FMT_36_MULHI_A_CODE \
883 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
884 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
885 f_acc = EXTRACT_UNSIGNED (insn, 16, 8, 1); \
886 f_op23 = EXTRACT_UNSIGNED (insn, 16, 9, 3); \
887 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
889 #define EXTRACT_FMT_37_MV_VARS \
890 /* Instruction fields. */ \
896 #define EXTRACT_FMT_37_MV_CODE \
898 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
899 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
900 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
901 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
903 #define EXTRACT_FMT_38_MVFACHI_VARS \
904 /* Instruction fields. */ \
910 #define EXTRACT_FMT_38_MVFACHI_CODE \
912 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
913 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
914 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
915 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
917 #define EXTRACT_FMT_39_MVFACHI_A_VARS \
918 /* Instruction fields. */ \
925 #define EXTRACT_FMT_39_MVFACHI_A_CODE \
927 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
928 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
929 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
930 f_accs = EXTRACT_UNSIGNED (insn, 16, 12, 2); \
931 f_op3 = EXTRACT_UNSIGNED (insn, 16, 14, 2); \
933 #define EXTRACT_FMT_40_MVFC_VARS \
934 /* Instruction fields. */ \
940 #define EXTRACT_FMT_40_MVFC_CODE \
942 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
943 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
944 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
945 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
947 #define EXTRACT_FMT_41_MVTACHI_VARS \
948 /* Instruction fields. */ \
954 #define EXTRACT_FMT_41_MVTACHI_CODE \
956 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
957 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
958 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
959 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
961 #define EXTRACT_FMT_42_MVTACHI_A_VARS \
962 /* Instruction fields. */ \
969 #define EXTRACT_FMT_42_MVTACHI_A_CODE \
971 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
972 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
973 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
974 f_accs = EXTRACT_UNSIGNED (insn, 16, 12, 2); \
975 f_op3 = EXTRACT_UNSIGNED (insn, 16, 14, 2); \
977 #define EXTRACT_FMT_43_MVTC_VARS \
978 /* Instruction fields. */ \
984 #define EXTRACT_FMT_43_MVTC_CODE \
986 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
987 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
988 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
989 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
991 #define EXTRACT_FMT_44_NOP_VARS \
992 /* Instruction fields. */ \
998 #define EXTRACT_FMT_44_NOP_CODE \
1000 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1001 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1002 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1003 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
1005 #define EXTRACT_FMT_45_RAC_VARS \
1006 /* Instruction fields. */ \
1011 unsigned int length;
1012 #define EXTRACT_FMT_45_RAC_CODE \
1014 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1015 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1016 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1017 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
1019 #define EXTRACT_FMT_46_RAC_A_VARS \
1020 /* Instruction fields. */ \
1026 unsigned int length;
1027 #define EXTRACT_FMT_46_RAC_A_CODE \
1029 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1030 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1031 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1032 f_accs = EXTRACT_UNSIGNED (insn, 16, 12, 2); \
1033 f_op3 = EXTRACT_UNSIGNED (insn, 16, 14, 2); \
1035 #define EXTRACT_FMT_47_SETH_VARS \
1036 /* Instruction fields. */ \
1042 unsigned int length;
1043 #define EXTRACT_FMT_47_SETH_CODE \
1045 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
1046 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
1047 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
1048 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
1049 f_hi16 = EXTRACT_UNSIGNED (insn, 32, 16, 16); \
1051 #define EXTRACT_FMT_48_SLLI_VARS \
1052 /* Instruction fields. */ \
1057 unsigned int length;
1058 #define EXTRACT_FMT_48_SLLI_CODE \
1060 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1061 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1062 f_shift_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 3); \
1063 f_uimm5 = EXTRACT_UNSIGNED (insn, 16, 11, 5); \
1065 #define EXTRACT_FMT_49_ST_D_VARS \
1066 /* Instruction fields. */ \
1072 unsigned int length;
1073 #define EXTRACT_FMT_49_ST_D_CODE \
1075 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
1076 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
1077 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
1078 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
1079 f_simm16 = EXTRACT_SIGNED (insn, 32, 16, 16); \
1081 #define EXTRACT_FMT_50_TRAP_VARS \
1082 /* Instruction fields. */ \
1087 unsigned int length;
1088 #define EXTRACT_FMT_50_TRAP_CODE \
1090 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1091 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1092 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1093 f_uimm4 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
1095 #define EXTRACT_FMT_51_SATB_VARS \
1096 /* Instruction fields. */ \
1102 unsigned int length;
1103 #define EXTRACT_FMT_51_SATB_CODE \
1105 f_op1 = EXTRACT_UNSIGNED (insn, 32, 0, 4); \
1106 f_r1 = EXTRACT_UNSIGNED (insn, 32, 4, 4); \
1107 f_op2 = EXTRACT_UNSIGNED (insn, 32, 8, 4); \
1108 f_r2 = EXTRACT_UNSIGNED (insn, 32, 12, 4); \
1109 f_uimm16 = EXTRACT_UNSIGNED (insn, 32, 16, 16); \
1111 #define EXTRACT_FMT_52_PCMPBZ_VARS \
1112 /* Instruction fields. */ \
1117 unsigned int length;
1118 #define EXTRACT_FMT_52_PCMPBZ_CODE \
1120 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1121 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1122 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1123 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
1125 #define EXTRACT_FMT_53_SADD_VARS \
1126 /* Instruction fields. */ \
1131 unsigned int length;
1132 #define EXTRACT_FMT_53_SADD_CODE \
1134 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1135 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1136 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1137 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
1139 #define EXTRACT_FMT_54_MACWU1_VARS \
1140 /* Instruction fields. */ \
1145 unsigned int length;
1146 #define EXTRACT_FMT_54_MACWU1_CODE \
1148 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1149 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1150 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1151 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
1153 #define EXTRACT_FMT_55_SC_VARS \
1154 /* Instruction fields. */ \
1159 unsigned int length;
1160 #define EXTRACT_FMT_55_SC_CODE \
1162 f_op1 = EXTRACT_UNSIGNED (insn, 16, 0, 4); \
1163 f_r1 = EXTRACT_UNSIGNED (insn, 16, 4, 4); \
1164 f_op2 = EXTRACT_UNSIGNED (insn, 16, 8, 4); \
1165 f_r2 = EXTRACT_UNSIGNED (insn, 16, 12, 4); \
1167 /* Fetched input values of an instruction. */
1169 struct parallel_exec {
1171 struct { /* e.g. add $dr,$sr */
1175 struct { /* e.g. add3 $dr,$sr,#$slo16 */
1179 struct { /* e.g. and3 $dr,$sr,#$uimm16 */
1183 struct { /* e.g. or3 $dr,$sr,#$ulo16 */
1187 struct { /* e.g. addi $dr,#$simm8 */
1191 struct { /* e.g. addv3 $dr,$sr,#$simm16 */
1195 struct { /* e.g. addx $dr,$sr */
1200 struct { /* e.g. bc $disp8 */
1204 struct { /* e.g. bc $disp24 */
1208 struct { /* e.g. beq $src1,$src2,$disp16 */
1213 struct { /* e.g. beqz $src2,$disp16 */
1217 struct { /* e.g. bl $disp8 */
1221 struct { /* e.g. bl $disp24 */
1225 struct { /* e.g. bcl $disp8 */
1230 struct { /* e.g. bcl $disp24 */
1235 struct { /* e.g. bra $disp8 */
1238 struct { /* e.g. bra $disp24 */
1241 struct { /* e.g. cmp $src1,$src2 */
1245 struct { /* e.g. cmpi $src2,#$simm16 */
1249 struct { /* e.g. cmpui $src2,#$uimm16 */
1253 struct { /* e.g. cmpz $src2 */
1256 struct { /* e.g. div $dr,$sr */
1260 struct { /* e.g. jc $sr */
1264 struct { /* e.g. jl $sr */
1268 struct { /* e.g. jmp $sr */
1271 struct { /* e.g. ld $dr,@$sr */
1275 struct { /* e.g. ld $dr,@($slo16,$sr) */
1280 struct { /* e.g. ldb $dr,@$sr */
1284 struct { /* e.g. ldb $dr,@($slo16,$sr) */
1289 struct { /* e.g. ldh $dr,@$sr */
1293 struct { /* e.g. ldh $dr,@($slo16,$sr) */
1298 struct { /* e.g. ld24 $dr,#$uimm24 */
1301 struct { /* e.g. ldi $dr,#$simm8 */
1304 struct { /* e.g. ldi $dr,$slo16 */
1307 struct { /* e.g. machi $src1,$src2 */
1312 struct { /* e.g. machi $src1,$src2,$acc */
1317 struct { /* e.g. mulhi $src1,$src2,$acc */
1321 struct { /* e.g. mv $dr,$sr */
1324 struct { /* e.g. mvfachi $dr */
1327 struct { /* e.g. mvfachi $dr,$accs */
1330 struct { /* e.g. mvfc $dr,$scr */
1333 struct { /* e.g. mvtachi $src1 */
1337 struct { /* e.g. mvtachi $src1,$accs */
1341 struct { /* e.g. mvtc $sr,$dcr */
1344 struct { /* e.g. nop */
1347 struct { /* e.g. rac */
1350 struct { /* e.g. rac $accs */
1353 struct { /* e.g. seth $dr,$hi16 */
1356 struct { /* e.g. slli $dr,#$uimm5 */
1360 struct { /* e.g. st $src1,@($slo16,$src2) */
1365 struct { /* e.g. trap #$uimm4 */
1368 struct { /* e.g. satb $dr,$src2 */
1371 struct { /* e.g. pcmpbz $src2 */
1374 struct { /* e.g. sadd */
1378 struct { /* e.g. macwu1 $src1,$src2 */
1383 struct { /* e.g. sc */
1389 #endif /* CPU_M32RX_H */