Commit | Line | Data |
---|---|---|
cbb38b47 BE |
1 | /* Simulator instruction semantics for sh64. |
2 | ||
3 | THIS FILE IS MACHINE GENERATED WITH CGEN. | |
4 | ||
5 | Copyright (C) 1996, 1997, 1998, 1999, 2000 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 sh64 | |
26 | #define WANT_CPU_SH64 | |
27 | ||
28 | #include "sim-main.h" | |
29 | #include "cgen-mem.h" | |
30 | #include "cgen-ops.h" | |
31 | ||
32 | #undef GET_ATTR | |
33 | #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) | |
34 | #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr) | |
35 | #else | |
36 | #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_/**/attr) | |
37 | #endif | |
38 | ||
39 | /* This is used so that we can compile two copies of the semantic code, | |
40 | one with full feature support and one without that runs fast(er). | |
41 | FAST_P, when desired, is defined on the command line, -DFAST_P=1. */ | |
42 | #if FAST_P | |
43 | #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn) | |
44 | #undef TRACE_RESULT | |
45 | #define TRACE_RESULT(cpu, abuf, name, type, val) | |
46 | #else | |
47 | #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn) | |
48 | #endif | |
49 | ||
50 | /* x-invalid: --invalid-- */ | |
51 | ||
52 | static SEM_PC | |
53 | SEM_FN_NAME (sh64_compact,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
54 | { | |
55 | #define FLD(f) abuf->fields.fmt_empty.f | |
56 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
57 | int UNUSED written = 0; | |
58 | IADDR UNUSED pc = abuf->addr; | |
59 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
60 | ||
61 | { | |
62 | /* Update the recorded pc in the cpu state struct. | |
63 | Only necessary for WITH_SCACHE case, but to avoid the | |
64 | conditional compilation .... */ | |
65 | SET_H_PC (pc); | |
66 | /* Virtual insns have zero size. Overwrite vpc with address of next insn | |
67 | using the default-insn-bitsize spec. When executing insns in parallel | |
68 | we may want to queue the fault and continue execution. */ | |
69 | vpc = SEM_NEXT_VPC (sem_arg, pc, 4); | |
70 | vpc = sim_engine_invalid_insn (current_cpu, pc, vpc); | |
71 | } | |
72 | ||
73 | return vpc; | |
74 | #undef FLD | |
75 | } | |
76 | ||
77 | /* x-after: --after-- */ | |
78 | ||
79 | static SEM_PC | |
80 | SEM_FN_NAME (sh64_compact,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
81 | { | |
82 | #define FLD(f) abuf->fields.fmt_empty.f | |
83 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
84 | int UNUSED written = 0; | |
85 | IADDR UNUSED pc = abuf->addr; | |
86 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
87 | ||
88 | { | |
89 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
90 | sh64_compact_pbb_after (current_cpu, sem_arg); | |
91 | #endif | |
92 | } | |
93 | ||
94 | return vpc; | |
95 | #undef FLD | |
96 | } | |
97 | ||
98 | /* x-before: --before-- */ | |
99 | ||
100 | static SEM_PC | |
101 | SEM_FN_NAME (sh64_compact,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
102 | { | |
103 | #define FLD(f) abuf->fields.fmt_empty.f | |
104 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
105 | int UNUSED written = 0; | |
106 | IADDR UNUSED pc = abuf->addr; | |
107 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
108 | ||
109 | { | |
110 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
111 | sh64_compact_pbb_before (current_cpu, sem_arg); | |
112 | #endif | |
113 | } | |
114 | ||
115 | return vpc; | |
116 | #undef FLD | |
117 | } | |
118 | ||
119 | /* x-cti-chain: --cti-chain-- */ | |
120 | ||
121 | static SEM_PC | |
122 | SEM_FN_NAME (sh64_compact,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
123 | { | |
124 | #define FLD(f) abuf->fields.fmt_empty.f | |
125 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
126 | int UNUSED written = 0; | |
127 | IADDR UNUSED pc = abuf->addr; | |
128 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
129 | ||
130 | { | |
131 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
132 | #ifdef DEFINE_SWITCH | |
133 | vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg, | |
134 | pbb_br_type, pbb_br_npc); | |
135 | BREAK (sem); | |
136 | #else | |
137 | /* FIXME: Allow provision of explicit ifmt spec in insn spec. */ | |
138 | vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg, | |
139 | CPU_PBB_BR_TYPE (current_cpu), | |
140 | CPU_PBB_BR_NPC (current_cpu)); | |
141 | #endif | |
142 | #endif | |
143 | } | |
144 | ||
145 | return vpc; | |
146 | #undef FLD | |
147 | } | |
148 | ||
149 | /* x-chain: --chain-- */ | |
150 | ||
151 | static SEM_PC | |
152 | SEM_FN_NAME (sh64_compact,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
153 | { | |
154 | #define FLD(f) abuf->fields.fmt_empty.f | |
155 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
156 | int UNUSED written = 0; | |
157 | IADDR UNUSED pc = abuf->addr; | |
158 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
159 | ||
160 | { | |
161 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
162 | vpc = sh64_compact_pbb_chain (current_cpu, sem_arg); | |
163 | #ifdef DEFINE_SWITCH | |
164 | BREAK (sem); | |
165 | #endif | |
166 | #endif | |
167 | } | |
168 | ||
169 | return vpc; | |
170 | #undef FLD | |
171 | } | |
172 | ||
173 | /* x-begin: --begin-- */ | |
174 | ||
175 | static SEM_PC | |
176 | SEM_FN_NAME (sh64_compact,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
177 | { | |
178 | #define FLD(f) abuf->fields.fmt_empty.f | |
179 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
180 | int UNUSED written = 0; | |
181 | IADDR UNUSED pc = abuf->addr; | |
182 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); | |
183 | ||
184 | { | |
185 | #if WITH_SCACHE_PBB_SH64_COMPACT | |
186 | #if defined DEFINE_SWITCH || defined FAST_P | |
187 | /* In the switch case FAST_P is a constant, allowing several optimizations | |
188 | in any called inline functions. */ | |
189 | vpc = sh64_compact_pbb_begin (current_cpu, FAST_P); | |
190 | #else | |
191 | #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */ | |
192 | vpc = sh64_compact_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu))); | |
193 | #else | |
194 | vpc = sh64_compact_pbb_begin (current_cpu, 0); | |
195 | #endif | |
196 | #endif | |
197 | #endif | |
198 | } | |
199 | ||
200 | return vpc; | |
201 | #undef FLD | |
202 | } | |
203 | ||
204 | /* add-compact: add $rm, $rn */ | |
205 | ||
206 | static SEM_PC | |
207 | SEM_FN_NAME (sh64_compact,add_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
208 | { | |
209 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
210 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
211 | int UNUSED written = 0; | |
212 | IADDR UNUSED pc = abuf->addr; | |
213 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
214 | ||
215 | { | |
216 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
217 | SET_H_GRC (FLD (f_rn), opval); | |
218 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
219 | } | |
220 | ||
221 | return vpc; | |
222 | #undef FLD | |
223 | } | |
224 | ||
225 | /* addi-compact: add #$imm8, $rn */ | |
226 | ||
227 | static SEM_PC | |
228 | SEM_FN_NAME (sh64_compact,addi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
229 | { | |
230 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
231 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
232 | int UNUSED written = 0; | |
233 | IADDR UNUSED pc = abuf->addr; | |
234 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
235 | ||
236 | { | |
237 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), EXTQISI (ANDQI (FLD (f_imm8), 255))); | |
238 | SET_H_GRC (FLD (f_rn), opval); | |
239 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
240 | } | |
241 | ||
242 | return vpc; | |
243 | #undef FLD | |
244 | } | |
245 | ||
246 | /* addc-compact: addc $rm, $rn */ | |
247 | ||
248 | static SEM_PC | |
249 | SEM_FN_NAME (sh64_compact,addc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
250 | { | |
251 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
252 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
253 | int UNUSED written = 0; | |
254 | IADDR UNUSED pc = abuf->addr; | |
255 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
256 | ||
257 | { | |
258 | BI tmp_flag; | |
259 | tmp_flag = ADDCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
260 | { | |
261 | SI opval = ADDCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
262 | SET_H_GRC (FLD (f_rn), opval); | |
263 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
264 | } | |
265 | { | |
266 | BI opval = tmp_flag; | |
267 | SET_H_TBIT (opval); | |
268 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
269 | } | |
270 | } | |
271 | ||
272 | return vpc; | |
273 | #undef FLD | |
274 | } | |
275 | ||
276 | /* addv-compact: addv $rm, $rn */ | |
277 | ||
278 | static SEM_PC | |
279 | SEM_FN_NAME (sh64_compact,addv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
280 | { | |
281 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
282 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
283 | int UNUSED written = 0; | |
284 | IADDR UNUSED pc = abuf->addr; | |
285 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
286 | ||
287 | { | |
288 | BI tmp_t; | |
289 | tmp_t = ADDOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0); | |
290 | { | |
291 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
292 | SET_H_GRC (FLD (f_rn), opval); | |
293 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
294 | } | |
295 | { | |
296 | BI opval = tmp_t; | |
297 | SET_H_TBIT (opval); | |
298 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
299 | } | |
300 | } | |
301 | ||
302 | return vpc; | |
303 | #undef FLD | |
304 | } | |
305 | ||
306 | /* and-compact: and $rm64, $rn64 */ | |
307 | ||
308 | static SEM_PC | |
309 | SEM_FN_NAME (sh64_compact,and_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
310 | { | |
311 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
312 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
313 | int UNUSED written = 0; | |
314 | IADDR UNUSED pc = abuf->addr; | |
315 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
316 | ||
317 | { | |
318 | DI opval = ANDDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn))); | |
319 | SET_H_GR (FLD (f_rn), opval); | |
320 | TRACE_RESULT (current_cpu, abuf, "rn64", 'D', opval); | |
321 | } | |
322 | ||
323 | return vpc; | |
324 | #undef FLD | |
325 | } | |
326 | ||
327 | /* andi-compact: and #$uimm8, r0 */ | |
328 | ||
329 | static SEM_PC | |
330 | SEM_FN_NAME (sh64_compact,andi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
331 | { | |
332 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
333 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
334 | int UNUSED written = 0; | |
335 | IADDR UNUSED pc = abuf->addr; | |
336 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
337 | ||
338 | { | |
339 | SI opval = ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8))); | |
340 | SET_H_GRC (((UINT) 0), opval); | |
341 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
342 | } | |
343 | ||
344 | return vpc; | |
345 | #undef FLD | |
346 | } | |
347 | ||
348 | /* andb-compact: and.b #$imm8, @(r0, gbr) */ | |
349 | ||
350 | static SEM_PC | |
351 | SEM_FN_NAME (sh64_compact,andb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
352 | { | |
353 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
354 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
355 | int UNUSED written = 0; | |
356 | IADDR UNUSED pc = abuf->addr; | |
357 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
358 | ||
359 | { | |
360 | DI tmp_addr; | |
361 | UQI tmp_data; | |
362 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
363 | tmp_data = ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)); | |
364 | { | |
365 | UQI opval = tmp_data; | |
366 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
367 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
368 | } | |
369 | } | |
370 | ||
371 | return vpc; | |
372 | #undef FLD | |
373 | } | |
374 | ||
375 | /* bf-compact: bf $disp8 */ | |
376 | ||
377 | static SEM_PC | |
378 | SEM_FN_NAME (sh64_compact,bf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
379 | { | |
380 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
381 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
382 | int UNUSED written = 0; | |
383 | IADDR UNUSED pc = abuf->addr; | |
384 | SEM_BRANCH_INIT | |
385 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
386 | ||
387 | if (NOTBI (GET_H_TBIT ())) { | |
388 | { | |
389 | UDI opval = FLD (i_disp8); | |
390 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
391 | written |= (1 << 2); | |
392 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
393 | } | |
394 | } | |
395 | ||
396 | abuf->written = written; | |
397 | SEM_BRANCH_FINI (vpc); | |
398 | return vpc; | |
399 | #undef FLD | |
400 | } | |
401 | ||
402 | /* bfs-compact: bf/s $disp8 */ | |
403 | ||
404 | static SEM_PC | |
405 | SEM_FN_NAME (sh64_compact,bfs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
406 | { | |
407 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
408 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
409 | int UNUSED written = 0; | |
410 | IADDR UNUSED pc = abuf->addr; | |
411 | SEM_BRANCH_INIT | |
412 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
413 | ||
414 | if (NOTBI (GET_H_TBIT ())) { | |
415 | { | |
416 | { | |
417 | UDI opval = FLD (i_disp8); | |
418 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
419 | written |= (1 << 2); | |
420 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
421 | } | |
422 | } | |
423 | } | |
424 | ||
425 | abuf->written = written; | |
426 | SEM_BRANCH_FINI (vpc); | |
427 | return vpc; | |
428 | #undef FLD | |
429 | } | |
430 | ||
431 | /* bra-compact: bra $disp12 */ | |
432 | ||
433 | static SEM_PC | |
434 | SEM_FN_NAME (sh64_compact,bra_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
435 | { | |
436 | #define FLD(f) abuf->fields.sfmt_bra_compact.f | |
437 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
438 | int UNUSED written = 0; | |
439 | IADDR UNUSED pc = abuf->addr; | |
440 | SEM_BRANCH_INIT | |
441 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
442 | ||
443 | { | |
444 | { | |
445 | UDI opval = FLD (i_disp12); | |
446 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
447 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
448 | } | |
449 | } | |
450 | ||
451 | SEM_BRANCH_FINI (vpc); | |
452 | return vpc; | |
453 | #undef FLD | |
454 | } | |
455 | ||
456 | /* braf-compact: braf $rn */ | |
457 | ||
458 | static SEM_PC | |
459 | SEM_FN_NAME (sh64_compact,braf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
460 | { | |
461 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
462 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
463 | int UNUSED written = 0; | |
464 | IADDR UNUSED pc = abuf->addr; | |
465 | SEM_BRANCH_INIT | |
466 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
467 | ||
468 | { | |
469 | { | |
470 | UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4)); | |
471 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
472 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
473 | } | |
474 | } | |
475 | ||
476 | SEM_BRANCH_FINI (vpc); | |
477 | return vpc; | |
478 | #undef FLD | |
479 | } | |
480 | ||
481 | /* brk-compact: brk */ | |
482 | ||
483 | static SEM_PC | |
484 | SEM_FN_NAME (sh64_compact,brk_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
485 | { | |
486 | #define FLD(f) abuf->fields.fmt_empty.f | |
487 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
488 | int UNUSED written = 0; | |
489 | IADDR UNUSED pc = abuf->addr; | |
490 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
491 | ||
492 | sh64_break (current_cpu, pc); | |
493 | ||
494 | return vpc; | |
495 | #undef FLD | |
496 | } | |
497 | ||
498 | /* bsr-compact: bsr $disp12 */ | |
499 | ||
500 | static SEM_PC | |
501 | SEM_FN_NAME (sh64_compact,bsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
502 | { | |
503 | #define FLD(f) abuf->fields.sfmt_bra_compact.f | |
504 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
505 | int UNUSED written = 0; | |
506 | IADDR UNUSED pc = abuf->addr; | |
507 | SEM_BRANCH_INIT | |
508 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
509 | ||
510 | { | |
511 | { | |
512 | { | |
513 | SI opval = ADDDI (pc, 4); | |
514 | SET_H_PR (opval); | |
515 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
516 | } | |
517 | { | |
518 | UDI opval = FLD (i_disp12); | |
519 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
520 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
521 | } | |
522 | } | |
523 | } | |
524 | ||
525 | SEM_BRANCH_FINI (vpc); | |
526 | return vpc; | |
527 | #undef FLD | |
528 | } | |
529 | ||
530 | /* bsrf-compact: bsrf $rn */ | |
531 | ||
532 | static SEM_PC | |
533 | SEM_FN_NAME (sh64_compact,bsrf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
534 | { | |
535 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
536 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
537 | int UNUSED written = 0; | |
538 | IADDR UNUSED pc = abuf->addr; | |
539 | SEM_BRANCH_INIT | |
540 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
541 | ||
542 | { | |
543 | { | |
544 | { | |
545 | SI opval = ADDDI (pc, 4); | |
546 | SET_H_PR (opval); | |
547 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
548 | } | |
549 | { | |
550 | UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4)); | |
551 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
552 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
553 | } | |
554 | } | |
555 | } | |
556 | ||
557 | SEM_BRANCH_FINI (vpc); | |
558 | return vpc; | |
559 | #undef FLD | |
560 | } | |
561 | ||
562 | /* bt-compact: bt $disp8 */ | |
563 | ||
564 | static SEM_PC | |
565 | SEM_FN_NAME (sh64_compact,bt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
566 | { | |
567 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
568 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
569 | int UNUSED written = 0; | |
570 | IADDR UNUSED pc = abuf->addr; | |
571 | SEM_BRANCH_INIT | |
572 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
573 | ||
574 | if (GET_H_TBIT ()) { | |
575 | { | |
576 | UDI opval = FLD (i_disp8); | |
577 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
578 | written |= (1 << 2); | |
579 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
580 | } | |
581 | } | |
582 | ||
583 | abuf->written = written; | |
584 | SEM_BRANCH_FINI (vpc); | |
585 | return vpc; | |
586 | #undef FLD | |
587 | } | |
588 | ||
589 | /* bts-compact: bt/s $disp8 */ | |
590 | ||
591 | static SEM_PC | |
592 | SEM_FN_NAME (sh64_compact,bts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
593 | { | |
594 | #define FLD(f) abuf->fields.sfmt_bf_compact.f | |
595 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
596 | int UNUSED written = 0; | |
597 | IADDR UNUSED pc = abuf->addr; | |
598 | SEM_BRANCH_INIT | |
599 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
600 | ||
601 | if (GET_H_TBIT ()) { | |
602 | { | |
603 | { | |
604 | UDI opval = FLD (i_disp8); | |
605 | SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); | |
606 | written |= (1 << 2); | |
607 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
608 | } | |
609 | } | |
610 | } | |
611 | ||
612 | abuf->written = written; | |
613 | SEM_BRANCH_FINI (vpc); | |
614 | return vpc; | |
615 | #undef FLD | |
616 | } | |
617 | ||
618 | /* clrmac-compact: clrmac */ | |
619 | ||
620 | static SEM_PC | |
621 | SEM_FN_NAME (sh64_compact,clrmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
622 | { | |
623 | #define FLD(f) abuf->fields.fmt_empty.f | |
624 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
625 | int UNUSED written = 0; | |
626 | IADDR UNUSED pc = abuf->addr; | |
627 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
628 | ||
629 | { | |
630 | { | |
631 | SI opval = 0; | |
632 | SET_H_MACL (opval); | |
633 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
634 | } | |
635 | { | |
636 | SI opval = 0; | |
637 | SET_H_MACH (opval); | |
638 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
639 | } | |
640 | } | |
641 | ||
642 | return vpc; | |
643 | #undef FLD | |
644 | } | |
645 | ||
646 | /* clrs-compact: clrs */ | |
647 | ||
648 | static SEM_PC | |
649 | SEM_FN_NAME (sh64_compact,clrs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
650 | { | |
651 | #define FLD(f) abuf->fields.fmt_empty.f | |
652 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
653 | int UNUSED written = 0; | |
654 | IADDR UNUSED pc = abuf->addr; | |
655 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
656 | ||
657 | { | |
658 | BI opval = 0; | |
659 | SET_H_SBIT (opval); | |
660 | TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval); | |
661 | } | |
662 | ||
663 | return vpc; | |
664 | #undef FLD | |
665 | } | |
666 | ||
667 | /* clrt-compact: clrt */ | |
668 | ||
669 | static SEM_PC | |
670 | SEM_FN_NAME (sh64_compact,clrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
671 | { | |
672 | #define FLD(f) abuf->fields.fmt_empty.f | |
673 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
674 | int UNUSED written = 0; | |
675 | IADDR UNUSED pc = abuf->addr; | |
676 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
677 | ||
678 | { | |
679 | BI opval = 0; | |
680 | SET_H_TBIT (opval); | |
681 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
682 | } | |
683 | ||
684 | return vpc; | |
685 | #undef FLD | |
686 | } | |
687 | ||
688 | /* cmpeq-compact: cmp/eq $rm, $rn */ | |
689 | ||
690 | static SEM_PC | |
691 | SEM_FN_NAME (sh64_compact,cmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
692 | { | |
693 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
694 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
695 | int UNUSED written = 0; | |
696 | IADDR UNUSED pc = abuf->addr; | |
697 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
698 | ||
699 | { | |
700 | BI opval = EQSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
701 | SET_H_TBIT (opval); | |
702 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
703 | } | |
704 | ||
705 | return vpc; | |
706 | #undef FLD | |
707 | } | |
708 | ||
709 | /* cmpeqi-compact: cmp/eq #$imm8, r0 */ | |
710 | ||
711 | static SEM_PC | |
712 | SEM_FN_NAME (sh64_compact,cmpeqi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
713 | { | |
714 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
715 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
716 | int UNUSED written = 0; | |
717 | IADDR UNUSED pc = abuf->addr; | |
718 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
719 | ||
720 | { | |
721 | BI opval = EQSI (GET_H_GRC (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255))); | |
722 | SET_H_TBIT (opval); | |
723 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
724 | } | |
725 | ||
726 | return vpc; | |
727 | #undef FLD | |
728 | } | |
729 | ||
730 | /* cmpge-compact: cmp/ge $rm, $rn */ | |
731 | ||
732 | static SEM_PC | |
733 | SEM_FN_NAME (sh64_compact,cmpge_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
734 | { | |
735 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
736 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
737 | int UNUSED written = 0; | |
738 | IADDR UNUSED pc = abuf->addr; | |
739 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
740 | ||
741 | { | |
742 | BI opval = GESI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
743 | SET_H_TBIT (opval); | |
744 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
745 | } | |
746 | ||
747 | return vpc; | |
748 | #undef FLD | |
749 | } | |
750 | ||
751 | /* cmpgt-compact: cmp/gt $rm, $rn */ | |
752 | ||
753 | static SEM_PC | |
754 | SEM_FN_NAME (sh64_compact,cmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
755 | { | |
756 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
757 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
758 | int UNUSED written = 0; | |
759 | IADDR UNUSED pc = abuf->addr; | |
760 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
761 | ||
762 | { | |
763 | BI opval = GTSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
764 | SET_H_TBIT (opval); | |
765 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
766 | } | |
767 | ||
768 | return vpc; | |
769 | #undef FLD | |
770 | } | |
771 | ||
772 | /* cmphi-compact: cmp/hi $rm, $rn */ | |
773 | ||
774 | static SEM_PC | |
775 | SEM_FN_NAME (sh64_compact,cmphi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
776 | { | |
777 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
778 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
779 | int UNUSED written = 0; | |
780 | IADDR UNUSED pc = abuf->addr; | |
781 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
782 | ||
783 | { | |
784 | BI opval = GTUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
785 | SET_H_TBIT (opval); | |
786 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
787 | } | |
788 | ||
789 | return vpc; | |
790 | #undef FLD | |
791 | } | |
792 | ||
793 | /* cmphs-compact: cmp/hs $rm, $rn */ | |
794 | ||
795 | static SEM_PC | |
796 | SEM_FN_NAME (sh64_compact,cmphs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
797 | { | |
798 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
799 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
800 | int UNUSED written = 0; | |
801 | IADDR UNUSED pc = abuf->addr; | |
802 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
803 | ||
804 | { | |
805 | BI opval = GEUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
806 | SET_H_TBIT (opval); | |
807 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
808 | } | |
809 | ||
810 | return vpc; | |
811 | #undef FLD | |
812 | } | |
813 | ||
814 | /* cmppl-compact: cmp/pl $rn */ | |
815 | ||
816 | static SEM_PC | |
817 | SEM_FN_NAME (sh64_compact,cmppl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
818 | { | |
819 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
820 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
821 | int UNUSED written = 0; | |
822 | IADDR UNUSED pc = abuf->addr; | |
823 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
824 | ||
825 | { | |
826 | BI opval = GTSI (GET_H_GRC (FLD (f_rn)), 0); | |
827 | SET_H_TBIT (opval); | |
828 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
829 | } | |
830 | ||
831 | return vpc; | |
832 | #undef FLD | |
833 | } | |
834 | ||
835 | /* cmppz-compact: cmp/pz $rn */ | |
836 | ||
837 | static SEM_PC | |
838 | SEM_FN_NAME (sh64_compact,cmppz_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
839 | { | |
840 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
841 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
842 | int UNUSED written = 0; | |
843 | IADDR UNUSED pc = abuf->addr; | |
844 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
845 | ||
846 | { | |
847 | BI opval = GESI (GET_H_GRC (FLD (f_rn)), 0); | |
848 | SET_H_TBIT (opval); | |
849 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
850 | } | |
851 | ||
852 | return vpc; | |
853 | #undef FLD | |
854 | } | |
855 | ||
856 | /* cmpstr-compact: cmp/str $rm, $rn */ | |
857 | ||
858 | static SEM_PC | |
859 | SEM_FN_NAME (sh64_compact,cmpstr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
860 | { | |
861 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
862 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
863 | int UNUSED written = 0; | |
864 | IADDR UNUSED pc = abuf->addr; | |
865 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
866 | ||
867 | { | |
868 | BI tmp_t; | |
869 | SI tmp_temp; | |
870 | tmp_temp = XORSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
871 | tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0); | |
872 | tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t); | |
873 | tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t); | |
874 | tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t); | |
875 | { | |
876 | BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0)); | |
877 | SET_H_TBIT (opval); | |
878 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
879 | } | |
880 | } | |
881 | ||
882 | return vpc; | |
883 | #undef FLD | |
884 | } | |
885 | ||
886 | /* div0s-compact: div0s $rm, $rn */ | |
887 | ||
888 | static SEM_PC | |
889 | SEM_FN_NAME (sh64_compact,div0s_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
890 | { | |
891 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
892 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
893 | int UNUSED written = 0; | |
894 | IADDR UNUSED pc = abuf->addr; | |
895 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
896 | ||
897 | { | |
898 | { | |
899 | BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
900 | SET_H_QBIT (opval); | |
901 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
902 | } | |
903 | { | |
904 | BI opval = SRLSI (GET_H_GRC (FLD (f_rm)), 31); | |
905 | SET_H_MBIT (opval); | |
906 | TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval); | |
907 | } | |
908 | { | |
909 | BI opval = ((EQSI (SRLSI (GET_H_GRC (FLD (f_rm)), 31), SRLSI (GET_H_GRC (FLD (f_rn)), 31))) ? (0) : (1)); | |
910 | SET_H_TBIT (opval); | |
911 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
912 | } | |
913 | } | |
914 | ||
915 | return vpc; | |
916 | #undef FLD | |
917 | } | |
918 | ||
919 | /* div0u-compact: div0u */ | |
920 | ||
921 | static SEM_PC | |
922 | SEM_FN_NAME (sh64_compact,div0u_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
923 | { | |
924 | #define FLD(f) abuf->fields.fmt_empty.f | |
925 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
926 | int UNUSED written = 0; | |
927 | IADDR UNUSED pc = abuf->addr; | |
928 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
929 | ||
930 | { | |
931 | { | |
932 | BI opval = 0; | |
933 | SET_H_TBIT (opval); | |
934 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
935 | } | |
936 | { | |
937 | BI opval = 0; | |
938 | SET_H_QBIT (opval); | |
939 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
940 | } | |
941 | { | |
942 | BI opval = 0; | |
943 | SET_H_MBIT (opval); | |
944 | TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval); | |
945 | } | |
946 | } | |
947 | ||
948 | return vpc; | |
949 | #undef FLD | |
950 | } | |
951 | ||
952 | /* div1-compact: div1 $rm, $rn */ | |
953 | ||
954 | static SEM_PC | |
955 | SEM_FN_NAME (sh64_compact,div1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
956 | { | |
957 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
958 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
959 | int UNUSED written = 0; | |
960 | IADDR UNUSED pc = abuf->addr; | |
961 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
962 | ||
963 | { | |
964 | BI tmp_oldq; | |
965 | SI tmp_tmp0; | |
966 | UQI tmp_tmp1; | |
967 | tmp_oldq = GET_H_QBIT (); | |
968 | { | |
969 | BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
970 | SET_H_QBIT (opval); | |
971 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
972 | } | |
973 | { | |
974 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), ZEXTBISI (GET_H_TBIT ())); | |
975 | SET_H_GRC (FLD (f_rn), opval); | |
976 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
977 | } | |
978 | if (NOTBI (tmp_oldq)) { | |
979 | if (NOTBI (GET_H_MBIT ())) { | |
980 | { | |
981 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
982 | { | |
983 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
984 | SET_H_GRC (FLD (f_rn), opval); | |
985 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
986 | } | |
987 | tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
988 | if (NOTBI (GET_H_QBIT ())) { | |
989 | { | |
990 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
991 | SET_H_QBIT (opval); | |
992 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
993 | } | |
994 | } else { | |
995 | { | |
996 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
997 | SET_H_QBIT (opval); | |
998 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
999 | } | |
1000 | } | |
1001 | } | |
1002 | } else { | |
1003 | { | |
1004 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
1005 | { | |
1006 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
1007 | SET_H_GRC (FLD (f_rn), opval); | |
1008 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1009 | } | |
1010 | tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
1011 | if (NOTBI (GET_H_QBIT ())) { | |
1012 | { | |
1013 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
1014 | SET_H_QBIT (opval); | |
1015 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1016 | } | |
1017 | } else { | |
1018 | { | |
1019 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
1020 | SET_H_QBIT (opval); | |
1021 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1022 | } | |
1023 | } | |
1024 | } | |
1025 | } | |
1026 | } else { | |
1027 | if (NOTBI (GET_H_MBIT ())) { | |
1028 | { | |
1029 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
1030 | { | |
1031 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
1032 | SET_H_GRC (FLD (f_rn), opval); | |
1033 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1034 | } | |
1035 | tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
1036 | if (NOTBI (GET_H_QBIT ())) { | |
1037 | { | |
1038 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
1039 | SET_H_QBIT (opval); | |
1040 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1041 | } | |
1042 | } else { | |
1043 | { | |
1044 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
1045 | SET_H_QBIT (opval); | |
1046 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1047 | } | |
1048 | } | |
1049 | } | |
1050 | } else { | |
1051 | { | |
1052 | tmp_tmp0 = GET_H_GRC (FLD (f_rn)); | |
1053 | { | |
1054 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
1055 | SET_H_GRC (FLD (f_rn), opval); | |
1056 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1057 | } | |
1058 | tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0); | |
1059 | if (NOTBI (GET_H_QBIT ())) { | |
1060 | { | |
1061 | BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0)); | |
1062 | SET_H_QBIT (opval); | |
1063 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1064 | } | |
1065 | } else { | |
1066 | { | |
1067 | BI opval = ((tmp_tmp1) ? (1) : (0)); | |
1068 | SET_H_QBIT (opval); | |
1069 | TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval); | |
1070 | } | |
1071 | } | |
1072 | } | |
1073 | } | |
1074 | } | |
1075 | { | |
1076 | BI opval = ((EQBI (GET_H_QBIT (), GET_H_MBIT ())) ? (1) : (0)); | |
1077 | SET_H_TBIT (opval); | |
1078 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1079 | } | |
1080 | } | |
1081 | ||
1082 | return vpc; | |
1083 | #undef FLD | |
1084 | } | |
1085 | ||
1086 | /* dmulsl-compact: dmuls.l $rm, $rn */ | |
1087 | ||
1088 | static SEM_PC | |
1089 | SEM_FN_NAME (sh64_compact,dmulsl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1090 | { | |
1091 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1092 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1093 | int UNUSED written = 0; | |
1094 | IADDR UNUSED pc = abuf->addr; | |
1095 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1096 | ||
1097 | { | |
1098 | DI tmp_result; | |
1099 | tmp_result = MULDI (EXTSIDI (GET_H_GRC (FLD (f_rm))), EXTSIDI (GET_H_GRC (FLD (f_rn)))); | |
1100 | { | |
1101 | SI opval = SUBWORDDISI (tmp_result, 0); | |
1102 | SET_H_MACH (opval); | |
1103 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
1104 | } | |
1105 | { | |
1106 | SI opval = SUBWORDDISI (tmp_result, 1); | |
1107 | SET_H_MACL (opval); | |
1108 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
1109 | } | |
1110 | } | |
1111 | ||
1112 | return vpc; | |
1113 | #undef FLD | |
1114 | } | |
1115 | ||
1116 | /* dmulul-compact: dmulu.l $rm, $rn */ | |
1117 | ||
1118 | static SEM_PC | |
1119 | SEM_FN_NAME (sh64_compact,dmulul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1120 | { | |
1121 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1122 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1123 | int UNUSED written = 0; | |
1124 | IADDR UNUSED pc = abuf->addr; | |
1125 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1126 | ||
1127 | { | |
1128 | DI tmp_result; | |
1129 | tmp_result = MULDI (ZEXTSIDI (GET_H_GRC (FLD (f_rm))), ZEXTSIDI (GET_H_GRC (FLD (f_rn)))); | |
1130 | { | |
1131 | SI opval = SUBWORDDISI (tmp_result, 0); | |
1132 | SET_H_MACH (opval); | |
1133 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
1134 | } | |
1135 | { | |
1136 | SI opval = SUBWORDDISI (tmp_result, 1); | |
1137 | SET_H_MACL (opval); | |
1138 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
1139 | } | |
1140 | } | |
1141 | ||
1142 | return vpc; | |
1143 | #undef FLD | |
1144 | } | |
1145 | ||
1146 | /* dt-compact: dt $rn */ | |
1147 | ||
1148 | static SEM_PC | |
1149 | SEM_FN_NAME (sh64_compact,dt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1150 | { | |
1151 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1152 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1153 | int UNUSED written = 0; | |
1154 | IADDR UNUSED pc = abuf->addr; | |
1155 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1156 | ||
1157 | { | |
1158 | { | |
1159 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 1); | |
1160 | SET_H_GRC (FLD (f_rn), opval); | |
1161 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1162 | } | |
1163 | { | |
1164 | BI opval = EQSI (GET_H_GRC (FLD (f_rn)), 0); | |
1165 | SET_H_TBIT (opval); | |
1166 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1167 | } | |
1168 | } | |
1169 | ||
1170 | return vpc; | |
1171 | #undef FLD | |
1172 | } | |
1173 | ||
1174 | /* extsb-compact: exts.b $rm, $rn */ | |
1175 | ||
1176 | static SEM_PC | |
1177 | SEM_FN_NAME (sh64_compact,extsb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1178 | { | |
1179 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1180 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1181 | int UNUSED written = 0; | |
1182 | IADDR UNUSED pc = abuf->addr; | |
1183 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1184 | ||
1185 | { | |
1186 | SI opval = EXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3)); | |
1187 | SET_H_GRC (FLD (f_rn), opval); | |
1188 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1189 | } | |
1190 | ||
1191 | return vpc; | |
1192 | #undef FLD | |
1193 | } | |
1194 | ||
1195 | /* extsw-compact: exts.w $rm, $rn */ | |
1196 | ||
1197 | static SEM_PC | |
1198 | SEM_FN_NAME (sh64_compact,extsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1199 | { | |
1200 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1201 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1202 | int UNUSED written = 0; | |
1203 | IADDR UNUSED pc = abuf->addr; | |
1204 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1205 | ||
1206 | { | |
1207 | SI opval = EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)); | |
1208 | SET_H_GRC (FLD (f_rn), opval); | |
1209 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1210 | } | |
1211 | ||
1212 | return vpc; | |
1213 | #undef FLD | |
1214 | } | |
1215 | ||
1216 | /* extub-compact: extu.b $rm, $rn */ | |
1217 | ||
1218 | static SEM_PC | |
1219 | SEM_FN_NAME (sh64_compact,extub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1220 | { | |
1221 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1222 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1223 | int UNUSED written = 0; | |
1224 | IADDR UNUSED pc = abuf->addr; | |
1225 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1226 | ||
1227 | { | |
1228 | SI opval = ZEXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3)); | |
1229 | SET_H_GRC (FLD (f_rn), opval); | |
1230 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1231 | } | |
1232 | ||
1233 | return vpc; | |
1234 | #undef FLD | |
1235 | } | |
1236 | ||
1237 | /* extuw-compact: extu.w $rm, $rn */ | |
1238 | ||
1239 | static SEM_PC | |
1240 | SEM_FN_NAME (sh64_compact,extuw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1241 | { | |
1242 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1243 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1244 | int UNUSED written = 0; | |
1245 | IADDR UNUSED pc = abuf->addr; | |
1246 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1247 | ||
1248 | { | |
1249 | SI opval = ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)); | |
1250 | SET_H_GRC (FLD (f_rn), opval); | |
1251 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1252 | } | |
1253 | ||
1254 | return vpc; | |
1255 | #undef FLD | |
1256 | } | |
1257 | ||
1258 | /* fabs-compact: fabs $fsdn */ | |
1259 | ||
1260 | static SEM_PC | |
1261 | SEM_FN_NAME (sh64_compact,fabs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1262 | { | |
1263 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1264 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1265 | int UNUSED written = 0; | |
1266 | IADDR UNUSED pc = abuf->addr; | |
1267 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1268 | ||
1269 | if (GET_H_PRBIT ()) { | |
1270 | { | |
1271 | DF opval = sh64_fabsd (current_cpu, GET_H_DR (FLD (f_rn))); | |
1272 | SET_H_DR (FLD (f_rn), opval); | |
1273 | written |= (1 << 5); | |
1274 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
1275 | } | |
1276 | } else { | |
1277 | { | |
1278 | SF opval = sh64_fabss (current_cpu, GET_H_FRC (FLD (f_rn))); | |
1279 | SET_H_FRC (FLD (f_rn), opval); | |
1280 | written |= (1 << 4); | |
1281 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
1282 | } | |
1283 | } | |
1284 | ||
1285 | abuf->written = written; | |
1286 | return vpc; | |
1287 | #undef FLD | |
1288 | } | |
1289 | ||
1290 | /* fadd-compact: fadd $fsdm, $fsdn */ | |
1291 | ||
1292 | static SEM_PC | |
1293 | SEM_FN_NAME (sh64_compact,fadd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1294 | { | |
1295 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1296 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1297 | int UNUSED written = 0; | |
1298 | IADDR UNUSED pc = abuf->addr; | |
1299 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1300 | ||
1301 | if (GET_H_PRBIT ()) { | |
1302 | { | |
1303 | DF opval = sh64_faddd (current_cpu, GET_H_DR (FLD (f_rm)), GET_H_DR (FLD (f_rn))); | |
1304 | SET_H_DR (FLD (f_rn), opval); | |
1305 | written |= (1 << 8); | |
1306 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
1307 | } | |
1308 | } else { | |
1309 | { | |
1310 | SF opval = sh64_fadds (current_cpu, GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn))); | |
1311 | SET_H_FRC (FLD (f_rn), opval); | |
1312 | written |= (1 << 7); | |
1313 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
1314 | } | |
1315 | } | |
1316 | ||
1317 | abuf->written = written; | |
1318 | return vpc; | |
1319 | #undef FLD | |
1320 | } | |
1321 | ||
1322 | /* fcmpeq-compact: fcmp/eq $fsdm, $fsdn */ | |
1323 | ||
1324 | static SEM_PC | |
1325 | SEM_FN_NAME (sh64_compact,fcmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1326 | { | |
1327 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1328 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1329 | int UNUSED written = 0; | |
1330 | IADDR UNUSED pc = abuf->addr; | |
1331 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1332 | ||
1333 | if (GET_H_PRBIT ()) { | |
1334 | { | |
1335 | BI opval = sh64_fcmpeqd (current_cpu, GET_H_DR (FLD (f_rm)), GET_H_DR (FLD (f_rn))); | |
1336 | SET_H_TBIT (opval); | |
1337 | written |= (1 << 7); | |
1338 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1339 | } | |
1340 | } else { | |
1341 | { | |
1342 | BI opval = sh64_fcmpeqs (current_cpu, GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn))); | |
1343 | SET_H_TBIT (opval); | |
1344 | written |= (1 << 7); | |
1345 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1346 | } | |
1347 | } | |
1348 | ||
1349 | abuf->written = written; | |
1350 | return vpc; | |
1351 | #undef FLD | |
1352 | } | |
1353 | ||
1354 | /* fcmpgt-compact: fcmp/gt $fsdm, $fsdn */ | |
1355 | ||
1356 | static SEM_PC | |
1357 | SEM_FN_NAME (sh64_compact,fcmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1358 | { | |
1359 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1360 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1361 | int UNUSED written = 0; | |
1362 | IADDR UNUSED pc = abuf->addr; | |
1363 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1364 | ||
1365 | if (GET_H_PRBIT ()) { | |
1366 | { | |
1367 | BI opval = sh64_fcmpgtd (current_cpu, GET_H_DR (FLD (f_rn)), GET_H_DR (FLD (f_rm))); | |
1368 | SET_H_TBIT (opval); | |
1369 | written |= (1 << 7); | |
1370 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1371 | } | |
1372 | } else { | |
1373 | { | |
1374 | BI opval = sh64_fcmpgts (current_cpu, GET_H_FRC (FLD (f_rn)), GET_H_FRC (FLD (f_rm))); | |
1375 | SET_H_TBIT (opval); | |
1376 | written |= (1 << 7); | |
1377 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
1378 | } | |
1379 | } | |
1380 | ||
1381 | abuf->written = written; | |
1382 | return vpc; | |
1383 | #undef FLD | |
1384 | } | |
1385 | ||
1386 | /* fcnvds-compact: fcnvds $drn, fpul */ | |
1387 | ||
1388 | static SEM_PC | |
1389 | SEM_FN_NAME (sh64_compact,fcnvds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1390 | { | |
1391 | #define FLD(f) abuf->fields.sfmt_fcnvds_compact.f | |
1392 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1393 | int UNUSED written = 0; | |
1394 | IADDR UNUSED pc = abuf->addr; | |
1395 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1396 | ||
1397 | { | |
1398 | SF opval = sh64_fcnvds (current_cpu, GET_H_DRC (FLD (f_dn))); | |
1399 | CPU (h_fr[((UINT) 32)]) = opval; | |
1400 | TRACE_RESULT (current_cpu, abuf, "fpul", 'f', opval); | |
1401 | } | |
1402 | ||
1403 | return vpc; | |
1404 | #undef FLD | |
1405 | } | |
1406 | ||
1407 | /* fcnvsd-compact: fcnvsd fpul, $drn */ | |
1408 | ||
1409 | static SEM_PC | |
1410 | SEM_FN_NAME (sh64_compact,fcnvsd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1411 | { | |
1412 | #define FLD(f) abuf->fields.sfmt_fcnvds_compact.f | |
1413 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1414 | int UNUSED written = 0; | |
1415 | IADDR UNUSED pc = abuf->addr; | |
1416 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1417 | ||
1418 | { | |
1419 | DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[((UINT) 32)])); | |
1420 | SET_H_DRC (FLD (f_dn), opval); | |
1421 | TRACE_RESULT (current_cpu, abuf, "drn", 'f', opval); | |
1422 | } | |
1423 | ||
1424 | return vpc; | |
1425 | #undef FLD | |
1426 | } | |
1427 | ||
1428 | /* fdiv-compact: fdiv $fsdm, $fsdn */ | |
1429 | ||
1430 | static SEM_PC | |
1431 | SEM_FN_NAME (sh64_compact,fdiv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1432 | { | |
1433 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1434 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1435 | int UNUSED written = 0; | |
1436 | IADDR UNUSED pc = abuf->addr; | |
1437 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1438 | ||
1439 | if (GET_H_PRBIT ()) { | |
1440 | { | |
1441 | DF opval = sh64_fdivd (current_cpu, GET_H_DR (FLD (f_rn)), GET_H_DR (FLD (f_rm))); | |
1442 | SET_H_DR (FLD (f_rn), opval); | |
1443 | written |= (1 << 8); | |
1444 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
1445 | } | |
1446 | } else { | |
1447 | { | |
1448 | SF opval = sh64_fdivs (current_cpu, GET_H_FRC (FLD (f_rn)), GET_H_FRC (FLD (f_rm))); | |
1449 | SET_H_FRC (FLD (f_rn), opval); | |
1450 | written |= (1 << 7); | |
1451 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
1452 | } | |
1453 | } | |
1454 | ||
1455 | abuf->written = written; | |
1456 | return vpc; | |
1457 | #undef FLD | |
1458 | } | |
1459 | ||
1460 | /* fipr-compact: fipr $fvm, $fvn */ | |
1461 | ||
1462 | static SEM_PC | |
1463 | SEM_FN_NAME (sh64_compact,fipr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1464 | { | |
1465 | #define FLD(f) abuf->fields.sfmt_fipr_compact.f | |
1466 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1467 | int UNUSED written = 0; | |
1468 | IADDR UNUSED pc = abuf->addr; | |
1469 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1470 | ||
1471 | { | |
1472 | QI tmp_m; | |
1473 | QI tmp_n; | |
1474 | SF tmp_res; | |
1475 | tmp_m = FLD (f_vm); | |
1476 | tmp_n = FLD (f_vn); | |
1477 | tmp_res = sh64_fmuls (current_cpu, GET_H_FVC (FLD (f_vm)), GET_H_FVC (FLD (f_vn))); | |
1478 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_FRC (ADDQI (tmp_m, 1)), GET_H_FRC (ADDQI (tmp_n, 1)))); | |
1479 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_FRC (ADDQI (tmp_m, 2)), GET_H_FRC (ADDQI (tmp_n, 2)))); | |
1480 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_FRC (ADDQI (tmp_m, 3)), GET_H_FRC (ADDQI (tmp_n, 3)))); | |
1481 | { | |
1482 | SF opval = tmp_res; | |
1483 | SET_H_FRC (ADDQI (tmp_n, 3), opval); | |
1484 | TRACE_RESULT (current_cpu, abuf, "frc-add--DFLT-n-3", 'f', opval); | |
1485 | } | |
1486 | } | |
1487 | ||
1488 | return vpc; | |
1489 | #undef FLD | |
1490 | } | |
1491 | ||
1492 | /* flds-compact: flds $frn */ | |
1493 | ||
1494 | static SEM_PC | |
1495 | SEM_FN_NAME (sh64_compact,flds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1496 | { | |
1497 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1498 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1499 | int UNUSED written = 0; | |
1500 | IADDR UNUSED pc = abuf->addr; | |
1501 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1502 | ||
1503 | { | |
1504 | SF opval = GET_H_FRC (FLD (f_rn)); | |
1505 | CPU (h_fr[((UINT) 32)]) = opval; | |
1506 | TRACE_RESULT (current_cpu, abuf, "fpul", 'f', opval); | |
1507 | } | |
1508 | ||
1509 | return vpc; | |
1510 | #undef FLD | |
1511 | } | |
1512 | ||
1513 | /* fldi0-compact: fldi0 $frn */ | |
1514 | ||
1515 | static SEM_PC | |
1516 | SEM_FN_NAME (sh64_compact,fldi0_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1517 | { | |
1518 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1519 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1520 | int UNUSED written = 0; | |
1521 | IADDR UNUSED pc = abuf->addr; | |
1522 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1523 | ||
1524 | { | |
1525 | SF opval = sh64_fldi0 (current_cpu); | |
1526 | SET_H_FRC (FLD (f_rn), opval); | |
1527 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
1528 | } | |
1529 | ||
1530 | return vpc; | |
1531 | #undef FLD | |
1532 | } | |
1533 | ||
1534 | /* fldi1-compact: fldi1 $frn */ | |
1535 | ||
1536 | static SEM_PC | |
1537 | SEM_FN_NAME (sh64_compact,fldi1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1538 | { | |
1539 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1540 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1541 | int UNUSED written = 0; | |
1542 | IADDR UNUSED pc = abuf->addr; | |
1543 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1544 | ||
1545 | { | |
1546 | SF opval = sh64_fldi1 (current_cpu); | |
1547 | SET_H_FRC (FLD (f_rn), opval); | |
1548 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
1549 | } | |
1550 | ||
1551 | return vpc; | |
1552 | #undef FLD | |
1553 | } | |
1554 | ||
1555 | /* float-compact: float fpul, $fsdn */ | |
1556 | ||
1557 | static SEM_PC | |
1558 | SEM_FN_NAME (sh64_compact,float_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1559 | { | |
1560 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1561 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1562 | int UNUSED written = 0; | |
1563 | IADDR UNUSED pc = abuf->addr; | |
1564 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1565 | ||
1566 | if (GET_H_PRBIT ()) { | |
1567 | { | |
1568 | DF opval = sh64_floatld (current_cpu, CPU (h_fr[((UINT) 32)])); | |
1569 | SET_H_DR (FLD (f_rn), opval); | |
1570 | written |= (1 << 4); | |
1571 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
1572 | } | |
1573 | } else { | |
1574 | { | |
1575 | SF opval = sh64_floatls (current_cpu, CPU (h_fr[((UINT) 32)])); | |
1576 | SET_H_FRC (FLD (f_rn), opval); | |
1577 | written |= (1 << 3); | |
1578 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
1579 | } | |
1580 | } | |
1581 | ||
1582 | abuf->written = written; | |
1583 | return vpc; | |
1584 | #undef FLD | |
1585 | } | |
1586 | ||
1587 | /* fmac-compact: fmac fr0, $frm, $frn */ | |
1588 | ||
1589 | static SEM_PC | |
1590 | SEM_FN_NAME (sh64_compact,fmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1591 | { | |
1592 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1593 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1594 | int UNUSED written = 0; | |
1595 | IADDR UNUSED pc = abuf->addr; | |
1596 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1597 | ||
1598 | { | |
1599 | SF opval = sh64_fmacs (current_cpu, GET_H_FRC (((UINT) 0)), GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn))); | |
1600 | SET_H_FRC (FLD (f_rn), opval); | |
1601 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
1602 | } | |
1603 | ||
1604 | return vpc; | |
1605 | #undef FLD | |
1606 | } | |
1607 | ||
1608 | /* fmov1-compact: fmov $frm, $frn */ | |
1609 | ||
1610 | static SEM_PC | |
1611 | SEM_FN_NAME (sh64_compact,fmov1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1612 | { | |
1613 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1614 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1615 | int UNUSED written = 0; | |
1616 | IADDR UNUSED pc = abuf->addr; | |
1617 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1618 | ||
1619 | if (NOTBI (GET_H_SZBIT ())) { | |
1620 | { | |
1621 | SF opval = GET_H_FRC (FLD (f_rm)); | |
1622 | SET_H_FRC (FLD (f_rn), opval); | |
1623 | written |= (1 << 6); | |
1624 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
1625 | } | |
1626 | } else { | |
1627 | if (EQSI (ANDSI (FLD (f_rm), 1), 1)) { | |
1628 | if (EQSI (ANDSI (FLD (f_rn), 1), 1)) { | |
1629 | { | |
1630 | DF opval = GET_H_XD (((FLD (f_rm)) & (INVQI (1)))); | |
1631 | SET_H_XD (((FLD (f_rn)) & (INVQI (1))), opval); | |
1632 | written |= (1 << 8); | |
1633 | TRACE_RESULT (current_cpu, abuf, "xd-and--DFLT-index-of--DFLT-frn-inv--QI-1", 'f', opval); | |
1634 | } | |
1635 | } else { | |
1636 | { | |
1637 | DF opval = GET_H_XD (((FLD (f_rm)) & (INVQI (1)))); | |
1638 | SET_H_DR (FLD (f_rn), opval); | |
1639 | written |= (1 << 7); | |
1640 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-frn", 'f', opval); | |
1641 | } | |
1642 | } | |
1643 | } else { | |
1644 | if (EQSI (ANDSI (FLD (f_rn), 1), 1)) { | |
1645 | { | |
1646 | DF opval = GET_H_DR (FLD (f_rm)); | |
1647 | SET_H_XD (((FLD (f_rn)) & (INVQI (1))), opval); | |
1648 | written |= (1 << 8); | |
1649 | TRACE_RESULT (current_cpu, abuf, "xd-and--DFLT-index-of--DFLT-frn-inv--QI-1", 'f', opval); | |
1650 | } | |
1651 | } else { | |
1652 | { | |
1653 | DF opval = GET_H_DR (FLD (f_rm)); | |
1654 | SET_H_DR (FLD (f_rn), opval); | |
1655 | written |= (1 << 7); | |
1656 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-frn", 'f', opval); | |
1657 | } | |
1658 | } | |
1659 | } | |
1660 | } | |
1661 | ||
1662 | abuf->written = written; | |
1663 | return vpc; | |
1664 | #undef FLD | |
1665 | } | |
1666 | ||
1667 | /* fmov2-compact: fmov @$rm, $frn */ | |
1668 | ||
1669 | static SEM_PC | |
1670 | SEM_FN_NAME (sh64_compact,fmov2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1671 | { | |
1672 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1673 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1674 | int UNUSED written = 0; | |
1675 | IADDR UNUSED pc = abuf->addr; | |
1676 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1677 | ||
1678 | if (NOTBI (GET_H_SZBIT ())) { | |
1679 | { | |
1680 | SF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
1681 | SET_H_FRC (FLD (f_rn), opval); | |
1682 | written |= (1 << 5); | |
1683 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
1684 | } | |
1685 | } else { | |
1686 | if (EQSI (ANDSI (FLD (f_rn), 1), 1)) { | |
1687 | { | |
1688 | DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
1689 | SET_H_XD (((FLD (f_rn)) & (INVQI (1))), opval); | |
1690 | written |= (1 << 7); | |
1691 | TRACE_RESULT (current_cpu, abuf, "xd-and--DFLT-index-of--DFLT-frn-inv--QI-1", 'f', opval); | |
1692 | } | |
1693 | } else { | |
1694 | { | |
1695 | DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
1696 | SET_H_DR (FLD (f_rn), opval); | |
1697 | written |= (1 << 6); | |
1698 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-frn", 'f', opval); | |
1699 | } | |
1700 | } | |
1701 | } | |
1702 | ||
1703 | abuf->written = written; | |
1704 | return vpc; | |
1705 | #undef FLD | |
1706 | } | |
1707 | ||
1708 | /* fmov3-compact: fmov @${rm}+, frn */ | |
1709 | ||
1710 | static SEM_PC | |
1711 | SEM_FN_NAME (sh64_compact,fmov3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1712 | { | |
1713 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1714 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1715 | int UNUSED written = 0; | |
1716 | IADDR UNUSED pc = abuf->addr; | |
1717 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1718 | ||
1719 | if (NOTBI (GET_H_SZBIT ())) { | |
1720 | { | |
1721 | { | |
1722 | SF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
1723 | SET_H_FRC (FLD (f_rn), opval); | |
1724 | written |= (1 << 5); | |
1725 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
1726 | } | |
1727 | { | |
1728 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
1729 | SET_H_GRC (FLD (f_rm), opval); | |
1730 | written |= (1 << 8); | |
1731 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
1732 | } | |
1733 | } | |
1734 | } else { | |
1735 | { | |
1736 | if (EQSI (ANDSI (FLD (f_rn), 1), 1)) { | |
1737 | { | |
1738 | DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
1739 | SET_H_XD (((FLD (f_rn)) & (INVQI (1))), opval); | |
1740 | written |= (1 << 7); | |
1741 | TRACE_RESULT (current_cpu, abuf, "xd-and--DFLT-index-of--DFLT-frn-inv--QI-1", 'f', opval); | |
1742 | } | |
1743 | } else { | |
1744 | { | |
1745 | DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
1746 | SET_H_DR (FLD (f_rn), opval); | |
1747 | written |= (1 << 6); | |
1748 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-frn", 'f', opval); | |
1749 | } | |
1750 | } | |
1751 | { | |
1752 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 8); | |
1753 | SET_H_GRC (FLD (f_rm), opval); | |
1754 | written |= (1 << 8); | |
1755 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
1756 | } | |
1757 | } | |
1758 | } | |
1759 | ||
1760 | abuf->written = written; | |
1761 | return vpc; | |
1762 | #undef FLD | |
1763 | } | |
1764 | ||
1765 | /* fmov4-compact: fmov @(r0, $rm), $frn */ | |
1766 | ||
1767 | static SEM_PC | |
1768 | SEM_FN_NAME (sh64_compact,fmov4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1769 | { | |
1770 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1771 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1772 | int UNUSED written = 0; | |
1773 | IADDR UNUSED pc = abuf->addr; | |
1774 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1775 | ||
1776 | if (NOTBI (GET_H_SZBIT ())) { | |
1777 | { | |
1778 | SF opval = GETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))); | |
1779 | SET_H_FRC (FLD (f_rn), opval); | |
1780 | written |= (1 << 6); | |
1781 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
1782 | } | |
1783 | } else { | |
1784 | if (EQSI (ANDSI (FLD (f_rn), 1), 1)) { | |
1785 | { | |
1786 | DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))); | |
1787 | SET_H_XD (((FLD (f_rn)) & (INVQI (1))), opval); | |
1788 | written |= (1 << 8); | |
1789 | TRACE_RESULT (current_cpu, abuf, "xd-and--DFLT-index-of--DFLT-frn-inv--QI-1", 'f', opval); | |
1790 | } | |
1791 | } else { | |
1792 | { | |
1793 | DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))); | |
1794 | SET_H_DR (FLD (f_rn), opval); | |
1795 | written |= (1 << 7); | |
1796 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-frn", 'f', opval); | |
1797 | } | |
1798 | } | |
1799 | } | |
1800 | ||
1801 | abuf->written = written; | |
1802 | return vpc; | |
1803 | #undef FLD | |
1804 | } | |
1805 | ||
1806 | /* fmov5-compact: fmov $frm, @$rn */ | |
1807 | ||
1808 | static SEM_PC | |
1809 | SEM_FN_NAME (sh64_compact,fmov5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1810 | { | |
1811 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1812 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1813 | int UNUSED written = 0; | |
1814 | IADDR UNUSED pc = abuf->addr; | |
1815 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1816 | ||
1817 | if (NOTBI (GET_H_SZBIT ())) { | |
1818 | { | |
1819 | SF opval = GET_H_FRC (FLD (f_rm)); | |
1820 | SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
1821 | written |= (1 << 6); | |
1822 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1823 | } | |
1824 | } else { | |
1825 | if (EQSI (ANDSI (FLD (f_rm), 1), 1)) { | |
1826 | { | |
1827 | DF opval = GET_H_XD (((FLD (f_rm)) & (INVQI (1)))); | |
1828 | SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
1829 | written |= (1 << 7); | |
1830 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1831 | } | |
1832 | } else { | |
1833 | { | |
1834 | DF opval = GET_H_DR (FLD (f_rm)); | |
1835 | SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
1836 | written |= (1 << 7); | |
1837 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1838 | } | |
1839 | } | |
1840 | } | |
1841 | ||
1842 | abuf->written = written; | |
1843 | return vpc; | |
1844 | #undef FLD | |
1845 | } | |
1846 | ||
1847 | /* fmov6-compact: fmov $frm, @-$rn */ | |
1848 | ||
1849 | static SEM_PC | |
1850 | SEM_FN_NAME (sh64_compact,fmov6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1851 | { | |
1852 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1853 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1854 | int UNUSED written = 0; | |
1855 | IADDR UNUSED pc = abuf->addr; | |
1856 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1857 | ||
1858 | if (NOTBI (GET_H_SZBIT ())) { | |
1859 | { | |
1860 | { | |
1861 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
1862 | SET_H_GRC (FLD (f_rn), opval); | |
1863 | written |= (1 << 8); | |
1864 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1865 | } | |
1866 | { | |
1867 | SF opval = GET_H_FRC (FLD (f_rm)); | |
1868 | SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
1869 | written |= (1 << 6); | |
1870 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1871 | } | |
1872 | } | |
1873 | } else { | |
1874 | { | |
1875 | { | |
1876 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 8); | |
1877 | SET_H_GRC (FLD (f_rn), opval); | |
1878 | written |= (1 << 8); | |
1879 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
1880 | } | |
1881 | if (EQSI (ANDSI (FLD (f_rm), 1), 1)) { | |
1882 | { | |
1883 | DF opval = GET_H_XD (((FLD (f_rm)) & (INVQI (1)))); | |
1884 | SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
1885 | written |= (1 << 7); | |
1886 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1887 | } | |
1888 | } else { | |
1889 | { | |
1890 | DF opval = GET_H_DR (FLD (f_rm)); | |
1891 | SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
1892 | written |= (1 << 7); | |
1893 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1894 | } | |
1895 | } | |
1896 | } | |
1897 | } | |
1898 | ||
1899 | abuf->written = written; | |
1900 | return vpc; | |
1901 | #undef FLD | |
1902 | } | |
1903 | ||
1904 | /* fmov7-compact: fmov $frm, @(r0, $rn) */ | |
1905 | ||
1906 | static SEM_PC | |
1907 | SEM_FN_NAME (sh64_compact,fmov7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1908 | { | |
1909 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1910 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1911 | int UNUSED written = 0; | |
1912 | IADDR UNUSED pc = abuf->addr; | |
1913 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1914 | ||
1915 | if (NOTBI (GET_H_SZBIT ())) { | |
1916 | { | |
1917 | SF opval = GET_H_FRC (FLD (f_rm)); | |
1918 | SETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
1919 | written |= (1 << 7); | |
1920 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1921 | } | |
1922 | } else { | |
1923 | if (EQSI (ANDSI (FLD (f_rm), 1), 1)) { | |
1924 | { | |
1925 | DF opval = GET_H_XD (((FLD (f_rm)) & (INVQI (1)))); | |
1926 | SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
1927 | written |= (1 << 8); | |
1928 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1929 | } | |
1930 | } else { | |
1931 | { | |
1932 | DF opval = GET_H_DR (FLD (f_rm)); | |
1933 | SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
1934 | written |= (1 << 8); | |
1935 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
1936 | } | |
1937 | } | |
1938 | } | |
1939 | ||
1940 | abuf->written = written; | |
1941 | return vpc; | |
1942 | #undef FLD | |
1943 | } | |
1944 | ||
1945 | /* fmul-compact: fmul $fsdm, $fsdn */ | |
1946 | ||
1947 | static SEM_PC | |
1948 | SEM_FN_NAME (sh64_compact,fmul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1949 | { | |
1950 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
1951 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1952 | int UNUSED written = 0; | |
1953 | IADDR UNUSED pc = abuf->addr; | |
1954 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1955 | ||
1956 | if (GET_H_PRBIT ()) { | |
1957 | { | |
1958 | DF opval = sh64_fmuld (current_cpu, GET_H_DR (FLD (f_rm)), GET_H_DR (FLD (f_rn))); | |
1959 | SET_H_DR (FLD (f_rn), opval); | |
1960 | written |= (1 << 8); | |
1961 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
1962 | } | |
1963 | } else { | |
1964 | { | |
1965 | SF opval = sh64_fmuls (current_cpu, GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn))); | |
1966 | SET_H_FRC (FLD (f_rn), opval); | |
1967 | written |= (1 << 7); | |
1968 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
1969 | } | |
1970 | } | |
1971 | ||
1972 | abuf->written = written; | |
1973 | return vpc; | |
1974 | #undef FLD | |
1975 | } | |
1976 | ||
1977 | /* fneg-compact: fneg $fsdn */ | |
1978 | ||
1979 | static SEM_PC | |
1980 | SEM_FN_NAME (sh64_compact,fneg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
1981 | { | |
1982 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
1983 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
1984 | int UNUSED written = 0; | |
1985 | IADDR UNUSED pc = abuf->addr; | |
1986 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
1987 | ||
1988 | if (GET_H_PRBIT ()) { | |
1989 | { | |
1990 | DF opval = sh64_fnegd (current_cpu, GET_H_DR (FLD (f_rn))); | |
1991 | SET_H_DR (FLD (f_rn), opval); | |
1992 | written |= (1 << 5); | |
1993 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
1994 | } | |
1995 | } else { | |
1996 | { | |
1997 | SF opval = sh64_fnegs (current_cpu, GET_H_FRC (FLD (f_rn))); | |
1998 | SET_H_FRC (FLD (f_rn), opval); | |
1999 | written |= (1 << 4); | |
2000 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
2001 | } | |
2002 | } | |
2003 | ||
2004 | abuf->written = written; | |
2005 | return vpc; | |
2006 | #undef FLD | |
2007 | } | |
2008 | ||
2009 | /* frchg-compact: frchg */ | |
2010 | ||
2011 | static SEM_PC | |
2012 | SEM_FN_NAME (sh64_compact,frchg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2013 | { | |
2014 | #define FLD(f) abuf->fields.fmt_empty.f | |
2015 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2016 | int UNUSED written = 0; | |
2017 | IADDR UNUSED pc = abuf->addr; | |
2018 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2019 | ||
2020 | { | |
2021 | BI opval = NOTBI (GET_H_FRBIT ()); | |
2022 | SET_H_FRBIT (opval); | |
2023 | TRACE_RESULT (current_cpu, abuf, "frbit", 'x', opval); | |
2024 | } | |
2025 | ||
2026 | return vpc; | |
2027 | #undef FLD | |
2028 | } | |
2029 | ||
2030 | /* fschg-compact: fschg */ | |
2031 | ||
2032 | static SEM_PC | |
2033 | SEM_FN_NAME (sh64_compact,fschg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2034 | { | |
2035 | #define FLD(f) abuf->fields.fmt_empty.f | |
2036 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2037 | int UNUSED written = 0; | |
2038 | IADDR UNUSED pc = abuf->addr; | |
2039 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2040 | ||
2041 | { | |
2042 | BI opval = NOTBI (GET_H_SZBIT ()); | |
2043 | SET_H_SZBIT (opval); | |
2044 | TRACE_RESULT (current_cpu, abuf, "szbit", 'x', opval); | |
2045 | } | |
2046 | ||
2047 | return vpc; | |
2048 | #undef FLD | |
2049 | } | |
2050 | ||
2051 | /* fsqrt-compact: fsqrt $fsdn */ | |
2052 | ||
2053 | static SEM_PC | |
2054 | SEM_FN_NAME (sh64_compact,fsqrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2055 | { | |
2056 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2057 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2058 | int UNUSED written = 0; | |
2059 | IADDR UNUSED pc = abuf->addr; | |
2060 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2061 | ||
2062 | if (GET_H_PRBIT ()) { | |
2063 | { | |
2064 | DF opval = sh64_fsqrtd (current_cpu, GET_H_DR (FLD (f_rn))); | |
2065 | SET_H_DR (FLD (f_rn), opval); | |
2066 | written |= (1 << 5); | |
2067 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
2068 | } | |
2069 | } else { | |
2070 | { | |
2071 | SF opval = sh64_fsqrts (current_cpu, GET_H_FRC (FLD (f_rn))); | |
2072 | SET_H_FRC (FLD (f_rn), opval); | |
2073 | written |= (1 << 4); | |
2074 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
2075 | } | |
2076 | } | |
2077 | ||
2078 | abuf->written = written; | |
2079 | return vpc; | |
2080 | #undef FLD | |
2081 | } | |
2082 | ||
2083 | /* fsts-compact: fsts fpul, $frn */ | |
2084 | ||
2085 | static SEM_PC | |
2086 | SEM_FN_NAME (sh64_compact,fsts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2087 | { | |
2088 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2089 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2090 | int UNUSED written = 0; | |
2091 | IADDR UNUSED pc = abuf->addr; | |
2092 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2093 | ||
2094 | { | |
2095 | SF opval = CPU (h_fr[((UINT) 32)]); | |
2096 | SET_H_FRC (FLD (f_rn), opval); | |
2097 | TRACE_RESULT (current_cpu, abuf, "frn", 'f', opval); | |
2098 | } | |
2099 | ||
2100 | return vpc; | |
2101 | #undef FLD | |
2102 | } | |
2103 | ||
2104 | /* fsub-compact: fsub $fsdm, $fsdn */ | |
2105 | ||
2106 | static SEM_PC | |
2107 | SEM_FN_NAME (sh64_compact,fsub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2108 | { | |
2109 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2110 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2111 | int UNUSED written = 0; | |
2112 | IADDR UNUSED pc = abuf->addr; | |
2113 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2114 | ||
2115 | if (GET_H_PRBIT ()) { | |
2116 | { | |
2117 | DF opval = sh64_fsubd (current_cpu, GET_H_DR (FLD (f_rn)), GET_H_DR (FLD (f_rm))); | |
2118 | SET_H_DR (FLD (f_rn), opval); | |
2119 | written |= (1 << 8); | |
2120 | TRACE_RESULT (current_cpu, abuf, "dr-index-of--DFLT-fsdn", 'f', opval); | |
2121 | } | |
2122 | } else { | |
2123 | { | |
2124 | SF opval = sh64_fsubs (current_cpu, GET_H_FRC (FLD (f_rn)), GET_H_FRC (FLD (f_rm))); | |
2125 | SET_H_FRC (FLD (f_rn), opval); | |
2126 | written |= (1 << 7); | |
2127 | TRACE_RESULT (current_cpu, abuf, "fsdn", 'f', opval); | |
2128 | } | |
2129 | } | |
2130 | ||
2131 | abuf->written = written; | |
2132 | return vpc; | |
2133 | #undef FLD | |
2134 | } | |
2135 | ||
2136 | /* ftrc-compact: ftrc $fsdn, fpul */ | |
2137 | ||
2138 | static SEM_PC | |
2139 | SEM_FN_NAME (sh64_compact,ftrc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2140 | { | |
2141 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2142 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2143 | int UNUSED written = 0; | |
2144 | IADDR UNUSED pc = abuf->addr; | |
2145 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2146 | ||
2147 | { | |
2148 | SF opval = ((GET_H_PRBIT ()) ? (sh64_ftrcdl (current_cpu, GET_H_DR (FLD (f_rn)))) : (sh64_ftrcsl (current_cpu, GET_H_FRC (FLD (f_rn))))); | |
2149 | CPU (h_fr[((UINT) 32)]) = opval; | |
2150 | TRACE_RESULT (current_cpu, abuf, "fpul", 'f', opval); | |
2151 | } | |
2152 | ||
2153 | return vpc; | |
2154 | #undef FLD | |
2155 | } | |
2156 | ||
2157 | /* ftrv-compact: ftrv xmtrx, $fvn */ | |
2158 | ||
2159 | static SEM_PC | |
2160 | SEM_FN_NAME (sh64_compact,ftrv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2161 | { | |
2162 | #define FLD(f) abuf->fields.sfmt_fipr_compact.f | |
2163 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2164 | int UNUSED written = 0; | |
2165 | IADDR UNUSED pc = abuf->addr; | |
2166 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2167 | ||
2168 | { | |
2169 | QI tmp_n; | |
2170 | SF tmp_res; | |
2171 | tmp_n = FLD (f_vn); | |
2172 | tmp_res = sh64_fmuls (current_cpu, GET_H_XF (((UINT) 0)), GET_H_FRC (tmp_n)); | |
2173 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 4)), GET_H_FRC (ADDQI (tmp_n, 1)))); | |
2174 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 8)), GET_H_FRC (ADDQI (tmp_n, 2)))); | |
2175 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 12)), GET_H_FRC (ADDQI (tmp_n, 3)))); | |
2176 | { | |
2177 | SF opval = tmp_res; | |
2178 | SET_H_FRC (tmp_n, opval); | |
2179 | TRACE_RESULT (current_cpu, abuf, "frc-n", 'f', opval); | |
2180 | } | |
2181 | tmp_res = sh64_fmuls (current_cpu, GET_H_XF (((UINT) 1)), GET_H_FRC (tmp_n)); | |
2182 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 5)), GET_H_FRC (ADDQI (tmp_n, 1)))); | |
2183 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 9)), GET_H_FRC (ADDQI (tmp_n, 2)))); | |
2184 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 13)), GET_H_FRC (ADDQI (tmp_n, 3)))); | |
2185 | { | |
2186 | SF opval = tmp_res; | |
2187 | SET_H_FRC (ADDQI (tmp_n, 1), opval); | |
2188 | TRACE_RESULT (current_cpu, abuf, "frc-add--DFLT-n-1", 'f', opval); | |
2189 | } | |
2190 | tmp_res = sh64_fmuls (current_cpu, GET_H_XF (((UINT) 2)), GET_H_FRC (tmp_n)); | |
2191 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 6)), GET_H_FRC (ADDQI (tmp_n, 1)))); | |
2192 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 10)), GET_H_FRC (ADDQI (tmp_n, 2)))); | |
2193 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 14)), GET_H_FRC (ADDQI (tmp_n, 3)))); | |
2194 | { | |
2195 | SF opval = tmp_res; | |
2196 | SET_H_FRC (ADDQI (tmp_n, 2), opval); | |
2197 | TRACE_RESULT (current_cpu, abuf, "frc-add--DFLT-n-2", 'f', opval); | |
2198 | } | |
2199 | tmp_res = sh64_fmuls (current_cpu, GET_H_XF (((UINT) 3)), GET_H_FRC (tmp_n)); | |
2200 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 7)), GET_H_FRC (ADDQI (tmp_n, 1)))); | |
2201 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 11)), GET_H_FRC (ADDQI (tmp_n, 2)))); | |
2202 | tmp_res = sh64_fadds (current_cpu, tmp_res, sh64_fmuls (current_cpu, GET_H_XF (((UINT) 15)), GET_H_FRC (ADDQI (tmp_n, 3)))); | |
2203 | { | |
2204 | SF opval = tmp_res; | |
2205 | SET_H_FRC (ADDQI (tmp_n, 3), opval); | |
2206 | TRACE_RESULT (current_cpu, abuf, "frc-add--DFLT-n-3", 'f', opval); | |
2207 | } | |
2208 | } | |
2209 | ||
2210 | return vpc; | |
2211 | #undef FLD | |
2212 | } | |
2213 | ||
2214 | /* jmp-compact: jmp @$rn */ | |
2215 | ||
2216 | static SEM_PC | |
2217 | SEM_FN_NAME (sh64_compact,jmp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2218 | { | |
2219 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2220 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2221 | int UNUSED written = 0; | |
2222 | IADDR UNUSED pc = abuf->addr; | |
2223 | SEM_BRANCH_INIT | |
2224 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2225 | ||
2226 | { | |
2227 | { | |
2228 | UDI opval = GET_H_GRC (FLD (f_rn)); | |
2229 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
2230 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
2231 | } | |
2232 | } | |
2233 | ||
2234 | SEM_BRANCH_FINI (vpc); | |
2235 | return vpc; | |
2236 | #undef FLD | |
2237 | } | |
2238 | ||
2239 | /* jsr-compact: jsr @$rn */ | |
2240 | ||
2241 | static SEM_PC | |
2242 | SEM_FN_NAME (sh64_compact,jsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2243 | { | |
2244 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2245 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2246 | int UNUSED written = 0; | |
2247 | IADDR UNUSED pc = abuf->addr; | |
2248 | SEM_BRANCH_INIT | |
2249 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2250 | ||
2251 | { | |
2252 | { | |
2253 | { | |
2254 | SI opval = ADDDI (pc, 4); | |
2255 | SET_H_PR (opval); | |
2256 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
2257 | } | |
2258 | { | |
2259 | UDI opval = GET_H_GRC (FLD (f_rn)); | |
2260 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
2261 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
2262 | } | |
2263 | } | |
2264 | } | |
2265 | ||
2266 | SEM_BRANCH_FINI (vpc); | |
2267 | return vpc; | |
2268 | #undef FLD | |
2269 | } | |
2270 | ||
2271 | /* ldc-compact: ldc $rn, gbr */ | |
2272 | ||
2273 | static SEM_PC | |
2274 | SEM_FN_NAME (sh64_compact,ldc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2275 | { | |
2276 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2277 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2278 | int UNUSED written = 0; | |
2279 | IADDR UNUSED pc = abuf->addr; | |
2280 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2281 | ||
2282 | { | |
2283 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2284 | SET_H_GBR (opval); | |
2285 | TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval); | |
2286 | } | |
2287 | ||
2288 | return vpc; | |
2289 | #undef FLD | |
2290 | } | |
2291 | ||
2292 | /* ldcl-compact: ldc.l @${rn}+, gbr */ | |
2293 | ||
2294 | static SEM_PC | |
2295 | SEM_FN_NAME (sh64_compact,ldcl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2296 | { | |
2297 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2298 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2299 | int UNUSED written = 0; | |
2300 | IADDR UNUSED pc = abuf->addr; | |
2301 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2302 | ||
2303 | { | |
2304 | { | |
2305 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2306 | SET_H_GBR (opval); | |
2307 | TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval); | |
2308 | } | |
2309 | { | |
2310 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2311 | SET_H_GRC (FLD (f_rn), opval); | |
2312 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2313 | } | |
2314 | } | |
2315 | ||
2316 | return vpc; | |
2317 | #undef FLD | |
2318 | } | |
2319 | ||
2320 | /* lds-fpscr-compact: lds $rn, fpscr */ | |
2321 | ||
2322 | static SEM_PC | |
2323 | SEM_FN_NAME (sh64_compact,lds_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2324 | { | |
2325 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2326 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2327 | int UNUSED written = 0; | |
2328 | IADDR UNUSED pc = abuf->addr; | |
2329 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2330 | ||
2331 | { | |
2332 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2333 | SET_H_FPCCR (opval); | |
2334 | TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval); | |
2335 | } | |
2336 | ||
2337 | return vpc; | |
2338 | #undef FLD | |
2339 | } | |
2340 | ||
2341 | /* ldsl-fpscr-compact: lds.l @${rn}+, fpscr */ | |
2342 | ||
2343 | static SEM_PC | |
2344 | SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2345 | { | |
2346 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2347 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2348 | int UNUSED written = 0; | |
2349 | IADDR UNUSED pc = abuf->addr; | |
2350 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2351 | ||
2352 | { | |
2353 | { | |
2354 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2355 | SET_H_FPCCR (opval); | |
2356 | TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval); | |
2357 | } | |
2358 | { | |
2359 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2360 | SET_H_GRC (FLD (f_rn), opval); | |
2361 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2362 | } | |
2363 | } | |
2364 | ||
2365 | return vpc; | |
2366 | #undef FLD | |
2367 | } | |
2368 | ||
2369 | /* lds-fpul-compact: lds $rn, fpul */ | |
2370 | ||
2371 | static SEM_PC | |
2372 | SEM_FN_NAME (sh64_compact,lds_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2373 | { | |
2374 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2375 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2376 | int UNUSED written = 0; | |
2377 | IADDR UNUSED pc = abuf->addr; | |
2378 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2379 | ||
2380 | { | |
2381 | SF opval = SUBWORDSISF (GET_H_GRC (FLD (f_rn))); | |
2382 | CPU (h_fr[((UINT) 32)]) = opval; | |
2383 | TRACE_RESULT (current_cpu, abuf, "fpul", 'f', opval); | |
2384 | } | |
2385 | ||
2386 | return vpc; | |
2387 | #undef FLD | |
2388 | } | |
2389 | ||
2390 | /* ldsl-fpul-compact: lds.l @${rn}+, fpul */ | |
2391 | ||
2392 | static SEM_PC | |
2393 | SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2394 | { | |
2395 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2396 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2397 | int UNUSED written = 0; | |
2398 | IADDR UNUSED pc = abuf->addr; | |
2399 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2400 | ||
2401 | { | |
2402 | { | |
2403 | SF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2404 | CPU (h_fr[((UINT) 32)]) = opval; | |
2405 | TRACE_RESULT (current_cpu, abuf, "fpul", 'f', opval); | |
2406 | } | |
2407 | { | |
2408 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2409 | SET_H_GRC (FLD (f_rn), opval); | |
2410 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2411 | } | |
2412 | } | |
2413 | ||
2414 | return vpc; | |
2415 | #undef FLD | |
2416 | } | |
2417 | ||
2418 | /* lds-mach-compact: lds $rn, mach */ | |
2419 | ||
2420 | static SEM_PC | |
2421 | SEM_FN_NAME (sh64_compact,lds_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2422 | { | |
2423 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2424 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2425 | int UNUSED written = 0; | |
2426 | IADDR UNUSED pc = abuf->addr; | |
2427 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2428 | ||
2429 | { | |
2430 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2431 | SET_H_MACH (opval); | |
2432 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2433 | } | |
2434 | ||
2435 | return vpc; | |
2436 | #undef FLD | |
2437 | } | |
2438 | ||
2439 | /* ldsl-mach-compact: lds.l @${rn}+, mach */ | |
2440 | ||
2441 | static SEM_PC | |
2442 | SEM_FN_NAME (sh64_compact,ldsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2443 | { | |
2444 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2445 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2446 | int UNUSED written = 0; | |
2447 | IADDR UNUSED pc = abuf->addr; | |
2448 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2449 | ||
2450 | { | |
2451 | { | |
2452 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2453 | SET_H_MACH (opval); | |
2454 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2455 | } | |
2456 | { | |
2457 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2458 | SET_H_GRC (FLD (f_rn), opval); | |
2459 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2460 | } | |
2461 | } | |
2462 | ||
2463 | return vpc; | |
2464 | #undef FLD | |
2465 | } | |
2466 | ||
2467 | /* lds-macl-compact: lds $rn, macl */ | |
2468 | ||
2469 | static SEM_PC | |
2470 | SEM_FN_NAME (sh64_compact,lds_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2471 | { | |
2472 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2473 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2474 | int UNUSED written = 0; | |
2475 | IADDR UNUSED pc = abuf->addr; | |
2476 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2477 | ||
2478 | { | |
2479 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2480 | SET_H_MACL (opval); | |
2481 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2482 | } | |
2483 | ||
2484 | return vpc; | |
2485 | #undef FLD | |
2486 | } | |
2487 | ||
2488 | /* ldsl-macl-compact: lds.l @${rn}+, macl */ | |
2489 | ||
2490 | static SEM_PC | |
2491 | SEM_FN_NAME (sh64_compact,ldsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2492 | { | |
2493 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2494 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2495 | int UNUSED written = 0; | |
2496 | IADDR UNUSED pc = abuf->addr; | |
2497 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2498 | ||
2499 | { | |
2500 | { | |
2501 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2502 | SET_H_MACL (opval); | |
2503 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2504 | } | |
2505 | { | |
2506 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2507 | SET_H_GRC (FLD (f_rn), opval); | |
2508 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2509 | } | |
2510 | } | |
2511 | ||
2512 | return vpc; | |
2513 | #undef FLD | |
2514 | } | |
2515 | ||
2516 | /* lds-pr-compact: lds $rn, pr */ | |
2517 | ||
2518 | static SEM_PC | |
2519 | SEM_FN_NAME (sh64_compact,lds_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2520 | { | |
2521 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2522 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2523 | int UNUSED written = 0; | |
2524 | IADDR UNUSED pc = abuf->addr; | |
2525 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2526 | ||
2527 | { | |
2528 | SI opval = GET_H_GRC (FLD (f_rn)); | |
2529 | SET_H_PR (opval); | |
2530 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
2531 | } | |
2532 | ||
2533 | return vpc; | |
2534 | #undef FLD | |
2535 | } | |
2536 | ||
2537 | /* ldsl-pr-compact: lds.l @${rn}+, pr */ | |
2538 | ||
2539 | static SEM_PC | |
2540 | SEM_FN_NAME (sh64_compact,ldsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2541 | { | |
2542 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
2543 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2544 | int UNUSED written = 0; | |
2545 | IADDR UNUSED pc = abuf->addr; | |
2546 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2547 | ||
2548 | { | |
2549 | { | |
2550 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2551 | SET_H_PR (opval); | |
2552 | TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval); | |
2553 | } | |
2554 | { | |
2555 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2556 | SET_H_GRC (FLD (f_rn), opval); | |
2557 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2558 | } | |
2559 | } | |
2560 | ||
2561 | return vpc; | |
2562 | #undef FLD | |
2563 | } | |
2564 | ||
2565 | /* macl-compact: mac.l @${rm}+, @${rn}+ */ | |
2566 | ||
2567 | static SEM_PC | |
2568 | SEM_FN_NAME (sh64_compact,macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2569 | { | |
2570 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2571 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2572 | int UNUSED written = 0; | |
2573 | IADDR UNUSED pc = abuf->addr; | |
2574 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2575 | ||
2576 | { | |
2577 | DI tmp_tmpry; | |
2578 | DI tmp_mac; | |
2579 | DI tmp_result; | |
2580 | SI tmp_x; | |
2581 | SI tmp_y; | |
2582 | tmp_x = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2583 | { | |
2584 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2585 | SET_H_GRC (FLD (f_rn), opval); | |
2586 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2587 | } | |
2588 | if (EQSI (FLD (f_rn), FLD (f_rm))) { | |
2589 | { | |
2590 | { | |
2591 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4); | |
2592 | SET_H_GRC (FLD (f_rn), opval); | |
2593 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2594 | } | |
2595 | { | |
2596 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
2597 | SET_H_GRC (FLD (f_rm), opval); | |
2598 | written |= (1 << 11); | |
2599 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
2600 | } | |
2601 | } | |
2602 | } | |
2603 | tmp_y = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
2604 | { | |
2605 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
2606 | SET_H_GRC (FLD (f_rm), opval); | |
2607 | written |= (1 << 11); | |
2608 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
2609 | } | |
2610 | tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y)); | |
2611 | tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ())); | |
2612 | tmp_result = ADDDI (tmp_mac, tmp_tmpry); | |
2613 | { | |
2614 | if (GET_H_SBIT ()) { | |
2615 | { | |
2616 | SI tmp_min; | |
2617 | SI tmp_max; | |
2618 | tmp_max = SRLDI (INVDI (0), 16); | |
2619 | tmp_min = SRLDI (INVDI (0), 15); | |
2620 | if (GTDI (tmp_result, tmp_max)) { | |
2621 | tmp_result = tmp_max; | |
2622 | } else { | |
2623 | if (LTDI (tmp_result, tmp_min)) { | |
2624 | tmp_result = tmp_min; | |
2625 | } | |
2626 | } | |
2627 | } | |
2628 | } | |
2629 | { | |
2630 | SI opval = SUBWORDDISI (tmp_result, 0); | |
2631 | SET_H_MACH (opval); | |
2632 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2633 | } | |
2634 | { | |
2635 | SI opval = SUBWORDDISI (tmp_result, 1); | |
2636 | SET_H_MACL (opval); | |
2637 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2638 | } | |
2639 | } | |
2640 | } | |
2641 | ||
2642 | abuf->written = written; | |
2643 | return vpc; | |
2644 | #undef FLD | |
2645 | } | |
2646 | ||
2647 | /* macw-compact: mac.w @${rm}+, @${rn}+ */ | |
2648 | ||
2649 | static SEM_PC | |
2650 | SEM_FN_NAME (sh64_compact,macw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2651 | { | |
2652 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2653 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2654 | int UNUSED written = 0; | |
2655 | IADDR UNUSED pc = abuf->addr; | |
2656 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2657 | ||
2658 | { | |
2659 | SI tmp_tmpry; | |
2660 | DI tmp_mac; | |
2661 | DI tmp_result; | |
2662 | HI tmp_x; | |
2663 | HI tmp_y; | |
2664 | tmp_x = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
2665 | { | |
2666 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2); | |
2667 | SET_H_GRC (FLD (f_rn), opval); | |
2668 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2669 | } | |
2670 | if (EQSI (FLD (f_rn), FLD (f_rm))) { | |
2671 | { | |
2672 | { | |
2673 | SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2); | |
2674 | SET_H_GRC (FLD (f_rn), opval); | |
2675 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2676 | } | |
2677 | { | |
2678 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2); | |
2679 | SET_H_GRC (FLD (f_rm), opval); | |
2680 | written |= (1 << 11); | |
2681 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
2682 | } | |
2683 | } | |
2684 | } | |
2685 | tmp_y = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
2686 | { | |
2687 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2); | |
2688 | SET_H_GRC (FLD (f_rm), opval); | |
2689 | written |= (1 << 11); | |
2690 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
2691 | } | |
2692 | tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y)); | |
2693 | if (GET_H_SBIT ()) { | |
2694 | { | |
2695 | if (ADDOFSI (tmp_tmpry, GET_H_MACL (), 0)) { | |
2696 | { | |
2697 | SI opval = 1; | |
2698 | SET_H_MACH (opval); | |
2699 | written |= (1 << 9); | |
2700 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2701 | } | |
2702 | } | |
2703 | { | |
2704 | SI opval = ADDSI (tmp_tmpry, GET_H_MACL ()); | |
2705 | SET_H_MACL (opval); | |
2706 | written |= (1 << 10); | |
2707 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2708 | } | |
2709 | } | |
2710 | } else { | |
2711 | { | |
2712 | tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ())); | |
2713 | tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry)); | |
2714 | { | |
2715 | SI opval = SUBWORDDISI (tmp_result, 0); | |
2716 | SET_H_MACH (opval); | |
2717 | written |= (1 << 9); | |
2718 | TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval); | |
2719 | } | |
2720 | { | |
2721 | SI opval = SUBWORDDISI (tmp_result, 1); | |
2722 | SET_H_MACL (opval); | |
2723 | written |= (1 << 10); | |
2724 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
2725 | } | |
2726 | } | |
2727 | } | |
2728 | } | |
2729 | ||
2730 | abuf->written = written; | |
2731 | return vpc; | |
2732 | #undef FLD | |
2733 | } | |
2734 | ||
2735 | /* mov-compact: mov $rm64, $rn64 */ | |
2736 | ||
2737 | static SEM_PC | |
2738 | SEM_FN_NAME (sh64_compact,mov_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2739 | { | |
2740 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2741 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2742 | int UNUSED written = 0; | |
2743 | IADDR UNUSED pc = abuf->addr; | |
2744 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2745 | ||
2746 | { | |
2747 | DI opval = GET_H_GR (FLD (f_rm)); | |
2748 | SET_H_GR (FLD (f_rn), opval); | |
2749 | TRACE_RESULT (current_cpu, abuf, "rn64", 'D', opval); | |
2750 | } | |
2751 | ||
2752 | return vpc; | |
2753 | #undef FLD | |
2754 | } | |
2755 | ||
2756 | /* movi-compact: mov #$imm8, $rn */ | |
2757 | ||
2758 | static SEM_PC | |
2759 | SEM_FN_NAME (sh64_compact,movi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2760 | { | |
2761 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
2762 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2763 | int UNUSED written = 0; | |
2764 | IADDR UNUSED pc = abuf->addr; | |
2765 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2766 | ||
2767 | { | |
2768 | SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255)); | |
2769 | SET_H_GRC (FLD (f_rn), opval); | |
2770 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2771 | } | |
2772 | ||
2773 | return vpc; | |
2774 | #undef FLD | |
2775 | } | |
2776 | ||
2777 | /* movb1-compact: mov.b $rm, @$rn */ | |
2778 | ||
2779 | static SEM_PC | |
2780 | SEM_FN_NAME (sh64_compact,movb1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2781 | { | |
2782 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2783 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2784 | int UNUSED written = 0; | |
2785 | IADDR UNUSED pc = abuf->addr; | |
2786 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2787 | ||
2788 | { | |
2789 | UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3); | |
2790 | SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
2791 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2792 | } | |
2793 | ||
2794 | return vpc; | |
2795 | #undef FLD | |
2796 | } | |
2797 | ||
2798 | /* movb2-compact: mov.b $rm, @-$rn */ | |
2799 | ||
2800 | static SEM_PC | |
2801 | SEM_FN_NAME (sh64_compact,movb2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2802 | { | |
2803 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2804 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2805 | int UNUSED written = 0; | |
2806 | IADDR UNUSED pc = abuf->addr; | |
2807 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2808 | ||
2809 | { | |
2810 | DI tmp_addr; | |
2811 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 1); | |
2812 | { | |
2813 | UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3); | |
2814 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
2815 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2816 | } | |
2817 | { | |
2818 | SI opval = tmp_addr; | |
2819 | SET_H_GRC (FLD (f_rn), opval); | |
2820 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2821 | } | |
2822 | } | |
2823 | ||
2824 | return vpc; | |
2825 | #undef FLD | |
2826 | } | |
2827 | ||
2828 | /* movb3-compact: mov.b $rm, @(r0,$rn) */ | |
2829 | ||
2830 | static SEM_PC | |
2831 | SEM_FN_NAME (sh64_compact,movb3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2832 | { | |
2833 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2834 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2835 | int UNUSED written = 0; | |
2836 | IADDR UNUSED pc = abuf->addr; | |
2837 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2838 | ||
2839 | { | |
2840 | UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3); | |
2841 | SETMEMUQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
2842 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2843 | } | |
2844 | ||
2845 | return vpc; | |
2846 | #undef FLD | |
2847 | } | |
2848 | ||
2849 | /* movb4-compact: mov.b r0, @($imm8, gbr) */ | |
2850 | ||
2851 | static SEM_PC | |
2852 | SEM_FN_NAME (sh64_compact,movb4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2853 | { | |
2854 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
2855 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2856 | int UNUSED written = 0; | |
2857 | IADDR UNUSED pc = abuf->addr; | |
2858 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2859 | ||
2860 | { | |
2861 | DI tmp_addr; | |
2862 | tmp_addr = ADDSI (GET_H_GBR (), FLD (f_imm8)); | |
2863 | { | |
2864 | UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3); | |
2865 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
2866 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2867 | } | |
2868 | } | |
2869 | ||
2870 | return vpc; | |
2871 | #undef FLD | |
2872 | } | |
2873 | ||
2874 | /* movb5-compact: mov.b r0, @($imm4, $rm) */ | |
2875 | ||
2876 | static SEM_PC | |
2877 | SEM_FN_NAME (sh64_compact,movb5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2878 | { | |
2879 | #define FLD(f) abuf->fields.sfmt_movb5_compact.f | |
2880 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2881 | int UNUSED written = 0; | |
2882 | IADDR UNUSED pc = abuf->addr; | |
2883 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2884 | ||
2885 | { | |
2886 | DI tmp_addr; | |
2887 | tmp_addr = ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4)); | |
2888 | { | |
2889 | UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3); | |
2890 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
2891 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
2892 | } | |
2893 | } | |
2894 | ||
2895 | return vpc; | |
2896 | #undef FLD | |
2897 | } | |
2898 | ||
2899 | /* movb6-compact: mov.b @$rm, $rn */ | |
2900 | ||
2901 | static SEM_PC | |
2902 | SEM_FN_NAME (sh64_compact,movb6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2903 | { | |
2904 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2905 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2906 | int UNUSED written = 0; | |
2907 | IADDR UNUSED pc = abuf->addr; | |
2908 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2909 | ||
2910 | { | |
2911 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm)))); | |
2912 | SET_H_GRC (FLD (f_rn), opval); | |
2913 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2914 | } | |
2915 | ||
2916 | return vpc; | |
2917 | #undef FLD | |
2918 | } | |
2919 | ||
2920 | /* movb7-compact: mov.b @${rm}+, $rn */ | |
2921 | ||
2922 | static SEM_PC | |
2923 | SEM_FN_NAME (sh64_compact,movb7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2924 | { | |
2925 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2926 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2927 | int UNUSED written = 0; | |
2928 | IADDR UNUSED pc = abuf->addr; | |
2929 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2930 | ||
2931 | { | |
2932 | QI tmp_data; | |
2933 | tmp_data = GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
2934 | if (EQSI (FLD (f_rm), FLD (f_rn))) { | |
2935 | { | |
2936 | SI opval = EXTQISI (tmp_data); | |
2937 | SET_H_GRC (FLD (f_rm), opval); | |
2938 | written |= (1 << 4); | |
2939 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
2940 | } | |
2941 | } else { | |
2942 | { | |
2943 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 1); | |
2944 | SET_H_GRC (FLD (f_rm), opval); | |
2945 | written |= (1 << 4); | |
2946 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
2947 | } | |
2948 | } | |
2949 | { | |
2950 | SI opval = EXTQISI (tmp_data); | |
2951 | SET_H_GRC (FLD (f_rn), opval); | |
2952 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2953 | } | |
2954 | } | |
2955 | ||
2956 | abuf->written = written; | |
2957 | return vpc; | |
2958 | #undef FLD | |
2959 | } | |
2960 | ||
2961 | /* movb8-compact: mov.b @(r0, $rm), $rn */ | |
2962 | ||
2963 | static SEM_PC | |
2964 | SEM_FN_NAME (sh64_compact,movb8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2965 | { | |
2966 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
2967 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2968 | int UNUSED written = 0; | |
2969 | IADDR UNUSED pc = abuf->addr; | |
2970 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2971 | ||
2972 | { | |
2973 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))))); | |
2974 | SET_H_GRC (FLD (f_rn), opval); | |
2975 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
2976 | } | |
2977 | ||
2978 | return vpc; | |
2979 | #undef FLD | |
2980 | } | |
2981 | ||
2982 | /* movb9-compact: mov.b @($imm8, gbr), r0 */ | |
2983 | ||
2984 | static SEM_PC | |
2985 | SEM_FN_NAME (sh64_compact,movb9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
2986 | { | |
2987 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
2988 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
2989 | int UNUSED written = 0; | |
2990 | IADDR UNUSED pc = abuf->addr; | |
2991 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
2992 | ||
2993 | { | |
2994 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8)))); | |
2995 | SET_H_GRC (((UINT) 0), opval); | |
2996 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
2997 | } | |
2998 | ||
2999 | return vpc; | |
3000 | #undef FLD | |
3001 | } | |
3002 | ||
3003 | /* movb10-compact: mov.b @($imm4, $rm), r0 */ | |
3004 | ||
3005 | static SEM_PC | |
3006 | SEM_FN_NAME (sh64_compact,movb10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3007 | { | |
3008 | #define FLD(f) abuf->fields.sfmt_movb5_compact.f | |
3009 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3010 | int UNUSED written = 0; | |
3011 | IADDR UNUSED pc = abuf->addr; | |
3012 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3013 | ||
3014 | { | |
3015 | SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4)))); | |
3016 | SET_H_GRC (((UINT) 0), opval); | |
3017 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
3018 | } | |
3019 | ||
3020 | return vpc; | |
3021 | #undef FLD | |
3022 | } | |
3023 | ||
3024 | /* movl1-compact: mov.l $rm, @$rn */ | |
3025 | ||
3026 | static SEM_PC | |
3027 | SEM_FN_NAME (sh64_compact,movl1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3028 | { | |
3029 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3030 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3031 | int UNUSED written = 0; | |
3032 | IADDR UNUSED pc = abuf->addr; | |
3033 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3034 | ||
3035 | { | |
3036 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3037 | SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
3038 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3039 | } | |
3040 | ||
3041 | return vpc; | |
3042 | #undef FLD | |
3043 | } | |
3044 | ||
3045 | /* movl2-compact: mov.l $rm, @-$rn */ | |
3046 | ||
3047 | static SEM_PC | |
3048 | SEM_FN_NAME (sh64_compact,movl2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3049 | { | |
3050 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3051 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3052 | int UNUSED written = 0; | |
3053 | IADDR UNUSED pc = abuf->addr; | |
3054 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3055 | ||
3056 | { | |
3057 | SI tmp_addr; | |
3058 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
3059 | { | |
3060 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3061 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
3062 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3063 | } | |
3064 | { | |
3065 | SI opval = tmp_addr; | |
3066 | SET_H_GRC (FLD (f_rn), opval); | |
3067 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3068 | } | |
3069 | } | |
3070 | ||
3071 | return vpc; | |
3072 | #undef FLD | |
3073 | } | |
3074 | ||
3075 | /* movl3-compact: mov.l $rm, @(r0, $rn) */ | |
3076 | ||
3077 | static SEM_PC | |
3078 | SEM_FN_NAME (sh64_compact,movl3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3079 | { | |
3080 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3081 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3082 | int UNUSED written = 0; | |
3083 | IADDR UNUSED pc = abuf->addr; | |
3084 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3085 | ||
3086 | { | |
3087 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3088 | SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
3089 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3090 | } | |
3091 | ||
3092 | return vpc; | |
3093 | #undef FLD | |
3094 | } | |
3095 | ||
3096 | /* movl4-compact: mov.l r0, @($imm8x4, gbr) */ | |
3097 | ||
3098 | static SEM_PC | |
3099 | SEM_FN_NAME (sh64_compact,movl4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3100 | { | |
3101 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3102 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3103 | int UNUSED written = 0; | |
3104 | IADDR UNUSED pc = abuf->addr; | |
3105 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3106 | ||
3107 | { | |
3108 | SI opval = GET_H_GRC (((UINT) 0)); | |
3109 | SETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)), opval); | |
3110 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3111 | } | |
3112 | ||
3113 | return vpc; | |
3114 | #undef FLD | |
3115 | } | |
3116 | ||
3117 | /* movl5-compact: mov.l $rm, @($imm4x4, $rn) */ | |
3118 | ||
3119 | static SEM_PC | |
3120 | SEM_FN_NAME (sh64_compact,movl5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3121 | { | |
3122 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3123 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3124 | int UNUSED written = 0; | |
3125 | IADDR UNUSED pc = abuf->addr; | |
3126 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3127 | ||
3128 | { | |
3129 | SI opval = GET_H_GRC (FLD (f_rm)); | |
3130 | SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm4x4)), opval); | |
3131 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3132 | } | |
3133 | ||
3134 | return vpc; | |
3135 | #undef FLD | |
3136 | } | |
3137 | ||
3138 | /* movl6-compact: mov.l @$rm, $rn */ | |
3139 | ||
3140 | static SEM_PC | |
3141 | SEM_FN_NAME (sh64_compact,movl6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3142 | { | |
3143 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3144 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3145 | int UNUSED written = 0; | |
3146 | IADDR UNUSED pc = abuf->addr; | |
3147 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3148 | ||
3149 | { | |
3150 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
3151 | SET_H_GRC (FLD (f_rn), opval); | |
3152 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3153 | } | |
3154 | ||
3155 | return vpc; | |
3156 | #undef FLD | |
3157 | } | |
3158 | ||
3159 | /* movl7-compact: mov.l @${rm}+, $rn */ | |
3160 | ||
3161 | static SEM_PC | |
3162 | SEM_FN_NAME (sh64_compact,movl7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3163 | { | |
3164 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3165 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3166 | int UNUSED written = 0; | |
3167 | IADDR UNUSED pc = abuf->addr; | |
3168 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3169 | ||
3170 | { | |
3171 | { | |
3172 | SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
3173 | SET_H_GRC (FLD (f_rn), opval); | |
3174 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3175 | } | |
3176 | if (EQSI (FLD (f_rm), FLD (f_rn))) { | |
3177 | { | |
3178 | SI opval = GET_H_GRC (FLD (f_rn)); | |
3179 | SET_H_GRC (FLD (f_rm), opval); | |
3180 | written |= (1 << 5); | |
3181 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
3182 | } | |
3183 | } else { | |
3184 | { | |
3185 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4); | |
3186 | SET_H_GRC (FLD (f_rm), opval); | |
3187 | written |= (1 << 5); | |
3188 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
3189 | } | |
3190 | } | |
3191 | } | |
3192 | ||
3193 | abuf->written = written; | |
3194 | return vpc; | |
3195 | #undef FLD | |
3196 | } | |
3197 | ||
3198 | /* movl8-compact: mov.l @(r0, $rm), $rn */ | |
3199 | ||
3200 | static SEM_PC | |
3201 | SEM_FN_NAME (sh64_compact,movl8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3202 | { | |
3203 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3204 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3205 | int UNUSED written = 0; | |
3206 | IADDR UNUSED pc = abuf->addr; | |
3207 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3208 | ||
3209 | { | |
3210 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))); | |
3211 | SET_H_GRC (FLD (f_rn), opval); | |
3212 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3213 | } | |
3214 | ||
3215 | return vpc; | |
3216 | #undef FLD | |
3217 | } | |
3218 | ||
3219 | /* movl9-compact: mov.l @($imm8x4, gbr), r0 */ | |
3220 | ||
3221 | static SEM_PC | |
3222 | SEM_FN_NAME (sh64_compact,movl9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3223 | { | |
3224 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3225 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3226 | int UNUSED written = 0; | |
3227 | IADDR UNUSED pc = abuf->addr; | |
3228 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3229 | ||
3230 | { | |
3231 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4))); | |
3232 | SET_H_GRC (((UINT) 0), opval); | |
3233 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
3234 | } | |
3235 | ||
3236 | return vpc; | |
3237 | #undef FLD | |
3238 | } | |
3239 | ||
3240 | /* movl10-compact: mov.l @($imm8x4, pc), $rn */ | |
3241 | ||
3242 | static SEM_PC | |
3243 | SEM_FN_NAME (sh64_compact,movl10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3244 | { | |
3245 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3246 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3247 | int UNUSED written = 0; | |
3248 | IADDR UNUSED pc = abuf->addr; | |
3249 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3250 | ||
3251 | { | |
3252 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3)))); | |
3253 | SET_H_GRC (FLD (f_rn), opval); | |
3254 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3255 | } | |
3256 | ||
3257 | return vpc; | |
3258 | #undef FLD | |
3259 | } | |
3260 | ||
3261 | /* movl11-compact: mov.l @($imm4x4, $rm), $rn */ | |
3262 | ||
3263 | static SEM_PC | |
3264 | SEM_FN_NAME (sh64_compact,movl11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3265 | { | |
3266 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3267 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3268 | int UNUSED written = 0; | |
3269 | IADDR UNUSED pc = abuf->addr; | |
3270 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3271 | ||
3272 | { | |
3273 | SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x4))); | |
3274 | SET_H_GRC (FLD (f_rn), opval); | |
3275 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3276 | } | |
3277 | ||
3278 | return vpc; | |
3279 | #undef FLD | |
3280 | } | |
3281 | ||
3282 | /* movw1-compact: mov.w $rm, @$rn */ | |
3283 | ||
3284 | static SEM_PC | |
3285 | SEM_FN_NAME (sh64_compact,movw1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3286 | { | |
3287 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3288 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3289 | int UNUSED written = 0; | |
3290 | IADDR UNUSED pc = abuf->addr; | |
3291 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3292 | ||
3293 | { | |
3294 | HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1); | |
3295 | SETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
3296 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3297 | } | |
3298 | ||
3299 | return vpc; | |
3300 | #undef FLD | |
3301 | } | |
3302 | ||
3303 | /* movw2-compact: mov.w $rm, @-$rn */ | |
3304 | ||
3305 | static SEM_PC | |
3306 | SEM_FN_NAME (sh64_compact,movw2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3307 | { | |
3308 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3309 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3310 | int UNUSED written = 0; | |
3311 | IADDR UNUSED pc = abuf->addr; | |
3312 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3313 | ||
3314 | { | |
3315 | DI tmp_addr; | |
3316 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 2); | |
3317 | { | |
3318 | HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1); | |
3319 | SETMEMHI (current_cpu, pc, tmp_addr, opval); | |
3320 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3321 | } | |
3322 | { | |
3323 | SI opval = tmp_addr; | |
3324 | SET_H_GRC (FLD (f_rn), opval); | |
3325 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3326 | } | |
3327 | } | |
3328 | ||
3329 | return vpc; | |
3330 | #undef FLD | |
3331 | } | |
3332 | ||
3333 | /* movw3-compact: mov.w $rm, @(r0, $rn) */ | |
3334 | ||
3335 | static SEM_PC | |
3336 | SEM_FN_NAME (sh64_compact,movw3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3337 | { | |
3338 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3339 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3340 | int UNUSED written = 0; | |
3341 | IADDR UNUSED pc = abuf->addr; | |
3342 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3343 | ||
3344 | { | |
3345 | HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1); | |
3346 | SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval); | |
3347 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3348 | } | |
3349 | ||
3350 | return vpc; | |
3351 | #undef FLD | |
3352 | } | |
3353 | ||
3354 | /* movw4-compact: mov.w r0, @($imm8x2, gbr) */ | |
3355 | ||
3356 | static SEM_PC | |
3357 | SEM_FN_NAME (sh64_compact,movw4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3358 | { | |
3359 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3360 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3361 | int UNUSED written = 0; | |
3362 | IADDR UNUSED pc = abuf->addr; | |
3363 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3364 | ||
3365 | { | |
3366 | HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1); | |
3367 | SETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2)), opval); | |
3368 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3369 | } | |
3370 | ||
3371 | return vpc; | |
3372 | #undef FLD | |
3373 | } | |
3374 | ||
3375 | /* movw5-compact: mov.w r0, @($imm4x2, $rn) */ | |
3376 | ||
3377 | static SEM_PC | |
3378 | SEM_FN_NAME (sh64_compact,movw5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3379 | { | |
3380 | #define FLD(f) abuf->fields.sfmt_movw5_compact.f | |
3381 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3382 | int UNUSED written = 0; | |
3383 | IADDR UNUSED pc = abuf->addr; | |
3384 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3385 | ||
3386 | { | |
3387 | HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1); | |
3388 | SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm4x2)), opval); | |
3389 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3390 | } | |
3391 | ||
3392 | return vpc; | |
3393 | #undef FLD | |
3394 | } | |
3395 | ||
3396 | /* movw6-compact: mov.w @$rm, $rn */ | |
3397 | ||
3398 | static SEM_PC | |
3399 | SEM_FN_NAME (sh64_compact,movw6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3400 | { | |
3401 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3402 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3403 | int UNUSED written = 0; | |
3404 | IADDR UNUSED pc = abuf->addr; | |
3405 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3406 | ||
3407 | { | |
3408 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)))); | |
3409 | SET_H_GRC (FLD (f_rn), opval); | |
3410 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3411 | } | |
3412 | ||
3413 | return vpc; | |
3414 | #undef FLD | |
3415 | } | |
3416 | ||
3417 | /* movw7-compact: mov.w @${rm}+, $rn */ | |
3418 | ||
3419 | static SEM_PC | |
3420 | SEM_FN_NAME (sh64_compact,movw7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3421 | { | |
3422 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3423 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3424 | int UNUSED written = 0; | |
3425 | IADDR UNUSED pc = abuf->addr; | |
3426 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3427 | ||
3428 | { | |
3429 | HI tmp_data; | |
3430 | tmp_data = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm))); | |
3431 | if (EQSI (FLD (f_rm), FLD (f_rn))) { | |
3432 | { | |
3433 | SI opval = EXTHISI (tmp_data); | |
3434 | SET_H_GRC (FLD (f_rm), opval); | |
3435 | written |= (1 << 4); | |
3436 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
3437 | } | |
3438 | } else { | |
3439 | { | |
3440 | SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2); | |
3441 | SET_H_GRC (FLD (f_rm), opval); | |
3442 | written |= (1 << 4); | |
3443 | TRACE_RESULT (current_cpu, abuf, "rm", 'x', opval); | |
3444 | } | |
3445 | } | |
3446 | { | |
3447 | SI opval = EXTHISI (tmp_data); | |
3448 | SET_H_GRC (FLD (f_rn), opval); | |
3449 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3450 | } | |
3451 | } | |
3452 | ||
3453 | abuf->written = written; | |
3454 | return vpc; | |
3455 | #undef FLD | |
3456 | } | |
3457 | ||
3458 | /* movw8-compact: mov.w @(r0, $rm), $rn */ | |
3459 | ||
3460 | static SEM_PC | |
3461 | SEM_FN_NAME (sh64_compact,movw8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3462 | { | |
3463 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3464 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3465 | int UNUSED written = 0; | |
3466 | IADDR UNUSED pc = abuf->addr; | |
3467 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3468 | ||
3469 | { | |
3470 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))))); | |
3471 | SET_H_GRC (FLD (f_rn), opval); | |
3472 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3473 | } | |
3474 | ||
3475 | return vpc; | |
3476 | #undef FLD | |
3477 | } | |
3478 | ||
3479 | /* movw9-compact: mov.w @($imm8x2, gbr), r0 */ | |
3480 | ||
3481 | static SEM_PC | |
3482 | SEM_FN_NAME (sh64_compact,movw9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3483 | { | |
3484 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3485 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3486 | int UNUSED written = 0; | |
3487 | IADDR UNUSED pc = abuf->addr; | |
3488 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3489 | ||
3490 | { | |
3491 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2)))); | |
3492 | SET_H_GRC (((UINT) 0), opval); | |
3493 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
3494 | } | |
3495 | ||
3496 | return vpc; | |
3497 | #undef FLD | |
3498 | } | |
3499 | ||
3500 | /* movw10-compact: mov.w @($imm8x2, pc), $rn */ | |
3501 | ||
3502 | static SEM_PC | |
3503 | SEM_FN_NAME (sh64_compact,movw10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3504 | { | |
3505 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3506 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3507 | int UNUSED written = 0; | |
3508 | IADDR UNUSED pc = abuf->addr; | |
3509 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3510 | ||
3511 | { | |
3512 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2)))); | |
3513 | SET_H_GRC (FLD (f_rn), opval); | |
3514 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3515 | } | |
3516 | ||
3517 | return vpc; | |
3518 | #undef FLD | |
3519 | } | |
3520 | ||
3521 | /* movw11-compact: mov.w @($imm4x2, $rm), r0 */ | |
3522 | ||
3523 | static SEM_PC | |
3524 | SEM_FN_NAME (sh64_compact,movw11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3525 | { | |
3526 | #define FLD(f) abuf->fields.sfmt_movw11_compact.f | |
3527 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3528 | int UNUSED written = 0; | |
3529 | IADDR UNUSED pc = abuf->addr; | |
3530 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3531 | ||
3532 | { | |
3533 | SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2)))); | |
3534 | SET_H_GRC (((UINT) 0), opval); | |
3535 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
3536 | } | |
3537 | ||
3538 | return vpc; | |
3539 | #undef FLD | |
3540 | } | |
3541 | ||
3542 | /* mova-compact: mova @($imm8x4, pc), r0 */ | |
3543 | ||
3544 | static SEM_PC | |
3545 | SEM_FN_NAME (sh64_compact,mova_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3546 | { | |
3547 | #define FLD(f) abuf->fields.sfmt_movl10_compact.f | |
3548 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3549 | int UNUSED written = 0; | |
3550 | IADDR UNUSED pc = abuf->addr; | |
3551 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3552 | ||
3553 | { | |
3554 | SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4)); | |
3555 | SET_H_GRC (((UINT) 0), opval); | |
3556 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
3557 | } | |
3558 | ||
3559 | return vpc; | |
3560 | #undef FLD | |
3561 | } | |
3562 | ||
3563 | /* movcal-compact: movca.l r0, @$rn */ | |
3564 | ||
3565 | static SEM_PC | |
3566 | SEM_FN_NAME (sh64_compact,movcal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3567 | { | |
3568 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3569 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3570 | int UNUSED written = 0; | |
3571 | IADDR UNUSED pc = abuf->addr; | |
3572 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3573 | ||
3574 | { | |
3575 | SI opval = GET_H_GRC (((UINT) 0)); | |
3576 | SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
3577 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3578 | } | |
3579 | ||
3580 | return vpc; | |
3581 | #undef FLD | |
3582 | } | |
3583 | ||
3584 | /* movt-compact: movt $rn */ | |
3585 | ||
3586 | static SEM_PC | |
3587 | SEM_FN_NAME (sh64_compact,movt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3588 | { | |
3589 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3590 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3591 | int UNUSED written = 0; | |
3592 | IADDR UNUSED pc = abuf->addr; | |
3593 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3594 | ||
3595 | { | |
3596 | SI opval = ZEXTBISI (GET_H_TBIT ()); | |
3597 | SET_H_GRC (FLD (f_rn), opval); | |
3598 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3599 | } | |
3600 | ||
3601 | return vpc; | |
3602 | #undef FLD | |
3603 | } | |
3604 | ||
3605 | /* mull-compact: mul.l $rm, $rn */ | |
3606 | ||
3607 | static SEM_PC | |
3608 | SEM_FN_NAME (sh64_compact,mull_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3609 | { | |
3610 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3611 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3612 | int UNUSED written = 0; | |
3613 | IADDR UNUSED pc = abuf->addr; | |
3614 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3615 | ||
3616 | { | |
3617 | SI opval = MULSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))); | |
3618 | SET_H_MACL (opval); | |
3619 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
3620 | } | |
3621 | ||
3622 | return vpc; | |
3623 | #undef FLD | |
3624 | } | |
3625 | ||
3626 | /* mulsw-compact: muls.w $rm, $rn */ | |
3627 | ||
3628 | static SEM_PC | |
3629 | SEM_FN_NAME (sh64_compact,mulsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3630 | { | |
3631 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3632 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3633 | int UNUSED written = 0; | |
3634 | IADDR UNUSED pc = abuf->addr; | |
3635 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3636 | ||
3637 | { | |
3638 | SI opval = MULSI (EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1))); | |
3639 | SET_H_MACL (opval); | |
3640 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
3641 | } | |
3642 | ||
3643 | return vpc; | |
3644 | #undef FLD | |
3645 | } | |
3646 | ||
3647 | /* muluw-compact: mulu.w $rm, $rn */ | |
3648 | ||
3649 | static SEM_PC | |
3650 | SEM_FN_NAME (sh64_compact,muluw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3651 | { | |
3652 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3653 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3654 | int UNUSED written = 0; | |
3655 | IADDR UNUSED pc = abuf->addr; | |
3656 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3657 | ||
3658 | { | |
3659 | SI opval = MULSI (ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1))); | |
3660 | SET_H_MACL (opval); | |
3661 | TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval); | |
3662 | } | |
3663 | ||
3664 | return vpc; | |
3665 | #undef FLD | |
3666 | } | |
3667 | ||
3668 | /* neg-compact: neg $rm, $rn */ | |
3669 | ||
3670 | static SEM_PC | |
3671 | SEM_FN_NAME (sh64_compact,neg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3672 | { | |
3673 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3674 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3675 | int UNUSED written = 0; | |
3676 | IADDR UNUSED pc = abuf->addr; | |
3677 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3678 | ||
3679 | { | |
3680 | SI opval = NEGSI (GET_H_GRC (FLD (f_rm))); | |
3681 | SET_H_GRC (FLD (f_rn), opval); | |
3682 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3683 | } | |
3684 | ||
3685 | return vpc; | |
3686 | #undef FLD | |
3687 | } | |
3688 | ||
3689 | /* negc-compact: negc $rm, $rn */ | |
3690 | ||
3691 | static SEM_PC | |
3692 | SEM_FN_NAME (sh64_compact,negc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3693 | { | |
3694 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3695 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3696 | int UNUSED written = 0; | |
3697 | IADDR UNUSED pc = abuf->addr; | |
3698 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3699 | ||
3700 | { | |
3701 | BI tmp_flag; | |
3702 | tmp_flag = SUBCFSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
3703 | { | |
3704 | SI opval = SUBCSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
3705 | SET_H_GRC (FLD (f_rn), opval); | |
3706 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3707 | } | |
3708 | { | |
3709 | BI opval = tmp_flag; | |
3710 | SET_H_TBIT (opval); | |
3711 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
3712 | } | |
3713 | } | |
3714 | ||
3715 | return vpc; | |
3716 | #undef FLD | |
3717 | } | |
3718 | ||
3719 | /* nop-compact: nop */ | |
3720 | ||
3721 | static SEM_PC | |
3722 | SEM_FN_NAME (sh64_compact,nop_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3723 | { | |
3724 | #define FLD(f) abuf->fields.fmt_empty.f | |
3725 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3726 | int UNUSED written = 0; | |
3727 | IADDR UNUSED pc = abuf->addr; | |
3728 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3729 | ||
3730 | ((void) 0); /*nop*/ | |
3731 | ||
3732 | return vpc; | |
3733 | #undef FLD | |
3734 | } | |
3735 | ||
3736 | /* not-compact: not $rm64, $rn64 */ | |
3737 | ||
3738 | static SEM_PC | |
3739 | SEM_FN_NAME (sh64_compact,not_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3740 | { | |
3741 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3742 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3743 | int UNUSED written = 0; | |
3744 | IADDR UNUSED pc = abuf->addr; | |
3745 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3746 | ||
3747 | { | |
3748 | DI opval = INVDI (GET_H_GR (FLD (f_rm))); | |
3749 | SET_H_GR (FLD (f_rn), opval); | |
3750 | TRACE_RESULT (current_cpu, abuf, "rn64", 'D', opval); | |
3751 | } | |
3752 | ||
3753 | return vpc; | |
3754 | #undef FLD | |
3755 | } | |
3756 | ||
3757 | /* ocbi-compact: ocbi @$rn */ | |
3758 | ||
3759 | static SEM_PC | |
3760 | SEM_FN_NAME (sh64_compact,ocbi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3761 | { | |
3762 | #define FLD(f) abuf->fields.fmt_empty.f | |
3763 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3764 | int UNUSED written = 0; | |
3765 | IADDR UNUSED pc = abuf->addr; | |
3766 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3767 | ||
3768 | ((void) 0); /*nop*/ | |
3769 | ||
3770 | return vpc; | |
3771 | #undef FLD | |
3772 | } | |
3773 | ||
3774 | /* ocbp-compact: ocbp @$rn */ | |
3775 | ||
3776 | static SEM_PC | |
3777 | SEM_FN_NAME (sh64_compact,ocbp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3778 | { | |
3779 | #define FLD(f) abuf->fields.fmt_empty.f | |
3780 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3781 | int UNUSED written = 0; | |
3782 | IADDR UNUSED pc = abuf->addr; | |
3783 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3784 | ||
3785 | ((void) 0); /*nop*/ | |
3786 | ||
3787 | return vpc; | |
3788 | #undef FLD | |
3789 | } | |
3790 | ||
3791 | /* ocbwb-compact: ocbwb @$rn */ | |
3792 | ||
3793 | static SEM_PC | |
3794 | SEM_FN_NAME (sh64_compact,ocbwb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3795 | { | |
3796 | #define FLD(f) abuf->fields.fmt_empty.f | |
3797 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3798 | int UNUSED written = 0; | |
3799 | IADDR UNUSED pc = abuf->addr; | |
3800 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3801 | ||
3802 | ((void) 0); /*nop*/ | |
3803 | ||
3804 | return vpc; | |
3805 | #undef FLD | |
3806 | } | |
3807 | ||
3808 | /* or-compact: or $rm64, $rn64 */ | |
3809 | ||
3810 | static SEM_PC | |
3811 | SEM_FN_NAME (sh64_compact,or_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3812 | { | |
3813 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
3814 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3815 | int UNUSED written = 0; | |
3816 | IADDR UNUSED pc = abuf->addr; | |
3817 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3818 | ||
3819 | { | |
3820 | DI opval = ORDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn))); | |
3821 | SET_H_GR (FLD (f_rn), opval); | |
3822 | TRACE_RESULT (current_cpu, abuf, "rn64", 'D', opval); | |
3823 | } | |
3824 | ||
3825 | return vpc; | |
3826 | #undef FLD | |
3827 | } | |
3828 | ||
3829 | /* ori-compact: or #$uimm8, r0 */ | |
3830 | ||
3831 | static SEM_PC | |
3832 | SEM_FN_NAME (sh64_compact,ori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3833 | { | |
3834 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
3835 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3836 | int UNUSED written = 0; | |
3837 | IADDR UNUSED pc = abuf->addr; | |
3838 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3839 | ||
3840 | { | |
3841 | SI opval = ORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8))); | |
3842 | SET_H_GRC (((UINT) 0), opval); | |
3843 | TRACE_RESULT (current_cpu, abuf, "r0", 'x', opval); | |
3844 | } | |
3845 | ||
3846 | return vpc; | |
3847 | #undef FLD | |
3848 | } | |
3849 | ||
3850 | /* orb-compact: or.b #$imm8, @(r0, gbr) */ | |
3851 | ||
3852 | static SEM_PC | |
3853 | SEM_FN_NAME (sh64_compact,orb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3854 | { | |
3855 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
3856 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3857 | int UNUSED written = 0; | |
3858 | IADDR UNUSED pc = abuf->addr; | |
3859 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3860 | ||
3861 | { | |
3862 | DI tmp_addr; | |
3863 | UQI tmp_data; | |
3864 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
3865 | tmp_data = ORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)); | |
3866 | { | |
3867 | UQI opval = tmp_data; | |
3868 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
3869 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
3870 | } | |
3871 | } | |
3872 | ||
3873 | return vpc; | |
3874 | #undef FLD | |
3875 | } | |
3876 | ||
3877 | /* pref-compact: pref @$rn */ | |
3878 | ||
3879 | static SEM_PC | |
3880 | SEM_FN_NAME (sh64_compact,pref_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3881 | { | |
3882 | #define FLD(f) abuf->fields.fmt_empty.f | |
3883 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3884 | int UNUSED written = 0; | |
3885 | IADDR UNUSED pc = abuf->addr; | |
3886 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3887 | ||
3888 | ((void) 0); /*nop*/ | |
3889 | ||
3890 | return vpc; | |
3891 | #undef FLD | |
3892 | } | |
3893 | ||
3894 | /* rotcl-compact: rotcl $rn */ | |
3895 | ||
3896 | static SEM_PC | |
3897 | SEM_FN_NAME (sh64_compact,rotcl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3898 | { | |
3899 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3900 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3901 | int UNUSED written = 0; | |
3902 | IADDR UNUSED pc = abuf->addr; | |
3903 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3904 | ||
3905 | { | |
3906 | BI tmp_temp; | |
3907 | tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
3908 | { | |
3909 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), GET_H_TBIT ()); | |
3910 | SET_H_GRC (FLD (f_rn), opval); | |
3911 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3912 | } | |
3913 | { | |
3914 | BI opval = ((tmp_temp) ? (1) : (0)); | |
3915 | SET_H_TBIT (opval); | |
3916 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
3917 | } | |
3918 | } | |
3919 | ||
3920 | return vpc; | |
3921 | #undef FLD | |
3922 | } | |
3923 | ||
3924 | /* rotcr-compact: rotcr $rn */ | |
3925 | ||
3926 | static SEM_PC | |
3927 | SEM_FN_NAME (sh64_compact,rotcr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3928 | { | |
3929 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3930 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3931 | int UNUSED written = 0; | |
3932 | IADDR UNUSED pc = abuf->addr; | |
3933 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3934 | ||
3935 | { | |
3936 | BI tmp_lsbit; | |
3937 | SI tmp_temp; | |
3938 | tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1)); | |
3939 | tmp_temp = GET_H_TBIT (); | |
3940 | { | |
3941 | SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31)); | |
3942 | SET_H_GRC (FLD (f_rn), opval); | |
3943 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3944 | } | |
3945 | { | |
3946 | BI opval = ((tmp_lsbit) ? (1) : (0)); | |
3947 | SET_H_TBIT (opval); | |
3948 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
3949 | } | |
3950 | } | |
3951 | ||
3952 | return vpc; | |
3953 | #undef FLD | |
3954 | } | |
3955 | ||
3956 | /* rotl-compact: rotl $rn */ | |
3957 | ||
3958 | static SEM_PC | |
3959 | SEM_FN_NAME (sh64_compact,rotl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3960 | { | |
3961 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3962 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3963 | int UNUSED written = 0; | |
3964 | IADDR UNUSED pc = abuf->addr; | |
3965 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3966 | ||
3967 | { | |
3968 | BI tmp_temp; | |
3969 | tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
3970 | { | |
3971 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), tmp_temp); | |
3972 | SET_H_GRC (FLD (f_rn), opval); | |
3973 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
3974 | } | |
3975 | { | |
3976 | BI opval = ((tmp_temp) ? (1) : (0)); | |
3977 | SET_H_TBIT (opval); | |
3978 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
3979 | } | |
3980 | } | |
3981 | ||
3982 | return vpc; | |
3983 | #undef FLD | |
3984 | } | |
3985 | ||
3986 | /* rotr-compact: rotr $rn */ | |
3987 | ||
3988 | static SEM_PC | |
3989 | SEM_FN_NAME (sh64_compact,rotr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
3990 | { | |
3991 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
3992 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
3993 | int UNUSED written = 0; | |
3994 | IADDR UNUSED pc = abuf->addr; | |
3995 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
3996 | ||
3997 | { | |
3998 | BI tmp_lsbit; | |
3999 | SI tmp_temp; | |
4000 | tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1)); | |
4001 | tmp_temp = tmp_lsbit; | |
4002 | { | |
4003 | SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31)); | |
4004 | SET_H_GRC (FLD (f_rn), opval); | |
4005 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4006 | } | |
4007 | { | |
4008 | BI opval = ((tmp_lsbit) ? (1) : (0)); | |
4009 | SET_H_TBIT (opval); | |
4010 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4011 | } | |
4012 | } | |
4013 | ||
4014 | return vpc; | |
4015 | #undef FLD | |
4016 | } | |
4017 | ||
4018 | /* rts-compact: rts */ | |
4019 | ||
4020 | static SEM_PC | |
4021 | SEM_FN_NAME (sh64_compact,rts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4022 | { | |
4023 | #define FLD(f) abuf->fields.fmt_empty.f | |
4024 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4025 | int UNUSED written = 0; | |
4026 | IADDR UNUSED pc = abuf->addr; | |
4027 | SEM_BRANCH_INIT | |
4028 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4029 | ||
4030 | { | |
4031 | { | |
4032 | UDI opval = GET_H_PR (); | |
4033 | SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); | |
4034 | TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval); | |
4035 | } | |
4036 | } | |
4037 | ||
4038 | SEM_BRANCH_FINI (vpc); | |
4039 | return vpc; | |
4040 | #undef FLD | |
4041 | } | |
4042 | ||
4043 | /* sets-compact: sets */ | |
4044 | ||
4045 | static SEM_PC | |
4046 | SEM_FN_NAME (sh64_compact,sets_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4047 | { | |
4048 | #define FLD(f) abuf->fields.fmt_empty.f | |
4049 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4050 | int UNUSED written = 0; | |
4051 | IADDR UNUSED pc = abuf->addr; | |
4052 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4053 | ||
4054 | { | |
4055 | BI opval = 1; | |
4056 | SET_H_SBIT (opval); | |
4057 | TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval); | |
4058 | } | |
4059 | ||
4060 | return vpc; | |
4061 | #undef FLD | |
4062 | } | |
4063 | ||
4064 | /* sett-compact: sett */ | |
4065 | ||
4066 | static SEM_PC | |
4067 | SEM_FN_NAME (sh64_compact,sett_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4068 | { | |
4069 | #define FLD(f) abuf->fields.fmt_empty.f | |
4070 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4071 | int UNUSED written = 0; | |
4072 | IADDR UNUSED pc = abuf->addr; | |
4073 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4074 | ||
4075 | { | |
4076 | BI opval = 1; | |
4077 | SET_H_TBIT (opval); | |
4078 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4079 | } | |
4080 | ||
4081 | return vpc; | |
4082 | #undef FLD | |
4083 | } | |
4084 | ||
4085 | /* shad-compact: shad $rm, $rn */ | |
4086 | ||
4087 | static SEM_PC | |
4088 | SEM_FN_NAME (sh64_compact,shad_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4089 | { | |
4090 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4091 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4092 | int UNUSED written = 0; | |
4093 | IADDR UNUSED pc = abuf->addr; | |
4094 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4095 | ||
4096 | { | |
4097 | QI tmp_shamt; | |
4098 | tmp_shamt = ANDQI (GET_H_GRC (FLD (f_rm)), 31); | |
4099 | if (GESI (GET_H_GRC (FLD (f_rm)), 0)) { | |
4100 | { | |
4101 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt); | |
4102 | SET_H_GRC (FLD (f_rn), opval); | |
4103 | written |= (1 << 3); | |
4104 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4105 | } | |
4106 | } else { | |
4107 | if (NEQI (tmp_shamt, 0)) { | |
4108 | { | |
4109 | SI opval = SRASI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt)); | |
4110 | SET_H_GRC (FLD (f_rn), opval); | |
4111 | written |= (1 << 3); | |
4112 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4113 | } | |
4114 | } else { | |
4115 | if (LTSI (GET_H_GRC (FLD (f_rn)), 0)) { | |
4116 | { | |
4117 | SI opval = NEGSI (1); | |
4118 | SET_H_GRC (FLD (f_rn), opval); | |
4119 | written |= (1 << 3); | |
4120 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4121 | } | |
4122 | } else { | |
4123 | { | |
4124 | SI opval = 0; | |
4125 | SET_H_GRC (FLD (f_rn), opval); | |
4126 | written |= (1 << 3); | |
4127 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4128 | } | |
4129 | } | |
4130 | } | |
4131 | } | |
4132 | } | |
4133 | ||
4134 | abuf->written = written; | |
4135 | return vpc; | |
4136 | #undef FLD | |
4137 | } | |
4138 | ||
4139 | /* shal-compact: shal $rn */ | |
4140 | ||
4141 | static SEM_PC | |
4142 | SEM_FN_NAME (sh64_compact,shal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4143 | { | |
4144 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4145 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4146 | int UNUSED written = 0; | |
4147 | IADDR UNUSED pc = abuf->addr; | |
4148 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4149 | ||
4150 | { | |
4151 | BI tmp_t; | |
4152 | tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
4153 | { | |
4154 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1); | |
4155 | SET_H_GRC (FLD (f_rn), opval); | |
4156 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4157 | } | |
4158 | { | |
4159 | BI opval = ((tmp_t) ? (1) : (0)); | |
4160 | SET_H_TBIT (opval); | |
4161 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4162 | } | |
4163 | } | |
4164 | ||
4165 | return vpc; | |
4166 | #undef FLD | |
4167 | } | |
4168 | ||
4169 | /* shar-compact: shar $rn */ | |
4170 | ||
4171 | static SEM_PC | |
4172 | SEM_FN_NAME (sh64_compact,shar_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4173 | { | |
4174 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4175 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4176 | int UNUSED written = 0; | |
4177 | IADDR UNUSED pc = abuf->addr; | |
4178 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4179 | ||
4180 | { | |
4181 | BI tmp_t; | |
4182 | tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1); | |
4183 | { | |
4184 | SI opval = SRASI (GET_H_GRC (FLD (f_rn)), 1); | |
4185 | SET_H_GRC (FLD (f_rn), opval); | |
4186 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4187 | } | |
4188 | { | |
4189 | BI opval = ((tmp_t) ? (1) : (0)); | |
4190 | SET_H_TBIT (opval); | |
4191 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4192 | } | |
4193 | } | |
4194 | ||
4195 | return vpc; | |
4196 | #undef FLD | |
4197 | } | |
4198 | ||
4199 | /* shld-compact: shld $rm, $rn */ | |
4200 | ||
4201 | static SEM_PC | |
4202 | SEM_FN_NAME (sh64_compact,shld_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4203 | { | |
4204 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4205 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4206 | int UNUSED written = 0; | |
4207 | IADDR UNUSED pc = abuf->addr; | |
4208 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4209 | ||
4210 | { | |
4211 | QI tmp_shamt; | |
4212 | tmp_shamt = ANDQI (GET_H_GRC (FLD (f_rm)), 31); | |
4213 | if (GESI (GET_H_GRC (FLD (f_rm)), 0)) { | |
4214 | { | |
4215 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt); | |
4216 | SET_H_GRC (FLD (f_rn), opval); | |
4217 | written |= (1 << 3); | |
4218 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4219 | } | |
4220 | } else { | |
4221 | if (NEQI (tmp_shamt, 0)) { | |
4222 | { | |
4223 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt)); | |
4224 | SET_H_GRC (FLD (f_rn), opval); | |
4225 | written |= (1 << 3); | |
4226 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4227 | } | |
4228 | } else { | |
4229 | { | |
4230 | SI opval = 0; | |
4231 | SET_H_GRC (FLD (f_rn), opval); | |
4232 | written |= (1 << 3); | |
4233 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4234 | } | |
4235 | } | |
4236 | } | |
4237 | } | |
4238 | ||
4239 | abuf->written = written; | |
4240 | return vpc; | |
4241 | #undef FLD | |
4242 | } | |
4243 | ||
4244 | /* shll-compact: shll $rn */ | |
4245 | ||
4246 | static SEM_PC | |
4247 | SEM_FN_NAME (sh64_compact,shll_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4248 | { | |
4249 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4250 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4251 | int UNUSED written = 0; | |
4252 | IADDR UNUSED pc = abuf->addr; | |
4253 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4254 | ||
4255 | { | |
4256 | BI tmp_t; | |
4257 | tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31); | |
4258 | { | |
4259 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1); | |
4260 | SET_H_GRC (FLD (f_rn), opval); | |
4261 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4262 | } | |
4263 | { | |
4264 | BI opval = ((tmp_t) ? (1) : (0)); | |
4265 | SET_H_TBIT (opval); | |
4266 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4267 | } | |
4268 | } | |
4269 | ||
4270 | return vpc; | |
4271 | #undef FLD | |
4272 | } | |
4273 | ||
4274 | /* shll2-compact: shll2 $rn */ | |
4275 | ||
4276 | static SEM_PC | |
4277 | SEM_FN_NAME (sh64_compact,shll2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4278 | { | |
4279 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4280 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4281 | int UNUSED written = 0; | |
4282 | IADDR UNUSED pc = abuf->addr; | |
4283 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4284 | ||
4285 | { | |
4286 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 2); | |
4287 | SET_H_GRC (FLD (f_rn), opval); | |
4288 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4289 | } | |
4290 | ||
4291 | return vpc; | |
4292 | #undef FLD | |
4293 | } | |
4294 | ||
4295 | /* shll8-compact: shll8 $rn */ | |
4296 | ||
4297 | static SEM_PC | |
4298 | SEM_FN_NAME (sh64_compact,shll8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4299 | { | |
4300 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4301 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4302 | int UNUSED written = 0; | |
4303 | IADDR UNUSED pc = abuf->addr; | |
4304 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4305 | ||
4306 | { | |
4307 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 8); | |
4308 | SET_H_GRC (FLD (f_rn), opval); | |
4309 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4310 | } | |
4311 | ||
4312 | return vpc; | |
4313 | #undef FLD | |
4314 | } | |
4315 | ||
4316 | /* shll16-compact: shll16 $rn */ | |
4317 | ||
4318 | static SEM_PC | |
4319 | SEM_FN_NAME (sh64_compact,shll16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4320 | { | |
4321 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4322 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4323 | int UNUSED written = 0; | |
4324 | IADDR UNUSED pc = abuf->addr; | |
4325 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4326 | ||
4327 | { | |
4328 | SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 16); | |
4329 | SET_H_GRC (FLD (f_rn), opval); | |
4330 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4331 | } | |
4332 | ||
4333 | return vpc; | |
4334 | #undef FLD | |
4335 | } | |
4336 | ||
4337 | /* shlr-compact: shlr $rn */ | |
4338 | ||
4339 | static SEM_PC | |
4340 | SEM_FN_NAME (sh64_compact,shlr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4341 | { | |
4342 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4343 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4344 | int UNUSED written = 0; | |
4345 | IADDR UNUSED pc = abuf->addr; | |
4346 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4347 | ||
4348 | { | |
4349 | BI tmp_t; | |
4350 | tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1); | |
4351 | { | |
4352 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 1); | |
4353 | SET_H_GRC (FLD (f_rn), opval); | |
4354 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4355 | } | |
4356 | { | |
4357 | BI opval = ((tmp_t) ? (1) : (0)); | |
4358 | SET_H_TBIT (opval); | |
4359 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4360 | } | |
4361 | } | |
4362 | ||
4363 | return vpc; | |
4364 | #undef FLD | |
4365 | } | |
4366 | ||
4367 | /* shlr2-compact: shlr2 $rn */ | |
4368 | ||
4369 | static SEM_PC | |
4370 | SEM_FN_NAME (sh64_compact,shlr2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4371 | { | |
4372 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4373 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4374 | int UNUSED written = 0; | |
4375 | IADDR UNUSED pc = abuf->addr; | |
4376 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4377 | ||
4378 | { | |
4379 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 2); | |
4380 | SET_H_GRC (FLD (f_rn), opval); | |
4381 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4382 | } | |
4383 | ||
4384 | return vpc; | |
4385 | #undef FLD | |
4386 | } | |
4387 | ||
4388 | /* shlr8-compact: shlr8 $rn */ | |
4389 | ||
4390 | static SEM_PC | |
4391 | SEM_FN_NAME (sh64_compact,shlr8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4392 | { | |
4393 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4394 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4395 | int UNUSED written = 0; | |
4396 | IADDR UNUSED pc = abuf->addr; | |
4397 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4398 | ||
4399 | { | |
4400 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 8); | |
4401 | SET_H_GRC (FLD (f_rn), opval); | |
4402 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4403 | } | |
4404 | ||
4405 | return vpc; | |
4406 | #undef FLD | |
4407 | } | |
4408 | ||
4409 | /* shlr16-compact: shlr16 $rn */ | |
4410 | ||
4411 | static SEM_PC | |
4412 | SEM_FN_NAME (sh64_compact,shlr16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4413 | { | |
4414 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4415 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4416 | int UNUSED written = 0; | |
4417 | IADDR UNUSED pc = abuf->addr; | |
4418 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4419 | ||
4420 | { | |
4421 | SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 16); | |
4422 | SET_H_GRC (FLD (f_rn), opval); | |
4423 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4424 | } | |
4425 | ||
4426 | return vpc; | |
4427 | #undef FLD | |
4428 | } | |
4429 | ||
4430 | /* stc-gbr-compact: stc gbr, $rn */ | |
4431 | ||
4432 | static SEM_PC | |
4433 | SEM_FN_NAME (sh64_compact,stc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4434 | { | |
4435 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4436 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4437 | int UNUSED written = 0; | |
4438 | IADDR UNUSED pc = abuf->addr; | |
4439 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4440 | ||
4441 | { | |
4442 | SI opval = GET_H_GBR (); | |
4443 | SET_H_GRC (FLD (f_rn), opval); | |
4444 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4445 | } | |
4446 | ||
4447 | return vpc; | |
4448 | #undef FLD | |
4449 | } | |
4450 | ||
4451 | /* stcl-gbr-compact: stc.l gbr, @-$rn */ | |
4452 | ||
4453 | static SEM_PC | |
4454 | SEM_FN_NAME (sh64_compact,stcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4455 | { | |
4456 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4457 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4458 | int UNUSED written = 0; | |
4459 | IADDR UNUSED pc = abuf->addr; | |
4460 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4461 | ||
4462 | { | |
4463 | DI tmp_addr; | |
4464 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4465 | { | |
4466 | SI opval = GET_H_GBR (); | |
4467 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4468 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4469 | } | |
4470 | { | |
4471 | SI opval = tmp_addr; | |
4472 | SET_H_GRC (FLD (f_rn), opval); | |
4473 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4474 | } | |
4475 | } | |
4476 | ||
4477 | return vpc; | |
4478 | #undef FLD | |
4479 | } | |
4480 | ||
4481 | /* sts-fpscr-compact: sts fpscr, $rn */ | |
4482 | ||
4483 | static SEM_PC | |
4484 | SEM_FN_NAME (sh64_compact,sts_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4485 | { | |
4486 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4487 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4488 | int UNUSED written = 0; | |
4489 | IADDR UNUSED pc = abuf->addr; | |
4490 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4491 | ||
4492 | { | |
4493 | SI opval = GET_H_FPCCR (); | |
4494 | SET_H_GRC (FLD (f_rn), opval); | |
4495 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4496 | } | |
4497 | ||
4498 | return vpc; | |
4499 | #undef FLD | |
4500 | } | |
4501 | ||
4502 | /* stsl-fpscr-compact: sts.l fpscr, @-$rn */ | |
4503 | ||
4504 | static SEM_PC | |
4505 | SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4506 | { | |
4507 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4508 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4509 | int UNUSED written = 0; | |
4510 | IADDR UNUSED pc = abuf->addr; | |
4511 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4512 | ||
4513 | { | |
4514 | DI tmp_addr; | |
4515 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4516 | { | |
4517 | SI opval = GET_H_FPCCR (); | |
4518 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4519 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4520 | } | |
4521 | { | |
4522 | SI opval = tmp_addr; | |
4523 | SET_H_GRC (FLD (f_rn), opval); | |
4524 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4525 | } | |
4526 | } | |
4527 | ||
4528 | return vpc; | |
4529 | #undef FLD | |
4530 | } | |
4531 | ||
4532 | /* sts-fpul-compact: sts fpul, $rn */ | |
4533 | ||
4534 | static SEM_PC | |
4535 | SEM_FN_NAME (sh64_compact,sts_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4536 | { | |
4537 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4538 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4539 | int UNUSED written = 0; | |
4540 | IADDR UNUSED pc = abuf->addr; | |
4541 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4542 | ||
4543 | { | |
4544 | SI opval = SUBWORDSFSI (CPU (h_fr[((UINT) 32)])); | |
4545 | SET_H_GRC (FLD (f_rn), opval); | |
4546 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4547 | } | |
4548 | ||
4549 | return vpc; | |
4550 | #undef FLD | |
4551 | } | |
4552 | ||
4553 | /* stsl-fpul-compact: sts.l fpul, @-$rn */ | |
4554 | ||
4555 | static SEM_PC | |
4556 | SEM_FN_NAME (sh64_compact,stsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4557 | { | |
4558 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4559 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4560 | int UNUSED written = 0; | |
4561 | IADDR UNUSED pc = abuf->addr; | |
4562 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4563 | ||
4564 | { | |
4565 | DI tmp_addr; | |
4566 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4567 | { | |
4568 | SF opval = CPU (h_fr[((UINT) 32)]); | |
4569 | SETMEMSF (current_cpu, pc, tmp_addr, opval); | |
4570 | TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval); | |
4571 | } | |
4572 | { | |
4573 | SI opval = tmp_addr; | |
4574 | SET_H_GRC (FLD (f_rn), opval); | |
4575 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4576 | } | |
4577 | } | |
4578 | ||
4579 | return vpc; | |
4580 | #undef FLD | |
4581 | } | |
4582 | ||
4583 | /* sts-mach-compact: sts mach, $rn */ | |
4584 | ||
4585 | static SEM_PC | |
4586 | SEM_FN_NAME (sh64_compact,sts_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4587 | { | |
4588 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4589 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4590 | int UNUSED written = 0; | |
4591 | IADDR UNUSED pc = abuf->addr; | |
4592 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4593 | ||
4594 | { | |
4595 | SI opval = GET_H_MACH (); | |
4596 | SET_H_GRC (FLD (f_rn), opval); | |
4597 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4598 | } | |
4599 | ||
4600 | return vpc; | |
4601 | #undef FLD | |
4602 | } | |
4603 | ||
4604 | /* stsl-mach-compact: sts.l mach, @-$rn */ | |
4605 | ||
4606 | static SEM_PC | |
4607 | SEM_FN_NAME (sh64_compact,stsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4608 | { | |
4609 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4610 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4611 | int UNUSED written = 0; | |
4612 | IADDR UNUSED pc = abuf->addr; | |
4613 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4614 | ||
4615 | { | |
4616 | DI tmp_addr; | |
4617 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4618 | { | |
4619 | SI opval = GET_H_MACH (); | |
4620 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4621 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4622 | } | |
4623 | { | |
4624 | SI opval = tmp_addr; | |
4625 | SET_H_GRC (FLD (f_rn), opval); | |
4626 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4627 | } | |
4628 | } | |
4629 | ||
4630 | return vpc; | |
4631 | #undef FLD | |
4632 | } | |
4633 | ||
4634 | /* sts-macl-compact: sts macl, $rn */ | |
4635 | ||
4636 | static SEM_PC | |
4637 | SEM_FN_NAME (sh64_compact,sts_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4638 | { | |
4639 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4640 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4641 | int UNUSED written = 0; | |
4642 | IADDR UNUSED pc = abuf->addr; | |
4643 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4644 | ||
4645 | { | |
4646 | SI opval = GET_H_MACL (); | |
4647 | SET_H_GRC (FLD (f_rn), opval); | |
4648 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4649 | } | |
4650 | ||
4651 | return vpc; | |
4652 | #undef FLD | |
4653 | } | |
4654 | ||
4655 | /* stsl-macl-compact: sts.l macl, @-$rn */ | |
4656 | ||
4657 | static SEM_PC | |
4658 | SEM_FN_NAME (sh64_compact,stsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4659 | { | |
4660 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4661 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4662 | int UNUSED written = 0; | |
4663 | IADDR UNUSED pc = abuf->addr; | |
4664 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4665 | ||
4666 | { | |
4667 | DI tmp_addr; | |
4668 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4669 | { | |
4670 | SI opval = GET_H_MACL (); | |
4671 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4672 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4673 | } | |
4674 | { | |
4675 | SI opval = tmp_addr; | |
4676 | SET_H_GRC (FLD (f_rn), opval); | |
4677 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4678 | } | |
4679 | } | |
4680 | ||
4681 | return vpc; | |
4682 | #undef FLD | |
4683 | } | |
4684 | ||
4685 | /* sts-pr-compact: sts pr, $rn */ | |
4686 | ||
4687 | static SEM_PC | |
4688 | SEM_FN_NAME (sh64_compact,sts_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4689 | { | |
4690 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4691 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4692 | int UNUSED written = 0; | |
4693 | IADDR UNUSED pc = abuf->addr; | |
4694 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4695 | ||
4696 | { | |
4697 | SI opval = GET_H_PR (); | |
4698 | SET_H_GRC (FLD (f_rn), opval); | |
4699 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4700 | } | |
4701 | ||
4702 | return vpc; | |
4703 | #undef FLD | |
4704 | } | |
4705 | ||
4706 | /* stsl-pr-compact: sts.l pr, @-$rn */ | |
4707 | ||
4708 | static SEM_PC | |
4709 | SEM_FN_NAME (sh64_compact,stsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4710 | { | |
4711 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4712 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4713 | int UNUSED written = 0; | |
4714 | IADDR UNUSED pc = abuf->addr; | |
4715 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4716 | ||
4717 | { | |
4718 | DI tmp_addr; | |
4719 | tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4); | |
4720 | { | |
4721 | SI opval = GET_H_PR (); | |
4722 | SETMEMSI (current_cpu, pc, tmp_addr, opval); | |
4723 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4724 | } | |
4725 | { | |
4726 | SI opval = tmp_addr; | |
4727 | SET_H_GRC (FLD (f_rn), opval); | |
4728 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4729 | } | |
4730 | } | |
4731 | ||
4732 | return vpc; | |
4733 | #undef FLD | |
4734 | } | |
4735 | ||
4736 | /* sub-compact: sub $rm, $rn */ | |
4737 | ||
4738 | static SEM_PC | |
4739 | SEM_FN_NAME (sh64_compact,sub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4740 | { | |
4741 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4742 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4743 | int UNUSED written = 0; | |
4744 | IADDR UNUSED pc = abuf->addr; | |
4745 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4746 | ||
4747 | { | |
4748 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
4749 | SET_H_GRC (FLD (f_rn), opval); | |
4750 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4751 | } | |
4752 | ||
4753 | return vpc; | |
4754 | #undef FLD | |
4755 | } | |
4756 | ||
4757 | /* subc-compact: subc $rm, $rn */ | |
4758 | ||
4759 | static SEM_PC | |
4760 | SEM_FN_NAME (sh64_compact,subc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4761 | { | |
4762 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4763 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4764 | int UNUSED written = 0; | |
4765 | IADDR UNUSED pc = abuf->addr; | |
4766 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4767 | ||
4768 | { | |
4769 | BI tmp_flag; | |
4770 | tmp_flag = SUBCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
4771 | { | |
4772 | SI opval = SUBCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ()); | |
4773 | SET_H_GRC (FLD (f_rn), opval); | |
4774 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4775 | } | |
4776 | { | |
4777 | BI opval = tmp_flag; | |
4778 | SET_H_TBIT (opval); | |
4779 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4780 | } | |
4781 | } | |
4782 | ||
4783 | return vpc; | |
4784 | #undef FLD | |
4785 | } | |
4786 | ||
4787 | /* subv-compact: subv $rm, $rn */ | |
4788 | ||
4789 | static SEM_PC | |
4790 | SEM_FN_NAME (sh64_compact,subv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4791 | { | |
4792 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4793 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4794 | int UNUSED written = 0; | |
4795 | IADDR UNUSED pc = abuf->addr; | |
4796 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4797 | ||
4798 | { | |
4799 | BI tmp_t; | |
4800 | tmp_t = SUBOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0); | |
4801 | { | |
4802 | SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm))); | |
4803 | SET_H_GRC (FLD (f_rn), opval); | |
4804 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4805 | } | |
4806 | { | |
4807 | BI opval = ((tmp_t) ? (1) : (0)); | |
4808 | SET_H_TBIT (opval); | |
4809 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4810 | } | |
4811 | } | |
4812 | ||
4813 | return vpc; | |
4814 | #undef FLD | |
4815 | } | |
4816 | ||
4817 | /* swapb-compact: swap.b $rm, $rn */ | |
4818 | ||
4819 | static SEM_PC | |
4820 | SEM_FN_NAME (sh64_compact,swapb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4821 | { | |
4822 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4823 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4824 | int UNUSED written = 0; | |
4825 | IADDR UNUSED pc = abuf->addr; | |
4826 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4827 | ||
4828 | { | |
4829 | UHI tmp_top_half; | |
4830 | UQI tmp_byte1; | |
4831 | UQI tmp_byte0; | |
4832 | tmp_top_half = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 0); | |
4833 | tmp_byte1 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 2); | |
4834 | tmp_byte0 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3); | |
4835 | { | |
4836 | SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1)); | |
4837 | SET_H_GRC (FLD (f_rn), opval); | |
4838 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4839 | } | |
4840 | } | |
4841 | ||
4842 | return vpc; | |
4843 | #undef FLD | |
4844 | } | |
4845 | ||
4846 | /* swapw-compact: swap.w $rm, $rn */ | |
4847 | ||
4848 | static SEM_PC | |
4849 | SEM_FN_NAME (sh64_compact,swapw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4850 | { | |
4851 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4852 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4853 | int UNUSED written = 0; | |
4854 | IADDR UNUSED pc = abuf->addr; | |
4855 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4856 | ||
4857 | { | |
4858 | SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rm)), 16), SLLSI (GET_H_GRC (FLD (f_rm)), 16)); | |
4859 | SET_H_GRC (FLD (f_rn), opval); | |
4860 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
4861 | } | |
4862 | ||
4863 | return vpc; | |
4864 | #undef FLD | |
4865 | } | |
4866 | ||
4867 | /* tasb-compact: tas.b @$rn */ | |
4868 | ||
4869 | static SEM_PC | |
4870 | SEM_FN_NAME (sh64_compact,tasb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4871 | { | |
4872 | #define FLD(f) abuf->fields.sfmt_movw10_compact.f | |
4873 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4874 | int UNUSED written = 0; | |
4875 | IADDR UNUSED pc = abuf->addr; | |
4876 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4877 | ||
4878 | { | |
4879 | UQI tmp_byte; | |
4880 | tmp_byte = GETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn))); | |
4881 | { | |
4882 | BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0)); | |
4883 | SET_H_TBIT (opval); | |
4884 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4885 | } | |
4886 | tmp_byte = ORQI (tmp_byte, 128); | |
4887 | { | |
4888 | UQI opval = tmp_byte; | |
4889 | SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval); | |
4890 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
4891 | } | |
4892 | } | |
4893 | ||
4894 | return vpc; | |
4895 | #undef FLD | |
4896 | } | |
4897 | ||
4898 | /* trapa-compact: trapa #$uimm8 */ | |
4899 | ||
4900 | static SEM_PC | |
4901 | SEM_FN_NAME (sh64_compact,trapa_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4902 | { | |
4903 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
4904 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4905 | int UNUSED written = 0; | |
4906 | IADDR UNUSED pc = abuf->addr; | |
4907 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4908 | ||
4909 | sh64_compact_trapa (current_cpu, FLD (f_imm8), pc); | |
4910 | ||
4911 | return vpc; | |
4912 | #undef FLD | |
4913 | } | |
4914 | ||
4915 | /* tst-compact: tst $rm, $rn */ | |
4916 | ||
4917 | static SEM_PC | |
4918 | SEM_FN_NAME (sh64_compact,tst_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4919 | { | |
4920 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4921 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4922 | int UNUSED written = 0; | |
4923 | IADDR UNUSED pc = abuf->addr; | |
4924 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4925 | ||
4926 | { | |
4927 | BI opval = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))), 0)) ? (1) : (0)); | |
4928 | SET_H_TBIT (opval); | |
4929 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4930 | } | |
4931 | ||
4932 | return vpc; | |
4933 | #undef FLD | |
4934 | } | |
4935 | ||
4936 | /* tsti-compact: tst #$uimm8, r0 */ | |
4937 | ||
4938 | static SEM_PC | |
4939 | SEM_FN_NAME (sh64_compact,tsti_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4940 | { | |
4941 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
4942 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4943 | int UNUSED written = 0; | |
4944 | IADDR UNUSED pc = abuf->addr; | |
4945 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4946 | ||
4947 | { | |
4948 | BI opval = ((EQSI (ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0)); | |
4949 | SET_H_TBIT (opval); | |
4950 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4951 | } | |
4952 | ||
4953 | return vpc; | |
4954 | #undef FLD | |
4955 | } | |
4956 | ||
4957 | /* tstb-compact: tst.b #$imm8, @(r0, gbr) */ | |
4958 | ||
4959 | static SEM_PC | |
4960 | SEM_FN_NAME (sh64_compact,tstb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4961 | { | |
4962 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
4963 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4964 | int UNUSED written = 0; | |
4965 | IADDR UNUSED pc = abuf->addr; | |
4966 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4967 | ||
4968 | { | |
4969 | DI tmp_addr; | |
4970 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
4971 | { | |
4972 | BI opval = ((EQQI (ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0)); | |
4973 | SET_H_TBIT (opval); | |
4974 | TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval); | |
4975 | } | |
4976 | } | |
4977 | ||
4978 | return vpc; | |
4979 | #undef FLD | |
4980 | } | |
4981 | ||
4982 | /* xor-compact: xor $rm64, $rn64 */ | |
4983 | ||
4984 | static SEM_PC | |
4985 | SEM_FN_NAME (sh64_compact,xor_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
4986 | { | |
4987 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
4988 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
4989 | int UNUSED written = 0; | |
4990 | IADDR UNUSED pc = abuf->addr; | |
4991 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
4992 | ||
4993 | { | |
4994 | DI opval = XORDI (GET_H_GR (FLD (f_rn)), GET_H_GR (FLD (f_rm))); | |
4995 | SET_H_GR (FLD (f_rn), opval); | |
4996 | TRACE_RESULT (current_cpu, abuf, "rn64", 'D', opval); | |
4997 | } | |
4998 | ||
4999 | return vpc; | |
5000 | #undef FLD | |
5001 | } | |
5002 | ||
5003 | /* xori-compact: xor #$uimm8, r0 */ | |
5004 | ||
5005 | static SEM_PC | |
5006 | SEM_FN_NAME (sh64_compact,xori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5007 | { | |
5008 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
5009 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5010 | int UNUSED written = 0; | |
5011 | IADDR UNUSED pc = abuf->addr; | |
5012 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5013 | ||
5014 | { | |
5015 | DI opval = XORDI (GET_H_GR (((UINT) 0)), ZEXTSIDI (FLD (f_imm8))); | |
5016 | SET_H_GR (((UINT) 0), opval); | |
5017 | TRACE_RESULT (current_cpu, abuf, "gr-0", 'D', opval); | |
5018 | } | |
5019 | ||
5020 | return vpc; | |
5021 | #undef FLD | |
5022 | } | |
5023 | ||
5024 | /* xorb-compact: xor.b #$imm8, @(r0, gbr) */ | |
5025 | ||
5026 | static SEM_PC | |
5027 | SEM_FN_NAME (sh64_compact,xorb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5028 | { | |
5029 | #define FLD(f) abuf->fields.sfmt_addi_compact.f | |
5030 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5031 | int UNUSED written = 0; | |
5032 | IADDR UNUSED pc = abuf->addr; | |
5033 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5034 | ||
5035 | { | |
5036 | DI tmp_addr; | |
5037 | UQI tmp_data; | |
5038 | tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ()); | |
5039 | tmp_data = XORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)); | |
5040 | { | |
5041 | UQI opval = tmp_data; | |
5042 | SETMEMUQI (current_cpu, pc, tmp_addr, opval); | |
5043 | TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); | |
5044 | } | |
5045 | } | |
5046 | ||
5047 | return vpc; | |
5048 | #undef FLD | |
5049 | } | |
5050 | ||
5051 | /* xtrct-compact: xtrct $rm, $rn */ | |
5052 | ||
5053 | static SEM_PC | |
5054 | SEM_FN_NAME (sh64_compact,xtrct_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg) | |
5055 | { | |
5056 | #define FLD(f) abuf->fields.sfmt_movl5_compact.f | |
5057 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); | |
5058 | int UNUSED written = 0; | |
5059 | IADDR UNUSED pc = abuf->addr; | |
5060 | SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); | |
5061 | ||
5062 | { | |
5063 | SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rm)), 16), SRLSI (GET_H_GRC (FLD (f_rn)), 16)); | |
5064 | SET_H_GRC (FLD (f_rn), opval); | |
5065 | TRACE_RESULT (current_cpu, abuf, "rn", 'x', opval); | |
5066 | } | |
5067 | ||
5068 | return vpc; | |
5069 | #undef FLD | |
5070 | } | |
5071 | ||
5072 | /* Table of all semantic fns. */ | |
5073 | ||
5074 | static const struct sem_fn_desc sem_fns[] = { | |
5075 | { SH64_COMPACT_INSN_X_INVALID, SEM_FN_NAME (sh64_compact,x_invalid) }, | |
5076 | { SH64_COMPACT_INSN_X_AFTER, SEM_FN_NAME (sh64_compact,x_after) }, | |
5077 | { SH64_COMPACT_INSN_X_BEFORE, SEM_FN_NAME (sh64_compact,x_before) }, | |
5078 | { SH64_COMPACT_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_compact,x_cti_chain) }, | |
5079 | { SH64_COMPACT_INSN_X_CHAIN, SEM_FN_NAME (sh64_compact,x_chain) }, | |
5080 | { SH64_COMPACT_INSN_X_BEGIN, SEM_FN_NAME (sh64_compact,x_begin) }, | |
5081 | { SH64_COMPACT_INSN_ADD_COMPACT, SEM_FN_NAME (sh64_compact,add_compact) }, | |
5082 | { SH64_COMPACT_INSN_ADDI_COMPACT, SEM_FN_NAME (sh64_compact,addi_compact) }, | |
5083 | { SH64_COMPACT_INSN_ADDC_COMPACT, SEM_FN_NAME (sh64_compact,addc_compact) }, | |
5084 | { SH64_COMPACT_INSN_ADDV_COMPACT, SEM_FN_NAME (sh64_compact,addv_compact) }, | |
5085 | { SH64_COMPACT_INSN_AND_COMPACT, SEM_FN_NAME (sh64_compact,and_compact) }, | |
5086 | { SH64_COMPACT_INSN_ANDI_COMPACT, SEM_FN_NAME (sh64_compact,andi_compact) }, | |
5087 | { SH64_COMPACT_INSN_ANDB_COMPACT, SEM_FN_NAME (sh64_compact,andb_compact) }, | |
5088 | { SH64_COMPACT_INSN_BF_COMPACT, SEM_FN_NAME (sh64_compact,bf_compact) }, | |
5089 | { SH64_COMPACT_INSN_BFS_COMPACT, SEM_FN_NAME (sh64_compact,bfs_compact) }, | |
5090 | { SH64_COMPACT_INSN_BRA_COMPACT, SEM_FN_NAME (sh64_compact,bra_compact) }, | |
5091 | { SH64_COMPACT_INSN_BRAF_COMPACT, SEM_FN_NAME (sh64_compact,braf_compact) }, | |
5092 | { SH64_COMPACT_INSN_BRK_COMPACT, SEM_FN_NAME (sh64_compact,brk_compact) }, | |
5093 | { SH64_COMPACT_INSN_BSR_COMPACT, SEM_FN_NAME (sh64_compact,bsr_compact) }, | |
5094 | { SH64_COMPACT_INSN_BSRF_COMPACT, SEM_FN_NAME (sh64_compact,bsrf_compact) }, | |
5095 | { SH64_COMPACT_INSN_BT_COMPACT, SEM_FN_NAME (sh64_compact,bt_compact) }, | |
5096 | { SH64_COMPACT_INSN_BTS_COMPACT, SEM_FN_NAME (sh64_compact,bts_compact) }, | |
5097 | { SH64_COMPACT_INSN_CLRMAC_COMPACT, SEM_FN_NAME (sh64_compact,clrmac_compact) }, | |
5098 | { SH64_COMPACT_INSN_CLRS_COMPACT, SEM_FN_NAME (sh64_compact,clrs_compact) }, | |
5099 | { SH64_COMPACT_INSN_CLRT_COMPACT, SEM_FN_NAME (sh64_compact,clrt_compact) }, | |
5100 | { SH64_COMPACT_INSN_CMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,cmpeq_compact) }, | |
5101 | { SH64_COMPACT_INSN_CMPEQI_COMPACT, SEM_FN_NAME (sh64_compact,cmpeqi_compact) }, | |
5102 | { SH64_COMPACT_INSN_CMPGE_COMPACT, SEM_FN_NAME (sh64_compact,cmpge_compact) }, | |
5103 | { SH64_COMPACT_INSN_CMPGT_COMPACT, SEM_FN_NAME (sh64_compact,cmpgt_compact) }, | |
5104 | { SH64_COMPACT_INSN_CMPHI_COMPACT, SEM_FN_NAME (sh64_compact,cmphi_compact) }, | |
5105 | { SH64_COMPACT_INSN_CMPHS_COMPACT, SEM_FN_NAME (sh64_compact,cmphs_compact) }, | |
5106 | { SH64_COMPACT_INSN_CMPPL_COMPACT, SEM_FN_NAME (sh64_compact,cmppl_compact) }, | |
5107 | { SH64_COMPACT_INSN_CMPPZ_COMPACT, SEM_FN_NAME (sh64_compact,cmppz_compact) }, | |
5108 | { SH64_COMPACT_INSN_CMPSTR_COMPACT, SEM_FN_NAME (sh64_compact,cmpstr_compact) }, | |
5109 | { SH64_COMPACT_INSN_DIV0S_COMPACT, SEM_FN_NAME (sh64_compact,div0s_compact) }, | |
5110 | { SH64_COMPACT_INSN_DIV0U_COMPACT, SEM_FN_NAME (sh64_compact,div0u_compact) }, | |
5111 | { SH64_COMPACT_INSN_DIV1_COMPACT, SEM_FN_NAME (sh64_compact,div1_compact) }, | |
5112 | { SH64_COMPACT_INSN_DMULSL_COMPACT, SEM_FN_NAME (sh64_compact,dmulsl_compact) }, | |
5113 | { SH64_COMPACT_INSN_DMULUL_COMPACT, SEM_FN_NAME (sh64_compact,dmulul_compact) }, | |
5114 | { SH64_COMPACT_INSN_DT_COMPACT, SEM_FN_NAME (sh64_compact,dt_compact) }, | |
5115 | { SH64_COMPACT_INSN_EXTSB_COMPACT, SEM_FN_NAME (sh64_compact,extsb_compact) }, | |
5116 | { SH64_COMPACT_INSN_EXTSW_COMPACT, SEM_FN_NAME (sh64_compact,extsw_compact) }, | |
5117 | { SH64_COMPACT_INSN_EXTUB_COMPACT, SEM_FN_NAME (sh64_compact,extub_compact) }, | |
5118 | { SH64_COMPACT_INSN_EXTUW_COMPACT, SEM_FN_NAME (sh64_compact,extuw_compact) }, | |
5119 | { SH64_COMPACT_INSN_FABS_COMPACT, SEM_FN_NAME (sh64_compact,fabs_compact) }, | |
5120 | { SH64_COMPACT_INSN_FADD_COMPACT, SEM_FN_NAME (sh64_compact,fadd_compact) }, | |
5121 | { SH64_COMPACT_INSN_FCMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,fcmpeq_compact) }, | |
5122 | { SH64_COMPACT_INSN_FCMPGT_COMPACT, SEM_FN_NAME (sh64_compact,fcmpgt_compact) }, | |
5123 | { SH64_COMPACT_INSN_FCNVDS_COMPACT, SEM_FN_NAME (sh64_compact,fcnvds_compact) }, | |
5124 | { SH64_COMPACT_INSN_FCNVSD_COMPACT, SEM_FN_NAME (sh64_compact,fcnvsd_compact) }, | |
5125 | { SH64_COMPACT_INSN_FDIV_COMPACT, SEM_FN_NAME (sh64_compact,fdiv_compact) }, | |
5126 | { SH64_COMPACT_INSN_FIPR_COMPACT, SEM_FN_NAME (sh64_compact,fipr_compact) }, | |
5127 | { SH64_COMPACT_INSN_FLDS_COMPACT, SEM_FN_NAME (sh64_compact,flds_compact) }, | |
5128 | { SH64_COMPACT_INSN_FLDI0_COMPACT, SEM_FN_NAME (sh64_compact,fldi0_compact) }, | |
5129 | { SH64_COMPACT_INSN_FLDI1_COMPACT, SEM_FN_NAME (sh64_compact,fldi1_compact) }, | |
5130 | { SH64_COMPACT_INSN_FLOAT_COMPACT, SEM_FN_NAME (sh64_compact,float_compact) }, | |
5131 | { SH64_COMPACT_INSN_FMAC_COMPACT, SEM_FN_NAME (sh64_compact,fmac_compact) }, | |
5132 | { SH64_COMPACT_INSN_FMOV1_COMPACT, SEM_FN_NAME (sh64_compact,fmov1_compact) }, | |
5133 | { SH64_COMPACT_INSN_FMOV2_COMPACT, SEM_FN_NAME (sh64_compact,fmov2_compact) }, | |
5134 | { SH64_COMPACT_INSN_FMOV3_COMPACT, SEM_FN_NAME (sh64_compact,fmov3_compact) }, | |
5135 | { SH64_COMPACT_INSN_FMOV4_COMPACT, SEM_FN_NAME (sh64_compact,fmov4_compact) }, | |
5136 | { SH64_COMPACT_INSN_FMOV5_COMPACT, SEM_FN_NAME (sh64_compact,fmov5_compact) }, | |
5137 | { SH64_COMPACT_INSN_FMOV6_COMPACT, SEM_FN_NAME (sh64_compact,fmov6_compact) }, | |
5138 | { SH64_COMPACT_INSN_FMOV7_COMPACT, SEM_FN_NAME (sh64_compact,fmov7_compact) }, | |
5139 | { SH64_COMPACT_INSN_FMUL_COMPACT, SEM_FN_NAME (sh64_compact,fmul_compact) }, | |
5140 | { SH64_COMPACT_INSN_FNEG_COMPACT, SEM_FN_NAME (sh64_compact,fneg_compact) }, | |
5141 | { SH64_COMPACT_INSN_FRCHG_COMPACT, SEM_FN_NAME (sh64_compact,frchg_compact) }, | |
5142 | { SH64_COMPACT_INSN_FSCHG_COMPACT, SEM_FN_NAME (sh64_compact,fschg_compact) }, | |
5143 | { SH64_COMPACT_INSN_FSQRT_COMPACT, SEM_FN_NAME (sh64_compact,fsqrt_compact) }, | |
5144 | { SH64_COMPACT_INSN_FSTS_COMPACT, SEM_FN_NAME (sh64_compact,fsts_compact) }, | |
5145 | { SH64_COMPACT_INSN_FSUB_COMPACT, SEM_FN_NAME (sh64_compact,fsub_compact) }, | |
5146 | { SH64_COMPACT_INSN_FTRC_COMPACT, SEM_FN_NAME (sh64_compact,ftrc_compact) }, | |
5147 | { SH64_COMPACT_INSN_FTRV_COMPACT, SEM_FN_NAME (sh64_compact,ftrv_compact) }, | |
5148 | { SH64_COMPACT_INSN_JMP_COMPACT, SEM_FN_NAME (sh64_compact,jmp_compact) }, | |
5149 | { SH64_COMPACT_INSN_JSR_COMPACT, SEM_FN_NAME (sh64_compact,jsr_compact) }, | |
5150 | { SH64_COMPACT_INSN_LDC_COMPACT, SEM_FN_NAME (sh64_compact,ldc_compact) }, | |
5151 | { SH64_COMPACT_INSN_LDCL_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_compact) }, | |
5152 | { SH64_COMPACT_INSN_LDS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpscr_compact) }, | |
5153 | { SH64_COMPACT_INSN_LDSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) }, | |
5154 | { SH64_COMPACT_INSN_LDS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpul_compact) }, | |
5155 | { SH64_COMPACT_INSN_LDSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) }, | |
5156 | { SH64_COMPACT_INSN_LDS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,lds_mach_compact) }, | |
5157 | { SH64_COMPACT_INSN_LDSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_mach_compact) }, | |
5158 | { SH64_COMPACT_INSN_LDS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,lds_macl_compact) }, | |
5159 | { SH64_COMPACT_INSN_LDSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_macl_compact) }, | |
5160 | { SH64_COMPACT_INSN_LDS_PR_COMPACT, SEM_FN_NAME (sh64_compact,lds_pr_compact) }, | |
5161 | { SH64_COMPACT_INSN_LDSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_pr_compact) }, | |
5162 | { SH64_COMPACT_INSN_MACL_COMPACT, SEM_FN_NAME (sh64_compact,macl_compact) }, | |
5163 | { SH64_COMPACT_INSN_MACW_COMPACT, SEM_FN_NAME (sh64_compact,macw_compact) }, | |
5164 | { SH64_COMPACT_INSN_MOV_COMPACT, SEM_FN_NAME (sh64_compact,mov_compact) }, | |
5165 | { SH64_COMPACT_INSN_MOVI_COMPACT, SEM_FN_NAME (sh64_compact,movi_compact) }, | |
5166 | { SH64_COMPACT_INSN_MOVB1_COMPACT, SEM_FN_NAME (sh64_compact,movb1_compact) }, | |
5167 | { SH64_COMPACT_INSN_MOVB2_COMPACT, SEM_FN_NAME (sh64_compact,movb2_compact) }, | |
5168 | { SH64_COMPACT_INSN_MOVB3_COMPACT, SEM_FN_NAME (sh64_compact,movb3_compact) }, | |
5169 | { SH64_COMPACT_INSN_MOVB4_COMPACT, SEM_FN_NAME (sh64_compact,movb4_compact) }, | |
5170 | { SH64_COMPACT_INSN_MOVB5_COMPACT, SEM_FN_NAME (sh64_compact,movb5_compact) }, | |
5171 | { SH64_COMPACT_INSN_MOVB6_COMPACT, SEM_FN_NAME (sh64_compact,movb6_compact) }, | |
5172 | { SH64_COMPACT_INSN_MOVB7_COMPACT, SEM_FN_NAME (sh64_compact,movb7_compact) }, | |
5173 | { SH64_COMPACT_INSN_MOVB8_COMPACT, SEM_FN_NAME (sh64_compact,movb8_compact) }, | |
5174 | { SH64_COMPACT_INSN_MOVB9_COMPACT, SEM_FN_NAME (sh64_compact,movb9_compact) }, | |
5175 | { SH64_COMPACT_INSN_MOVB10_COMPACT, SEM_FN_NAME (sh64_compact,movb10_compact) }, | |
5176 | { SH64_COMPACT_INSN_MOVL1_COMPACT, SEM_FN_NAME (sh64_compact,movl1_compact) }, | |
5177 | { SH64_COMPACT_INSN_MOVL2_COMPACT, SEM_FN_NAME (sh64_compact,movl2_compact) }, | |
5178 | { SH64_COMPACT_INSN_MOVL3_COMPACT, SEM_FN_NAME (sh64_compact,movl3_compact) }, | |
5179 | { SH64_COMPACT_INSN_MOVL4_COMPACT, SEM_FN_NAME (sh64_compact,movl4_compact) }, | |
5180 | { SH64_COMPACT_INSN_MOVL5_COMPACT, SEM_FN_NAME (sh64_compact,movl5_compact) }, | |
5181 | { SH64_COMPACT_INSN_MOVL6_COMPACT, SEM_FN_NAME (sh64_compact,movl6_compact) }, | |
5182 | { SH64_COMPACT_INSN_MOVL7_COMPACT, SEM_FN_NAME (sh64_compact,movl7_compact) }, | |
5183 | { SH64_COMPACT_INSN_MOVL8_COMPACT, SEM_FN_NAME (sh64_compact,movl8_compact) }, | |
5184 | { SH64_COMPACT_INSN_MOVL9_COMPACT, SEM_FN_NAME (sh64_compact,movl9_compact) }, | |
5185 | { SH64_COMPACT_INSN_MOVL10_COMPACT, SEM_FN_NAME (sh64_compact,movl10_compact) }, | |
5186 | { SH64_COMPACT_INSN_MOVL11_COMPACT, SEM_FN_NAME (sh64_compact,movl11_compact) }, | |
5187 | { SH64_COMPACT_INSN_MOVW1_COMPACT, SEM_FN_NAME (sh64_compact,movw1_compact) }, | |
5188 | { SH64_COMPACT_INSN_MOVW2_COMPACT, SEM_FN_NAME (sh64_compact,movw2_compact) }, | |
5189 | { SH64_COMPACT_INSN_MOVW3_COMPACT, SEM_FN_NAME (sh64_compact,movw3_compact) }, | |
5190 | { SH64_COMPACT_INSN_MOVW4_COMPACT, SEM_FN_NAME (sh64_compact,movw4_compact) }, | |
5191 | { SH64_COMPACT_INSN_MOVW5_COMPACT, SEM_FN_NAME (sh64_compact,movw5_compact) }, | |
5192 | { SH64_COMPACT_INSN_MOVW6_COMPACT, SEM_FN_NAME (sh64_compact,movw6_compact) }, | |
5193 | { SH64_COMPACT_INSN_MOVW7_COMPACT, SEM_FN_NAME (sh64_compact,movw7_compact) }, | |
5194 | { SH64_COMPACT_INSN_MOVW8_COMPACT, SEM_FN_NAME (sh64_compact,movw8_compact) }, | |
5195 | { SH64_COMPACT_INSN_MOVW9_COMPACT, SEM_FN_NAME (sh64_compact,movw9_compact) }, | |
5196 | { SH64_COMPACT_INSN_MOVW10_COMPACT, SEM_FN_NAME (sh64_compact,movw10_compact) }, | |
5197 | { SH64_COMPACT_INSN_MOVW11_COMPACT, SEM_FN_NAME (sh64_compact,movw11_compact) }, | |
5198 | { SH64_COMPACT_INSN_MOVA_COMPACT, SEM_FN_NAME (sh64_compact,mova_compact) }, | |
5199 | { SH64_COMPACT_INSN_MOVCAL_COMPACT, SEM_FN_NAME (sh64_compact,movcal_compact) }, | |
5200 | { SH64_COMPACT_INSN_MOVT_COMPACT, SEM_FN_NAME (sh64_compact,movt_compact) }, | |
5201 | { SH64_COMPACT_INSN_MULL_COMPACT, SEM_FN_NAME (sh64_compact,mull_compact) }, | |
5202 | { SH64_COMPACT_INSN_MULSW_COMPACT, SEM_FN_NAME (sh64_compact,mulsw_compact) }, | |
5203 | { SH64_COMPACT_INSN_MULUW_COMPACT, SEM_FN_NAME (sh64_compact,muluw_compact) }, | |
5204 | { SH64_COMPACT_INSN_NEG_COMPACT, SEM_FN_NAME (sh64_compact,neg_compact) }, | |
5205 | { SH64_COMPACT_INSN_NEGC_COMPACT, SEM_FN_NAME (sh64_compact,negc_compact) }, | |
5206 | { SH64_COMPACT_INSN_NOP_COMPACT, SEM_FN_NAME (sh64_compact,nop_compact) }, | |
5207 | { SH64_COMPACT_INSN_NOT_COMPACT, SEM_FN_NAME (sh64_compact,not_compact) }, | |
5208 | { SH64_COMPACT_INSN_OCBI_COMPACT, SEM_FN_NAME (sh64_compact,ocbi_compact) }, | |
5209 | { SH64_COMPACT_INSN_OCBP_COMPACT, SEM_FN_NAME (sh64_compact,ocbp_compact) }, | |
5210 | { SH64_COMPACT_INSN_OCBWB_COMPACT, SEM_FN_NAME (sh64_compact,ocbwb_compact) }, | |
5211 | { SH64_COMPACT_INSN_OR_COMPACT, SEM_FN_NAME (sh64_compact,or_compact) }, | |
5212 | { SH64_COMPACT_INSN_ORI_COMPACT, SEM_FN_NAME (sh64_compact,ori_compact) }, | |
5213 | { SH64_COMPACT_INSN_ORB_COMPACT, SEM_FN_NAME (sh64_compact,orb_compact) }, | |
5214 | { SH64_COMPACT_INSN_PREF_COMPACT, SEM_FN_NAME (sh64_compact,pref_compact) }, | |
5215 | { SH64_COMPACT_INSN_ROTCL_COMPACT, SEM_FN_NAME (sh64_compact,rotcl_compact) }, | |
5216 | { SH64_COMPACT_INSN_ROTCR_COMPACT, SEM_FN_NAME (sh64_compact,rotcr_compact) }, | |
5217 | { SH64_COMPACT_INSN_ROTL_COMPACT, SEM_FN_NAME (sh64_compact,rotl_compact) }, | |
5218 | { SH64_COMPACT_INSN_ROTR_COMPACT, SEM_FN_NAME (sh64_compact,rotr_compact) }, | |
5219 | { SH64_COMPACT_INSN_RTS_COMPACT, SEM_FN_NAME (sh64_compact,rts_compact) }, | |
5220 | { SH64_COMPACT_INSN_SETS_COMPACT, SEM_FN_NAME (sh64_compact,sets_compact) }, | |
5221 | { SH64_COMPACT_INSN_SETT_COMPACT, SEM_FN_NAME (sh64_compact,sett_compact) }, | |
5222 | { SH64_COMPACT_INSN_SHAD_COMPACT, SEM_FN_NAME (sh64_compact,shad_compact) }, | |
5223 | { SH64_COMPACT_INSN_SHAL_COMPACT, SEM_FN_NAME (sh64_compact,shal_compact) }, | |
5224 | { SH64_COMPACT_INSN_SHAR_COMPACT, SEM_FN_NAME (sh64_compact,shar_compact) }, | |
5225 | { SH64_COMPACT_INSN_SHLD_COMPACT, SEM_FN_NAME (sh64_compact,shld_compact) }, | |
5226 | { SH64_COMPACT_INSN_SHLL_COMPACT, SEM_FN_NAME (sh64_compact,shll_compact) }, | |
5227 | { SH64_COMPACT_INSN_SHLL2_COMPACT, SEM_FN_NAME (sh64_compact,shll2_compact) }, | |
5228 | { SH64_COMPACT_INSN_SHLL8_COMPACT, SEM_FN_NAME (sh64_compact,shll8_compact) }, | |
5229 | { SH64_COMPACT_INSN_SHLL16_COMPACT, SEM_FN_NAME (sh64_compact,shll16_compact) }, | |
5230 | { SH64_COMPACT_INSN_SHLR_COMPACT, SEM_FN_NAME (sh64_compact,shlr_compact) }, | |
5231 | { SH64_COMPACT_INSN_SHLR2_COMPACT, SEM_FN_NAME (sh64_compact,shlr2_compact) }, | |
5232 | { SH64_COMPACT_INSN_SHLR8_COMPACT, SEM_FN_NAME (sh64_compact,shlr8_compact) }, | |
5233 | { SH64_COMPACT_INSN_SHLR16_COMPACT, SEM_FN_NAME (sh64_compact,shlr16_compact) }, | |
5234 | { SH64_COMPACT_INSN_STC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_gbr_compact) }, | |
5235 | { SH64_COMPACT_INSN_STCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_gbr_compact) }, | |
5236 | { SH64_COMPACT_INSN_STS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpscr_compact) }, | |
5237 | { SH64_COMPACT_INSN_STSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) }, | |
5238 | { SH64_COMPACT_INSN_STS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpul_compact) }, | |
5239 | { SH64_COMPACT_INSN_STSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpul_compact) }, | |
5240 | { SH64_COMPACT_INSN_STS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,sts_mach_compact) }, | |
5241 | { SH64_COMPACT_INSN_STSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,stsl_mach_compact) }, | |
5242 | { SH64_COMPACT_INSN_STS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,sts_macl_compact) }, | |
5243 | { SH64_COMPACT_INSN_STSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_macl_compact) }, | |
5244 | { SH64_COMPACT_INSN_STS_PR_COMPACT, SEM_FN_NAME (sh64_compact,sts_pr_compact) }, | |
5245 | { SH64_COMPACT_INSN_STSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_pr_compact) }, | |
5246 | { SH64_COMPACT_INSN_SUB_COMPACT, SEM_FN_NAME (sh64_compact,sub_compact) }, | |
5247 | { SH64_COMPACT_INSN_SUBC_COMPACT, SEM_FN_NAME (sh64_compact,subc_compact) }, | |
5248 | { SH64_COMPACT_INSN_SUBV_COMPACT, SEM_FN_NAME (sh64_compact,subv_compact) }, | |
5249 | { SH64_COMPACT_INSN_SWAPB_COMPACT, SEM_FN_NAME (sh64_compact,swapb_compact) }, | |
5250 | { SH64_COMPACT_INSN_SWAPW_COMPACT, SEM_FN_NAME (sh64_compact,swapw_compact) }, | |
5251 | { SH64_COMPACT_INSN_TASB_COMPACT, SEM_FN_NAME (sh64_compact,tasb_compact) }, | |
5252 | { SH64_COMPACT_INSN_TRAPA_COMPACT, SEM_FN_NAME (sh64_compact,trapa_compact) }, | |
5253 | { SH64_COMPACT_INSN_TST_COMPACT, SEM_FN_NAME (sh64_compact,tst_compact) }, | |
5254 | { SH64_COMPACT_INSN_TSTI_COMPACT, SEM_FN_NAME (sh64_compact,tsti_compact) }, | |
5255 | { SH64_COMPACT_INSN_TSTB_COMPACT, SEM_FN_NAME (sh64_compact,tstb_compact) }, | |
5256 | { SH64_COMPACT_INSN_XOR_COMPACT, SEM_FN_NAME (sh64_compact,xor_compact) }, | |
5257 | { SH64_COMPACT_INSN_XORI_COMPACT, SEM_FN_NAME (sh64_compact,xori_compact) }, | |
5258 | { SH64_COMPACT_INSN_XORB_COMPACT, SEM_FN_NAME (sh64_compact,xorb_compact) }, | |
5259 | { SH64_COMPACT_INSN_XTRCT_COMPACT, SEM_FN_NAME (sh64_compact,xtrct_compact) }, | |
5260 | { 0, 0 } | |
5261 | }; | |
5262 | ||
5263 | /* Add the semantic fns to IDESC_TABLE. */ | |
5264 | ||
5265 | void | |
5266 | SEM_FN_NAME (sh64_compact,init_idesc_table) (SIM_CPU *current_cpu) | |
5267 | { | |
5268 | IDESC *idesc_table = CPU_IDESC (current_cpu); | |
5269 | const struct sem_fn_desc *sf; | |
5270 | int mach_num = MACH_NUM (CPU_MACH (current_cpu)); | |
5271 | ||
5272 | for (sf = &sem_fns[0]; sf->fn != 0; ++sf) | |
5273 | { | |
5274 | const CGEN_INSN *insn = idesc_table[sf->index].idata; | |
5275 | int valid_p = (CGEN_INSN_VIRTUAL_P (insn) | |
5276 | || CGEN_INSN_MACH_HAS_P (insn, mach_num)); | |
5277 | #if FAST_P | |
5278 | if (valid_p) | |
5279 | idesc_table[sf->index].sem_fast = sf->fn; | |
5280 | else | |
5281 | idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_compact,x_invalid); | |
5282 | #else | |
5283 | if (valid_p) | |
5284 | idesc_table[sf->index].sem_full = sf->fn; | |
5285 | else | |
5286 | idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_compact,x_invalid); | |
5287 | #endif | |
5288 | } | |
5289 | } | |
5290 |