decode.c revision 1.1.1.1 1 1.1 christos /* Simulator instruction decoder for m32rbf.
2 1.1 christos
3 1.1 christos THIS FILE IS MACHINE GENERATED WITH CGEN.
4 1.1 christos
5 1.1 christos Copyright 1996-2010 Free Software Foundation, Inc.
6 1.1 christos
7 1.1 christos This file is part of the GNU simulators.
8 1.1 christos
9 1.1 christos This file is free software; you can redistribute it and/or modify
10 1.1 christos it under the terms of the GNU General Public License as published by
11 1.1 christos the Free Software Foundation; either version 3, or (at your option)
12 1.1 christos any later version.
13 1.1 christos
14 1.1 christos It is distributed in the hope that it will be useful, but WITHOUT
15 1.1 christos ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 1.1 christos or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 1.1 christos License for more details.
18 1.1 christos
19 1.1 christos You should have received a copy of the GNU General Public License along
20 1.1 christos with this program; if not, write to the Free Software Foundation, Inc.,
21 1.1 christos 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
22 1.1 christos
23 1.1 christos */
24 1.1 christos
25 1.1 christos #define WANT_CPU m32rbf
26 1.1 christos #define WANT_CPU_M32RBF
27 1.1 christos
28 1.1 christos #include "sim-main.h"
29 1.1 christos #include "sim-assert.h"
30 1.1 christos
31 1.1 christos /* The instruction descriptor array.
32 1.1 christos This is computed at runtime. Space for it is not malloc'd to save a
33 1.1 christos teensy bit of cpu in the decoder. Moving it to malloc space is trivial
34 1.1 christos but won't be done until necessary (we don't currently support the runtime
35 1.1 christos addition of instructions nor an SMP machine with different cpus). */
36 1.1 christos static IDESC m32rbf_insn_data[M32RBF_INSN__MAX];
37 1.1 christos
38 1.1 christos /* Commas between elements are contained in the macros.
39 1.1 christos Some of these are conditionally compiled out. */
40 1.1 christos
41 1.1 christos static const struct insn_sem m32rbf_insn_sem[] =
42 1.1 christos {
43 1.1 christos { VIRTUAL_INSN_X_INVALID, M32RBF_INSN_X_INVALID, M32RBF_SFMT_EMPTY },
44 1.1 christos { VIRTUAL_INSN_X_AFTER, M32RBF_INSN_X_AFTER, M32RBF_SFMT_EMPTY },
45 1.1 christos { VIRTUAL_INSN_X_BEFORE, M32RBF_INSN_X_BEFORE, M32RBF_SFMT_EMPTY },
46 1.1 christos { VIRTUAL_INSN_X_CTI_CHAIN, M32RBF_INSN_X_CTI_CHAIN, M32RBF_SFMT_EMPTY },
47 1.1 christos { VIRTUAL_INSN_X_CHAIN, M32RBF_INSN_X_CHAIN, M32RBF_SFMT_EMPTY },
48 1.1 christos { VIRTUAL_INSN_X_BEGIN, M32RBF_INSN_X_BEGIN, M32RBF_SFMT_EMPTY },
49 1.1 christos { M32R_INSN_ADD, M32RBF_INSN_ADD, M32RBF_SFMT_ADD },
50 1.1 christos { M32R_INSN_ADD3, M32RBF_INSN_ADD3, M32RBF_SFMT_ADD3 },
51 1.1 christos { M32R_INSN_AND, M32RBF_INSN_AND, M32RBF_SFMT_ADD },
52 1.1 christos { M32R_INSN_AND3, M32RBF_INSN_AND3, M32RBF_SFMT_AND3 },
53 1.1 christos { M32R_INSN_OR, M32RBF_INSN_OR, M32RBF_SFMT_ADD },
54 1.1 christos { M32R_INSN_OR3, M32RBF_INSN_OR3, M32RBF_SFMT_OR3 },
55 1.1 christos { M32R_INSN_XOR, M32RBF_INSN_XOR, M32RBF_SFMT_ADD },
56 1.1 christos { M32R_INSN_XOR3, M32RBF_INSN_XOR3, M32RBF_SFMT_AND3 },
57 1.1 christos { M32R_INSN_ADDI, M32RBF_INSN_ADDI, M32RBF_SFMT_ADDI },
58 1.1 christos { M32R_INSN_ADDV, M32RBF_INSN_ADDV, M32RBF_SFMT_ADDV },
59 1.1 christos { M32R_INSN_ADDV3, M32RBF_INSN_ADDV3, M32RBF_SFMT_ADDV3 },
60 1.1 christos { M32R_INSN_ADDX, M32RBF_INSN_ADDX, M32RBF_SFMT_ADDX },
61 1.1 christos { M32R_INSN_BC8, M32RBF_INSN_BC8, M32RBF_SFMT_BC8 },
62 1.1 christos { M32R_INSN_BC24, M32RBF_INSN_BC24, M32RBF_SFMT_BC24 },
63 1.1 christos { M32R_INSN_BEQ, M32RBF_INSN_BEQ, M32RBF_SFMT_BEQ },
64 1.1 christos { M32R_INSN_BEQZ, M32RBF_INSN_BEQZ, M32RBF_SFMT_BEQZ },
65 1.1 christos { M32R_INSN_BGEZ, M32RBF_INSN_BGEZ, M32RBF_SFMT_BEQZ },
66 1.1 christos { M32R_INSN_BGTZ, M32RBF_INSN_BGTZ, M32RBF_SFMT_BEQZ },
67 1.1 christos { M32R_INSN_BLEZ, M32RBF_INSN_BLEZ, M32RBF_SFMT_BEQZ },
68 1.1 christos { M32R_INSN_BLTZ, M32RBF_INSN_BLTZ, M32RBF_SFMT_BEQZ },
69 1.1 christos { M32R_INSN_BNEZ, M32RBF_INSN_BNEZ, M32RBF_SFMT_BEQZ },
70 1.1 christos { M32R_INSN_BL8, M32RBF_INSN_BL8, M32RBF_SFMT_BL8 },
71 1.1 christos { M32R_INSN_BL24, M32RBF_INSN_BL24, M32RBF_SFMT_BL24 },
72 1.1 christos { M32R_INSN_BNC8, M32RBF_INSN_BNC8, M32RBF_SFMT_BC8 },
73 1.1 christos { M32R_INSN_BNC24, M32RBF_INSN_BNC24, M32RBF_SFMT_BC24 },
74 1.1 christos { M32R_INSN_BNE, M32RBF_INSN_BNE, M32RBF_SFMT_BEQ },
75 1.1 christos { M32R_INSN_BRA8, M32RBF_INSN_BRA8, M32RBF_SFMT_BRA8 },
76 1.1 christos { M32R_INSN_BRA24, M32RBF_INSN_BRA24, M32RBF_SFMT_BRA24 },
77 1.1 christos { M32R_INSN_CMP, M32RBF_INSN_CMP, M32RBF_SFMT_CMP },
78 1.1 christos { M32R_INSN_CMPI, M32RBF_INSN_CMPI, M32RBF_SFMT_CMPI },
79 1.1 christos { M32R_INSN_CMPU, M32RBF_INSN_CMPU, M32RBF_SFMT_CMP },
80 1.1 christos { M32R_INSN_CMPUI, M32RBF_INSN_CMPUI, M32RBF_SFMT_CMPI },
81 1.1 christos { M32R_INSN_DIV, M32RBF_INSN_DIV, M32RBF_SFMT_DIV },
82 1.1 christos { M32R_INSN_DIVU, M32RBF_INSN_DIVU, M32RBF_SFMT_DIV },
83 1.1 christos { M32R_INSN_REM, M32RBF_INSN_REM, M32RBF_SFMT_DIV },
84 1.1 christos { M32R_INSN_REMU, M32RBF_INSN_REMU, M32RBF_SFMT_DIV },
85 1.1 christos { M32R_INSN_JL, M32RBF_INSN_JL, M32RBF_SFMT_JL },
86 1.1 christos { M32R_INSN_JMP, M32RBF_INSN_JMP, M32RBF_SFMT_JMP },
87 1.1 christos { M32R_INSN_LD, M32RBF_INSN_LD, M32RBF_SFMT_LD },
88 1.1 christos { M32R_INSN_LD_D, M32RBF_INSN_LD_D, M32RBF_SFMT_LD_D },
89 1.1 christos { M32R_INSN_LDB, M32RBF_INSN_LDB, M32RBF_SFMT_LDB },
90 1.1 christos { M32R_INSN_LDB_D, M32RBF_INSN_LDB_D, M32RBF_SFMT_LDB_D },
91 1.1 christos { M32R_INSN_LDH, M32RBF_INSN_LDH, M32RBF_SFMT_LDH },
92 1.1 christos { M32R_INSN_LDH_D, M32RBF_INSN_LDH_D, M32RBF_SFMT_LDH_D },
93 1.1 christos { M32R_INSN_LDUB, M32RBF_INSN_LDUB, M32RBF_SFMT_LDB },
94 1.1 christos { M32R_INSN_LDUB_D, M32RBF_INSN_LDUB_D, M32RBF_SFMT_LDB_D },
95 1.1 christos { M32R_INSN_LDUH, M32RBF_INSN_LDUH, M32RBF_SFMT_LDH },
96 1.1 christos { M32R_INSN_LDUH_D, M32RBF_INSN_LDUH_D, M32RBF_SFMT_LDH_D },
97 1.1 christos { M32R_INSN_LD_PLUS, M32RBF_INSN_LD_PLUS, M32RBF_SFMT_LD_PLUS },
98 1.1 christos { M32R_INSN_LD24, M32RBF_INSN_LD24, M32RBF_SFMT_LD24 },
99 1.1 christos { M32R_INSN_LDI8, M32RBF_INSN_LDI8, M32RBF_SFMT_LDI8 },
100 1.1 christos { M32R_INSN_LDI16, M32RBF_INSN_LDI16, M32RBF_SFMT_LDI16 },
101 1.1 christos { M32R_INSN_LOCK, M32RBF_INSN_LOCK, M32RBF_SFMT_LOCK },
102 1.1 christos { M32R_INSN_MACHI, M32RBF_INSN_MACHI, M32RBF_SFMT_MACHI },
103 1.1 christos { M32R_INSN_MACLO, M32RBF_INSN_MACLO, M32RBF_SFMT_MACHI },
104 1.1 christos { M32R_INSN_MACWHI, M32RBF_INSN_MACWHI, M32RBF_SFMT_MACHI },
105 1.1 christos { M32R_INSN_MACWLO, M32RBF_INSN_MACWLO, M32RBF_SFMT_MACHI },
106 1.1 christos { M32R_INSN_MUL, M32RBF_INSN_MUL, M32RBF_SFMT_ADD },
107 1.1 christos { M32R_INSN_MULHI, M32RBF_INSN_MULHI, M32RBF_SFMT_MULHI },
108 1.1 christos { M32R_INSN_MULLO, M32RBF_INSN_MULLO, M32RBF_SFMT_MULHI },
109 1.1 christos { M32R_INSN_MULWHI, M32RBF_INSN_MULWHI, M32RBF_SFMT_MULHI },
110 1.1 christos { M32R_INSN_MULWLO, M32RBF_INSN_MULWLO, M32RBF_SFMT_MULHI },
111 1.1 christos { M32R_INSN_MV, M32RBF_INSN_MV, M32RBF_SFMT_MV },
112 1.1 christos { M32R_INSN_MVFACHI, M32RBF_INSN_MVFACHI, M32RBF_SFMT_MVFACHI },
113 1.1 christos { M32R_INSN_MVFACLO, M32RBF_INSN_MVFACLO, M32RBF_SFMT_MVFACHI },
114 1.1 christos { M32R_INSN_MVFACMI, M32RBF_INSN_MVFACMI, M32RBF_SFMT_MVFACHI },
115 1.1 christos { M32R_INSN_MVFC, M32RBF_INSN_MVFC, M32RBF_SFMT_MVFC },
116 1.1 christos { M32R_INSN_MVTACHI, M32RBF_INSN_MVTACHI, M32RBF_SFMT_MVTACHI },
117 1.1 christos { M32R_INSN_MVTACLO, M32RBF_INSN_MVTACLO, M32RBF_SFMT_MVTACHI },
118 1.1 christos { M32R_INSN_MVTC, M32RBF_INSN_MVTC, M32RBF_SFMT_MVTC },
119 1.1 christos { M32R_INSN_NEG, M32RBF_INSN_NEG, M32RBF_SFMT_MV },
120 1.1 christos { M32R_INSN_NOP, M32RBF_INSN_NOP, M32RBF_SFMT_NOP },
121 1.1 christos { M32R_INSN_NOT, M32RBF_INSN_NOT, M32RBF_SFMT_MV },
122 1.1 christos { M32R_INSN_RAC, M32RBF_INSN_RAC, M32RBF_SFMT_RAC },
123 1.1 christos { M32R_INSN_RACH, M32RBF_INSN_RACH, M32RBF_SFMT_RAC },
124 1.1 christos { M32R_INSN_RTE, M32RBF_INSN_RTE, M32RBF_SFMT_RTE },
125 1.1 christos { M32R_INSN_SETH, M32RBF_INSN_SETH, M32RBF_SFMT_SETH },
126 1.1 christos { M32R_INSN_SLL, M32RBF_INSN_SLL, M32RBF_SFMT_ADD },
127 1.1 christos { M32R_INSN_SLL3, M32RBF_INSN_SLL3, M32RBF_SFMT_SLL3 },
128 1.1 christos { M32R_INSN_SLLI, M32RBF_INSN_SLLI, M32RBF_SFMT_SLLI },
129 1.1 christos { M32R_INSN_SRA, M32RBF_INSN_SRA, M32RBF_SFMT_ADD },
130 1.1 christos { M32R_INSN_SRA3, M32RBF_INSN_SRA3, M32RBF_SFMT_SLL3 },
131 1.1 christos { M32R_INSN_SRAI, M32RBF_INSN_SRAI, M32RBF_SFMT_SLLI },
132 1.1 christos { M32R_INSN_SRL, M32RBF_INSN_SRL, M32RBF_SFMT_ADD },
133 1.1 christos { M32R_INSN_SRL3, M32RBF_INSN_SRL3, M32RBF_SFMT_SLL3 },
134 1.1 christos { M32R_INSN_SRLI, M32RBF_INSN_SRLI, M32RBF_SFMT_SLLI },
135 1.1 christos { M32R_INSN_ST, M32RBF_INSN_ST, M32RBF_SFMT_ST },
136 1.1 christos { M32R_INSN_ST_D, M32RBF_INSN_ST_D, M32RBF_SFMT_ST_D },
137 1.1 christos { M32R_INSN_STB, M32RBF_INSN_STB, M32RBF_SFMT_STB },
138 1.1 christos { M32R_INSN_STB_D, M32RBF_INSN_STB_D, M32RBF_SFMT_STB_D },
139 1.1 christos { M32R_INSN_STH, M32RBF_INSN_STH, M32RBF_SFMT_STH },
140 1.1 christos { M32R_INSN_STH_D, M32RBF_INSN_STH_D, M32RBF_SFMT_STH_D },
141 1.1 christos { M32R_INSN_ST_PLUS, M32RBF_INSN_ST_PLUS, M32RBF_SFMT_ST_PLUS },
142 1.1 christos { M32R_INSN_ST_MINUS, M32RBF_INSN_ST_MINUS, M32RBF_SFMT_ST_PLUS },
143 1.1 christos { M32R_INSN_SUB, M32RBF_INSN_SUB, M32RBF_SFMT_ADD },
144 1.1 christos { M32R_INSN_SUBV, M32RBF_INSN_SUBV, M32RBF_SFMT_ADDV },
145 1.1 christos { M32R_INSN_SUBX, M32RBF_INSN_SUBX, M32RBF_SFMT_ADDX },
146 1.1 christos { M32R_INSN_TRAP, M32RBF_INSN_TRAP, M32RBF_SFMT_TRAP },
147 1.1 christos { M32R_INSN_UNLOCK, M32RBF_INSN_UNLOCK, M32RBF_SFMT_UNLOCK },
148 1.1 christos { M32R_INSN_CLRPSW, M32RBF_INSN_CLRPSW, M32RBF_SFMT_CLRPSW },
149 1.1 christos { M32R_INSN_SETPSW, M32RBF_INSN_SETPSW, M32RBF_SFMT_SETPSW },
150 1.1 christos { M32R_INSN_BSET, M32RBF_INSN_BSET, M32RBF_SFMT_BSET },
151 1.1 christos { M32R_INSN_BCLR, M32RBF_INSN_BCLR, M32RBF_SFMT_BSET },
152 1.1 christos { M32R_INSN_BTST, M32RBF_INSN_BTST, M32RBF_SFMT_BTST },
153 1.1 christos };
154 1.1 christos
155 1.1 christos static const struct insn_sem m32rbf_insn_sem_invalid =
156 1.1 christos {
157 1.1 christos VIRTUAL_INSN_X_INVALID, M32RBF_INSN_X_INVALID, M32RBF_SFMT_EMPTY
158 1.1 christos };
159 1.1 christos
160 1.1 christos /* Initialize an IDESC from the compile-time computable parts. */
161 1.1 christos
162 1.1 christos static INLINE void
163 1.1 christos init_idesc (SIM_CPU *cpu, IDESC *id, const struct insn_sem *t)
164 1.1 christos {
165 1.1 christos const CGEN_INSN *insn_table = CGEN_CPU_INSN_TABLE (CPU_CPU_DESC (cpu))->init_entries;
166 1.1 christos
167 1.1 christos id->num = t->index;
168 1.1 christos id->sfmt = t->sfmt;
169 1.1 christos if ((int) t->type <= 0)
170 1.1 christos id->idata = & cgen_virtual_insn_table[- (int) t->type];
171 1.1 christos else
172 1.1 christos id->idata = & insn_table[t->type];
173 1.1 christos id->attrs = CGEN_INSN_ATTRS (id->idata);
174 1.1 christos /* Oh my god, a magic number. */
175 1.1 christos id->length = CGEN_INSN_BITSIZE (id->idata) / 8;
176 1.1 christos
177 1.1 christos #if WITH_PROFILE_MODEL_P
178 1.1 christos id->timing = & MODEL_TIMING (CPU_MODEL (cpu)) [t->index];
179 1.1 christos {
180 1.1 christos SIM_DESC sd = CPU_STATE (cpu);
181 1.1 christos SIM_ASSERT (t->index == id->timing->num);
182 1.1 christos }
183 1.1 christos #endif
184 1.1 christos
185 1.1 christos /* Semantic pointers are initialized elsewhere. */
186 1.1 christos }
187 1.1 christos
188 1.1 christos /* Initialize the instruction descriptor table. */
189 1.1 christos
190 1.1 christos void
191 1.1 christos m32rbf_init_idesc_table (SIM_CPU *cpu)
192 1.1 christos {
193 1.1 christos IDESC *id,*tabend;
194 1.1 christos const struct insn_sem *t,*tend;
195 1.1 christos int tabsize = M32RBF_INSN__MAX;
196 1.1 christos IDESC *table = m32rbf_insn_data;
197 1.1 christos
198 1.1 christos memset (table, 0, tabsize * sizeof (IDESC));
199 1.1 christos
200 1.1 christos /* First set all entries to the `invalid insn'. */
201 1.1 christos t = & m32rbf_insn_sem_invalid;
202 1.1 christos for (id = table, tabend = table + tabsize; id < tabend; ++id)
203 1.1 christos init_idesc (cpu, id, t);
204 1.1 christos
205 1.1 christos /* Now fill in the values for the chosen cpu. */
206 1.1 christos for (t = m32rbf_insn_sem, tend = t + sizeof (m32rbf_insn_sem) / sizeof (*t);
207 1.1 christos t != tend; ++t)
208 1.1 christos {
209 1.1 christos init_idesc (cpu, & table[t->index], t);
210 1.1 christos }
211 1.1 christos
212 1.1 christos /* Link the IDESC table into the cpu. */
213 1.1 christos CPU_IDESC (cpu) = table;
214 1.1 christos }
215 1.1 christos
216 1.1 christos /* Given an instruction, return a pointer to its IDESC entry. */
217 1.1 christos
218 1.1 christos const IDESC *
219 1.1 christos m32rbf_decode (SIM_CPU *current_cpu, IADDR pc,
220 1.1 christos CGEN_INSN_WORD base_insn, CGEN_INSN_WORD entire_insn,
221 1.1 christos ARGBUF *abuf)
222 1.1 christos {
223 1.1 christos /* Result of decoder. */
224 1.1 christos M32RBF_INSN_TYPE itype;
225 1.1 christos
226 1.1 christos {
227 1.1 christos CGEN_INSN_WORD insn = base_insn;
228 1.1 christos
229 1.1 christos {
230 1.1 christos unsigned int val = (((insn >> 8) & (15 << 4)) | ((insn >> 4) & (15 << 0)));
231 1.1 christos switch (val)
232 1.1 christos {
233 1.1 christos case 0 : itype = M32RBF_INSN_SUBV; goto extract_sfmt_addv;
234 1.1 christos case 1 : itype = M32RBF_INSN_SUBX; goto extract_sfmt_addx;
235 1.1 christos case 2 : itype = M32RBF_INSN_SUB; goto extract_sfmt_add;
236 1.1 christos case 3 : itype = M32RBF_INSN_NEG; goto extract_sfmt_mv;
237 1.1 christos case 4 : itype = M32RBF_INSN_CMP; goto extract_sfmt_cmp;
238 1.1 christos case 5 : itype = M32RBF_INSN_CMPU; goto extract_sfmt_cmp;
239 1.1 christos case 8 : itype = M32RBF_INSN_ADDV; goto extract_sfmt_addv;
240 1.1 christos case 9 : itype = M32RBF_INSN_ADDX; goto extract_sfmt_addx;
241 1.1 christos case 10 : itype = M32RBF_INSN_ADD; goto extract_sfmt_add;
242 1.1 christos case 11 : itype = M32RBF_INSN_NOT; goto extract_sfmt_mv;
243 1.1 christos case 12 : itype = M32RBF_INSN_AND; goto extract_sfmt_add;
244 1.1 christos case 13 : itype = M32RBF_INSN_XOR; goto extract_sfmt_add;
245 1.1 christos case 14 : itype = M32RBF_INSN_OR; goto extract_sfmt_add;
246 1.1 christos case 15 :
247 1.1 christos if ((entire_insn & 0xf8f0) == 0xf0)
248 1.1 christos { itype = M32RBF_INSN_BTST; goto extract_sfmt_btst; }
249 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
250 1.1 christos case 16 : itype = M32RBF_INSN_SRL; goto extract_sfmt_add;
251 1.1 christos case 18 : itype = M32RBF_INSN_SRA; goto extract_sfmt_add;
252 1.1 christos case 20 : itype = M32RBF_INSN_SLL; goto extract_sfmt_add;
253 1.1 christos case 22 : itype = M32RBF_INSN_MUL; goto extract_sfmt_add;
254 1.1 christos case 24 : itype = M32RBF_INSN_MV; goto extract_sfmt_mv;
255 1.1 christos case 25 : itype = M32RBF_INSN_MVFC; goto extract_sfmt_mvfc;
256 1.1 christos case 26 : itype = M32RBF_INSN_MVTC; goto extract_sfmt_mvtc;
257 1.1 christos case 28 :
258 1.1 christos {
259 1.1 christos unsigned int val = (((insn >> 8) & (1 << 0)));
260 1.1 christos switch (val)
261 1.1 christos {
262 1.1 christos case 0 :
263 1.1 christos if ((entire_insn & 0xfff0) == 0x1ec0)
264 1.1 christos { itype = M32RBF_INSN_JL; goto extract_sfmt_jl; }
265 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
266 1.1 christos case 1 :
267 1.1 christos if ((entire_insn & 0xfff0) == 0x1fc0)
268 1.1 christos { itype = M32RBF_INSN_JMP; goto extract_sfmt_jmp; }
269 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
270 1.1 christos default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
271 1.1 christos }
272 1.1 christos }
273 1.1 christos case 29 :
274 1.1 christos if ((entire_insn & 0xffff) == 0x10d6)
275 1.1 christos { itype = M32RBF_INSN_RTE; goto extract_sfmt_rte; }
276 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
277 1.1 christos case 31 :
278 1.1 christos if ((entire_insn & 0xfff0) == 0x10f0)
279 1.1 christos { itype = M32RBF_INSN_TRAP; goto extract_sfmt_trap; }
280 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
281 1.1 christos case 32 : itype = M32RBF_INSN_STB; goto extract_sfmt_stb;
282 1.1 christos case 34 : itype = M32RBF_INSN_STH; goto extract_sfmt_sth;
283 1.1 christos case 36 : itype = M32RBF_INSN_ST; goto extract_sfmt_st;
284 1.1 christos case 37 : itype = M32RBF_INSN_UNLOCK; goto extract_sfmt_unlock;
285 1.1 christos case 38 : itype = M32RBF_INSN_ST_PLUS; goto extract_sfmt_st_plus;
286 1.1 christos case 39 : itype = M32RBF_INSN_ST_MINUS; goto extract_sfmt_st_plus;
287 1.1 christos case 40 : itype = M32RBF_INSN_LDB; goto extract_sfmt_ldb;
288 1.1 christos case 41 : itype = M32RBF_INSN_LDUB; goto extract_sfmt_ldb;
289 1.1 christos case 42 : itype = M32RBF_INSN_LDH; goto extract_sfmt_ldh;
290 1.1 christos case 43 : itype = M32RBF_INSN_LDUH; goto extract_sfmt_ldh;
291 1.1 christos case 44 : itype = M32RBF_INSN_LD; goto extract_sfmt_ld;
292 1.1 christos case 45 : itype = M32RBF_INSN_LOCK; goto extract_sfmt_lock;
293 1.1 christos case 46 : itype = M32RBF_INSN_LD_PLUS; goto extract_sfmt_ld_plus;
294 1.1 christos case 48 : itype = M32RBF_INSN_MULHI; goto extract_sfmt_mulhi;
295 1.1 christos case 49 : itype = M32RBF_INSN_MULLO; goto extract_sfmt_mulhi;
296 1.1 christos case 50 : itype = M32RBF_INSN_MULWHI; goto extract_sfmt_mulhi;
297 1.1 christos case 51 : itype = M32RBF_INSN_MULWLO; goto extract_sfmt_mulhi;
298 1.1 christos case 52 : itype = M32RBF_INSN_MACHI; goto extract_sfmt_machi;
299 1.1 christos case 53 : itype = M32RBF_INSN_MACLO; goto extract_sfmt_machi;
300 1.1 christos case 54 : itype = M32RBF_INSN_MACWHI; goto extract_sfmt_machi;
301 1.1 christos case 55 : itype = M32RBF_INSN_MACWLO; goto extract_sfmt_machi;
302 1.1 christos case 64 : /* fall through */
303 1.1 christos case 65 : /* fall through */
304 1.1 christos case 66 : /* fall through */
305 1.1 christos case 67 : /* fall through */
306 1.1 christos case 68 : /* fall through */
307 1.1 christos case 69 : /* fall through */
308 1.1 christos case 70 : /* fall through */
309 1.1 christos case 71 : /* fall through */
310 1.1 christos case 72 : /* fall through */
311 1.1 christos case 73 : /* fall through */
312 1.1 christos case 74 : /* fall through */
313 1.1 christos case 75 : /* fall through */
314 1.1 christos case 76 : /* fall through */
315 1.1 christos case 77 : /* fall through */
316 1.1 christos case 78 : /* fall through */
317 1.1 christos case 79 : itype = M32RBF_INSN_ADDI; goto extract_sfmt_addi;
318 1.1 christos case 80 : /* fall through */
319 1.1 christos case 81 : itype = M32RBF_INSN_SRLI; goto extract_sfmt_slli;
320 1.1 christos case 82 : /* fall through */
321 1.1 christos case 83 : itype = M32RBF_INSN_SRAI; goto extract_sfmt_slli;
322 1.1 christos case 84 : /* fall through */
323 1.1 christos case 85 : itype = M32RBF_INSN_SLLI; goto extract_sfmt_slli;
324 1.1 christos case 87 :
325 1.1 christos {
326 1.1 christos unsigned int val = (((insn >> 0) & (1 << 0)));
327 1.1 christos switch (val)
328 1.1 christos {
329 1.1 christos case 0 :
330 1.1 christos if ((entire_insn & 0xf0ff) == 0x5070)
331 1.1 christos { itype = M32RBF_INSN_MVTACHI; goto extract_sfmt_mvtachi; }
332 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
333 1.1 christos case 1 :
334 1.1 christos if ((entire_insn & 0xf0ff) == 0x5071)
335 1.1 christos { itype = M32RBF_INSN_MVTACLO; goto extract_sfmt_mvtachi; }
336 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
337 1.1 christos default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
338 1.1 christos }
339 1.1 christos }
340 1.1 christos case 88 :
341 1.1 christos if ((entire_insn & 0xffff) == 0x5080)
342 1.1 christos { itype = M32RBF_INSN_RACH; goto extract_sfmt_rac; }
343 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
344 1.1 christos case 89 :
345 1.1 christos if ((entire_insn & 0xffff) == 0x5090)
346 1.1 christos { itype = M32RBF_INSN_RAC; goto extract_sfmt_rac; }
347 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
348 1.1 christos case 95 :
349 1.1 christos {
350 1.1 christos unsigned int val = (((insn >> 0) & (3 << 0)));
351 1.1 christos switch (val)
352 1.1 christos {
353 1.1 christos case 0 :
354 1.1 christos if ((entire_insn & 0xf0ff) == 0x50f0)
355 1.1 christos { itype = M32RBF_INSN_MVFACHI; goto extract_sfmt_mvfachi; }
356 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
357 1.1 christos case 1 :
358 1.1 christos if ((entire_insn & 0xf0ff) == 0x50f1)
359 1.1 christos { itype = M32RBF_INSN_MVFACLO; goto extract_sfmt_mvfachi; }
360 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
361 1.1 christos case 2 :
362 1.1 christos if ((entire_insn & 0xf0ff) == 0x50f2)
363 1.1 christos { itype = M32RBF_INSN_MVFACMI; goto extract_sfmt_mvfachi; }
364 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
365 1.1 christos default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
366 1.1 christos }
367 1.1 christos }
368 1.1 christos case 96 : /* fall through */
369 1.1 christos case 97 : /* fall through */
370 1.1 christos case 98 : /* fall through */
371 1.1 christos case 99 : /* fall through */
372 1.1 christos case 100 : /* fall through */
373 1.1 christos case 101 : /* fall through */
374 1.1 christos case 102 : /* fall through */
375 1.1 christos case 103 : /* fall through */
376 1.1 christos case 104 : /* fall through */
377 1.1 christos case 105 : /* fall through */
378 1.1 christos case 106 : /* fall through */
379 1.1 christos case 107 : /* fall through */
380 1.1 christos case 108 : /* fall through */
381 1.1 christos case 109 : /* fall through */
382 1.1 christos case 110 : /* fall through */
383 1.1 christos case 111 : itype = M32RBF_INSN_LDI8; goto extract_sfmt_ldi8;
384 1.1 christos case 112 :
385 1.1 christos {
386 1.1 christos unsigned int val = (((insn >> 8) & (15 << 0)));
387 1.1 christos switch (val)
388 1.1 christos {
389 1.1 christos case 0 :
390 1.1 christos if ((entire_insn & 0xffff) == 0x7000)
391 1.1 christos { itype = M32RBF_INSN_NOP; goto extract_sfmt_nop; }
392 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
393 1.1 christos case 1 : itype = M32RBF_INSN_SETPSW; goto extract_sfmt_setpsw;
394 1.1 christos case 2 : itype = M32RBF_INSN_CLRPSW; goto extract_sfmt_clrpsw;
395 1.1 christos case 12 : itype = M32RBF_INSN_BC8; goto extract_sfmt_bc8;
396 1.1 christos case 13 : itype = M32RBF_INSN_BNC8; goto extract_sfmt_bc8;
397 1.1 christos case 14 : itype = M32RBF_INSN_BL8; goto extract_sfmt_bl8;
398 1.1 christos case 15 : itype = M32RBF_INSN_BRA8; goto extract_sfmt_bra8;
399 1.1 christos default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
400 1.1 christos }
401 1.1 christos }
402 1.1 christos case 113 : /* fall through */
403 1.1 christos case 114 : /* fall through */
404 1.1 christos case 115 : /* fall through */
405 1.1 christos case 116 : /* fall through */
406 1.1 christos case 117 : /* fall through */
407 1.1 christos case 118 : /* fall through */
408 1.1 christos case 119 : /* fall through */
409 1.1 christos case 120 : /* fall through */
410 1.1 christos case 121 : /* fall through */
411 1.1 christos case 122 : /* fall through */
412 1.1 christos case 123 : /* fall through */
413 1.1 christos case 124 : /* fall through */
414 1.1 christos case 125 : /* fall through */
415 1.1 christos case 126 : /* fall through */
416 1.1 christos case 127 :
417 1.1 christos {
418 1.1 christos unsigned int val = (((insn >> 8) & (15 << 0)));
419 1.1 christos switch (val)
420 1.1 christos {
421 1.1 christos case 1 : itype = M32RBF_INSN_SETPSW; goto extract_sfmt_setpsw;
422 1.1 christos case 2 : itype = M32RBF_INSN_CLRPSW; goto extract_sfmt_clrpsw;
423 1.1 christos case 12 : itype = M32RBF_INSN_BC8; goto extract_sfmt_bc8;
424 1.1 christos case 13 : itype = M32RBF_INSN_BNC8; goto extract_sfmt_bc8;
425 1.1 christos case 14 : itype = M32RBF_INSN_BL8; goto extract_sfmt_bl8;
426 1.1 christos case 15 : itype = M32RBF_INSN_BRA8; goto extract_sfmt_bra8;
427 1.1 christos default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
428 1.1 christos }
429 1.1 christos }
430 1.1 christos case 132 :
431 1.1 christos if ((entire_insn & 0xfff00000) == 0x80400000)
432 1.1 christos { itype = M32RBF_INSN_CMPI; goto extract_sfmt_cmpi; }
433 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
434 1.1 christos case 133 :
435 1.1 christos if ((entire_insn & 0xfff00000) == 0x80500000)
436 1.1 christos { itype = M32RBF_INSN_CMPUI; goto extract_sfmt_cmpi; }
437 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
438 1.1 christos case 136 : itype = M32RBF_INSN_ADDV3; goto extract_sfmt_addv3;
439 1.1 christos case 138 : itype = M32RBF_INSN_ADD3; goto extract_sfmt_add3;
440 1.1 christos case 140 : itype = M32RBF_INSN_AND3; goto extract_sfmt_and3;
441 1.1 christos case 141 : itype = M32RBF_INSN_XOR3; goto extract_sfmt_and3;
442 1.1 christos case 142 : itype = M32RBF_INSN_OR3; goto extract_sfmt_or3;
443 1.1 christos case 144 :
444 1.1 christos if ((entire_insn & 0xf0f0ffff) == 0x90000000)
445 1.1 christos { itype = M32RBF_INSN_DIV; goto extract_sfmt_div; }
446 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
447 1.1 christos case 145 :
448 1.1 christos if ((entire_insn & 0xf0f0ffff) == 0x90100000)
449 1.1 christos { itype = M32RBF_INSN_DIVU; goto extract_sfmt_div; }
450 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
451 1.1 christos case 146 :
452 1.1 christos if ((entire_insn & 0xf0f0ffff) == 0x90200000)
453 1.1 christos { itype = M32RBF_INSN_REM; goto extract_sfmt_div; }
454 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
455 1.1 christos case 147 :
456 1.1 christos if ((entire_insn & 0xf0f0ffff) == 0x90300000)
457 1.1 christos { itype = M32RBF_INSN_REMU; goto extract_sfmt_div; }
458 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
459 1.1 christos case 152 : itype = M32RBF_INSN_SRL3; goto extract_sfmt_sll3;
460 1.1 christos case 154 : itype = M32RBF_INSN_SRA3; goto extract_sfmt_sll3;
461 1.1 christos case 156 : itype = M32RBF_INSN_SLL3; goto extract_sfmt_sll3;
462 1.1 christos case 159 :
463 1.1 christos if ((entire_insn & 0xf0ff0000) == 0x90f00000)
464 1.1 christos { itype = M32RBF_INSN_LDI16; goto extract_sfmt_ldi16; }
465 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
466 1.1 christos case 160 : itype = M32RBF_INSN_STB_D; goto extract_sfmt_stb_d;
467 1.1 christos case 162 : itype = M32RBF_INSN_STH_D; goto extract_sfmt_sth_d;
468 1.1 christos case 164 : itype = M32RBF_INSN_ST_D; goto extract_sfmt_st_d;
469 1.1 christos case 166 :
470 1.1 christos if ((entire_insn & 0xf8f00000) == 0xa0600000)
471 1.1 christos { itype = M32RBF_INSN_BSET; goto extract_sfmt_bset; }
472 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
473 1.1 christos case 167 :
474 1.1 christos if ((entire_insn & 0xf8f00000) == 0xa0700000)
475 1.1 christos { itype = M32RBF_INSN_BCLR; goto extract_sfmt_bset; }
476 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
477 1.1 christos case 168 : itype = M32RBF_INSN_LDB_D; goto extract_sfmt_ldb_d;
478 1.1 christos case 169 : itype = M32RBF_INSN_LDUB_D; goto extract_sfmt_ldb_d;
479 1.1 christos case 170 : itype = M32RBF_INSN_LDH_D; goto extract_sfmt_ldh_d;
480 1.1 christos case 171 : itype = M32RBF_INSN_LDUH_D; goto extract_sfmt_ldh_d;
481 1.1 christos case 172 : itype = M32RBF_INSN_LD_D; goto extract_sfmt_ld_d;
482 1.1 christos case 176 : itype = M32RBF_INSN_BEQ; goto extract_sfmt_beq;
483 1.1 christos case 177 : itype = M32RBF_INSN_BNE; goto extract_sfmt_beq;
484 1.1 christos case 184 :
485 1.1 christos if ((entire_insn & 0xfff00000) == 0xb0800000)
486 1.1 christos { itype = M32RBF_INSN_BEQZ; goto extract_sfmt_beqz; }
487 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
488 1.1 christos case 185 :
489 1.1 christos if ((entire_insn & 0xfff00000) == 0xb0900000)
490 1.1 christos { itype = M32RBF_INSN_BNEZ; goto extract_sfmt_beqz; }
491 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
492 1.1 christos case 186 :
493 1.1 christos if ((entire_insn & 0xfff00000) == 0xb0a00000)
494 1.1 christos { itype = M32RBF_INSN_BLTZ; goto extract_sfmt_beqz; }
495 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
496 1.1 christos case 187 :
497 1.1 christos if ((entire_insn & 0xfff00000) == 0xb0b00000)
498 1.1 christos { itype = M32RBF_INSN_BGEZ; goto extract_sfmt_beqz; }
499 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
500 1.1 christos case 188 :
501 1.1 christos if ((entire_insn & 0xfff00000) == 0xb0c00000)
502 1.1 christos { itype = M32RBF_INSN_BLEZ; goto extract_sfmt_beqz; }
503 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
504 1.1 christos case 189 :
505 1.1 christos if ((entire_insn & 0xfff00000) == 0xb0d00000)
506 1.1 christos { itype = M32RBF_INSN_BGTZ; goto extract_sfmt_beqz; }
507 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
508 1.1 christos case 220 :
509 1.1 christos if ((entire_insn & 0xf0ff0000) == 0xd0c00000)
510 1.1 christos { itype = M32RBF_INSN_SETH; goto extract_sfmt_seth; }
511 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
512 1.1 christos case 224 : /* fall through */
513 1.1 christos case 225 : /* fall through */
514 1.1 christos case 226 : /* fall through */
515 1.1 christos case 227 : /* fall through */
516 1.1 christos case 228 : /* fall through */
517 1.1 christos case 229 : /* fall through */
518 1.1 christos case 230 : /* fall through */
519 1.1 christos case 231 : /* fall through */
520 1.1 christos case 232 : /* fall through */
521 1.1 christos case 233 : /* fall through */
522 1.1 christos case 234 : /* fall through */
523 1.1 christos case 235 : /* fall through */
524 1.1 christos case 236 : /* fall through */
525 1.1 christos case 237 : /* fall through */
526 1.1 christos case 238 : /* fall through */
527 1.1 christos case 239 : itype = M32RBF_INSN_LD24; goto extract_sfmt_ld24;
528 1.1 christos case 240 : /* fall through */
529 1.1 christos case 241 : /* fall through */
530 1.1 christos case 242 : /* fall through */
531 1.1 christos case 243 : /* fall through */
532 1.1 christos case 244 : /* fall through */
533 1.1 christos case 245 : /* fall through */
534 1.1 christos case 246 : /* fall through */
535 1.1 christos case 247 : /* fall through */
536 1.1 christos case 248 : /* fall through */
537 1.1 christos case 249 : /* fall through */
538 1.1 christos case 250 : /* fall through */
539 1.1 christos case 251 : /* fall through */
540 1.1 christos case 252 : /* fall through */
541 1.1 christos case 253 : /* fall through */
542 1.1 christos case 254 : /* fall through */
543 1.1 christos case 255 :
544 1.1 christos {
545 1.1 christos unsigned int val = (((insn >> 8) & (3 << 0)));
546 1.1 christos switch (val)
547 1.1 christos {
548 1.1 christos case 0 :
549 1.1 christos if ((entire_insn & 0xff000000) == 0xfc000000)
550 1.1 christos { itype = M32RBF_INSN_BC24; goto extract_sfmt_bc24; }
551 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
552 1.1 christos case 1 :
553 1.1 christos if ((entire_insn & 0xff000000) == 0xfd000000)
554 1.1 christos { itype = M32RBF_INSN_BNC24; goto extract_sfmt_bc24; }
555 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
556 1.1 christos case 2 :
557 1.1 christos if ((entire_insn & 0xff000000) == 0xfe000000)
558 1.1 christos { itype = M32RBF_INSN_BL24; goto extract_sfmt_bl24; }
559 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
560 1.1 christos case 3 :
561 1.1 christos if ((entire_insn & 0xff000000) == 0xff000000)
562 1.1 christos { itype = M32RBF_INSN_BRA24; goto extract_sfmt_bra24; }
563 1.1 christos itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
564 1.1 christos default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
565 1.1 christos }
566 1.1 christos }
567 1.1 christos default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty;
568 1.1 christos }
569 1.1 christos }
570 1.1 christos }
571 1.1 christos
572 1.1 christos /* The instruction has been decoded, now extract the fields. */
573 1.1 christos
574 1.1 christos extract_sfmt_empty:
575 1.1 christos {
576 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
577 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f
578 1.1 christos
579 1.1 christos
580 1.1 christos /* Record the fields for the semantic handler. */
581 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_empty", (char *) 0));
582 1.1 christos
583 1.1 christos #undef FLD
584 1.1 christos return idesc;
585 1.1 christos }
586 1.1 christos
587 1.1 christos extract_sfmt_add:
588 1.1 christos {
589 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
590 1.1 christos CGEN_INSN_WORD insn = entire_insn;
591 1.1 christos #define FLD(f) abuf->fields.sfmt_add.f
592 1.1 christos UINT f_r1;
593 1.1 christos UINT f_r2;
594 1.1 christos
595 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
596 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
597 1.1 christos
598 1.1 christos /* Record the fields for the semantic handler. */
599 1.1 christos FLD (f_r1) = f_r1;
600 1.1 christos FLD (f_r2) = f_r2;
601 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
602 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
603 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
604 1.1 christos
605 1.1 christos #if WITH_PROFILE_MODEL_P
606 1.1 christos /* Record the fields for profiling. */
607 1.1 christos if (PROFILE_MODEL_P (current_cpu))
608 1.1 christos {
609 1.1 christos FLD (in_dr) = f_r1;
610 1.1 christos FLD (in_sr) = f_r2;
611 1.1 christos FLD (out_dr) = f_r1;
612 1.1 christos }
613 1.1 christos #endif
614 1.1 christos #undef FLD
615 1.1 christos return idesc;
616 1.1 christos }
617 1.1 christos
618 1.1 christos extract_sfmt_add3:
619 1.1 christos {
620 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
621 1.1 christos CGEN_INSN_WORD insn = entire_insn;
622 1.1 christos #define FLD(f) abuf->fields.sfmt_add3.f
623 1.1 christos UINT f_r1;
624 1.1 christos UINT f_r2;
625 1.1 christos INT f_simm16;
626 1.1 christos
627 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
628 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
629 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
630 1.1 christos
631 1.1 christos /* Record the fields for the semantic handler. */
632 1.1 christos FLD (f_simm16) = f_simm16;
633 1.1 christos FLD (f_r2) = f_r2;
634 1.1 christos FLD (f_r1) = f_r1;
635 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
636 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
637 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
638 1.1 christos
639 1.1 christos #if WITH_PROFILE_MODEL_P
640 1.1 christos /* Record the fields for profiling. */
641 1.1 christos if (PROFILE_MODEL_P (current_cpu))
642 1.1 christos {
643 1.1 christos FLD (in_sr) = f_r2;
644 1.1 christos FLD (out_dr) = f_r1;
645 1.1 christos }
646 1.1 christos #endif
647 1.1 christos #undef FLD
648 1.1 christos return idesc;
649 1.1 christos }
650 1.1 christos
651 1.1 christos extract_sfmt_and3:
652 1.1 christos {
653 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
654 1.1 christos CGEN_INSN_WORD insn = entire_insn;
655 1.1 christos #define FLD(f) abuf->fields.sfmt_and3.f
656 1.1 christos UINT f_r1;
657 1.1 christos UINT f_r2;
658 1.1 christos UINT f_uimm16;
659 1.1 christos
660 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
661 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
662 1.1 christos f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
663 1.1 christos
664 1.1 christos /* Record the fields for the semantic handler. */
665 1.1 christos FLD (f_r2) = f_r2;
666 1.1 christos FLD (f_uimm16) = f_uimm16;
667 1.1 christos FLD (f_r1) = f_r1;
668 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
669 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
670 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_and3", "f_r2 0x%x", 'x', f_r2, "f_uimm16 0x%x", 'x', f_uimm16, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
671 1.1 christos
672 1.1 christos #if WITH_PROFILE_MODEL_P
673 1.1 christos /* Record the fields for profiling. */
674 1.1 christos if (PROFILE_MODEL_P (current_cpu))
675 1.1 christos {
676 1.1 christos FLD (in_sr) = f_r2;
677 1.1 christos FLD (out_dr) = f_r1;
678 1.1 christos }
679 1.1 christos #endif
680 1.1 christos #undef FLD
681 1.1 christos return idesc;
682 1.1 christos }
683 1.1 christos
684 1.1 christos extract_sfmt_or3:
685 1.1 christos {
686 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
687 1.1 christos CGEN_INSN_WORD insn = entire_insn;
688 1.1 christos #define FLD(f) abuf->fields.sfmt_and3.f
689 1.1 christos UINT f_r1;
690 1.1 christos UINT f_r2;
691 1.1 christos UINT f_uimm16;
692 1.1 christos
693 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
694 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
695 1.1 christos f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
696 1.1 christos
697 1.1 christos /* Record the fields for the semantic handler. */
698 1.1 christos FLD (f_r2) = f_r2;
699 1.1 christos FLD (f_uimm16) = f_uimm16;
700 1.1 christos FLD (f_r1) = f_r1;
701 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
702 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
703 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_or3", "f_r2 0x%x", 'x', f_r2, "f_uimm16 0x%x", 'x', f_uimm16, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
704 1.1 christos
705 1.1 christos #if WITH_PROFILE_MODEL_P
706 1.1 christos /* Record the fields for profiling. */
707 1.1 christos if (PROFILE_MODEL_P (current_cpu))
708 1.1 christos {
709 1.1 christos FLD (in_sr) = f_r2;
710 1.1 christos FLD (out_dr) = f_r1;
711 1.1 christos }
712 1.1 christos #endif
713 1.1 christos #undef FLD
714 1.1 christos return idesc;
715 1.1 christos }
716 1.1 christos
717 1.1 christos extract_sfmt_addi:
718 1.1 christos {
719 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
720 1.1 christos CGEN_INSN_WORD insn = entire_insn;
721 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f
722 1.1 christos UINT f_r1;
723 1.1 christos INT f_simm8;
724 1.1 christos
725 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
726 1.1 christos f_simm8 = EXTRACT_MSB0_SINT (insn, 16, 8, 8);
727 1.1 christos
728 1.1 christos /* Record the fields for the semantic handler. */
729 1.1 christos FLD (f_r1) = f_r1;
730 1.1 christos FLD (f_simm8) = f_simm8;
731 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
732 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addi", "f_r1 0x%x", 'x', f_r1, "f_simm8 0x%x", 'x', f_simm8, "dr 0x%x", 'x', f_r1, (char *) 0));
733 1.1 christos
734 1.1 christos #if WITH_PROFILE_MODEL_P
735 1.1 christos /* Record the fields for profiling. */
736 1.1 christos if (PROFILE_MODEL_P (current_cpu))
737 1.1 christos {
738 1.1 christos FLD (in_dr) = f_r1;
739 1.1 christos FLD (out_dr) = f_r1;
740 1.1 christos }
741 1.1 christos #endif
742 1.1 christos #undef FLD
743 1.1 christos return idesc;
744 1.1 christos }
745 1.1 christos
746 1.1 christos extract_sfmt_addv:
747 1.1 christos {
748 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
749 1.1 christos CGEN_INSN_WORD insn = entire_insn;
750 1.1 christos #define FLD(f) abuf->fields.sfmt_add.f
751 1.1 christos UINT f_r1;
752 1.1 christos UINT f_r2;
753 1.1 christos
754 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
755 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
756 1.1 christos
757 1.1 christos /* Record the fields for the semantic handler. */
758 1.1 christos FLD (f_r1) = f_r1;
759 1.1 christos FLD (f_r2) = f_r2;
760 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
761 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
762 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
763 1.1 christos
764 1.1 christos #if WITH_PROFILE_MODEL_P
765 1.1 christos /* Record the fields for profiling. */
766 1.1 christos if (PROFILE_MODEL_P (current_cpu))
767 1.1 christos {
768 1.1 christos FLD (in_dr) = f_r1;
769 1.1 christos FLD (in_sr) = f_r2;
770 1.1 christos FLD (out_dr) = f_r1;
771 1.1 christos }
772 1.1 christos #endif
773 1.1 christos #undef FLD
774 1.1 christos return idesc;
775 1.1 christos }
776 1.1 christos
777 1.1 christos extract_sfmt_addv3:
778 1.1 christos {
779 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
780 1.1 christos CGEN_INSN_WORD insn = entire_insn;
781 1.1 christos #define FLD(f) abuf->fields.sfmt_add3.f
782 1.1 christos UINT f_r1;
783 1.1 christos UINT f_r2;
784 1.1 christos INT f_simm16;
785 1.1 christos
786 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
787 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
788 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
789 1.1 christos
790 1.1 christos /* Record the fields for the semantic handler. */
791 1.1 christos FLD (f_simm16) = f_simm16;
792 1.1 christos FLD (f_r2) = f_r2;
793 1.1 christos FLD (f_r1) = f_r1;
794 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
795 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
796 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
797 1.1 christos
798 1.1 christos #if WITH_PROFILE_MODEL_P
799 1.1 christos /* Record the fields for profiling. */
800 1.1 christos if (PROFILE_MODEL_P (current_cpu))
801 1.1 christos {
802 1.1 christos FLD (in_sr) = f_r2;
803 1.1 christos FLD (out_dr) = f_r1;
804 1.1 christos }
805 1.1 christos #endif
806 1.1 christos #undef FLD
807 1.1 christos return idesc;
808 1.1 christos }
809 1.1 christos
810 1.1 christos extract_sfmt_addx:
811 1.1 christos {
812 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
813 1.1 christos CGEN_INSN_WORD insn = entire_insn;
814 1.1 christos #define FLD(f) abuf->fields.sfmt_add.f
815 1.1 christos UINT f_r1;
816 1.1 christos UINT f_r2;
817 1.1 christos
818 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
819 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
820 1.1 christos
821 1.1 christos /* Record the fields for the semantic handler. */
822 1.1 christos FLD (f_r1) = f_r1;
823 1.1 christos FLD (f_r2) = f_r2;
824 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
825 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
826 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addx", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
827 1.1 christos
828 1.1 christos #if WITH_PROFILE_MODEL_P
829 1.1 christos /* Record the fields for profiling. */
830 1.1 christos if (PROFILE_MODEL_P (current_cpu))
831 1.1 christos {
832 1.1 christos FLD (in_dr) = f_r1;
833 1.1 christos FLD (in_sr) = f_r2;
834 1.1 christos FLD (out_dr) = f_r1;
835 1.1 christos }
836 1.1 christos #endif
837 1.1 christos #undef FLD
838 1.1 christos return idesc;
839 1.1 christos }
840 1.1 christos
841 1.1 christos extract_sfmt_bc8:
842 1.1 christos {
843 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
844 1.1 christos CGEN_INSN_WORD insn = entire_insn;
845 1.1 christos #define FLD(f) abuf->fields.sfmt_bl8.f
846 1.1 christos SI f_disp8;
847 1.1 christos
848 1.1 christos f_disp8 = ((((EXTRACT_MSB0_SINT (insn, 16, 8, 8)) << (2))) + (((pc) & (-4))));
849 1.1 christos
850 1.1 christos /* Record the fields for the semantic handler. */
851 1.1 christos FLD (i_disp8) = f_disp8;
852 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bc8", "disp8 0x%x", 'x', f_disp8, (char *) 0));
853 1.1 christos
854 1.1 christos #if WITH_PROFILE_MODEL_P
855 1.1 christos /* Record the fields for profiling. */
856 1.1 christos if (PROFILE_MODEL_P (current_cpu))
857 1.1 christos {
858 1.1 christos }
859 1.1 christos #endif
860 1.1 christos #undef FLD
861 1.1 christos return idesc;
862 1.1 christos }
863 1.1 christos
864 1.1 christos extract_sfmt_bc24:
865 1.1 christos {
866 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
867 1.1 christos CGEN_INSN_WORD insn = entire_insn;
868 1.1 christos #define FLD(f) abuf->fields.sfmt_bl24.f
869 1.1 christos SI f_disp24;
870 1.1 christos
871 1.1 christos f_disp24 = ((((EXTRACT_MSB0_SINT (insn, 32, 8, 24)) << (2))) + (pc));
872 1.1 christos
873 1.1 christos /* Record the fields for the semantic handler. */
874 1.1 christos FLD (i_disp24) = f_disp24;
875 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bc24", "disp24 0x%x", 'x', f_disp24, (char *) 0));
876 1.1 christos
877 1.1 christos #if WITH_PROFILE_MODEL_P
878 1.1 christos /* Record the fields for profiling. */
879 1.1 christos if (PROFILE_MODEL_P (current_cpu))
880 1.1 christos {
881 1.1 christos }
882 1.1 christos #endif
883 1.1 christos #undef FLD
884 1.1 christos return idesc;
885 1.1 christos }
886 1.1 christos
887 1.1 christos extract_sfmt_beq:
888 1.1 christos {
889 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
890 1.1 christos CGEN_INSN_WORD insn = entire_insn;
891 1.1 christos #define FLD(f) abuf->fields.sfmt_beq.f
892 1.1 christos UINT f_r1;
893 1.1 christos UINT f_r2;
894 1.1 christos SI f_disp16;
895 1.1 christos
896 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
897 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
898 1.1 christos f_disp16 = ((((EXTRACT_MSB0_SINT (insn, 32, 16, 16)) << (2))) + (pc));
899 1.1 christos
900 1.1 christos /* Record the fields for the semantic handler. */
901 1.1 christos FLD (f_r1) = f_r1;
902 1.1 christos FLD (f_r2) = f_r2;
903 1.1 christos FLD (i_disp16) = f_disp16;
904 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
905 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
906 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beq", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "disp16 0x%x", 'x', f_disp16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
907 1.1 christos
908 1.1 christos #if WITH_PROFILE_MODEL_P
909 1.1 christos /* Record the fields for profiling. */
910 1.1 christos if (PROFILE_MODEL_P (current_cpu))
911 1.1 christos {
912 1.1 christos FLD (in_src1) = f_r1;
913 1.1 christos FLD (in_src2) = f_r2;
914 1.1 christos }
915 1.1 christos #endif
916 1.1 christos #undef FLD
917 1.1 christos return idesc;
918 1.1 christos }
919 1.1 christos
920 1.1 christos extract_sfmt_beqz:
921 1.1 christos {
922 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
923 1.1 christos CGEN_INSN_WORD insn = entire_insn;
924 1.1 christos #define FLD(f) abuf->fields.sfmt_beq.f
925 1.1 christos UINT f_r2;
926 1.1 christos SI f_disp16;
927 1.1 christos
928 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
929 1.1 christos f_disp16 = ((((EXTRACT_MSB0_SINT (insn, 32, 16, 16)) << (2))) + (pc));
930 1.1 christos
931 1.1 christos /* Record the fields for the semantic handler. */
932 1.1 christos FLD (f_r2) = f_r2;
933 1.1 christos FLD (i_disp16) = f_disp16;
934 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
935 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beqz", "f_r2 0x%x", 'x', f_r2, "disp16 0x%x", 'x', f_disp16, "src2 0x%x", 'x', f_r2, (char *) 0));
936 1.1 christos
937 1.1 christos #if WITH_PROFILE_MODEL_P
938 1.1 christos /* Record the fields for profiling. */
939 1.1 christos if (PROFILE_MODEL_P (current_cpu))
940 1.1 christos {
941 1.1 christos FLD (in_src2) = f_r2;
942 1.1 christos }
943 1.1 christos #endif
944 1.1 christos #undef FLD
945 1.1 christos return idesc;
946 1.1 christos }
947 1.1 christos
948 1.1 christos extract_sfmt_bl8:
949 1.1 christos {
950 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
951 1.1 christos CGEN_INSN_WORD insn = entire_insn;
952 1.1 christos #define FLD(f) abuf->fields.sfmt_bl8.f
953 1.1 christos SI f_disp8;
954 1.1 christos
955 1.1 christos f_disp8 = ((((EXTRACT_MSB0_SINT (insn, 16, 8, 8)) << (2))) + (((pc) & (-4))));
956 1.1 christos
957 1.1 christos /* Record the fields for the semantic handler. */
958 1.1 christos FLD (i_disp8) = f_disp8;
959 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bl8", "disp8 0x%x", 'x', f_disp8, (char *) 0));
960 1.1 christos
961 1.1 christos #if WITH_PROFILE_MODEL_P
962 1.1 christos /* Record the fields for profiling. */
963 1.1 christos if (PROFILE_MODEL_P (current_cpu))
964 1.1 christos {
965 1.1 christos FLD (out_h_gr_SI_14) = 14;
966 1.1 christos }
967 1.1 christos #endif
968 1.1 christos #undef FLD
969 1.1 christos return idesc;
970 1.1 christos }
971 1.1 christos
972 1.1 christos extract_sfmt_bl24:
973 1.1 christos {
974 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
975 1.1 christos CGEN_INSN_WORD insn = entire_insn;
976 1.1 christos #define FLD(f) abuf->fields.sfmt_bl24.f
977 1.1 christos SI f_disp24;
978 1.1 christos
979 1.1 christos f_disp24 = ((((EXTRACT_MSB0_SINT (insn, 32, 8, 24)) << (2))) + (pc));
980 1.1 christos
981 1.1 christos /* Record the fields for the semantic handler. */
982 1.1 christos FLD (i_disp24) = f_disp24;
983 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bl24", "disp24 0x%x", 'x', f_disp24, (char *) 0));
984 1.1 christos
985 1.1 christos #if WITH_PROFILE_MODEL_P
986 1.1 christos /* Record the fields for profiling. */
987 1.1 christos if (PROFILE_MODEL_P (current_cpu))
988 1.1 christos {
989 1.1 christos FLD (out_h_gr_SI_14) = 14;
990 1.1 christos }
991 1.1 christos #endif
992 1.1 christos #undef FLD
993 1.1 christos return idesc;
994 1.1 christos }
995 1.1 christos
996 1.1 christos extract_sfmt_bra8:
997 1.1 christos {
998 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
999 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1000 1.1 christos #define FLD(f) abuf->fields.sfmt_bl8.f
1001 1.1 christos SI f_disp8;
1002 1.1 christos
1003 1.1 christos f_disp8 = ((((EXTRACT_MSB0_SINT (insn, 16, 8, 8)) << (2))) + (((pc) & (-4))));
1004 1.1 christos
1005 1.1 christos /* Record the fields for the semantic handler. */
1006 1.1 christos FLD (i_disp8) = f_disp8;
1007 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bra8", "disp8 0x%x", 'x', f_disp8, (char *) 0));
1008 1.1 christos
1009 1.1 christos #if WITH_PROFILE_MODEL_P
1010 1.1 christos /* Record the fields for profiling. */
1011 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1012 1.1 christos {
1013 1.1 christos }
1014 1.1 christos #endif
1015 1.1 christos #undef FLD
1016 1.1 christos return idesc;
1017 1.1 christos }
1018 1.1 christos
1019 1.1 christos extract_sfmt_bra24:
1020 1.1 christos {
1021 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1022 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1023 1.1 christos #define FLD(f) abuf->fields.sfmt_bl24.f
1024 1.1 christos SI f_disp24;
1025 1.1 christos
1026 1.1 christos f_disp24 = ((((EXTRACT_MSB0_SINT (insn, 32, 8, 24)) << (2))) + (pc));
1027 1.1 christos
1028 1.1 christos /* Record the fields for the semantic handler. */
1029 1.1 christos FLD (i_disp24) = f_disp24;
1030 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bra24", "disp24 0x%x", 'x', f_disp24, (char *) 0));
1031 1.1 christos
1032 1.1 christos #if WITH_PROFILE_MODEL_P
1033 1.1 christos /* Record the fields for profiling. */
1034 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1035 1.1 christos {
1036 1.1 christos }
1037 1.1 christos #endif
1038 1.1 christos #undef FLD
1039 1.1 christos return idesc;
1040 1.1 christos }
1041 1.1 christos
1042 1.1 christos extract_sfmt_cmp:
1043 1.1 christos {
1044 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1045 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1046 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
1047 1.1 christos UINT f_r1;
1048 1.1 christos UINT f_r2;
1049 1.1 christos
1050 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1051 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1052 1.1 christos
1053 1.1 christos /* Record the fields for the semantic handler. */
1054 1.1 christos FLD (f_r1) = f_r1;
1055 1.1 christos FLD (f_r2) = f_r2;
1056 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1057 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1058 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1059 1.1 christos
1060 1.1 christos #if WITH_PROFILE_MODEL_P
1061 1.1 christos /* Record the fields for profiling. */
1062 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1063 1.1 christos {
1064 1.1 christos FLD (in_src1) = f_r1;
1065 1.1 christos FLD (in_src2) = f_r2;
1066 1.1 christos }
1067 1.1 christos #endif
1068 1.1 christos #undef FLD
1069 1.1 christos return idesc;
1070 1.1 christos }
1071 1.1 christos
1072 1.1 christos extract_sfmt_cmpi:
1073 1.1 christos {
1074 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1075 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1076 1.1 christos #define FLD(f) abuf->fields.sfmt_st_d.f
1077 1.1 christos UINT f_r2;
1078 1.1 christos INT f_simm16;
1079 1.1 christos
1080 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1081 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1082 1.1 christos
1083 1.1 christos /* Record the fields for the semantic handler. */
1084 1.1 christos FLD (f_simm16) = f_simm16;
1085 1.1 christos FLD (f_r2) = f_r2;
1086 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1087 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpi", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "src2 0x%x", 'x', f_r2, (char *) 0));
1088 1.1 christos
1089 1.1 christos #if WITH_PROFILE_MODEL_P
1090 1.1 christos /* Record the fields for profiling. */
1091 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1092 1.1 christos {
1093 1.1 christos FLD (in_src2) = f_r2;
1094 1.1 christos }
1095 1.1 christos #endif
1096 1.1 christos #undef FLD
1097 1.1 christos return idesc;
1098 1.1 christos }
1099 1.1 christos
1100 1.1 christos extract_sfmt_div:
1101 1.1 christos {
1102 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1103 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1104 1.1 christos #define FLD(f) abuf->fields.sfmt_add.f
1105 1.1 christos UINT f_r1;
1106 1.1 christos UINT f_r2;
1107 1.1 christos
1108 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1109 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1110 1.1 christos
1111 1.1 christos /* Record the fields for the semantic handler. */
1112 1.1 christos FLD (f_r1) = f_r1;
1113 1.1 christos FLD (f_r2) = f_r2;
1114 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1115 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1116 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
1117 1.1 christos
1118 1.1 christos #if WITH_PROFILE_MODEL_P
1119 1.1 christos /* Record the fields for profiling. */
1120 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1121 1.1 christos {
1122 1.1 christos FLD (in_dr) = f_r1;
1123 1.1 christos FLD (in_sr) = f_r2;
1124 1.1 christos FLD (out_dr) = f_r1;
1125 1.1 christos }
1126 1.1 christos #endif
1127 1.1 christos #undef FLD
1128 1.1 christos return idesc;
1129 1.1 christos }
1130 1.1 christos
1131 1.1 christos extract_sfmt_jl:
1132 1.1 christos {
1133 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1134 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1135 1.1 christos #define FLD(f) abuf->fields.sfmt_jl.f
1136 1.1 christos UINT f_r2;
1137 1.1 christos
1138 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1139 1.1 christos
1140 1.1 christos /* Record the fields for the semantic handler. */
1141 1.1 christos FLD (f_r2) = f_r2;
1142 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1143 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jl", "f_r2 0x%x", 'x', f_r2, "sr 0x%x", 'x', f_r2, (char *) 0));
1144 1.1 christos
1145 1.1 christos #if WITH_PROFILE_MODEL_P
1146 1.1 christos /* Record the fields for profiling. */
1147 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1148 1.1 christos {
1149 1.1 christos FLD (in_sr) = f_r2;
1150 1.1 christos FLD (out_h_gr_SI_14) = 14;
1151 1.1 christos }
1152 1.1 christos #endif
1153 1.1 christos #undef FLD
1154 1.1 christos return idesc;
1155 1.1 christos }
1156 1.1 christos
1157 1.1 christos extract_sfmt_jmp:
1158 1.1 christos {
1159 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1160 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1161 1.1 christos #define FLD(f) abuf->fields.sfmt_jl.f
1162 1.1 christos UINT f_r2;
1163 1.1 christos
1164 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1165 1.1 christos
1166 1.1 christos /* Record the fields for the semantic handler. */
1167 1.1 christos FLD (f_r2) = f_r2;
1168 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1169 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jmp", "f_r2 0x%x", 'x', f_r2, "sr 0x%x", 'x', f_r2, (char *) 0));
1170 1.1 christos
1171 1.1 christos #if WITH_PROFILE_MODEL_P
1172 1.1 christos /* Record the fields for profiling. */
1173 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1174 1.1 christos {
1175 1.1 christos FLD (in_sr) = f_r2;
1176 1.1 christos }
1177 1.1 christos #endif
1178 1.1 christos #undef FLD
1179 1.1 christos return idesc;
1180 1.1 christos }
1181 1.1 christos
1182 1.1 christos extract_sfmt_ld:
1183 1.1 christos {
1184 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1185 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1186 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1187 1.1 christos UINT f_r1;
1188 1.1 christos UINT f_r2;
1189 1.1 christos
1190 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1191 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1192 1.1 christos
1193 1.1 christos /* Record the fields for the semantic handler. */
1194 1.1 christos FLD (f_r2) = f_r2;
1195 1.1 christos FLD (f_r1) = f_r1;
1196 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1197 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1198 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1199 1.1 christos
1200 1.1 christos #if WITH_PROFILE_MODEL_P
1201 1.1 christos /* Record the fields for profiling. */
1202 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1203 1.1 christos {
1204 1.1 christos FLD (in_sr) = f_r2;
1205 1.1 christos FLD (out_dr) = f_r1;
1206 1.1 christos }
1207 1.1 christos #endif
1208 1.1 christos #undef FLD
1209 1.1 christos return idesc;
1210 1.1 christos }
1211 1.1 christos
1212 1.1 christos extract_sfmt_ld_d:
1213 1.1 christos {
1214 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1215 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1216 1.1 christos #define FLD(f) abuf->fields.sfmt_add3.f
1217 1.1 christos UINT f_r1;
1218 1.1 christos UINT f_r2;
1219 1.1 christos INT f_simm16;
1220 1.1 christos
1221 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1222 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1223 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1224 1.1 christos
1225 1.1 christos /* Record the fields for the semantic handler. */
1226 1.1 christos FLD (f_simm16) = f_simm16;
1227 1.1 christos FLD (f_r2) = f_r2;
1228 1.1 christos FLD (f_r1) = f_r1;
1229 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1230 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1231 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_d", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1232 1.1 christos
1233 1.1 christos #if WITH_PROFILE_MODEL_P
1234 1.1 christos /* Record the fields for profiling. */
1235 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1236 1.1 christos {
1237 1.1 christos FLD (in_sr) = f_r2;
1238 1.1 christos FLD (out_dr) = f_r1;
1239 1.1 christos }
1240 1.1 christos #endif
1241 1.1 christos #undef FLD
1242 1.1 christos return idesc;
1243 1.1 christos }
1244 1.1 christos
1245 1.1 christos extract_sfmt_ldb:
1246 1.1 christos {
1247 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1248 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1249 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1250 1.1 christos UINT f_r1;
1251 1.1 christos UINT f_r2;
1252 1.1 christos
1253 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1254 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1255 1.1 christos
1256 1.1 christos /* Record the fields for the semantic handler. */
1257 1.1 christos FLD (f_r2) = f_r2;
1258 1.1 christos FLD (f_r1) = f_r1;
1259 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1260 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1261 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldb", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1262 1.1 christos
1263 1.1 christos #if WITH_PROFILE_MODEL_P
1264 1.1 christos /* Record the fields for profiling. */
1265 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1266 1.1 christos {
1267 1.1 christos FLD (in_sr) = f_r2;
1268 1.1 christos FLD (out_dr) = f_r1;
1269 1.1 christos }
1270 1.1 christos #endif
1271 1.1 christos #undef FLD
1272 1.1 christos return idesc;
1273 1.1 christos }
1274 1.1 christos
1275 1.1 christos extract_sfmt_ldb_d:
1276 1.1 christos {
1277 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1278 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1279 1.1 christos #define FLD(f) abuf->fields.sfmt_add3.f
1280 1.1 christos UINT f_r1;
1281 1.1 christos UINT f_r2;
1282 1.1 christos INT f_simm16;
1283 1.1 christos
1284 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1285 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1286 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1287 1.1 christos
1288 1.1 christos /* Record the fields for the semantic handler. */
1289 1.1 christos FLD (f_simm16) = f_simm16;
1290 1.1 christos FLD (f_r2) = f_r2;
1291 1.1 christos FLD (f_r1) = f_r1;
1292 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1293 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1294 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldb_d", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1295 1.1 christos
1296 1.1 christos #if WITH_PROFILE_MODEL_P
1297 1.1 christos /* Record the fields for profiling. */
1298 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1299 1.1 christos {
1300 1.1 christos FLD (in_sr) = f_r2;
1301 1.1 christos FLD (out_dr) = f_r1;
1302 1.1 christos }
1303 1.1 christos #endif
1304 1.1 christos #undef FLD
1305 1.1 christos return idesc;
1306 1.1 christos }
1307 1.1 christos
1308 1.1 christos extract_sfmt_ldh:
1309 1.1 christos {
1310 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1311 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1312 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1313 1.1 christos UINT f_r1;
1314 1.1 christos UINT f_r2;
1315 1.1 christos
1316 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1317 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1318 1.1 christos
1319 1.1 christos /* Record the fields for the semantic handler. */
1320 1.1 christos FLD (f_r2) = f_r2;
1321 1.1 christos FLD (f_r1) = f_r1;
1322 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1323 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1324 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldh", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1325 1.1 christos
1326 1.1 christos #if WITH_PROFILE_MODEL_P
1327 1.1 christos /* Record the fields for profiling. */
1328 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1329 1.1 christos {
1330 1.1 christos FLD (in_sr) = f_r2;
1331 1.1 christos FLD (out_dr) = f_r1;
1332 1.1 christos }
1333 1.1 christos #endif
1334 1.1 christos #undef FLD
1335 1.1 christos return idesc;
1336 1.1 christos }
1337 1.1 christos
1338 1.1 christos extract_sfmt_ldh_d:
1339 1.1 christos {
1340 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1341 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1342 1.1 christos #define FLD(f) abuf->fields.sfmt_add3.f
1343 1.1 christos UINT f_r1;
1344 1.1 christos UINT f_r2;
1345 1.1 christos INT f_simm16;
1346 1.1 christos
1347 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1348 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1349 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1350 1.1 christos
1351 1.1 christos /* Record the fields for the semantic handler. */
1352 1.1 christos FLD (f_simm16) = f_simm16;
1353 1.1 christos FLD (f_r2) = f_r2;
1354 1.1 christos FLD (f_r1) = f_r1;
1355 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1356 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1357 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldh_d", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1358 1.1 christos
1359 1.1 christos #if WITH_PROFILE_MODEL_P
1360 1.1 christos /* Record the fields for profiling. */
1361 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1362 1.1 christos {
1363 1.1 christos FLD (in_sr) = f_r2;
1364 1.1 christos FLD (out_dr) = f_r1;
1365 1.1 christos }
1366 1.1 christos #endif
1367 1.1 christos #undef FLD
1368 1.1 christos return idesc;
1369 1.1 christos }
1370 1.1 christos
1371 1.1 christos extract_sfmt_ld_plus:
1372 1.1 christos {
1373 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1374 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1375 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1376 1.1 christos UINT f_r1;
1377 1.1 christos UINT f_r2;
1378 1.1 christos
1379 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1380 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1381 1.1 christos
1382 1.1 christos /* Record the fields for the semantic handler. */
1383 1.1 christos FLD (f_r2) = f_r2;
1384 1.1 christos FLD (f_r1) = f_r1;
1385 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1386 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1387 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_plus", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1388 1.1 christos
1389 1.1 christos #if WITH_PROFILE_MODEL_P
1390 1.1 christos /* Record the fields for profiling. */
1391 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1392 1.1 christos {
1393 1.1 christos FLD (in_sr) = f_r2;
1394 1.1 christos FLD (out_dr) = f_r1;
1395 1.1 christos FLD (out_sr) = f_r2;
1396 1.1 christos }
1397 1.1 christos #endif
1398 1.1 christos #undef FLD
1399 1.1 christos return idesc;
1400 1.1 christos }
1401 1.1 christos
1402 1.1 christos extract_sfmt_ld24:
1403 1.1 christos {
1404 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1405 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1406 1.1 christos #define FLD(f) abuf->fields.sfmt_ld24.f
1407 1.1 christos UINT f_r1;
1408 1.1 christos UINT f_uimm24;
1409 1.1 christos
1410 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1411 1.1 christos f_uimm24 = EXTRACT_MSB0_UINT (insn, 32, 8, 24);
1412 1.1 christos
1413 1.1 christos /* Record the fields for the semantic handler. */
1414 1.1 christos FLD (f_r1) = f_r1;
1415 1.1 christos FLD (i_uimm24) = f_uimm24;
1416 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1417 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld24", "f_r1 0x%x", 'x', f_r1, "uimm24 0x%x", 'x', f_uimm24, "dr 0x%x", 'x', f_r1, (char *) 0));
1418 1.1 christos
1419 1.1 christos #if WITH_PROFILE_MODEL_P
1420 1.1 christos /* Record the fields for profiling. */
1421 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1422 1.1 christos {
1423 1.1 christos FLD (out_dr) = f_r1;
1424 1.1 christos }
1425 1.1 christos #endif
1426 1.1 christos #undef FLD
1427 1.1 christos return idesc;
1428 1.1 christos }
1429 1.1 christos
1430 1.1 christos extract_sfmt_ldi8:
1431 1.1 christos {
1432 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1433 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1434 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f
1435 1.1 christos UINT f_r1;
1436 1.1 christos INT f_simm8;
1437 1.1 christos
1438 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1439 1.1 christos f_simm8 = EXTRACT_MSB0_SINT (insn, 16, 8, 8);
1440 1.1 christos
1441 1.1 christos /* Record the fields for the semantic handler. */
1442 1.1 christos FLD (f_simm8) = f_simm8;
1443 1.1 christos FLD (f_r1) = f_r1;
1444 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1445 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi8", "f_simm8 0x%x", 'x', f_simm8, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
1446 1.1 christos
1447 1.1 christos #if WITH_PROFILE_MODEL_P
1448 1.1 christos /* Record the fields for profiling. */
1449 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1450 1.1 christos {
1451 1.1 christos FLD (out_dr) = f_r1;
1452 1.1 christos }
1453 1.1 christos #endif
1454 1.1 christos #undef FLD
1455 1.1 christos return idesc;
1456 1.1 christos }
1457 1.1 christos
1458 1.1 christos extract_sfmt_ldi16:
1459 1.1 christos {
1460 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1461 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1462 1.1 christos #define FLD(f) abuf->fields.sfmt_add3.f
1463 1.1 christos UINT f_r1;
1464 1.1 christos INT f_simm16;
1465 1.1 christos
1466 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1467 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1468 1.1 christos
1469 1.1 christos /* Record the fields for the semantic handler. */
1470 1.1 christos FLD (f_simm16) = f_simm16;
1471 1.1 christos FLD (f_r1) = f_r1;
1472 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1473 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi16", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
1474 1.1 christos
1475 1.1 christos #if WITH_PROFILE_MODEL_P
1476 1.1 christos /* Record the fields for profiling. */
1477 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1478 1.1 christos {
1479 1.1 christos FLD (out_dr) = f_r1;
1480 1.1 christos }
1481 1.1 christos #endif
1482 1.1 christos #undef FLD
1483 1.1 christos return idesc;
1484 1.1 christos }
1485 1.1 christos
1486 1.1 christos extract_sfmt_lock:
1487 1.1 christos {
1488 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1489 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1490 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1491 1.1 christos UINT f_r1;
1492 1.1 christos UINT f_r2;
1493 1.1 christos
1494 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1495 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1496 1.1 christos
1497 1.1 christos /* Record the fields for the semantic handler. */
1498 1.1 christos FLD (f_r2) = f_r2;
1499 1.1 christos FLD (f_r1) = f_r1;
1500 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1501 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1502 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lock", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1503 1.1 christos
1504 1.1 christos #if WITH_PROFILE_MODEL_P
1505 1.1 christos /* Record the fields for profiling. */
1506 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1507 1.1 christos {
1508 1.1 christos FLD (in_sr) = f_r2;
1509 1.1 christos FLD (out_dr) = f_r1;
1510 1.1 christos }
1511 1.1 christos #endif
1512 1.1 christos #undef FLD
1513 1.1 christos return idesc;
1514 1.1 christos }
1515 1.1 christos
1516 1.1 christos extract_sfmt_machi:
1517 1.1 christos {
1518 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1519 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1520 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
1521 1.1 christos UINT f_r1;
1522 1.1 christos UINT f_r2;
1523 1.1 christos
1524 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1525 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1526 1.1 christos
1527 1.1 christos /* Record the fields for the semantic handler. */
1528 1.1 christos FLD (f_r1) = f_r1;
1529 1.1 christos FLD (f_r2) = f_r2;
1530 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1531 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1532 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_machi", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1533 1.1 christos
1534 1.1 christos #if WITH_PROFILE_MODEL_P
1535 1.1 christos /* Record the fields for profiling. */
1536 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1537 1.1 christos {
1538 1.1 christos FLD (in_src1) = f_r1;
1539 1.1 christos FLD (in_src2) = f_r2;
1540 1.1 christos }
1541 1.1 christos #endif
1542 1.1 christos #undef FLD
1543 1.1 christos return idesc;
1544 1.1 christos }
1545 1.1 christos
1546 1.1 christos extract_sfmt_mulhi:
1547 1.1 christos {
1548 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1549 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1550 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
1551 1.1 christos UINT f_r1;
1552 1.1 christos UINT f_r2;
1553 1.1 christos
1554 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1555 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1556 1.1 christos
1557 1.1 christos /* Record the fields for the semantic handler. */
1558 1.1 christos FLD (f_r1) = f_r1;
1559 1.1 christos FLD (f_r2) = f_r2;
1560 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1561 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1562 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulhi", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1563 1.1 christos
1564 1.1 christos #if WITH_PROFILE_MODEL_P
1565 1.1 christos /* Record the fields for profiling. */
1566 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1567 1.1 christos {
1568 1.1 christos FLD (in_src1) = f_r1;
1569 1.1 christos FLD (in_src2) = f_r2;
1570 1.1 christos }
1571 1.1 christos #endif
1572 1.1 christos #undef FLD
1573 1.1 christos return idesc;
1574 1.1 christos }
1575 1.1 christos
1576 1.1 christos extract_sfmt_mv:
1577 1.1 christos {
1578 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1579 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1580 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1581 1.1 christos UINT f_r1;
1582 1.1 christos UINT f_r2;
1583 1.1 christos
1584 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1585 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1586 1.1 christos
1587 1.1 christos /* Record the fields for the semantic handler. */
1588 1.1 christos FLD (f_r2) = f_r2;
1589 1.1 christos FLD (f_r1) = f_r1;
1590 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1591 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1592 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mv", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1593 1.1 christos
1594 1.1 christos #if WITH_PROFILE_MODEL_P
1595 1.1 christos /* Record the fields for profiling. */
1596 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1597 1.1 christos {
1598 1.1 christos FLD (in_sr) = f_r2;
1599 1.1 christos FLD (out_dr) = f_r1;
1600 1.1 christos }
1601 1.1 christos #endif
1602 1.1 christos #undef FLD
1603 1.1 christos return idesc;
1604 1.1 christos }
1605 1.1 christos
1606 1.1 christos extract_sfmt_mvfachi:
1607 1.1 christos {
1608 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1609 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1610 1.1 christos #define FLD(f) abuf->fields.sfmt_seth.f
1611 1.1 christos UINT f_r1;
1612 1.1 christos
1613 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1614 1.1 christos
1615 1.1 christos /* Record the fields for the semantic handler. */
1616 1.1 christos FLD (f_r1) = f_r1;
1617 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1618 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfachi", "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
1619 1.1 christos
1620 1.1 christos #if WITH_PROFILE_MODEL_P
1621 1.1 christos /* Record the fields for profiling. */
1622 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1623 1.1 christos {
1624 1.1 christos FLD (out_dr) = f_r1;
1625 1.1 christos }
1626 1.1 christos #endif
1627 1.1 christos #undef FLD
1628 1.1 christos return idesc;
1629 1.1 christos }
1630 1.1 christos
1631 1.1 christos extract_sfmt_mvfc:
1632 1.1 christos {
1633 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1634 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1635 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1636 1.1 christos UINT f_r1;
1637 1.1 christos UINT f_r2;
1638 1.1 christos
1639 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1640 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1641 1.1 christos
1642 1.1 christos /* Record the fields for the semantic handler. */
1643 1.1 christos FLD (f_r2) = f_r2;
1644 1.1 christos FLD (f_r1) = f_r1;
1645 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1646 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfc", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
1647 1.1 christos
1648 1.1 christos #if WITH_PROFILE_MODEL_P
1649 1.1 christos /* Record the fields for profiling. */
1650 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1651 1.1 christos {
1652 1.1 christos FLD (out_dr) = f_r1;
1653 1.1 christos }
1654 1.1 christos #endif
1655 1.1 christos #undef FLD
1656 1.1 christos return idesc;
1657 1.1 christos }
1658 1.1 christos
1659 1.1 christos extract_sfmt_mvtachi:
1660 1.1 christos {
1661 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1662 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1663 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
1664 1.1 christos UINT f_r1;
1665 1.1 christos
1666 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1667 1.1 christos
1668 1.1 christos /* Record the fields for the semantic handler. */
1669 1.1 christos FLD (f_r1) = f_r1;
1670 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1671 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtachi", "f_r1 0x%x", 'x', f_r1, "src1 0x%x", 'x', f_r1, (char *) 0));
1672 1.1 christos
1673 1.1 christos #if WITH_PROFILE_MODEL_P
1674 1.1 christos /* Record the fields for profiling. */
1675 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1676 1.1 christos {
1677 1.1 christos FLD (in_src1) = f_r1;
1678 1.1 christos }
1679 1.1 christos #endif
1680 1.1 christos #undef FLD
1681 1.1 christos return idesc;
1682 1.1 christos }
1683 1.1 christos
1684 1.1 christos extract_sfmt_mvtc:
1685 1.1 christos {
1686 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1687 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1688 1.1 christos #define FLD(f) abuf->fields.sfmt_ld_plus.f
1689 1.1 christos UINT f_r1;
1690 1.1 christos UINT f_r2;
1691 1.1 christos
1692 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1693 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1694 1.1 christos
1695 1.1 christos /* Record the fields for the semantic handler. */
1696 1.1 christos FLD (f_r2) = f_r2;
1697 1.1 christos FLD (f_r1) = f_r1;
1698 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1699 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtc", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
1700 1.1 christos
1701 1.1 christos #if WITH_PROFILE_MODEL_P
1702 1.1 christos /* Record the fields for profiling. */
1703 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1704 1.1 christos {
1705 1.1 christos FLD (in_sr) = f_r2;
1706 1.1 christos }
1707 1.1 christos #endif
1708 1.1 christos #undef FLD
1709 1.1 christos return idesc;
1710 1.1 christos }
1711 1.1 christos
1712 1.1 christos extract_sfmt_nop:
1713 1.1 christos {
1714 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1715 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f
1716 1.1 christos
1717 1.1 christos
1718 1.1 christos /* Record the fields for the semantic handler. */
1719 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_nop", (char *) 0));
1720 1.1 christos
1721 1.1 christos #undef FLD
1722 1.1 christos return idesc;
1723 1.1 christos }
1724 1.1 christos
1725 1.1 christos extract_sfmt_rac:
1726 1.1 christos {
1727 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1728 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f
1729 1.1 christos
1730 1.1 christos
1731 1.1 christos /* Record the fields for the semantic handler. */
1732 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_rac", (char *) 0));
1733 1.1 christos
1734 1.1 christos #undef FLD
1735 1.1 christos return idesc;
1736 1.1 christos }
1737 1.1 christos
1738 1.1 christos extract_sfmt_rte:
1739 1.1 christos {
1740 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1741 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f
1742 1.1 christos
1743 1.1 christos
1744 1.1 christos /* Record the fields for the semantic handler. */
1745 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_rte", (char *) 0));
1746 1.1 christos
1747 1.1 christos #if WITH_PROFILE_MODEL_P
1748 1.1 christos /* Record the fields for profiling. */
1749 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1750 1.1 christos {
1751 1.1 christos }
1752 1.1 christos #endif
1753 1.1 christos #undef FLD
1754 1.1 christos return idesc;
1755 1.1 christos }
1756 1.1 christos
1757 1.1 christos extract_sfmt_seth:
1758 1.1 christos {
1759 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1760 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1761 1.1 christos #define FLD(f) abuf->fields.sfmt_seth.f
1762 1.1 christos UINT f_r1;
1763 1.1 christos UINT f_hi16;
1764 1.1 christos
1765 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1766 1.1 christos f_hi16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
1767 1.1 christos
1768 1.1 christos /* Record the fields for the semantic handler. */
1769 1.1 christos FLD (f_hi16) = f_hi16;
1770 1.1 christos FLD (f_r1) = f_r1;
1771 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1772 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_seth", "f_hi16 0x%x", 'x', f_hi16, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
1773 1.1 christos
1774 1.1 christos #if WITH_PROFILE_MODEL_P
1775 1.1 christos /* Record the fields for profiling. */
1776 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1777 1.1 christos {
1778 1.1 christos FLD (out_dr) = f_r1;
1779 1.1 christos }
1780 1.1 christos #endif
1781 1.1 christos #undef FLD
1782 1.1 christos return idesc;
1783 1.1 christos }
1784 1.1 christos
1785 1.1 christos extract_sfmt_sll3:
1786 1.1 christos {
1787 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1788 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1789 1.1 christos #define FLD(f) abuf->fields.sfmt_add3.f
1790 1.1 christos UINT f_r1;
1791 1.1 christos UINT f_r2;
1792 1.1 christos INT f_simm16;
1793 1.1 christos
1794 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1795 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1796 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1797 1.1 christos
1798 1.1 christos /* Record the fields for the semantic handler. */
1799 1.1 christos FLD (f_simm16) = f_simm16;
1800 1.1 christos FLD (f_r2) = f_r2;
1801 1.1 christos FLD (f_r1) = f_r1;
1802 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
1803 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1804 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sll3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
1805 1.1 christos
1806 1.1 christos #if WITH_PROFILE_MODEL_P
1807 1.1 christos /* Record the fields for profiling. */
1808 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1809 1.1 christos {
1810 1.1 christos FLD (in_sr) = f_r2;
1811 1.1 christos FLD (out_dr) = f_r1;
1812 1.1 christos }
1813 1.1 christos #endif
1814 1.1 christos #undef FLD
1815 1.1 christos return idesc;
1816 1.1 christos }
1817 1.1 christos
1818 1.1 christos extract_sfmt_slli:
1819 1.1 christos {
1820 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1821 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1822 1.1 christos #define FLD(f) abuf->fields.sfmt_slli.f
1823 1.1 christos UINT f_r1;
1824 1.1 christos UINT f_uimm5;
1825 1.1 christos
1826 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1827 1.1 christos f_uimm5 = EXTRACT_MSB0_UINT (insn, 16, 11, 5);
1828 1.1 christos
1829 1.1 christos /* Record the fields for the semantic handler. */
1830 1.1 christos FLD (f_r1) = f_r1;
1831 1.1 christos FLD (f_uimm5) = f_uimm5;
1832 1.1 christos FLD (i_dr) = & CPU (h_gr)[f_r1];
1833 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_slli", "f_r1 0x%x", 'x', f_r1, "f_uimm5 0x%x", 'x', f_uimm5, "dr 0x%x", 'x', f_r1, (char *) 0));
1834 1.1 christos
1835 1.1 christos #if WITH_PROFILE_MODEL_P
1836 1.1 christos /* Record the fields for profiling. */
1837 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1838 1.1 christos {
1839 1.1 christos FLD (in_dr) = f_r1;
1840 1.1 christos FLD (out_dr) = f_r1;
1841 1.1 christos }
1842 1.1 christos #endif
1843 1.1 christos #undef FLD
1844 1.1 christos return idesc;
1845 1.1 christos }
1846 1.1 christos
1847 1.1 christos extract_sfmt_st:
1848 1.1 christos {
1849 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1850 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1851 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
1852 1.1 christos UINT f_r1;
1853 1.1 christos UINT f_r2;
1854 1.1 christos
1855 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1856 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1857 1.1 christos
1858 1.1 christos /* Record the fields for the semantic handler. */
1859 1.1 christos FLD (f_r1) = f_r1;
1860 1.1 christos FLD (f_r2) = f_r2;
1861 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1862 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1863 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1864 1.1 christos
1865 1.1 christos #if WITH_PROFILE_MODEL_P
1866 1.1 christos /* Record the fields for profiling. */
1867 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1868 1.1 christos {
1869 1.1 christos FLD (in_src1) = f_r1;
1870 1.1 christos FLD (in_src2) = f_r2;
1871 1.1 christos }
1872 1.1 christos #endif
1873 1.1 christos #undef FLD
1874 1.1 christos return idesc;
1875 1.1 christos }
1876 1.1 christos
1877 1.1 christos extract_sfmt_st_d:
1878 1.1 christos {
1879 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1880 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1881 1.1 christos #define FLD(f) abuf->fields.sfmt_st_d.f
1882 1.1 christos UINT f_r1;
1883 1.1 christos UINT f_r2;
1884 1.1 christos INT f_simm16;
1885 1.1 christos
1886 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1887 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1888 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1889 1.1 christos
1890 1.1 christos /* Record the fields for the semantic handler. */
1891 1.1 christos FLD (f_simm16) = f_simm16;
1892 1.1 christos FLD (f_r1) = f_r1;
1893 1.1 christos FLD (f_r2) = f_r2;
1894 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1895 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1896 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1897 1.1 christos
1898 1.1 christos #if WITH_PROFILE_MODEL_P
1899 1.1 christos /* Record the fields for profiling. */
1900 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1901 1.1 christos {
1902 1.1 christos FLD (in_src1) = f_r1;
1903 1.1 christos FLD (in_src2) = f_r2;
1904 1.1 christos }
1905 1.1 christos #endif
1906 1.1 christos #undef FLD
1907 1.1 christos return idesc;
1908 1.1 christos }
1909 1.1 christos
1910 1.1 christos extract_sfmt_stb:
1911 1.1 christos {
1912 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1913 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1914 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
1915 1.1 christos UINT f_r1;
1916 1.1 christos UINT f_r2;
1917 1.1 christos
1918 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1919 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1920 1.1 christos
1921 1.1 christos /* Record the fields for the semantic handler. */
1922 1.1 christos FLD (f_r1) = f_r1;
1923 1.1 christos FLD (f_r2) = f_r2;
1924 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1925 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1926 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1927 1.1 christos
1928 1.1 christos #if WITH_PROFILE_MODEL_P
1929 1.1 christos /* Record the fields for profiling. */
1930 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1931 1.1 christos {
1932 1.1 christos FLD (in_src1) = f_r1;
1933 1.1 christos FLD (in_src2) = f_r2;
1934 1.1 christos }
1935 1.1 christos #endif
1936 1.1 christos #undef FLD
1937 1.1 christos return idesc;
1938 1.1 christos }
1939 1.1 christos
1940 1.1 christos extract_sfmt_stb_d:
1941 1.1 christos {
1942 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1943 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1944 1.1 christos #define FLD(f) abuf->fields.sfmt_st_d.f
1945 1.1 christos UINT f_r1;
1946 1.1 christos UINT f_r2;
1947 1.1 christos INT f_simm16;
1948 1.1 christos
1949 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
1950 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
1951 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
1952 1.1 christos
1953 1.1 christos /* Record the fields for the semantic handler. */
1954 1.1 christos FLD (f_simm16) = f_simm16;
1955 1.1 christos FLD (f_r1) = f_r1;
1956 1.1 christos FLD (f_r2) = f_r2;
1957 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1958 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1959 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1960 1.1 christos
1961 1.1 christos #if WITH_PROFILE_MODEL_P
1962 1.1 christos /* Record the fields for profiling. */
1963 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1964 1.1 christos {
1965 1.1 christos FLD (in_src1) = f_r1;
1966 1.1 christos FLD (in_src2) = f_r2;
1967 1.1 christos }
1968 1.1 christos #endif
1969 1.1 christos #undef FLD
1970 1.1 christos return idesc;
1971 1.1 christos }
1972 1.1 christos
1973 1.1 christos extract_sfmt_sth:
1974 1.1 christos {
1975 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
1976 1.1 christos CGEN_INSN_WORD insn = entire_insn;
1977 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
1978 1.1 christos UINT f_r1;
1979 1.1 christos UINT f_r2;
1980 1.1 christos
1981 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
1982 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
1983 1.1 christos
1984 1.1 christos /* Record the fields for the semantic handler. */
1985 1.1 christos FLD (f_r1) = f_r1;
1986 1.1 christos FLD (f_r2) = f_r2;
1987 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
1988 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
1989 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
1990 1.1 christos
1991 1.1 christos #if WITH_PROFILE_MODEL_P
1992 1.1 christos /* Record the fields for profiling. */
1993 1.1 christos if (PROFILE_MODEL_P (current_cpu))
1994 1.1 christos {
1995 1.1 christos FLD (in_src1) = f_r1;
1996 1.1 christos FLD (in_src2) = f_r2;
1997 1.1 christos }
1998 1.1 christos #endif
1999 1.1 christos #undef FLD
2000 1.1 christos return idesc;
2001 1.1 christos }
2002 1.1 christos
2003 1.1 christos extract_sfmt_sth_d:
2004 1.1 christos {
2005 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2006 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2007 1.1 christos #define FLD(f) abuf->fields.sfmt_st_d.f
2008 1.1 christos UINT f_r1;
2009 1.1 christos UINT f_r2;
2010 1.1 christos INT f_simm16;
2011 1.1 christos
2012 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4);
2013 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
2014 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
2015 1.1 christos
2016 1.1 christos /* Record the fields for the semantic handler. */
2017 1.1 christos FLD (f_simm16) = f_simm16;
2018 1.1 christos FLD (f_r1) = f_r1;
2019 1.1 christos FLD (f_r2) = f_r2;
2020 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
2021 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
2022 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
2023 1.1 christos
2024 1.1 christos #if WITH_PROFILE_MODEL_P
2025 1.1 christos /* Record the fields for profiling. */
2026 1.1 christos if (PROFILE_MODEL_P (current_cpu))
2027 1.1 christos {
2028 1.1 christos FLD (in_src1) = f_r1;
2029 1.1 christos FLD (in_src2) = f_r2;
2030 1.1 christos }
2031 1.1 christos #endif
2032 1.1 christos #undef FLD
2033 1.1 christos return idesc;
2034 1.1 christos }
2035 1.1 christos
2036 1.1 christos extract_sfmt_st_plus:
2037 1.1 christos {
2038 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2039 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2040 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
2041 1.1 christos UINT f_r1;
2042 1.1 christos UINT f_r2;
2043 1.1 christos
2044 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
2045 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
2046 1.1 christos
2047 1.1 christos /* Record the fields for the semantic handler. */
2048 1.1 christos FLD (f_r1) = f_r1;
2049 1.1 christos FLD (f_r2) = f_r2;
2050 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
2051 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
2052 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_plus", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
2053 1.1 christos
2054 1.1 christos #if WITH_PROFILE_MODEL_P
2055 1.1 christos /* Record the fields for profiling. */
2056 1.1 christos if (PROFILE_MODEL_P (current_cpu))
2057 1.1 christos {
2058 1.1 christos FLD (in_src1) = f_r1;
2059 1.1 christos FLD (in_src2) = f_r2;
2060 1.1 christos FLD (out_src2) = f_r2;
2061 1.1 christos }
2062 1.1 christos #endif
2063 1.1 christos #undef FLD
2064 1.1 christos return idesc;
2065 1.1 christos }
2066 1.1 christos
2067 1.1 christos extract_sfmt_trap:
2068 1.1 christos {
2069 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2070 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2071 1.1 christos #define FLD(f) abuf->fields.sfmt_trap.f
2072 1.1 christos UINT f_uimm4;
2073 1.1 christos
2074 1.1 christos f_uimm4 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
2075 1.1 christos
2076 1.1 christos /* Record the fields for the semantic handler. */
2077 1.1 christos FLD (f_uimm4) = f_uimm4;
2078 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_trap", "f_uimm4 0x%x", 'x', f_uimm4, (char *) 0));
2079 1.1 christos
2080 1.1 christos #if WITH_PROFILE_MODEL_P
2081 1.1 christos /* Record the fields for profiling. */
2082 1.1 christos if (PROFILE_MODEL_P (current_cpu))
2083 1.1 christos {
2084 1.1 christos }
2085 1.1 christos #endif
2086 1.1 christos #undef FLD
2087 1.1 christos return idesc;
2088 1.1 christos }
2089 1.1 christos
2090 1.1 christos extract_sfmt_unlock:
2091 1.1 christos {
2092 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2093 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2094 1.1 christos #define FLD(f) abuf->fields.sfmt_st_plus.f
2095 1.1 christos UINT f_r1;
2096 1.1 christos UINT f_r2;
2097 1.1 christos
2098 1.1 christos f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
2099 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
2100 1.1 christos
2101 1.1 christos /* Record the fields for the semantic handler. */
2102 1.1 christos FLD (f_r1) = f_r1;
2103 1.1 christos FLD (f_r2) = f_r2;
2104 1.1 christos FLD (i_src1) = & CPU (h_gr)[f_r1];
2105 1.1 christos FLD (i_src2) = & CPU (h_gr)[f_r2];
2106 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_unlock", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
2107 1.1 christos
2108 1.1 christos #if WITH_PROFILE_MODEL_P
2109 1.1 christos /* Record the fields for profiling. */
2110 1.1 christos if (PROFILE_MODEL_P (current_cpu))
2111 1.1 christos {
2112 1.1 christos FLD (in_src1) = f_r1;
2113 1.1 christos FLD (in_src2) = f_r2;
2114 1.1 christos }
2115 1.1 christos #endif
2116 1.1 christos #undef FLD
2117 1.1 christos return idesc;
2118 1.1 christos }
2119 1.1 christos
2120 1.1 christos extract_sfmt_clrpsw:
2121 1.1 christos {
2122 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2123 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2124 1.1 christos #define FLD(f) abuf->fields.sfmt_clrpsw.f
2125 1.1 christos UINT f_uimm8;
2126 1.1 christos
2127 1.1 christos f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8);
2128 1.1 christos
2129 1.1 christos /* Record the fields for the semantic handler. */
2130 1.1 christos FLD (f_uimm8) = f_uimm8;
2131 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_clrpsw", "f_uimm8 0x%x", 'x', f_uimm8, (char *) 0));
2132 1.1 christos
2133 1.1 christos #undef FLD
2134 1.1 christos return idesc;
2135 1.1 christos }
2136 1.1 christos
2137 1.1 christos extract_sfmt_setpsw:
2138 1.1 christos {
2139 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2140 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2141 1.1 christos #define FLD(f) abuf->fields.sfmt_clrpsw.f
2142 1.1 christos UINT f_uimm8;
2143 1.1 christos
2144 1.1 christos f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8);
2145 1.1 christos
2146 1.1 christos /* Record the fields for the semantic handler. */
2147 1.1 christos FLD (f_uimm8) = f_uimm8;
2148 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_setpsw", "f_uimm8 0x%x", 'x', f_uimm8, (char *) 0));
2149 1.1 christos
2150 1.1 christos #undef FLD
2151 1.1 christos return idesc;
2152 1.1 christos }
2153 1.1 christos
2154 1.1 christos extract_sfmt_bset:
2155 1.1 christos {
2156 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2157 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2158 1.1 christos #define FLD(f) abuf->fields.sfmt_bset.f
2159 1.1 christos UINT f_uimm3;
2160 1.1 christos UINT f_r2;
2161 1.1 christos INT f_simm16;
2162 1.1 christos
2163 1.1 christos f_uimm3 = EXTRACT_MSB0_UINT (insn, 32, 5, 3);
2164 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
2165 1.1 christos f_simm16 = EXTRACT_MSB0_SINT (insn, 32, 16, 16);
2166 1.1 christos
2167 1.1 christos /* Record the fields for the semantic handler. */
2168 1.1 christos FLD (f_simm16) = f_simm16;
2169 1.1 christos FLD (f_r2) = f_r2;
2170 1.1 christos FLD (f_uimm3) = f_uimm3;
2171 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
2172 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bset", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_uimm3 0x%x", 'x', f_uimm3, "sr 0x%x", 'x', f_r2, (char *) 0));
2173 1.1 christos
2174 1.1 christos #if WITH_PROFILE_MODEL_P
2175 1.1 christos /* Record the fields for profiling. */
2176 1.1 christos if (PROFILE_MODEL_P (current_cpu))
2177 1.1 christos {
2178 1.1 christos FLD (in_sr) = f_r2;
2179 1.1 christos }
2180 1.1 christos #endif
2181 1.1 christos #undef FLD
2182 1.1 christos return idesc;
2183 1.1 christos }
2184 1.1 christos
2185 1.1 christos extract_sfmt_btst:
2186 1.1 christos {
2187 1.1 christos const IDESC *idesc = &m32rbf_insn_data[itype];
2188 1.1 christos CGEN_INSN_WORD insn = entire_insn;
2189 1.1 christos #define FLD(f) abuf->fields.sfmt_bset.f
2190 1.1 christos UINT f_uimm3;
2191 1.1 christos UINT f_r2;
2192 1.1 christos
2193 1.1 christos f_uimm3 = EXTRACT_MSB0_UINT (insn, 16, 5, 3);
2194 1.1 christos f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
2195 1.1 christos
2196 1.1 christos /* Record the fields for the semantic handler. */
2197 1.1 christos FLD (f_r2) = f_r2;
2198 1.1 christos FLD (f_uimm3) = f_uimm3;
2199 1.1 christos FLD (i_sr) = & CPU (h_gr)[f_r2];
2200 1.1 christos TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_btst", "f_r2 0x%x", 'x', f_r2, "f_uimm3 0x%x", 'x', f_uimm3, "sr 0x%x", 'x', f_r2, (char *) 0));
2201 1.1 christos
2202 1.1 christos #if WITH_PROFILE_MODEL_P
2203 1.1 christos /* Record the fields for profiling. */
2204 1.1 christos if (PROFILE_MODEL_P (current_cpu))
2205 1.1 christos {
2206 1.1 christos FLD (in_sr) = f_r2;
2207 1.1 christos }
2208 1.1 christos #endif
2209 1.1 christos #undef FLD
2210 1.1 christos return idesc;
2211 1.1 christos }
2212 1.1 christos
2213 1.1 christos }
2214