1 /* Simulator instruction semantics for sh4.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 2000-2009 Red Hat, Inc.
7 This file is part of the Red Hat simulators.
18 using namespace sh4; // FIXME: namespace organization still wip
19 using namespace sh4; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh4_sem_x_invalid (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
27 sh4::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh4_scache* abuf = sem;
32 unsigned long long written = 0;
33 PCADDR pc = abuf->addr;
37 current_cpu->invalid_insn (pc);
42 current_cpu->done_insn (npc, status);
46 // ********** add-compact: add $rm, $rn
49 sh4_sem_add_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
50 sh4::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh4_scache* abuf = sem;
55 unsigned long long written = 0;
56 PCADDR pc = abuf->addr;
60 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
61 if (UNLIKELY(current_cpu->trace_result_p))
62 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
63 current_cpu->h_grc_set (FLD (f_rn), opval);
66 current_cpu->done_insn (npc, status);
70 // ********** addi-compact: add #$imm8, $rn
73 sh4_sem_addi_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
74 sh4::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh4_scache* abuf = sem;
79 unsigned long long written = 0;
80 PCADDR pc = abuf->addr;
84 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
85 if (UNLIKELY(current_cpu->trace_result_p))
86 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
87 current_cpu->h_grc_set (FLD (f_rn), opval);
90 current_cpu->done_insn (npc, status);
94 // ********** addc-compact: addc $rm, $rn
97 sh4_sem_addc_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
98 sh4::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh4_scache* abuf = sem;
103 unsigned long long written = 0;
104 PCADDR pc = abuf->addr;
109 tmp_flag = ADDCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
111 SI opval = ADDCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
112 if (UNLIKELY(current_cpu->trace_result_p))
113 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
114 current_cpu->h_grc_set (FLD (f_rn), opval);
118 if (UNLIKELY(current_cpu->trace_result_p))
119 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
120 current_cpu->h_tbit_set (opval);
124 current_cpu->done_insn (npc, status);
128 // ********** addv-compact: addv $rm, $rn
131 sh4_sem_addv_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
132 sh4::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh4_scache* abuf = sem;
137 unsigned long long written = 0;
138 PCADDR pc = abuf->addr;
143 tmp_t = ADDOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
145 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
146 if (UNLIKELY(current_cpu->trace_result_p))
147 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
148 current_cpu->h_grc_set (FLD (f_rn), opval);
152 if (UNLIKELY(current_cpu->trace_result_p))
153 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
154 current_cpu->h_tbit_set (opval);
158 current_cpu->done_insn (npc, status);
162 // ********** and-compact: and $rm64, $rn64
165 sh4_sem_and_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
166 sh4::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh4_scache* abuf = sem;
171 unsigned long long written = 0;
172 PCADDR pc = abuf->addr;
176 DI opval = ANDDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
177 if (UNLIKELY(current_cpu->trace_result_p))
178 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
179 current_cpu->h_gr_set (FLD (f_rn), opval);
182 current_cpu->done_insn (npc, status);
186 // ********** andi-compact: and #$uimm8, r0
189 sh4_sem_andi_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
190 sh4::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh4_scache* abuf = sem;
195 unsigned long long written = 0;
196 PCADDR pc = abuf->addr;
200 SI opval = ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
201 if (UNLIKELY(current_cpu->trace_result_p))
202 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
203 current_cpu->h_grc_set (((UINT) 0), opval);
206 current_cpu->done_insn (npc, status);
210 // ********** andb-compact: and.b #$imm8, @(r0, gbr)
213 sh4_sem_andb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
214 sh4::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh4_scache* abuf = sem;
219 unsigned long long written = 0;
220 PCADDR pc = abuf->addr;
226 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
227 tmp_data = ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
229 UQI opval = tmp_data;
230 if (UNLIKELY(current_cpu->trace_result_p))
231 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
232 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
236 current_cpu->done_insn (npc, status);
240 // ********** bf-compact: bf $disp8
243 sh4_sem_bf_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
244 sh4::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh4_scache* abuf = sem;
249 unsigned long long written = 0;
250 PCADDR pc = abuf->addr;
253 if (NOTBI (current_cpu->h_tbit_get ())) {
255 UDI opval = FLD (i_disp8);
256 written |= (1ULL << 2);
257 if (UNLIKELY(current_cpu->trace_result_p))
258 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
259 current_cpu->branch (opval, npc, status);
263 abuf->written = written;
264 current_cpu->done_cti_insn (npc, status);
268 // ********** bfs-compact: bf/s $disp8
271 sh4_sem_bfs_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
272 sh4::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh4_scache* abuf = sem;
277 unsigned long long written = 0;
278 PCADDR pc = abuf->addr;
281 if (NOTBI (current_cpu->h_tbit_get ())) {
284 UDI opval = ADDDI (pc, 2);
285 written |= (1ULL << 3);
286 if (UNLIKELY(current_cpu->trace_result_p))
287 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
288 current_cpu->branch (opval, npc, status);
290 current_cpu->save_delayed_pc (FLD (i_disp8));
292 UDI opval = FLD (i_disp8);
293 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
294 if (UNLIKELY(current_cpu->trace_result_p))
295 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
300 abuf->written = written;
301 current_cpu->done_cti_insn (npc, status);
305 // ********** bra-compact: bra $disp12
308 sh4_sem_bra_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
309 sh4::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh4_scache* abuf = sem;
314 unsigned long long written = 0;
315 PCADDR pc = abuf->addr;
320 UDI opval = ADDDI (pc, 2);
321 if (UNLIKELY(current_cpu->trace_result_p))
322 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
323 current_cpu->branch (opval, npc, status);
325 current_cpu->save_delayed_pc (FLD (i_disp12));
327 UDI opval = FLD (i_disp12);
328 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
329 if (UNLIKELY(current_cpu->trace_result_p))
330 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
334 current_cpu->done_cti_insn (npc, status);
338 // ********** braf-compact: braf $rn
341 sh4_sem_braf_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
342 sh4::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh4_scache* abuf = sem;
347 unsigned long long written = 0;
348 PCADDR pc = abuf->addr;
353 UDI opval = ADDDI (pc, 2);
354 if (UNLIKELY(current_cpu->trace_result_p))
355 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
356 current_cpu->branch (opval, npc, status);
358 current_cpu->save_delayed_pc (ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4)));
360 UDI opval = ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4));
361 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
362 if (UNLIKELY(current_cpu->trace_result_p))
363 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
367 current_cpu->done_cti_insn (npc, status);
371 // ********** bsr-compact: bsr $disp12
374 sh4_sem_bsr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
375 sh4::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh4_scache* abuf = sem;
380 unsigned long long written = 0;
381 PCADDR pc = abuf->addr;
386 SI opval = ADDDI (pc, 4);
387 buf.h_pr_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<SI>(pc, opval));
388 if (UNLIKELY(current_cpu->trace_result_p))
389 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
392 UDI opval = ADDDI (pc, 2);
393 if (UNLIKELY(current_cpu->trace_result_p))
394 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
395 current_cpu->branch (opval, npc, status);
397 current_cpu->save_delayed_pc (FLD (i_disp12));
399 UDI opval = FLD (i_disp12);
400 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
401 if (UNLIKELY(current_cpu->trace_result_p))
402 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
406 current_cpu->done_cti_insn (npc, status);
410 // ********** bsrf-compact: bsrf $rn
413 sh4_sem_bsrf_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
414 sh4::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh4_scache* abuf = sem;
419 unsigned long long written = 0;
420 PCADDR pc = abuf->addr;
425 SI opval = ADDDI (pc, 4);
426 buf.h_pr_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<SI>(pc, opval));
427 if (UNLIKELY(current_cpu->trace_result_p))
428 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
431 UDI opval = ADDDI (pc, 2);
432 if (UNLIKELY(current_cpu->trace_result_p))
433 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
434 current_cpu->branch (opval, npc, status);
436 current_cpu->save_delayed_pc (ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4)));
438 UDI opval = ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4));
439 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
440 if (UNLIKELY(current_cpu->trace_result_p))
441 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
445 current_cpu->done_cti_insn (npc, status);
449 // ********** bt-compact: bt $disp8
452 sh4_sem_bt_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
453 sh4::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh4_scache* abuf = sem;
458 unsigned long long written = 0;
459 PCADDR pc = abuf->addr;
462 if (current_cpu->h_tbit_get ()) {
464 UDI opval = FLD (i_disp8);
465 written |= (1ULL << 2);
466 if (UNLIKELY(current_cpu->trace_result_p))
467 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
468 current_cpu->branch (opval, npc, status);
472 abuf->written = written;
473 current_cpu->done_cti_insn (npc, status);
477 // ********** bts-compact: bt/s $disp8
480 sh4_sem_bts_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
481 sh4::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh4_scache* abuf = sem;
486 unsigned long long written = 0;
487 PCADDR pc = abuf->addr;
490 if (current_cpu->h_tbit_get ()) {
493 UDI opval = ADDDI (pc, 2);
494 written |= (1ULL << 3);
495 if (UNLIKELY(current_cpu->trace_result_p))
496 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
497 current_cpu->branch (opval, npc, status);
499 current_cpu->save_delayed_pc (FLD (i_disp8));
501 UDI opval = FLD (i_disp8);
502 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
503 if (UNLIKELY(current_cpu->trace_result_p))
504 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
509 abuf->written = written;
510 current_cpu->done_cti_insn (npc, status);
514 // ********** clrmac-compact: clrmac
517 sh4_sem_clrmac_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
518 sh4::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh4_scache* abuf = sem;
523 unsigned long long written = 0;
524 PCADDR pc = abuf->addr;
530 if (UNLIKELY(current_cpu->trace_result_p))
531 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
532 current_cpu->h_macl_set (opval);
536 if (UNLIKELY(current_cpu->trace_result_p))
537 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
538 current_cpu->h_mach_set (opval);
542 current_cpu->done_insn (npc, status);
546 // ********** clrs-compact: clrs
549 sh4_sem_clrs_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
550 sh4::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh4_scache* abuf = sem;
555 unsigned long long written = 0;
556 PCADDR pc = abuf->addr;
561 if (UNLIKELY(current_cpu->trace_result_p))
562 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
563 current_cpu->h_sbit_set (opval);
566 current_cpu->done_insn (npc, status);
570 // ********** clrt-compact: clrt
573 sh4_sem_clrt_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
574 sh4::write_stacks &buf)
576 #define FLD(f) abuf->fields.fmt_empty.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh4_scache* abuf = sem;
579 unsigned long long written = 0;
580 PCADDR pc = abuf->addr;
585 if (UNLIKELY(current_cpu->trace_result_p))
586 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
587 current_cpu->h_tbit_set (opval);
590 current_cpu->done_insn (npc, status);
594 // ********** cmpeq-compact: cmp/eq $rm, $rn
597 sh4_sem_cmpeq_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
598 sh4::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh4_scache* abuf = sem;
603 unsigned long long written = 0;
604 PCADDR pc = abuf->addr;
608 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
609 if (UNLIKELY(current_cpu->trace_result_p))
610 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
611 current_cpu->h_tbit_set (opval);
614 current_cpu->done_insn (npc, status);
618 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
621 sh4_sem_cmpeqi_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
622 sh4::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_andi_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh4_scache* abuf = sem;
627 unsigned long long written = 0;
628 PCADDR pc = abuf->addr;
632 BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
633 if (UNLIKELY(current_cpu->trace_result_p))
634 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
635 current_cpu->h_tbit_set (opval);
638 current_cpu->done_insn (npc, status);
642 // ********** cmpge-compact: cmp/ge $rm, $rn
645 sh4_sem_cmpge_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
646 sh4::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh4_scache* abuf = sem;
651 unsigned long long written = 0;
652 PCADDR pc = abuf->addr;
656 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
657 if (UNLIKELY(current_cpu->trace_result_p))
658 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
659 current_cpu->h_tbit_set (opval);
662 current_cpu->done_insn (npc, status);
666 // ********** cmpgt-compact: cmp/gt $rm, $rn
669 sh4_sem_cmpgt_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
670 sh4::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh4_scache* abuf = sem;
675 unsigned long long written = 0;
676 PCADDR pc = abuf->addr;
680 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
681 if (UNLIKELY(current_cpu->trace_result_p))
682 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
683 current_cpu->h_tbit_set (opval);
686 current_cpu->done_insn (npc, status);
690 // ********** cmphi-compact: cmp/hi $rm, $rn
693 sh4_sem_cmphi_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
694 sh4::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh4_scache* abuf = sem;
699 unsigned long long written = 0;
700 PCADDR pc = abuf->addr;
704 BI opval = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
705 if (UNLIKELY(current_cpu->trace_result_p))
706 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
707 current_cpu->h_tbit_set (opval);
710 current_cpu->done_insn (npc, status);
714 // ********** cmphs-compact: cmp/hs $rm, $rn
717 sh4_sem_cmphs_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
718 sh4::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh4_scache* abuf = sem;
723 unsigned long long written = 0;
724 PCADDR pc = abuf->addr;
728 BI opval = GEUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
729 if (UNLIKELY(current_cpu->trace_result_p))
730 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
731 current_cpu->h_tbit_set (opval);
734 current_cpu->done_insn (npc, status);
738 // ********** cmppl-compact: cmp/pl $rn
741 sh4_sem_cmppl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
742 sh4::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh4_scache* abuf = sem;
747 unsigned long long written = 0;
748 PCADDR pc = abuf->addr;
752 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
753 if (UNLIKELY(current_cpu->trace_result_p))
754 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
755 current_cpu->h_tbit_set (opval);
758 current_cpu->done_insn (npc, status);
762 // ********** cmppz-compact: cmp/pz $rn
765 sh4_sem_cmppz_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
766 sh4::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh4_scache* abuf = sem;
771 unsigned long long written = 0;
772 PCADDR pc = abuf->addr;
776 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), 0);
777 if (UNLIKELY(current_cpu->trace_result_p))
778 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
779 current_cpu->h_tbit_set (opval);
782 current_cpu->done_insn (npc, status);
786 // ********** cmpstr-compact: cmp/str $rm, $rn
789 sh4_sem_cmpstr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
790 sh4::write_stacks &buf)
792 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
793 sem_status status = SEM_STATUS_NORMAL;
794 sh4_scache* abuf = sem;
795 unsigned long long written = 0;
796 PCADDR pc = abuf->addr;
802 tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
803 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
804 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
805 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
806 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
808 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
809 if (UNLIKELY(current_cpu->trace_result_p))
810 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
811 current_cpu->h_tbit_set (opval);
815 current_cpu->done_insn (npc, status);
819 // ********** div0s-compact: div0s $rm, $rn
822 sh4_sem_div0s_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
823 sh4::write_stacks &buf)
825 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
826 sem_status status = SEM_STATUS_NORMAL;
827 sh4_scache* abuf = sem;
828 unsigned long long written = 0;
829 PCADDR pc = abuf->addr;
834 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
835 if (UNLIKELY(current_cpu->trace_result_p))
836 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
837 current_cpu->h_qbit_set (opval);
840 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
841 if (UNLIKELY(current_cpu->trace_result_p))
842 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
843 current_cpu->h_mbit_set (opval);
846 BI opval = ((EQSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31))) ? (0) : (1));
847 if (UNLIKELY(current_cpu->trace_result_p))
848 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
849 current_cpu->h_tbit_set (opval);
853 current_cpu->done_insn (npc, status);
857 // ********** div0u-compact: div0u
860 sh4_sem_div0u_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
861 sh4::write_stacks &buf)
863 #define FLD(f) abuf->fields.fmt_empty.f
864 sem_status status = SEM_STATUS_NORMAL;
865 sh4_scache* abuf = sem;
866 unsigned long long written = 0;
867 PCADDR pc = abuf->addr;
873 if (UNLIKELY(current_cpu->trace_result_p))
874 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
875 current_cpu->h_tbit_set (opval);
879 if (UNLIKELY(current_cpu->trace_result_p))
880 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
881 current_cpu->h_qbit_set (opval);
885 if (UNLIKELY(current_cpu->trace_result_p))
886 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
887 current_cpu->h_mbit_set (opval);
891 current_cpu->done_insn (npc, status);
895 // ********** div1-compact: div1 $rm, $rn
898 sh4_sem_div1_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
899 sh4::write_stacks &buf)
901 #define FLD(f) abuf->fields.sfmt_macl_compact.f
902 sem_status status = SEM_STATUS_NORMAL;
903 sh4_scache* abuf = sem;
904 unsigned long long written = 0;
905 PCADDR pc = abuf->addr;
912 tmp_oldq = current_cpu->h_qbit_get ();
914 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
915 if (UNLIKELY(current_cpu->trace_result_p))
916 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
917 current_cpu->h_qbit_set (opval);
920 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
921 if (UNLIKELY(current_cpu->trace_result_p))
922 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
923 current_cpu->h_grc_set (FLD (f_rn), opval);
925 if (NOTBI (tmp_oldq)) {
926 if (NOTBI (current_cpu->h_mbit_get ())) {
928 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
930 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
931 if (UNLIKELY(current_cpu->trace_result_p))
932 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
933 current_cpu->h_grc_set (FLD (f_rn), opval);
935 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
936 if (NOTBI (current_cpu->h_qbit_get ())) {
938 BI opval = ((tmp_tmp1) ? (1) : (0));
939 if (UNLIKELY(current_cpu->trace_result_p))
940 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
941 current_cpu->h_qbit_set (opval);
945 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
946 if (UNLIKELY(current_cpu->trace_result_p))
947 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
948 current_cpu->h_qbit_set (opval);
954 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
956 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
957 if (UNLIKELY(current_cpu->trace_result_p))
958 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
959 current_cpu->h_grc_set (FLD (f_rn), opval);
961 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
962 if (NOTBI (current_cpu->h_qbit_get ())) {
964 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
965 if (UNLIKELY(current_cpu->trace_result_p))
966 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
967 current_cpu->h_qbit_set (opval);
971 BI opval = ((tmp_tmp1) ? (1) : (0));
972 if (UNLIKELY(current_cpu->trace_result_p))
973 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
974 current_cpu->h_qbit_set (opval);
980 if (NOTBI (current_cpu->h_mbit_get ())) {
982 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
984 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
985 if (UNLIKELY(current_cpu->trace_result_p))
986 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
987 current_cpu->h_grc_set (FLD (f_rn), opval);
989 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
990 if (NOTBI (current_cpu->h_qbit_get ())) {
992 BI opval = ((tmp_tmp1) ? (1) : (0));
993 if (UNLIKELY(current_cpu->trace_result_p))
994 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
995 current_cpu->h_qbit_set (opval);
999 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1000 if (UNLIKELY(current_cpu->trace_result_p))
1001 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1002 current_cpu->h_qbit_set (opval);
1008 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
1010 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
1011 if (UNLIKELY(current_cpu->trace_result_p))
1012 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1013 current_cpu->h_grc_set (FLD (f_rn), opval);
1015 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
1016 if (NOTBI (current_cpu->h_qbit_get ())) {
1018 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1019 if (UNLIKELY(current_cpu->trace_result_p))
1020 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1021 current_cpu->h_qbit_set (opval);
1025 BI opval = ((tmp_tmp1) ? (1) : (0));
1026 if (UNLIKELY(current_cpu->trace_result_p))
1027 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1028 current_cpu->h_qbit_set (opval);
1035 BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1036 if (UNLIKELY(current_cpu->trace_result_p))
1037 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1038 current_cpu->h_tbit_set (opval);
1042 current_cpu->done_insn (npc, status);
1046 // ********** divu-compact: divu r0, $rn
1049 sh4_sem_divu_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1050 sh4::write_stacks &buf)
1052 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1053 sem_status status = SEM_STATUS_NORMAL;
1054 sh4_scache* abuf = sem;
1055 unsigned long long written = 0;
1056 PCADDR pc = abuf->addr;
1057 PCADDR npc = pc + 2;
1060 SI opval = UDIVSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1061 if (UNLIKELY(current_cpu->trace_result_p))
1062 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1063 current_cpu->h_grc_set (FLD (f_rn), opval);
1066 current_cpu->done_insn (npc, status);
1070 // ********** mulr-compact: mulr r0, $rn
1073 sh4_sem_mulr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1074 sh4::write_stacks &buf)
1076 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1077 sem_status status = SEM_STATUS_NORMAL;
1078 sh4_scache* abuf = sem;
1079 unsigned long long written = 0;
1080 PCADDR pc = abuf->addr;
1081 PCADDR npc = pc + 2;
1084 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1085 if (UNLIKELY(current_cpu->trace_result_p))
1086 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1087 current_cpu->h_grc_set (FLD (f_rn), opval);
1090 current_cpu->done_insn (npc, status);
1094 // ********** dmulsl-compact: dmuls.l $rm, $rn
1097 sh4_sem_dmulsl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1098 sh4::write_stacks &buf)
1100 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1101 sem_status status = SEM_STATUS_NORMAL;
1102 sh4_scache* abuf = sem;
1103 unsigned long long written = 0;
1104 PCADDR pc = abuf->addr;
1105 PCADDR npc = pc + 2;
1109 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1111 SI opval = SUBWORDDISI (tmp_result, 0);
1112 if (UNLIKELY(current_cpu->trace_result_p))
1113 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1114 current_cpu->h_mach_set (opval);
1117 SI opval = SUBWORDDISI (tmp_result, 1);
1118 if (UNLIKELY(current_cpu->trace_result_p))
1119 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1120 current_cpu->h_macl_set (opval);
1124 current_cpu->done_insn (npc, status);
1128 // ********** dmulul-compact: dmulu.l $rm, $rn
1131 sh4_sem_dmulul_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1132 sh4::write_stacks &buf)
1134 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1135 sem_status status = SEM_STATUS_NORMAL;
1136 sh4_scache* abuf = sem;
1137 unsigned long long written = 0;
1138 PCADDR pc = abuf->addr;
1139 PCADDR npc = pc + 2;
1143 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1145 SI opval = SUBWORDDISI (tmp_result, 0);
1146 if (UNLIKELY(current_cpu->trace_result_p))
1147 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1148 current_cpu->h_mach_set (opval);
1151 SI opval = SUBWORDDISI (tmp_result, 1);
1152 if (UNLIKELY(current_cpu->trace_result_p))
1153 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1154 current_cpu->h_macl_set (opval);
1158 current_cpu->done_insn (npc, status);
1162 // ********** dt-compact: dt $rn
1165 sh4_sem_dt_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1166 sh4::write_stacks &buf)
1168 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
1169 sem_status status = SEM_STATUS_NORMAL;
1170 sh4_scache* abuf = sem;
1171 unsigned long long written = 0;
1172 PCADDR pc = abuf->addr;
1173 PCADDR npc = pc + 2;
1177 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1178 if (UNLIKELY(current_cpu->trace_result_p))
1179 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1180 current_cpu->h_grc_set (FLD (f_rn), opval);
1183 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1184 if (UNLIKELY(current_cpu->trace_result_p))
1185 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1186 current_cpu->h_tbit_set (opval);
1190 current_cpu->done_insn (npc, status);
1194 // ********** extsb-compact: exts.b $rm, $rn
1197 sh4_sem_extsb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1198 sh4::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh4_scache* abuf = sem;
1203 unsigned long long written = 0;
1204 PCADDR pc = abuf->addr;
1205 PCADDR npc = pc + 2;
1208 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1209 if (UNLIKELY(current_cpu->trace_result_p))
1210 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1211 current_cpu->h_grc_set (FLD (f_rn), opval);
1214 current_cpu->done_insn (npc, status);
1218 // ********** extsw-compact: exts.w $rm, $rn
1221 sh4_sem_extsw_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1222 sh4::write_stacks &buf)
1224 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh4_scache* abuf = sem;
1227 unsigned long long written = 0;
1228 PCADDR pc = abuf->addr;
1229 PCADDR npc = pc + 2;
1232 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1233 if (UNLIKELY(current_cpu->trace_result_p))
1234 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1235 current_cpu->h_grc_set (FLD (f_rn), opval);
1238 current_cpu->done_insn (npc, status);
1242 // ********** extub-compact: extu.b $rm, $rn
1245 sh4_sem_extub_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1246 sh4::write_stacks &buf)
1248 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1249 sem_status status = SEM_STATUS_NORMAL;
1250 sh4_scache* abuf = sem;
1251 unsigned long long written = 0;
1252 PCADDR pc = abuf->addr;
1253 PCADDR npc = pc + 2;
1256 SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1257 if (UNLIKELY(current_cpu->trace_result_p))
1258 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1259 current_cpu->h_grc_set (FLD (f_rn), opval);
1262 current_cpu->done_insn (npc, status);
1266 // ********** extuw-compact: extu.w $rm, $rn
1269 sh4_sem_extuw_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1270 sh4::write_stacks &buf)
1272 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1273 sem_status status = SEM_STATUS_NORMAL;
1274 sh4_scache* abuf = sem;
1275 unsigned long long written = 0;
1276 PCADDR pc = abuf->addr;
1277 PCADDR npc = pc + 2;
1280 SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1281 if (UNLIKELY(current_cpu->trace_result_p))
1282 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1283 current_cpu->h_grc_set (FLD (f_rn), opval);
1286 current_cpu->done_insn (npc, status);
1290 // ********** fabs-compact: fabs $fsdn
1293 sh4_sem_fabs_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1294 sh4::write_stacks &buf)
1296 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1297 sem_status status = SEM_STATUS_NORMAL;
1298 sh4_scache* abuf = sem;
1299 unsigned long long written = 0;
1300 PCADDR pc = abuf->addr;
1301 PCADDR npc = pc + 2;
1303 if (current_cpu->h_prbit_get ()) {
1305 DF opval = current_cpu->sh64_fabsd (current_cpu->h_fsd_get (FLD (f_rn)));
1306 written |= (1ULL << 2);
1307 if (UNLIKELY(current_cpu->trace_result_p))
1308 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1309 current_cpu->h_fsd_set (FLD (f_rn), opval);
1313 DF opval = current_cpu->sh64_fabss (current_cpu->h_fsd_get (FLD (f_rn)));
1314 written |= (1ULL << 2);
1315 if (UNLIKELY(current_cpu->trace_result_p))
1316 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1317 current_cpu->h_fsd_set (FLD (f_rn), opval);
1321 abuf->written = written;
1322 current_cpu->done_insn (npc, status);
1326 // ********** fadd-compact: fadd $fsdm, $fsdn
1329 sh4_sem_fadd_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1330 sh4::write_stacks &buf)
1332 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1333 sem_status status = SEM_STATUS_NORMAL;
1334 sh4_scache* abuf = sem;
1335 unsigned long long written = 0;
1336 PCADDR pc = abuf->addr;
1337 PCADDR npc = pc + 2;
1339 if (current_cpu->h_prbit_get ()) {
1341 DF opval = current_cpu->sh64_faddd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1342 written |= (1ULL << 3);
1343 if (UNLIKELY(current_cpu->trace_result_p))
1344 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1345 current_cpu->h_fsd_set (FLD (f_rn), opval);
1349 DF opval = current_cpu->sh64_fadds (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1350 written |= (1ULL << 3);
1351 if (UNLIKELY(current_cpu->trace_result_p))
1352 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1353 current_cpu->h_fsd_set (FLD (f_rn), opval);
1357 abuf->written = written;
1358 current_cpu->done_insn (npc, status);
1362 // ********** fcmpeq-compact: fcmp/eq $fsdm, $fsdn
1365 sh4_sem_fcmpeq_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1366 sh4::write_stacks &buf)
1368 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1369 sem_status status = SEM_STATUS_NORMAL;
1370 sh4_scache* abuf = sem;
1371 unsigned long long written = 0;
1372 PCADDR pc = abuf->addr;
1373 PCADDR npc = pc + 2;
1375 if (current_cpu->h_prbit_get ()) {
1377 BI opval = current_cpu->sh64_fcmpeqd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1378 written |= (1ULL << 3);
1379 if (UNLIKELY(current_cpu->trace_result_p))
1380 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1381 current_cpu->h_tbit_set (opval);
1385 BI opval = current_cpu->sh64_fcmpeqs (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1386 written |= (1ULL << 3);
1387 if (UNLIKELY(current_cpu->trace_result_p))
1388 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1389 current_cpu->h_tbit_set (opval);
1393 abuf->written = written;
1394 current_cpu->done_insn (npc, status);
1398 // ********** fcmpgt-compact: fcmp/gt $fsdm, $fsdn
1401 sh4_sem_fcmpgt_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1402 sh4::write_stacks &buf)
1404 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1405 sem_status status = SEM_STATUS_NORMAL;
1406 sh4_scache* abuf = sem;
1407 unsigned long long written = 0;
1408 PCADDR pc = abuf->addr;
1409 PCADDR npc = pc + 2;
1411 if (current_cpu->h_prbit_get ()) {
1413 BI opval = current_cpu->sh64_fcmpgtd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1414 written |= (1ULL << 3);
1415 if (UNLIKELY(current_cpu->trace_result_p))
1416 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1417 current_cpu->h_tbit_set (opval);
1421 BI opval = current_cpu->sh64_fcmpgts (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1422 written |= (1ULL << 3);
1423 if (UNLIKELY(current_cpu->trace_result_p))
1424 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1425 current_cpu->h_tbit_set (opval);
1429 abuf->written = written;
1430 current_cpu->done_insn (npc, status);
1434 // ********** fcnvds-compact: fcnvds $drn, fpul
1437 sh4_sem_fcnvds_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1438 sh4::write_stacks &buf)
1440 #define FLD(f) abuf->fields.sfmt_fcnvds_compact.f
1441 sem_status status = SEM_STATUS_NORMAL;
1442 sh4_scache* abuf = sem;
1443 unsigned long long written = 0;
1444 PCADDR pc = abuf->addr;
1445 PCADDR npc = pc + 2;
1448 SF opval = current_cpu->sh64_fcnvds (current_cpu->h_drc_get (FLD (f_dn)));
1449 if (UNLIKELY(current_cpu->trace_result_p))
1450 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
1451 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1454 current_cpu->done_insn (npc, status);
1458 // ********** fcnvsd-compact: fcnvsd fpul, $drn
1461 sh4_sem_fcnvsd_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1462 sh4::write_stacks &buf)
1464 #define FLD(f) abuf->fields.sfmt_fcnvsd_compact.f
1465 sem_status status = SEM_STATUS_NORMAL;
1466 sh4_scache* abuf = sem;
1467 unsigned long long written = 0;
1468 PCADDR pc = abuf->addr;
1469 PCADDR npc = pc + 2;
1472 DF opval = current_cpu->sh64_fcnvsd (current_cpu->hardware.h_fr[((UINT) 32)]);
1473 if (UNLIKELY(current_cpu->trace_result_p))
1474 current_cpu->trace_stream << "drc" << '[' << FLD (f_dn) << ']' << ":=0x" << hex << opval << dec << " ";
1475 current_cpu->h_drc_set (FLD (f_dn), opval);
1478 current_cpu->done_insn (npc, status);
1482 // ********** fdiv-compact: fdiv $fsdm, $fsdn
1485 sh4_sem_fdiv_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1486 sh4::write_stacks &buf)
1488 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1489 sem_status status = SEM_STATUS_NORMAL;
1490 sh4_scache* abuf = sem;
1491 unsigned long long written = 0;
1492 PCADDR pc = abuf->addr;
1493 PCADDR npc = pc + 2;
1495 if (current_cpu->h_prbit_get ()) {
1497 DF opval = current_cpu->sh64_fdivd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1498 written |= (1ULL << 3);
1499 if (UNLIKELY(current_cpu->trace_result_p))
1500 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1501 current_cpu->h_fsd_set (FLD (f_rn), opval);
1505 DF opval = current_cpu->sh64_fdivs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1506 written |= (1ULL << 3);
1507 if (UNLIKELY(current_cpu->trace_result_p))
1508 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1509 current_cpu->h_fsd_set (FLD (f_rn), opval);
1513 abuf->written = written;
1514 current_cpu->done_insn (npc, status);
1518 // ********** fipr-compact: fipr $fvm, $fvn
1521 sh4_sem_fipr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1522 sh4::write_stacks &buf)
1524 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
1525 sem_status status = SEM_STATUS_NORMAL;
1526 sh4_scache* abuf = sem;
1527 unsigned long long written = 0;
1528 PCADDR pc = abuf->addr;
1529 PCADDR npc = pc + 2;
1531 current_cpu->sh64_fipr (FLD (f_vm), FLD (f_vn));
1533 current_cpu->done_insn (npc, status);
1537 // ********** flds-compact: flds $frn, fpul
1540 sh4_sem_flds_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1541 sh4::write_stacks &buf)
1543 #define FLD(f) abuf->fields.sfmt_flds_compact.f
1544 sem_status status = SEM_STATUS_NORMAL;
1545 sh4_scache* abuf = sem;
1546 unsigned long long written = 0;
1547 PCADDR pc = abuf->addr;
1548 PCADDR npc = pc + 2;
1551 SF opval = current_cpu->h_frc_get (FLD (f_rn));
1552 if (UNLIKELY(current_cpu->trace_result_p))
1553 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
1554 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1557 current_cpu->done_insn (npc, status);
1561 // ********** fldi0-compact: fldi0 $frn
1564 sh4_sem_fldi0_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1565 sh4::write_stacks &buf)
1567 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1568 sem_status status = SEM_STATUS_NORMAL;
1569 sh4_scache* abuf = sem;
1570 unsigned long long written = 0;
1571 PCADDR pc = abuf->addr;
1572 PCADDR npc = pc + 2;
1575 SF opval = current_cpu->sh64_fldi0 ();
1576 if (UNLIKELY(current_cpu->trace_result_p))
1577 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1578 current_cpu->h_frc_set (FLD (f_rn), opval);
1581 current_cpu->done_insn (npc, status);
1585 // ********** fldi1-compact: fldi1 $frn
1588 sh4_sem_fldi1_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1589 sh4::write_stacks &buf)
1591 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1592 sem_status status = SEM_STATUS_NORMAL;
1593 sh4_scache* abuf = sem;
1594 unsigned long long written = 0;
1595 PCADDR pc = abuf->addr;
1596 PCADDR npc = pc + 2;
1599 SF opval = current_cpu->sh64_fldi1 ();
1600 if (UNLIKELY(current_cpu->trace_result_p))
1601 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1602 current_cpu->h_frc_set (FLD (f_rn), opval);
1605 current_cpu->done_insn (npc, status);
1609 // ********** float-compact: float fpul, $fsdn
1612 sh4_sem_float_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1613 sh4::write_stacks &buf)
1615 #define FLD(f) abuf->fields.sfmt_float_compact.f
1616 sem_status status = SEM_STATUS_NORMAL;
1617 sh4_scache* abuf = sem;
1618 unsigned long long written = 0;
1619 PCADDR pc = abuf->addr;
1620 PCADDR npc = pc + 2;
1622 if (current_cpu->h_prbit_get ()) {
1624 DF opval = current_cpu->sh64_floatld (current_cpu->hardware.h_fr[((UINT) 32)]);
1625 written |= (1ULL << 2);
1626 if (UNLIKELY(current_cpu->trace_result_p))
1627 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1628 current_cpu->h_fsd_set (FLD (f_rn), opval);
1632 DF opval = current_cpu->sh64_floatls (current_cpu->hardware.h_fr[((UINT) 32)]);
1633 written |= (1ULL << 2);
1634 if (UNLIKELY(current_cpu->trace_result_p))
1635 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1636 current_cpu->h_fsd_set (FLD (f_rn), opval);
1640 abuf->written = written;
1641 current_cpu->done_insn (npc, status);
1645 // ********** fmac-compact: fmac fr0, $frm, $frn
1648 sh4_sem_fmac_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1649 sh4::write_stacks &buf)
1651 #define FLD(f) abuf->fields.sfmt_fmac_compact.f
1652 sem_status status = SEM_STATUS_NORMAL;
1653 sh4_scache* abuf = sem;
1654 unsigned long long written = 0;
1655 PCADDR pc = abuf->addr;
1656 PCADDR npc = pc + 2;
1659 SF opval = current_cpu->sh64_fmacs (current_cpu->h_frc_get (((UINT) 0)), current_cpu->h_frc_get (FLD (f_rm)), current_cpu->h_frc_get (FLD (f_rn)));
1660 if (UNLIKELY(current_cpu->trace_result_p))
1661 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1662 current_cpu->h_frc_set (FLD (f_rn), opval);
1665 current_cpu->done_insn (npc, status);
1669 // ********** fmov1-compact: fmov $fmovm, $fmovn
1672 sh4_sem_fmov1_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1673 sh4::write_stacks &buf)
1675 #define FLD(f) abuf->fields.sfmt_fmov1_compact.f
1676 sem_status status = SEM_STATUS_NORMAL;
1677 sh4_scache* abuf = sem;
1678 unsigned long long written = 0;
1679 PCADDR pc = abuf->addr;
1680 PCADDR npc = pc + 2;
1683 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1684 if (UNLIKELY(current_cpu->trace_result_p))
1685 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1686 current_cpu->h_fmov_set (FLD (f_rn), opval);
1689 current_cpu->done_insn (npc, status);
1693 // ********** fmov2-compact: fmov @$rm, $fmovn
1696 sh4_sem_fmov2_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1697 sh4::write_stacks &buf)
1699 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1700 sem_status status = SEM_STATUS_NORMAL;
1701 sh4_scache* abuf = sem;
1702 unsigned long long written = 0;
1703 PCADDR pc = abuf->addr;
1704 PCADDR npc = pc + 2;
1706 if (NOTBI (current_cpu->h_szbit_get ())) {
1708 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1709 written |= (1ULL << 4);
1710 if (UNLIKELY(current_cpu->trace_result_p))
1711 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1712 current_cpu->h_fmov_set (FLD (f_rn), opval);
1716 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1717 written |= (1ULL << 4);
1718 if (UNLIKELY(current_cpu->trace_result_p))
1719 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1720 current_cpu->h_fmov_set (FLD (f_rn), opval);
1724 abuf->written = written;
1725 current_cpu->done_insn (npc, status);
1729 // ********** fmov3-compact: fmov @${rm}+, fmovn
1732 sh4_sem_fmov3_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1733 sh4::write_stacks &buf)
1735 #define FLD(f) abuf->fields.sfmt_fmov3_compact.f
1736 sem_status status = SEM_STATUS_NORMAL;
1737 sh4_scache* abuf = sem;
1738 unsigned long long written = 0;
1739 PCADDR pc = abuf->addr;
1740 PCADDR npc = pc + 2;
1742 if (NOTBI (current_cpu->h_szbit_get ())) {
1745 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1746 written |= (1ULL << 4);
1747 if (UNLIKELY(current_cpu->trace_result_p))
1748 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1749 current_cpu->h_fmov_set (FLD (f_rn), opval);
1752 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1753 written |= (1ULL << 5);
1754 if (UNLIKELY(current_cpu->trace_result_p))
1755 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1756 current_cpu->h_grc_set (FLD (f_rm), opval);
1762 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1763 written |= (1ULL << 4);
1764 if (UNLIKELY(current_cpu->trace_result_p))
1765 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1766 current_cpu->h_fmov_set (FLD (f_rn), opval);
1769 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 8);
1770 written |= (1ULL << 5);
1771 if (UNLIKELY(current_cpu->trace_result_p))
1772 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1773 current_cpu->h_grc_set (FLD (f_rm), opval);
1778 abuf->written = written;
1779 current_cpu->done_insn (npc, status);
1783 // ********** fmov4-compact: fmov @(r0, $rm), $fmovn
1786 sh4_sem_fmov4_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1787 sh4::write_stacks &buf)
1789 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1790 sem_status status = SEM_STATUS_NORMAL;
1791 sh4_scache* abuf = sem;
1792 unsigned long long written = 0;
1793 PCADDR pc = abuf->addr;
1794 PCADDR npc = pc + 2;
1796 if (NOTBI (current_cpu->h_szbit_get ())) {
1798 DF opval = current_cpu->GETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1799 written |= (1ULL << 5);
1800 if (UNLIKELY(current_cpu->trace_result_p))
1801 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1802 current_cpu->h_fmov_set (FLD (f_rn), opval);
1806 DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1807 written |= (1ULL << 5);
1808 if (UNLIKELY(current_cpu->trace_result_p))
1809 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1810 current_cpu->h_fmov_set (FLD (f_rn), opval);
1814 abuf->written = written;
1815 current_cpu->done_insn (npc, status);
1819 // ********** fmov5-compact: fmov $fmovm, @$rn
1822 sh4_sem_fmov5_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1823 sh4::write_stacks &buf)
1825 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1826 sem_status status = SEM_STATUS_NORMAL;
1827 sh4_scache* abuf = sem;
1828 unsigned long long written = 0;
1829 PCADDR pc = abuf->addr;
1830 PCADDR npc = pc + 2;
1832 if (NOTBI (current_cpu->h_szbit_get ())) {
1834 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1835 written |= (1ULL << 4);
1836 if (UNLIKELY(current_cpu->trace_result_p))
1837 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1838 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1842 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1843 written |= (1ULL << 3);
1844 if (UNLIKELY(current_cpu->trace_result_p))
1845 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1846 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1850 abuf->written = written;
1851 current_cpu->done_insn (npc, status);
1855 // ********** fmov6-compact: fmov $fmovm, @-$rn
1858 sh4_sem_fmov6_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1859 sh4::write_stacks &buf)
1861 #define FLD(f) abuf->fields.sfmt_fmov6_compact.f
1862 sem_status status = SEM_STATUS_NORMAL;
1863 sh4_scache* abuf = sem;
1864 unsigned long long written = 0;
1865 PCADDR pc = abuf->addr;
1866 PCADDR npc = pc + 2;
1868 if (NOTBI (current_cpu->h_szbit_get ())) {
1871 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1872 written |= (1ULL << 5);
1873 if (UNLIKELY(current_cpu->trace_result_p))
1874 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1875 current_cpu->h_grc_set (FLD (f_rn), opval);
1878 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1879 written |= (1ULL << 4);
1880 if (UNLIKELY(current_cpu->trace_result_p))
1881 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1882 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1888 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
1889 written |= (1ULL << 5);
1890 if (UNLIKELY(current_cpu->trace_result_p))
1891 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1892 current_cpu->h_grc_set (FLD (f_rn), opval);
1895 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1896 written |= (1ULL << 3);
1897 if (UNLIKELY(current_cpu->trace_result_p))
1898 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1899 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1904 abuf->written = written;
1905 current_cpu->done_insn (npc, status);
1909 // ********** fmov7-compact: fmov $fmovm, @(r0, $rn)
1912 sh4_sem_fmov7_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1913 sh4::write_stacks &buf)
1915 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1916 sem_status status = SEM_STATUS_NORMAL;
1917 sh4_scache* abuf = sem;
1918 unsigned long long written = 0;
1919 PCADDR pc = abuf->addr;
1920 PCADDR npc = pc + 2;
1922 if (NOTBI (current_cpu->h_szbit_get ())) {
1924 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1925 written |= (1ULL << 5);
1926 if (UNLIKELY(current_cpu->trace_result_p))
1927 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1928 current_cpu->SETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1932 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1933 written |= (1ULL << 4);
1934 if (UNLIKELY(current_cpu->trace_result_p))
1935 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1936 current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1940 abuf->written = written;
1941 current_cpu->done_insn (npc, status);
1945 // ********** fmov8-compact: fmov.d @($imm12x8, $rm), $drn
1948 sh4_sem_fmov8_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1949 sh4::write_stacks &buf)
1951 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1952 sem_status status = SEM_STATUS_NORMAL;
1953 sh4_scache* abuf = sem;
1954 unsigned long long written = 0;
1955 PCADDR pc = abuf->addr;
1956 PCADDR npc = pc + 4;
1959 DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x8)));
1960 if (UNLIKELY(current_cpu->trace_result_p))
1961 current_cpu->trace_stream << "drc" << '[' << FLD (f_dn) << ']' << ":=0x" << hex << opval << dec << " ";
1962 current_cpu->h_drc_set (FLD (f_dn), opval);
1965 current_cpu->done_insn (npc, status);
1969 // ********** fmov9-compact: mov.l $drm, @($imm12x8, $rn)
1972 sh4_sem_fmov9_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1973 sh4::write_stacks &buf)
1975 #define FLD(f) abuf->fields.sfmt_fmov9_compact.f
1976 sem_status status = SEM_STATUS_NORMAL;
1977 sh4_scache* abuf = sem;
1978 unsigned long long written = 0;
1979 PCADDR pc = abuf->addr;
1980 PCADDR npc = pc + 4;
1983 DF opval = current_cpu->h_drc_get (FLD (f_dm));
1984 if (UNLIKELY(current_cpu->trace_result_p))
1985 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x8)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1986 current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x8)), opval);
1989 current_cpu->done_insn (npc, status);
1993 // ********** fmul-compact: fmul $fsdm, $fsdn
1996 sh4_sem_fmul_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
1997 sh4::write_stacks &buf)
1999 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2000 sem_status status = SEM_STATUS_NORMAL;
2001 sh4_scache* abuf = sem;
2002 unsigned long long written = 0;
2003 PCADDR pc = abuf->addr;
2004 PCADDR npc = pc + 2;
2006 if (current_cpu->h_prbit_get ()) {
2008 DF opval = current_cpu->sh64_fmuld (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
2009 written |= (1ULL << 3);
2010 if (UNLIKELY(current_cpu->trace_result_p))
2011 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2012 current_cpu->h_fsd_set (FLD (f_rn), opval);
2016 DF opval = current_cpu->sh64_fmuls (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
2017 written |= (1ULL << 3);
2018 if (UNLIKELY(current_cpu->trace_result_p))
2019 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2020 current_cpu->h_fsd_set (FLD (f_rn), opval);
2024 abuf->written = written;
2025 current_cpu->done_insn (npc, status);
2029 // ********** fneg-compact: fneg $fsdn
2032 sh4_sem_fneg_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2033 sh4::write_stacks &buf)
2035 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2036 sem_status status = SEM_STATUS_NORMAL;
2037 sh4_scache* abuf = sem;
2038 unsigned long long written = 0;
2039 PCADDR pc = abuf->addr;
2040 PCADDR npc = pc + 2;
2042 if (current_cpu->h_prbit_get ()) {
2044 DF opval = current_cpu->sh64_fnegd (current_cpu->h_fsd_get (FLD (f_rn)));
2045 written |= (1ULL << 2);
2046 if (UNLIKELY(current_cpu->trace_result_p))
2047 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2048 current_cpu->h_fsd_set (FLD (f_rn), opval);
2052 DF opval = current_cpu->sh64_fnegs (current_cpu->h_fsd_get (FLD (f_rn)));
2053 written |= (1ULL << 2);
2054 if (UNLIKELY(current_cpu->trace_result_p))
2055 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2056 current_cpu->h_fsd_set (FLD (f_rn), opval);
2060 abuf->written = written;
2061 current_cpu->done_insn (npc, status);
2065 // ********** frchg-compact: frchg
2068 sh4_sem_frchg_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2069 sh4::write_stacks &buf)
2071 #define FLD(f) abuf->fields.fmt_empty.f
2072 sem_status status = SEM_STATUS_NORMAL;
2073 sh4_scache* abuf = sem;
2074 unsigned long long written = 0;
2075 PCADDR pc = abuf->addr;
2076 PCADDR npc = pc + 2;
2079 BI opval = NOTBI (current_cpu->h_frbit_get ());
2080 if (UNLIKELY(current_cpu->trace_result_p))
2081 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
2082 current_cpu->h_frbit_set (opval);
2085 current_cpu->done_insn (npc, status);
2089 // ********** fschg-compact: fschg
2092 sh4_sem_fschg_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2093 sh4::write_stacks &buf)
2095 #define FLD(f) abuf->fields.fmt_empty.f
2096 sem_status status = SEM_STATUS_NORMAL;
2097 sh4_scache* abuf = sem;
2098 unsigned long long written = 0;
2099 PCADDR pc = abuf->addr;
2100 PCADDR npc = pc + 2;
2103 BI opval = NOTBI (current_cpu->h_szbit_get ());
2104 if (UNLIKELY(current_cpu->trace_result_p))
2105 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
2106 current_cpu->h_szbit_set (opval);
2109 current_cpu->done_insn (npc, status);
2113 // ********** fsqrt-compact: fsqrt $fsdn
2116 sh4_sem_fsqrt_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2117 sh4::write_stacks &buf)
2119 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2120 sem_status status = SEM_STATUS_NORMAL;
2121 sh4_scache* abuf = sem;
2122 unsigned long long written = 0;
2123 PCADDR pc = abuf->addr;
2124 PCADDR npc = pc + 2;
2126 if (current_cpu->h_prbit_get ()) {
2128 DF opval = current_cpu->sh64_fsqrtd (current_cpu->h_fsd_get (FLD (f_rn)));
2129 written |= (1ULL << 2);
2130 if (UNLIKELY(current_cpu->trace_result_p))
2131 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2132 current_cpu->h_fsd_set (FLD (f_rn), opval);
2136 DF opval = current_cpu->sh64_fsqrts (current_cpu->h_fsd_get (FLD (f_rn)));
2137 written |= (1ULL << 2);
2138 if (UNLIKELY(current_cpu->trace_result_p))
2139 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2140 current_cpu->h_fsd_set (FLD (f_rn), opval);
2144 abuf->written = written;
2145 current_cpu->done_insn (npc, status);
2149 // ********** fsts-compact: fsts fpul, $frn
2152 sh4_sem_fsts_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2153 sh4::write_stacks &buf)
2155 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
2156 sem_status status = SEM_STATUS_NORMAL;
2157 sh4_scache* abuf = sem;
2158 unsigned long long written = 0;
2159 PCADDR pc = abuf->addr;
2160 PCADDR npc = pc + 2;
2163 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
2164 if (UNLIKELY(current_cpu->trace_result_p))
2165 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2166 current_cpu->h_frc_set (FLD (f_rn), opval);
2169 current_cpu->done_insn (npc, status);
2173 // ********** fsub-compact: fsub $fsdm, $fsdn
2176 sh4_sem_fsub_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2177 sh4::write_stacks &buf)
2179 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2180 sem_status status = SEM_STATUS_NORMAL;
2181 sh4_scache* abuf = sem;
2182 unsigned long long written = 0;
2183 PCADDR pc = abuf->addr;
2184 PCADDR npc = pc + 2;
2186 if (current_cpu->h_prbit_get ()) {
2188 DF opval = current_cpu->sh64_fsubd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2189 written |= (1ULL << 3);
2190 if (UNLIKELY(current_cpu->trace_result_p))
2191 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2192 current_cpu->h_fsd_set (FLD (f_rn), opval);
2196 DF opval = current_cpu->sh64_fsubs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2197 written |= (1ULL << 3);
2198 if (UNLIKELY(current_cpu->trace_result_p))
2199 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2200 current_cpu->h_fsd_set (FLD (f_rn), opval);
2204 abuf->written = written;
2205 current_cpu->done_insn (npc, status);
2209 // ********** ftrc-compact: ftrc $fsdn, fpul
2212 sh4_sem_ftrc_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2213 sh4::write_stacks &buf)
2215 #define FLD(f) abuf->fields.sfmt_ftrc_compact.f
2216 sem_status status = SEM_STATUS_NORMAL;
2217 sh4_scache* abuf = sem;
2218 unsigned long long written = 0;
2219 PCADDR pc = abuf->addr;
2220 PCADDR npc = pc + 2;
2223 SF opval = ((current_cpu->h_prbit_get ()) ? (current_cpu->sh64_ftrcdl (current_cpu->h_fsd_get (FLD (f_rn)))) : (current_cpu->sh64_ftrcsl (current_cpu->h_fsd_get (FLD (f_rn)))));
2224 if (UNLIKELY(current_cpu->trace_result_p))
2225 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2226 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2229 current_cpu->done_insn (npc, status);
2233 // ********** ftrv-compact: ftrv xmtrx, $fvn
2236 sh4_sem_ftrv_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2237 sh4::write_stacks &buf)
2239 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
2240 sem_status status = SEM_STATUS_NORMAL;
2241 sh4_scache* abuf = sem;
2242 unsigned long long written = 0;
2243 PCADDR pc = abuf->addr;
2244 PCADDR npc = pc + 2;
2246 current_cpu->sh64_ftrv (FLD (f_vn));
2248 current_cpu->done_insn (npc, status);
2252 // ********** jmp-compact: jmp @$rn
2255 sh4_sem_jmp_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2256 sh4::write_stacks &buf)
2258 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2259 sem_status status = SEM_STATUS_NORMAL;
2260 sh4_scache* abuf = sem;
2261 unsigned long long written = 0;
2262 PCADDR pc = abuf->addr;
2263 PCADDR npc = pc + 2;
2267 UDI opval = ADDDI (pc, 2);
2268 if (UNLIKELY(current_cpu->trace_result_p))
2269 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2270 current_cpu->branch (opval, npc, status);
2272 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2274 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2275 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
2276 if (UNLIKELY(current_cpu->trace_result_p))
2277 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2279 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2282 current_cpu->done_cti_insn (npc, status);
2286 // ********** jsr-compact: jsr @$rn
2289 sh4_sem_jsr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2290 sh4::write_stacks &buf)
2292 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2293 sem_status status = SEM_STATUS_NORMAL;
2294 sh4_scache* abuf = sem;
2295 unsigned long long written = 0;
2296 PCADDR pc = abuf->addr;
2297 PCADDR npc = pc + 2;
2301 SI opval = ADDDI (pc, 4);
2302 buf.h_pr_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<SI>(pc, opval));
2303 if (UNLIKELY(current_cpu->trace_result_p))
2304 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2307 UDI opval = ADDDI (pc, 2);
2308 if (UNLIKELY(current_cpu->trace_result_p))
2309 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2310 current_cpu->branch (opval, npc, status);
2312 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2314 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2315 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
2316 if (UNLIKELY(current_cpu->trace_result_p))
2317 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2319 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2322 current_cpu->done_cti_insn (npc, status);
2326 // ********** ldc-gbr-compact: ldc $rn, gbr
2329 sh4_sem_ldc_gbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2330 sh4::write_stacks &buf)
2332 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2333 sem_status status = SEM_STATUS_NORMAL;
2334 sh4_scache* abuf = sem;
2335 unsigned long long written = 0;
2336 PCADDR pc = abuf->addr;
2337 PCADDR npc = pc + 2;
2340 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2341 if (UNLIKELY(current_cpu->trace_result_p))
2342 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2343 current_cpu->h_gbr_set (opval);
2346 current_cpu->done_insn (npc, status);
2350 // ********** ldc-vbr-compact: ldc $rn, vbr
2353 sh4_sem_ldc_vbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2354 sh4::write_stacks &buf)
2356 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2357 sem_status status = SEM_STATUS_NORMAL;
2358 sh4_scache* abuf = sem;
2359 unsigned long long written = 0;
2360 PCADDR pc = abuf->addr;
2361 PCADDR npc = pc + 2;
2364 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2365 if (UNLIKELY(current_cpu->trace_result_p))
2366 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2367 current_cpu->h_vbr_set (opval);
2370 current_cpu->done_insn (npc, status);
2374 // ********** ldc-sr-compact: ldc $rn, sr
2377 sh4_sem_ldc_sr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2378 sh4::write_stacks &buf)
2380 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2381 sem_status status = SEM_STATUS_NORMAL;
2382 sh4_scache* abuf = sem;
2383 unsigned long long written = 0;
2384 PCADDR pc = abuf->addr;
2385 PCADDR npc = pc + 2;
2388 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2389 if (UNLIKELY(current_cpu->trace_result_p))
2390 current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << " ";
2391 current_cpu->hardware.h_sr = opval;
2394 current_cpu->done_insn (npc, status);
2398 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
2401 sh4_sem_ldcl_gbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2402 sh4::write_stacks &buf)
2404 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2405 sem_status status = SEM_STATUS_NORMAL;
2406 sh4_scache* abuf = sem;
2407 unsigned long long written = 0;
2408 PCADDR pc = abuf->addr;
2409 PCADDR npc = pc + 2;
2413 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2414 if (UNLIKELY(current_cpu->trace_result_p))
2415 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2416 current_cpu->h_gbr_set (opval);
2419 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2420 if (UNLIKELY(current_cpu->trace_result_p))
2421 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2422 current_cpu->h_grc_set (FLD (f_rn), opval);
2426 current_cpu->done_insn (npc, status);
2430 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
2433 sh4_sem_ldcl_vbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2434 sh4::write_stacks &buf)
2436 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2437 sem_status status = SEM_STATUS_NORMAL;
2438 sh4_scache* abuf = sem;
2439 unsigned long long written = 0;
2440 PCADDR pc = abuf->addr;
2441 PCADDR npc = pc + 2;
2445 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2446 if (UNLIKELY(current_cpu->trace_result_p))
2447 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2448 current_cpu->h_vbr_set (opval);
2451 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2452 if (UNLIKELY(current_cpu->trace_result_p))
2453 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2454 current_cpu->h_grc_set (FLD (f_rn), opval);
2458 current_cpu->done_insn (npc, status);
2462 // ********** lds-fpscr-compact: lds $rn, fpscr
2465 sh4_sem_lds_fpscr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2466 sh4::write_stacks &buf)
2468 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2469 sem_status status = SEM_STATUS_NORMAL;
2470 sh4_scache* abuf = sem;
2471 unsigned long long written = 0;
2472 PCADDR pc = abuf->addr;
2473 PCADDR npc = pc + 2;
2476 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2477 if (UNLIKELY(current_cpu->trace_result_p))
2478 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2479 current_cpu->hardware.h_fpscr = opval;
2482 current_cpu->done_insn (npc, status);
2486 // ********** ldsl-fpscr-compact: lds.l @${rn}+, fpscr
2489 sh4_sem_ldsl_fpscr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2490 sh4::write_stacks &buf)
2492 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2493 sem_status status = SEM_STATUS_NORMAL;
2494 sh4_scache* abuf = sem;
2495 unsigned long long written = 0;
2496 PCADDR pc = abuf->addr;
2497 PCADDR npc = pc + 2;
2501 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2502 if (UNLIKELY(current_cpu->trace_result_p))
2503 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2504 current_cpu->hardware.h_fpscr = opval;
2507 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2508 if (UNLIKELY(current_cpu->trace_result_p))
2509 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2510 current_cpu->h_grc_set (FLD (f_rn), opval);
2514 current_cpu->done_insn (npc, status);
2518 // ********** lds-fpul-compact: lds $rn, fpul
2521 sh4_sem_lds_fpul_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2522 sh4::write_stacks &buf)
2524 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2525 sem_status status = SEM_STATUS_NORMAL;
2526 sh4_scache* abuf = sem;
2527 unsigned long long written = 0;
2528 PCADDR pc = abuf->addr;
2529 PCADDR npc = pc + 2;
2532 SF opval = SUBWORDSISF (current_cpu->h_grc_get (FLD (f_rn)));
2533 if (UNLIKELY(current_cpu->trace_result_p))
2534 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2535 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2538 current_cpu->done_insn (npc, status);
2542 // ********** ldsl-fpul-compact: lds.l @${rn}+, fpul
2545 sh4_sem_ldsl_fpul_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2546 sh4::write_stacks &buf)
2548 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2549 sem_status status = SEM_STATUS_NORMAL;
2550 sh4_scache* abuf = sem;
2551 unsigned long long written = 0;
2552 PCADDR pc = abuf->addr;
2553 PCADDR npc = pc + 2;
2557 SF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)));
2558 if (UNLIKELY(current_cpu->trace_result_p))
2559 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2560 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2563 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2564 if (UNLIKELY(current_cpu->trace_result_p))
2565 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2566 current_cpu->h_grc_set (FLD (f_rn), opval);
2570 current_cpu->done_insn (npc, status);
2574 // ********** lds-mach-compact: lds $rn, mach
2577 sh4_sem_lds_mach_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2578 sh4::write_stacks &buf)
2580 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2581 sem_status status = SEM_STATUS_NORMAL;
2582 sh4_scache* abuf = sem;
2583 unsigned long long written = 0;
2584 PCADDR pc = abuf->addr;
2585 PCADDR npc = pc + 2;
2588 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2589 if (UNLIKELY(current_cpu->trace_result_p))
2590 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2591 current_cpu->h_mach_set (opval);
2594 current_cpu->done_insn (npc, status);
2598 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
2601 sh4_sem_ldsl_mach_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2602 sh4::write_stacks &buf)
2604 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2605 sem_status status = SEM_STATUS_NORMAL;
2606 sh4_scache* abuf = sem;
2607 unsigned long long written = 0;
2608 PCADDR pc = abuf->addr;
2609 PCADDR npc = pc + 2;
2613 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2614 if (UNLIKELY(current_cpu->trace_result_p))
2615 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2616 current_cpu->h_mach_set (opval);
2619 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2620 if (UNLIKELY(current_cpu->trace_result_p))
2621 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2622 current_cpu->h_grc_set (FLD (f_rn), opval);
2626 current_cpu->done_insn (npc, status);
2630 // ********** lds-macl-compact: lds $rn, macl
2633 sh4_sem_lds_macl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2634 sh4::write_stacks &buf)
2636 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2637 sem_status status = SEM_STATUS_NORMAL;
2638 sh4_scache* abuf = sem;
2639 unsigned long long written = 0;
2640 PCADDR pc = abuf->addr;
2641 PCADDR npc = pc + 2;
2644 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2645 if (UNLIKELY(current_cpu->trace_result_p))
2646 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2647 current_cpu->h_macl_set (opval);
2650 current_cpu->done_insn (npc, status);
2654 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
2657 sh4_sem_ldsl_macl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2658 sh4::write_stacks &buf)
2660 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2661 sem_status status = SEM_STATUS_NORMAL;
2662 sh4_scache* abuf = sem;
2663 unsigned long long written = 0;
2664 PCADDR pc = abuf->addr;
2665 PCADDR npc = pc + 2;
2669 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2670 if (UNLIKELY(current_cpu->trace_result_p))
2671 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2672 current_cpu->h_macl_set (opval);
2675 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2676 if (UNLIKELY(current_cpu->trace_result_p))
2677 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2678 current_cpu->h_grc_set (FLD (f_rn), opval);
2682 current_cpu->done_insn (npc, status);
2686 // ********** lds-pr-compact: lds $rn, pr
2689 sh4_sem_lds_pr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2690 sh4::write_stacks &buf)
2692 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2693 sem_status status = SEM_STATUS_NORMAL;
2694 sh4_scache* abuf = sem;
2695 unsigned long long written = 0;
2696 PCADDR pc = abuf->addr;
2697 PCADDR npc = pc + 2;
2700 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2701 if (UNLIKELY(current_cpu->trace_result_p))
2702 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2703 current_cpu->h_pr_set (opval);
2706 current_cpu->done_insn (npc, status);
2710 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
2713 sh4_sem_ldsl_pr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2714 sh4::write_stacks &buf)
2716 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2717 sem_status status = SEM_STATUS_NORMAL;
2718 sh4_scache* abuf = sem;
2719 unsigned long long written = 0;
2720 PCADDR pc = abuf->addr;
2721 PCADDR npc = pc + 2;
2725 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2726 if (UNLIKELY(current_cpu->trace_result_p))
2727 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2728 current_cpu->h_pr_set (opval);
2731 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2732 if (UNLIKELY(current_cpu->trace_result_p))
2733 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2734 current_cpu->h_grc_set (FLD (f_rn), opval);
2738 current_cpu->done_insn (npc, status);
2742 // ********** macl-compact: mac.l @${rm}+, @${rn}+
2745 sh4_sem_macl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2746 sh4::write_stacks &buf)
2748 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2749 sem_status status = SEM_STATUS_NORMAL;
2750 sh4_scache* abuf = sem;
2751 unsigned long long written = 0;
2752 PCADDR pc = abuf->addr;
2753 PCADDR npc = pc + 2;
2761 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2763 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2764 if (UNLIKELY(current_cpu->trace_result_p))
2765 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2766 current_cpu->h_grc_set (FLD (f_rn), opval);
2768 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2771 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2772 if (UNLIKELY(current_cpu->trace_result_p))
2773 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2774 current_cpu->h_grc_set (FLD (f_rn), opval);
2777 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2778 written |= (1ULL << 11);
2779 if (UNLIKELY(current_cpu->trace_result_p))
2780 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2781 current_cpu->h_grc_set (FLD (f_rm), opval);
2785 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2787 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2788 written |= (1ULL << 11);
2789 if (UNLIKELY(current_cpu->trace_result_p))
2790 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2791 current_cpu->h_grc_set (FLD (f_rm), opval);
2793 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2794 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2795 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2797 if (current_cpu->h_sbit_get ()) {
2801 tmp_max = SRLDI (INVDI (0), 16);
2802 tmp_min = SRLDI (INVDI (0), 15);
2803 if (GTDI (tmp_result, tmp_max)) {
2804 tmp_result = tmp_max;
2806 if (LTDI (tmp_result, tmp_min)) {
2807 tmp_result = tmp_min;
2813 SI opval = SUBWORDDISI (tmp_result, 0);
2814 if (UNLIKELY(current_cpu->trace_result_p))
2815 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2816 current_cpu->h_mach_set (opval);
2819 SI opval = SUBWORDDISI (tmp_result, 1);
2820 if (UNLIKELY(current_cpu->trace_result_p))
2821 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2822 current_cpu->h_macl_set (opval);
2827 abuf->written = written;
2828 current_cpu->done_insn (npc, status);
2832 // ********** macw-compact: mac.w @${rm}+, @${rn}+
2835 sh4_sem_macw_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2836 sh4::write_stacks &buf)
2838 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2839 sem_status status = SEM_STATUS_NORMAL;
2840 sh4_scache* abuf = sem;
2841 unsigned long long written = 0;
2842 PCADDR pc = abuf->addr;
2843 PCADDR npc = pc + 2;
2851 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2853 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2854 if (UNLIKELY(current_cpu->trace_result_p))
2855 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2856 current_cpu->h_grc_set (FLD (f_rn), opval);
2858 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2861 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2862 if (UNLIKELY(current_cpu->trace_result_p))
2863 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2864 current_cpu->h_grc_set (FLD (f_rn), opval);
2867 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2868 written |= (1ULL << 11);
2869 if (UNLIKELY(current_cpu->trace_result_p))
2870 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2871 current_cpu->h_grc_set (FLD (f_rm), opval);
2875 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2877 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2878 written |= (1ULL << 11);
2879 if (UNLIKELY(current_cpu->trace_result_p))
2880 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2881 current_cpu->h_grc_set (FLD (f_rm), opval);
2883 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2884 if (current_cpu->h_sbit_get ()) {
2886 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
2889 written |= (1ULL << 9);
2890 if (UNLIKELY(current_cpu->trace_result_p))
2891 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2892 current_cpu->h_mach_set (opval);
2896 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
2897 written |= (1ULL << 10);
2898 if (UNLIKELY(current_cpu->trace_result_p))
2899 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2900 current_cpu->h_macl_set (opval);
2905 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2906 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2908 SI opval = SUBWORDDISI (tmp_result, 0);
2909 written |= (1ULL << 9);
2910 if (UNLIKELY(current_cpu->trace_result_p))
2911 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2912 current_cpu->h_mach_set (opval);
2915 SI opval = SUBWORDDISI (tmp_result, 1);
2916 written |= (1ULL << 10);
2917 if (UNLIKELY(current_cpu->trace_result_p))
2918 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2919 current_cpu->h_macl_set (opval);
2925 abuf->written = written;
2926 current_cpu->done_insn (npc, status);
2930 // ********** mov-compact: mov $rm64, $rn64
2933 sh4_sem_mov_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2934 sh4::write_stacks &buf)
2936 #define FLD(f) abuf->fields.sfmt_and_compact.f
2937 sem_status status = SEM_STATUS_NORMAL;
2938 sh4_scache* abuf = sem;
2939 unsigned long long written = 0;
2940 PCADDR pc = abuf->addr;
2941 PCADDR npc = pc + 2;
2944 DI opval = current_cpu->h_gr_get (FLD (f_rm));
2945 if (UNLIKELY(current_cpu->trace_result_p))
2946 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2947 current_cpu->h_gr_set (FLD (f_rn), opval);
2950 current_cpu->done_insn (npc, status);
2954 // ********** movi-compact: mov #$imm8, $rn
2957 sh4_sem_movi_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2958 sh4::write_stacks &buf)
2960 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2961 sem_status status = SEM_STATUS_NORMAL;
2962 sh4_scache* abuf = sem;
2963 unsigned long long written = 0;
2964 PCADDR pc = abuf->addr;
2965 PCADDR npc = pc + 2;
2968 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2969 if (UNLIKELY(current_cpu->trace_result_p))
2970 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2971 current_cpu->h_grc_set (FLD (f_rn), opval);
2974 current_cpu->done_insn (npc, status);
2978 // ********** movi20-compact: movi20 #$imm20, $rn
2981 sh4_sem_movi20_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
2982 sh4::write_stacks &buf)
2984 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
2985 sem_status status = SEM_STATUS_NORMAL;
2986 sh4_scache* abuf = sem;
2987 unsigned long long written = 0;
2988 PCADDR pc = abuf->addr;
2989 PCADDR npc = pc + 4;
2992 SI opval = FLD (f_imm20);
2993 if (UNLIKELY(current_cpu->trace_result_p))
2994 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2995 current_cpu->h_grc_set (FLD (f_rn), opval);
2998 current_cpu->done_insn (npc, status);
3002 // ********** movb1-compact: mov.b $rm, @$rn
3005 sh4_sem_movb1_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3006 sh4::write_stacks &buf)
3008 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3009 sem_status status = SEM_STATUS_NORMAL;
3010 sh4_scache* abuf = sem;
3011 unsigned long long written = 0;
3012 PCADDR pc = abuf->addr;
3013 PCADDR npc = pc + 2;
3016 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3017 if (UNLIKELY(current_cpu->trace_result_p))
3018 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3019 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3022 current_cpu->done_insn (npc, status);
3026 // ********** movb2-compact: mov.b $rm, @-$rn
3029 sh4_sem_movb2_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3030 sh4::write_stacks &buf)
3032 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3033 sem_status status = SEM_STATUS_NORMAL;
3034 sh4_scache* abuf = sem;
3035 unsigned long long written = 0;
3036 PCADDR pc = abuf->addr;
3037 PCADDR npc = pc + 2;
3041 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3043 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3044 if (UNLIKELY(current_cpu->trace_result_p))
3045 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3046 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3049 SI opval = tmp_addr;
3050 if (UNLIKELY(current_cpu->trace_result_p))
3051 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3052 current_cpu->h_grc_set (FLD (f_rn), opval);
3056 current_cpu->done_insn (npc, status);
3060 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
3063 sh4_sem_movb3_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3064 sh4::write_stacks &buf)
3066 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3067 sem_status status = SEM_STATUS_NORMAL;
3068 sh4_scache* abuf = sem;
3069 unsigned long long written = 0;
3070 PCADDR pc = abuf->addr;
3071 PCADDR npc = pc + 2;
3074 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3075 if (UNLIKELY(current_cpu->trace_result_p))
3076 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3077 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3080 current_cpu->done_insn (npc, status);
3084 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
3087 sh4_sem_movb4_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3088 sh4::write_stacks &buf)
3090 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3091 sem_status status = SEM_STATUS_NORMAL;
3092 sh4_scache* abuf = sem;
3093 unsigned long long written = 0;
3094 PCADDR pc = abuf->addr;
3095 PCADDR npc = pc + 2;
3099 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
3101 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
3102 if (UNLIKELY(current_cpu->trace_result_p))
3103 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3104 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3108 current_cpu->done_insn (npc, status);
3112 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
3115 sh4_sem_movb5_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3116 sh4::write_stacks &buf)
3118 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
3119 sem_status status = SEM_STATUS_NORMAL;
3120 sh4_scache* abuf = sem;
3121 unsigned long long written = 0;
3122 PCADDR pc = abuf->addr;
3123 PCADDR npc = pc + 2;
3127 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
3129 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
3130 if (UNLIKELY(current_cpu->trace_result_p))
3131 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3132 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3136 current_cpu->done_insn (npc, status);
3140 // ********** movb6-compact: mov.b @$rm, $rn
3143 sh4_sem_movb6_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3144 sh4::write_stacks &buf)
3146 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3147 sem_status status = SEM_STATUS_NORMAL;
3148 sh4_scache* abuf = sem;
3149 unsigned long long written = 0;
3150 PCADDR pc = abuf->addr;
3151 PCADDR npc = pc + 2;
3154 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3155 if (UNLIKELY(current_cpu->trace_result_p))
3156 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3157 current_cpu->h_grc_set (FLD (f_rn), opval);
3160 current_cpu->done_insn (npc, status);
3164 // ********** movb7-compact: mov.b @${rm}+, $rn
3167 sh4_sem_movb7_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3168 sh4::write_stacks &buf)
3170 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3171 sem_status status = SEM_STATUS_NORMAL;
3172 sh4_scache* abuf = sem;
3173 unsigned long long written = 0;
3174 PCADDR pc = abuf->addr;
3175 PCADDR npc = pc + 2;
3179 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3180 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3182 SI opval = EXTQISI (tmp_data);
3183 written |= (1ULL << 4);
3184 if (UNLIKELY(current_cpu->trace_result_p))
3185 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3186 current_cpu->h_grc_set (FLD (f_rm), opval);
3190 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3191 written |= (1ULL << 4);
3192 if (UNLIKELY(current_cpu->trace_result_p))
3193 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3194 current_cpu->h_grc_set (FLD (f_rm), opval);
3198 SI opval = EXTQISI (tmp_data);
3199 if (UNLIKELY(current_cpu->trace_result_p))
3200 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3201 current_cpu->h_grc_set (FLD (f_rn), opval);
3205 abuf->written = written;
3206 current_cpu->done_insn (npc, status);
3210 // ********** movb8-compact: mov.b @(r0, $rm), $rn
3213 sh4_sem_movb8_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3214 sh4::write_stacks &buf)
3216 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3217 sem_status status = SEM_STATUS_NORMAL;
3218 sh4_scache* abuf = sem;
3219 unsigned long long written = 0;
3220 PCADDR pc = abuf->addr;
3221 PCADDR npc = pc + 2;
3224 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3225 if (UNLIKELY(current_cpu->trace_result_p))
3226 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3227 current_cpu->h_grc_set (FLD (f_rn), opval);
3230 current_cpu->done_insn (npc, status);
3234 // ********** movb9-compact: mov.b @($imm8, gbr), r0
3237 sh4_sem_movb9_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3238 sh4::write_stacks &buf)
3240 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3241 sem_status status = SEM_STATUS_NORMAL;
3242 sh4_scache* abuf = sem;
3243 unsigned long long written = 0;
3244 PCADDR pc = abuf->addr;
3245 PCADDR npc = pc + 2;
3248 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
3249 if (UNLIKELY(current_cpu->trace_result_p))
3250 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3251 current_cpu->h_grc_set (((UINT) 0), opval);
3254 current_cpu->done_insn (npc, status);
3258 // ********** movb10-compact: mov.b @($imm4, $rm), r0
3261 sh4_sem_movb10_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3262 sh4::write_stacks &buf)
3264 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
3265 sem_status status = SEM_STATUS_NORMAL;
3266 sh4_scache* abuf = sem;
3267 unsigned long long written = 0;
3268 PCADDR pc = abuf->addr;
3269 PCADDR npc = pc + 2;
3272 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
3273 if (UNLIKELY(current_cpu->trace_result_p))
3274 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3275 current_cpu->h_grc_set (((UINT) 0), opval);
3278 current_cpu->done_insn (npc, status);
3282 // ********** movl1-compact: mov.l $rm, @$rn
3285 sh4_sem_movl1_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3286 sh4::write_stacks &buf)
3288 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3289 sem_status status = SEM_STATUS_NORMAL;
3290 sh4_scache* abuf = sem;
3291 unsigned long long written = 0;
3292 PCADDR pc = abuf->addr;
3293 PCADDR npc = pc + 2;
3296 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3297 if (UNLIKELY(current_cpu->trace_result_p))
3298 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3299 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3302 current_cpu->done_insn (npc, status);
3306 // ********** movl2-compact: mov.l $rm, @-$rn
3309 sh4_sem_movl2_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3310 sh4::write_stacks &buf)
3312 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3313 sem_status status = SEM_STATUS_NORMAL;
3314 sh4_scache* abuf = sem;
3315 unsigned long long written = 0;
3316 PCADDR pc = abuf->addr;
3317 PCADDR npc = pc + 2;
3321 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3323 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3324 if (UNLIKELY(current_cpu->trace_result_p))
3325 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3326 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3329 SI opval = tmp_addr;
3330 if (UNLIKELY(current_cpu->trace_result_p))
3331 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3332 current_cpu->h_grc_set (FLD (f_rn), opval);
3336 current_cpu->done_insn (npc, status);
3340 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
3343 sh4_sem_movl3_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3344 sh4::write_stacks &buf)
3346 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3347 sem_status status = SEM_STATUS_NORMAL;
3348 sh4_scache* abuf = sem;
3349 unsigned long long written = 0;
3350 PCADDR pc = abuf->addr;
3351 PCADDR npc = pc + 2;
3354 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3355 if (UNLIKELY(current_cpu->trace_result_p))
3356 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3357 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3360 current_cpu->done_insn (npc, status);
3364 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
3367 sh4_sem_movl4_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3368 sh4::write_stacks &buf)
3370 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
3371 sem_status status = SEM_STATUS_NORMAL;
3372 sh4_scache* abuf = sem;
3373 unsigned long long written = 0;
3374 PCADDR pc = abuf->addr;
3375 PCADDR npc = pc + 2;
3378 SI opval = current_cpu->h_grc_get (((UINT) 0));
3379 if (UNLIKELY(current_cpu->trace_result_p))
3380 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3381 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
3384 current_cpu->done_insn (npc, status);
3388 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
3391 sh4_sem_movl5_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3392 sh4::write_stacks &buf)
3394 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3395 sem_status status = SEM_STATUS_NORMAL;
3396 sh4_scache* abuf = sem;
3397 unsigned long long written = 0;
3398 PCADDR pc = abuf->addr;
3399 PCADDR npc = pc + 2;
3402 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3403 if (UNLIKELY(current_cpu->trace_result_p))
3404 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3405 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
3408 current_cpu->done_insn (npc, status);
3412 // ********** movl6-compact: mov.l @$rm, $rn
3415 sh4_sem_movl6_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3416 sh4::write_stacks &buf)
3418 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3419 sem_status status = SEM_STATUS_NORMAL;
3420 sh4_scache* abuf = sem;
3421 unsigned long long written = 0;
3422 PCADDR pc = abuf->addr;
3423 PCADDR npc = pc + 2;
3426 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3427 if (UNLIKELY(current_cpu->trace_result_p))
3428 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3429 current_cpu->h_grc_set (FLD (f_rn), opval);
3432 current_cpu->done_insn (npc, status);
3436 // ********** movl7-compact: mov.l @${rm}+, $rn
3439 sh4_sem_movl7_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3440 sh4::write_stacks &buf)
3442 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3443 sem_status status = SEM_STATUS_NORMAL;
3444 sh4_scache* abuf = sem;
3445 unsigned long long written = 0;
3446 PCADDR pc = abuf->addr;
3447 PCADDR npc = pc + 2;
3451 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3452 if (UNLIKELY(current_cpu->trace_result_p))
3453 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3454 current_cpu->h_grc_set (FLD (f_rn), opval);
3456 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3458 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3459 written |= (1ULL << 5);
3460 if (UNLIKELY(current_cpu->trace_result_p))
3461 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3462 current_cpu->h_grc_set (FLD (f_rm), opval);
3466 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
3467 written |= (1ULL << 5);
3468 if (UNLIKELY(current_cpu->trace_result_p))
3469 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3470 current_cpu->h_grc_set (FLD (f_rm), opval);
3475 abuf->written = written;
3476 current_cpu->done_insn (npc, status);
3480 // ********** movl8-compact: mov.l @(r0, $rm), $rn
3483 sh4_sem_movl8_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3484 sh4::write_stacks &buf)
3486 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3487 sem_status status = SEM_STATUS_NORMAL;
3488 sh4_scache* abuf = sem;
3489 unsigned long long written = 0;
3490 PCADDR pc = abuf->addr;
3491 PCADDR npc = pc + 2;
3494 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
3495 if (UNLIKELY(current_cpu->trace_result_p))
3496 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3497 current_cpu->h_grc_set (FLD (f_rn), opval);
3500 current_cpu->done_insn (npc, status);
3504 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
3507 sh4_sem_movl9_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3508 sh4::write_stacks &buf)
3510 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3511 sem_status status = SEM_STATUS_NORMAL;
3512 sh4_scache* abuf = sem;
3513 unsigned long long written = 0;
3514 PCADDR pc = abuf->addr;
3515 PCADDR npc = pc + 2;
3518 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
3519 if (UNLIKELY(current_cpu->trace_result_p))
3520 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3521 current_cpu->h_grc_set (((UINT) 0), opval);
3524 current_cpu->done_insn (npc, status);
3528 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
3531 sh4_sem_movl10_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3532 sh4::write_stacks &buf)
3534 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3535 sem_status status = SEM_STATUS_NORMAL;
3536 sh4_scache* abuf = sem;
3537 unsigned long long written = 0;
3538 PCADDR pc = abuf->addr;
3539 PCADDR npc = pc + 2;
3542 SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3543 if (UNLIKELY(current_cpu->trace_result_p))
3544 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3545 current_cpu->h_grc_set (FLD (f_rn), opval);
3548 current_cpu->done_insn (npc, status);
3552 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
3555 sh4_sem_movl11_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3556 sh4::write_stacks &buf)
3558 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3559 sem_status status = SEM_STATUS_NORMAL;
3560 sh4_scache* abuf = sem;
3561 unsigned long long written = 0;
3562 PCADDR pc = abuf->addr;
3563 PCADDR npc = pc + 2;
3566 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
3567 if (UNLIKELY(current_cpu->trace_result_p))
3568 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3569 current_cpu->h_grc_set (FLD (f_rn), opval);
3572 current_cpu->done_insn (npc, status);
3576 // ********** movl12-compact: mov.l @($imm12x4, $rm), $rn
3579 sh4_sem_movl12_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3580 sh4::write_stacks &buf)
3582 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3583 sem_status status = SEM_STATUS_NORMAL;
3584 sh4_scache* abuf = sem;
3585 unsigned long long written = 0;
3586 PCADDR pc = abuf->addr;
3587 PCADDR npc = pc + 4;
3590 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x4)));
3591 if (UNLIKELY(current_cpu->trace_result_p))
3592 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3593 current_cpu->h_grc_set (FLD (f_rn), opval);
3596 current_cpu->done_insn (npc, status);
3600 // ********** movl13-compact: mov.l $rm, @($imm12x4, $rn)
3603 sh4_sem_movl13_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3604 sh4::write_stacks &buf)
3606 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3607 sem_status status = SEM_STATUS_NORMAL;
3608 sh4_scache* abuf = sem;
3609 unsigned long long written = 0;
3610 PCADDR pc = abuf->addr;
3611 PCADDR npc = pc + 4;
3614 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3615 if (UNLIKELY(current_cpu->trace_result_p))
3616 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3617 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)), opval);
3620 current_cpu->done_insn (npc, status);
3624 // ********** movw1-compact: mov.w $rm, @$rn
3627 sh4_sem_movw1_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3628 sh4::write_stacks &buf)
3630 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3631 sem_status status = SEM_STATUS_NORMAL;
3632 sh4_scache* abuf = sem;
3633 unsigned long long written = 0;
3634 PCADDR pc = abuf->addr;
3635 PCADDR npc = pc + 2;
3638 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3639 if (UNLIKELY(current_cpu->trace_result_p))
3640 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3641 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3644 current_cpu->done_insn (npc, status);
3648 // ********** movw2-compact: mov.w $rm, @-$rn
3651 sh4_sem_movw2_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3652 sh4::write_stacks &buf)
3654 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3655 sem_status status = SEM_STATUS_NORMAL;
3656 sh4_scache* abuf = sem;
3657 unsigned long long written = 0;
3658 PCADDR pc = abuf->addr;
3659 PCADDR npc = pc + 2;
3663 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3665 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3666 if (UNLIKELY(current_cpu->trace_result_p))
3667 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3668 current_cpu->SETMEMHI (pc, tmp_addr, opval);
3671 SI opval = tmp_addr;
3672 if (UNLIKELY(current_cpu->trace_result_p))
3673 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3674 current_cpu->h_grc_set (FLD (f_rn), opval);
3678 current_cpu->done_insn (npc, status);
3682 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
3685 sh4_sem_movw3_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3686 sh4::write_stacks &buf)
3688 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3689 sem_status status = SEM_STATUS_NORMAL;
3690 sh4_scache* abuf = sem;
3691 unsigned long long written = 0;
3692 PCADDR pc = abuf->addr;
3693 PCADDR npc = pc + 2;
3696 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3697 if (UNLIKELY(current_cpu->trace_result_p))
3698 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3699 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3702 current_cpu->done_insn (npc, status);
3706 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
3709 sh4_sem_movw4_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3710 sh4::write_stacks &buf)
3712 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
3713 sem_status status = SEM_STATUS_NORMAL;
3714 sh4_scache* abuf = sem;
3715 unsigned long long written = 0;
3716 PCADDR pc = abuf->addr;
3717 PCADDR npc = pc + 2;
3720 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3721 if (UNLIKELY(current_cpu->trace_result_p))
3722 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3723 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
3726 current_cpu->done_insn (npc, status);
3730 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
3733 sh4_sem_movw5_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3734 sh4::write_stacks &buf)
3736 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3737 sem_status status = SEM_STATUS_NORMAL;
3738 sh4_scache* abuf = sem;
3739 unsigned long long written = 0;
3740 PCADDR pc = abuf->addr;
3741 PCADDR npc = pc + 2;
3744 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3745 if (UNLIKELY(current_cpu->trace_result_p))
3746 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3747 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
3750 current_cpu->done_insn (npc, status);
3754 // ********** movw6-compact: mov.w @$rm, $rn
3757 sh4_sem_movw6_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3758 sh4::write_stacks &buf)
3760 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3761 sem_status status = SEM_STATUS_NORMAL;
3762 sh4_scache* abuf = sem;
3763 unsigned long long written = 0;
3764 PCADDR pc = abuf->addr;
3765 PCADDR npc = pc + 2;
3768 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3769 if (UNLIKELY(current_cpu->trace_result_p))
3770 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3771 current_cpu->h_grc_set (FLD (f_rn), opval);
3774 current_cpu->done_insn (npc, status);
3778 // ********** movw7-compact: mov.w @${rm}+, $rn
3781 sh4_sem_movw7_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3782 sh4::write_stacks &buf)
3784 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3785 sem_status status = SEM_STATUS_NORMAL;
3786 sh4_scache* abuf = sem;
3787 unsigned long long written = 0;
3788 PCADDR pc = abuf->addr;
3789 PCADDR npc = pc + 2;
3793 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3794 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3796 SI opval = EXTHISI (tmp_data);
3797 written |= (1ULL << 4);
3798 if (UNLIKELY(current_cpu->trace_result_p))
3799 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3800 current_cpu->h_grc_set (FLD (f_rm), opval);
3804 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
3805 written |= (1ULL << 4);
3806 if (UNLIKELY(current_cpu->trace_result_p))
3807 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3808 current_cpu->h_grc_set (FLD (f_rm), opval);
3812 SI opval = EXTHISI (tmp_data);
3813 if (UNLIKELY(current_cpu->trace_result_p))
3814 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3815 current_cpu->h_grc_set (FLD (f_rn), opval);
3819 abuf->written = written;
3820 current_cpu->done_insn (npc, status);
3824 // ********** movw8-compact: mov.w @(r0, $rm), $rn
3827 sh4_sem_movw8_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3828 sh4::write_stacks &buf)
3830 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3831 sem_status status = SEM_STATUS_NORMAL;
3832 sh4_scache* abuf = sem;
3833 unsigned long long written = 0;
3834 PCADDR pc = abuf->addr;
3835 PCADDR npc = pc + 2;
3838 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3839 if (UNLIKELY(current_cpu->trace_result_p))
3840 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3841 current_cpu->h_grc_set (FLD (f_rn), opval);
3844 current_cpu->done_insn (npc, status);
3848 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
3851 sh4_sem_movw9_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3852 sh4::write_stacks &buf)
3854 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
3855 sem_status status = SEM_STATUS_NORMAL;
3856 sh4_scache* abuf = sem;
3857 unsigned long long written = 0;
3858 PCADDR pc = abuf->addr;
3859 PCADDR npc = pc + 2;
3862 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
3863 if (UNLIKELY(current_cpu->trace_result_p))
3864 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3865 current_cpu->h_grc_set (((UINT) 0), opval);
3868 current_cpu->done_insn (npc, status);
3872 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
3875 sh4_sem_movw10_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3876 sh4::write_stacks &buf)
3878 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3879 sem_status status = SEM_STATUS_NORMAL;
3880 sh4_scache* abuf = sem;
3881 unsigned long long written = 0;
3882 PCADDR pc = abuf->addr;
3883 PCADDR npc = pc + 2;
3886 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
3887 if (UNLIKELY(current_cpu->trace_result_p))
3888 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3889 current_cpu->h_grc_set (FLD (f_rn), opval);
3892 current_cpu->done_insn (npc, status);
3896 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
3899 sh4_sem_movw11_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3900 sh4::write_stacks &buf)
3902 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
3903 sem_status status = SEM_STATUS_NORMAL;
3904 sh4_scache* abuf = sem;
3905 unsigned long long written = 0;
3906 PCADDR pc = abuf->addr;
3907 PCADDR npc = pc + 2;
3910 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
3911 if (UNLIKELY(current_cpu->trace_result_p))
3912 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3913 current_cpu->h_grc_set (((UINT) 0), opval);
3916 current_cpu->done_insn (npc, status);
3920 // ********** mova-compact: mova @($imm8x4, pc), r0
3923 sh4_sem_mova_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3924 sh4::write_stacks &buf)
3926 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3927 sem_status status = SEM_STATUS_NORMAL;
3928 sh4_scache* abuf = sem;
3929 unsigned long long written = 0;
3930 PCADDR pc = abuf->addr;
3931 PCADDR npc = pc + 2;
3934 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3935 if (UNLIKELY(current_cpu->trace_result_p))
3936 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3937 current_cpu->h_grc_set (((UINT) 0), opval);
3940 current_cpu->done_insn (npc, status);
3944 // ********** movcal-compact: movca.l r0, @$rn
3947 sh4_sem_movcal_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3948 sh4::write_stacks &buf)
3950 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3951 sem_status status = SEM_STATUS_NORMAL;
3952 sh4_scache* abuf = sem;
3953 unsigned long long written = 0;
3954 PCADDR pc = abuf->addr;
3955 PCADDR npc = pc + 2;
3958 SI opval = current_cpu->h_grc_get (((UINT) 0));
3959 if (UNLIKELY(current_cpu->trace_result_p))
3960 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3961 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3964 current_cpu->done_insn (npc, status);
3968 // ********** movt-compact: movt $rn
3971 sh4_sem_movt_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3972 sh4::write_stacks &buf)
3974 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3975 sem_status status = SEM_STATUS_NORMAL;
3976 sh4_scache* abuf = sem;
3977 unsigned long long written = 0;
3978 PCADDR pc = abuf->addr;
3979 PCADDR npc = pc + 2;
3982 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
3983 if (UNLIKELY(current_cpu->trace_result_p))
3984 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3985 current_cpu->h_grc_set (FLD (f_rn), opval);
3988 current_cpu->done_insn (npc, status);
3992 // ********** mull-compact: mul.l $rm, $rn
3995 sh4_sem_mull_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
3996 sh4::write_stacks &buf)
3998 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3999 sem_status status = SEM_STATUS_NORMAL;
4000 sh4_scache* abuf = sem;
4001 unsigned long long written = 0;
4002 PCADDR pc = abuf->addr;
4003 PCADDR npc = pc + 2;
4006 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
4007 if (UNLIKELY(current_cpu->trace_result_p))
4008 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
4009 current_cpu->h_macl_set (opval);
4012 current_cpu->done_insn (npc, status);
4016 // ********** mulsw-compact: muls.w $rm, $rn
4019 sh4_sem_mulsw_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4020 sh4::write_stacks &buf)
4022 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4023 sem_status status = SEM_STATUS_NORMAL;
4024 sh4_scache* abuf = sem;
4025 unsigned long long written = 0;
4026 PCADDR pc = abuf->addr;
4027 PCADDR npc = pc + 2;
4030 SI opval = MULSI (EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1)), EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rn)), 1)));
4031 if (UNLIKELY(current_cpu->trace_result_p))
4032 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
4033 current_cpu->h_macl_set (opval);
4036 current_cpu->done_insn (npc, status);
4040 // ********** muluw-compact: mulu.w $rm, $rn
4043 sh4_sem_muluw_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4044 sh4::write_stacks &buf)
4046 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4047 sem_status status = SEM_STATUS_NORMAL;
4048 sh4_scache* abuf = sem;
4049 unsigned long long written = 0;
4050 PCADDR pc = abuf->addr;
4051 PCADDR npc = pc + 2;
4054 SI opval = MULSI (ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1)), ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rn)), 1)));
4055 if (UNLIKELY(current_cpu->trace_result_p))
4056 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
4057 current_cpu->h_macl_set (opval);
4060 current_cpu->done_insn (npc, status);
4064 // ********** neg-compact: neg $rm, $rn
4067 sh4_sem_neg_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4068 sh4::write_stacks &buf)
4070 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4071 sem_status status = SEM_STATUS_NORMAL;
4072 sh4_scache* abuf = sem;
4073 unsigned long long written = 0;
4074 PCADDR pc = abuf->addr;
4075 PCADDR npc = pc + 2;
4078 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
4079 if (UNLIKELY(current_cpu->trace_result_p))
4080 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4081 current_cpu->h_grc_set (FLD (f_rn), opval);
4084 current_cpu->done_insn (npc, status);
4088 // ********** negc-compact: negc $rm, $rn
4091 sh4_sem_negc_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4092 sh4::write_stacks &buf)
4094 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4095 sem_status status = SEM_STATUS_NORMAL;
4096 sh4_scache* abuf = sem;
4097 unsigned long long written = 0;
4098 PCADDR pc = abuf->addr;
4099 PCADDR npc = pc + 2;
4103 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4105 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4106 if (UNLIKELY(current_cpu->trace_result_p))
4107 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4108 current_cpu->h_grc_set (FLD (f_rn), opval);
4111 BI opval = tmp_flag;
4112 if (UNLIKELY(current_cpu->trace_result_p))
4113 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4114 current_cpu->h_tbit_set (opval);
4118 current_cpu->done_insn (npc, status);
4122 // ********** nop-compact: nop
4125 sh4_sem_nop_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4126 sh4::write_stacks &buf)
4128 #define FLD(f) abuf->fields.fmt_empty.f
4129 sem_status status = SEM_STATUS_NORMAL;
4130 sh4_scache* abuf = sem;
4131 unsigned long long written = 0;
4132 PCADDR pc = abuf->addr;
4133 PCADDR npc = pc + 2;
4137 current_cpu->done_insn (npc, status);
4141 // ********** not-compact: not $rm64, $rn64
4144 sh4_sem_not_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4145 sh4::write_stacks &buf)
4147 #define FLD(f) abuf->fields.sfmt_and_compact.f
4148 sem_status status = SEM_STATUS_NORMAL;
4149 sh4_scache* abuf = sem;
4150 unsigned long long written = 0;
4151 PCADDR pc = abuf->addr;
4152 PCADDR npc = pc + 2;
4155 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
4156 if (UNLIKELY(current_cpu->trace_result_p))
4157 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4158 current_cpu->h_gr_set (FLD (f_rn), opval);
4161 current_cpu->done_insn (npc, status);
4165 // ********** ocbi-compact: ocbi @$rn
4168 sh4_sem_ocbi_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4169 sh4::write_stacks &buf)
4171 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4172 sem_status status = SEM_STATUS_NORMAL;
4173 sh4_scache* abuf = sem;
4174 unsigned long long written = 0;
4175 PCADDR pc = abuf->addr;
4176 PCADDR npc = pc + 2;
4180 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4181 if (UNLIKELY(current_cpu->trace_result_p))
4182 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4183 current_cpu->h_grc_set (FLD (f_rn), opval);
4188 current_cpu->done_insn (npc, status);
4192 // ********** ocbp-compact: ocbp @$rn
4195 sh4_sem_ocbp_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4196 sh4::write_stacks &buf)
4198 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4199 sem_status status = SEM_STATUS_NORMAL;
4200 sh4_scache* abuf = sem;
4201 unsigned long long written = 0;
4202 PCADDR pc = abuf->addr;
4203 PCADDR npc = pc + 2;
4207 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4208 if (UNLIKELY(current_cpu->trace_result_p))
4209 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4210 current_cpu->h_grc_set (FLD (f_rn), opval);
4215 current_cpu->done_insn (npc, status);
4219 // ********** ocbwb-compact: ocbwb @$rn
4222 sh4_sem_ocbwb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4223 sh4::write_stacks &buf)
4225 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4226 sem_status status = SEM_STATUS_NORMAL;
4227 sh4_scache* abuf = sem;
4228 unsigned long long written = 0;
4229 PCADDR pc = abuf->addr;
4230 PCADDR npc = pc + 2;
4234 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4235 if (UNLIKELY(current_cpu->trace_result_p))
4236 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4237 current_cpu->h_grc_set (FLD (f_rn), opval);
4242 current_cpu->done_insn (npc, status);
4246 // ********** or-compact: or $rm64, $rn64
4249 sh4_sem_or_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4250 sh4::write_stacks &buf)
4252 #define FLD(f) abuf->fields.sfmt_and_compact.f
4253 sem_status status = SEM_STATUS_NORMAL;
4254 sh4_scache* abuf = sem;
4255 unsigned long long written = 0;
4256 PCADDR pc = abuf->addr;
4257 PCADDR npc = pc + 2;
4260 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
4261 if (UNLIKELY(current_cpu->trace_result_p))
4262 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4263 current_cpu->h_gr_set (FLD (f_rn), opval);
4266 current_cpu->done_insn (npc, status);
4270 // ********** ori-compact: or #$uimm8, r0
4273 sh4_sem_ori_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4274 sh4::write_stacks &buf)
4276 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4277 sem_status status = SEM_STATUS_NORMAL;
4278 sh4_scache* abuf = sem;
4279 unsigned long long written = 0;
4280 PCADDR pc = abuf->addr;
4281 PCADDR npc = pc + 2;
4284 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4285 if (UNLIKELY(current_cpu->trace_result_p))
4286 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4287 current_cpu->h_grc_set (((UINT) 0), opval);
4290 current_cpu->done_insn (npc, status);
4294 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
4297 sh4_sem_orb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4298 sh4::write_stacks &buf)
4300 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4301 sem_status status = SEM_STATUS_NORMAL;
4302 sh4_scache* abuf = sem;
4303 unsigned long long written = 0;
4304 PCADDR pc = abuf->addr;
4305 PCADDR npc = pc + 2;
4310 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4311 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4313 UQI opval = tmp_data;
4314 if (UNLIKELY(current_cpu->trace_result_p))
4315 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4316 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4320 current_cpu->done_insn (npc, status);
4324 // ********** pref-compact: pref @$rn
4327 sh4_sem_pref_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4328 sh4::write_stacks &buf)
4330 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4331 sem_status status = SEM_STATUS_NORMAL;
4332 sh4_scache* abuf = sem;
4333 unsigned long long written = 0;
4334 PCADDR pc = abuf->addr;
4335 PCADDR npc = pc + 2;
4337 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
4339 current_cpu->done_insn (npc, status);
4343 // ********** rotcl-compact: rotcl $rn
4346 sh4_sem_rotcl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4347 sh4::write_stacks &buf)
4349 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4350 sem_status status = SEM_STATUS_NORMAL;
4351 sh4_scache* abuf = sem;
4352 unsigned long long written = 0;
4353 PCADDR pc = abuf->addr;
4354 PCADDR npc = pc + 2;
4358 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4360 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
4361 if (UNLIKELY(current_cpu->trace_result_p))
4362 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4363 current_cpu->h_grc_set (FLD (f_rn), opval);
4366 BI opval = ((tmp_temp) ? (1) : (0));
4367 if (UNLIKELY(current_cpu->trace_result_p))
4368 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4369 current_cpu->h_tbit_set (opval);
4373 current_cpu->done_insn (npc, status);
4377 // ********** rotcr-compact: rotcr $rn
4380 sh4_sem_rotcr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4381 sh4::write_stacks &buf)
4383 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4384 sem_status status = SEM_STATUS_NORMAL;
4385 sh4_scache* abuf = sem;
4386 unsigned long long written = 0;
4387 PCADDR pc = abuf->addr;
4388 PCADDR npc = pc + 2;
4393 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4394 tmp_temp = current_cpu->h_tbit_get ();
4396 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4397 if (UNLIKELY(current_cpu->trace_result_p))
4398 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4399 current_cpu->h_grc_set (FLD (f_rn), opval);
4402 BI opval = ((tmp_lsbit) ? (1) : (0));
4403 if (UNLIKELY(current_cpu->trace_result_p))
4404 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4405 current_cpu->h_tbit_set (opval);
4409 current_cpu->done_insn (npc, status);
4413 // ********** rotl-compact: rotl $rn
4416 sh4_sem_rotl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4417 sh4::write_stacks &buf)
4419 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4420 sem_status status = SEM_STATUS_NORMAL;
4421 sh4_scache* abuf = sem;
4422 unsigned long long written = 0;
4423 PCADDR pc = abuf->addr;
4424 PCADDR npc = pc + 2;
4428 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4430 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
4431 if (UNLIKELY(current_cpu->trace_result_p))
4432 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4433 current_cpu->h_grc_set (FLD (f_rn), opval);
4436 BI opval = ((tmp_temp) ? (1) : (0));
4437 if (UNLIKELY(current_cpu->trace_result_p))
4438 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4439 current_cpu->h_tbit_set (opval);
4443 current_cpu->done_insn (npc, status);
4447 // ********** rotr-compact: rotr $rn
4450 sh4_sem_rotr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4451 sh4::write_stacks &buf)
4453 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4454 sem_status status = SEM_STATUS_NORMAL;
4455 sh4_scache* abuf = sem;
4456 unsigned long long written = 0;
4457 PCADDR pc = abuf->addr;
4458 PCADDR npc = pc + 2;
4463 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4464 tmp_temp = tmp_lsbit;
4466 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4467 if (UNLIKELY(current_cpu->trace_result_p))
4468 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4469 current_cpu->h_grc_set (FLD (f_rn), opval);
4472 BI opval = ((tmp_lsbit) ? (1) : (0));
4473 if (UNLIKELY(current_cpu->trace_result_p))
4474 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4475 current_cpu->h_tbit_set (opval);
4479 current_cpu->done_insn (npc, status);
4483 // ********** rts-compact: rts
4486 sh4_sem_rts_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4487 sh4::write_stacks &buf)
4489 #define FLD(f) abuf->fields.fmt_empty.f
4490 sem_status status = SEM_STATUS_NORMAL;
4491 sh4_scache* abuf = sem;
4492 unsigned long long written = 0;
4493 PCADDR pc = abuf->addr;
4494 PCADDR npc = pc + 2;
4498 UDI opval = ADDDI (pc, 2);
4499 if (UNLIKELY(current_cpu->trace_result_p))
4500 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4501 current_cpu->branch (opval, npc, status);
4503 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
4505 UDI opval = current_cpu->h_pr_get ();
4506 buf.h_pc_writes [(tick + 1) % sh4::pipe_sz].push (sh4::write<UDI>(pc, opval));
4507 if (UNLIKELY(current_cpu->trace_result_p))
4508 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4510 current_cpu->notify_ret (current_cpu->h_pr_get ());
4513 current_cpu->done_cti_insn (npc, status);
4517 // ********** sets-compact: sets
4520 sh4_sem_sets_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4521 sh4::write_stacks &buf)
4523 #define FLD(f) abuf->fields.fmt_empty.f
4524 sem_status status = SEM_STATUS_NORMAL;
4525 sh4_scache* abuf = sem;
4526 unsigned long long written = 0;
4527 PCADDR pc = abuf->addr;
4528 PCADDR npc = pc + 2;
4532 if (UNLIKELY(current_cpu->trace_result_p))
4533 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
4534 current_cpu->h_sbit_set (opval);
4537 current_cpu->done_insn (npc, status);
4541 // ********** sett-compact: sett
4544 sh4_sem_sett_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4545 sh4::write_stacks &buf)
4547 #define FLD(f) abuf->fields.fmt_empty.f
4548 sem_status status = SEM_STATUS_NORMAL;
4549 sh4_scache* abuf = sem;
4550 unsigned long long written = 0;
4551 PCADDR pc = abuf->addr;
4552 PCADDR npc = pc + 2;
4556 if (UNLIKELY(current_cpu->trace_result_p))
4557 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4558 current_cpu->h_tbit_set (opval);
4561 current_cpu->done_insn (npc, status);
4565 // ********** shad-compact: shad $rm, $rn
4568 sh4_sem_shad_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4569 sh4::write_stacks &buf)
4571 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4572 sem_status status = SEM_STATUS_NORMAL;
4573 sh4_scache* abuf = sem;
4574 unsigned long long written = 0;
4575 PCADDR pc = abuf->addr;
4576 PCADDR npc = pc + 2;
4580 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4581 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4583 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4584 written |= (1ULL << 2);
4585 if (UNLIKELY(current_cpu->trace_result_p))
4586 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4587 current_cpu->h_grc_set (FLD (f_rn), opval);
4590 if (NESI (tmp_shamt, 0)) {
4592 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4593 written |= (1ULL << 2);
4594 if (UNLIKELY(current_cpu->trace_result_p))
4595 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4596 current_cpu->h_grc_set (FLD (f_rn), opval);
4599 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
4601 SI opval = NEGSI (1);
4602 written |= (1ULL << 2);
4603 if (UNLIKELY(current_cpu->trace_result_p))
4604 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4605 current_cpu->h_grc_set (FLD (f_rn), opval);
4610 written |= (1ULL << 2);
4611 if (UNLIKELY(current_cpu->trace_result_p))
4612 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4613 current_cpu->h_grc_set (FLD (f_rn), opval);
4620 abuf->written = written;
4621 current_cpu->done_insn (npc, status);
4625 // ********** shal-compact: shal $rn
4628 sh4_sem_shal_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4629 sh4::write_stacks &buf)
4631 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4632 sem_status status = SEM_STATUS_NORMAL;
4633 sh4_scache* abuf = sem;
4634 unsigned long long written = 0;
4635 PCADDR pc = abuf->addr;
4636 PCADDR npc = pc + 2;
4640 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4642 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4643 if (UNLIKELY(current_cpu->trace_result_p))
4644 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4645 current_cpu->h_grc_set (FLD (f_rn), opval);
4648 BI opval = ((tmp_t) ? (1) : (0));
4649 if (UNLIKELY(current_cpu->trace_result_p))
4650 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4651 current_cpu->h_tbit_set (opval);
4655 current_cpu->done_insn (npc, status);
4659 // ********** shar-compact: shar $rn
4662 sh4_sem_shar_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4663 sh4::write_stacks &buf)
4665 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4666 sem_status status = SEM_STATUS_NORMAL;
4667 sh4_scache* abuf = sem;
4668 unsigned long long written = 0;
4669 PCADDR pc = abuf->addr;
4670 PCADDR npc = pc + 2;
4674 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4676 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4677 if (UNLIKELY(current_cpu->trace_result_p))
4678 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4679 current_cpu->h_grc_set (FLD (f_rn), opval);
4682 BI opval = ((tmp_t) ? (1) : (0));
4683 if (UNLIKELY(current_cpu->trace_result_p))
4684 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4685 current_cpu->h_tbit_set (opval);
4689 current_cpu->done_insn (npc, status);
4693 // ********** shld-compact: shld $rm, $rn
4696 sh4_sem_shld_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4697 sh4::write_stacks &buf)
4699 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4700 sem_status status = SEM_STATUS_NORMAL;
4701 sh4_scache* abuf = sem;
4702 unsigned long long written = 0;
4703 PCADDR pc = abuf->addr;
4704 PCADDR npc = pc + 2;
4708 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4709 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4711 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4712 written |= (1ULL << 2);
4713 if (UNLIKELY(current_cpu->trace_result_p))
4714 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4715 current_cpu->h_grc_set (FLD (f_rn), opval);
4718 if (NESI (tmp_shamt, 0)) {
4720 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4721 written |= (1ULL << 2);
4722 if (UNLIKELY(current_cpu->trace_result_p))
4723 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4724 current_cpu->h_grc_set (FLD (f_rn), opval);
4729 written |= (1ULL << 2);
4730 if (UNLIKELY(current_cpu->trace_result_p))
4731 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4732 current_cpu->h_grc_set (FLD (f_rn), opval);
4738 abuf->written = written;
4739 current_cpu->done_insn (npc, status);
4743 // ********** shll-compact: shll $rn
4746 sh4_sem_shll_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4747 sh4::write_stacks &buf)
4749 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4750 sem_status status = SEM_STATUS_NORMAL;
4751 sh4_scache* abuf = sem;
4752 unsigned long long written = 0;
4753 PCADDR pc = abuf->addr;
4754 PCADDR npc = pc + 2;
4758 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4760 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4761 if (UNLIKELY(current_cpu->trace_result_p))
4762 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4763 current_cpu->h_grc_set (FLD (f_rn), opval);
4766 BI opval = ((tmp_t) ? (1) : (0));
4767 if (UNLIKELY(current_cpu->trace_result_p))
4768 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4769 current_cpu->h_tbit_set (opval);
4773 current_cpu->done_insn (npc, status);
4777 // ********** shll2-compact: shll2 $rn
4780 sh4_sem_shll2_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4781 sh4::write_stacks &buf)
4783 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4784 sem_status status = SEM_STATUS_NORMAL;
4785 sh4_scache* abuf = sem;
4786 unsigned long long written = 0;
4787 PCADDR pc = abuf->addr;
4788 PCADDR npc = pc + 2;
4791 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4792 if (UNLIKELY(current_cpu->trace_result_p))
4793 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4794 current_cpu->h_grc_set (FLD (f_rn), opval);
4797 current_cpu->done_insn (npc, status);
4801 // ********** shll8-compact: shll8 $rn
4804 sh4_sem_shll8_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4805 sh4::write_stacks &buf)
4807 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4808 sem_status status = SEM_STATUS_NORMAL;
4809 sh4_scache* abuf = sem;
4810 unsigned long long written = 0;
4811 PCADDR pc = abuf->addr;
4812 PCADDR npc = pc + 2;
4815 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4816 if (UNLIKELY(current_cpu->trace_result_p))
4817 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4818 current_cpu->h_grc_set (FLD (f_rn), opval);
4821 current_cpu->done_insn (npc, status);
4825 // ********** shll16-compact: shll16 $rn
4828 sh4_sem_shll16_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4829 sh4::write_stacks &buf)
4831 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4832 sem_status status = SEM_STATUS_NORMAL;
4833 sh4_scache* abuf = sem;
4834 unsigned long long written = 0;
4835 PCADDR pc = abuf->addr;
4836 PCADDR npc = pc + 2;
4839 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4840 if (UNLIKELY(current_cpu->trace_result_p))
4841 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4842 current_cpu->h_grc_set (FLD (f_rn), opval);
4845 current_cpu->done_insn (npc, status);
4849 // ********** shlr-compact: shlr $rn
4852 sh4_sem_shlr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4853 sh4::write_stacks &buf)
4855 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4856 sem_status status = SEM_STATUS_NORMAL;
4857 sh4_scache* abuf = sem;
4858 unsigned long long written = 0;
4859 PCADDR pc = abuf->addr;
4860 PCADDR npc = pc + 2;
4864 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4866 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4867 if (UNLIKELY(current_cpu->trace_result_p))
4868 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4869 current_cpu->h_grc_set (FLD (f_rn), opval);
4872 BI opval = ((tmp_t) ? (1) : (0));
4873 if (UNLIKELY(current_cpu->trace_result_p))
4874 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4875 current_cpu->h_tbit_set (opval);
4879 current_cpu->done_insn (npc, status);
4883 // ********** shlr2-compact: shlr2 $rn
4886 sh4_sem_shlr2_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4887 sh4::write_stacks &buf)
4889 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4890 sem_status status = SEM_STATUS_NORMAL;
4891 sh4_scache* abuf = sem;
4892 unsigned long long written = 0;
4893 PCADDR pc = abuf->addr;
4894 PCADDR npc = pc + 2;
4897 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4898 if (UNLIKELY(current_cpu->trace_result_p))
4899 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4900 current_cpu->h_grc_set (FLD (f_rn), opval);
4903 current_cpu->done_insn (npc, status);
4907 // ********** shlr8-compact: shlr8 $rn
4910 sh4_sem_shlr8_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4911 sh4::write_stacks &buf)
4913 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4914 sem_status status = SEM_STATUS_NORMAL;
4915 sh4_scache* abuf = sem;
4916 unsigned long long written = 0;
4917 PCADDR pc = abuf->addr;
4918 PCADDR npc = pc + 2;
4921 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4922 if (UNLIKELY(current_cpu->trace_result_p))
4923 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4924 current_cpu->h_grc_set (FLD (f_rn), opval);
4927 current_cpu->done_insn (npc, status);
4931 // ********** shlr16-compact: shlr16 $rn
4934 sh4_sem_shlr16_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4935 sh4::write_stacks &buf)
4937 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4938 sem_status status = SEM_STATUS_NORMAL;
4939 sh4_scache* abuf = sem;
4940 unsigned long long written = 0;
4941 PCADDR pc = abuf->addr;
4942 PCADDR npc = pc + 2;
4945 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4946 if (UNLIKELY(current_cpu->trace_result_p))
4947 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4948 current_cpu->h_grc_set (FLD (f_rn), opval);
4951 current_cpu->done_insn (npc, status);
4955 // ********** stc-gbr-compact: stc gbr, $rn
4958 sh4_sem_stc_gbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4959 sh4::write_stacks &buf)
4961 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4962 sem_status status = SEM_STATUS_NORMAL;
4963 sh4_scache* abuf = sem;
4964 unsigned long long written = 0;
4965 PCADDR pc = abuf->addr;
4966 PCADDR npc = pc + 2;
4969 SI opval = current_cpu->h_gbr_get ();
4970 if (UNLIKELY(current_cpu->trace_result_p))
4971 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4972 current_cpu->h_grc_set (FLD (f_rn), opval);
4975 current_cpu->done_insn (npc, status);
4979 // ********** stc-vbr-compact: stc vbr, $rn
4982 sh4_sem_stc_vbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
4983 sh4::write_stacks &buf)
4985 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4986 sem_status status = SEM_STATUS_NORMAL;
4987 sh4_scache* abuf = sem;
4988 unsigned long long written = 0;
4989 PCADDR pc = abuf->addr;
4990 PCADDR npc = pc + 2;
4993 SI opval = current_cpu->h_vbr_get ();
4994 if (UNLIKELY(current_cpu->trace_result_p))
4995 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4996 current_cpu->h_grc_set (FLD (f_rn), opval);
4999 current_cpu->done_insn (npc, status);
5003 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
5006 sh4_sem_stcl_gbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5007 sh4::write_stacks &buf)
5009 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5010 sem_status status = SEM_STATUS_NORMAL;
5011 sh4_scache* abuf = sem;
5012 unsigned long long written = 0;
5013 PCADDR pc = abuf->addr;
5014 PCADDR npc = pc + 2;
5018 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5020 SI opval = current_cpu->h_gbr_get ();
5021 if (UNLIKELY(current_cpu->trace_result_p))
5022 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5023 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5026 SI opval = tmp_addr;
5027 if (UNLIKELY(current_cpu->trace_result_p))
5028 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5029 current_cpu->h_grc_set (FLD (f_rn), opval);
5033 current_cpu->done_insn (npc, status);
5037 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
5040 sh4_sem_stcl_vbr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5041 sh4::write_stacks &buf)
5043 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5044 sem_status status = SEM_STATUS_NORMAL;
5045 sh4_scache* abuf = sem;
5046 unsigned long long written = 0;
5047 PCADDR pc = abuf->addr;
5048 PCADDR npc = pc + 2;
5052 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5054 SI opval = current_cpu->h_vbr_get ();
5055 if (UNLIKELY(current_cpu->trace_result_p))
5056 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5057 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5060 SI opval = tmp_addr;
5061 if (UNLIKELY(current_cpu->trace_result_p))
5062 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5063 current_cpu->h_grc_set (FLD (f_rn), opval);
5067 current_cpu->done_insn (npc, status);
5071 // ********** sts-fpscr-compact: sts fpscr, $rn
5074 sh4_sem_sts_fpscr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5075 sh4::write_stacks &buf)
5077 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5078 sem_status status = SEM_STATUS_NORMAL;
5079 sh4_scache* abuf = sem;
5080 unsigned long long written = 0;
5081 PCADDR pc = abuf->addr;
5082 PCADDR npc = pc + 2;
5085 SI opval = current_cpu->hardware.h_fpscr;
5086 if (UNLIKELY(current_cpu->trace_result_p))
5087 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5088 current_cpu->h_grc_set (FLD (f_rn), opval);
5091 current_cpu->done_insn (npc, status);
5095 // ********** stsl-fpscr-compact: sts.l fpscr, @-$rn
5098 sh4_sem_stsl_fpscr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5099 sh4::write_stacks &buf)
5101 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5102 sem_status status = SEM_STATUS_NORMAL;
5103 sh4_scache* abuf = sem;
5104 unsigned long long written = 0;
5105 PCADDR pc = abuf->addr;
5106 PCADDR npc = pc + 2;
5110 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5112 SI opval = current_cpu->hardware.h_fpscr;
5113 if (UNLIKELY(current_cpu->trace_result_p))
5114 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5115 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5118 SI opval = tmp_addr;
5119 if (UNLIKELY(current_cpu->trace_result_p))
5120 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5121 current_cpu->h_grc_set (FLD (f_rn), opval);
5125 current_cpu->done_insn (npc, status);
5129 // ********** sts-fpul-compact: sts fpul, $rn
5132 sh4_sem_sts_fpul_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5133 sh4::write_stacks &buf)
5135 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5136 sem_status status = SEM_STATUS_NORMAL;
5137 sh4_scache* abuf = sem;
5138 unsigned long long written = 0;
5139 PCADDR pc = abuf->addr;
5140 PCADDR npc = pc + 2;
5143 SI opval = SUBWORDSFSI (current_cpu->hardware.h_fr[((UINT) 32)]);
5144 if (UNLIKELY(current_cpu->trace_result_p))
5145 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5146 current_cpu->h_grc_set (FLD (f_rn), opval);
5149 current_cpu->done_insn (npc, status);
5153 // ********** stsl-fpul-compact: sts.l fpul, @-$rn
5156 sh4_sem_stsl_fpul_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5157 sh4::write_stacks &buf)
5159 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5160 sem_status status = SEM_STATUS_NORMAL;
5161 sh4_scache* abuf = sem;
5162 unsigned long long written = 0;
5163 PCADDR pc = abuf->addr;
5164 PCADDR npc = pc + 2;
5168 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5170 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
5171 if (UNLIKELY(current_cpu->trace_result_p))
5172 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5173 current_cpu->SETMEMSF (pc, tmp_addr, opval);
5176 SI opval = tmp_addr;
5177 if (UNLIKELY(current_cpu->trace_result_p))
5178 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5179 current_cpu->h_grc_set (FLD (f_rn), opval);
5183 current_cpu->done_insn (npc, status);
5187 // ********** sts-mach-compact: sts mach, $rn
5190 sh4_sem_sts_mach_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5191 sh4::write_stacks &buf)
5193 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5194 sem_status status = SEM_STATUS_NORMAL;
5195 sh4_scache* abuf = sem;
5196 unsigned long long written = 0;
5197 PCADDR pc = abuf->addr;
5198 PCADDR npc = pc + 2;
5201 SI opval = current_cpu->h_mach_get ();
5202 if (UNLIKELY(current_cpu->trace_result_p))
5203 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5204 current_cpu->h_grc_set (FLD (f_rn), opval);
5207 current_cpu->done_insn (npc, status);
5211 // ********** stsl-mach-compact: sts.l mach, @-$rn
5214 sh4_sem_stsl_mach_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5215 sh4::write_stacks &buf)
5217 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5218 sem_status status = SEM_STATUS_NORMAL;
5219 sh4_scache* abuf = sem;
5220 unsigned long long written = 0;
5221 PCADDR pc = abuf->addr;
5222 PCADDR npc = pc + 2;
5226 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5228 SI opval = current_cpu->h_mach_get ();
5229 if (UNLIKELY(current_cpu->trace_result_p))
5230 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5231 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5234 SI opval = tmp_addr;
5235 if (UNLIKELY(current_cpu->trace_result_p))
5236 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5237 current_cpu->h_grc_set (FLD (f_rn), opval);
5241 current_cpu->done_insn (npc, status);
5245 // ********** sts-macl-compact: sts macl, $rn
5248 sh4_sem_sts_macl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5249 sh4::write_stacks &buf)
5251 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5252 sem_status status = SEM_STATUS_NORMAL;
5253 sh4_scache* abuf = sem;
5254 unsigned long long written = 0;
5255 PCADDR pc = abuf->addr;
5256 PCADDR npc = pc + 2;
5259 SI opval = current_cpu->h_macl_get ();
5260 if (UNLIKELY(current_cpu->trace_result_p))
5261 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5262 current_cpu->h_grc_set (FLD (f_rn), opval);
5265 current_cpu->done_insn (npc, status);
5269 // ********** stsl-macl-compact: sts.l macl, @-$rn
5272 sh4_sem_stsl_macl_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5273 sh4::write_stacks &buf)
5275 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5276 sem_status status = SEM_STATUS_NORMAL;
5277 sh4_scache* abuf = sem;
5278 unsigned long long written = 0;
5279 PCADDR pc = abuf->addr;
5280 PCADDR npc = pc + 2;
5284 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5286 SI opval = current_cpu->h_macl_get ();
5287 if (UNLIKELY(current_cpu->trace_result_p))
5288 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5289 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5292 SI opval = tmp_addr;
5293 if (UNLIKELY(current_cpu->trace_result_p))
5294 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5295 current_cpu->h_grc_set (FLD (f_rn), opval);
5299 current_cpu->done_insn (npc, status);
5303 // ********** sts-pr-compact: sts pr, $rn
5306 sh4_sem_sts_pr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5307 sh4::write_stacks &buf)
5309 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5310 sem_status status = SEM_STATUS_NORMAL;
5311 sh4_scache* abuf = sem;
5312 unsigned long long written = 0;
5313 PCADDR pc = abuf->addr;
5314 PCADDR npc = pc + 2;
5317 SI opval = current_cpu->h_pr_get ();
5318 if (UNLIKELY(current_cpu->trace_result_p))
5319 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5320 current_cpu->h_grc_set (FLD (f_rn), opval);
5323 current_cpu->done_insn (npc, status);
5327 // ********** stsl-pr-compact: sts.l pr, @-$rn
5330 sh4_sem_stsl_pr_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5331 sh4::write_stacks &buf)
5333 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5334 sem_status status = SEM_STATUS_NORMAL;
5335 sh4_scache* abuf = sem;
5336 unsigned long long written = 0;
5337 PCADDR pc = abuf->addr;
5338 PCADDR npc = pc + 2;
5342 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5344 SI opval = current_cpu->h_pr_get ();
5345 if (UNLIKELY(current_cpu->trace_result_p))
5346 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5347 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5350 SI opval = tmp_addr;
5351 if (UNLIKELY(current_cpu->trace_result_p))
5352 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5353 current_cpu->h_grc_set (FLD (f_rn), opval);
5357 current_cpu->done_insn (npc, status);
5361 // ********** sub-compact: sub $rm, $rn
5364 sh4_sem_sub_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5365 sh4::write_stacks &buf)
5367 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5368 sem_status status = SEM_STATUS_NORMAL;
5369 sh4_scache* abuf = sem;
5370 unsigned long long written = 0;
5371 PCADDR pc = abuf->addr;
5372 PCADDR npc = pc + 2;
5375 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5376 if (UNLIKELY(current_cpu->trace_result_p))
5377 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5378 current_cpu->h_grc_set (FLD (f_rn), opval);
5381 current_cpu->done_insn (npc, status);
5385 // ********** subc-compact: subc $rm, $rn
5388 sh4_sem_subc_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5389 sh4::write_stacks &buf)
5391 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5392 sem_status status = SEM_STATUS_NORMAL;
5393 sh4_scache* abuf = sem;
5394 unsigned long long written = 0;
5395 PCADDR pc = abuf->addr;
5396 PCADDR npc = pc + 2;
5400 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5402 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5403 if (UNLIKELY(current_cpu->trace_result_p))
5404 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5405 current_cpu->h_grc_set (FLD (f_rn), opval);
5408 BI opval = tmp_flag;
5409 if (UNLIKELY(current_cpu->trace_result_p))
5410 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5411 current_cpu->h_tbit_set (opval);
5415 current_cpu->done_insn (npc, status);
5419 // ********** subv-compact: subv $rm, $rn
5422 sh4_sem_subv_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5423 sh4::write_stacks &buf)
5425 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5426 sem_status status = SEM_STATUS_NORMAL;
5427 sh4_scache* abuf = sem;
5428 unsigned long long written = 0;
5429 PCADDR pc = abuf->addr;
5430 PCADDR npc = pc + 2;
5434 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
5436 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5437 if (UNLIKELY(current_cpu->trace_result_p))
5438 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5439 current_cpu->h_grc_set (FLD (f_rn), opval);
5442 BI opval = ((tmp_t) ? (1) : (0));
5443 if (UNLIKELY(current_cpu->trace_result_p))
5444 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5445 current_cpu->h_tbit_set (opval);
5449 current_cpu->done_insn (npc, status);
5453 // ********** swapb-compact: swap.b $rm, $rn
5456 sh4_sem_swapb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5457 sh4::write_stacks &buf)
5459 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5460 sem_status status = SEM_STATUS_NORMAL;
5461 sh4_scache* abuf = sem;
5462 unsigned long long written = 0;
5463 PCADDR pc = abuf->addr;
5464 PCADDR npc = pc + 2;
5470 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
5471 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
5472 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
5474 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
5475 if (UNLIKELY(current_cpu->trace_result_p))
5476 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5477 current_cpu->h_grc_set (FLD (f_rn), opval);
5481 current_cpu->done_insn (npc, status);
5485 // ********** swapw-compact: swap.w $rm, $rn
5488 sh4_sem_swapw_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5489 sh4::write_stacks &buf)
5491 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5492 sem_status status = SEM_STATUS_NORMAL;
5493 sh4_scache* abuf = sem;
5494 unsigned long long written = 0;
5495 PCADDR pc = abuf->addr;
5496 PCADDR npc = pc + 2;
5499 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
5500 if (UNLIKELY(current_cpu->trace_result_p))
5501 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5502 current_cpu->h_grc_set (FLD (f_rn), opval);
5505 current_cpu->done_insn (npc, status);
5509 // ********** tasb-compact: tas.b @$rn
5512 sh4_sem_tasb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5513 sh4::write_stacks &buf)
5515 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5516 sem_status status = SEM_STATUS_NORMAL;
5517 sh4_scache* abuf = sem;
5518 unsigned long long written = 0;
5519 PCADDR pc = abuf->addr;
5520 PCADDR npc = pc + 2;
5524 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
5526 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
5527 if (UNLIKELY(current_cpu->trace_result_p))
5528 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5529 current_cpu->h_tbit_set (opval);
5531 tmp_byte = ORQI (tmp_byte, 128);
5533 UQI opval = tmp_byte;
5534 if (UNLIKELY(current_cpu->trace_result_p))
5535 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5536 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
5540 current_cpu->done_insn (npc, status);
5544 // ********** trapa-compact: trapa #$uimm8
5547 sh4_sem_trapa_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5548 sh4::write_stacks &buf)
5550 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5551 sem_status status = SEM_STATUS_NORMAL;
5552 sh4_scache* abuf = sem;
5553 unsigned long long written = 0;
5554 PCADDR pc = abuf->addr;
5555 PCADDR npc = pc + 2;
5557 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
5559 current_cpu->done_insn (npc, status);
5563 // ********** tst-compact: tst $rm, $rn
5566 sh4_sem_tst_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5567 sh4::write_stacks &buf)
5569 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
5570 sem_status status = SEM_STATUS_NORMAL;
5571 sh4_scache* abuf = sem;
5572 unsigned long long written = 0;
5573 PCADDR pc = abuf->addr;
5574 PCADDR npc = pc + 2;
5577 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
5578 if (UNLIKELY(current_cpu->trace_result_p))
5579 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5580 current_cpu->h_tbit_set (opval);
5583 current_cpu->done_insn (npc, status);
5587 // ********** tsti-compact: tst #$uimm8, r0
5590 sh4_sem_tsti_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5591 sh4::write_stacks &buf)
5593 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5594 sem_status status = SEM_STATUS_NORMAL;
5595 sh4_scache* abuf = sem;
5596 unsigned long long written = 0;
5597 PCADDR pc = abuf->addr;
5598 PCADDR npc = pc + 2;
5601 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5602 if (UNLIKELY(current_cpu->trace_result_p))
5603 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5604 current_cpu->h_tbit_set (opval);
5607 current_cpu->done_insn (npc, status);
5611 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
5614 sh4_sem_tstb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5615 sh4::write_stacks &buf)
5617 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5618 sem_status status = SEM_STATUS_NORMAL;
5619 sh4_scache* abuf = sem;
5620 unsigned long long written = 0;
5621 PCADDR pc = abuf->addr;
5622 PCADDR npc = pc + 2;
5626 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5628 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5629 if (UNLIKELY(current_cpu->trace_result_p))
5630 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5631 current_cpu->h_tbit_set (opval);
5635 current_cpu->done_insn (npc, status);
5639 // ********** xor-compact: xor $rm64, $rn64
5642 sh4_sem_xor_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5643 sh4::write_stacks &buf)
5645 #define FLD(f) abuf->fields.sfmt_and_compact.f
5646 sem_status status = SEM_STATUS_NORMAL;
5647 sh4_scache* abuf = sem;
5648 unsigned long long written = 0;
5649 PCADDR pc = abuf->addr;
5650 PCADDR npc = pc + 2;
5653 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
5654 if (UNLIKELY(current_cpu->trace_result_p))
5655 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5656 current_cpu->h_gr_set (FLD (f_rn), opval);
5659 current_cpu->done_insn (npc, status);
5663 // ********** xori-compact: xor #$uimm8, r0
5666 sh4_sem_xori_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5667 sh4::write_stacks &buf)
5669 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5670 sem_status status = SEM_STATUS_NORMAL;
5671 sh4_scache* abuf = sem;
5672 unsigned long long written = 0;
5673 PCADDR pc = abuf->addr;
5674 PCADDR npc = pc + 2;
5677 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5678 if (UNLIKELY(current_cpu->trace_result_p))
5679 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
5680 current_cpu->h_grc_set (((UINT) 0), opval);
5683 current_cpu->done_insn (npc, status);
5687 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
5690 sh4_sem_xorb_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5691 sh4::write_stacks &buf)
5693 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5694 sem_status status = SEM_STATUS_NORMAL;
5695 sh4_scache* abuf = sem;
5696 unsigned long long written = 0;
5697 PCADDR pc = abuf->addr;
5698 PCADDR npc = pc + 2;
5703 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5704 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
5706 UQI opval = tmp_data;
5707 if (UNLIKELY(current_cpu->trace_result_p))
5708 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5709 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5713 current_cpu->done_insn (npc, status);
5717 // ********** xtrct-compact: xtrct $rm, $rn
5720 sh4_sem_xtrct_compact (sh4_cpu* current_cpu, sh4_scache* sem, const int tick,
5721 sh4::write_stacks &buf)
5723 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5724 sem_status status = SEM_STATUS_NORMAL;
5725 sh4_scache* abuf = sem;
5726 unsigned long long written = 0;
5727 PCADDR pc = abuf->addr;
5728 PCADDR npc = pc + 2;
5731 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
5732 if (UNLIKELY(current_cpu->trace_result_p))
5733 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5734 current_cpu->h_grc_set (FLD (f_rn), opval);
5737 current_cpu->done_insn (npc, status);