Commit | Line | Data |
---|---|---|
b8a9943d DE |
1 | /* Simulator instruction decoder for m32r. |
2 | ||
3 | This file is machine generated with CGEN. | |
4 | ||
5 | Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. | |
6 | ||
7 | This file is part of the GNU Simulators. | |
8 | ||
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. | |
13 | ||
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. | |
18 | ||
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. | |
22 | ||
23 | */ | |
24 | ||
25 | #define WANT_CPU | |
26 | #define WANT_CPU_M32R | |
27 | ||
28 | #include "sim-main.h" | |
29 | #include "sim-xcat.h" | |
30 | #include "cpu-sim.h" | |
31 | #include "cpu-opc.h" | |
32 | ||
33 | /* FIXME: wip, may eventually only want one form so this would then go | |
34 | away. However, in the mean time, having both keeps a stable version | |
35 | around while the cache version is being developed. | |
36 | It may still be useful to allow two versions to exist though. */ | |
37 | #if WITH_SCACHE | |
38 | #define EX(fn) XCONCAT3 (m32r,_ex_,fn) | |
39 | #else | |
40 | #define EX(fn) 0 | |
41 | #endif | |
42 | ||
e0bd6e18 DE |
43 | #ifdef HAVE_PARALLEL_EXEC |
44 | #ifdef __GNUC__ | |
45 | #define READ(n) 0 | |
46 | #else | |
47 | #define READ(n) XCONCAT3 (READ,_,n) | |
48 | #endif | |
49 | #endif | |
50 | ||
cab58155 DE |
51 | /* FIXME: Need to review choices for the following. */ |
52 | ||
b8a9943d DE |
53 | #if WITH_SEM_SWITCH_FULL |
54 | #define FULL(fn) 0 | |
55 | #else | |
56 | #define FULL(fn) XCONCAT3 (m32r,_sem_,fn) | |
57 | #endif | |
58 | ||
cab58155 | 59 | #if WITH_FAST |
b8a9943d DE |
60 | #if WITH_SEM_SWITCH_FAST |
61 | #define FAST(fn) 0 | |
62 | #else | |
cab58155 DE |
63 | #define FAST(fn) XCONCAT3 (m32r,_semf_,fn) /* f for fast */ |
64 | #endif | |
b8a9943d DE |
65 | #else |
66 | #define FAST(fn) 0 | |
67 | #endif | |
b8a9943d DE |
68 | |
69 | /*#define DECODE M32R_DECODE*/ | |
70 | ||
71 | /* The decode_illegal case is currently non-static and the generator doesn't | |
72 | prepend m32r_, so simplify things by handling it here. */ | |
73 | #define decode_illegal m32r_decode_illegal | |
74 | ||
e0bd6e18 DE |
75 | #define ITAB(n) m32r_cgen_insn_table_entries[n] |
76 | ||
77 | static DECODE decode_add = { M32R_INSN_ADD, & ITAB (M32R_INSN_ADD), EX (fmt_0_add), FULL (add), FAST (add) }; | |
78 | static DECODE decode_add3 = { M32R_INSN_ADD3, & ITAB (M32R_INSN_ADD3), EX (fmt_1_add3), FULL (add3), FAST (add3) }; | |
79 | static DECODE decode_and = { M32R_INSN_AND, & ITAB (M32R_INSN_AND), EX (fmt_0_add), FULL (and), FAST (and) }; | |
80 | static DECODE decode_and3 = { M32R_INSN_AND3, & ITAB (M32R_INSN_AND3), EX (fmt_2_and3), FULL (and3), FAST (and3) }; | |
81 | static DECODE decode_or = { M32R_INSN_OR, & ITAB (M32R_INSN_OR), EX (fmt_0_add), FULL (or), FAST (or) }; | |
82 | static DECODE decode_or3 = { M32R_INSN_OR3, & ITAB (M32R_INSN_OR3), EX (fmt_3_or3), FULL (or3), FAST (or3) }; | |
83 | static DECODE decode_xor = { M32R_INSN_XOR, & ITAB (M32R_INSN_XOR), EX (fmt_0_add), FULL (xor), FAST (xor) }; | |
84 | static DECODE decode_xor3 = { M32R_INSN_XOR3, & ITAB (M32R_INSN_XOR3), EX (fmt_2_and3), FULL (xor3), FAST (xor3) }; | |
85 | static DECODE decode_addi = { M32R_INSN_ADDI, & ITAB (M32R_INSN_ADDI), EX (fmt_4_addi), FULL (addi), FAST (addi) }; | |
cab58155 DE |
86 | static DECODE decode_addv = { M32R_INSN_ADDV, & ITAB (M32R_INSN_ADDV), EX (fmt_5_addv), FULL (addv), FAST (addv) }; |
87 | static DECODE decode_addv3 = { M32R_INSN_ADDV3, & ITAB (M32R_INSN_ADDV3), EX (fmt_6_addv3), FULL (addv3), FAST (addv3) }; | |
88 | static DECODE decode_addx = { M32R_INSN_ADDX, & ITAB (M32R_INSN_ADDX), EX (fmt_7_addx), FULL (addx), FAST (addx) }; | |
89 | static DECODE decode_bc8 = { M32R_INSN_BC8, & ITAB (M32R_INSN_BC8), EX (fmt_8_bc8), FULL (bc8), FAST (bc8) }; | |
90 | static DECODE decode_bc24 = { M32R_INSN_BC24, & ITAB (M32R_INSN_BC24), EX (fmt_9_bc24), FULL (bc24), FAST (bc24) }; | |
91 | static DECODE decode_beq = { M32R_INSN_BEQ, & ITAB (M32R_INSN_BEQ), EX (fmt_10_beq), FULL (beq), FAST (beq) }; | |
92 | static DECODE decode_beqz = { M32R_INSN_BEQZ, & ITAB (M32R_INSN_BEQZ), EX (fmt_11_beqz), FULL (beqz), FAST (beqz) }; | |
93 | static DECODE decode_bgez = { M32R_INSN_BGEZ, & ITAB (M32R_INSN_BGEZ), EX (fmt_11_beqz), FULL (bgez), FAST (bgez) }; | |
94 | static DECODE decode_bgtz = { M32R_INSN_BGTZ, & ITAB (M32R_INSN_BGTZ), EX (fmt_11_beqz), FULL (bgtz), FAST (bgtz) }; | |
95 | static DECODE decode_blez = { M32R_INSN_BLEZ, & ITAB (M32R_INSN_BLEZ), EX (fmt_11_beqz), FULL (blez), FAST (blez) }; | |
96 | static DECODE decode_bltz = { M32R_INSN_BLTZ, & ITAB (M32R_INSN_BLTZ), EX (fmt_11_beqz), FULL (bltz), FAST (bltz) }; | |
97 | static DECODE decode_bnez = { M32R_INSN_BNEZ, & ITAB (M32R_INSN_BNEZ), EX (fmt_11_beqz), FULL (bnez), FAST (bnez) }; | |
98 | static DECODE decode_bl8 = { M32R_INSN_BL8, & ITAB (M32R_INSN_BL8), EX (fmt_12_bl8), FULL (bl8), FAST (bl8) }; | |
99 | static DECODE decode_bl24 = { M32R_INSN_BL24, & ITAB (M32R_INSN_BL24), EX (fmt_13_bl24), FULL (bl24), FAST (bl24) }; | |
100 | static DECODE decode_bnc8 = { M32R_INSN_BNC8, & ITAB (M32R_INSN_BNC8), EX (fmt_8_bc8), FULL (bnc8), FAST (bnc8) }; | |
101 | static DECODE decode_bnc24 = { M32R_INSN_BNC24, & ITAB (M32R_INSN_BNC24), EX (fmt_9_bc24), FULL (bnc24), FAST (bnc24) }; | |
102 | static DECODE decode_bne = { M32R_INSN_BNE, & ITAB (M32R_INSN_BNE), EX (fmt_10_beq), FULL (bne), FAST (bne) }; | |
103 | static DECODE decode_bra8 = { M32R_INSN_BRA8, & ITAB (M32R_INSN_BRA8), EX (fmt_14_bra8), FULL (bra8), FAST (bra8) }; | |
104 | static DECODE decode_bra24 = { M32R_INSN_BRA24, & ITAB (M32R_INSN_BRA24), EX (fmt_15_bra24), FULL (bra24), FAST (bra24) }; | |
105 | static DECODE decode_cmp = { M32R_INSN_CMP, & ITAB (M32R_INSN_CMP), EX (fmt_16_cmp), FULL (cmp), FAST (cmp) }; | |
106 | static DECODE decode_cmpi = { M32R_INSN_CMPI, & ITAB (M32R_INSN_CMPI), EX (fmt_17_cmpi), FULL (cmpi), FAST (cmpi) }; | |
107 | static DECODE decode_cmpu = { M32R_INSN_CMPU, & ITAB (M32R_INSN_CMPU), EX (fmt_16_cmp), FULL (cmpu), FAST (cmpu) }; | |
108 | static DECODE decode_cmpui = { M32R_INSN_CMPUI, & ITAB (M32R_INSN_CMPUI), EX (fmt_18_cmpui), FULL (cmpui), FAST (cmpui) }; | |
109 | static DECODE decode_div = { M32R_INSN_DIV, & ITAB (M32R_INSN_DIV), EX (fmt_19_div), FULL (div), FAST (div) }; | |
110 | static DECODE decode_divu = { M32R_INSN_DIVU, & ITAB (M32R_INSN_DIVU), EX (fmt_19_div), FULL (divu), FAST (divu) }; | |
111 | static DECODE decode_rem = { M32R_INSN_REM, & ITAB (M32R_INSN_REM), EX (fmt_19_div), FULL (rem), FAST (rem) }; | |
112 | static DECODE decode_remu = { M32R_INSN_REMU, & ITAB (M32R_INSN_REMU), EX (fmt_19_div), FULL (remu), FAST (remu) }; | |
113 | static DECODE decode_jl = { M32R_INSN_JL, & ITAB (M32R_INSN_JL), EX (fmt_20_jl), FULL (jl), FAST (jl) }; | |
114 | static DECODE decode_jmp = { M32R_INSN_JMP, & ITAB (M32R_INSN_JMP), EX (fmt_21_jmp), FULL (jmp), FAST (jmp) }; | |
115 | static DECODE decode_ld = { M32R_INSN_LD, & ITAB (M32R_INSN_LD), EX (fmt_22_ld), FULL (ld), FAST (ld) }; | |
116 | static DECODE decode_ld_d = { M32R_INSN_LD_D, & ITAB (M32R_INSN_LD_D), EX (fmt_23_ld_d), FULL (ld_d), FAST (ld_d) }; | |
117 | static DECODE decode_ldb = { M32R_INSN_LDB, & ITAB (M32R_INSN_LDB), EX (fmt_24_ldb), FULL (ldb), FAST (ldb) }; | |
118 | static DECODE decode_ldb_d = { M32R_INSN_LDB_D, & ITAB (M32R_INSN_LDB_D), EX (fmt_25_ldb_d), FULL (ldb_d), FAST (ldb_d) }; | |
119 | static DECODE decode_ldh = { M32R_INSN_LDH, & ITAB (M32R_INSN_LDH), EX (fmt_26_ldh), FULL (ldh), FAST (ldh) }; | |
120 | static DECODE decode_ldh_d = { M32R_INSN_LDH_D, & ITAB (M32R_INSN_LDH_D), EX (fmt_27_ldh_d), FULL (ldh_d), FAST (ldh_d) }; | |
121 | static DECODE decode_ldub = { M32R_INSN_LDUB, & ITAB (M32R_INSN_LDUB), EX (fmt_24_ldb), FULL (ldub), FAST (ldub) }; | |
122 | static DECODE decode_ldub_d = { M32R_INSN_LDUB_D, & ITAB (M32R_INSN_LDUB_D), EX (fmt_25_ldb_d), FULL (ldub_d), FAST (ldub_d) }; | |
123 | static DECODE decode_lduh = { M32R_INSN_LDUH, & ITAB (M32R_INSN_LDUH), EX (fmt_26_ldh), FULL (lduh), FAST (lduh) }; | |
124 | static DECODE decode_lduh_d = { M32R_INSN_LDUH_D, & ITAB (M32R_INSN_LDUH_D), EX (fmt_27_ldh_d), FULL (lduh_d), FAST (lduh_d) }; | |
125 | static DECODE decode_ld_plus = { M32R_INSN_LD_PLUS, & ITAB (M32R_INSN_LD_PLUS), EX (fmt_28_ld_plus), FULL (ld_plus), FAST (ld_plus) }; | |
126 | static DECODE decode_ld24 = { M32R_INSN_LD24, & ITAB (M32R_INSN_LD24), EX (fmt_29_ld24), FULL (ld24), FAST (ld24) }; | |
127 | static DECODE decode_ldi8 = { M32R_INSN_LDI8, & ITAB (M32R_INSN_LDI8), EX (fmt_30_ldi8), FULL (ldi8), FAST (ldi8) }; | |
128 | static DECODE decode_ldi16 = { M32R_INSN_LDI16, & ITAB (M32R_INSN_LDI16), EX (fmt_31_ldi16), FULL (ldi16), FAST (ldi16) }; | |
129 | static DECODE decode_lock = { M32R_INSN_LOCK, & ITAB (M32R_INSN_LOCK), EX (fmt_32_lock), FULL (lock), FAST (lock) }; | |
130 | static DECODE decode_machi = { M32R_INSN_MACHI, & ITAB (M32R_INSN_MACHI), EX (fmt_33_machi), FULL (machi), FAST (machi) }; | |
131 | static DECODE decode_maclo = { M32R_INSN_MACLO, & ITAB (M32R_INSN_MACLO), EX (fmt_33_machi), FULL (maclo), FAST (maclo) }; | |
132 | static DECODE decode_macwhi = { M32R_INSN_MACWHI, & ITAB (M32R_INSN_MACWHI), EX (fmt_33_machi), FULL (macwhi), FAST (macwhi) }; | |
133 | static DECODE decode_macwlo = { M32R_INSN_MACWLO, & ITAB (M32R_INSN_MACWLO), EX (fmt_33_machi), FULL (macwlo), FAST (macwlo) }; | |
e0bd6e18 | 134 | static DECODE decode_mul = { M32R_INSN_MUL, & ITAB (M32R_INSN_MUL), EX (fmt_0_add), FULL (mul), FAST (mul) }; |
cab58155 DE |
135 | static DECODE decode_mulhi = { M32R_INSN_MULHI, & ITAB (M32R_INSN_MULHI), EX (fmt_34_mulhi), FULL (mulhi), FAST (mulhi) }; |
136 | static DECODE decode_mullo = { M32R_INSN_MULLO, & ITAB (M32R_INSN_MULLO), EX (fmt_34_mulhi), FULL (mullo), FAST (mullo) }; | |
137 | static DECODE decode_mulwhi = { M32R_INSN_MULWHI, & ITAB (M32R_INSN_MULWHI), EX (fmt_34_mulhi), FULL (mulwhi), FAST (mulwhi) }; | |
138 | static DECODE decode_mulwlo = { M32R_INSN_MULWLO, & ITAB (M32R_INSN_MULWLO), EX (fmt_34_mulhi), FULL (mulwlo), FAST (mulwlo) }; | |
139 | static DECODE decode_mv = { M32R_INSN_MV, & ITAB (M32R_INSN_MV), EX (fmt_35_mv), FULL (mv), FAST (mv) }; | |
140 | static DECODE decode_mvfachi = { M32R_INSN_MVFACHI, & ITAB (M32R_INSN_MVFACHI), EX (fmt_36_mvfachi), FULL (mvfachi), FAST (mvfachi) }; | |
141 | static DECODE decode_mvfaclo = { M32R_INSN_MVFACLO, & ITAB (M32R_INSN_MVFACLO), EX (fmt_36_mvfachi), FULL (mvfaclo), FAST (mvfaclo) }; | |
142 | static DECODE decode_mvfacmi = { M32R_INSN_MVFACMI, & ITAB (M32R_INSN_MVFACMI), EX (fmt_36_mvfachi), FULL (mvfacmi), FAST (mvfacmi) }; | |
143 | static DECODE decode_mvfc = { M32R_INSN_MVFC, & ITAB (M32R_INSN_MVFC), EX (fmt_37_mvfc), FULL (mvfc), FAST (mvfc) }; | |
144 | static DECODE decode_mvtachi = { M32R_INSN_MVTACHI, & ITAB (M32R_INSN_MVTACHI), EX (fmt_38_mvtachi), FULL (mvtachi), FAST (mvtachi) }; | |
145 | static DECODE decode_mvtaclo = { M32R_INSN_MVTACLO, & ITAB (M32R_INSN_MVTACLO), EX (fmt_38_mvtachi), FULL (mvtaclo), FAST (mvtaclo) }; | |
146 | static DECODE decode_mvtc = { M32R_INSN_MVTC, & ITAB (M32R_INSN_MVTC), EX (fmt_39_mvtc), FULL (mvtc), FAST (mvtc) }; | |
147 | static DECODE decode_neg = { M32R_INSN_NEG, & ITAB (M32R_INSN_NEG), EX (fmt_35_mv), FULL (neg), FAST (neg) }; | |
148 | static DECODE decode_nop = { M32R_INSN_NOP, & ITAB (M32R_INSN_NOP), EX (fmt_40_nop), FULL (nop), FAST (nop) }; | |
149 | static DECODE decode_not = { M32R_INSN_NOT, & ITAB (M32R_INSN_NOT), EX (fmt_35_mv), FULL (not), FAST (not) }; | |
150 | static DECODE decode_rac = { M32R_INSN_RAC, & ITAB (M32R_INSN_RAC), EX (fmt_41_rac), FULL (rac), FAST (rac) }; | |
151 | static DECODE decode_rach = { M32R_INSN_RACH, & ITAB (M32R_INSN_RACH), EX (fmt_41_rac), FULL (rach), FAST (rach) }; | |
152 | static DECODE decode_rte = { M32R_INSN_RTE, & ITAB (M32R_INSN_RTE), EX (fmt_42_rte), FULL (rte), FAST (rte) }; | |
153 | static DECODE decode_seth = { M32R_INSN_SETH, & ITAB (M32R_INSN_SETH), EX (fmt_43_seth), FULL (seth), FAST (seth) }; | |
e0bd6e18 | 154 | static DECODE decode_sll = { M32R_INSN_SLL, & ITAB (M32R_INSN_SLL), EX (fmt_0_add), FULL (sll), FAST (sll) }; |
cab58155 DE |
155 | static DECODE decode_sll3 = { M32R_INSN_SLL3, & ITAB (M32R_INSN_SLL3), EX (fmt_44_sll3), FULL (sll3), FAST (sll3) }; |
156 | static DECODE decode_slli = { M32R_INSN_SLLI, & ITAB (M32R_INSN_SLLI), EX (fmt_45_slli), FULL (slli), FAST (slli) }; | |
e0bd6e18 | 157 | static DECODE decode_sra = { M32R_INSN_SRA, & ITAB (M32R_INSN_SRA), EX (fmt_0_add), FULL (sra), FAST (sra) }; |
cab58155 DE |
158 | static DECODE decode_sra3 = { M32R_INSN_SRA3, & ITAB (M32R_INSN_SRA3), EX (fmt_44_sll3), FULL (sra3), FAST (sra3) }; |
159 | static DECODE decode_srai = { M32R_INSN_SRAI, & ITAB (M32R_INSN_SRAI), EX (fmt_45_slli), FULL (srai), FAST (srai) }; | |
e0bd6e18 | 160 | static DECODE decode_srl = { M32R_INSN_SRL, & ITAB (M32R_INSN_SRL), EX (fmt_0_add), FULL (srl), FAST (srl) }; |
cab58155 DE |
161 | static DECODE decode_srl3 = { M32R_INSN_SRL3, & ITAB (M32R_INSN_SRL3), EX (fmt_44_sll3), FULL (srl3), FAST (srl3) }; |
162 | static DECODE decode_srli = { M32R_INSN_SRLI, & ITAB (M32R_INSN_SRLI), EX (fmt_45_slli), FULL (srli), FAST (srli) }; | |
163 | static DECODE decode_st = { M32R_INSN_ST, & ITAB (M32R_INSN_ST), EX (fmt_46_st), FULL (st), FAST (st) }; | |
164 | static DECODE decode_st_d = { M32R_INSN_ST_D, & ITAB (M32R_INSN_ST_D), EX (fmt_47_st_d), FULL (st_d), FAST (st_d) }; | |
165 | static DECODE decode_stb = { M32R_INSN_STB, & ITAB (M32R_INSN_STB), EX (fmt_48_stb), FULL (stb), FAST (stb) }; | |
166 | static DECODE decode_stb_d = { M32R_INSN_STB_D, & ITAB (M32R_INSN_STB_D), EX (fmt_49_stb_d), FULL (stb_d), FAST (stb_d) }; | |
167 | static DECODE decode_sth = { M32R_INSN_STH, & ITAB (M32R_INSN_STH), EX (fmt_50_sth), FULL (sth), FAST (sth) }; | |
168 | static DECODE decode_sth_d = { M32R_INSN_STH_D, & ITAB (M32R_INSN_STH_D), EX (fmt_51_sth_d), FULL (sth_d), FAST (sth_d) }; | |
169 | static DECODE decode_st_plus = { M32R_INSN_ST_PLUS, & ITAB (M32R_INSN_ST_PLUS), EX (fmt_52_st_plus), FULL (st_plus), FAST (st_plus) }; | |
170 | static DECODE decode_st_minus = { M32R_INSN_ST_MINUS, & ITAB (M32R_INSN_ST_MINUS), EX (fmt_52_st_plus), FULL (st_minus), FAST (st_minus) }; | |
e0bd6e18 | 171 | static DECODE decode_sub = { M32R_INSN_SUB, & ITAB (M32R_INSN_SUB), EX (fmt_0_add), FULL (sub), FAST (sub) }; |
cab58155 DE |
172 | static DECODE decode_subv = { M32R_INSN_SUBV, & ITAB (M32R_INSN_SUBV), EX (fmt_5_addv), FULL (subv), FAST (subv) }; |
173 | static DECODE decode_subx = { M32R_INSN_SUBX, & ITAB (M32R_INSN_SUBX), EX (fmt_7_addx), FULL (subx), FAST (subx) }; | |
174 | static DECODE decode_trap = { M32R_INSN_TRAP, & ITAB (M32R_INSN_TRAP), EX (fmt_53_trap), FULL (trap), FAST (trap) }; | |
175 | static DECODE decode_unlock = { M32R_INSN_UNLOCK, & ITAB (M32R_INSN_UNLOCK), EX (fmt_54_unlock), FULL (unlock), FAST (unlock) }; | |
e0bd6e18 | 176 | |
b8a9943d | 177 | DECODE m32r_decode_illegal = { |
e0bd6e18 DE |
178 | M32R_INSN_ILLEGAL, & ITAB (M32R_INSN_ILLEGAL), |
179 | EX (illegal), FULL (illegal), FAST (illegal) | |
b8a9943d DE |
180 | }; |
181 | ||
e0bd6e18 | 182 | /* The order must match that of `labels' in sem-switch.c/read.c. */ |
b8a9943d DE |
183 | |
184 | DECODE *m32r_decode_vars[] = { | |
185 | & m32r_decode_illegal, | |
186 | & decode_add, | |
187 | & decode_add3, | |
188 | & decode_and, | |
189 | & decode_and3, | |
190 | & decode_or, | |
191 | & decode_or3, | |
192 | & decode_xor, | |
193 | & decode_xor3, | |
194 | & decode_addi, | |
195 | & decode_addv, | |
196 | & decode_addv3, | |
197 | & decode_addx, | |
198 | & decode_bc8, | |
199 | & decode_bc24, | |
200 | & decode_beq, | |
201 | & decode_beqz, | |
202 | & decode_bgez, | |
203 | & decode_bgtz, | |
204 | & decode_blez, | |
205 | & decode_bltz, | |
206 | & decode_bnez, | |
207 | & decode_bl8, | |
208 | & decode_bl24, | |
209 | & decode_bnc8, | |
210 | & decode_bnc24, | |
211 | & decode_bne, | |
212 | & decode_bra8, | |
213 | & decode_bra24, | |
214 | & decode_cmp, | |
215 | & decode_cmpi, | |
216 | & decode_cmpu, | |
217 | & decode_cmpui, | |
218 | & decode_div, | |
219 | & decode_divu, | |
220 | & decode_rem, | |
221 | & decode_remu, | |
222 | & decode_jl, | |
223 | & decode_jmp, | |
224 | & decode_ld, | |
225 | & decode_ld_d, | |
226 | & decode_ldb, | |
227 | & decode_ldb_d, | |
228 | & decode_ldh, | |
229 | & decode_ldh_d, | |
230 | & decode_ldub, | |
231 | & decode_ldub_d, | |
232 | & decode_lduh, | |
233 | & decode_lduh_d, | |
234 | & decode_ld_plus, | |
235 | & decode_ld24, | |
236 | & decode_ldi8, | |
237 | & decode_ldi16, | |
238 | & decode_lock, | |
239 | & decode_machi, | |
240 | & decode_maclo, | |
241 | & decode_macwhi, | |
242 | & decode_macwlo, | |
243 | & decode_mul, | |
244 | & decode_mulhi, | |
245 | & decode_mullo, | |
246 | & decode_mulwhi, | |
247 | & decode_mulwlo, | |
248 | & decode_mv, | |
249 | & decode_mvfachi, | |
250 | & decode_mvfaclo, | |
251 | & decode_mvfacmi, | |
252 | & decode_mvfc, | |
253 | & decode_mvtachi, | |
254 | & decode_mvtaclo, | |
255 | & decode_mvtc, | |
256 | & decode_neg, | |
257 | & decode_nop, | |
258 | & decode_not, | |
259 | & decode_rac, | |
260 | & decode_rach, | |
261 | & decode_rte, | |
262 | & decode_seth, | |
263 | & decode_sll, | |
264 | & decode_sll3, | |
265 | & decode_slli, | |
266 | & decode_sra, | |
267 | & decode_sra3, | |
268 | & decode_srai, | |
269 | & decode_srl, | |
270 | & decode_srl3, | |
271 | & decode_srli, | |
272 | & decode_st, | |
273 | & decode_st_d, | |
274 | & decode_stb, | |
275 | & decode_stb_d, | |
276 | & decode_sth, | |
277 | & decode_sth_d, | |
278 | & decode_st_plus, | |
279 | & decode_st_minus, | |
280 | & decode_sub, | |
281 | & decode_subv, | |
282 | & decode_subx, | |
283 | & decode_trap, | |
284 | & decode_unlock, | |
285 | 0 | |
286 | }; | |
287 | ||
288 | /* The decoder needs a slightly different computed goto switch control. */ | |
289 | #ifdef __GNUC__ | |
290 | #define DECODE_SWITCH(N, X) goto *labels_##N[X]; | |
291 | #else | |
292 | #define DECODE_SWITCH(N, X) switch (X) | |
293 | #endif | |
294 | ||
295 | /* Given an instruction, return a pointer to its DECODE entry. */ | |
296 | ||
297 | DECODE * | |
298 | m32r_decode (current_cpu, pc, insn) | |
299 | SIM_CPU *current_cpu; | |
300 | PCADDR pc; | |
301 | insn_t insn; | |
302 | { | |
303 | { | |
304 | #ifdef __GNUC__ | |
305 | static void *labels_0[256] = { | |
306 | && default_0, && default_0, && default_0, && default_0, | |
307 | && default_0, && default_0, && default_0, && default_0, | |
308 | && default_0, && default_0, && default_0, && default_0, | |
309 | && default_0, && default_0, && default_0, && default_0, | |
310 | && default_0, && default_0, && default_0, && default_0, | |
311 | && default_0, && default_0, && default_0, && default_0, | |
312 | && default_0, && default_0, && default_0, && default_0, | |
313 | && case_0_28, && default_0, && default_0, && default_0, | |
314 | && default_0, && default_0, && default_0, && default_0, | |
315 | && default_0, && default_0, && default_0, && default_0, | |
316 | && default_0, && default_0, && default_0, && default_0, | |
317 | && default_0, && default_0, && default_0, && default_0, | |
318 | && default_0, && default_0, && default_0, && default_0, | |
319 | && default_0, && default_0, && default_0, && default_0, | |
320 | && default_0, && default_0, && default_0, && default_0, | |
321 | && default_0, && default_0, && default_0, && default_0, | |
322 | && default_0, && default_0, && default_0, && default_0, | |
323 | && default_0, && default_0, && default_0, && default_0, | |
324 | && default_0, && default_0, && default_0, && default_0, | |
325 | && default_0, && default_0, && default_0, && default_0, | |
326 | && default_0, && default_0, && default_0, && default_0, | |
327 | && default_0, && default_0, && default_0, && case_0_87, | |
328 | && default_0, && default_0, && default_0, && default_0, | |
329 | && default_0, && default_0, && default_0, && case_0_95, | |
330 | && default_0, && default_0, && default_0, && default_0, | |
331 | && default_0, && default_0, && default_0, && default_0, | |
332 | && default_0, && default_0, && default_0, && default_0, | |
333 | && default_0, && default_0, && default_0, && default_0, | |
334 | && case_0_112, && case_0_113, && case_0_114, && case_0_115, | |
335 | && case_0_116, && case_0_117, && case_0_118, && case_0_119, | |
336 | && case_0_120, && case_0_121, && case_0_122, && case_0_123, | |
337 | && case_0_124, && case_0_125, && case_0_126, && case_0_127, | |
338 | && default_0, && default_0, && default_0, && default_0, | |
339 | && default_0, && default_0, && default_0, && default_0, | |
340 | && default_0, && default_0, && default_0, && default_0, | |
341 | && default_0, && default_0, && default_0, && default_0, | |
cab58155 | 342 | && default_0, && default_0, && default_0, && default_0, |
b8a9943d DE |
343 | && default_0, && default_0, && default_0, && default_0, |
344 | && default_0, && default_0, && default_0, && default_0, | |
345 | && default_0, && default_0, && default_0, && default_0, | |
346 | && default_0, && default_0, && default_0, && default_0, | |
347 | && default_0, && default_0, && default_0, && default_0, | |
348 | && default_0, && default_0, && default_0, && default_0, | |
349 | && default_0, && default_0, && default_0, && default_0, | |
350 | && default_0, && default_0, && default_0, && default_0, | |
351 | && default_0, && default_0, && default_0, && default_0, | |
352 | && default_0, && default_0, && default_0, && default_0, | |
353 | && default_0, && default_0, && default_0, && default_0, | |
354 | && default_0, && default_0, && default_0, && default_0, | |
355 | && default_0, && default_0, && default_0, && default_0, | |
356 | && default_0, && default_0, && default_0, && default_0, | |
357 | && default_0, && default_0, && default_0, && default_0, | |
358 | && default_0, && default_0, && default_0, && default_0, | |
359 | && default_0, && default_0, && default_0, && default_0, | |
360 | && default_0, && default_0, && default_0, && default_0, | |
361 | && default_0, && default_0, && default_0, && default_0, | |
362 | && default_0, && default_0, && default_0, && default_0, | |
363 | && default_0, && default_0, && default_0, && default_0, | |
364 | && default_0, && default_0, && default_0, && default_0, | |
365 | && default_0, && default_0, && default_0, && default_0, | |
366 | && case_0_240, && case_0_241, && case_0_242, && case_0_243, | |
367 | && case_0_244, && case_0_245, && case_0_246, && case_0_247, | |
368 | && case_0_248, && case_0_249, && case_0_250, && case_0_251, | |
369 | && case_0_252, && case_0_253, && case_0_254, && case_0_255, | |
370 | }; | |
371 | #endif | |
372 | static DECODE *insns[256] = { | |
373 | &decode_subv, &decode_subx, &decode_sub, &decode_neg, | |
374 | &decode_cmp, &decode_cmpu, &decode_illegal, &decode_illegal, | |
375 | &decode_addv, &decode_addx, &decode_add, &decode_not, | |
376 | &decode_and, &decode_xor, &decode_or, &decode_illegal, | |
377 | &decode_srl, &decode_illegal, &decode_sra, &decode_illegal, | |
378 | &decode_sll, &decode_illegal, &decode_mul, &decode_illegal, | |
379 | &decode_mv, &decode_mvfc, &decode_mvtc, &decode_illegal, | |
380 | 0, &decode_rte, &decode_illegal, &decode_trap, | |
381 | &decode_stb, &decode_illegal, &decode_sth, &decode_illegal, | |
382 | &decode_st, &decode_unlock, &decode_st_plus, &decode_st_minus, | |
383 | &decode_ldb, &decode_ldub, &decode_ldh, &decode_lduh, | |
384 | &decode_ld, &decode_lock, &decode_ld_plus, &decode_illegal, | |
385 | &decode_mulhi, &decode_mullo, &decode_mulwhi, &decode_mulwlo, | |
386 | &decode_machi, &decode_maclo, &decode_macwhi, &decode_macwlo, | |
387 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
388 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
389 | &decode_addi, &decode_addi, &decode_addi, &decode_addi, | |
390 | &decode_addi, &decode_addi, &decode_addi, &decode_addi, | |
391 | &decode_addi, &decode_addi, &decode_addi, &decode_addi, | |
392 | &decode_addi, &decode_addi, &decode_addi, &decode_addi, | |
393 | &decode_srli, &decode_srli, &decode_srai, &decode_srai, | |
394 | &decode_slli, &decode_slli, &decode_illegal, 0, | |
395 | &decode_rach, &decode_rac, &decode_illegal, &decode_illegal, | |
396 | &decode_illegal, &decode_illegal, &decode_illegal, 0, | |
397 | &decode_ldi8, &decode_ldi8, &decode_ldi8, &decode_ldi8, | |
398 | &decode_ldi8, &decode_ldi8, &decode_ldi8, &decode_ldi8, | |
399 | &decode_ldi8, &decode_ldi8, &decode_ldi8, &decode_ldi8, | |
400 | &decode_ldi8, &decode_ldi8, &decode_ldi8, &decode_ldi8, | |
401 | 0, 0, 0, 0, | |
402 | 0, 0, 0, 0, | |
403 | 0, 0, 0, 0, | |
404 | 0, 0, 0, 0, | |
405 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
406 | &decode_cmpi, &decode_cmpui, &decode_illegal, &decode_illegal, | |
407 | &decode_addv3, &decode_illegal, &decode_add3, &decode_illegal, | |
408 | &decode_and3, &decode_xor3, &decode_or3, &decode_illegal, | |
cab58155 | 409 | &decode_div, &decode_divu, &decode_rem, &decode_remu, |
b8a9943d DE |
410 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, |
411 | &decode_srl3, &decode_illegal, &decode_sra3, &decode_illegal, | |
412 | &decode_sll3, &decode_illegal, &decode_illegal, &decode_ldi16, | |
413 | &decode_stb_d, &decode_illegal, &decode_sth_d, &decode_illegal, | |
414 | &decode_st_d, &decode_illegal, &decode_illegal, &decode_illegal, | |
415 | &decode_ldb_d, &decode_ldub_d, &decode_ldh_d, &decode_lduh_d, | |
416 | &decode_ld_d, &decode_illegal, &decode_illegal, &decode_illegal, | |
417 | &decode_beq, &decode_bne, &decode_illegal, &decode_illegal, | |
418 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
419 | &decode_beqz, &decode_bnez, &decode_bltz, &decode_bgez, | |
420 | &decode_blez, &decode_bgtz, &decode_illegal, &decode_illegal, | |
421 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
422 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
423 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
424 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
425 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
426 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
427 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
428 | &decode_seth, &decode_illegal, &decode_illegal, &decode_illegal, | |
429 | &decode_ld24, &decode_ld24, &decode_ld24, &decode_ld24, | |
430 | &decode_ld24, &decode_ld24, &decode_ld24, &decode_ld24, | |
431 | &decode_ld24, &decode_ld24, &decode_ld24, &decode_ld24, | |
432 | &decode_ld24, &decode_ld24, &decode_ld24, &decode_ld24, | |
433 | 0, 0, 0, 0, | |
434 | 0, 0, 0, 0, | |
435 | 0, 0, 0, 0, | |
436 | 0, 0, 0, 0, | |
437 | }; | |
438 | unsigned int val; | |
439 | val = (((insn >> 8) & (15 << 4)) | ((insn >> 4) & (15 << 0))); | |
440 | DECODE_SWITCH (0, val) | |
441 | { | |
442 | CASE (0, 28) : | |
443 | { | |
444 | static DECODE *insns[16] = { | |
445 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
446 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
447 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
448 | &decode_illegal, &decode_illegal, &decode_jl, &decode_jmp, | |
449 | }; | |
450 | unsigned int val = (((insn >> 8) & (15 << 0))); | |
451 | return insns[val]; | |
452 | } | |
453 | CASE (0, 87) : | |
454 | { | |
455 | static DECODE *insns[16] = { | |
456 | &decode_mvtachi, &decode_mvtaclo, &decode_illegal, &decode_illegal, | |
457 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
458 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
459 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
460 | }; | |
461 | unsigned int val = (((insn >> 0) & (15 << 0))); | |
462 | return insns[val]; | |
463 | } | |
464 | CASE (0, 95) : | |
465 | { | |
466 | static DECODE *insns[16] = { | |
467 | &decode_mvfachi, &decode_mvfaclo, &decode_mvfacmi, &decode_illegal, | |
468 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
469 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
470 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
471 | }; | |
472 | unsigned int val = (((insn >> 0) & (15 << 0))); | |
473 | return insns[val]; | |
474 | } | |
475 | CASE (0, 112) : | |
476 | { | |
477 | static DECODE *insns[16] = { | |
478 | &decode_nop, &decode_illegal, &decode_illegal, &decode_illegal, | |
479 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
480 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
481 | &decode_bc8, &decode_bnc8, &decode_bl8, &decode_bra8, | |
482 | }; | |
483 | unsigned int val = (((insn >> 8) & (15 << 0))); | |
484 | return insns[val]; | |
485 | } | |
486 | CASE (0, 113) : /* fall through */ | |
487 | CASE (0, 114) : /* fall through */ | |
488 | CASE (0, 115) : /* fall through */ | |
489 | CASE (0, 116) : /* fall through */ | |
490 | CASE (0, 117) : /* fall through */ | |
491 | CASE (0, 118) : /* fall through */ | |
492 | CASE (0, 119) : /* fall through */ | |
493 | CASE (0, 120) : /* fall through */ | |
494 | CASE (0, 121) : /* fall through */ | |
495 | CASE (0, 122) : /* fall through */ | |
496 | CASE (0, 123) : /* fall through */ | |
497 | CASE (0, 124) : /* fall through */ | |
498 | CASE (0, 125) : /* fall through */ | |
499 | CASE (0, 126) : /* fall through */ | |
500 | CASE (0, 127) : | |
501 | { | |
502 | static DECODE *insns[16] = { | |
503 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
504 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
505 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
506 | &decode_bc8, &decode_bnc8, &decode_bl8, &decode_bra8, | |
507 | }; | |
508 | unsigned int val = (((insn >> 8) & (15 << 0))); | |
509 | return insns[val]; | |
510 | } | |
511 | CASE (0, 240) : /* fall through */ | |
512 | CASE (0, 241) : /* fall through */ | |
513 | CASE (0, 242) : /* fall through */ | |
514 | CASE (0, 243) : /* fall through */ | |
515 | CASE (0, 244) : /* fall through */ | |
516 | CASE (0, 245) : /* fall through */ | |
517 | CASE (0, 246) : /* fall through */ | |
518 | CASE (0, 247) : /* fall through */ | |
519 | CASE (0, 248) : /* fall through */ | |
520 | CASE (0, 249) : /* fall through */ | |
521 | CASE (0, 250) : /* fall through */ | |
522 | CASE (0, 251) : /* fall through */ | |
523 | CASE (0, 252) : /* fall through */ | |
524 | CASE (0, 253) : /* fall through */ | |
525 | CASE (0, 254) : /* fall through */ | |
526 | CASE (0, 255) : | |
527 | { | |
528 | static DECODE *insns[16] = { | |
529 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
530 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
531 | &decode_illegal, &decode_illegal, &decode_illegal, &decode_illegal, | |
532 | &decode_bc24, &decode_bnc24, &decode_bl24, &decode_bra24, | |
533 | }; | |
534 | unsigned int val = (((insn >> 8) & (15 << 0))); | |
535 | return insns[val]; | |
536 | } | |
537 | DEFAULT (0) : return insns[val]; | |
538 | } | |
539 | ENDSWITCH (0) | |
540 | } | |
541 | } |