Commit | Line | Data |
---|---|---|
8e420152 DE |
1 | /* Simulator instruction semantics for m32rx. |
2 | ||
1148b104 | 3 | THIS FILE IS MACHINE GENERATED WITH CGEN. |
b8a9943d | 4 | |
8e420152 DE |
5 | Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. |
6 | ||
7 | This file is part of the GNU Simulators. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 2, or (at your option) | |
12 | any later version. | |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License along | |
20 | with this program; if not, write to the Free Software Foundation, Inc., | |
21 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
22 | ||
23 | */ | |
24 | ||
25 | #define WANT_CPU | |
26 | #define WANT_CPU_M32RX | |
27 | ||
28 | #include "sim-main.h" | |
29 | #include "cgen-mem.h" | |
30 | #include "cgen-ops.h" | |
31 | #include "cpu-sim.h" | |
32 | ||
a8981d67 | 33 | #if ! WITH_SCACHE |
8e420152 DE |
34 | |
35 | #undef GET_ATTR | |
40c680ba DE |
36 | #define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->idesc->opcode, CGEN_INSN_##attr) |
37 | ||
38 | /* add: add $dr,$sr. */ | |
8e420152 | 39 | |
8e420152 | 40 | CIA |
dc4e95ad | 41 | SEM_FN_NAME (m32rx,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 42 | { |
b8a9943d | 43 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 44 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 45 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 46 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 47 | CIA UNUSED pc = PC; |
e0a85af6 DE |
48 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
49 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 50 | |
1148b104 DE |
51 | { |
52 | SI opval = ADDSI (OPRND (dr), OPRND (sr)); | |
53 | CPU (h_gr[f_r1]) = opval; | |
54 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
55 | } | |
b8a9943d | 56 | |
40c680ba DE |
57 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
58 | ||
8e420152 DE |
59 | #if WITH_PROFILE_MODEL_P |
60 | if (PROFILE_MODEL_P (current_cpu)) | |
61 | { | |
62 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
63 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
64 | m32rx_model_profile_insn (current_cpu, abuf); | |
65 | } | |
66 | #endif | |
b8a9943d | 67 | |
8e420152 DE |
68 | return new_pc; |
69 | #undef OPRND | |
8e420152 DE |
70 | } |
71 | ||
40c680ba DE |
72 | /* add3: add3 $dr,$sr,$hash$slo16. */ |
73 | ||
8e420152 | 74 | CIA |
dc4e95ad | 75 | SEM_FN_NAME (m32rx,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 76 | { |
b8a9943d | 77 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 78 | #define OPRND(f) par_exec->operands.fmt_add3.f |
8e420152 | 79 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 80 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 81 | CIA UNUSED pc = PC; |
e0a85af6 DE |
82 | EXTRACT_FMT_ADD3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
83 | EXTRACT_FMT_ADD3_CODE | |
b8a9943d | 84 | |
1148b104 DE |
85 | { |
86 | SI opval = ADDSI (OPRND (sr), OPRND (slo16)); | |
87 | CPU (h_gr[f_r1]) = opval; | |
88 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
89 | } | |
b8a9943d | 90 | |
40c680ba DE |
91 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
92 | ||
8e420152 DE |
93 | #if WITH_PROFILE_MODEL_P |
94 | if (PROFILE_MODEL_P (current_cpu)) | |
95 | { | |
96 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
97 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
98 | m32rx_model_profile_insn (current_cpu, abuf); | |
99 | } | |
100 | #endif | |
b8a9943d | 101 | |
8e420152 DE |
102 | return new_pc; |
103 | #undef OPRND | |
8e420152 DE |
104 | } |
105 | ||
40c680ba DE |
106 | /* and: and $dr,$sr. */ |
107 | ||
8e420152 | 108 | CIA |
dc4e95ad | 109 | SEM_FN_NAME (m32rx,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 110 | { |
b8a9943d | 111 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 112 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 113 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 114 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 115 | CIA UNUSED pc = PC; |
e0a85af6 DE |
116 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
117 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 118 | |
1148b104 DE |
119 | { |
120 | SI opval = ANDSI (OPRND (dr), OPRND (sr)); | |
121 | CPU (h_gr[f_r1]) = opval; | |
122 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
123 | } | |
b8a9943d | 124 | |
40c680ba DE |
125 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
126 | ||
8e420152 DE |
127 | #if WITH_PROFILE_MODEL_P |
128 | if (PROFILE_MODEL_P (current_cpu)) | |
129 | { | |
130 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
131 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
132 | m32rx_model_profile_insn (current_cpu, abuf); | |
133 | } | |
134 | #endif | |
b8a9943d | 135 | |
8e420152 DE |
136 | return new_pc; |
137 | #undef OPRND | |
8e420152 DE |
138 | } |
139 | ||
40c680ba DE |
140 | /* and3: and3 $dr,$sr,$uimm16. */ |
141 | ||
8e420152 | 142 | CIA |
dc4e95ad | 143 | SEM_FN_NAME (m32rx,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 144 | { |
b8a9943d | 145 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 146 | #define OPRND(f) par_exec->operands.fmt_and3.f |
8e420152 | 147 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 148 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 149 | CIA UNUSED pc = PC; |
e0a85af6 DE |
150 | EXTRACT_FMT_AND3_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */ |
151 | EXTRACT_FMT_AND3_CODE | |
b8a9943d | 152 | |
1148b104 DE |
153 | { |
154 | SI opval = ANDSI (OPRND (sr), OPRND (uimm16)); | |
155 | CPU (h_gr[f_r1]) = opval; | |
156 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
157 | } | |
b8a9943d | 158 | |
40c680ba DE |
159 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
160 | ||
8e420152 DE |
161 | #if WITH_PROFILE_MODEL_P |
162 | if (PROFILE_MODEL_P (current_cpu)) | |
163 | { | |
164 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
165 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
166 | m32rx_model_profile_insn (current_cpu, abuf); | |
167 | } | |
168 | #endif | |
b8a9943d | 169 | |
8e420152 DE |
170 | return new_pc; |
171 | #undef OPRND | |
8e420152 DE |
172 | } |
173 | ||
40c680ba DE |
174 | /* or: or $dr,$sr. */ |
175 | ||
8e420152 | 176 | CIA |
dc4e95ad | 177 | SEM_FN_NAME (m32rx,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 178 | { |
b8a9943d | 179 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 180 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 181 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 182 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 183 | CIA UNUSED pc = PC; |
e0a85af6 DE |
184 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
185 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 186 | |
1148b104 DE |
187 | { |
188 | SI opval = ORSI (OPRND (dr), OPRND (sr)); | |
189 | CPU (h_gr[f_r1]) = opval; | |
190 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
191 | } | |
b8a9943d | 192 | |
40c680ba DE |
193 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
194 | ||
8e420152 DE |
195 | #if WITH_PROFILE_MODEL_P |
196 | if (PROFILE_MODEL_P (current_cpu)) | |
197 | { | |
198 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
199 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
200 | m32rx_model_profile_insn (current_cpu, abuf); | |
201 | } | |
202 | #endif | |
b8a9943d | 203 | |
8e420152 DE |
204 | return new_pc; |
205 | #undef OPRND | |
8e420152 DE |
206 | } |
207 | ||
40c680ba DE |
208 | /* or3: or3 $dr,$sr,$hash$ulo16. */ |
209 | ||
8e420152 | 210 | CIA |
dc4e95ad | 211 | SEM_FN_NAME (m32rx,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 212 | { |
b8a9943d | 213 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 214 | #define OPRND(f) par_exec->operands.fmt_or3.f |
8e420152 | 215 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 216 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 217 | CIA UNUSED pc = PC; |
e0a85af6 DE |
218 | EXTRACT_FMT_OR3_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */ |
219 | EXTRACT_FMT_OR3_CODE | |
b8a9943d | 220 | |
1148b104 DE |
221 | { |
222 | SI opval = ORSI (OPRND (sr), OPRND (ulo16)); | |
223 | CPU (h_gr[f_r1]) = opval; | |
224 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
225 | } | |
b8a9943d | 226 | |
40c680ba DE |
227 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
228 | ||
8e420152 DE |
229 | #if WITH_PROFILE_MODEL_P |
230 | if (PROFILE_MODEL_P (current_cpu)) | |
231 | { | |
232 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
233 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
234 | m32rx_model_profile_insn (current_cpu, abuf); | |
235 | } | |
236 | #endif | |
b8a9943d | 237 | |
8e420152 DE |
238 | return new_pc; |
239 | #undef OPRND | |
8e420152 DE |
240 | } |
241 | ||
40c680ba DE |
242 | /* xor: xor $dr,$sr. */ |
243 | ||
8e420152 | 244 | CIA |
dc4e95ad | 245 | SEM_FN_NAME (m32rx,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 246 | { |
b8a9943d | 247 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 248 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 249 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 250 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 251 | CIA UNUSED pc = PC; |
e0a85af6 DE |
252 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
253 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 254 | |
1148b104 DE |
255 | { |
256 | SI opval = XORSI (OPRND (dr), OPRND (sr)); | |
257 | CPU (h_gr[f_r1]) = opval; | |
258 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
259 | } | |
b8a9943d | 260 | |
40c680ba DE |
261 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
262 | ||
8e420152 DE |
263 | #if WITH_PROFILE_MODEL_P |
264 | if (PROFILE_MODEL_P (current_cpu)) | |
265 | { | |
266 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
267 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
268 | m32rx_model_profile_insn (current_cpu, abuf); | |
269 | } | |
270 | #endif | |
b8a9943d | 271 | |
8e420152 DE |
272 | return new_pc; |
273 | #undef OPRND | |
8e420152 DE |
274 | } |
275 | ||
40c680ba DE |
276 | /* xor3: xor3 $dr,$sr,$uimm16. */ |
277 | ||
8e420152 | 278 | CIA |
dc4e95ad | 279 | SEM_FN_NAME (m32rx,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 280 | { |
b8a9943d | 281 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 282 | #define OPRND(f) par_exec->operands.fmt_and3.f |
8e420152 | 283 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 284 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 285 | CIA UNUSED pc = PC; |
e0a85af6 DE |
286 | EXTRACT_FMT_AND3_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */ |
287 | EXTRACT_FMT_AND3_CODE | |
b8a9943d | 288 | |
1148b104 DE |
289 | { |
290 | SI opval = XORSI (OPRND (sr), OPRND (uimm16)); | |
291 | CPU (h_gr[f_r1]) = opval; | |
292 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
293 | } | |
b8a9943d | 294 | |
40c680ba DE |
295 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
296 | ||
8e420152 DE |
297 | #if WITH_PROFILE_MODEL_P |
298 | if (PROFILE_MODEL_P (current_cpu)) | |
299 | { | |
300 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
301 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
302 | m32rx_model_profile_insn (current_cpu, abuf); | |
303 | } | |
304 | #endif | |
b8a9943d | 305 | |
8e420152 DE |
306 | return new_pc; |
307 | #undef OPRND | |
8e420152 DE |
308 | } |
309 | ||
40c680ba DE |
310 | /* addi: addi $dr,$simm8. */ |
311 | ||
8e420152 | 312 | CIA |
dc4e95ad | 313 | SEM_FN_NAME (m32rx,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 314 | { |
b8a9943d | 315 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 316 | #define OPRND(f) par_exec->operands.fmt_addi.f |
8e420152 | 317 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 318 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 319 | CIA UNUSED pc = PC; |
e0a85af6 DE |
320 | EXTRACT_FMT_ADDI_VARS /* f-op1 f-r1 f-simm8 */ |
321 | EXTRACT_FMT_ADDI_CODE | |
b8a9943d | 322 | |
1148b104 DE |
323 | { |
324 | SI opval = ADDSI (OPRND (dr), OPRND (simm8)); | |
325 | CPU (h_gr[f_r1]) = opval; | |
326 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
327 | } | |
b8a9943d | 328 | |
40c680ba DE |
329 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
330 | ||
8e420152 DE |
331 | #if WITH_PROFILE_MODEL_P |
332 | if (PROFILE_MODEL_P (current_cpu)) | |
333 | { | |
334 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
335 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
336 | m32rx_model_profile_insn (current_cpu, abuf); | |
337 | } | |
338 | #endif | |
b8a9943d | 339 | |
8e420152 DE |
340 | return new_pc; |
341 | #undef OPRND | |
8e420152 DE |
342 | } |
343 | ||
40c680ba DE |
344 | /* addv: addv $dr,$sr. */ |
345 | ||
8e420152 | 346 | CIA |
dc4e95ad | 347 | SEM_FN_NAME (m32rx,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 348 | { |
b8a9943d | 349 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 350 | #define OPRND(f) par_exec->operands.fmt_addv.f |
8e420152 | 351 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 352 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 353 | CIA UNUSED pc = PC; |
e0a85af6 DE |
354 | EXTRACT_FMT_ADDV_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
355 | EXTRACT_FMT_ADDV_CODE | |
b8a9943d | 356 | |
8e420152 | 357 | do { |
a040908c | 358 | UBI temp1;SI temp0; |
8e420152 DE |
359 | temp0 = ADDSI (OPRND (dr), OPRND (sr)); |
360 | temp1 = ADDOFSI (OPRND (dr), OPRND (sr), 0); | |
1148b104 DE |
361 | { |
362 | SI opval = temp0; | |
363 | CPU (h_gr[f_r1]) = opval; | |
364 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
365 | } | |
366 | { | |
367 | UBI opval = temp1; | |
368 | CPU (h_cond) = opval; | |
369 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
370 | } | |
8e420152 | 371 | } while (0); |
b8a9943d | 372 | |
40c680ba DE |
373 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
374 | ||
8e420152 DE |
375 | #if WITH_PROFILE_MODEL_P |
376 | if (PROFILE_MODEL_P (current_cpu)) | |
377 | { | |
378 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
379 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
380 | m32rx_model_profile_insn (current_cpu, abuf); | |
381 | } | |
382 | #endif | |
b8a9943d | 383 | |
8e420152 DE |
384 | return new_pc; |
385 | #undef OPRND | |
8e420152 DE |
386 | } |
387 | ||
40c680ba DE |
388 | /* addv3: addv3 $dr,$sr,$simm16. */ |
389 | ||
8e420152 | 390 | CIA |
dc4e95ad | 391 | SEM_FN_NAME (m32rx,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 392 | { |
b8a9943d | 393 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 394 | #define OPRND(f) par_exec->operands.fmt_addv3.f |
8e420152 | 395 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 396 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 397 | CIA UNUSED pc = PC; |
e0a85af6 DE |
398 | EXTRACT_FMT_ADDV3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
399 | EXTRACT_FMT_ADDV3_CODE | |
b8a9943d | 400 | |
8e420152 | 401 | do { |
a040908c | 402 | UBI temp1;SI temp0; |
8e420152 DE |
403 | temp0 = ADDSI (OPRND (sr), OPRND (simm16)); |
404 | temp1 = ADDOFSI (OPRND (sr), OPRND (simm16), 0); | |
1148b104 DE |
405 | { |
406 | SI opval = temp0; | |
407 | CPU (h_gr[f_r1]) = opval; | |
408 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
409 | } | |
410 | { | |
411 | UBI opval = temp1; | |
412 | CPU (h_cond) = opval; | |
413 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
414 | } | |
8e420152 | 415 | } while (0); |
b8a9943d | 416 | |
40c680ba DE |
417 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
418 | ||
8e420152 DE |
419 | #if WITH_PROFILE_MODEL_P |
420 | if (PROFILE_MODEL_P (current_cpu)) | |
421 | { | |
422 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
423 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
424 | m32rx_model_profile_insn (current_cpu, abuf); | |
425 | } | |
426 | #endif | |
b8a9943d | 427 | |
8e420152 DE |
428 | return new_pc; |
429 | #undef OPRND | |
8e420152 DE |
430 | } |
431 | ||
40c680ba DE |
432 | /* addx: addx $dr,$sr. */ |
433 | ||
8e420152 | 434 | CIA |
dc4e95ad | 435 | SEM_FN_NAME (m32rx,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 436 | { |
b8a9943d | 437 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 438 | #define OPRND(f) par_exec->operands.fmt_addx.f |
8e420152 | 439 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 440 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 441 | CIA UNUSED pc = PC; |
e0a85af6 DE |
442 | EXTRACT_FMT_ADDX_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
443 | EXTRACT_FMT_ADDX_CODE | |
b8a9943d | 444 | |
8e420152 | 445 | do { |
a040908c | 446 | UBI temp1;SI temp0; |
8e420152 DE |
447 | temp0 = ADDCSI (OPRND (dr), OPRND (sr), OPRND (condbit)); |
448 | temp1 = ADDCFSI (OPRND (dr), OPRND (sr), OPRND (condbit)); | |
1148b104 DE |
449 | { |
450 | SI opval = temp0; | |
451 | CPU (h_gr[f_r1]) = opval; | |
452 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
453 | } | |
454 | { | |
455 | UBI opval = temp1; | |
456 | CPU (h_cond) = opval; | |
457 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
458 | } | |
8e420152 | 459 | } while (0); |
b8a9943d | 460 | |
40c680ba DE |
461 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
462 | ||
8e420152 DE |
463 | #if WITH_PROFILE_MODEL_P |
464 | if (PROFILE_MODEL_P (current_cpu)) | |
465 | { | |
466 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
467 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
468 | m32rx_model_profile_insn (current_cpu, abuf); | |
469 | } | |
470 | #endif | |
b8a9943d | 471 | |
8e420152 DE |
472 | return new_pc; |
473 | #undef OPRND | |
8e420152 DE |
474 | } |
475 | ||
40c680ba DE |
476 | /* bc8: bc.s $disp8. */ |
477 | ||
8e420152 | 478 | CIA |
dc4e95ad | 479 | SEM_FN_NAME (m32rx,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 480 | { |
b8a9943d | 481 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 482 | #define OPRND(f) par_exec->operands.fmt_bc8.f |
8e420152 | 483 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 484 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 485 | int taken_p = 0; |
431e4f86 | 486 | CIA UNUSED pc = PC; |
e0a85af6 DE |
487 | EXTRACT_FMT_BC8_VARS /* f-op1 f-r1 f-disp8 */ |
488 | EXTRACT_FMT_BC8_CODE | |
b8a9943d | 489 | |
8e420152 | 490 | if (OPRND (condbit)) { |
1148b104 DE |
491 | { |
492 | USI opval = OPRND (disp8); | |
493 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
494 | taken_p = 1; | |
495 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
496 | } | |
8e420152 | 497 | } |
b8a9943d | 498 | |
40c680ba DE |
499 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
500 | ||
8e420152 DE |
501 | #if WITH_PROFILE_MODEL_P |
502 | if (PROFILE_MODEL_P (current_cpu)) | |
503 | { | |
504 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
505 | } | |
506 | #endif | |
b8a9943d | 507 | |
8e420152 DE |
508 | return new_pc; |
509 | #undef OPRND | |
8e420152 DE |
510 | } |
511 | ||
40c680ba DE |
512 | /* bc24: bc.l $disp24. */ |
513 | ||
8e420152 | 514 | CIA |
dc4e95ad | 515 | SEM_FN_NAME (m32rx,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 516 | { |
b8a9943d | 517 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 518 | #define OPRND(f) par_exec->operands.fmt_bc24.f |
8e420152 | 519 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 520 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 521 | int taken_p = 0; |
431e4f86 | 522 | CIA UNUSED pc = PC; |
e0a85af6 DE |
523 | EXTRACT_FMT_BC24_VARS /* f-op1 f-r1 f-disp24 */ |
524 | EXTRACT_FMT_BC24_CODE | |
b8a9943d | 525 | |
8e420152 | 526 | if (OPRND (condbit)) { |
1148b104 DE |
527 | { |
528 | USI opval = OPRND (disp24); | |
529 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
530 | taken_p = 1; | |
531 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
532 | } | |
8e420152 | 533 | } |
b8a9943d | 534 | |
40c680ba DE |
535 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
536 | ||
8e420152 DE |
537 | #if WITH_PROFILE_MODEL_P |
538 | if (PROFILE_MODEL_P (current_cpu)) | |
539 | { | |
540 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
541 | } | |
542 | #endif | |
b8a9943d | 543 | |
8e420152 DE |
544 | return new_pc; |
545 | #undef OPRND | |
8e420152 DE |
546 | } |
547 | ||
40c680ba DE |
548 | /* beq: beq $src1,$src2,$disp16. */ |
549 | ||
8e420152 | 550 | CIA |
dc4e95ad | 551 | SEM_FN_NAME (m32rx,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 552 | { |
b8a9943d | 553 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 554 | #define OPRND(f) par_exec->operands.fmt_beq.f |
8e420152 | 555 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 556 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 557 | int taken_p = 0; |
431e4f86 | 558 | CIA UNUSED pc = PC; |
e0a85af6 DE |
559 | EXTRACT_FMT_BEQ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
560 | EXTRACT_FMT_BEQ_CODE | |
b8a9943d | 561 | |
8e420152 | 562 | if (EQSI (OPRND (src1), OPRND (src2))) { |
1148b104 DE |
563 | { |
564 | USI opval = OPRND (disp16); | |
565 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
566 | taken_p = 1; | |
567 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
568 | } | |
8e420152 | 569 | } |
b8a9943d | 570 | |
40c680ba DE |
571 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
572 | ||
8e420152 DE |
573 | #if WITH_PROFILE_MODEL_P |
574 | if (PROFILE_MODEL_P (current_cpu)) | |
575 | { | |
576 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
577 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
578 | } | |
579 | #endif | |
b8a9943d | 580 | |
8e420152 DE |
581 | return new_pc; |
582 | #undef OPRND | |
8e420152 DE |
583 | } |
584 | ||
40c680ba DE |
585 | /* beqz: beqz $src2,$disp16. */ |
586 | ||
8e420152 | 587 | CIA |
dc4e95ad | 588 | SEM_FN_NAME (m32rx,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 589 | { |
b8a9943d | 590 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 591 | #define OPRND(f) par_exec->operands.fmt_beqz.f |
8e420152 | 592 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 593 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 594 | int taken_p = 0; |
431e4f86 | 595 | CIA UNUSED pc = PC; |
e0a85af6 DE |
596 | EXTRACT_FMT_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
597 | EXTRACT_FMT_BEQZ_CODE | |
b8a9943d | 598 | |
8e420152 | 599 | if (EQSI (OPRND (src2), 0)) { |
1148b104 DE |
600 | { |
601 | USI opval = OPRND (disp16); | |
602 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
603 | taken_p = 1; | |
604 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
605 | } | |
8e420152 | 606 | } |
b8a9943d | 607 | |
40c680ba DE |
608 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
609 | ||
8e420152 DE |
610 | #if WITH_PROFILE_MODEL_P |
611 | if (PROFILE_MODEL_P (current_cpu)) | |
612 | { | |
613 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
614 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
615 | } | |
616 | #endif | |
b8a9943d | 617 | |
8e420152 DE |
618 | return new_pc; |
619 | #undef OPRND | |
8e420152 DE |
620 | } |
621 | ||
40c680ba DE |
622 | /* bgez: bgez $src2,$disp16. */ |
623 | ||
8e420152 | 624 | CIA |
dc4e95ad | 625 | SEM_FN_NAME (m32rx,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 626 | { |
b8a9943d | 627 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 628 | #define OPRND(f) par_exec->operands.fmt_beqz.f |
8e420152 | 629 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 630 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 631 | int taken_p = 0; |
431e4f86 | 632 | CIA UNUSED pc = PC; |
e0a85af6 DE |
633 | EXTRACT_FMT_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
634 | EXTRACT_FMT_BEQZ_CODE | |
b8a9943d | 635 | |
8e420152 | 636 | if (GESI (OPRND (src2), 0)) { |
1148b104 DE |
637 | { |
638 | USI opval = OPRND (disp16); | |
639 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
640 | taken_p = 1; | |
641 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
642 | } | |
8e420152 | 643 | } |
b8a9943d | 644 | |
40c680ba DE |
645 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
646 | ||
8e420152 DE |
647 | #if WITH_PROFILE_MODEL_P |
648 | if (PROFILE_MODEL_P (current_cpu)) | |
649 | { | |
650 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
651 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
652 | } | |
653 | #endif | |
b8a9943d | 654 | |
8e420152 DE |
655 | return new_pc; |
656 | #undef OPRND | |
8e420152 DE |
657 | } |
658 | ||
40c680ba DE |
659 | /* bgtz: bgtz $src2,$disp16. */ |
660 | ||
8e420152 | 661 | CIA |
dc4e95ad | 662 | SEM_FN_NAME (m32rx,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 663 | { |
b8a9943d | 664 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 665 | #define OPRND(f) par_exec->operands.fmt_beqz.f |
8e420152 | 666 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 667 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 668 | int taken_p = 0; |
431e4f86 | 669 | CIA UNUSED pc = PC; |
e0a85af6 DE |
670 | EXTRACT_FMT_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
671 | EXTRACT_FMT_BEQZ_CODE | |
b8a9943d | 672 | |
8e420152 | 673 | if (GTSI (OPRND (src2), 0)) { |
1148b104 DE |
674 | { |
675 | USI opval = OPRND (disp16); | |
676 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
677 | taken_p = 1; | |
678 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
679 | } | |
8e420152 | 680 | } |
b8a9943d | 681 | |
40c680ba DE |
682 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
683 | ||
8e420152 DE |
684 | #if WITH_PROFILE_MODEL_P |
685 | if (PROFILE_MODEL_P (current_cpu)) | |
686 | { | |
687 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
688 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
689 | } | |
690 | #endif | |
b8a9943d | 691 | |
8e420152 DE |
692 | return new_pc; |
693 | #undef OPRND | |
8e420152 DE |
694 | } |
695 | ||
40c680ba DE |
696 | /* blez: blez $src2,$disp16. */ |
697 | ||
8e420152 | 698 | CIA |
dc4e95ad | 699 | SEM_FN_NAME (m32rx,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 700 | { |
b8a9943d | 701 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 702 | #define OPRND(f) par_exec->operands.fmt_beqz.f |
8e420152 | 703 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 704 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 705 | int taken_p = 0; |
431e4f86 | 706 | CIA UNUSED pc = PC; |
e0a85af6 DE |
707 | EXTRACT_FMT_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
708 | EXTRACT_FMT_BEQZ_CODE | |
b8a9943d | 709 | |
8e420152 | 710 | if (LESI (OPRND (src2), 0)) { |
1148b104 DE |
711 | { |
712 | USI opval = OPRND (disp16); | |
713 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
714 | taken_p = 1; | |
715 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
716 | } | |
8e420152 | 717 | } |
b8a9943d | 718 | |
40c680ba DE |
719 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
720 | ||
8e420152 DE |
721 | #if WITH_PROFILE_MODEL_P |
722 | if (PROFILE_MODEL_P (current_cpu)) | |
723 | { | |
724 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
725 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
726 | } | |
727 | #endif | |
b8a9943d | 728 | |
8e420152 DE |
729 | return new_pc; |
730 | #undef OPRND | |
8e420152 DE |
731 | } |
732 | ||
40c680ba DE |
733 | /* bltz: bltz $src2,$disp16. */ |
734 | ||
8e420152 | 735 | CIA |
dc4e95ad | 736 | SEM_FN_NAME (m32rx,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 737 | { |
b8a9943d | 738 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 739 | #define OPRND(f) par_exec->operands.fmt_beqz.f |
8e420152 | 740 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 741 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 742 | int taken_p = 0; |
431e4f86 | 743 | CIA UNUSED pc = PC; |
e0a85af6 DE |
744 | EXTRACT_FMT_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
745 | EXTRACT_FMT_BEQZ_CODE | |
b8a9943d | 746 | |
8e420152 | 747 | if (LTSI (OPRND (src2), 0)) { |
1148b104 DE |
748 | { |
749 | USI opval = OPRND (disp16); | |
750 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
751 | taken_p = 1; | |
752 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
753 | } | |
8e420152 | 754 | } |
b8a9943d | 755 | |
40c680ba DE |
756 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
757 | ||
8e420152 DE |
758 | #if WITH_PROFILE_MODEL_P |
759 | if (PROFILE_MODEL_P (current_cpu)) | |
760 | { | |
761 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
762 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
763 | } | |
764 | #endif | |
b8a9943d | 765 | |
8e420152 DE |
766 | return new_pc; |
767 | #undef OPRND | |
8e420152 DE |
768 | } |
769 | ||
40c680ba DE |
770 | /* bnez: bnez $src2,$disp16. */ |
771 | ||
8e420152 | 772 | CIA |
dc4e95ad | 773 | SEM_FN_NAME (m32rx,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 774 | { |
b8a9943d | 775 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 776 | #define OPRND(f) par_exec->operands.fmt_beqz.f |
8e420152 | 777 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 778 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 779 | int taken_p = 0; |
431e4f86 | 780 | CIA UNUSED pc = PC; |
e0a85af6 DE |
781 | EXTRACT_FMT_BEQZ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
782 | EXTRACT_FMT_BEQZ_CODE | |
b8a9943d | 783 | |
8e420152 | 784 | if (NESI (OPRND (src2), 0)) { |
1148b104 DE |
785 | { |
786 | USI opval = OPRND (disp16); | |
787 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
788 | taken_p = 1; | |
789 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
790 | } | |
8e420152 | 791 | } |
b8a9943d | 792 | |
40c680ba DE |
793 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
794 | ||
8e420152 DE |
795 | #if WITH_PROFILE_MODEL_P |
796 | if (PROFILE_MODEL_P (current_cpu)) | |
797 | { | |
798 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
799 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
800 | } | |
801 | #endif | |
b8a9943d | 802 | |
8e420152 DE |
803 | return new_pc; |
804 | #undef OPRND | |
8e420152 DE |
805 | } |
806 | ||
40c680ba DE |
807 | /* bl8: bl.s $disp8. */ |
808 | ||
8e420152 | 809 | CIA |
dc4e95ad | 810 | SEM_FN_NAME (m32rx,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 811 | { |
b8a9943d | 812 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 813 | #define OPRND(f) par_exec->operands.fmt_bl8.f |
8e420152 | 814 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 815 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 816 | int taken_p = 0; |
431e4f86 | 817 | CIA UNUSED pc = PC; |
e0a85af6 DE |
818 | EXTRACT_FMT_BL8_VARS /* f-op1 f-r1 f-disp8 */ |
819 | EXTRACT_FMT_BL8_CODE | |
b8a9943d | 820 | |
8e420152 | 821 | do { |
1148b104 DE |
822 | { |
823 | SI opval = ADDSI (ANDSI (OPRND (pc), -4), 4); | |
824 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
825 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
826 | } | |
827 | { | |
828 | USI opval = OPRND (disp8); | |
829 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
830 | taken_p = 1; | |
831 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
832 | } | |
8e420152 | 833 | } while (0); |
b8a9943d | 834 | |
40c680ba DE |
835 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
836 | ||
8e420152 DE |
837 | #if WITH_PROFILE_MODEL_P |
838 | if (PROFILE_MODEL_P (current_cpu)) | |
839 | { | |
b8a9943d | 840 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
841 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); |
842 | } | |
843 | #endif | |
b8a9943d | 844 | |
8e420152 DE |
845 | return new_pc; |
846 | #undef OPRND | |
8e420152 DE |
847 | } |
848 | ||
40c680ba DE |
849 | /* bl24: bl.l $disp24. */ |
850 | ||
8e420152 | 851 | CIA |
dc4e95ad | 852 | SEM_FN_NAME (m32rx,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 853 | { |
b8a9943d | 854 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 855 | #define OPRND(f) par_exec->operands.fmt_bl24.f |
8e420152 | 856 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 857 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 858 | int taken_p = 0; |
431e4f86 | 859 | CIA UNUSED pc = PC; |
e0a85af6 DE |
860 | EXTRACT_FMT_BL24_VARS /* f-op1 f-r1 f-disp24 */ |
861 | EXTRACT_FMT_BL24_CODE | |
b8a9943d | 862 | |
8e420152 | 863 | do { |
1148b104 DE |
864 | { |
865 | SI opval = ADDSI (OPRND (pc), 4); | |
866 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
867 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
868 | } | |
869 | { | |
870 | USI opval = OPRND (disp24); | |
871 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
872 | taken_p = 1; | |
873 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
874 | } | |
8e420152 | 875 | } while (0); |
b8a9943d | 876 | |
40c680ba DE |
877 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
878 | ||
8e420152 DE |
879 | #if WITH_PROFILE_MODEL_P |
880 | if (PROFILE_MODEL_P (current_cpu)) | |
881 | { | |
b8a9943d | 882 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
883 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); |
884 | } | |
885 | #endif | |
b8a9943d | 886 | |
8e420152 DE |
887 | return new_pc; |
888 | #undef OPRND | |
8e420152 DE |
889 | } |
890 | ||
40c680ba DE |
891 | /* bcl8: bcl.s $disp8. */ |
892 | ||
8e420152 | 893 | CIA |
dc4e95ad | 894 | SEM_FN_NAME (m32rx,bcl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 895 | { |
b8a9943d | 896 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 897 | #define OPRND(f) par_exec->operands.fmt_bcl8.f |
8e420152 | 898 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 899 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 900 | int taken_p = 0; |
431e4f86 | 901 | CIA UNUSED pc = PC; |
e0a85af6 DE |
902 | EXTRACT_FMT_BCL8_VARS /* f-op1 f-r1 f-disp8 */ |
903 | EXTRACT_FMT_BCL8_CODE | |
b8a9943d | 904 | |
8e420152 DE |
905 | if (OPRND (condbit)) { |
906 | do { | |
1148b104 DE |
907 | { |
908 | SI opval = ADDSI (ANDSI (OPRND (pc), -4), 4); | |
909 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
910 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
911 | } | |
912 | { | |
913 | USI opval = OPRND (disp8); | |
914 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
915 | taken_p = 1; | |
916 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
917 | } | |
8e420152 DE |
918 | } while (0); |
919 | } | |
b8a9943d | 920 | |
40c680ba DE |
921 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
922 | ||
8e420152 DE |
923 | #if WITH_PROFILE_MODEL_P |
924 | if (PROFILE_MODEL_P (current_cpu)) | |
925 | { | |
926 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
927 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
928 | } | |
929 | #endif | |
b8a9943d | 930 | |
8e420152 DE |
931 | return new_pc; |
932 | #undef OPRND | |
8e420152 DE |
933 | } |
934 | ||
40c680ba DE |
935 | /* bcl24: bcl.l $disp24. */ |
936 | ||
8e420152 | 937 | CIA |
dc4e95ad | 938 | SEM_FN_NAME (m32rx,bcl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 939 | { |
b8a9943d | 940 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 941 | #define OPRND(f) par_exec->operands.fmt_bcl24.f |
8e420152 | 942 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 943 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 944 | int taken_p = 0; |
431e4f86 | 945 | CIA UNUSED pc = PC; |
e0a85af6 DE |
946 | EXTRACT_FMT_BCL24_VARS /* f-op1 f-r1 f-disp24 */ |
947 | EXTRACT_FMT_BCL24_CODE | |
b8a9943d | 948 | |
8e420152 DE |
949 | if (OPRND (condbit)) { |
950 | do { | |
1148b104 DE |
951 | { |
952 | SI opval = ADDSI (OPRND (pc), 4); | |
953 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
954 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
955 | } | |
956 | { | |
957 | USI opval = OPRND (disp24); | |
958 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
959 | taken_p = 1; | |
960 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
961 | } | |
8e420152 DE |
962 | } while (0); |
963 | } | |
b8a9943d | 964 | |
40c680ba DE |
965 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
966 | ||
8e420152 DE |
967 | #if WITH_PROFILE_MODEL_P |
968 | if (PROFILE_MODEL_P (current_cpu)) | |
969 | { | |
970 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
971 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
972 | } | |
973 | #endif | |
b8a9943d | 974 | |
8e420152 DE |
975 | return new_pc; |
976 | #undef OPRND | |
8e420152 DE |
977 | } |
978 | ||
40c680ba DE |
979 | /* bnc8: bnc.s $disp8. */ |
980 | ||
8e420152 | 981 | CIA |
dc4e95ad | 982 | SEM_FN_NAME (m32rx,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 983 | { |
b8a9943d | 984 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 985 | #define OPRND(f) par_exec->operands.fmt_bc8.f |
8e420152 | 986 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 987 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 988 | int taken_p = 0; |
431e4f86 | 989 | CIA UNUSED pc = PC; |
e0a85af6 DE |
990 | EXTRACT_FMT_BC8_VARS /* f-op1 f-r1 f-disp8 */ |
991 | EXTRACT_FMT_BC8_CODE | |
b8a9943d | 992 | |
8e420152 | 993 | if (NOTBI (OPRND (condbit))) { |
1148b104 DE |
994 | { |
995 | USI opval = OPRND (disp8); | |
996 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
997 | taken_p = 1; | |
998 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
999 | } | |
8e420152 | 1000 | } |
b8a9943d | 1001 | |
40c680ba DE |
1002 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1003 | ||
8e420152 DE |
1004 | #if WITH_PROFILE_MODEL_P |
1005 | if (PROFILE_MODEL_P (current_cpu)) | |
1006 | { | |
1007 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1008 | } | |
1009 | #endif | |
b8a9943d | 1010 | |
8e420152 DE |
1011 | return new_pc; |
1012 | #undef OPRND | |
8e420152 DE |
1013 | } |
1014 | ||
40c680ba DE |
1015 | /* bnc24: bnc.l $disp24. */ |
1016 | ||
8e420152 | 1017 | CIA |
dc4e95ad | 1018 | SEM_FN_NAME (m32rx,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1019 | { |
b8a9943d | 1020 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1021 | #define OPRND(f) par_exec->operands.fmt_bc24.f |
8e420152 | 1022 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1023 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 1024 | int taken_p = 0; |
431e4f86 | 1025 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1026 | EXTRACT_FMT_BC24_VARS /* f-op1 f-r1 f-disp24 */ |
1027 | EXTRACT_FMT_BC24_CODE | |
b8a9943d | 1028 | |
8e420152 | 1029 | if (NOTBI (OPRND (condbit))) { |
1148b104 DE |
1030 | { |
1031 | USI opval = OPRND (disp24); | |
1032 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1033 | taken_p = 1; | |
1034 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1035 | } | |
8e420152 | 1036 | } |
b8a9943d | 1037 | |
40c680ba DE |
1038 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1039 | ||
8e420152 DE |
1040 | #if WITH_PROFILE_MODEL_P |
1041 | if (PROFILE_MODEL_P (current_cpu)) | |
1042 | { | |
1043 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1044 | } | |
1045 | #endif | |
b8a9943d | 1046 | |
8e420152 DE |
1047 | return new_pc; |
1048 | #undef OPRND | |
8e420152 DE |
1049 | } |
1050 | ||
40c680ba DE |
1051 | /* bne: bne $src1,$src2,$disp16. */ |
1052 | ||
8e420152 | 1053 | CIA |
dc4e95ad | 1054 | SEM_FN_NAME (m32rx,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1055 | { |
b8a9943d | 1056 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1057 | #define OPRND(f) par_exec->operands.fmt_beq.f |
8e420152 | 1058 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1059 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 1060 | int taken_p = 0; |
431e4f86 | 1061 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1062 | EXTRACT_FMT_BEQ_VARS /* f-op1 f-r1 f-op2 f-r2 f-disp16 */ |
1063 | EXTRACT_FMT_BEQ_CODE | |
b8a9943d | 1064 | |
8e420152 | 1065 | if (NESI (OPRND (src1), OPRND (src2))) { |
1148b104 DE |
1066 | { |
1067 | USI opval = OPRND (disp16); | |
1068 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1069 | taken_p = 1; | |
1070 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1071 | } | |
8e420152 | 1072 | } |
b8a9943d | 1073 | |
40c680ba DE |
1074 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1075 | ||
8e420152 DE |
1076 | #if WITH_PROFILE_MODEL_P |
1077 | if (PROFILE_MODEL_P (current_cpu)) | |
1078 | { | |
1079 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1080 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1081 | } | |
1082 | #endif | |
b8a9943d | 1083 | |
8e420152 DE |
1084 | return new_pc; |
1085 | #undef OPRND | |
8e420152 DE |
1086 | } |
1087 | ||
40c680ba DE |
1088 | /* bra8: bra.s $disp8. */ |
1089 | ||
8e420152 | 1090 | CIA |
dc4e95ad | 1091 | SEM_FN_NAME (m32rx,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1092 | { |
b8a9943d | 1093 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1094 | #define OPRND(f) par_exec->operands.fmt_bra8.f |
8e420152 | 1095 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1096 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 1097 | int taken_p = 0; |
431e4f86 | 1098 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1099 | EXTRACT_FMT_BRA8_VARS /* f-op1 f-r1 f-disp8 */ |
1100 | EXTRACT_FMT_BRA8_CODE | |
b8a9943d | 1101 | |
1148b104 DE |
1102 | { |
1103 | USI opval = OPRND (disp8); | |
1104 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1105 | taken_p = 1; | |
1106 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1107 | } | |
b8a9943d | 1108 | |
40c680ba DE |
1109 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1110 | ||
8e420152 DE |
1111 | #if WITH_PROFILE_MODEL_P |
1112 | if (PROFILE_MODEL_P (current_cpu)) | |
1113 | { | |
1114 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1115 | } | |
1116 | #endif | |
b8a9943d | 1117 | |
8e420152 DE |
1118 | return new_pc; |
1119 | #undef OPRND | |
8e420152 DE |
1120 | } |
1121 | ||
40c680ba DE |
1122 | /* bra24: bra.l $disp24. */ |
1123 | ||
8e420152 | 1124 | CIA |
dc4e95ad | 1125 | SEM_FN_NAME (m32rx,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1126 | { |
b8a9943d | 1127 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1128 | #define OPRND(f) par_exec->operands.fmt_bra24.f |
8e420152 | 1129 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1130 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 1131 | int taken_p = 0; |
431e4f86 | 1132 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1133 | EXTRACT_FMT_BRA24_VARS /* f-op1 f-r1 f-disp24 */ |
1134 | EXTRACT_FMT_BRA24_CODE | |
b8a9943d | 1135 | |
1148b104 DE |
1136 | { |
1137 | USI opval = OPRND (disp24); | |
1138 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1139 | taken_p = 1; | |
1140 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1141 | } | |
b8a9943d | 1142 | |
40c680ba DE |
1143 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1144 | ||
8e420152 DE |
1145 | #if WITH_PROFILE_MODEL_P |
1146 | if (PROFILE_MODEL_P (current_cpu)) | |
1147 | { | |
1148 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1149 | } | |
1150 | #endif | |
b8a9943d | 1151 | |
8e420152 DE |
1152 | return new_pc; |
1153 | #undef OPRND | |
8e420152 DE |
1154 | } |
1155 | ||
40c680ba DE |
1156 | /* bncl8: bncl.s $disp8. */ |
1157 | ||
8e420152 | 1158 | CIA |
dc4e95ad | 1159 | SEM_FN_NAME (m32rx,bncl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1160 | { |
b8a9943d | 1161 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1162 | #define OPRND(f) par_exec->operands.fmt_bcl8.f |
8e420152 | 1163 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1164 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 1165 | int taken_p = 0; |
431e4f86 | 1166 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1167 | EXTRACT_FMT_BCL8_VARS /* f-op1 f-r1 f-disp8 */ |
1168 | EXTRACT_FMT_BCL8_CODE | |
b8a9943d | 1169 | |
8e420152 DE |
1170 | if (NOTBI (OPRND (condbit))) { |
1171 | do { | |
1148b104 DE |
1172 | { |
1173 | SI opval = ADDSI (ANDSI (OPRND (pc), -4), 4); | |
1174 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
1175 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
1176 | } | |
1177 | { | |
1178 | USI opval = OPRND (disp8); | |
1179 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1180 | taken_p = 1; | |
1181 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1182 | } | |
8e420152 DE |
1183 | } while (0); |
1184 | } | |
b8a9943d | 1185 | |
40c680ba DE |
1186 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1187 | ||
8e420152 DE |
1188 | #if WITH_PROFILE_MODEL_P |
1189 | if (PROFILE_MODEL_P (current_cpu)) | |
1190 | { | |
1191 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1192 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1193 | } | |
1194 | #endif | |
b8a9943d | 1195 | |
8e420152 DE |
1196 | return new_pc; |
1197 | #undef OPRND | |
8e420152 DE |
1198 | } |
1199 | ||
40c680ba DE |
1200 | /* bncl24: bncl.l $disp24. */ |
1201 | ||
8e420152 | 1202 | CIA |
dc4e95ad | 1203 | SEM_FN_NAME (m32rx,bncl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1204 | { |
b8a9943d | 1205 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1206 | #define OPRND(f) par_exec->operands.fmt_bcl24.f |
8e420152 | 1207 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1208 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
8e420152 | 1209 | int taken_p = 0; |
431e4f86 | 1210 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1211 | EXTRACT_FMT_BCL24_VARS /* f-op1 f-r1 f-disp24 */ |
1212 | EXTRACT_FMT_BCL24_CODE | |
b8a9943d | 1213 | |
8e420152 DE |
1214 | if (NOTBI (OPRND (condbit))) { |
1215 | do { | |
1148b104 DE |
1216 | { |
1217 | SI opval = ADDSI (OPRND (pc), 4); | |
1218 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
1219 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
1220 | } | |
1221 | { | |
1222 | USI opval = OPRND (disp24); | |
1223 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1224 | taken_p = 1; | |
1225 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1226 | } | |
8e420152 DE |
1227 | } while (0); |
1228 | } | |
b8a9943d | 1229 | |
40c680ba DE |
1230 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1231 | ||
8e420152 DE |
1232 | #if WITH_PROFILE_MODEL_P |
1233 | if (PROFILE_MODEL_P (current_cpu)) | |
1234 | { | |
1235 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1236 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1237 | } | |
1238 | #endif | |
b8a9943d | 1239 | |
8e420152 DE |
1240 | return new_pc; |
1241 | #undef OPRND | |
8e420152 DE |
1242 | } |
1243 | ||
40c680ba DE |
1244 | /* cmp: cmp $src1,$src2. */ |
1245 | ||
8e420152 | 1246 | CIA |
dc4e95ad | 1247 | SEM_FN_NAME (m32rx,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1248 | { |
b8a9943d | 1249 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1250 | #define OPRND(f) par_exec->operands.fmt_cmp.f |
8e420152 | 1251 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1252 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1253 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1254 | EXTRACT_FMT_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1255 | EXTRACT_FMT_CMP_CODE | |
b8a9943d | 1256 | |
1148b104 DE |
1257 | { |
1258 | UBI opval = LTSI (OPRND (src1), OPRND (src2)); | |
1259 | CPU (h_cond) = opval; | |
1260 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1261 | } | |
b8a9943d | 1262 | |
40c680ba DE |
1263 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1264 | ||
8e420152 DE |
1265 | #if WITH_PROFILE_MODEL_P |
1266 | if (PROFILE_MODEL_P (current_cpu)) | |
1267 | { | |
1268 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1269 | m32rx_model_profile_insn (current_cpu, abuf); | |
1270 | } | |
1271 | #endif | |
b8a9943d | 1272 | |
8e420152 DE |
1273 | return new_pc; |
1274 | #undef OPRND | |
8e420152 DE |
1275 | } |
1276 | ||
40c680ba DE |
1277 | /* cmpi: cmpi $src2,$simm16. */ |
1278 | ||
8e420152 | 1279 | CIA |
dc4e95ad | 1280 | SEM_FN_NAME (m32rx,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1281 | { |
b8a9943d | 1282 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1283 | #define OPRND(f) par_exec->operands.fmt_cmpi.f |
8e420152 | 1284 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1285 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1286 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1287 | EXTRACT_FMT_CMPI_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1288 | EXTRACT_FMT_CMPI_CODE | |
b8a9943d | 1289 | |
1148b104 DE |
1290 | { |
1291 | UBI opval = LTSI (OPRND (src2), OPRND (simm16)); | |
1292 | CPU (h_cond) = opval; | |
1293 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1294 | } | |
b8a9943d | 1295 | |
40c680ba DE |
1296 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1297 | ||
8e420152 DE |
1298 | #if WITH_PROFILE_MODEL_P |
1299 | if (PROFILE_MODEL_P (current_cpu)) | |
1300 | { | |
1301 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1302 | m32rx_model_profile_insn (current_cpu, abuf); | |
1303 | } | |
1304 | #endif | |
b8a9943d | 1305 | |
8e420152 DE |
1306 | return new_pc; |
1307 | #undef OPRND | |
8e420152 DE |
1308 | } |
1309 | ||
40c680ba DE |
1310 | /* cmpu: cmpu $src1,$src2. */ |
1311 | ||
8e420152 | 1312 | CIA |
dc4e95ad | 1313 | SEM_FN_NAME (m32rx,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1314 | { |
b8a9943d | 1315 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1316 | #define OPRND(f) par_exec->operands.fmt_cmp.f |
8e420152 | 1317 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1318 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1319 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1320 | EXTRACT_FMT_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1321 | EXTRACT_FMT_CMP_CODE | |
b8a9943d | 1322 | |
1148b104 DE |
1323 | { |
1324 | UBI opval = LTUSI (OPRND (src1), OPRND (src2)); | |
1325 | CPU (h_cond) = opval; | |
1326 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1327 | } | |
b8a9943d | 1328 | |
40c680ba DE |
1329 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1330 | ||
8e420152 DE |
1331 | #if WITH_PROFILE_MODEL_P |
1332 | if (PROFILE_MODEL_P (current_cpu)) | |
1333 | { | |
1334 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1335 | m32rx_model_profile_insn (current_cpu, abuf); | |
1336 | } | |
1337 | #endif | |
b8a9943d | 1338 | |
8e420152 DE |
1339 | return new_pc; |
1340 | #undef OPRND | |
8e420152 DE |
1341 | } |
1342 | ||
40c680ba DE |
1343 | /* cmpui: cmpui $src2,$simm16. */ |
1344 | ||
8e420152 | 1345 | CIA |
dc4e95ad | 1346 | SEM_FN_NAME (m32rx,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1347 | { |
b8a9943d | 1348 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1349 | #define OPRND(f) par_exec->operands.fmt_cmpi.f |
8e420152 | 1350 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1351 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1352 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1353 | EXTRACT_FMT_CMPI_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1354 | EXTRACT_FMT_CMPI_CODE | |
b8a9943d | 1355 | |
1148b104 DE |
1356 | { |
1357 | UBI opval = LTUSI (OPRND (src2), OPRND (simm16)); | |
1358 | CPU (h_cond) = opval; | |
1359 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1360 | } | |
b8a9943d | 1361 | |
40c680ba DE |
1362 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1363 | ||
8e420152 DE |
1364 | #if WITH_PROFILE_MODEL_P |
1365 | if (PROFILE_MODEL_P (current_cpu)) | |
1366 | { | |
1367 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1368 | m32rx_model_profile_insn (current_cpu, abuf); | |
1369 | } | |
1370 | #endif | |
b8a9943d | 1371 | |
8e420152 DE |
1372 | return new_pc; |
1373 | #undef OPRND | |
8e420152 DE |
1374 | } |
1375 | ||
40c680ba DE |
1376 | /* cmpeq: cmpeq $src1,$src2. */ |
1377 | ||
8e420152 | 1378 | CIA |
dc4e95ad | 1379 | SEM_FN_NAME (m32rx,cmpeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1380 | { |
b8a9943d | 1381 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1382 | #define OPRND(f) par_exec->operands.fmt_cmp.f |
8e420152 | 1383 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1384 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1385 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1386 | EXTRACT_FMT_CMP_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1387 | EXTRACT_FMT_CMP_CODE | |
b8a9943d | 1388 | |
1148b104 DE |
1389 | { |
1390 | UBI opval = EQSI (OPRND (src1), OPRND (src2)); | |
1391 | CPU (h_cond) = opval; | |
1392 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1393 | } | |
b8a9943d | 1394 | |
40c680ba DE |
1395 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1396 | ||
8e420152 DE |
1397 | #if WITH_PROFILE_MODEL_P |
1398 | if (PROFILE_MODEL_P (current_cpu)) | |
1399 | { | |
1400 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1401 | m32rx_model_profile_insn (current_cpu, abuf); | |
1402 | } | |
1403 | #endif | |
b8a9943d | 1404 | |
8e420152 DE |
1405 | return new_pc; |
1406 | #undef OPRND | |
8e420152 DE |
1407 | } |
1408 | ||
40c680ba DE |
1409 | /* cmpz: cmpz $src2. */ |
1410 | ||
8e420152 | 1411 | CIA |
dc4e95ad | 1412 | SEM_FN_NAME (m32rx,cmpz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1413 | { |
b8a9943d | 1414 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1415 | #define OPRND(f) par_exec->operands.fmt_cmpz.f |
8e420152 | 1416 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1417 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1418 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1419 | EXTRACT_FMT_CMPZ_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1420 | EXTRACT_FMT_CMPZ_CODE | |
b8a9943d | 1421 | |
1148b104 DE |
1422 | { |
1423 | UBI opval = EQSI (OPRND (src2), 0); | |
1424 | CPU (h_cond) = opval; | |
1425 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1426 | } | |
b8a9943d | 1427 | |
40c680ba DE |
1428 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1429 | ||
8e420152 DE |
1430 | #if WITH_PROFILE_MODEL_P |
1431 | if (PROFILE_MODEL_P (current_cpu)) | |
1432 | { | |
1433 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1434 | m32rx_model_profile_insn (current_cpu, abuf); | |
1435 | } | |
1436 | #endif | |
b8a9943d | 1437 | |
8e420152 DE |
1438 | return new_pc; |
1439 | #undef OPRND | |
8e420152 DE |
1440 | } |
1441 | ||
40c680ba DE |
1442 | /* div: div $dr,$sr. */ |
1443 | ||
8e420152 | 1444 | CIA |
dc4e95ad | 1445 | SEM_FN_NAME (m32rx,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1446 | { |
b8a9943d | 1447 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1448 | #define OPRND(f) par_exec->operands.fmt_div.f |
8e420152 | 1449 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1450 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1451 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1452 | EXTRACT_FMT_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1453 | EXTRACT_FMT_DIV_CODE | |
b8a9943d | 1454 | |
8e420152 | 1455 | if (NESI (OPRND (sr), 0)) { |
1148b104 DE |
1456 | { |
1457 | SI opval = DIVSI (OPRND (dr), OPRND (sr)); | |
1458 | CPU (h_gr[f_r1]) = opval; | |
1459 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1460 | } | |
8e420152 | 1461 | } |
b8a9943d | 1462 | |
40c680ba DE |
1463 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1464 | ||
8e420152 DE |
1465 | #if WITH_PROFILE_MODEL_P |
1466 | if (PROFILE_MODEL_P (current_cpu)) | |
1467 | { | |
1468 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1469 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1470 | m32rx_model_profile_insn (current_cpu, abuf); | |
1471 | } | |
1472 | #endif | |
b8a9943d | 1473 | |
8e420152 DE |
1474 | return new_pc; |
1475 | #undef OPRND | |
8e420152 DE |
1476 | } |
1477 | ||
40c680ba DE |
1478 | /* divu: divu $dr,$sr. */ |
1479 | ||
8e420152 | 1480 | CIA |
dc4e95ad | 1481 | SEM_FN_NAME (m32rx,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1482 | { |
b8a9943d | 1483 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1484 | #define OPRND(f) par_exec->operands.fmt_div.f |
8e420152 | 1485 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1486 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1487 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1488 | EXTRACT_FMT_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1489 | EXTRACT_FMT_DIV_CODE | |
b8a9943d | 1490 | |
8e420152 | 1491 | if (NESI (OPRND (sr), 0)) { |
1148b104 DE |
1492 | { |
1493 | SI opval = UDIVSI (OPRND (dr), OPRND (sr)); | |
1494 | CPU (h_gr[f_r1]) = opval; | |
1495 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1496 | } | |
8e420152 | 1497 | } |
b8a9943d | 1498 | |
40c680ba DE |
1499 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1500 | ||
8e420152 DE |
1501 | #if WITH_PROFILE_MODEL_P |
1502 | if (PROFILE_MODEL_P (current_cpu)) | |
1503 | { | |
1504 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1505 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1506 | m32rx_model_profile_insn (current_cpu, abuf); | |
1507 | } | |
1508 | #endif | |
b8a9943d | 1509 | |
8e420152 DE |
1510 | return new_pc; |
1511 | #undef OPRND | |
8e420152 DE |
1512 | } |
1513 | ||
40c680ba DE |
1514 | /* rem: rem $dr,$sr. */ |
1515 | ||
8e420152 | 1516 | CIA |
dc4e95ad | 1517 | SEM_FN_NAME (m32rx,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1518 | { |
b8a9943d | 1519 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1520 | #define OPRND(f) par_exec->operands.fmt_div.f |
8e420152 | 1521 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1522 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1523 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1524 | EXTRACT_FMT_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1525 | EXTRACT_FMT_DIV_CODE | |
b8a9943d | 1526 | |
8e420152 | 1527 | if (NESI (OPRND (sr), 0)) { |
1148b104 DE |
1528 | { |
1529 | SI opval = MODSI (OPRND (dr), OPRND (sr)); | |
1530 | CPU (h_gr[f_r1]) = opval; | |
1531 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1532 | } | |
8e420152 | 1533 | } |
b8a9943d | 1534 | |
40c680ba DE |
1535 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1536 | ||
8e420152 DE |
1537 | #if WITH_PROFILE_MODEL_P |
1538 | if (PROFILE_MODEL_P (current_cpu)) | |
1539 | { | |
1540 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1541 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1542 | m32rx_model_profile_insn (current_cpu, abuf); | |
1543 | } | |
1544 | #endif | |
b8a9943d | 1545 | |
8e420152 DE |
1546 | return new_pc; |
1547 | #undef OPRND | |
8e420152 DE |
1548 | } |
1549 | ||
40c680ba DE |
1550 | /* remu: remu $dr,$sr. */ |
1551 | ||
8e420152 | 1552 | CIA |
dc4e95ad | 1553 | SEM_FN_NAME (m32rx,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1554 | { |
b8a9943d | 1555 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1556 | #define OPRND(f) par_exec->operands.fmt_div.f |
8e420152 | 1557 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1558 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1559 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1560 | EXTRACT_FMT_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1561 | EXTRACT_FMT_DIV_CODE | |
b8a9943d | 1562 | |
8e420152 | 1563 | if (NESI (OPRND (sr), 0)) { |
1148b104 DE |
1564 | { |
1565 | SI opval = UMODSI (OPRND (dr), OPRND (sr)); | |
1566 | CPU (h_gr[f_r1]) = opval; | |
1567 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1568 | } | |
8e420152 | 1569 | } |
b8a9943d | 1570 | |
40c680ba DE |
1571 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1572 | ||
8e420152 DE |
1573 | #if WITH_PROFILE_MODEL_P |
1574 | if (PROFILE_MODEL_P (current_cpu)) | |
1575 | { | |
1576 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1577 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1578 | m32rx_model_profile_insn (current_cpu, abuf); | |
1579 | } | |
1580 | #endif | |
b8a9943d | 1581 | |
8e420152 DE |
1582 | return new_pc; |
1583 | #undef OPRND | |
8e420152 DE |
1584 | } |
1585 | ||
40c680ba DE |
1586 | /* divh: divh $dr,$sr. */ |
1587 | ||
e0bd6e18 DE |
1588 | CIA |
1589 | SEM_FN_NAME (m32rx,divh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) | |
1590 | { | |
1591 | insn_t insn = SEM_INSN (sem_arg); | |
e0a85af6 | 1592 | #define OPRND(f) par_exec->operands.fmt_div.f |
e0bd6e18 | 1593 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1594 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1595 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1596 | EXTRACT_FMT_DIV_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1597 | EXTRACT_FMT_DIV_CODE | |
e0bd6e18 DE |
1598 | |
1599 | if (NESI (OPRND (sr), 0)) { | |
1148b104 DE |
1600 | { |
1601 | SI opval = DIVSI (EXTHISI (TRUNCSIHI (OPRND (dr))), OPRND (sr)); | |
1602 | CPU (h_gr[f_r1]) = opval; | |
1603 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1604 | } | |
e0bd6e18 DE |
1605 | } |
1606 | ||
40c680ba DE |
1607 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1608 | ||
e0bd6e18 DE |
1609 | #if WITH_PROFILE_MODEL_P |
1610 | if (PROFILE_MODEL_P (current_cpu)) | |
1611 | { | |
1612 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1613 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1614 | m32rx_model_profile_insn (current_cpu, abuf); | |
1615 | } | |
1616 | #endif | |
1617 | ||
1618 | return new_pc; | |
1619 | #undef OPRND | |
1620 | } | |
1621 | ||
40c680ba DE |
1622 | /* jc: jc $sr. */ |
1623 | ||
8e420152 | 1624 | CIA |
dc4e95ad | 1625 | SEM_FN_NAME (m32rx,jc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1626 | { |
b8a9943d | 1627 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1628 | #define OPRND(f) par_exec->operands.fmt_jc.f |
8e420152 | 1629 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1630 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 1631 | int taken_p = 0; |
431e4f86 | 1632 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1633 | EXTRACT_FMT_JC_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1634 | EXTRACT_FMT_JC_CODE | |
b8a9943d | 1635 | |
8e420152 | 1636 | if (OPRND (condbit)) { |
1148b104 DE |
1637 | { |
1638 | USI opval = ANDSI (OPRND (sr), -4); | |
1639 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1640 | taken_p = 1; | |
1641 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1642 | } | |
8e420152 | 1643 | } |
b8a9943d | 1644 | |
40c680ba DE |
1645 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1646 | ||
8e420152 DE |
1647 | #if WITH_PROFILE_MODEL_P |
1648 | if (PROFILE_MODEL_P (current_cpu)) | |
1649 | { | |
1650 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1651 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1652 | } | |
1653 | #endif | |
b8a9943d | 1654 | |
8e420152 DE |
1655 | return new_pc; |
1656 | #undef OPRND | |
8e420152 DE |
1657 | } |
1658 | ||
40c680ba DE |
1659 | /* jnc: jnc $sr. */ |
1660 | ||
8e420152 | 1661 | CIA |
dc4e95ad | 1662 | SEM_FN_NAME (m32rx,jnc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1663 | { |
b8a9943d | 1664 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1665 | #define OPRND(f) par_exec->operands.fmt_jc.f |
8e420152 | 1666 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1667 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 1668 | int taken_p = 0; |
431e4f86 | 1669 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1670 | EXTRACT_FMT_JC_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1671 | EXTRACT_FMT_JC_CODE | |
b8a9943d | 1672 | |
8e420152 | 1673 | if (NOTBI (OPRND (condbit))) { |
1148b104 DE |
1674 | { |
1675 | USI opval = ANDSI (OPRND (sr), -4); | |
1676 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1677 | taken_p = 1; | |
1678 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1679 | } | |
8e420152 | 1680 | } |
b8a9943d | 1681 | |
40c680ba DE |
1682 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1683 | ||
8e420152 DE |
1684 | #if WITH_PROFILE_MODEL_P |
1685 | if (PROFILE_MODEL_P (current_cpu)) | |
1686 | { | |
1687 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1688 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1689 | } | |
1690 | #endif | |
b8a9943d | 1691 | |
8e420152 DE |
1692 | return new_pc; |
1693 | #undef OPRND | |
8e420152 DE |
1694 | } |
1695 | ||
40c680ba DE |
1696 | /* jl: jl $sr. */ |
1697 | ||
8e420152 | 1698 | CIA |
dc4e95ad | 1699 | SEM_FN_NAME (m32rx,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1700 | { |
b8a9943d | 1701 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1702 | #define OPRND(f) par_exec->operands.fmt_jl.f |
8e420152 | 1703 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1704 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 1705 | int taken_p = 0; |
431e4f86 | 1706 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1707 | EXTRACT_FMT_JL_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1708 | EXTRACT_FMT_JL_CODE | |
b8a9943d | 1709 | |
8e420152 | 1710 | do { |
a040908c | 1711 | USI temp1;SI temp0; |
8e420152 | 1712 | temp0 = ADDSI (ANDSI (OPRND (pc), -4), 4); |
6ebf4a95 | 1713 | temp1 = ANDSI (OPRND (sr), -4); |
1148b104 DE |
1714 | { |
1715 | SI opval = temp0; | |
1716 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
1717 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
1718 | } | |
1719 | { | |
1720 | USI opval = temp1; | |
1721 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1722 | taken_p = 1; | |
1723 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1724 | } | |
8e420152 | 1725 | } while (0); |
b8a9943d | 1726 | |
40c680ba DE |
1727 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1728 | ||
8e420152 DE |
1729 | #if WITH_PROFILE_MODEL_P |
1730 | if (PROFILE_MODEL_P (current_cpu)) | |
1731 | { | |
1732 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
b8a9943d | 1733 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
1734 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); |
1735 | } | |
1736 | #endif | |
b8a9943d | 1737 | |
8e420152 DE |
1738 | return new_pc; |
1739 | #undef OPRND | |
8e420152 DE |
1740 | } |
1741 | ||
40c680ba DE |
1742 | /* jmp: jmp $sr. */ |
1743 | ||
8e420152 | 1744 | CIA |
dc4e95ad | 1745 | SEM_FN_NAME (m32rx,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1746 | { |
b8a9943d | 1747 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1748 | #define OPRND(f) par_exec->operands.fmt_jmp.f |
8e420152 | 1749 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1750 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 1751 | int taken_p = 0; |
431e4f86 | 1752 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1753 | EXTRACT_FMT_JMP_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1754 | EXTRACT_FMT_JMP_CODE | |
b8a9943d | 1755 | |
1148b104 DE |
1756 | { |
1757 | USI opval = ANDSI (OPRND (sr), -4); | |
1758 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1759 | taken_p = 1; | |
1760 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1761 | } | |
b8a9943d | 1762 | |
40c680ba DE |
1763 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1764 | ||
8e420152 DE |
1765 | #if WITH_PROFILE_MODEL_P |
1766 | if (PROFILE_MODEL_P (current_cpu)) | |
1767 | { | |
1768 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1769 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
1770 | } | |
1771 | #endif | |
b8a9943d | 1772 | |
8e420152 DE |
1773 | return new_pc; |
1774 | #undef OPRND | |
8e420152 DE |
1775 | } |
1776 | ||
40c680ba DE |
1777 | /* ld: ld $dr,@$sr. */ |
1778 | ||
8e420152 | 1779 | CIA |
dc4e95ad | 1780 | SEM_FN_NAME (m32rx,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1781 | { |
b8a9943d | 1782 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1783 | #define OPRND(f) par_exec->operands.fmt_ld.f |
8e420152 | 1784 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1785 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1786 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1787 | EXTRACT_FMT_LD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1788 | EXTRACT_FMT_LD_CODE | |
b8a9943d | 1789 | |
1148b104 DE |
1790 | { |
1791 | SI opval = OPRND (h_memory_sr); | |
1792 | CPU (h_gr[f_r1]) = opval; | |
1793 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1794 | } | |
b8a9943d | 1795 | |
40c680ba DE |
1796 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1797 | ||
8e420152 DE |
1798 | #if WITH_PROFILE_MODEL_P |
1799 | if (PROFILE_MODEL_P (current_cpu)) | |
1800 | { | |
1801 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1802 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1803 | m32rx_model_profile_insn (current_cpu, abuf); | |
1804 | } | |
1805 | #endif | |
b8a9943d | 1806 | |
8e420152 DE |
1807 | return new_pc; |
1808 | #undef OPRND | |
8e420152 DE |
1809 | } |
1810 | ||
40c680ba DE |
1811 | /* ld-d: ld $dr,@($slo16,$sr). */ |
1812 | ||
8e420152 | 1813 | CIA |
dc4e95ad | 1814 | SEM_FN_NAME (m32rx,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1815 | { |
b8a9943d | 1816 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1817 | #define OPRND(f) par_exec->operands.fmt_ld_d.f |
8e420152 | 1818 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1819 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1820 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1821 | EXTRACT_FMT_LD_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1822 | EXTRACT_FMT_LD_D_CODE | |
b8a9943d | 1823 | |
1148b104 DE |
1824 | { |
1825 | SI opval = OPRND (h_memory_add__VM_sr_slo16); | |
1826 | CPU (h_gr[f_r1]) = opval; | |
1827 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1828 | } | |
b8a9943d | 1829 | |
40c680ba DE |
1830 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1831 | ||
8e420152 DE |
1832 | #if WITH_PROFILE_MODEL_P |
1833 | if (PROFILE_MODEL_P (current_cpu)) | |
1834 | { | |
1835 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1836 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1837 | m32rx_model_profile_insn (current_cpu, abuf); | |
1838 | } | |
1839 | #endif | |
b8a9943d | 1840 | |
8e420152 DE |
1841 | return new_pc; |
1842 | #undef OPRND | |
8e420152 DE |
1843 | } |
1844 | ||
40c680ba DE |
1845 | /* ldb: ldb $dr,@$sr. */ |
1846 | ||
8e420152 | 1847 | CIA |
dc4e95ad | 1848 | SEM_FN_NAME (m32rx,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1849 | { |
b8a9943d | 1850 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1851 | #define OPRND(f) par_exec->operands.fmt_ldb.f |
8e420152 | 1852 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1853 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1854 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1855 | EXTRACT_FMT_LDB_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1856 | EXTRACT_FMT_LDB_CODE | |
b8a9943d | 1857 | |
1148b104 DE |
1858 | { |
1859 | SI opval = EXTQISI (OPRND (h_memory_sr)); | |
1860 | CPU (h_gr[f_r1]) = opval; | |
1861 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1862 | } | |
b8a9943d | 1863 | |
40c680ba DE |
1864 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1865 | ||
8e420152 DE |
1866 | #if WITH_PROFILE_MODEL_P |
1867 | if (PROFILE_MODEL_P (current_cpu)) | |
1868 | { | |
1869 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1870 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1871 | m32rx_model_profile_insn (current_cpu, abuf); | |
1872 | } | |
1873 | #endif | |
b8a9943d | 1874 | |
8e420152 DE |
1875 | return new_pc; |
1876 | #undef OPRND | |
8e420152 DE |
1877 | } |
1878 | ||
40c680ba DE |
1879 | /* ldb-d: ldb $dr,@($slo16,$sr). */ |
1880 | ||
8e420152 | 1881 | CIA |
dc4e95ad | 1882 | SEM_FN_NAME (m32rx,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1883 | { |
b8a9943d | 1884 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1885 | #define OPRND(f) par_exec->operands.fmt_ldb_d.f |
8e420152 | 1886 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1887 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1888 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1889 | EXTRACT_FMT_LDB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1890 | EXTRACT_FMT_LDB_D_CODE | |
b8a9943d | 1891 | |
1148b104 DE |
1892 | { |
1893 | SI opval = EXTQISI (OPRND (h_memory_add__VM_sr_slo16)); | |
1894 | CPU (h_gr[f_r1]) = opval; | |
1895 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1896 | } | |
b8a9943d | 1897 | |
40c680ba DE |
1898 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1899 | ||
8e420152 DE |
1900 | #if WITH_PROFILE_MODEL_P |
1901 | if (PROFILE_MODEL_P (current_cpu)) | |
1902 | { | |
1903 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1904 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1905 | m32rx_model_profile_insn (current_cpu, abuf); | |
1906 | } | |
1907 | #endif | |
b8a9943d | 1908 | |
8e420152 DE |
1909 | return new_pc; |
1910 | #undef OPRND | |
8e420152 DE |
1911 | } |
1912 | ||
40c680ba DE |
1913 | /* ldh: ldh $dr,@$sr. */ |
1914 | ||
8e420152 | 1915 | CIA |
dc4e95ad | 1916 | SEM_FN_NAME (m32rx,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1917 | { |
b8a9943d | 1918 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1919 | #define OPRND(f) par_exec->operands.fmt_ldh.f |
8e420152 | 1920 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1921 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1922 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1923 | EXTRACT_FMT_LDH_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1924 | EXTRACT_FMT_LDH_CODE | |
b8a9943d | 1925 | |
1148b104 DE |
1926 | { |
1927 | SI opval = EXTHISI (OPRND (h_memory_sr)); | |
1928 | CPU (h_gr[f_r1]) = opval; | |
1929 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1930 | } | |
b8a9943d | 1931 | |
40c680ba DE |
1932 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1933 | ||
8e420152 DE |
1934 | #if WITH_PROFILE_MODEL_P |
1935 | if (PROFILE_MODEL_P (current_cpu)) | |
1936 | { | |
1937 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1938 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1939 | m32rx_model_profile_insn (current_cpu, abuf); | |
1940 | } | |
1941 | #endif | |
b8a9943d | 1942 | |
8e420152 DE |
1943 | return new_pc; |
1944 | #undef OPRND | |
8e420152 DE |
1945 | } |
1946 | ||
40c680ba DE |
1947 | /* ldh-d: ldh $dr,@($slo16,$sr). */ |
1948 | ||
8e420152 | 1949 | CIA |
dc4e95ad | 1950 | SEM_FN_NAME (m32rx,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1951 | { |
b8a9943d | 1952 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1953 | #define OPRND(f) par_exec->operands.fmt_ldh_d.f |
8e420152 | 1954 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1955 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 1956 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1957 | EXTRACT_FMT_LDH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
1958 | EXTRACT_FMT_LDH_D_CODE | |
b8a9943d | 1959 | |
1148b104 DE |
1960 | { |
1961 | SI opval = EXTHISI (OPRND (h_memory_add__VM_sr_slo16)); | |
1962 | CPU (h_gr[f_r1]) = opval; | |
1963 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1964 | } | |
b8a9943d | 1965 | |
40c680ba DE |
1966 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1967 | ||
8e420152 DE |
1968 | #if WITH_PROFILE_MODEL_P |
1969 | if (PROFILE_MODEL_P (current_cpu)) | |
1970 | { | |
1971 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
1972 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
1973 | m32rx_model_profile_insn (current_cpu, abuf); | |
1974 | } | |
1975 | #endif | |
b8a9943d | 1976 | |
8e420152 DE |
1977 | return new_pc; |
1978 | #undef OPRND | |
8e420152 DE |
1979 | } |
1980 | ||
40c680ba DE |
1981 | /* ldub: ldub $dr,@$sr. */ |
1982 | ||
8e420152 | 1983 | CIA |
dc4e95ad | 1984 | SEM_FN_NAME (m32rx,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 1985 | { |
b8a9943d | 1986 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 1987 | #define OPRND(f) par_exec->operands.fmt_ldb.f |
8e420152 | 1988 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1989 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 1990 | CIA UNUSED pc = PC; |
e0a85af6 DE |
1991 | EXTRACT_FMT_LDB_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
1992 | EXTRACT_FMT_LDB_CODE | |
b8a9943d | 1993 | |
1148b104 DE |
1994 | { |
1995 | SI opval = ZEXTQISI (OPRND (h_memory_sr)); | |
1996 | CPU (h_gr[f_r1]) = opval; | |
1997 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1998 | } | |
b8a9943d | 1999 | |
40c680ba DE |
2000 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2001 | ||
8e420152 DE |
2002 | #if WITH_PROFILE_MODEL_P |
2003 | if (PROFILE_MODEL_P (current_cpu)) | |
2004 | { | |
2005 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2006 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2007 | m32rx_model_profile_insn (current_cpu, abuf); | |
2008 | } | |
2009 | #endif | |
b8a9943d | 2010 | |
8e420152 DE |
2011 | return new_pc; |
2012 | #undef OPRND | |
8e420152 DE |
2013 | } |
2014 | ||
40c680ba DE |
2015 | /* ldub-d: ldub $dr,@($slo16,$sr). */ |
2016 | ||
8e420152 | 2017 | CIA |
dc4e95ad | 2018 | SEM_FN_NAME (m32rx,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2019 | { |
b8a9943d | 2020 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2021 | #define OPRND(f) par_exec->operands.fmt_ldb_d.f |
8e420152 | 2022 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2023 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 2024 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2025 | EXTRACT_FMT_LDB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
2026 | EXTRACT_FMT_LDB_D_CODE | |
b8a9943d | 2027 | |
1148b104 DE |
2028 | { |
2029 | SI opval = ZEXTQISI (OPRND (h_memory_add__VM_sr_slo16)); | |
2030 | CPU (h_gr[f_r1]) = opval; | |
2031 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2032 | } | |
b8a9943d | 2033 | |
40c680ba DE |
2034 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2035 | ||
8e420152 DE |
2036 | #if WITH_PROFILE_MODEL_P |
2037 | if (PROFILE_MODEL_P (current_cpu)) | |
2038 | { | |
2039 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2040 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2041 | m32rx_model_profile_insn (current_cpu, abuf); | |
2042 | } | |
2043 | #endif | |
b8a9943d | 2044 | |
8e420152 DE |
2045 | return new_pc; |
2046 | #undef OPRND | |
8e420152 DE |
2047 | } |
2048 | ||
40c680ba DE |
2049 | /* lduh: lduh $dr,@$sr. */ |
2050 | ||
8e420152 | 2051 | CIA |
dc4e95ad | 2052 | SEM_FN_NAME (m32rx,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2053 | { |
b8a9943d | 2054 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2055 | #define OPRND(f) par_exec->operands.fmt_ldh.f |
8e420152 | 2056 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2057 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2058 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2059 | EXTRACT_FMT_LDH_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2060 | EXTRACT_FMT_LDH_CODE | |
b8a9943d | 2061 | |
1148b104 DE |
2062 | { |
2063 | SI opval = ZEXTHISI (OPRND (h_memory_sr)); | |
2064 | CPU (h_gr[f_r1]) = opval; | |
2065 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2066 | } | |
b8a9943d | 2067 | |
40c680ba DE |
2068 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2069 | ||
8e420152 DE |
2070 | #if WITH_PROFILE_MODEL_P |
2071 | if (PROFILE_MODEL_P (current_cpu)) | |
2072 | { | |
2073 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2074 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2075 | m32rx_model_profile_insn (current_cpu, abuf); | |
2076 | } | |
2077 | #endif | |
b8a9943d | 2078 | |
8e420152 DE |
2079 | return new_pc; |
2080 | #undef OPRND | |
8e420152 DE |
2081 | } |
2082 | ||
40c680ba DE |
2083 | /* lduh-d: lduh $dr,@($slo16,$sr). */ |
2084 | ||
8e420152 | 2085 | CIA |
dc4e95ad | 2086 | SEM_FN_NAME (m32rx,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2087 | { |
b8a9943d | 2088 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2089 | #define OPRND(f) par_exec->operands.fmt_ldh_d.f |
8e420152 | 2090 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2091 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 2092 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2093 | EXTRACT_FMT_LDH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
2094 | EXTRACT_FMT_LDH_D_CODE | |
b8a9943d | 2095 | |
1148b104 DE |
2096 | { |
2097 | SI opval = ZEXTHISI (OPRND (h_memory_add__VM_sr_slo16)); | |
2098 | CPU (h_gr[f_r1]) = opval; | |
2099 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2100 | } | |
b8a9943d | 2101 | |
40c680ba DE |
2102 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2103 | ||
8e420152 DE |
2104 | #if WITH_PROFILE_MODEL_P |
2105 | if (PROFILE_MODEL_P (current_cpu)) | |
2106 | { | |
2107 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2108 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2109 | m32rx_model_profile_insn (current_cpu, abuf); | |
2110 | } | |
2111 | #endif | |
b8a9943d | 2112 | |
8e420152 DE |
2113 | return new_pc; |
2114 | #undef OPRND | |
8e420152 DE |
2115 | } |
2116 | ||
40c680ba DE |
2117 | /* ld-plus: ld $dr,@$sr+. */ |
2118 | ||
8e420152 | 2119 | CIA |
dc4e95ad | 2120 | SEM_FN_NAME (m32rx,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2121 | { |
b8a9943d | 2122 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2123 | #define OPRND(f) par_exec->operands.fmt_ld_plus.f |
8e420152 | 2124 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2125 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2126 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2127 | EXTRACT_FMT_LD_PLUS_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2128 | EXTRACT_FMT_LD_PLUS_CODE | |
b8a9943d | 2129 | |
8e420152 DE |
2130 | do { |
2131 | SI temp1;SI temp0; | |
b8a9943d | 2132 | temp0 = OPRND (h_memory_sr); |
8e420152 | 2133 | temp1 = ADDSI (OPRND (sr), 4); |
1148b104 DE |
2134 | { |
2135 | SI opval = temp0; | |
2136 | CPU (h_gr[f_r1]) = opval; | |
2137 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2138 | } | |
2139 | { | |
2140 | SI opval = temp1; | |
2141 | CPU (h_gr[f_r2]) = opval; | |
2142 | TRACE_RESULT (current_cpu, "sr", 'x', opval); | |
2143 | } | |
8e420152 | 2144 | } while (0); |
b8a9943d | 2145 | |
40c680ba DE |
2146 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2147 | ||
8e420152 DE |
2148 | #if WITH_PROFILE_MODEL_P |
2149 | if (PROFILE_MODEL_P (current_cpu)) | |
2150 | { | |
2151 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2152 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2153 | m32rx_model_profile_insn (current_cpu, abuf); | |
2154 | } | |
2155 | #endif | |
b8a9943d | 2156 | |
8e420152 DE |
2157 | return new_pc; |
2158 | #undef OPRND | |
8e420152 DE |
2159 | } |
2160 | ||
40c680ba DE |
2161 | /* ld24: ld24 $dr,$uimm24. */ |
2162 | ||
8e420152 | 2163 | CIA |
dc4e95ad | 2164 | SEM_FN_NAME (m32rx,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2165 | { |
b8a9943d | 2166 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2167 | #define OPRND(f) par_exec->operands.fmt_ld24.f |
8e420152 | 2168 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2169 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 2170 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2171 | EXTRACT_FMT_LD24_VARS /* f-op1 f-r1 f-uimm24 */ |
2172 | EXTRACT_FMT_LD24_CODE | |
b8a9943d | 2173 | |
1148b104 DE |
2174 | { |
2175 | SI opval = OPRND (uimm24); | |
2176 | CPU (h_gr[f_r1]) = opval; | |
2177 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2178 | } | |
b8a9943d | 2179 | |
40c680ba DE |
2180 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2181 | ||
8e420152 DE |
2182 | #if WITH_PROFILE_MODEL_P |
2183 | if (PROFILE_MODEL_P (current_cpu)) | |
2184 | { | |
2185 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2186 | m32rx_model_profile_insn (current_cpu, abuf); | |
2187 | } | |
2188 | #endif | |
b8a9943d | 2189 | |
8e420152 DE |
2190 | return new_pc; |
2191 | #undef OPRND | |
8e420152 DE |
2192 | } |
2193 | ||
40c680ba DE |
2194 | /* ldi8: ldi8 $dr,$simm8. */ |
2195 | ||
8e420152 | 2196 | CIA |
dc4e95ad | 2197 | SEM_FN_NAME (m32rx,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2198 | { |
b8a9943d | 2199 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2200 | #define OPRND(f) par_exec->operands.fmt_ldi8.f |
8e420152 | 2201 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2202 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2203 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2204 | EXTRACT_FMT_LDI8_VARS /* f-op1 f-r1 f-simm8 */ |
2205 | EXTRACT_FMT_LDI8_CODE | |
b8a9943d | 2206 | |
1148b104 DE |
2207 | { |
2208 | SI opval = OPRND (simm8); | |
2209 | CPU (h_gr[f_r1]) = opval; | |
2210 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2211 | } | |
b8a9943d | 2212 | |
40c680ba DE |
2213 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2214 | ||
8e420152 DE |
2215 | #if WITH_PROFILE_MODEL_P |
2216 | if (PROFILE_MODEL_P (current_cpu)) | |
2217 | { | |
2218 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2219 | m32rx_model_profile_insn (current_cpu, abuf); | |
2220 | } | |
2221 | #endif | |
b8a9943d | 2222 | |
8e420152 DE |
2223 | return new_pc; |
2224 | #undef OPRND | |
8e420152 DE |
2225 | } |
2226 | ||
40c680ba DE |
2227 | /* ldi16: ldi16 $dr,$hash$slo16. */ |
2228 | ||
8e420152 | 2229 | CIA |
dc4e95ad | 2230 | SEM_FN_NAME (m32rx,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2231 | { |
b8a9943d | 2232 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2233 | #define OPRND(f) par_exec->operands.fmt_ldi16.f |
8e420152 | 2234 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2235 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 2236 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2237 | EXTRACT_FMT_LDI16_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
2238 | EXTRACT_FMT_LDI16_CODE | |
b8a9943d | 2239 | |
1148b104 DE |
2240 | { |
2241 | SI opval = OPRND (slo16); | |
2242 | CPU (h_gr[f_r1]) = opval; | |
2243 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2244 | } | |
b8a9943d | 2245 | |
40c680ba DE |
2246 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2247 | ||
8e420152 DE |
2248 | #if WITH_PROFILE_MODEL_P |
2249 | if (PROFILE_MODEL_P (current_cpu)) | |
2250 | { | |
2251 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2252 | m32rx_model_profile_insn (current_cpu, abuf); | |
2253 | } | |
2254 | #endif | |
b8a9943d | 2255 | |
8e420152 DE |
2256 | return new_pc; |
2257 | #undef OPRND | |
8e420152 DE |
2258 | } |
2259 | ||
40c680ba DE |
2260 | /* lock: lock $dr,@$sr. */ |
2261 | ||
8e420152 | 2262 | CIA |
dc4e95ad | 2263 | SEM_FN_NAME (m32rx,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2264 | { |
b8a9943d | 2265 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2266 | #define OPRND(f) par_exec->operands.fmt_lock.f |
8e420152 | 2267 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2268 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2269 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2270 | EXTRACT_FMT_LOCK_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2271 | EXTRACT_FMT_LOCK_CODE | |
b8a9943d | 2272 | |
cab58155 | 2273 | do { |
1148b104 DE |
2274 | { |
2275 | UBI opval = 1; | |
2276 | CPU (h_lock) = opval; | |
2277 | TRACE_RESULT (current_cpu, "lock-0", 'x', opval); | |
2278 | } | |
2279 | { | |
2280 | SI opval = OPRND (h_memory_sr); | |
2281 | CPU (h_gr[f_r1]) = opval; | |
2282 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2283 | } | |
cab58155 | 2284 | } while (0); |
b8a9943d | 2285 | |
40c680ba DE |
2286 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2287 | ||
8e420152 DE |
2288 | #if WITH_PROFILE_MODEL_P |
2289 | if (PROFILE_MODEL_P (current_cpu)) | |
2290 | { | |
2291 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
cab58155 | 2292 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
2293 | m32rx_model_profile_insn (current_cpu, abuf); |
2294 | } | |
2295 | #endif | |
b8a9943d | 2296 | |
8e420152 DE |
2297 | return new_pc; |
2298 | #undef OPRND | |
8e420152 DE |
2299 | } |
2300 | ||
40c680ba DE |
2301 | /* machi-a: machi $src1,$src2,$acc. */ |
2302 | ||
8e420152 | 2303 | CIA |
dc4e95ad | 2304 | SEM_FN_NAME (m32rx,machi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2305 | { |
b8a9943d | 2306 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2307 | #define OPRND(f) par_exec->operands.fmt_machi_a.f |
8e420152 | 2308 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2309 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2310 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2311 | EXTRACT_FMT_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2312 | EXTRACT_FMT_MACHI_A_CODE | |
b8a9943d | 2313 | |
1148b104 DE |
2314 | { |
2315 | DI opval = SRADI (SLLDI (ADDDI (OPRND (acc), MULDI (EXTSIDI (ANDSI (OPRND (src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2), 16))))), 8), 8); | |
2316 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2317 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
2318 | } | |
b8a9943d | 2319 | |
40c680ba DE |
2320 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2321 | ||
8e420152 DE |
2322 | #if WITH_PROFILE_MODEL_P |
2323 | if (PROFILE_MODEL_P (current_cpu)) | |
2324 | { | |
2325 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2326 | m32rx_model_profile_insn (current_cpu, abuf); | |
2327 | } | |
2328 | #endif | |
b8a9943d | 2329 | |
8e420152 DE |
2330 | return new_pc; |
2331 | #undef OPRND | |
8e420152 DE |
2332 | } |
2333 | ||
40c680ba DE |
2334 | /* maclo-a: maclo $src1,$src2,$acc. */ |
2335 | ||
8e420152 | 2336 | CIA |
dc4e95ad | 2337 | SEM_FN_NAME (m32rx,maclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2338 | { |
b8a9943d | 2339 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2340 | #define OPRND(f) par_exec->operands.fmt_machi_a.f |
8e420152 | 2341 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2342 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2343 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2344 | EXTRACT_FMT_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2345 | EXTRACT_FMT_MACHI_A_CODE | |
b8a9943d | 2346 | |
1148b104 DE |
2347 | { |
2348 | DI opval = SRADI (SLLDI (ADDDI (OPRND (acc), MULDI (EXTSIDI (SLLSI (OPRND (src1), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2))))), 8), 8); | |
2349 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2350 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
2351 | } | |
b8a9943d | 2352 | |
40c680ba DE |
2353 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2354 | ||
8e420152 DE |
2355 | #if WITH_PROFILE_MODEL_P |
2356 | if (PROFILE_MODEL_P (current_cpu)) | |
2357 | { | |
2358 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2359 | m32rx_model_profile_insn (current_cpu, abuf); | |
2360 | } | |
2361 | #endif | |
b8a9943d | 2362 | |
8e420152 DE |
2363 | return new_pc; |
2364 | #undef OPRND | |
8e420152 DE |
2365 | } |
2366 | ||
d846a17c | 2367 | /* macwhi-a: macwhi $src1,$src2,$acc. */ |
40c680ba | 2368 | |
83d9ce00 | 2369 | CIA |
d846a17c | 2370 | SEM_FN_NAME (m32rx,macwhi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
83d9ce00 DE |
2371 | { |
2372 | insn_t insn = SEM_INSN (sem_arg); | |
d846a17c | 2373 | #define OPRND(f) par_exec->operands.fmt_machi_a.f |
83d9ce00 DE |
2374 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2375 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); | |
431e4f86 | 2376 | CIA UNUSED pc = PC; |
d846a17c DE |
2377 | EXTRACT_FMT_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2378 | EXTRACT_FMT_MACHI_A_CODE | |
83d9ce00 | 2379 | |
1148b104 | 2380 | { |
d846a17c DE |
2381 | DI opval = ADDDI (OPRND (acc), MULDI (EXTSIDI (OPRND (src1)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2), 16))))); |
2382 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2383 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
1148b104 | 2384 | } |
83d9ce00 | 2385 | |
40c680ba DE |
2386 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2387 | ||
83d9ce00 DE |
2388 | #if WITH_PROFILE_MODEL_P |
2389 | if (PROFILE_MODEL_P (current_cpu)) | |
2390 | { | |
2391 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2392 | m32rx_model_profile_insn (current_cpu, abuf); | |
2393 | } | |
2394 | #endif | |
2395 | ||
2396 | return new_pc; | |
2397 | #undef OPRND | |
2398 | } | |
2399 | ||
d846a17c | 2400 | /* macwlo-a: macwlo $src1,$src2,$acc. */ |
40c680ba | 2401 | |
83d9ce00 | 2402 | CIA |
d846a17c | 2403 | SEM_FN_NAME (m32rx,macwlo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
83d9ce00 DE |
2404 | { |
2405 | insn_t insn = SEM_INSN (sem_arg); | |
d846a17c | 2406 | #define OPRND(f) par_exec->operands.fmt_machi_a.f |
83d9ce00 DE |
2407 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2408 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); | |
431e4f86 | 2409 | CIA UNUSED pc = PC; |
d846a17c DE |
2410 | EXTRACT_FMT_MACHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2411 | EXTRACT_FMT_MACHI_A_CODE | |
83d9ce00 | 2412 | |
1148b104 | 2413 | { |
d846a17c DE |
2414 | DI opval = ADDDI (OPRND (acc), MULDI (EXTSIDI (OPRND (src1)), EXTHIDI (TRUNCSIHI (OPRND (src2))))); |
2415 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2416 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
1148b104 | 2417 | } |
83d9ce00 | 2418 | |
40c680ba DE |
2419 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2420 | ||
83d9ce00 DE |
2421 | #if WITH_PROFILE_MODEL_P |
2422 | if (PROFILE_MODEL_P (current_cpu)) | |
2423 | { | |
2424 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2425 | m32rx_model_profile_insn (current_cpu, abuf); | |
2426 | } | |
2427 | #endif | |
2428 | ||
2429 | return new_pc; | |
2430 | #undef OPRND | |
2431 | } | |
2432 | ||
40c680ba DE |
2433 | /* mul: mul $dr,$sr. */ |
2434 | ||
8e420152 | 2435 | CIA |
dc4e95ad | 2436 | SEM_FN_NAME (m32rx,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2437 | { |
b8a9943d | 2438 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2439 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 2440 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2441 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2442 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2443 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2444 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 2445 | |
1148b104 DE |
2446 | { |
2447 | SI opval = MULSI (OPRND (dr), OPRND (sr)); | |
2448 | CPU (h_gr[f_r1]) = opval; | |
2449 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2450 | } | |
b8a9943d | 2451 | |
40c680ba DE |
2452 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2453 | ||
8e420152 DE |
2454 | #if WITH_PROFILE_MODEL_P |
2455 | if (PROFILE_MODEL_P (current_cpu)) | |
2456 | { | |
2457 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
b8a9943d | 2458 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
2459 | m32rx_model_profile_insn (current_cpu, abuf); |
2460 | } | |
2461 | #endif | |
b8a9943d | 2462 | |
8e420152 DE |
2463 | return new_pc; |
2464 | #undef OPRND | |
8e420152 DE |
2465 | } |
2466 | ||
40c680ba DE |
2467 | /* mulhi-a: mulhi $src1,$src2,$acc. */ |
2468 | ||
8e420152 | 2469 | CIA |
dc4e95ad | 2470 | SEM_FN_NAME (m32rx,mulhi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2471 | { |
b8a9943d | 2472 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2473 | #define OPRND(f) par_exec->operands.fmt_mulhi_a.f |
8e420152 | 2474 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2475 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2476 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2477 | EXTRACT_FMT_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2478 | EXTRACT_FMT_MULHI_A_CODE | |
b8a9943d | 2479 | |
1148b104 DE |
2480 | { |
2481 | DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (OPRND (src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2), 16)))), 16), 16); | |
2482 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2483 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
2484 | } | |
b8a9943d | 2485 | |
40c680ba DE |
2486 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2487 | ||
8e420152 DE |
2488 | #if WITH_PROFILE_MODEL_P |
2489 | if (PROFILE_MODEL_P (current_cpu)) | |
2490 | { | |
2491 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2492 | m32rx_model_profile_insn (current_cpu, abuf); | |
2493 | } | |
2494 | #endif | |
b8a9943d | 2495 | |
8e420152 DE |
2496 | return new_pc; |
2497 | #undef OPRND | |
8e420152 DE |
2498 | } |
2499 | ||
40c680ba DE |
2500 | /* mullo-a: mullo $src1,$src2,$acc. */ |
2501 | ||
8e420152 | 2502 | CIA |
dc4e95ad | 2503 | SEM_FN_NAME (m32rx,mullo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2504 | { |
b8a9943d | 2505 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2506 | #define OPRND(f) par_exec->operands.fmt_mulhi_a.f |
8e420152 | 2507 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2508 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2509 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2510 | EXTRACT_FMT_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2511 | EXTRACT_FMT_MULHI_A_CODE | |
b8a9943d | 2512 | |
1148b104 DE |
2513 | { |
2514 | DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (OPRND (src1), 16)), EXTHIDI (TRUNCSIHI (OPRND (src2)))), 16), 16); | |
2515 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2516 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
2517 | } | |
b8a9943d | 2518 | |
40c680ba DE |
2519 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2520 | ||
8e420152 DE |
2521 | #if WITH_PROFILE_MODEL_P |
2522 | if (PROFILE_MODEL_P (current_cpu)) | |
2523 | { | |
2524 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2525 | m32rx_model_profile_insn (current_cpu, abuf); | |
2526 | } | |
2527 | #endif | |
b8a9943d | 2528 | |
8e420152 DE |
2529 | return new_pc; |
2530 | #undef OPRND | |
8e420152 DE |
2531 | } |
2532 | ||
d846a17c | 2533 | /* mulwhi-a: mulwhi $src1,$src2,$acc. */ |
40c680ba | 2534 | |
83d9ce00 | 2535 | CIA |
d846a17c | 2536 | SEM_FN_NAME (m32rx,mulwhi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
83d9ce00 DE |
2537 | { |
2538 | insn_t insn = SEM_INSN (sem_arg); | |
d846a17c | 2539 | #define OPRND(f) par_exec->operands.fmt_mulhi_a.f |
83d9ce00 DE |
2540 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2541 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); | |
431e4f86 | 2542 | CIA UNUSED pc = PC; |
d846a17c DE |
2543 | EXTRACT_FMT_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2544 | EXTRACT_FMT_MULHI_A_CODE | |
83d9ce00 | 2545 | |
1148b104 | 2546 | { |
d846a17c DE |
2547 | DI opval = MULDI (EXTSIDI (OPRND (src1)), EXTHIDI (TRUNCSIHI (SRASI (OPRND (src2), 16)))); |
2548 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2549 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
1148b104 | 2550 | } |
83d9ce00 | 2551 | |
40c680ba DE |
2552 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2553 | ||
83d9ce00 DE |
2554 | #if WITH_PROFILE_MODEL_P |
2555 | if (PROFILE_MODEL_P (current_cpu)) | |
2556 | { | |
2557 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2558 | m32rx_model_profile_insn (current_cpu, abuf); | |
2559 | } | |
2560 | #endif | |
2561 | ||
2562 | return new_pc; | |
2563 | #undef OPRND | |
2564 | } | |
2565 | ||
d846a17c | 2566 | /* mulwlo-a: mulwlo $src1,$src2,$acc. */ |
40c680ba | 2567 | |
83d9ce00 | 2568 | CIA |
d846a17c | 2569 | SEM_FN_NAME (m32rx,mulwlo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
83d9ce00 DE |
2570 | { |
2571 | insn_t insn = SEM_INSN (sem_arg); | |
d846a17c | 2572 | #define OPRND(f) par_exec->operands.fmt_mulhi_a.f |
83d9ce00 DE |
2573 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
2574 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); | |
431e4f86 | 2575 | CIA UNUSED pc = PC; |
d846a17c DE |
2576 | EXTRACT_FMT_MULHI_A_VARS /* f-op1 f-r1 f-acc f-op23 f-r2 */ |
2577 | EXTRACT_FMT_MULHI_A_CODE | |
83d9ce00 | 2578 | |
1148b104 | 2579 | { |
d846a17c DE |
2580 | DI opval = MULDI (EXTSIDI (OPRND (src1)), EXTHIDI (TRUNCSIHI (OPRND (src2)))); |
2581 | m32rx_h_accums_set (current_cpu, f_acc, opval); | |
2582 | TRACE_RESULT (current_cpu, "acc", 'D', opval); | |
1148b104 | 2583 | } |
83d9ce00 | 2584 | |
40c680ba DE |
2585 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2586 | ||
83d9ce00 DE |
2587 | #if WITH_PROFILE_MODEL_P |
2588 | if (PROFILE_MODEL_P (current_cpu)) | |
2589 | { | |
2590 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2591 | m32rx_model_profile_insn (current_cpu, abuf); | |
2592 | } | |
2593 | #endif | |
2594 | ||
2595 | return new_pc; | |
2596 | #undef OPRND | |
2597 | } | |
2598 | ||
40c680ba DE |
2599 | /* mv: mv $dr,$sr. */ |
2600 | ||
8e420152 | 2601 | CIA |
dc4e95ad | 2602 | SEM_FN_NAME (m32rx,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2603 | { |
b8a9943d | 2604 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2605 | #define OPRND(f) par_exec->operands.fmt_mv.f |
8e420152 | 2606 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2607 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2608 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2609 | EXTRACT_FMT_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2610 | EXTRACT_FMT_MV_CODE | |
b8a9943d | 2611 | |
1148b104 DE |
2612 | { |
2613 | SI opval = OPRND (sr); | |
2614 | CPU (h_gr[f_r1]) = opval; | |
2615 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2616 | } | |
b8a9943d | 2617 | |
40c680ba DE |
2618 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2619 | ||
8e420152 DE |
2620 | #if WITH_PROFILE_MODEL_P |
2621 | if (PROFILE_MODEL_P (current_cpu)) | |
2622 | { | |
2623 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
b8a9943d | 2624 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
2625 | m32rx_model_profile_insn (current_cpu, abuf); |
2626 | } | |
2627 | #endif | |
b8a9943d | 2628 | |
8e420152 DE |
2629 | return new_pc; |
2630 | #undef OPRND | |
8e420152 DE |
2631 | } |
2632 | ||
40c680ba DE |
2633 | /* mvfachi-a: mvfachi $dr,$accs. */ |
2634 | ||
8e420152 | 2635 | CIA |
dc4e95ad | 2636 | SEM_FN_NAME (m32rx,mvfachi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2637 | { |
b8a9943d | 2638 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2639 | #define OPRND(f) par_exec->operands.fmt_mvfachi_a.f |
8e420152 | 2640 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2641 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2642 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2643 | EXTRACT_FMT_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */ |
2644 | EXTRACT_FMT_MVFACHI_A_CODE | |
b8a9943d | 2645 | |
1148b104 DE |
2646 | { |
2647 | SI opval = TRUNCDISI (SRADI (OPRND (accs), 32)); | |
2648 | CPU (h_gr[f_r1]) = opval; | |
2649 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2650 | } | |
b8a9943d | 2651 | |
40c680ba DE |
2652 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2653 | ||
8e420152 DE |
2654 | #if WITH_PROFILE_MODEL_P |
2655 | if (PROFILE_MODEL_P (current_cpu)) | |
2656 | { | |
b8a9943d | 2657 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
2658 | m32rx_model_profile_insn (current_cpu, abuf); |
2659 | } | |
2660 | #endif | |
b8a9943d | 2661 | |
8e420152 DE |
2662 | return new_pc; |
2663 | #undef OPRND | |
8e420152 DE |
2664 | } |
2665 | ||
40c680ba DE |
2666 | /* mvfaclo-a: mvfaclo $dr,$accs. */ |
2667 | ||
8e420152 | 2668 | CIA |
dc4e95ad | 2669 | SEM_FN_NAME (m32rx,mvfaclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2670 | { |
b8a9943d | 2671 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2672 | #define OPRND(f) par_exec->operands.fmt_mvfachi_a.f |
8e420152 | 2673 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2674 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2675 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2676 | EXTRACT_FMT_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */ |
2677 | EXTRACT_FMT_MVFACHI_A_CODE | |
b8a9943d | 2678 | |
1148b104 DE |
2679 | { |
2680 | SI opval = TRUNCDISI (OPRND (accs)); | |
2681 | CPU (h_gr[f_r1]) = opval; | |
2682 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2683 | } | |
b8a9943d | 2684 | |
40c680ba DE |
2685 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2686 | ||
8e420152 DE |
2687 | #if WITH_PROFILE_MODEL_P |
2688 | if (PROFILE_MODEL_P (current_cpu)) | |
2689 | { | |
b8a9943d | 2690 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
2691 | m32rx_model_profile_insn (current_cpu, abuf); |
2692 | } | |
2693 | #endif | |
b8a9943d | 2694 | |
8e420152 DE |
2695 | return new_pc; |
2696 | #undef OPRND | |
8e420152 DE |
2697 | } |
2698 | ||
40c680ba DE |
2699 | /* mvfacmi-a: mvfacmi $dr,$accs. */ |
2700 | ||
8e420152 | 2701 | CIA |
dc4e95ad | 2702 | SEM_FN_NAME (m32rx,mvfacmi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2703 | { |
b8a9943d | 2704 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2705 | #define OPRND(f) par_exec->operands.fmt_mvfachi_a.f |
8e420152 | 2706 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2707 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2708 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2709 | EXTRACT_FMT_MVFACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */ |
2710 | EXTRACT_FMT_MVFACHI_A_CODE | |
8e420152 | 2711 | |
1148b104 DE |
2712 | { |
2713 | SI opval = TRUNCDISI (SRADI (OPRND (accs), 16)); | |
2714 | CPU (h_gr[f_r1]) = opval; | |
2715 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2716 | } | |
8e420152 | 2717 | |
40c680ba DE |
2718 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2719 | ||
8e420152 DE |
2720 | #if WITH_PROFILE_MODEL_P |
2721 | if (PROFILE_MODEL_P (current_cpu)) | |
2722 | { | |
2723 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2724 | m32rx_model_profile_insn (current_cpu, abuf); | |
2725 | } | |
2726 | #endif | |
8e420152 | 2727 | |
8e420152 DE |
2728 | return new_pc; |
2729 | #undef OPRND | |
8e420152 DE |
2730 | } |
2731 | ||
40c680ba DE |
2732 | /* mvfc: mvfc $dr,$scr. */ |
2733 | ||
8e420152 | 2734 | CIA |
dc4e95ad | 2735 | SEM_FN_NAME (m32rx,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2736 | { |
b8a9943d | 2737 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2738 | #define OPRND(f) par_exec->operands.fmt_mvfc.f |
8e420152 | 2739 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2740 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2741 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2742 | EXTRACT_FMT_MVFC_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2743 | EXTRACT_FMT_MVFC_CODE | |
b8a9943d | 2744 | |
1148b104 DE |
2745 | { |
2746 | SI opval = OPRND (scr); | |
2747 | CPU (h_gr[f_r1]) = opval; | |
2748 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2749 | } | |
b8a9943d | 2750 | |
40c680ba DE |
2751 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2752 | ||
8e420152 DE |
2753 | #if WITH_PROFILE_MODEL_P |
2754 | if (PROFILE_MODEL_P (current_cpu)) | |
2755 | { | |
2756 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2757 | m32rx_model_profile_insn (current_cpu, abuf); | |
2758 | } | |
2759 | #endif | |
8e420152 | 2760 | |
8e420152 DE |
2761 | return new_pc; |
2762 | #undef OPRND | |
8e420152 DE |
2763 | } |
2764 | ||
40c680ba DE |
2765 | /* mvtachi-a: mvtachi $src1,$accs. */ |
2766 | ||
8e420152 | 2767 | CIA |
dc4e95ad | 2768 | SEM_FN_NAME (m32rx,mvtachi_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2769 | { |
b8a9943d | 2770 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2771 | #define OPRND(f) par_exec->operands.fmt_mvtachi_a.f |
8e420152 | 2772 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2773 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2774 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2775 | EXTRACT_FMT_MVTACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */ |
2776 | EXTRACT_FMT_MVTACHI_A_CODE | |
b8a9943d | 2777 | |
1148b104 DE |
2778 | { |
2779 | DI opval = ORDI (ANDDI (OPRND (accs), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (OPRND (src1)), 32)); | |
2780 | m32rx_h_accums_set (current_cpu, f_accs, opval); | |
2781 | TRACE_RESULT (current_cpu, "accs", 'D', opval); | |
2782 | } | |
8e420152 | 2783 | |
40c680ba DE |
2784 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2785 | ||
8e420152 DE |
2786 | #if WITH_PROFILE_MODEL_P |
2787 | if (PROFILE_MODEL_P (current_cpu)) | |
2788 | { | |
2789 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2790 | m32rx_model_profile_insn (current_cpu, abuf); | |
2791 | } | |
2792 | #endif | |
b8a9943d | 2793 | |
8e420152 DE |
2794 | return new_pc; |
2795 | #undef OPRND | |
8e420152 DE |
2796 | } |
2797 | ||
40c680ba DE |
2798 | /* mvtaclo-a: mvtaclo $src1,$accs. */ |
2799 | ||
8e420152 | 2800 | CIA |
dc4e95ad | 2801 | SEM_FN_NAME (m32rx,mvtaclo_a) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2802 | { |
b8a9943d | 2803 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2804 | #define OPRND(f) par_exec->operands.fmt_mvtachi_a.f |
8e420152 | 2805 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2806 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2807 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2808 | EXTRACT_FMT_MVTACHI_A_VARS /* f-op1 f-r1 f-op2 f-accs f-op3 */ |
2809 | EXTRACT_FMT_MVTACHI_A_CODE | |
b8a9943d | 2810 | |
1148b104 DE |
2811 | { |
2812 | DI opval = ORDI (ANDDI (OPRND (accs), MAKEDI (0xffffffff, 0)), ZEXTSIDI (OPRND (src1))); | |
2813 | m32rx_h_accums_set (current_cpu, f_accs, opval); | |
2814 | TRACE_RESULT (current_cpu, "accs", 'D', opval); | |
2815 | } | |
b8a9943d | 2816 | |
40c680ba DE |
2817 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2818 | ||
8e420152 DE |
2819 | #if WITH_PROFILE_MODEL_P |
2820 | if (PROFILE_MODEL_P (current_cpu)) | |
2821 | { | |
2822 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2823 | m32rx_model_profile_insn (current_cpu, abuf); | |
2824 | } | |
2825 | #endif | |
b8a9943d | 2826 | |
8e420152 DE |
2827 | return new_pc; |
2828 | #undef OPRND | |
8e420152 DE |
2829 | } |
2830 | ||
40c680ba DE |
2831 | /* mvtc: mvtc $sr,$dcr. */ |
2832 | ||
8e420152 | 2833 | CIA |
dc4e95ad | 2834 | SEM_FN_NAME (m32rx,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2835 | { |
b8a9943d | 2836 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2837 | #define OPRND(f) par_exec->operands.fmt_mvtc.f |
8e420152 | 2838 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2839 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2840 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2841 | EXTRACT_FMT_MVTC_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2842 | EXTRACT_FMT_MVTC_CODE | |
b8a9943d | 2843 | |
1148b104 DE |
2844 | { |
2845 | USI opval = OPRND (sr); | |
2846 | m32rx_h_cr_set (current_cpu, f_r1, opval); | |
2847 | TRACE_RESULT (current_cpu, "dcr", 'x', opval); | |
2848 | } | |
b8a9943d | 2849 | |
40c680ba DE |
2850 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2851 | ||
8e420152 DE |
2852 | #if WITH_PROFILE_MODEL_P |
2853 | if (PROFILE_MODEL_P (current_cpu)) | |
2854 | { | |
2855 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2856 | m32rx_model_profile_insn (current_cpu, abuf); | |
2857 | } | |
2858 | #endif | |
b8a9943d | 2859 | |
8e420152 DE |
2860 | return new_pc; |
2861 | #undef OPRND | |
8e420152 DE |
2862 | } |
2863 | ||
40c680ba DE |
2864 | /* neg: neg $dr,$sr. */ |
2865 | ||
8e420152 | 2866 | CIA |
dc4e95ad | 2867 | SEM_FN_NAME (m32rx,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2868 | { |
b8a9943d | 2869 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2870 | #define OPRND(f) par_exec->operands.fmt_mv.f |
8e420152 | 2871 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2872 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2873 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2874 | EXTRACT_FMT_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2875 | EXTRACT_FMT_MV_CODE | |
b8a9943d | 2876 | |
1148b104 DE |
2877 | { |
2878 | SI opval = NEGSI (OPRND (sr)); | |
2879 | CPU (h_gr[f_r1]) = opval; | |
2880 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2881 | } | |
b8a9943d | 2882 | |
40c680ba DE |
2883 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2884 | ||
8e420152 DE |
2885 | #if WITH_PROFILE_MODEL_P |
2886 | if (PROFILE_MODEL_P (current_cpu)) | |
2887 | { | |
2888 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2889 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2890 | m32rx_model_profile_insn (current_cpu, abuf); | |
2891 | } | |
2892 | #endif | |
b8a9943d | 2893 | |
8e420152 DE |
2894 | return new_pc; |
2895 | #undef OPRND | |
8e420152 DE |
2896 | } |
2897 | ||
40c680ba DE |
2898 | /* nop: nop. */ |
2899 | ||
8e420152 | 2900 | CIA |
dc4e95ad | 2901 | SEM_FN_NAME (m32rx,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2902 | { |
b8a9943d | 2903 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2904 | #define OPRND(f) par_exec->operands.fmt_nop.f |
8e420152 | 2905 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2906 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2907 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2908 | EXTRACT_FMT_NOP_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2909 | EXTRACT_FMT_NOP_CODE | |
b8a9943d | 2910 | |
8e420152 | 2911 | PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); |
b8a9943d | 2912 | |
40c680ba DE |
2913 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2914 | ||
8e420152 DE |
2915 | #if WITH_PROFILE_MODEL_P |
2916 | if (PROFILE_MODEL_P (current_cpu)) | |
2917 | { | |
2918 | m32rx_model_profile_insn (current_cpu, abuf); | |
2919 | } | |
2920 | #endif | |
b8a9943d | 2921 | |
8e420152 DE |
2922 | return new_pc; |
2923 | #undef OPRND | |
8e420152 DE |
2924 | } |
2925 | ||
40c680ba DE |
2926 | /* not: not $dr,$sr. */ |
2927 | ||
8e420152 | 2928 | CIA |
dc4e95ad | 2929 | SEM_FN_NAME (m32rx,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 2930 | { |
b8a9943d | 2931 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 2932 | #define OPRND(f) par_exec->operands.fmt_mv.f |
8e420152 | 2933 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2934 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2935 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2936 | EXTRACT_FMT_MV_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
2937 | EXTRACT_FMT_MV_CODE | |
b8a9943d | 2938 | |
1148b104 DE |
2939 | { |
2940 | SI opval = INVSI (OPRND (sr)); | |
2941 | CPU (h_gr[f_r1]) = opval; | |
2942 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2943 | } | |
b8a9943d | 2944 | |
40c680ba DE |
2945 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2946 | ||
8e420152 DE |
2947 | #if WITH_PROFILE_MODEL_P |
2948 | if (PROFILE_MODEL_P (current_cpu)) | |
2949 | { | |
2950 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
2951 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
2952 | m32rx_model_profile_insn (current_cpu, abuf); | |
2953 | } | |
2954 | #endif | |
8e420152 | 2955 | |
8e420152 DE |
2956 | return new_pc; |
2957 | #undef OPRND | |
8e420152 DE |
2958 | } |
2959 | ||
40c680ba DE |
2960 | /* rac-dsi: rac $accd,$accs,$imm1. */ |
2961 | ||
e0bd6e18 DE |
2962 | CIA |
2963 | SEM_FN_NAME (m32rx,rac_dsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) | |
2964 | { | |
2965 | insn_t insn = SEM_INSN (sem_arg); | |
e0a85af6 | 2966 | #define OPRND(f) par_exec->operands.fmt_rac_dsi.f |
e0bd6e18 | 2967 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2968 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 2969 | CIA UNUSED pc = PC; |
e0a85af6 DE |
2970 | EXTRACT_FMT_RAC_DSI_VARS /* f-op1 f-accd f-bits67 f-op2 f-accs f-bit14 f-imm1 */ |
2971 | EXTRACT_FMT_RAC_DSI_CODE | |
e0bd6e18 DE |
2972 | |
2973 | do { | |
2974 | DI tmp_tmp1; | |
2975 | tmp_tmp1 = SLLDI (OPRND (accs), OPRND (imm1)); | |
2976 | tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768)); | |
1148b104 DE |
2977 | { |
2978 | DI opval = (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000))); | |
2979 | m32rx_h_accums_set (current_cpu, f_accd, opval); | |
2980 | TRACE_RESULT (current_cpu, "accd", 'D', opval); | |
2981 | } | |
e0bd6e18 DE |
2982 | } while (0); |
2983 | ||
40c680ba DE |
2984 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2985 | ||
e0bd6e18 DE |
2986 | #if WITH_PROFILE_MODEL_P |
2987 | if (PROFILE_MODEL_P (current_cpu)) | |
2988 | { | |
2989 | m32rx_model_profile_insn (current_cpu, abuf); | |
2990 | } | |
2991 | #endif | |
2992 | ||
2993 | return new_pc; | |
2994 | #undef OPRND | |
2995 | } | |
2996 | ||
40c680ba DE |
2997 | /* rach-dsi: rach $accd,$accs,$imm1. */ |
2998 | ||
e0bd6e18 DE |
2999 | CIA |
3000 | SEM_FN_NAME (m32rx,rach_dsi) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) | |
3001 | { | |
3002 | insn_t insn = SEM_INSN (sem_arg); | |
e0a85af6 | 3003 | #define OPRND(f) par_exec->operands.fmt_rac_dsi.f |
e0bd6e18 | 3004 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3005 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3006 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3007 | EXTRACT_FMT_RAC_DSI_VARS /* f-op1 f-accd f-bits67 f-op2 f-accs f-bit14 f-imm1 */ |
3008 | EXTRACT_FMT_RAC_DSI_CODE | |
e0bd6e18 DE |
3009 | |
3010 | do { | |
3011 | DI tmp_tmp1; | |
3012 | tmp_tmp1 = SLLDI (OPRND (accs), OPRND (imm1)); | |
3013 | tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 0x80000000)); | |
1148b104 DE |
3014 | { |
3015 | DI opval = (GTDI (tmp_tmp1, MAKEDI (32767, 0))) ? (MAKEDI (32767, 0)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0))); | |
3016 | m32rx_h_accums_set (current_cpu, f_accd, opval); | |
3017 | TRACE_RESULT (current_cpu, "accd", 'D', opval); | |
3018 | } | |
8e420152 | 3019 | } while (0); |
b8a9943d | 3020 | |
40c680ba DE |
3021 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3022 | ||
8e420152 DE |
3023 | #if WITH_PROFILE_MODEL_P |
3024 | if (PROFILE_MODEL_P (current_cpu)) | |
3025 | { | |
3026 | m32rx_model_profile_insn (current_cpu, abuf); | |
3027 | } | |
3028 | #endif | |
b8a9943d | 3029 | |
8e420152 DE |
3030 | return new_pc; |
3031 | #undef OPRND | |
8e420152 DE |
3032 | } |
3033 | ||
40c680ba DE |
3034 | /* rte: rte. */ |
3035 | ||
8e420152 | 3036 | CIA |
dc4e95ad | 3037 | SEM_FN_NAME (m32rx,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3038 | { |
b8a9943d | 3039 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3040 | #define OPRND(f) par_exec->operands.fmt_rte.f |
8e420152 | 3041 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3042 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 3043 | int taken_p = 0; |
431e4f86 | 3044 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3045 | EXTRACT_FMT_RTE_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3046 | EXTRACT_FMT_RTE_CODE | |
b8a9943d | 3047 | |
8e420152 | 3048 | do { |
1148b104 DE |
3049 | { |
3050 | UBI opval = OPRND (h_bsm_0); | |
3051 | CPU (h_sm) = opval; | |
3052 | TRACE_RESULT (current_cpu, "sm-0", 'x', opval); | |
3053 | } | |
3054 | { | |
3055 | UBI opval = OPRND (h_bie_0); | |
3056 | CPU (h_ie) = opval; | |
3057 | TRACE_RESULT (current_cpu, "ie-0", 'x', opval); | |
3058 | } | |
3059 | { | |
3060 | UBI opval = OPRND (h_bcond_0); | |
3061 | CPU (h_cond) = opval; | |
3062 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
3063 | } | |
3064 | { | |
3065 | USI opval = ANDSI (OPRND (h_bpc_0), -4); | |
3066 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
3067 | taken_p = 1; | |
3068 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
3069 | } | |
8e420152 | 3070 | } while (0); |
b8a9943d | 3071 | |
40c680ba DE |
3072 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3073 | ||
8e420152 DE |
3074 | #if WITH_PROFILE_MODEL_P |
3075 | if (PROFILE_MODEL_P (current_cpu)) | |
3076 | { | |
3077 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
3078 | } | |
3079 | #endif | |
b8a9943d | 3080 | |
8e420152 DE |
3081 | return new_pc; |
3082 | #undef OPRND | |
8e420152 DE |
3083 | } |
3084 | ||
40c680ba DE |
3085 | /* seth: seth $dr,$hash$hi16. */ |
3086 | ||
8e420152 | 3087 | CIA |
dc4e95ad | 3088 | SEM_FN_NAME (m32rx,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3089 | { |
b8a9943d | 3090 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3091 | #define OPRND(f) par_exec->operands.fmt_seth.f |
8e420152 | 3092 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3093 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3094 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3095 | EXTRACT_FMT_SETH_VARS /* f-op1 f-r1 f-op2 f-r2 f-hi16 */ |
3096 | EXTRACT_FMT_SETH_CODE | |
b8a9943d | 3097 | |
1148b104 DE |
3098 | { |
3099 | SI opval = SLLSI (OPRND (hi16), 16); | |
3100 | CPU (h_gr[f_r1]) = opval; | |
3101 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3102 | } | |
b8a9943d | 3103 | |
40c680ba DE |
3104 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3105 | ||
8e420152 DE |
3106 | #if WITH_PROFILE_MODEL_P |
3107 | if (PROFILE_MODEL_P (current_cpu)) | |
3108 | { | |
3109 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3110 | m32rx_model_profile_insn (current_cpu, abuf); | |
3111 | } | |
3112 | #endif | |
b8a9943d | 3113 | |
8e420152 DE |
3114 | return new_pc; |
3115 | #undef OPRND | |
8e420152 DE |
3116 | } |
3117 | ||
40c680ba DE |
3118 | /* sll: sll $dr,$sr. */ |
3119 | ||
8e420152 | 3120 | CIA |
dc4e95ad | 3121 | SEM_FN_NAME (m32rx,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3122 | { |
b8a9943d | 3123 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3124 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 3125 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3126 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3127 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3128 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3129 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 3130 | |
1148b104 DE |
3131 | { |
3132 | SI opval = SLLSI (OPRND (dr), ANDSI (OPRND (sr), 31)); | |
3133 | CPU (h_gr[f_r1]) = opval; | |
3134 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3135 | } | |
b8a9943d | 3136 | |
40c680ba DE |
3137 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3138 | ||
8e420152 DE |
3139 | #if WITH_PROFILE_MODEL_P |
3140 | if (PROFILE_MODEL_P (current_cpu)) | |
3141 | { | |
3142 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3143 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3144 | m32rx_model_profile_insn (current_cpu, abuf); | |
3145 | } | |
3146 | #endif | |
b8a9943d | 3147 | |
8e420152 DE |
3148 | return new_pc; |
3149 | #undef OPRND | |
8e420152 DE |
3150 | } |
3151 | ||
40c680ba DE |
3152 | /* sll3: sll3 $dr,$sr,$simm16. */ |
3153 | ||
8e420152 | 3154 | CIA |
dc4e95ad | 3155 | SEM_FN_NAME (m32rx,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3156 | { |
b8a9943d | 3157 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3158 | #define OPRND(f) par_exec->operands.fmt_sll3.f |
8e420152 | 3159 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3160 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3161 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3162 | EXTRACT_FMT_SLL3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
3163 | EXTRACT_FMT_SLL3_CODE | |
b8a9943d | 3164 | |
1148b104 DE |
3165 | { |
3166 | SI opval = SLLSI (OPRND (sr), ANDSI (OPRND (simm16), 31)); | |
3167 | CPU (h_gr[f_r1]) = opval; | |
3168 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3169 | } | |
b8a9943d | 3170 | |
40c680ba DE |
3171 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3172 | ||
8e420152 DE |
3173 | #if WITH_PROFILE_MODEL_P |
3174 | if (PROFILE_MODEL_P (current_cpu)) | |
3175 | { | |
3176 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3177 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3178 | m32rx_model_profile_insn (current_cpu, abuf); | |
3179 | } | |
3180 | #endif | |
b8a9943d | 3181 | |
8e420152 DE |
3182 | return new_pc; |
3183 | #undef OPRND | |
8e420152 DE |
3184 | } |
3185 | ||
40c680ba DE |
3186 | /* slli: slli $dr,$uimm5. */ |
3187 | ||
8e420152 | 3188 | CIA |
dc4e95ad | 3189 | SEM_FN_NAME (m32rx,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3190 | { |
b8a9943d | 3191 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3192 | #define OPRND(f) par_exec->operands.fmt_slli.f |
8e420152 | 3193 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3194 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3195 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3196 | EXTRACT_FMT_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */ |
3197 | EXTRACT_FMT_SLLI_CODE | |
b8a9943d | 3198 | |
1148b104 DE |
3199 | { |
3200 | SI opval = SLLSI (OPRND (dr), OPRND (uimm5)); | |
3201 | CPU (h_gr[f_r1]) = opval; | |
3202 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3203 | } | |
b8a9943d | 3204 | |
40c680ba DE |
3205 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3206 | ||
8e420152 DE |
3207 | #if WITH_PROFILE_MODEL_P |
3208 | if (PROFILE_MODEL_P (current_cpu)) | |
3209 | { | |
3210 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3211 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3212 | m32rx_model_profile_insn (current_cpu, abuf); | |
3213 | } | |
3214 | #endif | |
b8a9943d | 3215 | |
8e420152 DE |
3216 | return new_pc; |
3217 | #undef OPRND | |
8e420152 DE |
3218 | } |
3219 | ||
40c680ba DE |
3220 | /* sra: sra $dr,$sr. */ |
3221 | ||
8e420152 | 3222 | CIA |
dc4e95ad | 3223 | SEM_FN_NAME (m32rx,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3224 | { |
b8a9943d | 3225 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3226 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 3227 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3228 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3229 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3230 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3231 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 3232 | |
1148b104 DE |
3233 | { |
3234 | SI opval = SRASI (OPRND (dr), ANDSI (OPRND (sr), 31)); | |
3235 | CPU (h_gr[f_r1]) = opval; | |
3236 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3237 | } | |
b8a9943d | 3238 | |
40c680ba DE |
3239 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3240 | ||
8e420152 DE |
3241 | #if WITH_PROFILE_MODEL_P |
3242 | if (PROFILE_MODEL_P (current_cpu)) | |
3243 | { | |
3244 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3245 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3246 | m32rx_model_profile_insn (current_cpu, abuf); | |
3247 | } | |
3248 | #endif | |
b8a9943d | 3249 | |
8e420152 DE |
3250 | return new_pc; |
3251 | #undef OPRND | |
8e420152 DE |
3252 | } |
3253 | ||
40c680ba DE |
3254 | /* sra3: sra3 $dr,$sr,$simm16. */ |
3255 | ||
8e420152 | 3256 | CIA |
dc4e95ad | 3257 | SEM_FN_NAME (m32rx,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3258 | { |
b8a9943d | 3259 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3260 | #define OPRND(f) par_exec->operands.fmt_sll3.f |
8e420152 | 3261 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3262 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3263 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3264 | EXTRACT_FMT_SLL3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
3265 | EXTRACT_FMT_SLL3_CODE | |
b8a9943d | 3266 | |
1148b104 DE |
3267 | { |
3268 | SI opval = SRASI (OPRND (sr), ANDSI (OPRND (simm16), 31)); | |
3269 | CPU (h_gr[f_r1]) = opval; | |
3270 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3271 | } | |
b8a9943d | 3272 | |
40c680ba DE |
3273 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3274 | ||
8e420152 DE |
3275 | #if WITH_PROFILE_MODEL_P |
3276 | if (PROFILE_MODEL_P (current_cpu)) | |
3277 | { | |
3278 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3279 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3280 | m32rx_model_profile_insn (current_cpu, abuf); | |
3281 | } | |
3282 | #endif | |
b8a9943d | 3283 | |
8e420152 DE |
3284 | return new_pc; |
3285 | #undef OPRND | |
8e420152 DE |
3286 | } |
3287 | ||
40c680ba DE |
3288 | /* srai: srai $dr,$uimm5. */ |
3289 | ||
8e420152 | 3290 | CIA |
dc4e95ad | 3291 | SEM_FN_NAME (m32rx,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3292 | { |
b8a9943d | 3293 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3294 | #define OPRND(f) par_exec->operands.fmt_slli.f |
8e420152 | 3295 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3296 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3297 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3298 | EXTRACT_FMT_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */ |
3299 | EXTRACT_FMT_SLLI_CODE | |
b8a9943d | 3300 | |
1148b104 DE |
3301 | { |
3302 | SI opval = SRASI (OPRND (dr), OPRND (uimm5)); | |
3303 | CPU (h_gr[f_r1]) = opval; | |
3304 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3305 | } | |
b8a9943d | 3306 | |
40c680ba DE |
3307 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3308 | ||
8e420152 DE |
3309 | #if WITH_PROFILE_MODEL_P |
3310 | if (PROFILE_MODEL_P (current_cpu)) | |
3311 | { | |
3312 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3313 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3314 | m32rx_model_profile_insn (current_cpu, abuf); | |
3315 | } | |
3316 | #endif | |
b8a9943d | 3317 | |
8e420152 DE |
3318 | return new_pc; |
3319 | #undef OPRND | |
8e420152 DE |
3320 | } |
3321 | ||
40c680ba DE |
3322 | /* srl: srl $dr,$sr. */ |
3323 | ||
8e420152 | 3324 | CIA |
dc4e95ad | 3325 | SEM_FN_NAME (m32rx,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3326 | { |
b8a9943d | 3327 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3328 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 3329 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3330 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3331 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3332 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3333 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 3334 | |
1148b104 DE |
3335 | { |
3336 | SI opval = SRLSI (OPRND (dr), ANDSI (OPRND (sr), 31)); | |
3337 | CPU (h_gr[f_r1]) = opval; | |
3338 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3339 | } | |
b8a9943d | 3340 | |
40c680ba DE |
3341 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3342 | ||
8e420152 DE |
3343 | #if WITH_PROFILE_MODEL_P |
3344 | if (PROFILE_MODEL_P (current_cpu)) | |
3345 | { | |
3346 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3347 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3348 | m32rx_model_profile_insn (current_cpu, abuf); | |
3349 | } | |
3350 | #endif | |
b8a9943d | 3351 | |
8e420152 DE |
3352 | return new_pc; |
3353 | #undef OPRND | |
8e420152 DE |
3354 | } |
3355 | ||
40c680ba DE |
3356 | /* srl3: srl3 $dr,$sr,$simm16. */ |
3357 | ||
8e420152 | 3358 | CIA |
dc4e95ad | 3359 | SEM_FN_NAME (m32rx,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3360 | { |
b8a9943d | 3361 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3362 | #define OPRND(f) par_exec->operands.fmt_sll3.f |
8e420152 | 3363 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3364 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3365 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3366 | EXTRACT_FMT_SLL3_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
3367 | EXTRACT_FMT_SLL3_CODE | |
b8a9943d | 3368 | |
1148b104 DE |
3369 | { |
3370 | SI opval = SRLSI (OPRND (sr), ANDSI (OPRND (simm16), 31)); | |
3371 | CPU (h_gr[f_r1]) = opval; | |
3372 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3373 | } | |
b8a9943d | 3374 | |
40c680ba DE |
3375 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3376 | ||
8e420152 DE |
3377 | #if WITH_PROFILE_MODEL_P |
3378 | if (PROFILE_MODEL_P (current_cpu)) | |
3379 | { | |
3380 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3381 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3382 | m32rx_model_profile_insn (current_cpu, abuf); | |
3383 | } | |
3384 | #endif | |
b8a9943d | 3385 | |
8e420152 DE |
3386 | return new_pc; |
3387 | #undef OPRND | |
8e420152 DE |
3388 | } |
3389 | ||
40c680ba DE |
3390 | /* srli: srli $dr,$uimm5. */ |
3391 | ||
8e420152 | 3392 | CIA |
dc4e95ad | 3393 | SEM_FN_NAME (m32rx,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3394 | { |
b8a9943d | 3395 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3396 | #define OPRND(f) par_exec->operands.fmt_slli.f |
8e420152 | 3397 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3398 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3399 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3400 | EXTRACT_FMT_SLLI_VARS /* f-op1 f-r1 f-shift-op2 f-uimm5 */ |
3401 | EXTRACT_FMT_SLLI_CODE | |
b8a9943d | 3402 | |
1148b104 DE |
3403 | { |
3404 | SI opval = SRLSI (OPRND (dr), OPRND (uimm5)); | |
3405 | CPU (h_gr[f_r1]) = opval; | |
3406 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3407 | } | |
b8a9943d | 3408 | |
40c680ba DE |
3409 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3410 | ||
8e420152 DE |
3411 | #if WITH_PROFILE_MODEL_P |
3412 | if (PROFILE_MODEL_P (current_cpu)) | |
3413 | { | |
3414 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3415 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3416 | m32rx_model_profile_insn (current_cpu, abuf); | |
3417 | } | |
3418 | #endif | |
b8a9943d | 3419 | |
8e420152 DE |
3420 | return new_pc; |
3421 | #undef OPRND | |
8e420152 DE |
3422 | } |
3423 | ||
40c680ba DE |
3424 | /* st: st $src1,@$src2. */ |
3425 | ||
8e420152 | 3426 | CIA |
dc4e95ad | 3427 | SEM_FN_NAME (m32rx,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3428 | { |
b8a9943d | 3429 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3430 | #define OPRND(f) par_exec->operands.fmt_st.f |
8e420152 | 3431 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3432 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3433 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3434 | EXTRACT_FMT_ST_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3435 | EXTRACT_FMT_ST_CODE | |
b8a9943d | 3436 | |
1148b104 DE |
3437 | { |
3438 | SI opval = OPRND (src1); | |
3439 | SETMEMSI (current_cpu, OPRND (src2), opval); | |
3440 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3441 | } | |
b8a9943d | 3442 | |
40c680ba DE |
3443 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3444 | ||
8e420152 DE |
3445 | #if WITH_PROFILE_MODEL_P |
3446 | if (PROFILE_MODEL_P (current_cpu)) | |
3447 | { | |
3448 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3449 | m32rx_model_profile_insn (current_cpu, abuf); | |
3450 | } | |
3451 | #endif | |
b8a9943d | 3452 | |
8e420152 DE |
3453 | return new_pc; |
3454 | #undef OPRND | |
8e420152 DE |
3455 | } |
3456 | ||
40c680ba DE |
3457 | /* st-d: st $src1,@($slo16,$src2). */ |
3458 | ||
8e420152 | 3459 | CIA |
dc4e95ad | 3460 | SEM_FN_NAME (m32rx,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3461 | { |
b8a9943d | 3462 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3463 | #define OPRND(f) par_exec->operands.fmt_st_d.f |
8e420152 | 3464 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3465 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3466 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3467 | EXTRACT_FMT_ST_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
3468 | EXTRACT_FMT_ST_D_CODE | |
b8a9943d | 3469 | |
1148b104 DE |
3470 | { |
3471 | SI opval = OPRND (src1); | |
3472 | SETMEMSI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), opval); | |
3473 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3474 | } | |
b8a9943d | 3475 | |
40c680ba DE |
3476 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3477 | ||
8e420152 DE |
3478 | #if WITH_PROFILE_MODEL_P |
3479 | if (PROFILE_MODEL_P (current_cpu)) | |
3480 | { | |
3481 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3482 | m32rx_model_profile_insn (current_cpu, abuf); | |
3483 | } | |
3484 | #endif | |
b8a9943d | 3485 | |
8e420152 DE |
3486 | return new_pc; |
3487 | #undef OPRND | |
8e420152 DE |
3488 | } |
3489 | ||
40c680ba DE |
3490 | /* stb: stb $src1,@$src2. */ |
3491 | ||
8e420152 | 3492 | CIA |
dc4e95ad | 3493 | SEM_FN_NAME (m32rx,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3494 | { |
b8a9943d | 3495 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3496 | #define OPRND(f) par_exec->operands.fmt_stb.f |
8e420152 | 3497 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3498 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3499 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3500 | EXTRACT_FMT_STB_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3501 | EXTRACT_FMT_STB_CODE | |
b8a9943d | 3502 | |
1148b104 DE |
3503 | { |
3504 | QI opval = OPRND (src1); | |
3505 | SETMEMQI (current_cpu, OPRND (src2), opval); | |
3506 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3507 | } | |
b8a9943d | 3508 | |
40c680ba DE |
3509 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3510 | ||
8e420152 DE |
3511 | #if WITH_PROFILE_MODEL_P |
3512 | if (PROFILE_MODEL_P (current_cpu)) | |
3513 | { | |
3514 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3515 | m32rx_model_profile_insn (current_cpu, abuf); | |
3516 | } | |
3517 | #endif | |
b8a9943d | 3518 | |
8e420152 DE |
3519 | return new_pc; |
3520 | #undef OPRND | |
8e420152 DE |
3521 | } |
3522 | ||
40c680ba DE |
3523 | /* stb-d: stb $src1,@($slo16,$src2). */ |
3524 | ||
8e420152 | 3525 | CIA |
dc4e95ad | 3526 | SEM_FN_NAME (m32rx,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3527 | { |
b8a9943d | 3528 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3529 | #define OPRND(f) par_exec->operands.fmt_stb_d.f |
8e420152 | 3530 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3531 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3532 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3533 | EXTRACT_FMT_STB_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
3534 | EXTRACT_FMT_STB_D_CODE | |
b8a9943d | 3535 | |
1148b104 DE |
3536 | { |
3537 | QI opval = OPRND (src1); | |
3538 | SETMEMQI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), opval); | |
3539 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3540 | } | |
b8a9943d | 3541 | |
40c680ba DE |
3542 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3543 | ||
8e420152 DE |
3544 | #if WITH_PROFILE_MODEL_P |
3545 | if (PROFILE_MODEL_P (current_cpu)) | |
3546 | { | |
3547 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3548 | m32rx_model_profile_insn (current_cpu, abuf); | |
3549 | } | |
3550 | #endif | |
b8a9943d | 3551 | |
8e420152 DE |
3552 | return new_pc; |
3553 | #undef OPRND | |
8e420152 DE |
3554 | } |
3555 | ||
40c680ba DE |
3556 | /* sth: sth $src1,@$src2. */ |
3557 | ||
8e420152 | 3558 | CIA |
dc4e95ad | 3559 | SEM_FN_NAME (m32rx,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3560 | { |
b8a9943d | 3561 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3562 | #define OPRND(f) par_exec->operands.fmt_sth.f |
8e420152 | 3563 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3564 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3565 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3566 | EXTRACT_FMT_STH_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3567 | EXTRACT_FMT_STH_CODE | |
b8a9943d | 3568 | |
1148b104 DE |
3569 | { |
3570 | HI opval = OPRND (src1); | |
3571 | SETMEMHI (current_cpu, OPRND (src2), opval); | |
3572 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3573 | } | |
b8a9943d | 3574 | |
40c680ba DE |
3575 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3576 | ||
8e420152 DE |
3577 | #if WITH_PROFILE_MODEL_P |
3578 | if (PROFILE_MODEL_P (current_cpu)) | |
3579 | { | |
3580 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3581 | m32rx_model_profile_insn (current_cpu, abuf); | |
3582 | } | |
3583 | #endif | |
b8a9943d | 3584 | |
8e420152 DE |
3585 | return new_pc; |
3586 | #undef OPRND | |
8e420152 DE |
3587 | } |
3588 | ||
40c680ba DE |
3589 | /* sth-d: sth $src1,@($slo16,$src2). */ |
3590 | ||
8e420152 | 3591 | CIA |
dc4e95ad | 3592 | SEM_FN_NAME (m32rx,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3593 | { |
b8a9943d | 3594 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3595 | #define OPRND(f) par_exec->operands.fmt_sth_d.f |
8e420152 | 3596 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3597 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3598 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3599 | EXTRACT_FMT_STH_D_VARS /* f-op1 f-r1 f-op2 f-r2 f-simm16 */ |
3600 | EXTRACT_FMT_STH_D_CODE | |
b8a9943d | 3601 | |
1148b104 DE |
3602 | { |
3603 | HI opval = OPRND (src1); | |
3604 | SETMEMHI (current_cpu, ADDSI (OPRND (src2), OPRND (slo16)), opval); | |
3605 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3606 | } | |
b8a9943d | 3607 | |
40c680ba DE |
3608 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3609 | ||
8e420152 DE |
3610 | #if WITH_PROFILE_MODEL_P |
3611 | if (PROFILE_MODEL_P (current_cpu)) | |
3612 | { | |
3613 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3614 | m32rx_model_profile_insn (current_cpu, abuf); | |
3615 | } | |
3616 | #endif | |
b8a9943d | 3617 | |
8e420152 DE |
3618 | return new_pc; |
3619 | #undef OPRND | |
8e420152 DE |
3620 | } |
3621 | ||
40c680ba DE |
3622 | /* st-plus: st $src1,@+$src2. */ |
3623 | ||
8e420152 | 3624 | CIA |
dc4e95ad | 3625 | SEM_FN_NAME (m32rx,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3626 | { |
b8a9943d | 3627 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3628 | #define OPRND(f) par_exec->operands.fmt_st_plus.f |
8e420152 | 3629 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3630 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3631 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3632 | EXTRACT_FMT_ST_PLUS_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3633 | EXTRACT_FMT_ST_PLUS_CODE | |
b8a9943d | 3634 | |
8e420152 | 3635 | do { |
02310b01 DE |
3636 | SI tmp_new_src2; |
3637 | tmp_new_src2 = ADDSI (OPRND (src2), 4); | |
1148b104 DE |
3638 | { |
3639 | SI opval = OPRND (src1); | |
3640 | SETMEMSI (current_cpu, tmp_new_src2, opval); | |
3641 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3642 | } | |
3643 | { | |
3644 | SI opval = tmp_new_src2; | |
3645 | CPU (h_gr[f_r2]) = opval; | |
3646 | TRACE_RESULT (current_cpu, "src2", 'x', opval); | |
3647 | } | |
8e420152 | 3648 | } while (0); |
b8a9943d | 3649 | |
40c680ba DE |
3650 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3651 | ||
8e420152 DE |
3652 | #if WITH_PROFILE_MODEL_P |
3653 | if (PROFILE_MODEL_P (current_cpu)) | |
3654 | { | |
3655 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
b8641a4d | 3656 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
3657 | m32rx_model_profile_insn (current_cpu, abuf); |
3658 | } | |
3659 | #endif | |
b8a9943d | 3660 | |
8e420152 DE |
3661 | return new_pc; |
3662 | #undef OPRND | |
8e420152 DE |
3663 | } |
3664 | ||
40c680ba DE |
3665 | /* st-minus: st $src1,@-$src2. */ |
3666 | ||
8e420152 | 3667 | CIA |
dc4e95ad | 3668 | SEM_FN_NAME (m32rx,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3669 | { |
b8a9943d | 3670 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3671 | #define OPRND(f) par_exec->operands.fmt_st_plus.f |
8e420152 | 3672 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3673 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3674 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3675 | EXTRACT_FMT_ST_PLUS_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3676 | EXTRACT_FMT_ST_PLUS_CODE | |
b8a9943d | 3677 | |
8e420152 | 3678 | do { |
02310b01 DE |
3679 | SI tmp_new_src2; |
3680 | tmp_new_src2 = SUBSI (OPRND (src2), 4); | |
1148b104 DE |
3681 | { |
3682 | SI opval = OPRND (src1); | |
3683 | SETMEMSI (current_cpu, tmp_new_src2, opval); | |
3684 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3685 | } | |
3686 | { | |
3687 | SI opval = tmp_new_src2; | |
3688 | CPU (h_gr[f_r2]) = opval; | |
3689 | TRACE_RESULT (current_cpu, "src2", 'x', opval); | |
3690 | } | |
8e420152 | 3691 | } while (0); |
b8a9943d | 3692 | |
40c680ba DE |
3693 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3694 | ||
8e420152 DE |
3695 | #if WITH_PROFILE_MODEL_P |
3696 | if (PROFILE_MODEL_P (current_cpu)) | |
3697 | { | |
3698 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
b8641a4d | 3699 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
8e420152 DE |
3700 | m32rx_model_profile_insn (current_cpu, abuf); |
3701 | } | |
3702 | #endif | |
b8a9943d | 3703 | |
8e420152 DE |
3704 | return new_pc; |
3705 | #undef OPRND | |
8e420152 DE |
3706 | } |
3707 | ||
40c680ba DE |
3708 | /* sub: sub $dr,$sr. */ |
3709 | ||
8e420152 | 3710 | CIA |
dc4e95ad | 3711 | SEM_FN_NAME (m32rx,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3712 | { |
b8a9943d | 3713 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3714 | #define OPRND(f) par_exec->operands.fmt_add.f |
8e420152 | 3715 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3716 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3717 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3718 | EXTRACT_FMT_ADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3719 | EXTRACT_FMT_ADD_CODE | |
b8a9943d | 3720 | |
1148b104 DE |
3721 | { |
3722 | SI opval = SUBSI (OPRND (dr), OPRND (sr)); | |
3723 | CPU (h_gr[f_r1]) = opval; | |
3724 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3725 | } | |
b8a9943d | 3726 | |
40c680ba DE |
3727 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3728 | ||
8e420152 DE |
3729 | #if WITH_PROFILE_MODEL_P |
3730 | if (PROFILE_MODEL_P (current_cpu)) | |
3731 | { | |
3732 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3733 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3734 | m32rx_model_profile_insn (current_cpu, abuf); | |
3735 | } | |
3736 | #endif | |
b8a9943d | 3737 | |
8e420152 DE |
3738 | return new_pc; |
3739 | #undef OPRND | |
8e420152 DE |
3740 | } |
3741 | ||
40c680ba DE |
3742 | /* subv: subv $dr,$sr. */ |
3743 | ||
8e420152 | 3744 | CIA |
dc4e95ad | 3745 | SEM_FN_NAME (m32rx,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3746 | { |
b8a9943d | 3747 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3748 | #define OPRND(f) par_exec->operands.fmt_addv.f |
8e420152 | 3749 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3750 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3751 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3752 | EXTRACT_FMT_ADDV_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3753 | EXTRACT_FMT_ADDV_CODE | |
b8a9943d | 3754 | |
8e420152 | 3755 | do { |
a040908c | 3756 | UBI temp1;SI temp0; |
8e420152 DE |
3757 | temp0 = SUBSI (OPRND (dr), OPRND (sr)); |
3758 | temp1 = SUBOFSI (OPRND (dr), OPRND (sr), 0); | |
1148b104 DE |
3759 | { |
3760 | SI opval = temp0; | |
3761 | CPU (h_gr[f_r1]) = opval; | |
3762 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3763 | } | |
3764 | { | |
3765 | UBI opval = temp1; | |
3766 | CPU (h_cond) = opval; | |
3767 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
3768 | } | |
8e420152 | 3769 | } while (0); |
b8a9943d | 3770 | |
40c680ba DE |
3771 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3772 | ||
8e420152 DE |
3773 | #if WITH_PROFILE_MODEL_P |
3774 | if (PROFILE_MODEL_P (current_cpu)) | |
3775 | { | |
3776 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3777 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3778 | m32rx_model_profile_insn (current_cpu, abuf); | |
3779 | } | |
3780 | #endif | |
b8a9943d | 3781 | |
8e420152 DE |
3782 | return new_pc; |
3783 | #undef OPRND | |
8e420152 DE |
3784 | } |
3785 | ||
40c680ba DE |
3786 | /* subx: subx $dr,$sr. */ |
3787 | ||
8e420152 | 3788 | CIA |
dc4e95ad | 3789 | SEM_FN_NAME (m32rx,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3790 | { |
b8a9943d | 3791 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3792 | #define OPRND(f) par_exec->operands.fmt_addx.f |
8e420152 | 3793 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3794 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3795 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3796 | EXTRACT_FMT_ADDX_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3797 | EXTRACT_FMT_ADDX_CODE | |
b8a9943d | 3798 | |
8e420152 | 3799 | do { |
a040908c | 3800 | UBI temp1;SI temp0; |
8e420152 DE |
3801 | temp0 = SUBCSI (OPRND (dr), OPRND (sr), OPRND (condbit)); |
3802 | temp1 = SUBCFSI (OPRND (dr), OPRND (sr), OPRND (condbit)); | |
1148b104 DE |
3803 | { |
3804 | SI opval = temp0; | |
3805 | CPU (h_gr[f_r1]) = opval; | |
3806 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3807 | } | |
3808 | { | |
3809 | UBI opval = temp1; | |
3810 | CPU (h_cond) = opval; | |
3811 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
3812 | } | |
8e420152 | 3813 | } while (0); |
b8a9943d | 3814 | |
40c680ba DE |
3815 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3816 | ||
8e420152 DE |
3817 | #if WITH_PROFILE_MODEL_P |
3818 | if (PROFILE_MODEL_P (current_cpu)) | |
3819 | { | |
3820 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3821 | m32rx_model_mark_set_h_gr (current_cpu, abuf); | |
3822 | m32rx_model_profile_insn (current_cpu, abuf); | |
3823 | } | |
3824 | #endif | |
b8a9943d | 3825 | |
8e420152 DE |
3826 | return new_pc; |
3827 | #undef OPRND | |
8e420152 DE |
3828 | } |
3829 | ||
40c680ba DE |
3830 | /* trap: trap $uimm4. */ |
3831 | ||
8e420152 | 3832 | CIA |
dc4e95ad | 3833 | SEM_FN_NAME (m32rx,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3834 | { |
b8a9943d | 3835 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3836 | #define OPRND(f) par_exec->operands.fmt_trap.f |
8e420152 | 3837 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3838 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
8e420152 | 3839 | int taken_p = 0; |
431e4f86 | 3840 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3841 | EXTRACT_FMT_TRAP_VARS /* f-op1 f-r1 f-op2 f-uimm4 */ |
3842 | EXTRACT_FMT_TRAP_CODE | |
b8a9943d | 3843 | |
cab58155 | 3844 | do { |
1148b104 DE |
3845 | { |
3846 | USI opval = ADDSI (OPRND (pc), 4); | |
3847 | m32rx_h_cr_set (current_cpu, ((HOSTUINT) 6), opval); | |
3848 | TRACE_RESULT (current_cpu, "cr-6", 'x', opval); | |
3849 | } | |
3850 | { | |
3851 | USI opval = ANDSI (SLLSI (OPRND (h_cr_0), 8), 65408); | |
3852 | m32rx_h_cr_set (current_cpu, ((HOSTUINT) 0), opval); | |
3853 | TRACE_RESULT (current_cpu, "cr-0", 'x', opval); | |
3854 | } | |
3855 | { | |
190659a2 | 3856 | SI opval = m32r_trap (current_cpu, OPRND (pc), OPRND (uimm4)); |
1148b104 DE |
3857 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); |
3858 | taken_p = 1; | |
3859 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
3860 | } | |
cab58155 | 3861 | } while (0); |
b8a9943d | 3862 | |
40c680ba DE |
3863 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3864 | ||
8e420152 DE |
3865 | #if WITH_PROFILE_MODEL_P |
3866 | if (PROFILE_MODEL_P (current_cpu)) | |
3867 | { | |
3868 | m32rx_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
3869 | } | |
3870 | #endif | |
b8a9943d | 3871 | |
8e420152 DE |
3872 | return new_pc; |
3873 | #undef OPRND | |
8e420152 DE |
3874 | } |
3875 | ||
40c680ba DE |
3876 | /* unlock: unlock $src1,@$src2. */ |
3877 | ||
8e420152 | 3878 | CIA |
dc4e95ad | 3879 | SEM_FN_NAME (m32rx,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3880 | { |
b8a9943d | 3881 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3882 | #define OPRND(f) par_exec->operands.fmt_unlock.f |
8e420152 | 3883 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3884 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 3885 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3886 | EXTRACT_FMT_UNLOCK_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
3887 | EXTRACT_FMT_UNLOCK_CODE | |
b8a9943d | 3888 | |
cab58155 DE |
3889 | do { |
3890 | if (OPRND (h_lock_0)) { | |
1148b104 DE |
3891 | { |
3892 | SI opval = OPRND (src1); | |
3893 | SETMEMSI (current_cpu, OPRND (src2), opval); | |
3894 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3895 | } | |
3896 | } | |
3897 | { | |
3898 | UBI opval = 0; | |
3899 | CPU (h_lock) = opval; | |
3900 | TRACE_RESULT (current_cpu, "lock-0", 'x', opval); | |
3901 | } | |
cab58155 | 3902 | } while (0); |
b8a9943d | 3903 | |
40c680ba DE |
3904 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3905 | ||
8e420152 DE |
3906 | #if WITH_PROFILE_MODEL_P |
3907 | if (PROFILE_MODEL_P (current_cpu)) | |
3908 | { | |
3909 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
3910 | m32rx_model_profile_insn (current_cpu, abuf); | |
3911 | } | |
3912 | #endif | |
b8a9943d | 3913 | |
8e420152 DE |
3914 | return new_pc; |
3915 | #undef OPRND | |
8e420152 DE |
3916 | } |
3917 | ||
40c680ba DE |
3918 | /* satb: satb $dr,$sr. */ |
3919 | ||
8e420152 | 3920 | CIA |
dc4e95ad | 3921 | SEM_FN_NAME (m32rx,satb) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3922 | { |
b8a9943d | 3923 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3924 | #define OPRND(f) par_exec->operands.fmt_satb.f |
8e420152 | 3925 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3926 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3927 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3928 | EXTRACT_FMT_SATB_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */ |
3929 | EXTRACT_FMT_SATB_CODE | |
b8a9943d | 3930 | |
1148b104 DE |
3931 | { |
3932 | SI opval = (GESI (OPRND (sr), 127)) ? (127) : (LESI (OPRND (sr), -128)) ? (-128) : (OPRND (sr)); | |
3933 | CPU (h_gr[f_r1]) = opval; | |
3934 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3935 | } | |
b8a9943d | 3936 | |
40c680ba DE |
3937 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3938 | ||
8e420152 DE |
3939 | #if WITH_PROFILE_MODEL_P |
3940 | if (PROFILE_MODEL_P (current_cpu)) | |
3941 | { | |
b8a9943d | 3942 | m32rx_model_mark_get_h_gr (current_cpu, abuf); |
8e420152 DE |
3943 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
3944 | m32rx_model_profile_insn (current_cpu, abuf); | |
3945 | } | |
3946 | #endif | |
b8a9943d | 3947 | |
8e420152 DE |
3948 | return new_pc; |
3949 | #undef OPRND | |
8e420152 DE |
3950 | } |
3951 | ||
40c680ba DE |
3952 | /* sath: sath $dr,$sr. */ |
3953 | ||
8e420152 | 3954 | CIA |
dc4e95ad | 3955 | SEM_FN_NAME (m32rx,sath) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3956 | { |
b8a9943d | 3957 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3958 | #define OPRND(f) par_exec->operands.fmt_satb.f |
8e420152 | 3959 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3960 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3961 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3962 | EXTRACT_FMT_SATB_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */ |
3963 | EXTRACT_FMT_SATB_CODE | |
b8a9943d | 3964 | |
1148b104 DE |
3965 | { |
3966 | SI opval = (GESI (OPRND (sr), 32767)) ? (32767) : (LESI (OPRND (sr), -32768)) ? (-32768) : (OPRND (sr)); | |
3967 | CPU (h_gr[f_r1]) = opval; | |
3968 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3969 | } | |
b8a9943d | 3970 | |
40c680ba DE |
3971 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3972 | ||
8e420152 DE |
3973 | #if WITH_PROFILE_MODEL_P |
3974 | if (PROFILE_MODEL_P (current_cpu)) | |
3975 | { | |
b8a9943d | 3976 | m32rx_model_mark_get_h_gr (current_cpu, abuf); |
8e420152 DE |
3977 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
3978 | m32rx_model_profile_insn (current_cpu, abuf); | |
3979 | } | |
3980 | #endif | |
b8a9943d | 3981 | |
8e420152 DE |
3982 | return new_pc; |
3983 | #undef OPRND | |
8e420152 DE |
3984 | } |
3985 | ||
40c680ba DE |
3986 | /* sat: sat $dr,$sr. */ |
3987 | ||
8e420152 | 3988 | CIA |
dc4e95ad | 3989 | SEM_FN_NAME (m32rx,sat) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 3990 | { |
b8a9943d | 3991 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 3992 | #define OPRND(f) par_exec->operands.fmt_sat.f |
8e420152 | 3993 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3994 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
431e4f86 | 3995 | CIA UNUSED pc = PC; |
e0a85af6 DE |
3996 | EXTRACT_FMT_SAT_VARS /* f-op1 f-r1 f-op2 f-r2 f-uimm16 */ |
3997 | EXTRACT_FMT_SAT_CODE | |
b8a9943d | 3998 | |
1148b104 DE |
3999 | { |
4000 | SI opval = ((OPRND (condbit)) ? (((LTSI (OPRND (sr), 0)) ? (2147483647) : (0x80000000))) : (OPRND (sr))); | |
4001 | CPU (h_gr[f_r1]) = opval; | |
4002 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
4003 | } | |
b8a9943d | 4004 | |
40c680ba DE |
4005 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4006 | ||
8e420152 DE |
4007 | #if WITH_PROFILE_MODEL_P |
4008 | if (PROFILE_MODEL_P (current_cpu)) | |
4009 | { | |
b8a9943d | 4010 | m32rx_model_mark_get_h_gr (current_cpu, abuf); |
8e420152 DE |
4011 | m32rx_model_mark_set_h_gr (current_cpu, abuf); |
4012 | m32rx_model_profile_insn (current_cpu, abuf); | |
4013 | } | |
4014 | #endif | |
b8a9943d | 4015 | |
8e420152 DE |
4016 | return new_pc; |
4017 | #undef OPRND | |
8e420152 DE |
4018 | } |
4019 | ||
40c680ba DE |
4020 | /* pcmpbz: pcmpbz $src2. */ |
4021 | ||
8e420152 | 4022 | CIA |
dc4e95ad | 4023 | SEM_FN_NAME (m32rx,pcmpbz) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4024 | { |
b8a9943d | 4025 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 4026 | #define OPRND(f) par_exec->operands.fmt_cmpz.f |
8e420152 | 4027 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4028 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4029 | CIA UNUSED pc = PC; |
e0a85af6 DE |
4030 | EXTRACT_FMT_CMPZ_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4031 | EXTRACT_FMT_CMPZ_CODE | |
b8a9943d | 4032 | |
1148b104 DE |
4033 | { |
4034 | UBI opval = (EQSI (ANDSI (OPRND (src2), 255), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2), 65280), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2), 16711680), 0)) ? (1) : (EQSI (ANDSI (OPRND (src2), 0xff000000), 0)) ? (1) : (0); | |
4035 | CPU (h_cond) = opval; | |
4036 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
4037 | } | |
b8a9943d | 4038 | |
40c680ba DE |
4039 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4040 | ||
8e420152 DE |
4041 | #if WITH_PROFILE_MODEL_P |
4042 | if (PROFILE_MODEL_P (current_cpu)) | |
4043 | { | |
b8a9943d | 4044 | m32rx_model_mark_get_h_gr (current_cpu, abuf); |
8e420152 DE |
4045 | m32rx_model_profile_insn (current_cpu, abuf); |
4046 | } | |
4047 | #endif | |
b8a9943d | 4048 | |
8e420152 DE |
4049 | return new_pc; |
4050 | #undef OPRND | |
8e420152 DE |
4051 | } |
4052 | ||
40c680ba DE |
4053 | /* sadd: sadd. */ |
4054 | ||
8e420152 | 4055 | CIA |
dc4e95ad | 4056 | SEM_FN_NAME (m32rx,sadd) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4057 | { |
b8a9943d | 4058 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 4059 | #define OPRND(f) par_exec->operands.fmt_sadd.f |
8e420152 | 4060 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4061 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4062 | CIA UNUSED pc = PC; |
e0a85af6 DE |
4063 | EXTRACT_FMT_SADD_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4064 | EXTRACT_FMT_SADD_CODE | |
b8a9943d | 4065 | |
1148b104 DE |
4066 | { |
4067 | DI opval = ADDDI (SRADI (OPRND (h_accums_1), 16), OPRND (h_accums_0)); | |
4068 | m32rx_h_accums_set (current_cpu, ((HOSTUINT) 0), opval); | |
4069 | TRACE_RESULT (current_cpu, "accums-0", 'D', opval); | |
4070 | } | |
b8a9943d | 4071 | |
40c680ba DE |
4072 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4073 | ||
8e420152 DE |
4074 | #if WITH_PROFILE_MODEL_P |
4075 | if (PROFILE_MODEL_P (current_cpu)) | |
4076 | { | |
4077 | m32rx_model_profile_insn (current_cpu, abuf); | |
4078 | } | |
4079 | #endif | |
b8a9943d | 4080 | |
8e420152 DE |
4081 | return new_pc; |
4082 | #undef OPRND | |
8e420152 DE |
4083 | } |
4084 | ||
40c680ba DE |
4085 | /* macwu1: macwu1 $src1,$src2. */ |
4086 | ||
8e420152 | 4087 | CIA |
dc4e95ad | 4088 | SEM_FN_NAME (m32rx,macwu1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4089 | { |
b8a9943d | 4090 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 4091 | #define OPRND(f) par_exec->operands.fmt_macwu1.f |
8e420152 | 4092 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4093 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4094 | CIA UNUSED pc = PC; |
e0a85af6 DE |
4095 | EXTRACT_FMT_MACWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4096 | EXTRACT_FMT_MACWU1_CODE | |
b8a9943d | 4097 | |
1148b104 DE |
4098 | { |
4099 | DI opval = SRADI (SLLDI (ADDDI (OPRND (h_accums_1), MULDI (EXTSIDI (OPRND (src1)), EXTSIDI (ANDSI (OPRND (src2), 65535)))), 8), 8); | |
4100 | m32rx_h_accums_set (current_cpu, ((HOSTUINT) 1), opval); | |
4101 | TRACE_RESULT (current_cpu, "accums-1", 'D', opval); | |
4102 | } | |
b8a9943d | 4103 | |
40c680ba DE |
4104 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4105 | ||
8e420152 DE |
4106 | #if WITH_PROFILE_MODEL_P |
4107 | if (PROFILE_MODEL_P (current_cpu)) | |
4108 | { | |
4109 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
4110 | m32rx_model_profile_insn (current_cpu, abuf); | |
4111 | } | |
4112 | #endif | |
b8a9943d | 4113 | |
8e420152 DE |
4114 | return new_pc; |
4115 | #undef OPRND | |
8e420152 DE |
4116 | } |
4117 | ||
40c680ba DE |
4118 | /* msblo: msblo $src1,$src2. */ |
4119 | ||
8e420152 | 4120 | CIA |
dc4e95ad | 4121 | SEM_FN_NAME (m32rx,msblo) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4122 | { |
b8a9943d | 4123 | insn_t insn = SEM_INSN (sem_arg); |
d846a17c | 4124 | #define OPRND(f) par_exec->operands.fmt_msblo.f |
8e420152 | 4125 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4126 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4127 | CIA UNUSED pc = PC; |
d846a17c DE |
4128 | EXTRACT_FMT_MSBLO_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4129 | EXTRACT_FMT_MSBLO_CODE | |
b8a9943d | 4130 | |
1148b104 DE |
4131 | { |
4132 | DI opval = SRADI (SLLDI (SUBDI (OPRND (accum), SRADI (SLLDI (MULDI (EXTHIDI (TRUNCSIHI (OPRND (src1))), EXTHIDI (TRUNCSIHI (OPRND (src2)))), 32), 16)), 8), 8); | |
4133 | m32rx_h_accum_set (current_cpu, opval); | |
4134 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
4135 | } | |
b8a9943d | 4136 | |
40c680ba DE |
4137 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4138 | ||
8e420152 DE |
4139 | #if WITH_PROFILE_MODEL_P |
4140 | if (PROFILE_MODEL_P (current_cpu)) | |
4141 | { | |
4142 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
4143 | m32rx_model_profile_insn (current_cpu, abuf); | |
4144 | } | |
4145 | #endif | |
b8a9943d | 4146 | |
8e420152 DE |
4147 | return new_pc; |
4148 | #undef OPRND | |
8e420152 DE |
4149 | } |
4150 | ||
40c680ba DE |
4151 | /* mulwu1: mulwu1 $src1,$src2. */ |
4152 | ||
8e420152 | 4153 | CIA |
dc4e95ad | 4154 | SEM_FN_NAME (m32rx,mulwu1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4155 | { |
b8a9943d | 4156 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 4157 | #define OPRND(f) par_exec->operands.fmt_mulwu1.f |
8e420152 | 4158 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4159 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4160 | CIA UNUSED pc = PC; |
e0a85af6 DE |
4161 | EXTRACT_FMT_MULWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4162 | EXTRACT_FMT_MULWU1_CODE | |
b8a9943d | 4163 | |
1148b104 DE |
4164 | { |
4165 | DI opval = SRADI (SLLDI (MULDI (EXTSIDI (OPRND (src1)), EXTSIDI (ANDSI (OPRND (src2), 65535))), 16), 16); | |
4166 | m32rx_h_accums_set (current_cpu, ((HOSTUINT) 1), opval); | |
4167 | TRACE_RESULT (current_cpu, "accums-1", 'D', opval); | |
4168 | } | |
b8a9943d | 4169 | |
40c680ba DE |
4170 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4171 | ||
8e420152 DE |
4172 | #if WITH_PROFILE_MODEL_P |
4173 | if (PROFILE_MODEL_P (current_cpu)) | |
4174 | { | |
4175 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
4176 | m32rx_model_profile_insn (current_cpu, abuf); | |
4177 | } | |
4178 | #endif | |
b8a9943d | 4179 | |
8e420152 DE |
4180 | return new_pc; |
4181 | #undef OPRND | |
8e420152 DE |
4182 | } |
4183 | ||
40c680ba DE |
4184 | /* maclh1: maclh1 $src1,$src2. */ |
4185 | ||
8e420152 | 4186 | CIA |
e0bd6e18 | 4187 | SEM_FN_NAME (m32rx,maclh1) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4188 | { |
b8a9943d | 4189 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 4190 | #define OPRND(f) par_exec->operands.fmt_macwu1.f |
8e420152 | 4191 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4192 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4193 | CIA UNUSED pc = PC; |
e0a85af6 DE |
4194 | EXTRACT_FMT_MACWU1_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4195 | EXTRACT_FMT_MACWU1_CODE | |
b8a9943d | 4196 | |
1148b104 DE |
4197 | { |
4198 | DI opval = SRADI (SLLDI (ADDDI (OPRND (h_accums_1), SLLDI (EXTSIDI (MULSI (EXTHISI (TRUNCSIHI (OPRND (src1))), SRASI (OPRND (src2), 16))), 16)), 8), 8); | |
4199 | m32rx_h_accums_set (current_cpu, ((HOSTUINT) 1), opval); | |
4200 | TRACE_RESULT (current_cpu, "accums-1", 'D', opval); | |
4201 | } | |
b8a9943d | 4202 | |
40c680ba DE |
4203 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4204 | ||
8e420152 DE |
4205 | #if WITH_PROFILE_MODEL_P |
4206 | if (PROFILE_MODEL_P (current_cpu)) | |
4207 | { | |
4208 | m32rx_model_mark_get_h_gr (current_cpu, abuf); | |
4209 | m32rx_model_profile_insn (current_cpu, abuf); | |
4210 | } | |
4211 | #endif | |
b8a9943d | 4212 | |
8e420152 DE |
4213 | return new_pc; |
4214 | #undef OPRND | |
8e420152 DE |
4215 | } |
4216 | ||
40c680ba DE |
4217 | /* sc: sc. */ |
4218 | ||
8e420152 | 4219 | CIA |
dc4e95ad | 4220 | SEM_FN_NAME (m32rx,sc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4221 | { |
b8a9943d | 4222 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 4223 | #define OPRND(f) par_exec->operands.fmt_sc.f |
8e420152 | 4224 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4225 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4226 | CIA UNUSED pc = PC; |
e0a85af6 DE |
4227 | EXTRACT_FMT_SC_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4228 | EXTRACT_FMT_SC_CODE | |
b8a9943d | 4229 | |
8e420152 | 4230 | if (OPRND (condbit)) { |
02310b01 | 4231 | BRANCH_NEW_PC (new_pc, NEW_PC_SKIP); |
8e420152 | 4232 | } |
b8a9943d | 4233 | |
40c680ba DE |
4234 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4235 | ||
8e420152 DE |
4236 | #if WITH_PROFILE_MODEL_P |
4237 | if (PROFILE_MODEL_P (current_cpu)) | |
4238 | { | |
4239 | m32rx_model_profile_insn (current_cpu, abuf); | |
4240 | } | |
4241 | #endif | |
b8a9943d | 4242 | |
8e420152 DE |
4243 | return new_pc; |
4244 | #undef OPRND | |
8e420152 DE |
4245 | } |
4246 | ||
40c680ba DE |
4247 | /* snc: snc. */ |
4248 | ||
8e420152 | 4249 | CIA |
dc4e95ad | 4250 | SEM_FN_NAME (m32rx,snc) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) |
8e420152 | 4251 | { |
b8a9943d | 4252 | insn_t insn = SEM_INSN (sem_arg); |
e0a85af6 | 4253 | #define OPRND(f) par_exec->operands.fmt_sc.f |
8e420152 | 4254 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 4255 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
431e4f86 | 4256 | CIA UNUSED pc = PC; |
e0a85af6 DE |
4257 | EXTRACT_FMT_SC_VARS /* f-op1 f-r1 f-op2 f-r2 */ |
4258 | EXTRACT_FMT_SC_CODE | |
b8a9943d | 4259 | |
8e420152 | 4260 | if (NOTBI (OPRND (condbit))) { |
02310b01 | 4261 | BRANCH_NEW_PC (new_pc, NEW_PC_SKIP); |
8e420152 | 4262 | } |
b8a9943d | 4263 | |
40c680ba DE |
4264 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
4265 | ||
8e420152 DE |
4266 | #if WITH_PROFILE_MODEL_P |
4267 | if (PROFILE_MODEL_P (current_cpu)) | |
4268 | { | |
4269 | m32rx_model_profile_insn (current_cpu, abuf); | |
4270 | } | |
4271 | #endif | |
b8a9943d | 4272 | |
8e420152 DE |
4273 | return new_pc; |
4274 | #undef OPRND | |
8e420152 DE |
4275 | } |
4276 | ||
dc4e95ad DE |
4277 | CIA |
4278 | SEM_FN_NAME (m32rx,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg, PAREXEC *par_exec) | |
8e420152 DE |
4279 | { |
4280 | sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/); | |
4281 | return 0; | |
4282 | } | |
4283 | ||
a040908c | 4284 | #endif /* WANT_CPU */ |