1 /* Simulator instruction semantics for sh4al.
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 sh4al; // FIXME: namespace organization still wip
19 using namespace sh4al; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh4al_sem_x_invalid (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
27 sh4al::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh4al_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 sh4al_sem_add_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
50 sh4al::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh4al_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 sh4al_sem_addi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
74 sh4al::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh4al_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 sh4al_sem_addc_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
98 sh4al::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh4al_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 sh4al_sem_addv_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
132 sh4al::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh4al_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 sh4al_sem_and_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
166 sh4al::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh4al_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 sh4al_sem_andi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
190 sh4al::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh4al_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 sh4al_sem_andb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
214 sh4al::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh4al_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 sh4al_sem_bf_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
244 sh4al::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh4al_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 sh4al_sem_bfs_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
272 sh4al::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bra_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
309 sh4al::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_braf_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
342 sh4al::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bsr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
375 sh4al::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh4al_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) % sh4al::pipe_sz].push (sh4al::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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bsrf_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
414 sh4al::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh4al_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) % sh4al::pipe_sz].push (sh4al::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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
453 sh4al::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh4al_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 sh4al_sem_bts_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
481 sh4al::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_clrmac_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
518 sh4al::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh4al_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 sh4al_sem_clrs_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
550 sh4al::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh4al_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 sh4al_sem_clrt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
574 sh4al::write_stacks &buf)
576 #define FLD(f) abuf->fields.fmt_empty.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh4al_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 sh4al_sem_cmpeq_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
598 sh4al::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh4al_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 sh4al_sem_cmpeqi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
622 sh4al::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_andi_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh4al_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 sh4al_sem_cmpge_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
646 sh4al::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh4al_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 sh4al_sem_cmpgt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
670 sh4al::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh4al_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 sh4al_sem_cmphi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
694 sh4al::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh4al_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 sh4al_sem_cmphs_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
718 sh4al::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh4al_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 sh4al_sem_cmppl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
742 sh4al::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh4al_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 sh4al_sem_cmppz_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
766 sh4al::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh4al_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 sh4al_sem_cmpstr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
790 sh4al::write_stacks &buf)
792 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
793 sem_status status = SEM_STATUS_NORMAL;
794 sh4al_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 sh4al_sem_div0s_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
823 sh4al::write_stacks &buf)
825 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
826 sem_status status = SEM_STATUS_NORMAL;
827 sh4al_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 sh4al_sem_div0u_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
861 sh4al::write_stacks &buf)
863 #define FLD(f) abuf->fields.fmt_empty.f
864 sem_status status = SEM_STATUS_NORMAL;
865 sh4al_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 sh4al_sem_div1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
899 sh4al::write_stacks &buf)
901 #define FLD(f) abuf->fields.sfmt_macl_compact.f
902 sem_status status = SEM_STATUS_NORMAL;
903 sh4al_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 // ********** dmulsl-compact: dmuls.l $rm, $rn
1049 sh4al_sem_dmulsl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1050 sh4al::write_stacks &buf)
1052 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1053 sem_status status = SEM_STATUS_NORMAL;
1054 sh4al_scache* abuf = sem;
1055 unsigned long long written = 0;
1056 PCADDR pc = abuf->addr;
1057 PCADDR npc = pc + 2;
1061 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1063 SI opval = SUBWORDDISI (tmp_result, 0);
1064 if (UNLIKELY(current_cpu->trace_result_p))
1065 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1066 current_cpu->h_mach_set (opval);
1069 SI opval = SUBWORDDISI (tmp_result, 1);
1070 if (UNLIKELY(current_cpu->trace_result_p))
1071 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1072 current_cpu->h_macl_set (opval);
1076 current_cpu->done_insn (npc, status);
1080 // ********** dmulul-compact: dmulu.l $rm, $rn
1083 sh4al_sem_dmulul_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1084 sh4al::write_stacks &buf)
1086 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1087 sem_status status = SEM_STATUS_NORMAL;
1088 sh4al_scache* abuf = sem;
1089 unsigned long long written = 0;
1090 PCADDR pc = abuf->addr;
1091 PCADDR npc = pc + 2;
1095 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1097 SI opval = SUBWORDDISI (tmp_result, 0);
1098 if (UNLIKELY(current_cpu->trace_result_p))
1099 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1100 current_cpu->h_mach_set (opval);
1103 SI opval = SUBWORDDISI (tmp_result, 1);
1104 if (UNLIKELY(current_cpu->trace_result_p))
1105 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1106 current_cpu->h_macl_set (opval);
1110 current_cpu->done_insn (npc, status);
1114 // ********** dt-compact: dt $rn
1117 sh4al_sem_dt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1118 sh4al::write_stacks &buf)
1120 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1121 sem_status status = SEM_STATUS_NORMAL;
1122 sh4al_scache* abuf = sem;
1123 unsigned long long written = 0;
1124 PCADDR pc = abuf->addr;
1125 PCADDR npc = pc + 2;
1129 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1130 if (UNLIKELY(current_cpu->trace_result_p))
1131 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1132 current_cpu->h_grc_set (FLD (f_rn), opval);
1135 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1136 if (UNLIKELY(current_cpu->trace_result_p))
1137 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1138 current_cpu->h_tbit_set (opval);
1142 current_cpu->done_insn (npc, status);
1146 // ********** extsb-compact: exts.b $rm, $rn
1149 sh4al_sem_extsb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1150 sh4al::write_stacks &buf)
1152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1153 sem_status status = SEM_STATUS_NORMAL;
1154 sh4al_scache* abuf = sem;
1155 unsigned long long written = 0;
1156 PCADDR pc = abuf->addr;
1157 PCADDR npc = pc + 2;
1160 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1161 if (UNLIKELY(current_cpu->trace_result_p))
1162 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1163 current_cpu->h_grc_set (FLD (f_rn), opval);
1166 current_cpu->done_insn (npc, status);
1170 // ********** extsw-compact: exts.w $rm, $rn
1173 sh4al_sem_extsw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1174 sh4al::write_stacks &buf)
1176 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1177 sem_status status = SEM_STATUS_NORMAL;
1178 sh4al_scache* abuf = sem;
1179 unsigned long long written = 0;
1180 PCADDR pc = abuf->addr;
1181 PCADDR npc = pc + 2;
1184 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1185 if (UNLIKELY(current_cpu->trace_result_p))
1186 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1187 current_cpu->h_grc_set (FLD (f_rn), opval);
1190 current_cpu->done_insn (npc, status);
1194 // ********** extub-compact: extu.b $rm, $rn
1197 sh4al_sem_extub_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1198 sh4al::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh4al_scache* abuf = sem;
1203 unsigned long long written = 0;
1204 PCADDR pc = abuf->addr;
1205 PCADDR npc = pc + 2;
1208 SI opval = ZEXTQISI (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 // ********** extuw-compact: extu.w $rm, $rn
1221 sh4al_sem_extuw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1222 sh4al::write_stacks &buf)
1224 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh4al_scache* abuf = sem;
1227 unsigned long long written = 0;
1228 PCADDR pc = abuf->addr;
1229 PCADDR npc = pc + 2;
1232 SI opval = ZEXTHISI (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 // ********** frchg-compact: frchg
1245 sh4al_sem_frchg_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1246 sh4al::write_stacks &buf)
1248 #define FLD(f) abuf->fields.fmt_empty.f
1249 sem_status status = SEM_STATUS_NORMAL;
1250 sh4al_scache* abuf = sem;
1251 unsigned long long written = 0;
1252 PCADDR pc = abuf->addr;
1253 PCADDR npc = pc + 2;
1256 BI opval = NOTBI (current_cpu->h_frbit_get ());
1257 if (UNLIKELY(current_cpu->trace_result_p))
1258 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
1259 current_cpu->h_frbit_set (opval);
1262 current_cpu->done_insn (npc, status);
1266 // ********** fschg-compact: fschg
1269 sh4al_sem_fschg_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1270 sh4al::write_stacks &buf)
1272 #define FLD(f) abuf->fields.fmt_empty.f
1273 sem_status status = SEM_STATUS_NORMAL;
1274 sh4al_scache* abuf = sem;
1275 unsigned long long written = 0;
1276 PCADDR pc = abuf->addr;
1277 PCADDR npc = pc + 2;
1280 BI opval = NOTBI (current_cpu->h_szbit_get ());
1281 if (UNLIKELY(current_cpu->trace_result_p))
1282 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
1283 current_cpu->h_szbit_set (opval);
1286 current_cpu->done_insn (npc, status);
1290 // ********** jmp-compact: jmp @$rn
1293 sh4al_sem_jmp_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1294 sh4al::write_stacks &buf)
1296 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1297 sem_status status = SEM_STATUS_NORMAL;
1298 sh4al_scache* abuf = sem;
1299 unsigned long long written = 0;
1300 PCADDR pc = abuf->addr;
1301 PCADDR npc = pc + 2;
1305 UDI opval = ADDDI (pc, 2);
1306 if (UNLIKELY(current_cpu->trace_result_p))
1307 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1308 current_cpu->branch (opval, npc, status);
1310 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1312 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1313 buf.h_pc_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<UDI>(pc, opval));
1314 if (UNLIKELY(current_cpu->trace_result_p))
1315 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1317 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1320 current_cpu->done_cti_insn (npc, status);
1324 // ********** jsr-compact: jsr @$rn
1327 sh4al_sem_jsr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1328 sh4al::write_stacks &buf)
1330 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1331 sem_status status = SEM_STATUS_NORMAL;
1332 sh4al_scache* abuf = sem;
1333 unsigned long long written = 0;
1334 PCADDR pc = abuf->addr;
1335 PCADDR npc = pc + 2;
1339 SI opval = ADDDI (pc, 4);
1340 buf.h_pr_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<SI>(pc, opval));
1341 if (UNLIKELY(current_cpu->trace_result_p))
1342 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1345 UDI opval = ADDDI (pc, 2);
1346 if (UNLIKELY(current_cpu->trace_result_p))
1347 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1348 current_cpu->branch (opval, npc, status);
1350 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1352 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1353 buf.h_pc_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<UDI>(pc, opval));
1354 if (UNLIKELY(current_cpu->trace_result_p))
1355 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1357 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1360 current_cpu->done_cti_insn (npc, status);
1364 // ********** ldc-gbr-compact: ldc $rn, gbr
1367 sh4al_sem_ldc_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1368 sh4al::write_stacks &buf)
1370 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1371 sem_status status = SEM_STATUS_NORMAL;
1372 sh4al_scache* abuf = sem;
1373 unsigned long long written = 0;
1374 PCADDR pc = abuf->addr;
1375 PCADDR npc = pc + 2;
1378 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1379 if (UNLIKELY(current_cpu->trace_result_p))
1380 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1381 current_cpu->h_gbr_set (opval);
1384 current_cpu->done_insn (npc, status);
1388 // ********** ldc-vbr-compact: ldc $rn, vbr
1391 sh4al_sem_ldc_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1392 sh4al::write_stacks &buf)
1394 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1395 sem_status status = SEM_STATUS_NORMAL;
1396 sh4al_scache* abuf = sem;
1397 unsigned long long written = 0;
1398 PCADDR pc = abuf->addr;
1399 PCADDR npc = pc + 2;
1402 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1403 if (UNLIKELY(current_cpu->trace_result_p))
1404 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1405 current_cpu->h_vbr_set (opval);
1408 current_cpu->done_insn (npc, status);
1412 // ********** ldc-sr-compact: ldc $rn, sr
1415 sh4al_sem_ldc_sr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1416 sh4al::write_stacks &buf)
1418 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1419 sem_status status = SEM_STATUS_NORMAL;
1420 sh4al_scache* abuf = sem;
1421 unsigned long long written = 0;
1422 PCADDR pc = abuf->addr;
1423 PCADDR npc = pc + 2;
1426 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1427 if (UNLIKELY(current_cpu->trace_result_p))
1428 current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << " ";
1429 current_cpu->hardware.h_sr = opval;
1432 current_cpu->done_insn (npc, status);
1436 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
1439 sh4al_sem_ldcl_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1440 sh4al::write_stacks &buf)
1442 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1443 sem_status status = SEM_STATUS_NORMAL;
1444 sh4al_scache* abuf = sem;
1445 unsigned long long written = 0;
1446 PCADDR pc = abuf->addr;
1447 PCADDR npc = pc + 2;
1451 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1452 if (UNLIKELY(current_cpu->trace_result_p))
1453 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1454 current_cpu->h_gbr_set (opval);
1457 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1458 if (UNLIKELY(current_cpu->trace_result_p))
1459 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1460 current_cpu->h_grc_set (FLD (f_rn), opval);
1464 current_cpu->done_insn (npc, status);
1468 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
1471 sh4al_sem_ldcl_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1472 sh4al::write_stacks &buf)
1474 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1475 sem_status status = SEM_STATUS_NORMAL;
1476 sh4al_scache* abuf = sem;
1477 unsigned long long written = 0;
1478 PCADDR pc = abuf->addr;
1479 PCADDR npc = pc + 2;
1483 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1484 if (UNLIKELY(current_cpu->trace_result_p))
1485 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1486 current_cpu->h_vbr_set (opval);
1489 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1490 if (UNLIKELY(current_cpu->trace_result_p))
1491 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1492 current_cpu->h_grc_set (FLD (f_rn), opval);
1496 current_cpu->done_insn (npc, status);
1500 // ********** lds-mach-compact: lds $rn, mach
1503 sh4al_sem_lds_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1504 sh4al::write_stacks &buf)
1506 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1507 sem_status status = SEM_STATUS_NORMAL;
1508 sh4al_scache* abuf = sem;
1509 unsigned long long written = 0;
1510 PCADDR pc = abuf->addr;
1511 PCADDR npc = pc + 2;
1514 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1515 if (UNLIKELY(current_cpu->trace_result_p))
1516 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1517 current_cpu->h_mach_set (opval);
1520 current_cpu->done_insn (npc, status);
1524 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
1527 sh4al_sem_ldsl_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1528 sh4al::write_stacks &buf)
1530 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1531 sem_status status = SEM_STATUS_NORMAL;
1532 sh4al_scache* abuf = sem;
1533 unsigned long long written = 0;
1534 PCADDR pc = abuf->addr;
1535 PCADDR npc = pc + 2;
1539 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1540 if (UNLIKELY(current_cpu->trace_result_p))
1541 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1542 current_cpu->h_mach_set (opval);
1545 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1546 if (UNLIKELY(current_cpu->trace_result_p))
1547 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1548 current_cpu->h_grc_set (FLD (f_rn), opval);
1552 current_cpu->done_insn (npc, status);
1556 // ********** lds-macl-compact: lds $rn, macl
1559 sh4al_sem_lds_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1560 sh4al::write_stacks &buf)
1562 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1563 sem_status status = SEM_STATUS_NORMAL;
1564 sh4al_scache* abuf = sem;
1565 unsigned long long written = 0;
1566 PCADDR pc = abuf->addr;
1567 PCADDR npc = pc + 2;
1570 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1571 if (UNLIKELY(current_cpu->trace_result_p))
1572 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1573 current_cpu->h_macl_set (opval);
1576 current_cpu->done_insn (npc, status);
1580 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
1583 sh4al_sem_ldsl_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1584 sh4al::write_stacks &buf)
1586 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1587 sem_status status = SEM_STATUS_NORMAL;
1588 sh4al_scache* abuf = sem;
1589 unsigned long long written = 0;
1590 PCADDR pc = abuf->addr;
1591 PCADDR npc = pc + 2;
1595 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1596 if (UNLIKELY(current_cpu->trace_result_p))
1597 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1598 current_cpu->h_macl_set (opval);
1601 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1602 if (UNLIKELY(current_cpu->trace_result_p))
1603 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1604 current_cpu->h_grc_set (FLD (f_rn), opval);
1608 current_cpu->done_insn (npc, status);
1612 // ********** lds-pr-compact: lds $rn, pr
1615 sh4al_sem_lds_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1616 sh4al::write_stacks &buf)
1618 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1619 sem_status status = SEM_STATUS_NORMAL;
1620 sh4al_scache* abuf = sem;
1621 unsigned long long written = 0;
1622 PCADDR pc = abuf->addr;
1623 PCADDR npc = pc + 2;
1626 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1627 if (UNLIKELY(current_cpu->trace_result_p))
1628 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1629 current_cpu->h_pr_set (opval);
1632 current_cpu->done_insn (npc, status);
1636 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
1639 sh4al_sem_ldsl_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1640 sh4al::write_stacks &buf)
1642 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1643 sem_status status = SEM_STATUS_NORMAL;
1644 sh4al_scache* abuf = sem;
1645 unsigned long long written = 0;
1646 PCADDR pc = abuf->addr;
1647 PCADDR npc = pc + 2;
1651 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1652 if (UNLIKELY(current_cpu->trace_result_p))
1653 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1654 current_cpu->h_pr_set (opval);
1657 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1658 if (UNLIKELY(current_cpu->trace_result_p))
1659 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1660 current_cpu->h_grc_set (FLD (f_rn), opval);
1664 current_cpu->done_insn (npc, status);
1668 // ********** macl-compact: mac.l @${rm}+, @${rn}+
1671 sh4al_sem_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1672 sh4al::write_stacks &buf)
1674 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1675 sem_status status = SEM_STATUS_NORMAL;
1676 sh4al_scache* abuf = sem;
1677 unsigned long long written = 0;
1678 PCADDR pc = abuf->addr;
1679 PCADDR npc = pc + 2;
1687 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1689 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1690 if (UNLIKELY(current_cpu->trace_result_p))
1691 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1692 current_cpu->h_grc_set (FLD (f_rn), opval);
1694 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1697 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1698 if (UNLIKELY(current_cpu->trace_result_p))
1699 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1700 current_cpu->h_grc_set (FLD (f_rn), opval);
1703 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1704 written |= (1ULL << 11);
1705 if (UNLIKELY(current_cpu->trace_result_p))
1706 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1707 current_cpu->h_grc_set (FLD (f_rm), opval);
1711 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1713 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1714 written |= (1ULL << 11);
1715 if (UNLIKELY(current_cpu->trace_result_p))
1716 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1717 current_cpu->h_grc_set (FLD (f_rm), opval);
1719 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
1720 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1721 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
1723 if (current_cpu->h_sbit_get ()) {
1727 tmp_max = SRLDI (INVDI (0), 16);
1728 tmp_min = SRLDI (INVDI (0), 15);
1729 if (GTDI (tmp_result, tmp_max)) {
1730 tmp_result = tmp_max;
1732 if (LTDI (tmp_result, tmp_min)) {
1733 tmp_result = tmp_min;
1739 SI opval = SUBWORDDISI (tmp_result, 0);
1740 if (UNLIKELY(current_cpu->trace_result_p))
1741 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1742 current_cpu->h_mach_set (opval);
1745 SI opval = SUBWORDDISI (tmp_result, 1);
1746 if (UNLIKELY(current_cpu->trace_result_p))
1747 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1748 current_cpu->h_macl_set (opval);
1753 abuf->written = written;
1754 current_cpu->done_insn (npc, status);
1758 // ********** macw-compact: mac.w @${rm}+, @${rn}+
1761 sh4al_sem_macw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1762 sh4al::write_stacks &buf)
1764 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1765 sem_status status = SEM_STATUS_NORMAL;
1766 sh4al_scache* abuf = sem;
1767 unsigned long long written = 0;
1768 PCADDR pc = abuf->addr;
1769 PCADDR npc = pc + 2;
1777 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1779 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1780 if (UNLIKELY(current_cpu->trace_result_p))
1781 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1782 current_cpu->h_grc_set (FLD (f_rn), opval);
1784 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1787 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1788 if (UNLIKELY(current_cpu->trace_result_p))
1789 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1790 current_cpu->h_grc_set (FLD (f_rn), opval);
1793 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1794 written |= (1ULL << 11);
1795 if (UNLIKELY(current_cpu->trace_result_p))
1796 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1797 current_cpu->h_grc_set (FLD (f_rm), opval);
1801 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1803 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1804 written |= (1ULL << 11);
1805 if (UNLIKELY(current_cpu->trace_result_p))
1806 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1807 current_cpu->h_grc_set (FLD (f_rm), opval);
1809 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
1810 if (current_cpu->h_sbit_get ()) {
1812 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
1815 written |= (1ULL << 9);
1816 if (UNLIKELY(current_cpu->trace_result_p))
1817 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1818 current_cpu->h_mach_set (opval);
1822 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
1823 written |= (1ULL << 10);
1824 if (UNLIKELY(current_cpu->trace_result_p))
1825 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1826 current_cpu->h_macl_set (opval);
1831 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1832 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
1834 SI opval = SUBWORDDISI (tmp_result, 0);
1835 written |= (1ULL << 9);
1836 if (UNLIKELY(current_cpu->trace_result_p))
1837 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1838 current_cpu->h_mach_set (opval);
1841 SI opval = SUBWORDDISI (tmp_result, 1);
1842 written |= (1ULL << 10);
1843 if (UNLIKELY(current_cpu->trace_result_p))
1844 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1845 current_cpu->h_macl_set (opval);
1851 abuf->written = written;
1852 current_cpu->done_insn (npc, status);
1856 // ********** mov-compact: mov $rm64, $rn64
1859 sh4al_sem_mov_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1860 sh4al::write_stacks &buf)
1862 #define FLD(f) abuf->fields.sfmt_and_compact.f
1863 sem_status status = SEM_STATUS_NORMAL;
1864 sh4al_scache* abuf = sem;
1865 unsigned long long written = 0;
1866 PCADDR pc = abuf->addr;
1867 PCADDR npc = pc + 2;
1870 DI opval = current_cpu->h_gr_get (FLD (f_rm));
1871 if (UNLIKELY(current_cpu->trace_result_p))
1872 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1873 current_cpu->h_gr_set (FLD (f_rn), opval);
1876 current_cpu->done_insn (npc, status);
1880 // ********** movi-compact: mov #$imm8, $rn
1883 sh4al_sem_movi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1884 sh4al::write_stacks &buf)
1886 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1887 sem_status status = SEM_STATUS_NORMAL;
1888 sh4al_scache* abuf = sem;
1889 unsigned long long written = 0;
1890 PCADDR pc = abuf->addr;
1891 PCADDR npc = pc + 2;
1894 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
1895 if (UNLIKELY(current_cpu->trace_result_p))
1896 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1897 current_cpu->h_grc_set (FLD (f_rn), opval);
1900 current_cpu->done_insn (npc, status);
1904 // ********** movb1-compact: mov.b $rm, @$rn
1907 sh4al_sem_movb1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1908 sh4al::write_stacks &buf)
1910 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1911 sem_status status = SEM_STATUS_NORMAL;
1912 sh4al_scache* abuf = sem;
1913 unsigned long long written = 0;
1914 PCADDR pc = abuf->addr;
1915 PCADDR npc = pc + 2;
1918 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1919 if (UNLIKELY(current_cpu->trace_result_p))
1920 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1921 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1924 current_cpu->done_insn (npc, status);
1928 // ********** movb2-compact: mov.b $rm, @-$rn
1931 sh4al_sem_movb2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1932 sh4al::write_stacks &buf)
1934 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1935 sem_status status = SEM_STATUS_NORMAL;
1936 sh4al_scache* abuf = sem;
1937 unsigned long long written = 0;
1938 PCADDR pc = abuf->addr;
1939 PCADDR npc = pc + 2;
1943 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1945 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1946 if (UNLIKELY(current_cpu->trace_result_p))
1947 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1948 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
1951 SI opval = tmp_addr;
1952 if (UNLIKELY(current_cpu->trace_result_p))
1953 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1954 current_cpu->h_grc_set (FLD (f_rn), opval);
1958 current_cpu->done_insn (npc, status);
1962 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
1965 sh4al_sem_movb3_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1966 sh4al::write_stacks &buf)
1968 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
1969 sem_status status = SEM_STATUS_NORMAL;
1970 sh4al_scache* abuf = sem;
1971 unsigned long long written = 0;
1972 PCADDR pc = abuf->addr;
1973 PCADDR npc = pc + 2;
1976 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1977 if (UNLIKELY(current_cpu->trace_result_p))
1978 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 << " ";
1979 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1982 current_cpu->done_insn (npc, status);
1986 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
1989 sh4al_sem_movb4_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
1990 sh4al::write_stacks &buf)
1992 #define FLD(f) abuf->fields.sfmt_andi_compact.f
1993 sem_status status = SEM_STATUS_NORMAL;
1994 sh4al_scache* abuf = sem;
1995 unsigned long long written = 0;
1996 PCADDR pc = abuf->addr;
1997 PCADDR npc = pc + 2;
2001 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
2003 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2004 if (UNLIKELY(current_cpu->trace_result_p))
2005 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2006 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2010 current_cpu->done_insn (npc, status);
2014 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
2017 sh4al_sem_movb5_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2018 sh4al::write_stacks &buf)
2020 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2021 sem_status status = SEM_STATUS_NORMAL;
2022 sh4al_scache* abuf = sem;
2023 unsigned long long written = 0;
2024 PCADDR pc = abuf->addr;
2025 PCADDR npc = pc + 2;
2029 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2031 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2032 if (UNLIKELY(current_cpu->trace_result_p))
2033 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2034 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2038 current_cpu->done_insn (npc, status);
2042 // ********** movb6-compact: mov.b @$rm, $rn
2045 sh4al_sem_movb6_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2046 sh4al::write_stacks &buf)
2048 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2049 sem_status status = SEM_STATUS_NORMAL;
2050 sh4al_scache* abuf = sem;
2051 unsigned long long written = 0;
2052 PCADDR pc = abuf->addr;
2053 PCADDR npc = pc + 2;
2056 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2057 if (UNLIKELY(current_cpu->trace_result_p))
2058 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2059 current_cpu->h_grc_set (FLD (f_rn), opval);
2062 current_cpu->done_insn (npc, status);
2066 // ********** movb7-compact: mov.b @${rm}+, $rn
2069 sh4al_sem_movb7_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2070 sh4al::write_stacks &buf)
2072 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2073 sem_status status = SEM_STATUS_NORMAL;
2074 sh4al_scache* abuf = sem;
2075 unsigned long long written = 0;
2076 PCADDR pc = abuf->addr;
2077 PCADDR npc = pc + 2;
2081 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2082 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2084 SI opval = EXTQISI (tmp_data);
2085 written |= (1ULL << 4);
2086 if (UNLIKELY(current_cpu->trace_result_p))
2087 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2088 current_cpu->h_grc_set (FLD (f_rm), opval);
2092 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2093 written |= (1ULL << 4);
2094 if (UNLIKELY(current_cpu->trace_result_p))
2095 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2096 current_cpu->h_grc_set (FLD (f_rm), opval);
2100 SI opval = EXTQISI (tmp_data);
2101 if (UNLIKELY(current_cpu->trace_result_p))
2102 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2103 current_cpu->h_grc_set (FLD (f_rn), opval);
2107 abuf->written = written;
2108 current_cpu->done_insn (npc, status);
2112 // ********** movb8-compact: mov.b @(r0, $rm), $rn
2115 sh4al_sem_movb8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2116 sh4al::write_stacks &buf)
2118 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2119 sem_status status = SEM_STATUS_NORMAL;
2120 sh4al_scache* abuf = sem;
2121 unsigned long long written = 0;
2122 PCADDR pc = abuf->addr;
2123 PCADDR npc = pc + 2;
2126 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2127 if (UNLIKELY(current_cpu->trace_result_p))
2128 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2129 current_cpu->h_grc_set (FLD (f_rn), opval);
2132 current_cpu->done_insn (npc, status);
2136 // ********** movb9-compact: mov.b @($imm8, gbr), r0
2139 sh4al_sem_movb9_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2140 sh4al::write_stacks &buf)
2142 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2143 sem_status status = SEM_STATUS_NORMAL;
2144 sh4al_scache* abuf = sem;
2145 unsigned long long written = 0;
2146 PCADDR pc = abuf->addr;
2147 PCADDR npc = pc + 2;
2150 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
2151 if (UNLIKELY(current_cpu->trace_result_p))
2152 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2153 current_cpu->h_grc_set (((UINT) 0), opval);
2156 current_cpu->done_insn (npc, status);
2160 // ********** movb10-compact: mov.b @($imm4, $rm), r0
2163 sh4al_sem_movb10_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2164 sh4al::write_stacks &buf)
2166 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2167 sem_status status = SEM_STATUS_NORMAL;
2168 sh4al_scache* abuf = sem;
2169 unsigned long long written = 0;
2170 PCADDR pc = abuf->addr;
2171 PCADDR npc = pc + 2;
2174 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
2175 if (UNLIKELY(current_cpu->trace_result_p))
2176 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2177 current_cpu->h_grc_set (((UINT) 0), opval);
2180 current_cpu->done_insn (npc, status);
2184 // ********** movl1-compact: mov.l $rm, @$rn
2187 sh4al_sem_movl1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2188 sh4al::write_stacks &buf)
2190 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2191 sem_status status = SEM_STATUS_NORMAL;
2192 sh4al_scache* abuf = sem;
2193 unsigned long long written = 0;
2194 PCADDR pc = abuf->addr;
2195 PCADDR npc = pc + 2;
2198 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2199 if (UNLIKELY(current_cpu->trace_result_p))
2200 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2201 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2204 current_cpu->done_insn (npc, status);
2208 // ********** movl2-compact: mov.l $rm, @-$rn
2211 sh4al_sem_movl2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2212 sh4al::write_stacks &buf)
2214 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2215 sem_status status = SEM_STATUS_NORMAL;
2216 sh4al_scache* abuf = sem;
2217 unsigned long long written = 0;
2218 PCADDR pc = abuf->addr;
2219 PCADDR npc = pc + 2;
2223 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2225 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2226 if (UNLIKELY(current_cpu->trace_result_p))
2227 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2228 current_cpu->SETMEMSI (pc, tmp_addr, opval);
2231 SI opval = tmp_addr;
2232 if (UNLIKELY(current_cpu->trace_result_p))
2233 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2234 current_cpu->h_grc_set (FLD (f_rn), opval);
2238 current_cpu->done_insn (npc, status);
2242 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
2245 sh4al_sem_movl3_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2246 sh4al::write_stacks &buf)
2248 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2249 sem_status status = SEM_STATUS_NORMAL;
2250 sh4al_scache* abuf = sem;
2251 unsigned long long written = 0;
2252 PCADDR pc = abuf->addr;
2253 PCADDR npc = pc + 2;
2256 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2257 if (UNLIKELY(current_cpu->trace_result_p))
2258 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 << " ";
2259 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2262 current_cpu->done_insn (npc, status);
2266 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
2269 sh4al_sem_movl4_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2270 sh4al::write_stacks &buf)
2272 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
2273 sem_status status = SEM_STATUS_NORMAL;
2274 sh4al_scache* abuf = sem;
2275 unsigned long long written = 0;
2276 PCADDR pc = abuf->addr;
2277 PCADDR npc = pc + 2;
2280 SI opval = current_cpu->h_grc_get (((UINT) 0));
2281 if (UNLIKELY(current_cpu->trace_result_p))
2282 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2283 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
2286 current_cpu->done_insn (npc, status);
2290 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
2293 sh4al_sem_movl5_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2294 sh4al::write_stacks &buf)
2296 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2297 sem_status status = SEM_STATUS_NORMAL;
2298 sh4al_scache* abuf = sem;
2299 unsigned long long written = 0;
2300 PCADDR pc = abuf->addr;
2301 PCADDR npc = pc + 2;
2304 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2305 if (UNLIKELY(current_cpu->trace_result_p))
2306 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 << " ";
2307 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
2310 current_cpu->done_insn (npc, status);
2314 // ********** movl6-compact: mov.l @$rm, $rn
2317 sh4al_sem_movl6_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2318 sh4al::write_stacks &buf)
2320 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2321 sem_status status = SEM_STATUS_NORMAL;
2322 sh4al_scache* abuf = sem;
2323 unsigned long long written = 0;
2324 PCADDR pc = abuf->addr;
2325 PCADDR npc = pc + 2;
2328 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2329 if (UNLIKELY(current_cpu->trace_result_p))
2330 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2331 current_cpu->h_grc_set (FLD (f_rn), opval);
2334 current_cpu->done_insn (npc, status);
2338 // ********** movl7-compact: mov.l @${rm}+, $rn
2341 sh4al_sem_movl7_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2342 sh4al::write_stacks &buf)
2344 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2345 sem_status status = SEM_STATUS_NORMAL;
2346 sh4al_scache* abuf = sem;
2347 unsigned long long written = 0;
2348 PCADDR pc = abuf->addr;
2349 PCADDR npc = pc + 2;
2353 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2354 if (UNLIKELY(current_cpu->trace_result_p))
2355 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2356 current_cpu->h_grc_set (FLD (f_rn), opval);
2358 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2360 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2361 written |= (1ULL << 5);
2362 if (UNLIKELY(current_cpu->trace_result_p))
2363 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2364 current_cpu->h_grc_set (FLD (f_rm), opval);
2368 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2369 written |= (1ULL << 5);
2370 if (UNLIKELY(current_cpu->trace_result_p))
2371 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2372 current_cpu->h_grc_set (FLD (f_rm), opval);
2377 abuf->written = written;
2378 current_cpu->done_insn (npc, status);
2382 // ********** movl8-compact: mov.l @(r0, $rm), $rn
2385 sh4al_sem_movl8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2386 sh4al::write_stacks &buf)
2388 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2389 sem_status status = SEM_STATUS_NORMAL;
2390 sh4al_scache* abuf = sem;
2391 unsigned long long written = 0;
2392 PCADDR pc = abuf->addr;
2393 PCADDR npc = pc + 2;
2396 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
2397 if (UNLIKELY(current_cpu->trace_result_p))
2398 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2399 current_cpu->h_grc_set (FLD (f_rn), opval);
2402 current_cpu->done_insn (npc, status);
2406 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
2409 sh4al_sem_movl9_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2410 sh4al::write_stacks &buf)
2412 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2413 sem_status status = SEM_STATUS_NORMAL;
2414 sh4al_scache* abuf = sem;
2415 unsigned long long written = 0;
2416 PCADDR pc = abuf->addr;
2417 PCADDR npc = pc + 2;
2420 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
2421 if (UNLIKELY(current_cpu->trace_result_p))
2422 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2423 current_cpu->h_grc_set (((UINT) 0), opval);
2426 current_cpu->done_insn (npc, status);
2430 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
2433 sh4al_sem_movl10_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2434 sh4al::write_stacks &buf)
2436 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
2437 sem_status status = SEM_STATUS_NORMAL;
2438 sh4al_scache* abuf = sem;
2439 unsigned long long written = 0;
2440 PCADDR pc = abuf->addr;
2441 PCADDR npc = pc + 2;
2444 SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
2445 if (UNLIKELY(current_cpu->trace_result_p))
2446 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2447 current_cpu->h_grc_set (FLD (f_rn), opval);
2450 current_cpu->done_insn (npc, status);
2454 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
2457 sh4al_sem_movl11_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2458 sh4al::write_stacks &buf)
2460 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2461 sem_status status = SEM_STATUS_NORMAL;
2462 sh4al_scache* abuf = sem;
2463 unsigned long long written = 0;
2464 PCADDR pc = abuf->addr;
2465 PCADDR npc = pc + 2;
2468 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
2469 if (UNLIKELY(current_cpu->trace_result_p))
2470 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2471 current_cpu->h_grc_set (FLD (f_rn), opval);
2474 current_cpu->done_insn (npc, status);
2478 // ********** movw1-compact: mov.w $rm, @$rn
2481 sh4al_sem_movw1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2482 sh4al::write_stacks &buf)
2484 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2485 sem_status status = SEM_STATUS_NORMAL;
2486 sh4al_scache* abuf = sem;
2487 unsigned long long written = 0;
2488 PCADDR pc = abuf->addr;
2489 PCADDR npc = pc + 2;
2492 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2493 if (UNLIKELY(current_cpu->trace_result_p))
2494 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2495 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2498 current_cpu->done_insn (npc, status);
2502 // ********** movw2-compact: mov.w $rm, @-$rn
2505 sh4al_sem_movw2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2506 sh4al::write_stacks &buf)
2508 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2509 sem_status status = SEM_STATUS_NORMAL;
2510 sh4al_scache* abuf = sem;
2511 unsigned long long written = 0;
2512 PCADDR pc = abuf->addr;
2513 PCADDR npc = pc + 2;
2517 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2519 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2520 if (UNLIKELY(current_cpu->trace_result_p))
2521 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2522 current_cpu->SETMEMHI (pc, tmp_addr, opval);
2525 SI opval = tmp_addr;
2526 if (UNLIKELY(current_cpu->trace_result_p))
2527 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2528 current_cpu->h_grc_set (FLD (f_rn), opval);
2532 current_cpu->done_insn (npc, status);
2536 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
2539 sh4al_sem_movw3_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2540 sh4al::write_stacks &buf)
2542 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2543 sem_status status = SEM_STATUS_NORMAL;
2544 sh4al_scache* abuf = sem;
2545 unsigned long long written = 0;
2546 PCADDR pc = abuf->addr;
2547 PCADDR npc = pc + 2;
2550 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2551 if (UNLIKELY(current_cpu->trace_result_p))
2552 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 << " ";
2553 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2556 current_cpu->done_insn (npc, status);
2560 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
2563 sh4al_sem_movw4_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2564 sh4al::write_stacks &buf)
2566 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
2567 sem_status status = SEM_STATUS_NORMAL;
2568 sh4al_scache* abuf = sem;
2569 unsigned long long written = 0;
2570 PCADDR pc = abuf->addr;
2571 PCADDR npc = pc + 2;
2574 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2575 if (UNLIKELY(current_cpu->trace_result_p))
2576 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2577 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
2580 current_cpu->done_insn (npc, status);
2584 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
2587 sh4al_sem_movw5_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2588 sh4al::write_stacks &buf)
2590 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
2591 sem_status status = SEM_STATUS_NORMAL;
2592 sh4al_scache* abuf = sem;
2593 unsigned long long written = 0;
2594 PCADDR pc = abuf->addr;
2595 PCADDR npc = pc + 2;
2598 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2599 if (UNLIKELY(current_cpu->trace_result_p))
2600 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 << " ";
2601 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
2604 current_cpu->done_insn (npc, status);
2608 // ********** movw6-compact: mov.w @$rm, $rn
2611 sh4al_sem_movw6_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2612 sh4al::write_stacks &buf)
2614 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2615 sem_status status = SEM_STATUS_NORMAL;
2616 sh4al_scache* abuf = sem;
2617 unsigned long long written = 0;
2618 PCADDR pc = abuf->addr;
2619 PCADDR npc = pc + 2;
2622 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2623 if (UNLIKELY(current_cpu->trace_result_p))
2624 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2625 current_cpu->h_grc_set (FLD (f_rn), opval);
2628 current_cpu->done_insn (npc, status);
2632 // ********** movw7-compact: mov.w @${rm}+, $rn
2635 sh4al_sem_movw7_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2636 sh4al::write_stacks &buf)
2638 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2639 sem_status status = SEM_STATUS_NORMAL;
2640 sh4al_scache* abuf = sem;
2641 unsigned long long written = 0;
2642 PCADDR pc = abuf->addr;
2643 PCADDR npc = pc + 2;
2647 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2648 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2650 SI opval = EXTHISI (tmp_data);
2651 written |= (1ULL << 4);
2652 if (UNLIKELY(current_cpu->trace_result_p))
2653 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2654 current_cpu->h_grc_set (FLD (f_rm), opval);
2658 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2659 written |= (1ULL << 4);
2660 if (UNLIKELY(current_cpu->trace_result_p))
2661 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2662 current_cpu->h_grc_set (FLD (f_rm), opval);
2666 SI opval = EXTHISI (tmp_data);
2667 if (UNLIKELY(current_cpu->trace_result_p))
2668 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2669 current_cpu->h_grc_set (FLD (f_rn), opval);
2673 abuf->written = written;
2674 current_cpu->done_insn (npc, status);
2678 // ********** movw8-compact: mov.w @(r0, $rm), $rn
2681 sh4al_sem_movw8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2682 sh4al::write_stacks &buf)
2684 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2685 sem_status status = SEM_STATUS_NORMAL;
2686 sh4al_scache* abuf = sem;
2687 unsigned long long written = 0;
2688 PCADDR pc = abuf->addr;
2689 PCADDR npc = pc + 2;
2692 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2693 if (UNLIKELY(current_cpu->trace_result_p))
2694 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2695 current_cpu->h_grc_set (FLD (f_rn), opval);
2698 current_cpu->done_insn (npc, status);
2702 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
2705 sh4al_sem_movw9_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2706 sh4al::write_stacks &buf)
2708 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
2709 sem_status status = SEM_STATUS_NORMAL;
2710 sh4al_scache* abuf = sem;
2711 unsigned long long written = 0;
2712 PCADDR pc = abuf->addr;
2713 PCADDR npc = pc + 2;
2716 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
2717 if (UNLIKELY(current_cpu->trace_result_p))
2718 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2719 current_cpu->h_grc_set (((UINT) 0), opval);
2722 current_cpu->done_insn (npc, status);
2726 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
2729 sh4al_sem_movw10_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2730 sh4al::write_stacks &buf)
2732 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2733 sem_status status = SEM_STATUS_NORMAL;
2734 sh4al_scache* abuf = sem;
2735 unsigned long long written = 0;
2736 PCADDR pc = abuf->addr;
2737 PCADDR npc = pc + 2;
2740 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
2741 if (UNLIKELY(current_cpu->trace_result_p))
2742 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2743 current_cpu->h_grc_set (FLD (f_rn), opval);
2746 current_cpu->done_insn (npc, status);
2750 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
2753 sh4al_sem_movw11_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2754 sh4al::write_stacks &buf)
2756 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
2757 sem_status status = SEM_STATUS_NORMAL;
2758 sh4al_scache* abuf = sem;
2759 unsigned long long written = 0;
2760 PCADDR pc = abuf->addr;
2761 PCADDR npc = pc + 2;
2764 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
2765 if (UNLIKELY(current_cpu->trace_result_p))
2766 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2767 current_cpu->h_grc_set (((UINT) 0), opval);
2770 current_cpu->done_insn (npc, status);
2774 // ********** mova-compact: mova @($imm8x4, pc), r0
2777 sh4al_sem_mova_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2778 sh4al::write_stacks &buf)
2780 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2781 sem_status status = SEM_STATUS_NORMAL;
2782 sh4al_scache* abuf = sem;
2783 unsigned long long written = 0;
2784 PCADDR pc = abuf->addr;
2785 PCADDR npc = pc + 2;
2788 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
2789 if (UNLIKELY(current_cpu->trace_result_p))
2790 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2791 current_cpu->h_grc_set (((UINT) 0), opval);
2794 current_cpu->done_insn (npc, status);
2798 // ********** movcal-compact: movca.l r0, @$rn
2801 sh4al_sem_movcal_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2802 sh4al::write_stacks &buf)
2804 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2805 sem_status status = SEM_STATUS_NORMAL;
2806 sh4al_scache* abuf = sem;
2807 unsigned long long written = 0;
2808 PCADDR pc = abuf->addr;
2809 PCADDR npc = pc + 2;
2812 SI opval = current_cpu->h_grc_get (((UINT) 0));
2813 if (UNLIKELY(current_cpu->trace_result_p))
2814 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2815 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2818 current_cpu->done_insn (npc, status);
2822 // ********** movcol-compact: movco.l r0, @$rn
2825 sh4al_sem_movcol_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2826 sh4al::write_stacks &buf)
2828 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
2829 sem_status status = SEM_STATUS_NORMAL;
2830 sh4al_scache* abuf = sem;
2831 unsigned long long written = 0;
2832 PCADDR pc = abuf->addr;
2833 PCADDR npc = pc + 2;
2836 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2837 if (UNLIKELY(current_cpu->trace_result_p))
2838 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2839 current_cpu->h_grc_set (FLD (f_rn), opval);
2842 current_cpu->done_insn (npc, status);
2846 // ********** movt-compact: movt $rn
2849 sh4al_sem_movt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2850 sh4al::write_stacks &buf)
2852 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2853 sem_status status = SEM_STATUS_NORMAL;
2854 sh4al_scache* abuf = sem;
2855 unsigned long long written = 0;
2856 PCADDR pc = abuf->addr;
2857 PCADDR npc = pc + 2;
2860 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
2861 if (UNLIKELY(current_cpu->trace_result_p))
2862 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2863 current_cpu->h_grc_set (FLD (f_rn), opval);
2866 current_cpu->done_insn (npc, status);
2870 // ********** movual-compact: movua.l @$rn, r0
2873 sh4al_sem_movual_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2874 sh4al::write_stacks &buf)
2876 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
2877 sem_status status = SEM_STATUS_NORMAL;
2878 sh4al_scache* abuf = sem;
2879 unsigned long long written = 0;
2880 PCADDR pc = abuf->addr;
2881 PCADDR npc = pc + 2;
2884 SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
2885 if (UNLIKELY(current_cpu->trace_result_p))
2886 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2887 current_cpu->h_grc_set (((UINT) 0), opval);
2890 current_cpu->done_insn (npc, status);
2894 // ********** movual2-compact: movua.l @$rn+, r0
2897 sh4al_sem_movual2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2898 sh4al::write_stacks &buf)
2900 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
2901 sem_status status = SEM_STATUS_NORMAL;
2902 sh4al_scache* abuf = sem;
2903 unsigned long long written = 0;
2904 PCADDR pc = abuf->addr;
2905 PCADDR npc = pc + 2;
2909 SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
2910 if (UNLIKELY(current_cpu->trace_result_p))
2911 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2912 current_cpu->h_grc_set (((UINT) 0), opval);
2915 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2916 if (UNLIKELY(current_cpu->trace_result_p))
2917 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2918 current_cpu->h_grc_set (FLD (f_rn), opval);
2922 current_cpu->done_insn (npc, status);
2926 // ********** mull-compact: mul.l $rm, $rn
2929 sh4al_sem_mull_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2930 sh4al::write_stacks &buf)
2932 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2933 sem_status status = SEM_STATUS_NORMAL;
2934 sh4al_scache* abuf = sem;
2935 unsigned long long written = 0;
2936 PCADDR pc = abuf->addr;
2937 PCADDR npc = pc + 2;
2940 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
2941 if (UNLIKELY(current_cpu->trace_result_p))
2942 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2943 current_cpu->h_macl_set (opval);
2946 current_cpu->done_insn (npc, status);
2950 // ********** mulsw-compact: muls.w $rm, $rn
2953 sh4al_sem_mulsw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2954 sh4al::write_stacks &buf)
2956 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2957 sem_status status = SEM_STATUS_NORMAL;
2958 sh4al_scache* abuf = sem;
2959 unsigned long long written = 0;
2960 PCADDR pc = abuf->addr;
2961 PCADDR npc = pc + 2;
2964 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)));
2965 if (UNLIKELY(current_cpu->trace_result_p))
2966 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2967 current_cpu->h_macl_set (opval);
2970 current_cpu->done_insn (npc, status);
2974 // ********** muluw-compact: mulu.w $rm, $rn
2977 sh4al_sem_muluw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
2978 sh4al::write_stacks &buf)
2980 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2981 sem_status status = SEM_STATUS_NORMAL;
2982 sh4al_scache* abuf = sem;
2983 unsigned long long written = 0;
2984 PCADDR pc = abuf->addr;
2985 PCADDR npc = pc + 2;
2988 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)));
2989 if (UNLIKELY(current_cpu->trace_result_p))
2990 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2991 current_cpu->h_macl_set (opval);
2994 current_cpu->done_insn (npc, status);
2998 // ********** neg-compact: neg $rm, $rn
3001 sh4al_sem_neg_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3002 sh4al::write_stacks &buf)
3004 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3005 sem_status status = SEM_STATUS_NORMAL;
3006 sh4al_scache* abuf = sem;
3007 unsigned long long written = 0;
3008 PCADDR pc = abuf->addr;
3009 PCADDR npc = pc + 2;
3012 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
3013 if (UNLIKELY(current_cpu->trace_result_p))
3014 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3015 current_cpu->h_grc_set (FLD (f_rn), opval);
3018 current_cpu->done_insn (npc, status);
3022 // ********** negc-compact: negc $rm, $rn
3025 sh4al_sem_negc_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3026 sh4al::write_stacks &buf)
3028 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3029 sem_status status = SEM_STATUS_NORMAL;
3030 sh4al_scache* abuf = sem;
3031 unsigned long long written = 0;
3032 PCADDR pc = abuf->addr;
3033 PCADDR npc = pc + 2;
3037 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3039 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3040 if (UNLIKELY(current_cpu->trace_result_p))
3041 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3042 current_cpu->h_grc_set (FLD (f_rn), opval);
3045 BI opval = tmp_flag;
3046 if (UNLIKELY(current_cpu->trace_result_p))
3047 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3048 current_cpu->h_tbit_set (opval);
3052 current_cpu->done_insn (npc, status);
3056 // ********** nop-compact: nop
3059 sh4al_sem_nop_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3060 sh4al::write_stacks &buf)
3062 #define FLD(f) abuf->fields.fmt_empty.f
3063 sem_status status = SEM_STATUS_NORMAL;
3064 sh4al_scache* abuf = sem;
3065 unsigned long long written = 0;
3066 PCADDR pc = abuf->addr;
3067 PCADDR npc = pc + 2;
3071 current_cpu->done_insn (npc, status);
3075 // ********** not-compact: not $rm64, $rn64
3078 sh4al_sem_not_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3079 sh4al::write_stacks &buf)
3081 #define FLD(f) abuf->fields.sfmt_and_compact.f
3082 sem_status status = SEM_STATUS_NORMAL;
3083 sh4al_scache* abuf = sem;
3084 unsigned long long written = 0;
3085 PCADDR pc = abuf->addr;
3086 PCADDR npc = pc + 2;
3089 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
3090 if (UNLIKELY(current_cpu->trace_result_p))
3091 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3092 current_cpu->h_gr_set (FLD (f_rn), opval);
3095 current_cpu->done_insn (npc, status);
3099 // ********** ocbi-compact: ocbi @$rn
3102 sh4al_sem_ocbi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3103 sh4al::write_stacks &buf)
3105 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3106 sem_status status = SEM_STATUS_NORMAL;
3107 sh4al_scache* abuf = sem;
3108 unsigned long long written = 0;
3109 PCADDR pc = abuf->addr;
3110 PCADDR npc = pc + 2;
3114 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3115 if (UNLIKELY(current_cpu->trace_result_p))
3116 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3117 current_cpu->h_grc_set (FLD (f_rn), opval);
3122 current_cpu->done_insn (npc, status);
3126 // ********** ocbp-compact: ocbp @$rn
3129 sh4al_sem_ocbp_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3130 sh4al::write_stacks &buf)
3132 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3133 sem_status status = SEM_STATUS_NORMAL;
3134 sh4al_scache* abuf = sem;
3135 unsigned long long written = 0;
3136 PCADDR pc = abuf->addr;
3137 PCADDR npc = pc + 2;
3141 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3142 if (UNLIKELY(current_cpu->trace_result_p))
3143 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3144 current_cpu->h_grc_set (FLD (f_rn), opval);
3149 current_cpu->done_insn (npc, status);
3153 // ********** ocbwb-compact: ocbwb @$rn
3156 sh4al_sem_ocbwb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3157 sh4al::write_stacks &buf)
3159 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3160 sem_status status = SEM_STATUS_NORMAL;
3161 sh4al_scache* abuf = sem;
3162 unsigned long long written = 0;
3163 PCADDR pc = abuf->addr;
3164 PCADDR npc = pc + 2;
3168 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3169 if (UNLIKELY(current_cpu->trace_result_p))
3170 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3171 current_cpu->h_grc_set (FLD (f_rn), opval);
3176 current_cpu->done_insn (npc, status);
3180 // ********** or-compact: or $rm64, $rn64
3183 sh4al_sem_or_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3184 sh4al::write_stacks &buf)
3186 #define FLD(f) abuf->fields.sfmt_and_compact.f
3187 sem_status status = SEM_STATUS_NORMAL;
3188 sh4al_scache* abuf = sem;
3189 unsigned long long written = 0;
3190 PCADDR pc = abuf->addr;
3191 PCADDR npc = pc + 2;
3194 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
3195 if (UNLIKELY(current_cpu->trace_result_p))
3196 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3197 current_cpu->h_gr_set (FLD (f_rn), opval);
3200 current_cpu->done_insn (npc, status);
3204 // ********** ori-compact: or #$uimm8, r0
3207 sh4al_sem_ori_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3208 sh4al::write_stacks &buf)
3210 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3211 sem_status status = SEM_STATUS_NORMAL;
3212 sh4al_scache* abuf = sem;
3213 unsigned long long written = 0;
3214 PCADDR pc = abuf->addr;
3215 PCADDR npc = pc + 2;
3218 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3219 if (UNLIKELY(current_cpu->trace_result_p))
3220 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3221 current_cpu->h_grc_set (((UINT) 0), opval);
3224 current_cpu->done_insn (npc, status);
3228 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3231 sh4al_sem_orb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3232 sh4al::write_stacks &buf)
3234 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3235 sem_status status = SEM_STATUS_NORMAL;
3236 sh4al_scache* abuf = sem;
3237 unsigned long long written = 0;
3238 PCADDR pc = abuf->addr;
3239 PCADDR npc = pc + 2;
3244 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3245 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3247 UQI opval = tmp_data;
3248 if (UNLIKELY(current_cpu->trace_result_p))
3249 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3250 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3254 current_cpu->done_insn (npc, status);
3258 // ********** pref-compact: pref @$rn
3261 sh4al_sem_pref_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3262 sh4al::write_stacks &buf)
3264 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3265 sem_status status = SEM_STATUS_NORMAL;
3266 sh4al_scache* abuf = sem;
3267 unsigned long long written = 0;
3268 PCADDR pc = abuf->addr;
3269 PCADDR npc = pc + 2;
3271 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
3273 current_cpu->done_insn (npc, status);
3277 // ********** rotcl-compact: rotcl $rn
3280 sh4al_sem_rotcl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3281 sh4al::write_stacks &buf)
3283 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3284 sem_status status = SEM_STATUS_NORMAL;
3285 sh4al_scache* abuf = sem;
3286 unsigned long long written = 0;
3287 PCADDR pc = abuf->addr;
3288 PCADDR npc = pc + 2;
3292 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3294 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3295 if (UNLIKELY(current_cpu->trace_result_p))
3296 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3297 current_cpu->h_grc_set (FLD (f_rn), opval);
3300 BI opval = ((tmp_temp) ? (1) : (0));
3301 if (UNLIKELY(current_cpu->trace_result_p))
3302 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3303 current_cpu->h_tbit_set (opval);
3307 current_cpu->done_insn (npc, status);
3311 // ********** rotcr-compact: rotcr $rn
3314 sh4al_sem_rotcr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3315 sh4al::write_stacks &buf)
3317 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3318 sem_status status = SEM_STATUS_NORMAL;
3319 sh4al_scache* abuf = sem;
3320 unsigned long long written = 0;
3321 PCADDR pc = abuf->addr;
3322 PCADDR npc = pc + 2;
3327 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3328 tmp_temp = current_cpu->h_tbit_get ();
3330 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3331 if (UNLIKELY(current_cpu->trace_result_p))
3332 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3333 current_cpu->h_grc_set (FLD (f_rn), opval);
3336 BI opval = ((tmp_lsbit) ? (1) : (0));
3337 if (UNLIKELY(current_cpu->trace_result_p))
3338 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3339 current_cpu->h_tbit_set (opval);
3343 current_cpu->done_insn (npc, status);
3347 // ********** rotl-compact: rotl $rn
3350 sh4al_sem_rotl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3351 sh4al::write_stacks &buf)
3353 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3354 sem_status status = SEM_STATUS_NORMAL;
3355 sh4al_scache* abuf = sem;
3356 unsigned long long written = 0;
3357 PCADDR pc = abuf->addr;
3358 PCADDR npc = pc + 2;
3362 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3364 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3365 if (UNLIKELY(current_cpu->trace_result_p))
3366 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3367 current_cpu->h_grc_set (FLD (f_rn), opval);
3370 BI opval = ((tmp_temp) ? (1) : (0));
3371 if (UNLIKELY(current_cpu->trace_result_p))
3372 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3373 current_cpu->h_tbit_set (opval);
3377 current_cpu->done_insn (npc, status);
3381 // ********** rotr-compact: rotr $rn
3384 sh4al_sem_rotr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3385 sh4al::write_stacks &buf)
3387 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3388 sem_status status = SEM_STATUS_NORMAL;
3389 sh4al_scache* abuf = sem;
3390 unsigned long long written = 0;
3391 PCADDR pc = abuf->addr;
3392 PCADDR npc = pc + 2;
3397 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3398 tmp_temp = tmp_lsbit;
3400 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3401 if (UNLIKELY(current_cpu->trace_result_p))
3402 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3403 current_cpu->h_grc_set (FLD (f_rn), opval);
3406 BI opval = ((tmp_lsbit) ? (1) : (0));
3407 if (UNLIKELY(current_cpu->trace_result_p))
3408 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3409 current_cpu->h_tbit_set (opval);
3413 current_cpu->done_insn (npc, status);
3417 // ********** rts-compact: rts
3420 sh4al_sem_rts_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3421 sh4al::write_stacks &buf)
3423 #define FLD(f) abuf->fields.fmt_empty.f
3424 sem_status status = SEM_STATUS_NORMAL;
3425 sh4al_scache* abuf = sem;
3426 unsigned long long written = 0;
3427 PCADDR pc = abuf->addr;
3428 PCADDR npc = pc + 2;
3432 UDI opval = ADDDI (pc, 2);
3433 if (UNLIKELY(current_cpu->trace_result_p))
3434 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3435 current_cpu->branch (opval, npc, status);
3437 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
3439 UDI opval = current_cpu->h_pr_get ();
3440 buf.h_pc_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<UDI>(pc, opval));
3441 if (UNLIKELY(current_cpu->trace_result_p))
3442 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3444 current_cpu->notify_ret (current_cpu->h_pr_get ());
3447 current_cpu->done_cti_insn (npc, status);
3451 // ********** sets-compact: sets
3454 sh4al_sem_sets_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3455 sh4al::write_stacks &buf)
3457 #define FLD(f) abuf->fields.fmt_empty.f
3458 sem_status status = SEM_STATUS_NORMAL;
3459 sh4al_scache* abuf = sem;
3460 unsigned long long written = 0;
3461 PCADDR pc = abuf->addr;
3462 PCADDR npc = pc + 2;
3466 if (UNLIKELY(current_cpu->trace_result_p))
3467 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
3468 current_cpu->h_sbit_set (opval);
3471 current_cpu->done_insn (npc, status);
3475 // ********** sett-compact: sett
3478 sh4al_sem_sett_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3479 sh4al::write_stacks &buf)
3481 #define FLD(f) abuf->fields.fmt_empty.f
3482 sem_status status = SEM_STATUS_NORMAL;
3483 sh4al_scache* abuf = sem;
3484 unsigned long long written = 0;
3485 PCADDR pc = abuf->addr;
3486 PCADDR npc = pc + 2;
3490 if (UNLIKELY(current_cpu->trace_result_p))
3491 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3492 current_cpu->h_tbit_set (opval);
3495 current_cpu->done_insn (npc, status);
3499 // ********** shad-compact: shad $rm, $rn
3502 sh4al_sem_shad_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3503 sh4al::write_stacks &buf)
3505 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3506 sem_status status = SEM_STATUS_NORMAL;
3507 sh4al_scache* abuf = sem;
3508 unsigned long long written = 0;
3509 PCADDR pc = abuf->addr;
3510 PCADDR npc = pc + 2;
3514 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3515 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3517 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3518 written |= (1ULL << 2);
3519 if (UNLIKELY(current_cpu->trace_result_p))
3520 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3521 current_cpu->h_grc_set (FLD (f_rn), opval);
3524 if (NESI (tmp_shamt, 0)) {
3526 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3527 written |= (1ULL << 2);
3528 if (UNLIKELY(current_cpu->trace_result_p))
3529 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3530 current_cpu->h_grc_set (FLD (f_rn), opval);
3533 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
3535 SI opval = NEGSI (1);
3536 written |= (1ULL << 2);
3537 if (UNLIKELY(current_cpu->trace_result_p))
3538 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3539 current_cpu->h_grc_set (FLD (f_rn), opval);
3544 written |= (1ULL << 2);
3545 if (UNLIKELY(current_cpu->trace_result_p))
3546 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3547 current_cpu->h_grc_set (FLD (f_rn), opval);
3554 abuf->written = written;
3555 current_cpu->done_insn (npc, status);
3559 // ********** shal-compact: shal $rn
3562 sh4al_sem_shal_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3563 sh4al::write_stacks &buf)
3565 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3566 sem_status status = SEM_STATUS_NORMAL;
3567 sh4al_scache* abuf = sem;
3568 unsigned long long written = 0;
3569 PCADDR pc = abuf->addr;
3570 PCADDR npc = pc + 2;
3574 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3576 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3577 if (UNLIKELY(current_cpu->trace_result_p))
3578 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3579 current_cpu->h_grc_set (FLD (f_rn), opval);
3582 BI opval = ((tmp_t) ? (1) : (0));
3583 if (UNLIKELY(current_cpu->trace_result_p))
3584 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3585 current_cpu->h_tbit_set (opval);
3589 current_cpu->done_insn (npc, status);
3593 // ********** shar-compact: shar $rn
3596 sh4al_sem_shar_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3597 sh4al::write_stacks &buf)
3599 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3600 sem_status status = SEM_STATUS_NORMAL;
3601 sh4al_scache* abuf = sem;
3602 unsigned long long written = 0;
3603 PCADDR pc = abuf->addr;
3604 PCADDR npc = pc + 2;
3608 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3610 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3611 if (UNLIKELY(current_cpu->trace_result_p))
3612 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3613 current_cpu->h_grc_set (FLD (f_rn), opval);
3616 BI opval = ((tmp_t) ? (1) : (0));
3617 if (UNLIKELY(current_cpu->trace_result_p))
3618 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3619 current_cpu->h_tbit_set (opval);
3623 current_cpu->done_insn (npc, status);
3627 // ********** shld-compact: shld $rm, $rn
3630 sh4al_sem_shld_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3631 sh4al::write_stacks &buf)
3633 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3634 sem_status status = SEM_STATUS_NORMAL;
3635 sh4al_scache* abuf = sem;
3636 unsigned long long written = 0;
3637 PCADDR pc = abuf->addr;
3638 PCADDR npc = pc + 2;
3642 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3643 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3645 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3646 written |= (1ULL << 2);
3647 if (UNLIKELY(current_cpu->trace_result_p))
3648 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3649 current_cpu->h_grc_set (FLD (f_rn), opval);
3652 if (NESI (tmp_shamt, 0)) {
3654 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3655 written |= (1ULL << 2);
3656 if (UNLIKELY(current_cpu->trace_result_p))
3657 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3658 current_cpu->h_grc_set (FLD (f_rn), opval);
3663 written |= (1ULL << 2);
3664 if (UNLIKELY(current_cpu->trace_result_p))
3665 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3666 current_cpu->h_grc_set (FLD (f_rn), opval);
3672 abuf->written = written;
3673 current_cpu->done_insn (npc, status);
3677 // ********** shll-compact: shll $rn
3680 sh4al_sem_shll_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3681 sh4al::write_stacks &buf)
3683 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3684 sem_status status = SEM_STATUS_NORMAL;
3685 sh4al_scache* abuf = sem;
3686 unsigned long long written = 0;
3687 PCADDR pc = abuf->addr;
3688 PCADDR npc = pc + 2;
3692 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3694 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3695 if (UNLIKELY(current_cpu->trace_result_p))
3696 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3697 current_cpu->h_grc_set (FLD (f_rn), opval);
3700 BI opval = ((tmp_t) ? (1) : (0));
3701 if (UNLIKELY(current_cpu->trace_result_p))
3702 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3703 current_cpu->h_tbit_set (opval);
3707 current_cpu->done_insn (npc, status);
3711 // ********** shll2-compact: shll2 $rn
3714 sh4al_sem_shll2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3715 sh4al::write_stacks &buf)
3717 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3718 sem_status status = SEM_STATUS_NORMAL;
3719 sh4al_scache* abuf = sem;
3720 unsigned long long written = 0;
3721 PCADDR pc = abuf->addr;
3722 PCADDR npc = pc + 2;
3725 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3726 if (UNLIKELY(current_cpu->trace_result_p))
3727 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3728 current_cpu->h_grc_set (FLD (f_rn), opval);
3731 current_cpu->done_insn (npc, status);
3735 // ********** shll8-compact: shll8 $rn
3738 sh4al_sem_shll8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3739 sh4al::write_stacks &buf)
3741 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3742 sem_status status = SEM_STATUS_NORMAL;
3743 sh4al_scache* abuf = sem;
3744 unsigned long long written = 0;
3745 PCADDR pc = abuf->addr;
3746 PCADDR npc = pc + 2;
3749 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3750 if (UNLIKELY(current_cpu->trace_result_p))
3751 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3752 current_cpu->h_grc_set (FLD (f_rn), opval);
3755 current_cpu->done_insn (npc, status);
3759 // ********** shll16-compact: shll16 $rn
3762 sh4al_sem_shll16_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3763 sh4al::write_stacks &buf)
3765 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3766 sem_status status = SEM_STATUS_NORMAL;
3767 sh4al_scache* abuf = sem;
3768 unsigned long long written = 0;
3769 PCADDR pc = abuf->addr;
3770 PCADDR npc = pc + 2;
3773 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3774 if (UNLIKELY(current_cpu->trace_result_p))
3775 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3776 current_cpu->h_grc_set (FLD (f_rn), opval);
3779 current_cpu->done_insn (npc, status);
3783 // ********** shlr-compact: shlr $rn
3786 sh4al_sem_shlr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3787 sh4al::write_stacks &buf)
3789 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3790 sem_status status = SEM_STATUS_NORMAL;
3791 sh4al_scache* abuf = sem;
3792 unsigned long long written = 0;
3793 PCADDR pc = abuf->addr;
3794 PCADDR npc = pc + 2;
3798 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3800 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3801 if (UNLIKELY(current_cpu->trace_result_p))
3802 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3803 current_cpu->h_grc_set (FLD (f_rn), opval);
3806 BI opval = ((tmp_t) ? (1) : (0));
3807 if (UNLIKELY(current_cpu->trace_result_p))
3808 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3809 current_cpu->h_tbit_set (opval);
3813 current_cpu->done_insn (npc, status);
3817 // ********** shlr2-compact: shlr2 $rn
3820 sh4al_sem_shlr2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3821 sh4al::write_stacks &buf)
3823 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3824 sem_status status = SEM_STATUS_NORMAL;
3825 sh4al_scache* abuf = sem;
3826 unsigned long long written = 0;
3827 PCADDR pc = abuf->addr;
3828 PCADDR npc = pc + 2;
3831 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3832 if (UNLIKELY(current_cpu->trace_result_p))
3833 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3834 current_cpu->h_grc_set (FLD (f_rn), opval);
3837 current_cpu->done_insn (npc, status);
3841 // ********** shlr8-compact: shlr8 $rn
3844 sh4al_sem_shlr8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3845 sh4al::write_stacks &buf)
3847 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3848 sem_status status = SEM_STATUS_NORMAL;
3849 sh4al_scache* abuf = sem;
3850 unsigned long long written = 0;
3851 PCADDR pc = abuf->addr;
3852 PCADDR npc = pc + 2;
3855 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3856 if (UNLIKELY(current_cpu->trace_result_p))
3857 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3858 current_cpu->h_grc_set (FLD (f_rn), opval);
3861 current_cpu->done_insn (npc, status);
3865 // ********** shlr16-compact: shlr16 $rn
3868 sh4al_sem_shlr16_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3869 sh4al::write_stacks &buf)
3871 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3872 sem_status status = SEM_STATUS_NORMAL;
3873 sh4al_scache* abuf = sem;
3874 unsigned long long written = 0;
3875 PCADDR pc = abuf->addr;
3876 PCADDR npc = pc + 2;
3879 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3880 if (UNLIKELY(current_cpu->trace_result_p))
3881 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3882 current_cpu->h_grc_set (FLD (f_rn), opval);
3885 current_cpu->done_insn (npc, status);
3889 // ********** stc-gbr-compact: stc gbr, $rn
3892 sh4al_sem_stc_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3893 sh4al::write_stacks &buf)
3895 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3896 sem_status status = SEM_STATUS_NORMAL;
3897 sh4al_scache* abuf = sem;
3898 unsigned long long written = 0;
3899 PCADDR pc = abuf->addr;
3900 PCADDR npc = pc + 2;
3903 SI opval = current_cpu->h_gbr_get ();
3904 if (UNLIKELY(current_cpu->trace_result_p))
3905 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3906 current_cpu->h_grc_set (FLD (f_rn), opval);
3909 current_cpu->done_insn (npc, status);
3913 // ********** stc-vbr-compact: stc vbr, $rn
3916 sh4al_sem_stc_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3917 sh4al::write_stacks &buf)
3919 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3920 sem_status status = SEM_STATUS_NORMAL;
3921 sh4al_scache* abuf = sem;
3922 unsigned long long written = 0;
3923 PCADDR pc = abuf->addr;
3924 PCADDR npc = pc + 2;
3927 SI opval = current_cpu->h_vbr_get ();
3928 if (UNLIKELY(current_cpu->trace_result_p))
3929 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3930 current_cpu->h_grc_set (FLD (f_rn), opval);
3933 current_cpu->done_insn (npc, status);
3937 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
3940 sh4al_sem_stcl_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3941 sh4al::write_stacks &buf)
3943 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3944 sem_status status = SEM_STATUS_NORMAL;
3945 sh4al_scache* abuf = sem;
3946 unsigned long long written = 0;
3947 PCADDR pc = abuf->addr;
3948 PCADDR npc = pc + 2;
3952 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3954 SI opval = current_cpu->h_gbr_get ();
3955 if (UNLIKELY(current_cpu->trace_result_p))
3956 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3957 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3960 SI opval = tmp_addr;
3961 if (UNLIKELY(current_cpu->trace_result_p))
3962 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3963 current_cpu->h_grc_set (FLD (f_rn), opval);
3967 current_cpu->done_insn (npc, status);
3971 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
3974 sh4al_sem_stcl_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
3975 sh4al::write_stacks &buf)
3977 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3978 sem_status status = SEM_STATUS_NORMAL;
3979 sh4al_scache* abuf = sem;
3980 unsigned long long written = 0;
3981 PCADDR pc = abuf->addr;
3982 PCADDR npc = pc + 2;
3986 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3988 SI opval = current_cpu->h_vbr_get ();
3989 if (UNLIKELY(current_cpu->trace_result_p))
3990 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3991 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3994 SI opval = tmp_addr;
3995 if (UNLIKELY(current_cpu->trace_result_p))
3996 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3997 current_cpu->h_grc_set (FLD (f_rn), opval);
4001 current_cpu->done_insn (npc, status);
4005 // ********** sts-mach-compact: sts mach, $rn
4008 sh4al_sem_sts_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4009 sh4al::write_stacks &buf)
4011 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4012 sem_status status = SEM_STATUS_NORMAL;
4013 sh4al_scache* abuf = sem;
4014 unsigned long long written = 0;
4015 PCADDR pc = abuf->addr;
4016 PCADDR npc = pc + 2;
4019 SI opval = current_cpu->h_mach_get ();
4020 if (UNLIKELY(current_cpu->trace_result_p))
4021 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4022 current_cpu->h_grc_set (FLD (f_rn), opval);
4025 current_cpu->done_insn (npc, status);
4029 // ********** stsl-mach-compact: sts.l mach, @-$rn
4032 sh4al_sem_stsl_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4033 sh4al::write_stacks &buf)
4035 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4036 sem_status status = SEM_STATUS_NORMAL;
4037 sh4al_scache* abuf = sem;
4038 unsigned long long written = 0;
4039 PCADDR pc = abuf->addr;
4040 PCADDR npc = pc + 2;
4044 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4046 SI opval = current_cpu->h_mach_get ();
4047 if (UNLIKELY(current_cpu->trace_result_p))
4048 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4049 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4052 SI opval = tmp_addr;
4053 if (UNLIKELY(current_cpu->trace_result_p))
4054 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4055 current_cpu->h_grc_set (FLD (f_rn), opval);
4059 current_cpu->done_insn (npc, status);
4063 // ********** sts-macl-compact: sts macl, $rn
4066 sh4al_sem_sts_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4067 sh4al::write_stacks &buf)
4069 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4070 sem_status status = SEM_STATUS_NORMAL;
4071 sh4al_scache* abuf = sem;
4072 unsigned long long written = 0;
4073 PCADDR pc = abuf->addr;
4074 PCADDR npc = pc + 2;
4077 SI opval = current_cpu->h_macl_get ();
4078 if (UNLIKELY(current_cpu->trace_result_p))
4079 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4080 current_cpu->h_grc_set (FLD (f_rn), opval);
4083 current_cpu->done_insn (npc, status);
4087 // ********** stsl-macl-compact: sts.l macl, @-$rn
4090 sh4al_sem_stsl_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4091 sh4al::write_stacks &buf)
4093 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4094 sem_status status = SEM_STATUS_NORMAL;
4095 sh4al_scache* abuf = sem;
4096 unsigned long long written = 0;
4097 PCADDR pc = abuf->addr;
4098 PCADDR npc = pc + 2;
4102 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4104 SI opval = current_cpu->h_macl_get ();
4105 if (UNLIKELY(current_cpu->trace_result_p))
4106 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4107 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4110 SI opval = tmp_addr;
4111 if (UNLIKELY(current_cpu->trace_result_p))
4112 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4113 current_cpu->h_grc_set (FLD (f_rn), opval);
4117 current_cpu->done_insn (npc, status);
4121 // ********** sts-pr-compact: sts pr, $rn
4124 sh4al_sem_sts_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4125 sh4al::write_stacks &buf)
4127 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4128 sem_status status = SEM_STATUS_NORMAL;
4129 sh4al_scache* abuf = sem;
4130 unsigned long long written = 0;
4131 PCADDR pc = abuf->addr;
4132 PCADDR npc = pc + 2;
4135 SI opval = current_cpu->h_pr_get ();
4136 if (UNLIKELY(current_cpu->trace_result_p))
4137 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4138 current_cpu->h_grc_set (FLD (f_rn), opval);
4141 current_cpu->done_insn (npc, status);
4145 // ********** stsl-pr-compact: sts.l pr, @-$rn
4148 sh4al_sem_stsl_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4149 sh4al::write_stacks &buf)
4151 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4152 sem_status status = SEM_STATUS_NORMAL;
4153 sh4al_scache* abuf = sem;
4154 unsigned long long written = 0;
4155 PCADDR pc = abuf->addr;
4156 PCADDR npc = pc + 2;
4160 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4162 SI opval = current_cpu->h_pr_get ();
4163 if (UNLIKELY(current_cpu->trace_result_p))
4164 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4165 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4168 SI opval = tmp_addr;
4169 if (UNLIKELY(current_cpu->trace_result_p))
4170 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4171 current_cpu->h_grc_set (FLD (f_rn), opval);
4175 current_cpu->done_insn (npc, status);
4179 // ********** sub-compact: sub $rm, $rn
4182 sh4al_sem_sub_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4183 sh4al::write_stacks &buf)
4185 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4186 sem_status status = SEM_STATUS_NORMAL;
4187 sh4al_scache* abuf = sem;
4188 unsigned long long written = 0;
4189 PCADDR pc = abuf->addr;
4190 PCADDR npc = pc + 2;
4193 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4194 if (UNLIKELY(current_cpu->trace_result_p))
4195 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4196 current_cpu->h_grc_set (FLD (f_rn), opval);
4199 current_cpu->done_insn (npc, status);
4203 // ********** subc-compact: subc $rm, $rn
4206 sh4al_sem_subc_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4207 sh4al::write_stacks &buf)
4209 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4210 sem_status status = SEM_STATUS_NORMAL;
4211 sh4al_scache* abuf = sem;
4212 unsigned long long written = 0;
4213 PCADDR pc = abuf->addr;
4214 PCADDR npc = pc + 2;
4218 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4220 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4221 if (UNLIKELY(current_cpu->trace_result_p))
4222 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4223 current_cpu->h_grc_set (FLD (f_rn), opval);
4226 BI opval = tmp_flag;
4227 if (UNLIKELY(current_cpu->trace_result_p))
4228 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4229 current_cpu->h_tbit_set (opval);
4233 current_cpu->done_insn (npc, status);
4237 // ********** subv-compact: subv $rm, $rn
4240 sh4al_sem_subv_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4241 sh4al::write_stacks &buf)
4243 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4244 sem_status status = SEM_STATUS_NORMAL;
4245 sh4al_scache* abuf = sem;
4246 unsigned long long written = 0;
4247 PCADDR pc = abuf->addr;
4248 PCADDR npc = pc + 2;
4252 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
4254 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4255 if (UNLIKELY(current_cpu->trace_result_p))
4256 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4257 current_cpu->h_grc_set (FLD (f_rn), opval);
4260 BI opval = ((tmp_t) ? (1) : (0));
4261 if (UNLIKELY(current_cpu->trace_result_p))
4262 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4263 current_cpu->h_tbit_set (opval);
4267 current_cpu->done_insn (npc, status);
4271 // ********** swapb-compact: swap.b $rm, $rn
4274 sh4al_sem_swapb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4275 sh4al::write_stacks &buf)
4277 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4278 sem_status status = SEM_STATUS_NORMAL;
4279 sh4al_scache* abuf = sem;
4280 unsigned long long written = 0;
4281 PCADDR pc = abuf->addr;
4282 PCADDR npc = pc + 2;
4288 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
4289 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
4290 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
4292 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
4293 if (UNLIKELY(current_cpu->trace_result_p))
4294 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4295 current_cpu->h_grc_set (FLD (f_rn), opval);
4299 current_cpu->done_insn (npc, status);
4303 // ********** swapw-compact: swap.w $rm, $rn
4306 sh4al_sem_swapw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4307 sh4al::write_stacks &buf)
4309 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4310 sem_status status = SEM_STATUS_NORMAL;
4311 sh4al_scache* abuf = sem;
4312 unsigned long long written = 0;
4313 PCADDR pc = abuf->addr;
4314 PCADDR npc = pc + 2;
4317 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
4318 if (UNLIKELY(current_cpu->trace_result_p))
4319 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4320 current_cpu->h_grc_set (FLD (f_rn), opval);
4323 current_cpu->done_insn (npc, status);
4327 // ********** tasb-compact: tas.b @$rn
4330 sh4al_sem_tasb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4331 sh4al::write_stacks &buf)
4333 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4334 sem_status status = SEM_STATUS_NORMAL;
4335 sh4al_scache* abuf = sem;
4336 unsigned long long written = 0;
4337 PCADDR pc = abuf->addr;
4338 PCADDR npc = pc + 2;
4342 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
4344 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
4345 if (UNLIKELY(current_cpu->trace_result_p))
4346 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4347 current_cpu->h_tbit_set (opval);
4349 tmp_byte = ORQI (tmp_byte, 128);
4351 UQI opval = tmp_byte;
4352 if (UNLIKELY(current_cpu->trace_result_p))
4353 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4354 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
4358 current_cpu->done_insn (npc, status);
4362 // ********** trapa-compact: trapa #$uimm8
4365 sh4al_sem_trapa_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4366 sh4al::write_stacks &buf)
4368 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4369 sem_status status = SEM_STATUS_NORMAL;
4370 sh4al_scache* abuf = sem;
4371 unsigned long long written = 0;
4372 PCADDR pc = abuf->addr;
4373 PCADDR npc = pc + 2;
4375 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4377 current_cpu->done_insn (npc, status);
4381 // ********** tst-compact: tst $rm, $rn
4384 sh4al_sem_tst_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4385 sh4al::write_stacks &buf)
4387 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
4388 sem_status status = SEM_STATUS_NORMAL;
4389 sh4al_scache* abuf = sem;
4390 unsigned long long written = 0;
4391 PCADDR pc = abuf->addr;
4392 PCADDR npc = pc + 2;
4395 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
4396 if (UNLIKELY(current_cpu->trace_result_p))
4397 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4398 current_cpu->h_tbit_set (opval);
4401 current_cpu->done_insn (npc, status);
4405 // ********** tsti-compact: tst #$uimm8, r0
4408 sh4al_sem_tsti_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4409 sh4al::write_stacks &buf)
4411 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4412 sem_status status = SEM_STATUS_NORMAL;
4413 sh4al_scache* abuf = sem;
4414 unsigned long long written = 0;
4415 PCADDR pc = abuf->addr;
4416 PCADDR npc = pc + 2;
4419 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
4420 if (UNLIKELY(current_cpu->trace_result_p))
4421 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4422 current_cpu->h_tbit_set (opval);
4425 current_cpu->done_insn (npc, status);
4429 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
4432 sh4al_sem_tstb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4433 sh4al::write_stacks &buf)
4435 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4436 sem_status status = SEM_STATUS_NORMAL;
4437 sh4al_scache* abuf = sem;
4438 unsigned long long written = 0;
4439 PCADDR pc = abuf->addr;
4440 PCADDR npc = pc + 2;
4444 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4446 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
4447 if (UNLIKELY(current_cpu->trace_result_p))
4448 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4449 current_cpu->h_tbit_set (opval);
4453 current_cpu->done_insn (npc, status);
4457 // ********** xor-compact: xor $rm64, $rn64
4460 sh4al_sem_xor_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4461 sh4al::write_stacks &buf)
4463 #define FLD(f) abuf->fields.sfmt_and_compact.f
4464 sem_status status = SEM_STATUS_NORMAL;
4465 sh4al_scache* abuf = sem;
4466 unsigned long long written = 0;
4467 PCADDR pc = abuf->addr;
4468 PCADDR npc = pc + 2;
4471 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
4472 if (UNLIKELY(current_cpu->trace_result_p))
4473 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4474 current_cpu->h_gr_set (FLD (f_rn), opval);
4477 current_cpu->done_insn (npc, status);
4481 // ********** xori-compact: xor #$uimm8, r0
4484 sh4al_sem_xori_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4485 sh4al::write_stacks &buf)
4487 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4488 sem_status status = SEM_STATUS_NORMAL;
4489 sh4al_scache* abuf = sem;
4490 unsigned long long written = 0;
4491 PCADDR pc = abuf->addr;
4492 PCADDR npc = pc + 2;
4495 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4496 if (UNLIKELY(current_cpu->trace_result_p))
4497 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4498 current_cpu->h_grc_set (((UINT) 0), opval);
4501 current_cpu->done_insn (npc, status);
4505 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
4508 sh4al_sem_xorb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4509 sh4al::write_stacks &buf)
4511 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4512 sem_status status = SEM_STATUS_NORMAL;
4513 sh4al_scache* abuf = sem;
4514 unsigned long long written = 0;
4515 PCADDR pc = abuf->addr;
4516 PCADDR npc = pc + 2;
4521 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4522 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4524 UQI opval = tmp_data;
4525 if (UNLIKELY(current_cpu->trace_result_p))
4526 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4527 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4531 current_cpu->done_insn (npc, status);
4535 // ********** xtrct-compact: xtrct $rm, $rn
4538 sh4al_sem_xtrct_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick,
4539 sh4al::write_stacks &buf)
4541 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4542 sem_status status = SEM_STATUS_NORMAL;
4543 sh4al_scache* abuf = sem;
4544 unsigned long long written = 0;
4545 PCADDR pc = abuf->addr;
4546 PCADDR npc = pc + 2;
4549 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
4550 if (UNLIKELY(current_cpu->trace_result_p))
4551 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4552 current_cpu->h_grc_set (FLD (f_rn), opval);
4555 current_cpu->done_insn (npc, status);