1 /* Simulator instruction semantics for sh2.
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 sh2; // FIXME: namespace organization still wip
19 using namespace sh2; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh2_sem_x_invalid (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
27 sh2::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh2_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 sh2_sem_add_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
50 sh2::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh2_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 sh2_sem_addi_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
74 sh2::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh2_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 sh2_sem_addc_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
98 sh2::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh2_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 sh2_sem_addv_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
132 sh2::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh2_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 sh2_sem_and_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
166 sh2::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh2_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 sh2_sem_andi_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
190 sh2::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh2_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 sh2_sem_andb_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
214 sh2::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh2_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 sh2_sem_bf_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
244 sh2::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh2_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 sh2_sem_bfs_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
272 sh2::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh2_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) % sh2::pipe_sz].push (sh2::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 sh2_sem_bra_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
309 sh2::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh2_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) % sh2::pipe_sz].push (sh2::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 sh2_sem_braf_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
342 sh2::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_addi_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh2_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) % sh2::pipe_sz].push (sh2::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 sh2_sem_bsr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
375 sh2::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh2_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) % sh2::pipe_sz].push (sh2::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) % sh2::pipe_sz].push (sh2::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 sh2_sem_bsrf_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
414 sh2::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_addi_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh2_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) % sh2::pipe_sz].push (sh2::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) % sh2::pipe_sz].push (sh2::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 sh2_sem_bt_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
453 sh2::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh2_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 sh2_sem_bts_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
481 sh2::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh2_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) % sh2::pipe_sz].push (sh2::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 sh2_sem_clrmac_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
518 sh2::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh2_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 // ********** clrt-compact: clrt
549 sh2_sem_clrt_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
550 sh2::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh2_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 << "tbit" << ":=0x" << hex << opval << dec << " ";
563 current_cpu->h_tbit_set (opval);
566 current_cpu->done_insn (npc, status);
570 // ********** cmpeq-compact: cmp/eq $rm, $rn
573 sh2_sem_cmpeq_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
574 sh2::write_stacks &buf)
576 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh2_scache* abuf = sem;
579 unsigned long long written = 0;
580 PCADDR pc = abuf->addr;
584 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
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 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
597 sh2_sem_cmpeqi_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
598 sh2::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_andi_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh2_scache* abuf = sem;
603 unsigned long long written = 0;
604 PCADDR pc = abuf->addr;
608 BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
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 // ********** cmpge-compact: cmp/ge $rm, $rn
621 sh2_sem_cmpge_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
622 sh2::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh2_scache* abuf = sem;
627 unsigned long long written = 0;
628 PCADDR pc = abuf->addr;
632 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
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 // ********** cmpgt-compact: cmp/gt $rm, $rn
645 sh2_sem_cmpgt_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
646 sh2::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh2_scache* abuf = sem;
651 unsigned long long written = 0;
652 PCADDR pc = abuf->addr;
656 BI opval = GTSI (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 // ********** cmphi-compact: cmp/hi $rm, $rn
669 sh2_sem_cmphi_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
670 sh2::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh2_scache* abuf = sem;
675 unsigned long long written = 0;
676 PCADDR pc = abuf->addr;
680 BI opval = GTUSI (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 // ********** cmphs-compact: cmp/hs $rm, $rn
693 sh2_sem_cmphs_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
694 sh2::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh2_scache* abuf = sem;
699 unsigned long long written = 0;
700 PCADDR pc = abuf->addr;
704 BI opval = GEUSI (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 // ********** cmppl-compact: cmp/pl $rn
717 sh2_sem_cmppl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
718 sh2::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_addi_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh2_scache* abuf = sem;
723 unsigned long long written = 0;
724 PCADDR pc = abuf->addr;
728 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
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 // ********** cmppz-compact: cmp/pz $rn
741 sh2_sem_cmppz_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
742 sh2::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_addi_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh2_scache* abuf = sem;
747 unsigned long long written = 0;
748 PCADDR pc = abuf->addr;
752 BI opval = GESI (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 // ********** cmpstr-compact: cmp/str $rm, $rn
765 sh2_sem_cmpstr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
766 sh2::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh2_scache* abuf = sem;
771 unsigned long long written = 0;
772 PCADDR pc = abuf->addr;
778 tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
779 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
780 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
781 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
782 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
784 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
785 if (UNLIKELY(current_cpu->trace_result_p))
786 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
787 current_cpu->h_tbit_set (opval);
791 current_cpu->done_insn (npc, status);
795 // ********** div0s-compact: div0s $rm, $rn
798 sh2_sem_div0s_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
799 sh2::write_stacks &buf)
801 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
802 sem_status status = SEM_STATUS_NORMAL;
803 sh2_scache* abuf = sem;
804 unsigned long long written = 0;
805 PCADDR pc = abuf->addr;
810 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
811 if (UNLIKELY(current_cpu->trace_result_p))
812 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
813 current_cpu->h_qbit_set (opval);
816 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
817 if (UNLIKELY(current_cpu->trace_result_p))
818 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
819 current_cpu->h_mbit_set (opval);
822 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));
823 if (UNLIKELY(current_cpu->trace_result_p))
824 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
825 current_cpu->h_tbit_set (opval);
829 current_cpu->done_insn (npc, status);
833 // ********** div0u-compact: div0u
836 sh2_sem_div0u_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
837 sh2::write_stacks &buf)
839 #define FLD(f) abuf->fields.fmt_empty.f
840 sem_status status = SEM_STATUS_NORMAL;
841 sh2_scache* abuf = sem;
842 unsigned long long written = 0;
843 PCADDR pc = abuf->addr;
849 if (UNLIKELY(current_cpu->trace_result_p))
850 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
851 current_cpu->h_tbit_set (opval);
855 if (UNLIKELY(current_cpu->trace_result_p))
856 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
857 current_cpu->h_qbit_set (opval);
861 if (UNLIKELY(current_cpu->trace_result_p))
862 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
863 current_cpu->h_mbit_set (opval);
867 current_cpu->done_insn (npc, status);
871 // ********** div1-compact: div1 $rm, $rn
874 sh2_sem_div1_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
875 sh2::write_stacks &buf)
877 #define FLD(f) abuf->fields.sfmt_macl_compact.f
878 sem_status status = SEM_STATUS_NORMAL;
879 sh2_scache* abuf = sem;
880 unsigned long long written = 0;
881 PCADDR pc = abuf->addr;
888 tmp_oldq = current_cpu->h_qbit_get ();
890 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
891 if (UNLIKELY(current_cpu->trace_result_p))
892 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
893 current_cpu->h_qbit_set (opval);
896 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
897 if (UNLIKELY(current_cpu->trace_result_p))
898 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
899 current_cpu->h_grc_set (FLD (f_rn), opval);
901 if (NOTBI (tmp_oldq)) {
902 if (NOTBI (current_cpu->h_mbit_get ())) {
904 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
906 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
907 if (UNLIKELY(current_cpu->trace_result_p))
908 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
909 current_cpu->h_grc_set (FLD (f_rn), opval);
911 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
912 if (NOTBI (current_cpu->h_qbit_get ())) {
914 BI opval = ((tmp_tmp1) ? (1) : (0));
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);
921 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
922 if (UNLIKELY(current_cpu->trace_result_p))
923 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
924 current_cpu->h_qbit_set (opval);
930 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
932 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
933 if (UNLIKELY(current_cpu->trace_result_p))
934 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
935 current_cpu->h_grc_set (FLD (f_rn), opval);
937 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
938 if (NOTBI (current_cpu->h_qbit_get ())) {
940 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
941 if (UNLIKELY(current_cpu->trace_result_p))
942 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
943 current_cpu->h_qbit_set (opval);
947 BI opval = ((tmp_tmp1) ? (1) : (0));
948 if (UNLIKELY(current_cpu->trace_result_p))
949 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
950 current_cpu->h_qbit_set (opval);
956 if (NOTBI (current_cpu->h_mbit_get ())) {
958 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
960 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
961 if (UNLIKELY(current_cpu->trace_result_p))
962 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
963 current_cpu->h_grc_set (FLD (f_rn), opval);
965 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
966 if (NOTBI (current_cpu->h_qbit_get ())) {
968 BI opval = ((tmp_tmp1) ? (1) : (0));
969 if (UNLIKELY(current_cpu->trace_result_p))
970 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
971 current_cpu->h_qbit_set (opval);
975 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
976 if (UNLIKELY(current_cpu->trace_result_p))
977 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
978 current_cpu->h_qbit_set (opval);
984 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
986 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
987 if (UNLIKELY(current_cpu->trace_result_p))
988 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
989 current_cpu->h_grc_set (FLD (f_rn), opval);
991 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
992 if (NOTBI (current_cpu->h_qbit_get ())) {
994 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
995 if (UNLIKELY(current_cpu->trace_result_p))
996 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
997 current_cpu->h_qbit_set (opval);
1001 BI opval = ((tmp_tmp1) ? (1) : (0));
1002 if (UNLIKELY(current_cpu->trace_result_p))
1003 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1004 current_cpu->h_qbit_set (opval);
1011 BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1012 if (UNLIKELY(current_cpu->trace_result_p))
1013 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1014 current_cpu->h_tbit_set (opval);
1018 current_cpu->done_insn (npc, status);
1022 // ********** dmulsl-compact: dmuls.l $rm, $rn
1025 sh2_sem_dmulsl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1026 sh2::write_stacks &buf)
1028 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1029 sem_status status = SEM_STATUS_NORMAL;
1030 sh2_scache* abuf = sem;
1031 unsigned long long written = 0;
1032 PCADDR pc = abuf->addr;
1033 PCADDR npc = pc + 2;
1037 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1039 SI opval = SUBWORDDISI (tmp_result, 0);
1040 if (UNLIKELY(current_cpu->trace_result_p))
1041 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1042 current_cpu->h_mach_set (opval);
1045 SI opval = SUBWORDDISI (tmp_result, 1);
1046 if (UNLIKELY(current_cpu->trace_result_p))
1047 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1048 current_cpu->h_macl_set (opval);
1052 current_cpu->done_insn (npc, status);
1056 // ********** dmulul-compact: dmulu.l $rm, $rn
1059 sh2_sem_dmulul_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1060 sh2::write_stacks &buf)
1062 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1063 sem_status status = SEM_STATUS_NORMAL;
1064 sh2_scache* abuf = sem;
1065 unsigned long long written = 0;
1066 PCADDR pc = abuf->addr;
1067 PCADDR npc = pc + 2;
1071 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1073 SI opval = SUBWORDDISI (tmp_result, 0);
1074 if (UNLIKELY(current_cpu->trace_result_p))
1075 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1076 current_cpu->h_mach_set (opval);
1079 SI opval = SUBWORDDISI (tmp_result, 1);
1080 if (UNLIKELY(current_cpu->trace_result_p))
1081 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1082 current_cpu->h_macl_set (opval);
1086 current_cpu->done_insn (npc, status);
1090 // ********** dt-compact: dt $rn
1093 sh2_sem_dt_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1094 sh2::write_stacks &buf)
1096 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1097 sem_status status = SEM_STATUS_NORMAL;
1098 sh2_scache* abuf = sem;
1099 unsigned long long written = 0;
1100 PCADDR pc = abuf->addr;
1101 PCADDR npc = pc + 2;
1105 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1106 if (UNLIKELY(current_cpu->trace_result_p))
1107 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1108 current_cpu->h_grc_set (FLD (f_rn), opval);
1111 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1112 if (UNLIKELY(current_cpu->trace_result_p))
1113 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1114 current_cpu->h_tbit_set (opval);
1118 current_cpu->done_insn (npc, status);
1122 // ********** extsb-compact: exts.b $rm, $rn
1125 sh2_sem_extsb_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1126 sh2::write_stacks &buf)
1128 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1129 sem_status status = SEM_STATUS_NORMAL;
1130 sh2_scache* abuf = sem;
1131 unsigned long long written = 0;
1132 PCADDR pc = abuf->addr;
1133 PCADDR npc = pc + 2;
1136 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1137 if (UNLIKELY(current_cpu->trace_result_p))
1138 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1139 current_cpu->h_grc_set (FLD (f_rn), opval);
1142 current_cpu->done_insn (npc, status);
1146 // ********** extsw-compact: exts.w $rm, $rn
1149 sh2_sem_extsw_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1150 sh2::write_stacks &buf)
1152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1153 sem_status status = SEM_STATUS_NORMAL;
1154 sh2_scache* abuf = sem;
1155 unsigned long long written = 0;
1156 PCADDR pc = abuf->addr;
1157 PCADDR npc = pc + 2;
1160 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
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 // ********** extub-compact: extu.b $rm, $rn
1173 sh2_sem_extub_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1174 sh2::write_stacks &buf)
1176 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1177 sem_status status = SEM_STATUS_NORMAL;
1178 sh2_scache* abuf = sem;
1179 unsigned long long written = 0;
1180 PCADDR pc = abuf->addr;
1181 PCADDR npc = pc + 2;
1184 SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
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 // ********** extuw-compact: extu.w $rm, $rn
1197 sh2_sem_extuw_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1198 sh2::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh2_scache* abuf = sem;
1203 unsigned long long written = 0;
1204 PCADDR pc = abuf->addr;
1205 PCADDR npc = pc + 2;
1208 SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
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 // ********** frchg-compact: frchg
1221 sh2_sem_frchg_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1222 sh2::write_stacks &buf)
1224 #define FLD(f) abuf->fields.fmt_empty.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh2_scache* abuf = sem;
1227 unsigned long long written = 0;
1228 PCADDR pc = abuf->addr;
1229 PCADDR npc = pc + 2;
1232 BI opval = NOTBI (current_cpu->h_frbit_get ());
1233 if (UNLIKELY(current_cpu->trace_result_p))
1234 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
1235 current_cpu->h_frbit_set (opval);
1238 current_cpu->done_insn (npc, status);
1242 // ********** fschg-compact: fschg
1245 sh2_sem_fschg_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1246 sh2::write_stacks &buf)
1248 #define FLD(f) abuf->fields.fmt_empty.f
1249 sem_status status = SEM_STATUS_NORMAL;
1250 sh2_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_szbit_get ());
1257 if (UNLIKELY(current_cpu->trace_result_p))
1258 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
1259 current_cpu->h_szbit_set (opval);
1262 current_cpu->done_insn (npc, status);
1266 // ********** jmp-compact: jmp @$rn
1269 sh2_sem_jmp_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1270 sh2::write_stacks &buf)
1272 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1273 sem_status status = SEM_STATUS_NORMAL;
1274 sh2_scache* abuf = sem;
1275 unsigned long long written = 0;
1276 PCADDR pc = abuf->addr;
1277 PCADDR npc = pc + 2;
1281 UDI opval = ADDDI (pc, 2);
1282 if (UNLIKELY(current_cpu->trace_result_p))
1283 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1284 current_cpu->branch (opval, npc, status);
1286 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1288 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1289 buf.h_pc_writes [(tick + 1) % sh2::pipe_sz].push (sh2::write<UDI>(pc, opval));
1290 if (UNLIKELY(current_cpu->trace_result_p))
1291 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1293 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1296 current_cpu->done_cti_insn (npc, status);
1300 // ********** jsr-compact: jsr @$rn
1303 sh2_sem_jsr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1304 sh2::write_stacks &buf)
1306 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1307 sem_status status = SEM_STATUS_NORMAL;
1308 sh2_scache* abuf = sem;
1309 unsigned long long written = 0;
1310 PCADDR pc = abuf->addr;
1311 PCADDR npc = pc + 2;
1315 SI opval = ADDDI (pc, 4);
1316 buf.h_pr_writes [(tick + 1) % sh2::pipe_sz].push (sh2::write<SI>(pc, opval));
1317 if (UNLIKELY(current_cpu->trace_result_p))
1318 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1321 UDI opval = ADDDI (pc, 2);
1322 if (UNLIKELY(current_cpu->trace_result_p))
1323 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1324 current_cpu->branch (opval, npc, status);
1326 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1328 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1329 buf.h_pc_writes [(tick + 1) % sh2::pipe_sz].push (sh2::write<UDI>(pc, opval));
1330 if (UNLIKELY(current_cpu->trace_result_p))
1331 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1333 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1336 current_cpu->done_cti_insn (npc, status);
1340 // ********** ldc-gbr-compact: ldc $rn, gbr
1343 sh2_sem_ldc_gbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1344 sh2::write_stacks &buf)
1346 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1347 sem_status status = SEM_STATUS_NORMAL;
1348 sh2_scache* abuf = sem;
1349 unsigned long long written = 0;
1350 PCADDR pc = abuf->addr;
1351 PCADDR npc = pc + 2;
1354 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1355 if (UNLIKELY(current_cpu->trace_result_p))
1356 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1357 current_cpu->h_gbr_set (opval);
1360 current_cpu->done_insn (npc, status);
1364 // ********** ldc-vbr-compact: ldc $rn, vbr
1367 sh2_sem_ldc_vbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1368 sh2::write_stacks &buf)
1370 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1371 sem_status status = SEM_STATUS_NORMAL;
1372 sh2_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 << "vbr" << ":=0x" << hex << opval << dec << " ";
1381 current_cpu->h_vbr_set (opval);
1384 current_cpu->done_insn (npc, status);
1388 // ********** ldc-sr-compact: ldc $rn, sr
1391 sh2_sem_ldc_sr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1392 sh2::write_stacks &buf)
1394 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1395 sem_status status = SEM_STATUS_NORMAL;
1396 sh2_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 << "sr" << ":=0x" << hex << opval << dec << " ";
1405 current_cpu->hardware.h_sr = opval;
1408 current_cpu->done_insn (npc, status);
1412 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
1415 sh2_sem_ldcl_gbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1416 sh2::write_stacks &buf)
1418 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1419 sem_status status = SEM_STATUS_NORMAL;
1420 sh2_scache* abuf = sem;
1421 unsigned long long written = 0;
1422 PCADDR pc = abuf->addr;
1423 PCADDR npc = pc + 2;
1427 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1428 if (UNLIKELY(current_cpu->trace_result_p))
1429 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1430 current_cpu->h_gbr_set (opval);
1433 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1434 if (UNLIKELY(current_cpu->trace_result_p))
1435 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1436 current_cpu->h_grc_set (FLD (f_rn), opval);
1440 current_cpu->done_insn (npc, status);
1444 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
1447 sh2_sem_ldcl_vbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1448 sh2::write_stacks &buf)
1450 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1451 sem_status status = SEM_STATUS_NORMAL;
1452 sh2_scache* abuf = sem;
1453 unsigned long long written = 0;
1454 PCADDR pc = abuf->addr;
1455 PCADDR npc = pc + 2;
1459 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1460 if (UNLIKELY(current_cpu->trace_result_p))
1461 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1462 current_cpu->h_vbr_set (opval);
1465 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1466 if (UNLIKELY(current_cpu->trace_result_p))
1467 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1468 current_cpu->h_grc_set (FLD (f_rn), opval);
1472 current_cpu->done_insn (npc, status);
1476 // ********** lds-mach-compact: lds $rn, mach
1479 sh2_sem_lds_mach_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1480 sh2::write_stacks &buf)
1482 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1483 sem_status status = SEM_STATUS_NORMAL;
1484 sh2_scache* abuf = sem;
1485 unsigned long long written = 0;
1486 PCADDR pc = abuf->addr;
1487 PCADDR npc = pc + 2;
1490 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1491 if (UNLIKELY(current_cpu->trace_result_p))
1492 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1493 current_cpu->h_mach_set (opval);
1496 current_cpu->done_insn (npc, status);
1500 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
1503 sh2_sem_ldsl_mach_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1504 sh2::write_stacks &buf)
1506 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1507 sem_status status = SEM_STATUS_NORMAL;
1508 sh2_scache* abuf = sem;
1509 unsigned long long written = 0;
1510 PCADDR pc = abuf->addr;
1511 PCADDR npc = pc + 2;
1515 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1516 if (UNLIKELY(current_cpu->trace_result_p))
1517 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1518 current_cpu->h_mach_set (opval);
1521 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1522 if (UNLIKELY(current_cpu->trace_result_p))
1523 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1524 current_cpu->h_grc_set (FLD (f_rn), opval);
1528 current_cpu->done_insn (npc, status);
1532 // ********** lds-macl-compact: lds $rn, macl
1535 sh2_sem_lds_macl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1536 sh2::write_stacks &buf)
1538 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1539 sem_status status = SEM_STATUS_NORMAL;
1540 sh2_scache* abuf = sem;
1541 unsigned long long written = 0;
1542 PCADDR pc = abuf->addr;
1543 PCADDR npc = pc + 2;
1546 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1547 if (UNLIKELY(current_cpu->trace_result_p))
1548 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1549 current_cpu->h_macl_set (opval);
1552 current_cpu->done_insn (npc, status);
1556 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
1559 sh2_sem_ldsl_macl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1560 sh2::write_stacks &buf)
1562 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1563 sem_status status = SEM_STATUS_NORMAL;
1564 sh2_scache* abuf = sem;
1565 unsigned long long written = 0;
1566 PCADDR pc = abuf->addr;
1567 PCADDR npc = pc + 2;
1571 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1572 if (UNLIKELY(current_cpu->trace_result_p))
1573 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1574 current_cpu->h_macl_set (opval);
1577 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1578 if (UNLIKELY(current_cpu->trace_result_p))
1579 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1580 current_cpu->h_grc_set (FLD (f_rn), opval);
1584 current_cpu->done_insn (npc, status);
1588 // ********** lds-pr-compact: lds $rn, pr
1591 sh2_sem_lds_pr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1592 sh2::write_stacks &buf)
1594 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1595 sem_status status = SEM_STATUS_NORMAL;
1596 sh2_scache* abuf = sem;
1597 unsigned long long written = 0;
1598 PCADDR pc = abuf->addr;
1599 PCADDR npc = pc + 2;
1602 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1603 if (UNLIKELY(current_cpu->trace_result_p))
1604 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1605 current_cpu->h_pr_set (opval);
1608 current_cpu->done_insn (npc, status);
1612 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
1615 sh2_sem_ldsl_pr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1616 sh2::write_stacks &buf)
1618 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1619 sem_status status = SEM_STATUS_NORMAL;
1620 sh2_scache* abuf = sem;
1621 unsigned long long written = 0;
1622 PCADDR pc = abuf->addr;
1623 PCADDR npc = pc + 2;
1627 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1628 if (UNLIKELY(current_cpu->trace_result_p))
1629 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1630 current_cpu->h_pr_set (opval);
1633 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1634 if (UNLIKELY(current_cpu->trace_result_p))
1635 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1636 current_cpu->h_grc_set (FLD (f_rn), opval);
1640 current_cpu->done_insn (npc, status);
1644 // ********** macl-compact: mac.l @${rm}+, @${rn}+
1647 sh2_sem_macl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1648 sh2::write_stacks &buf)
1650 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1651 sem_status status = SEM_STATUS_NORMAL;
1652 sh2_scache* abuf = sem;
1653 unsigned long long written = 0;
1654 PCADDR pc = abuf->addr;
1655 PCADDR npc = pc + 2;
1663 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1665 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1666 if (UNLIKELY(current_cpu->trace_result_p))
1667 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1668 current_cpu->h_grc_set (FLD (f_rn), opval);
1670 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1673 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1674 if (UNLIKELY(current_cpu->trace_result_p))
1675 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1676 current_cpu->h_grc_set (FLD (f_rn), opval);
1679 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1680 written |= (1ULL << 11);
1681 if (UNLIKELY(current_cpu->trace_result_p))
1682 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1683 current_cpu->h_grc_set (FLD (f_rm), opval);
1687 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1689 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1690 written |= (1ULL << 11);
1691 if (UNLIKELY(current_cpu->trace_result_p))
1692 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1693 current_cpu->h_grc_set (FLD (f_rm), opval);
1695 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
1696 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1697 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
1699 if (current_cpu->h_sbit_get ()) {
1703 tmp_max = SRLDI (INVDI (0), 16);
1704 tmp_min = SRLDI (INVDI (0), 15);
1705 if (GTDI (tmp_result, tmp_max)) {
1706 tmp_result = tmp_max;
1708 if (LTDI (tmp_result, tmp_min)) {
1709 tmp_result = tmp_min;
1715 SI opval = SUBWORDDISI (tmp_result, 0);
1716 if (UNLIKELY(current_cpu->trace_result_p))
1717 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1718 current_cpu->h_mach_set (opval);
1721 SI opval = SUBWORDDISI (tmp_result, 1);
1722 if (UNLIKELY(current_cpu->trace_result_p))
1723 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1724 current_cpu->h_macl_set (opval);
1729 abuf->written = written;
1730 current_cpu->done_insn (npc, status);
1734 // ********** macw-compact: mac.w @${rm}+, @${rn}+
1737 sh2_sem_macw_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1738 sh2::write_stacks &buf)
1740 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1741 sem_status status = SEM_STATUS_NORMAL;
1742 sh2_scache* abuf = sem;
1743 unsigned long long written = 0;
1744 PCADDR pc = abuf->addr;
1745 PCADDR npc = pc + 2;
1753 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1755 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1756 if (UNLIKELY(current_cpu->trace_result_p))
1757 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1758 current_cpu->h_grc_set (FLD (f_rn), opval);
1760 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1763 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1764 if (UNLIKELY(current_cpu->trace_result_p))
1765 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1766 current_cpu->h_grc_set (FLD (f_rn), opval);
1769 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1770 written |= (1ULL << 11);
1771 if (UNLIKELY(current_cpu->trace_result_p))
1772 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1773 current_cpu->h_grc_set (FLD (f_rm), opval);
1777 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1779 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1780 written |= (1ULL << 11);
1781 if (UNLIKELY(current_cpu->trace_result_p))
1782 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1783 current_cpu->h_grc_set (FLD (f_rm), opval);
1785 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
1786 if (current_cpu->h_sbit_get ()) {
1788 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
1791 written |= (1ULL << 9);
1792 if (UNLIKELY(current_cpu->trace_result_p))
1793 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1794 current_cpu->h_mach_set (opval);
1798 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
1799 written |= (1ULL << 10);
1800 if (UNLIKELY(current_cpu->trace_result_p))
1801 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1802 current_cpu->h_macl_set (opval);
1807 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1808 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
1810 SI opval = SUBWORDDISI (tmp_result, 0);
1811 written |= (1ULL << 9);
1812 if (UNLIKELY(current_cpu->trace_result_p))
1813 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1814 current_cpu->h_mach_set (opval);
1817 SI opval = SUBWORDDISI (tmp_result, 1);
1818 written |= (1ULL << 10);
1819 if (UNLIKELY(current_cpu->trace_result_p))
1820 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1821 current_cpu->h_macl_set (opval);
1827 abuf->written = written;
1828 current_cpu->done_insn (npc, status);
1832 // ********** mov-compact: mov $rm64, $rn64
1835 sh2_sem_mov_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1836 sh2::write_stacks &buf)
1838 #define FLD(f) abuf->fields.sfmt_and_compact.f
1839 sem_status status = SEM_STATUS_NORMAL;
1840 sh2_scache* abuf = sem;
1841 unsigned long long written = 0;
1842 PCADDR pc = abuf->addr;
1843 PCADDR npc = pc + 2;
1846 DI opval = current_cpu->h_gr_get (FLD (f_rm));
1847 if (UNLIKELY(current_cpu->trace_result_p))
1848 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1849 current_cpu->h_gr_set (FLD (f_rn), opval);
1852 current_cpu->done_insn (npc, status);
1856 // ********** movi-compact: mov #$imm8, $rn
1859 sh2_sem_movi_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1860 sh2::write_stacks &buf)
1862 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1863 sem_status status = SEM_STATUS_NORMAL;
1864 sh2_scache* abuf = sem;
1865 unsigned long long written = 0;
1866 PCADDR pc = abuf->addr;
1867 PCADDR npc = pc + 2;
1870 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
1871 if (UNLIKELY(current_cpu->trace_result_p))
1872 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1873 current_cpu->h_grc_set (FLD (f_rn), opval);
1876 current_cpu->done_insn (npc, status);
1880 // ********** movb1-compact: mov.b $rm, @$rn
1883 sh2_sem_movb1_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1884 sh2::write_stacks &buf)
1886 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1887 sem_status status = SEM_STATUS_NORMAL;
1888 sh2_scache* abuf = sem;
1889 unsigned long long written = 0;
1890 PCADDR pc = abuf->addr;
1891 PCADDR npc = pc + 2;
1894 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1895 if (UNLIKELY(current_cpu->trace_result_p))
1896 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1897 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1900 current_cpu->done_insn (npc, status);
1904 // ********** movb2-compact: mov.b $rm, @-$rn
1907 sh2_sem_movb2_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1908 sh2::write_stacks &buf)
1910 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1911 sem_status status = SEM_STATUS_NORMAL;
1912 sh2_scache* abuf = sem;
1913 unsigned long long written = 0;
1914 PCADDR pc = abuf->addr;
1915 PCADDR npc = pc + 2;
1919 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1921 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1922 if (UNLIKELY(current_cpu->trace_result_p))
1923 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1924 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
1927 SI opval = tmp_addr;
1928 if (UNLIKELY(current_cpu->trace_result_p))
1929 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1930 current_cpu->h_grc_set (FLD (f_rn), opval);
1934 current_cpu->done_insn (npc, status);
1938 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
1941 sh2_sem_movb3_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1942 sh2::write_stacks &buf)
1944 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
1945 sem_status status = SEM_STATUS_NORMAL;
1946 sh2_scache* abuf = sem;
1947 unsigned long long written = 0;
1948 PCADDR pc = abuf->addr;
1949 PCADDR npc = pc + 2;
1952 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1953 if (UNLIKELY(current_cpu->trace_result_p))
1954 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 << " ";
1955 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1958 current_cpu->done_insn (npc, status);
1962 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
1965 sh2_sem_movb4_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1966 sh2::write_stacks &buf)
1968 #define FLD(f) abuf->fields.sfmt_andi_compact.f
1969 sem_status status = SEM_STATUS_NORMAL;
1970 sh2_scache* abuf = sem;
1971 unsigned long long written = 0;
1972 PCADDR pc = abuf->addr;
1973 PCADDR npc = pc + 2;
1977 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
1979 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
1980 if (UNLIKELY(current_cpu->trace_result_p))
1981 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1982 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
1986 current_cpu->done_insn (npc, status);
1990 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
1993 sh2_sem_movb5_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
1994 sh2::write_stacks &buf)
1996 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
1997 sem_status status = SEM_STATUS_NORMAL;
1998 sh2_scache* abuf = sem;
1999 unsigned long long written = 0;
2000 PCADDR pc = abuf->addr;
2001 PCADDR npc = pc + 2;
2005 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2007 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2008 if (UNLIKELY(current_cpu->trace_result_p))
2009 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2010 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2014 current_cpu->done_insn (npc, status);
2018 // ********** movb6-compact: mov.b @$rm, $rn
2021 sh2_sem_movb6_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2022 sh2::write_stacks &buf)
2024 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2025 sem_status status = SEM_STATUS_NORMAL;
2026 sh2_scache* abuf = sem;
2027 unsigned long long written = 0;
2028 PCADDR pc = abuf->addr;
2029 PCADDR npc = pc + 2;
2032 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2033 if (UNLIKELY(current_cpu->trace_result_p))
2034 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2035 current_cpu->h_grc_set (FLD (f_rn), opval);
2038 current_cpu->done_insn (npc, status);
2042 // ********** movb7-compact: mov.b @${rm}+, $rn
2045 sh2_sem_movb7_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2046 sh2::write_stacks &buf)
2048 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2049 sem_status status = SEM_STATUS_NORMAL;
2050 sh2_scache* abuf = sem;
2051 unsigned long long written = 0;
2052 PCADDR pc = abuf->addr;
2053 PCADDR npc = pc + 2;
2057 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2058 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2060 SI opval = EXTQISI (tmp_data);
2061 written |= (1ULL << 4);
2062 if (UNLIKELY(current_cpu->trace_result_p))
2063 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2064 current_cpu->h_grc_set (FLD (f_rm), opval);
2068 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2069 written |= (1ULL << 4);
2070 if (UNLIKELY(current_cpu->trace_result_p))
2071 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2072 current_cpu->h_grc_set (FLD (f_rm), opval);
2076 SI opval = EXTQISI (tmp_data);
2077 if (UNLIKELY(current_cpu->trace_result_p))
2078 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2079 current_cpu->h_grc_set (FLD (f_rn), opval);
2083 abuf->written = written;
2084 current_cpu->done_insn (npc, status);
2088 // ********** movb8-compact: mov.b @(r0, $rm), $rn
2091 sh2_sem_movb8_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2092 sh2::write_stacks &buf)
2094 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2095 sem_status status = SEM_STATUS_NORMAL;
2096 sh2_scache* abuf = sem;
2097 unsigned long long written = 0;
2098 PCADDR pc = abuf->addr;
2099 PCADDR npc = pc + 2;
2102 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2103 if (UNLIKELY(current_cpu->trace_result_p))
2104 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2105 current_cpu->h_grc_set (FLD (f_rn), opval);
2108 current_cpu->done_insn (npc, status);
2112 // ********** movb9-compact: mov.b @($imm8, gbr), r0
2115 sh2_sem_movb9_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2116 sh2::write_stacks &buf)
2118 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2119 sem_status status = SEM_STATUS_NORMAL;
2120 sh2_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_gbr_get (), FLD (f_imm8))));
2127 if (UNLIKELY(current_cpu->trace_result_p))
2128 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2129 current_cpu->h_grc_set (((UINT) 0), opval);
2132 current_cpu->done_insn (npc, status);
2136 // ********** movb10-compact: mov.b @($imm4, $rm), r0
2139 sh2_sem_movb10_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2140 sh2::write_stacks &buf)
2142 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2143 sem_status status = SEM_STATUS_NORMAL;
2144 sh2_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_grc_get (FLD (f_rm)), FLD (f_imm4))));
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 // ********** movl1-compact: mov.l $rm, @$rn
2163 sh2_sem_movl1_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2164 sh2::write_stacks &buf)
2166 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2167 sem_status status = SEM_STATUS_NORMAL;
2168 sh2_scache* abuf = sem;
2169 unsigned long long written = 0;
2170 PCADDR pc = abuf->addr;
2171 PCADDR npc = pc + 2;
2174 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2175 if (UNLIKELY(current_cpu->trace_result_p))
2176 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2177 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2180 current_cpu->done_insn (npc, status);
2184 // ********** movl2-compact: mov.l $rm, @-$rn
2187 sh2_sem_movl2_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2188 sh2::write_stacks &buf)
2190 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2191 sem_status status = SEM_STATUS_NORMAL;
2192 sh2_scache* abuf = sem;
2193 unsigned long long written = 0;
2194 PCADDR pc = abuf->addr;
2195 PCADDR npc = pc + 2;
2199 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2201 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2202 if (UNLIKELY(current_cpu->trace_result_p))
2203 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2204 current_cpu->SETMEMSI (pc, tmp_addr, opval);
2207 SI opval = tmp_addr;
2208 if (UNLIKELY(current_cpu->trace_result_p))
2209 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2210 current_cpu->h_grc_set (FLD (f_rn), opval);
2214 current_cpu->done_insn (npc, status);
2218 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
2221 sh2_sem_movl3_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2222 sh2::write_stacks &buf)
2224 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2225 sem_status status = SEM_STATUS_NORMAL;
2226 sh2_scache* abuf = sem;
2227 unsigned long long written = 0;
2228 PCADDR pc = abuf->addr;
2229 PCADDR npc = pc + 2;
2232 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2233 if (UNLIKELY(current_cpu->trace_result_p))
2234 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 << " ";
2235 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2238 current_cpu->done_insn (npc, status);
2242 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
2245 sh2_sem_movl4_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2246 sh2::write_stacks &buf)
2248 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
2249 sem_status status = SEM_STATUS_NORMAL;
2250 sh2_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 (((UINT) 0));
2257 if (UNLIKELY(current_cpu->trace_result_p))
2258 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2259 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
2262 current_cpu->done_insn (npc, status);
2266 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
2269 sh2_sem_movl5_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2270 sh2::write_stacks &buf)
2272 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2273 sem_status status = SEM_STATUS_NORMAL;
2274 sh2_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 (FLD (f_rm));
2281 if (UNLIKELY(current_cpu->trace_result_p))
2282 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 << " ";
2283 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
2286 current_cpu->done_insn (npc, status);
2290 // ********** movl6-compact: mov.l @$rm, $rn
2293 sh2_sem_movl6_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2294 sh2::write_stacks &buf)
2296 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2297 sem_status status = SEM_STATUS_NORMAL;
2298 sh2_scache* abuf = sem;
2299 unsigned long long written = 0;
2300 PCADDR pc = abuf->addr;
2301 PCADDR npc = pc + 2;
2304 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2305 if (UNLIKELY(current_cpu->trace_result_p))
2306 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2307 current_cpu->h_grc_set (FLD (f_rn), opval);
2310 current_cpu->done_insn (npc, status);
2314 // ********** movl7-compact: mov.l @${rm}+, $rn
2317 sh2_sem_movl7_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2318 sh2::write_stacks &buf)
2320 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2321 sem_status status = SEM_STATUS_NORMAL;
2322 sh2_scache* abuf = sem;
2323 unsigned long long written = 0;
2324 PCADDR pc = abuf->addr;
2325 PCADDR npc = pc + 2;
2329 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2330 if (UNLIKELY(current_cpu->trace_result_p))
2331 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2332 current_cpu->h_grc_set (FLD (f_rn), opval);
2334 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2336 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2337 written |= (1ULL << 5);
2338 if (UNLIKELY(current_cpu->trace_result_p))
2339 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2340 current_cpu->h_grc_set (FLD (f_rm), opval);
2344 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2345 written |= (1ULL << 5);
2346 if (UNLIKELY(current_cpu->trace_result_p))
2347 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2348 current_cpu->h_grc_set (FLD (f_rm), opval);
2353 abuf->written = written;
2354 current_cpu->done_insn (npc, status);
2358 // ********** movl8-compact: mov.l @(r0, $rm), $rn
2361 sh2_sem_movl8_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2362 sh2::write_stacks &buf)
2364 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2365 sem_status status = SEM_STATUS_NORMAL;
2366 sh2_scache* abuf = sem;
2367 unsigned long long written = 0;
2368 PCADDR pc = abuf->addr;
2369 PCADDR npc = pc + 2;
2372 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
2373 if (UNLIKELY(current_cpu->trace_result_p))
2374 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2375 current_cpu->h_grc_set (FLD (f_rn), opval);
2378 current_cpu->done_insn (npc, status);
2382 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
2385 sh2_sem_movl9_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2386 sh2::write_stacks &buf)
2388 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2389 sem_status status = SEM_STATUS_NORMAL;
2390 sh2_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_gbr_get (), FLD (f_imm8x4)));
2397 if (UNLIKELY(current_cpu->trace_result_p))
2398 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2399 current_cpu->h_grc_set (((UINT) 0), opval);
2402 current_cpu->done_insn (npc, status);
2406 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
2409 sh2_sem_movl10_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2410 sh2::write_stacks &buf)
2412 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
2413 sem_status status = SEM_STATUS_NORMAL;
2414 sh2_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 (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
2421 if (UNLIKELY(current_cpu->trace_result_p))
2422 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2423 current_cpu->h_grc_set (FLD (f_rn), opval);
2426 current_cpu->done_insn (npc, status);
2430 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
2433 sh2_sem_movl11_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2434 sh2::write_stacks &buf)
2436 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2437 sem_status status = SEM_STATUS_NORMAL;
2438 sh2_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 (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
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 // ********** movw1-compact: mov.w $rm, @$rn
2457 sh2_sem_movw1_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2458 sh2::write_stacks &buf)
2460 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2461 sem_status status = SEM_STATUS_NORMAL;
2462 sh2_scache* abuf = sem;
2463 unsigned long long written = 0;
2464 PCADDR pc = abuf->addr;
2465 PCADDR npc = pc + 2;
2468 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2469 if (UNLIKELY(current_cpu->trace_result_p))
2470 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2471 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2474 current_cpu->done_insn (npc, status);
2478 // ********** movw2-compact: mov.w $rm, @-$rn
2481 sh2_sem_movw2_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2482 sh2::write_stacks &buf)
2484 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2485 sem_status status = SEM_STATUS_NORMAL;
2486 sh2_scache* abuf = sem;
2487 unsigned long long written = 0;
2488 PCADDR pc = abuf->addr;
2489 PCADDR npc = pc + 2;
2493 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2495 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2496 if (UNLIKELY(current_cpu->trace_result_p))
2497 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2498 current_cpu->SETMEMHI (pc, tmp_addr, opval);
2501 SI opval = tmp_addr;
2502 if (UNLIKELY(current_cpu->trace_result_p))
2503 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2504 current_cpu->h_grc_set (FLD (f_rn), opval);
2508 current_cpu->done_insn (npc, status);
2512 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
2515 sh2_sem_movw3_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2516 sh2::write_stacks &buf)
2518 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2519 sem_status status = SEM_STATUS_NORMAL;
2520 sh2_scache* abuf = sem;
2521 unsigned long long written = 0;
2522 PCADDR pc = abuf->addr;
2523 PCADDR npc = pc + 2;
2526 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2527 if (UNLIKELY(current_cpu->trace_result_p))
2528 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 << " ";
2529 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2532 current_cpu->done_insn (npc, status);
2536 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
2539 sh2_sem_movw4_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2540 sh2::write_stacks &buf)
2542 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
2543 sem_status status = SEM_STATUS_NORMAL;
2544 sh2_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 (((UINT) 0)), 1);
2551 if (UNLIKELY(current_cpu->trace_result_p))
2552 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2553 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
2556 current_cpu->done_insn (npc, status);
2560 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
2563 sh2_sem_movw5_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2564 sh2::write_stacks &buf)
2566 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
2567 sem_status status = SEM_STATUS_NORMAL;
2568 sh2_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_grc_get (FLD (f_rm)), FLD (f_imm4x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2577 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
2580 current_cpu->done_insn (npc, status);
2584 // ********** movw6-compact: mov.w @$rm, $rn
2587 sh2_sem_movw6_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2588 sh2::write_stacks &buf)
2590 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2591 sem_status status = SEM_STATUS_NORMAL;
2592 sh2_scache* abuf = sem;
2593 unsigned long long written = 0;
2594 PCADDR pc = abuf->addr;
2595 PCADDR npc = pc + 2;
2598 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2599 if (UNLIKELY(current_cpu->trace_result_p))
2600 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2601 current_cpu->h_grc_set (FLD (f_rn), opval);
2604 current_cpu->done_insn (npc, status);
2608 // ********** movw7-compact: mov.w @${rm}+, $rn
2611 sh2_sem_movw7_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2612 sh2::write_stacks &buf)
2614 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2615 sem_status status = SEM_STATUS_NORMAL;
2616 sh2_scache* abuf = sem;
2617 unsigned long long written = 0;
2618 PCADDR pc = abuf->addr;
2619 PCADDR npc = pc + 2;
2623 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2624 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2626 SI opval = EXTHISI (tmp_data);
2627 written |= (1ULL << 4);
2628 if (UNLIKELY(current_cpu->trace_result_p))
2629 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2630 current_cpu->h_grc_set (FLD (f_rm), opval);
2634 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2635 written |= (1ULL << 4);
2636 if (UNLIKELY(current_cpu->trace_result_p))
2637 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2638 current_cpu->h_grc_set (FLD (f_rm), opval);
2642 SI opval = EXTHISI (tmp_data);
2643 if (UNLIKELY(current_cpu->trace_result_p))
2644 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2645 current_cpu->h_grc_set (FLD (f_rn), opval);
2649 abuf->written = written;
2650 current_cpu->done_insn (npc, status);
2654 // ********** movw8-compact: mov.w @(r0, $rm), $rn
2657 sh2_sem_movw8_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2658 sh2::write_stacks &buf)
2660 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2661 sem_status status = SEM_STATUS_NORMAL;
2662 sh2_scache* abuf = sem;
2663 unsigned long long written = 0;
2664 PCADDR pc = abuf->addr;
2665 PCADDR npc = pc + 2;
2668 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2669 if (UNLIKELY(current_cpu->trace_result_p))
2670 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2671 current_cpu->h_grc_set (FLD (f_rn), opval);
2674 current_cpu->done_insn (npc, status);
2678 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
2681 sh2_sem_movw9_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2682 sh2::write_stacks &buf)
2684 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
2685 sem_status status = SEM_STATUS_NORMAL;
2686 sh2_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_gbr_get (), FLD (f_imm8x2))));
2693 if (UNLIKELY(current_cpu->trace_result_p))
2694 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2695 current_cpu->h_grc_set (((UINT) 0), opval);
2698 current_cpu->done_insn (npc, status);
2702 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
2705 sh2_sem_movw10_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2706 sh2::write_stacks &buf)
2708 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2709 sem_status status = SEM_STATUS_NORMAL;
2710 sh2_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, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
2717 if (UNLIKELY(current_cpu->trace_result_p))
2718 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2719 current_cpu->h_grc_set (FLD (f_rn), opval);
2722 current_cpu->done_insn (npc, status);
2726 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
2729 sh2_sem_movw11_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2730 sh2::write_stacks &buf)
2732 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
2733 sem_status status = SEM_STATUS_NORMAL;
2734 sh2_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, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
2741 if (UNLIKELY(current_cpu->trace_result_p))
2742 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2743 current_cpu->h_grc_set (((UINT) 0), opval);
2746 current_cpu->done_insn (npc, status);
2750 // ********** mova-compact: mova @($imm8x4, pc), r0
2753 sh2_sem_mova_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2754 sh2::write_stacks &buf)
2756 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2757 sem_status status = SEM_STATUS_NORMAL;
2758 sh2_scache* abuf = sem;
2759 unsigned long long written = 0;
2760 PCADDR pc = abuf->addr;
2761 PCADDR npc = pc + 2;
2764 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
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 // ********** movt-compact: movt $rn
2777 sh2_sem_movt_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2778 sh2::write_stacks &buf)
2780 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2781 sem_status status = SEM_STATUS_NORMAL;
2782 sh2_scache* abuf = sem;
2783 unsigned long long written = 0;
2784 PCADDR pc = abuf->addr;
2785 PCADDR npc = pc + 2;
2788 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
2789 if (UNLIKELY(current_cpu->trace_result_p))
2790 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2791 current_cpu->h_grc_set (FLD (f_rn), opval);
2794 current_cpu->done_insn (npc, status);
2798 // ********** mull-compact: mul.l $rm, $rn
2801 sh2_sem_mull_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2802 sh2::write_stacks &buf)
2804 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2805 sem_status status = SEM_STATUS_NORMAL;
2806 sh2_scache* abuf = sem;
2807 unsigned long long written = 0;
2808 PCADDR pc = abuf->addr;
2809 PCADDR npc = pc + 2;
2812 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
2813 if (UNLIKELY(current_cpu->trace_result_p))
2814 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2815 current_cpu->h_macl_set (opval);
2818 current_cpu->done_insn (npc, status);
2822 // ********** mulsw-compact: muls.w $rm, $rn
2825 sh2_sem_mulsw_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2826 sh2::write_stacks &buf)
2828 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2829 sem_status status = SEM_STATUS_NORMAL;
2830 sh2_scache* abuf = sem;
2831 unsigned long long written = 0;
2832 PCADDR pc = abuf->addr;
2833 PCADDR npc = pc + 2;
2836 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)));
2837 if (UNLIKELY(current_cpu->trace_result_p))
2838 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2839 current_cpu->h_macl_set (opval);
2842 current_cpu->done_insn (npc, status);
2846 // ********** muluw-compact: mulu.w $rm, $rn
2849 sh2_sem_muluw_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2850 sh2::write_stacks &buf)
2852 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2853 sem_status status = SEM_STATUS_NORMAL;
2854 sh2_scache* abuf = sem;
2855 unsigned long long written = 0;
2856 PCADDR pc = abuf->addr;
2857 PCADDR npc = pc + 2;
2860 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)));
2861 if (UNLIKELY(current_cpu->trace_result_p))
2862 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2863 current_cpu->h_macl_set (opval);
2866 current_cpu->done_insn (npc, status);
2870 // ********** neg-compact: neg $rm, $rn
2873 sh2_sem_neg_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2874 sh2::write_stacks &buf)
2876 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2877 sem_status status = SEM_STATUS_NORMAL;
2878 sh2_scache* abuf = sem;
2879 unsigned long long written = 0;
2880 PCADDR pc = abuf->addr;
2881 PCADDR npc = pc + 2;
2884 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
2885 if (UNLIKELY(current_cpu->trace_result_p))
2886 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2887 current_cpu->h_grc_set (FLD (f_rn), opval);
2890 current_cpu->done_insn (npc, status);
2894 // ********** negc-compact: negc $rm, $rn
2897 sh2_sem_negc_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2898 sh2::write_stacks &buf)
2900 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2901 sem_status status = SEM_STATUS_NORMAL;
2902 sh2_scache* abuf = sem;
2903 unsigned long long written = 0;
2904 PCADDR pc = abuf->addr;
2905 PCADDR npc = pc + 2;
2909 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
2911 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
2912 if (UNLIKELY(current_cpu->trace_result_p))
2913 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2914 current_cpu->h_grc_set (FLD (f_rn), opval);
2917 BI opval = tmp_flag;
2918 if (UNLIKELY(current_cpu->trace_result_p))
2919 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
2920 current_cpu->h_tbit_set (opval);
2924 current_cpu->done_insn (npc, status);
2928 // ********** nop-compact: nop
2931 sh2_sem_nop_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2932 sh2::write_stacks &buf)
2934 #define FLD(f) abuf->fields.fmt_empty.f
2935 sem_status status = SEM_STATUS_NORMAL;
2936 sh2_scache* abuf = sem;
2937 unsigned long long written = 0;
2938 PCADDR pc = abuf->addr;
2939 PCADDR npc = pc + 2;
2943 current_cpu->done_insn (npc, status);
2947 // ********** not-compact: not $rm64, $rn64
2950 sh2_sem_not_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2951 sh2::write_stacks &buf)
2953 #define FLD(f) abuf->fields.sfmt_and_compact.f
2954 sem_status status = SEM_STATUS_NORMAL;
2955 sh2_scache* abuf = sem;
2956 unsigned long long written = 0;
2957 PCADDR pc = abuf->addr;
2958 PCADDR npc = pc + 2;
2961 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
2962 if (UNLIKELY(current_cpu->trace_result_p))
2963 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2964 current_cpu->h_gr_set (FLD (f_rn), opval);
2967 current_cpu->done_insn (npc, status);
2971 // ********** or-compact: or $rm64, $rn64
2974 sh2_sem_or_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2975 sh2::write_stacks &buf)
2977 #define FLD(f) abuf->fields.sfmt_and_compact.f
2978 sem_status status = SEM_STATUS_NORMAL;
2979 sh2_scache* abuf = sem;
2980 unsigned long long written = 0;
2981 PCADDR pc = abuf->addr;
2982 PCADDR npc = pc + 2;
2985 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
2986 if (UNLIKELY(current_cpu->trace_result_p))
2987 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2988 current_cpu->h_gr_set (FLD (f_rn), opval);
2991 current_cpu->done_insn (npc, status);
2995 // ********** ori-compact: or #$uimm8, r0
2998 sh2_sem_ori_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
2999 sh2::write_stacks &buf)
3001 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3002 sem_status status = SEM_STATUS_NORMAL;
3003 sh2_scache* abuf = sem;
3004 unsigned long long written = 0;
3005 PCADDR pc = abuf->addr;
3006 PCADDR npc = pc + 2;
3009 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3010 if (UNLIKELY(current_cpu->trace_result_p))
3011 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3012 current_cpu->h_grc_set (((UINT) 0), opval);
3015 current_cpu->done_insn (npc, status);
3019 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3022 sh2_sem_orb_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3023 sh2::write_stacks &buf)
3025 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3026 sem_status status = SEM_STATUS_NORMAL;
3027 sh2_scache* abuf = sem;
3028 unsigned long long written = 0;
3029 PCADDR pc = abuf->addr;
3030 PCADDR npc = pc + 2;
3035 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3036 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3038 UQI opval = tmp_data;
3039 if (UNLIKELY(current_cpu->trace_result_p))
3040 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3041 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3045 current_cpu->done_insn (npc, status);
3049 // ********** rotcl-compact: rotcl $rn
3052 sh2_sem_rotcl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3053 sh2::write_stacks &buf)
3055 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3056 sem_status status = SEM_STATUS_NORMAL;
3057 sh2_scache* abuf = sem;
3058 unsigned long long written = 0;
3059 PCADDR pc = abuf->addr;
3060 PCADDR npc = pc + 2;
3064 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3066 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3067 if (UNLIKELY(current_cpu->trace_result_p))
3068 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3069 current_cpu->h_grc_set (FLD (f_rn), opval);
3072 BI opval = ((tmp_temp) ? (1) : (0));
3073 if (UNLIKELY(current_cpu->trace_result_p))
3074 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3075 current_cpu->h_tbit_set (opval);
3079 current_cpu->done_insn (npc, status);
3083 // ********** rotcr-compact: rotcr $rn
3086 sh2_sem_rotcr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3087 sh2::write_stacks &buf)
3089 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3090 sem_status status = SEM_STATUS_NORMAL;
3091 sh2_scache* abuf = sem;
3092 unsigned long long written = 0;
3093 PCADDR pc = abuf->addr;
3094 PCADDR npc = pc + 2;
3099 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3100 tmp_temp = current_cpu->h_tbit_get ();
3102 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3103 if (UNLIKELY(current_cpu->trace_result_p))
3104 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3105 current_cpu->h_grc_set (FLD (f_rn), opval);
3108 BI opval = ((tmp_lsbit) ? (1) : (0));
3109 if (UNLIKELY(current_cpu->trace_result_p))
3110 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3111 current_cpu->h_tbit_set (opval);
3115 current_cpu->done_insn (npc, status);
3119 // ********** rotl-compact: rotl $rn
3122 sh2_sem_rotl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3123 sh2::write_stacks &buf)
3125 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3126 sem_status status = SEM_STATUS_NORMAL;
3127 sh2_scache* abuf = sem;
3128 unsigned long long written = 0;
3129 PCADDR pc = abuf->addr;
3130 PCADDR npc = pc + 2;
3134 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3136 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3137 if (UNLIKELY(current_cpu->trace_result_p))
3138 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3139 current_cpu->h_grc_set (FLD (f_rn), opval);
3142 BI opval = ((tmp_temp) ? (1) : (0));
3143 if (UNLIKELY(current_cpu->trace_result_p))
3144 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3145 current_cpu->h_tbit_set (opval);
3149 current_cpu->done_insn (npc, status);
3153 // ********** rotr-compact: rotr $rn
3156 sh2_sem_rotr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3157 sh2::write_stacks &buf)
3159 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3160 sem_status status = SEM_STATUS_NORMAL;
3161 sh2_scache* abuf = sem;
3162 unsigned long long written = 0;
3163 PCADDR pc = abuf->addr;
3164 PCADDR npc = pc + 2;
3169 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3170 tmp_temp = tmp_lsbit;
3172 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3173 if (UNLIKELY(current_cpu->trace_result_p))
3174 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3175 current_cpu->h_grc_set (FLD (f_rn), opval);
3178 BI opval = ((tmp_lsbit) ? (1) : (0));
3179 if (UNLIKELY(current_cpu->trace_result_p))
3180 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3181 current_cpu->h_tbit_set (opval);
3185 current_cpu->done_insn (npc, status);
3189 // ********** rts-compact: rts
3192 sh2_sem_rts_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3193 sh2::write_stacks &buf)
3195 #define FLD(f) abuf->fields.fmt_empty.f
3196 sem_status status = SEM_STATUS_NORMAL;
3197 sh2_scache* abuf = sem;
3198 unsigned long long written = 0;
3199 PCADDR pc = abuf->addr;
3200 PCADDR npc = pc + 2;
3204 UDI opval = ADDDI (pc, 2);
3205 if (UNLIKELY(current_cpu->trace_result_p))
3206 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3207 current_cpu->branch (opval, npc, status);
3209 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
3211 UDI opval = current_cpu->h_pr_get ();
3212 buf.h_pc_writes [(tick + 1) % sh2::pipe_sz].push (sh2::write<UDI>(pc, opval));
3213 if (UNLIKELY(current_cpu->trace_result_p))
3214 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3216 current_cpu->notify_ret (current_cpu->h_pr_get ());
3219 current_cpu->done_cti_insn (npc, status);
3223 // ********** sett-compact: sett
3226 sh2_sem_sett_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3227 sh2::write_stacks &buf)
3229 #define FLD(f) abuf->fields.fmt_empty.f
3230 sem_status status = SEM_STATUS_NORMAL;
3231 sh2_scache* abuf = sem;
3232 unsigned long long written = 0;
3233 PCADDR pc = abuf->addr;
3234 PCADDR npc = pc + 2;
3238 if (UNLIKELY(current_cpu->trace_result_p))
3239 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3240 current_cpu->h_tbit_set (opval);
3243 current_cpu->done_insn (npc, status);
3247 // ********** shal-compact: shal $rn
3250 sh2_sem_shal_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3251 sh2::write_stacks &buf)
3253 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3254 sem_status status = SEM_STATUS_NORMAL;
3255 sh2_scache* abuf = sem;
3256 unsigned long long written = 0;
3257 PCADDR pc = abuf->addr;
3258 PCADDR npc = pc + 2;
3262 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3264 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3265 if (UNLIKELY(current_cpu->trace_result_p))
3266 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3267 current_cpu->h_grc_set (FLD (f_rn), opval);
3270 BI opval = ((tmp_t) ? (1) : (0));
3271 if (UNLIKELY(current_cpu->trace_result_p))
3272 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3273 current_cpu->h_tbit_set (opval);
3277 current_cpu->done_insn (npc, status);
3281 // ********** shar-compact: shar $rn
3284 sh2_sem_shar_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3285 sh2::write_stacks &buf)
3287 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3288 sem_status status = SEM_STATUS_NORMAL;
3289 sh2_scache* abuf = sem;
3290 unsigned long long written = 0;
3291 PCADDR pc = abuf->addr;
3292 PCADDR npc = pc + 2;
3296 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3298 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3299 if (UNLIKELY(current_cpu->trace_result_p))
3300 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3301 current_cpu->h_grc_set (FLD (f_rn), opval);
3304 BI opval = ((tmp_t) ? (1) : (0));
3305 if (UNLIKELY(current_cpu->trace_result_p))
3306 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3307 current_cpu->h_tbit_set (opval);
3311 current_cpu->done_insn (npc, status);
3315 // ********** shll-compact: shll $rn
3318 sh2_sem_shll_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3319 sh2::write_stacks &buf)
3321 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3322 sem_status status = SEM_STATUS_NORMAL;
3323 sh2_scache* abuf = sem;
3324 unsigned long long written = 0;
3325 PCADDR pc = abuf->addr;
3326 PCADDR npc = pc + 2;
3330 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3332 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3333 if (UNLIKELY(current_cpu->trace_result_p))
3334 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3335 current_cpu->h_grc_set (FLD (f_rn), opval);
3338 BI opval = ((tmp_t) ? (1) : (0));
3339 if (UNLIKELY(current_cpu->trace_result_p))
3340 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3341 current_cpu->h_tbit_set (opval);
3345 current_cpu->done_insn (npc, status);
3349 // ********** shll2-compact: shll2 $rn
3352 sh2_sem_shll2_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3353 sh2::write_stacks &buf)
3355 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3356 sem_status status = SEM_STATUS_NORMAL;
3357 sh2_scache* abuf = sem;
3358 unsigned long long written = 0;
3359 PCADDR pc = abuf->addr;
3360 PCADDR npc = pc + 2;
3363 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3364 if (UNLIKELY(current_cpu->trace_result_p))
3365 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3366 current_cpu->h_grc_set (FLD (f_rn), opval);
3369 current_cpu->done_insn (npc, status);
3373 // ********** shll8-compact: shll8 $rn
3376 sh2_sem_shll8_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3377 sh2::write_stacks &buf)
3379 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3380 sem_status status = SEM_STATUS_NORMAL;
3381 sh2_scache* abuf = sem;
3382 unsigned long long written = 0;
3383 PCADDR pc = abuf->addr;
3384 PCADDR npc = pc + 2;
3387 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3388 if (UNLIKELY(current_cpu->trace_result_p))
3389 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3390 current_cpu->h_grc_set (FLD (f_rn), opval);
3393 current_cpu->done_insn (npc, status);
3397 // ********** shll16-compact: shll16 $rn
3400 sh2_sem_shll16_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3401 sh2::write_stacks &buf)
3403 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3404 sem_status status = SEM_STATUS_NORMAL;
3405 sh2_scache* abuf = sem;
3406 unsigned long long written = 0;
3407 PCADDR pc = abuf->addr;
3408 PCADDR npc = pc + 2;
3411 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3412 if (UNLIKELY(current_cpu->trace_result_p))
3413 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3414 current_cpu->h_grc_set (FLD (f_rn), opval);
3417 current_cpu->done_insn (npc, status);
3421 // ********** shlr-compact: shlr $rn
3424 sh2_sem_shlr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3425 sh2::write_stacks &buf)
3427 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3428 sem_status status = SEM_STATUS_NORMAL;
3429 sh2_scache* abuf = sem;
3430 unsigned long long written = 0;
3431 PCADDR pc = abuf->addr;
3432 PCADDR npc = pc + 2;
3436 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3438 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3439 if (UNLIKELY(current_cpu->trace_result_p))
3440 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3441 current_cpu->h_grc_set (FLD (f_rn), opval);
3444 BI opval = ((tmp_t) ? (1) : (0));
3445 if (UNLIKELY(current_cpu->trace_result_p))
3446 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3447 current_cpu->h_tbit_set (opval);
3451 current_cpu->done_insn (npc, status);
3455 // ********** shlr2-compact: shlr2 $rn
3458 sh2_sem_shlr2_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3459 sh2::write_stacks &buf)
3461 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3462 sem_status status = SEM_STATUS_NORMAL;
3463 sh2_scache* abuf = sem;
3464 unsigned long long written = 0;
3465 PCADDR pc = abuf->addr;
3466 PCADDR npc = pc + 2;
3469 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3470 if (UNLIKELY(current_cpu->trace_result_p))
3471 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3472 current_cpu->h_grc_set (FLD (f_rn), opval);
3475 current_cpu->done_insn (npc, status);
3479 // ********** shlr8-compact: shlr8 $rn
3482 sh2_sem_shlr8_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3483 sh2::write_stacks &buf)
3485 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3486 sem_status status = SEM_STATUS_NORMAL;
3487 sh2_scache* abuf = sem;
3488 unsigned long long written = 0;
3489 PCADDR pc = abuf->addr;
3490 PCADDR npc = pc + 2;
3493 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3494 if (UNLIKELY(current_cpu->trace_result_p))
3495 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3496 current_cpu->h_grc_set (FLD (f_rn), opval);
3499 current_cpu->done_insn (npc, status);
3503 // ********** shlr16-compact: shlr16 $rn
3506 sh2_sem_shlr16_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3507 sh2::write_stacks &buf)
3509 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3510 sem_status status = SEM_STATUS_NORMAL;
3511 sh2_scache* abuf = sem;
3512 unsigned long long written = 0;
3513 PCADDR pc = abuf->addr;
3514 PCADDR npc = pc + 2;
3517 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3518 if (UNLIKELY(current_cpu->trace_result_p))
3519 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3520 current_cpu->h_grc_set (FLD (f_rn), opval);
3523 current_cpu->done_insn (npc, status);
3527 // ********** stc-gbr-compact: stc gbr, $rn
3530 sh2_sem_stc_gbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3531 sh2::write_stacks &buf)
3533 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3534 sem_status status = SEM_STATUS_NORMAL;
3535 sh2_scache* abuf = sem;
3536 unsigned long long written = 0;
3537 PCADDR pc = abuf->addr;
3538 PCADDR npc = pc + 2;
3541 SI opval = current_cpu->h_gbr_get ();
3542 if (UNLIKELY(current_cpu->trace_result_p))
3543 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3544 current_cpu->h_grc_set (FLD (f_rn), opval);
3547 current_cpu->done_insn (npc, status);
3551 // ********** stc-vbr-compact: stc vbr, $rn
3554 sh2_sem_stc_vbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3555 sh2::write_stacks &buf)
3557 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3558 sem_status status = SEM_STATUS_NORMAL;
3559 sh2_scache* abuf = sem;
3560 unsigned long long written = 0;
3561 PCADDR pc = abuf->addr;
3562 PCADDR npc = pc + 2;
3565 SI opval = current_cpu->h_vbr_get ();
3566 if (UNLIKELY(current_cpu->trace_result_p))
3567 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3568 current_cpu->h_grc_set (FLD (f_rn), opval);
3571 current_cpu->done_insn (npc, status);
3575 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
3578 sh2_sem_stcl_gbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3579 sh2::write_stacks &buf)
3581 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3582 sem_status status = SEM_STATUS_NORMAL;
3583 sh2_scache* abuf = sem;
3584 unsigned long long written = 0;
3585 PCADDR pc = abuf->addr;
3586 PCADDR npc = pc + 2;
3590 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3592 SI opval = current_cpu->h_gbr_get ();
3593 if (UNLIKELY(current_cpu->trace_result_p))
3594 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3595 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3598 SI opval = tmp_addr;
3599 if (UNLIKELY(current_cpu->trace_result_p))
3600 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3601 current_cpu->h_grc_set (FLD (f_rn), opval);
3605 current_cpu->done_insn (npc, status);
3609 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
3612 sh2_sem_stcl_vbr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3613 sh2::write_stacks &buf)
3615 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3616 sem_status status = SEM_STATUS_NORMAL;
3617 sh2_scache* abuf = sem;
3618 unsigned long long written = 0;
3619 PCADDR pc = abuf->addr;
3620 PCADDR npc = pc + 2;
3624 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3626 SI opval = current_cpu->h_vbr_get ();
3627 if (UNLIKELY(current_cpu->trace_result_p))
3628 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3629 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3632 SI opval = tmp_addr;
3633 if (UNLIKELY(current_cpu->trace_result_p))
3634 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3635 current_cpu->h_grc_set (FLD (f_rn), opval);
3639 current_cpu->done_insn (npc, status);
3643 // ********** sts-mach-compact: sts mach, $rn
3646 sh2_sem_sts_mach_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3647 sh2::write_stacks &buf)
3649 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3650 sem_status status = SEM_STATUS_NORMAL;
3651 sh2_scache* abuf = sem;
3652 unsigned long long written = 0;
3653 PCADDR pc = abuf->addr;
3654 PCADDR npc = pc + 2;
3657 SI opval = current_cpu->h_mach_get ();
3658 if (UNLIKELY(current_cpu->trace_result_p))
3659 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3660 current_cpu->h_grc_set (FLD (f_rn), opval);
3663 current_cpu->done_insn (npc, status);
3667 // ********** stsl-mach-compact: sts.l mach, @-$rn
3670 sh2_sem_stsl_mach_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3671 sh2::write_stacks &buf)
3673 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3674 sem_status status = SEM_STATUS_NORMAL;
3675 sh2_scache* abuf = sem;
3676 unsigned long long written = 0;
3677 PCADDR pc = abuf->addr;
3678 PCADDR npc = pc + 2;
3682 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3684 SI opval = current_cpu->h_mach_get ();
3685 if (UNLIKELY(current_cpu->trace_result_p))
3686 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3687 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3690 SI opval = tmp_addr;
3691 if (UNLIKELY(current_cpu->trace_result_p))
3692 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3693 current_cpu->h_grc_set (FLD (f_rn), opval);
3697 current_cpu->done_insn (npc, status);
3701 // ********** sts-macl-compact: sts macl, $rn
3704 sh2_sem_sts_macl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3705 sh2::write_stacks &buf)
3707 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3708 sem_status status = SEM_STATUS_NORMAL;
3709 sh2_scache* abuf = sem;
3710 unsigned long long written = 0;
3711 PCADDR pc = abuf->addr;
3712 PCADDR npc = pc + 2;
3715 SI opval = current_cpu->h_macl_get ();
3716 if (UNLIKELY(current_cpu->trace_result_p))
3717 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3718 current_cpu->h_grc_set (FLD (f_rn), opval);
3721 current_cpu->done_insn (npc, status);
3725 // ********** stsl-macl-compact: sts.l macl, @-$rn
3728 sh2_sem_stsl_macl_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3729 sh2::write_stacks &buf)
3731 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3732 sem_status status = SEM_STATUS_NORMAL;
3733 sh2_scache* abuf = sem;
3734 unsigned long long written = 0;
3735 PCADDR pc = abuf->addr;
3736 PCADDR npc = pc + 2;
3740 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3742 SI opval = current_cpu->h_macl_get ();
3743 if (UNLIKELY(current_cpu->trace_result_p))
3744 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3745 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3748 SI opval = tmp_addr;
3749 if (UNLIKELY(current_cpu->trace_result_p))
3750 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3751 current_cpu->h_grc_set (FLD (f_rn), opval);
3755 current_cpu->done_insn (npc, status);
3759 // ********** sts-pr-compact: sts pr, $rn
3762 sh2_sem_sts_pr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3763 sh2::write_stacks &buf)
3765 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3766 sem_status status = SEM_STATUS_NORMAL;
3767 sh2_scache* abuf = sem;
3768 unsigned long long written = 0;
3769 PCADDR pc = abuf->addr;
3770 PCADDR npc = pc + 2;
3773 SI opval = current_cpu->h_pr_get ();
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 // ********** stsl-pr-compact: sts.l pr, @-$rn
3786 sh2_sem_stsl_pr_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3787 sh2::write_stacks &buf)
3789 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3790 sem_status status = SEM_STATUS_NORMAL;
3791 sh2_scache* abuf = sem;
3792 unsigned long long written = 0;
3793 PCADDR pc = abuf->addr;
3794 PCADDR npc = pc + 2;
3798 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3800 SI opval = current_cpu->h_pr_get ();
3801 if (UNLIKELY(current_cpu->trace_result_p))
3802 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3803 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3806 SI opval = tmp_addr;
3807 if (UNLIKELY(current_cpu->trace_result_p))
3808 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3809 current_cpu->h_grc_set (FLD (f_rn), opval);
3813 current_cpu->done_insn (npc, status);
3817 // ********** sub-compact: sub $rm, $rn
3820 sh2_sem_sub_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3821 sh2::write_stacks &buf)
3823 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3824 sem_status status = SEM_STATUS_NORMAL;
3825 sh2_scache* abuf = sem;
3826 unsigned long long written = 0;
3827 PCADDR pc = abuf->addr;
3828 PCADDR npc = pc + 2;
3831 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
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 // ********** subc-compact: subc $rm, $rn
3844 sh2_sem_subc_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3845 sh2::write_stacks &buf)
3847 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3848 sem_status status = SEM_STATUS_NORMAL;
3849 sh2_scache* abuf = sem;
3850 unsigned long long written = 0;
3851 PCADDR pc = abuf->addr;
3852 PCADDR npc = pc + 2;
3856 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3858 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3859 if (UNLIKELY(current_cpu->trace_result_p))
3860 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3861 current_cpu->h_grc_set (FLD (f_rn), opval);
3864 BI opval = tmp_flag;
3865 if (UNLIKELY(current_cpu->trace_result_p))
3866 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3867 current_cpu->h_tbit_set (opval);
3871 current_cpu->done_insn (npc, status);
3875 // ********** subv-compact: subv $rm, $rn
3878 sh2_sem_subv_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3879 sh2::write_stacks &buf)
3881 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3882 sem_status status = SEM_STATUS_NORMAL;
3883 sh2_scache* abuf = sem;
3884 unsigned long long written = 0;
3885 PCADDR pc = abuf->addr;
3886 PCADDR npc = pc + 2;
3890 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
3892 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
3893 if (UNLIKELY(current_cpu->trace_result_p))
3894 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3895 current_cpu->h_grc_set (FLD (f_rn), opval);
3898 BI opval = ((tmp_t) ? (1) : (0));
3899 if (UNLIKELY(current_cpu->trace_result_p))
3900 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3901 current_cpu->h_tbit_set (opval);
3905 current_cpu->done_insn (npc, status);
3909 // ********** swapb-compact: swap.b $rm, $rn
3912 sh2_sem_swapb_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3913 sh2::write_stacks &buf)
3915 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3916 sem_status status = SEM_STATUS_NORMAL;
3917 sh2_scache* abuf = sem;
3918 unsigned long long written = 0;
3919 PCADDR pc = abuf->addr;
3920 PCADDR npc = pc + 2;
3926 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
3927 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
3928 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3930 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
3931 if (UNLIKELY(current_cpu->trace_result_p))
3932 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3933 current_cpu->h_grc_set (FLD (f_rn), opval);
3937 current_cpu->done_insn (npc, status);
3941 // ********** swapw-compact: swap.w $rm, $rn
3944 sh2_sem_swapw_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3945 sh2::write_stacks &buf)
3947 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3948 sem_status status = SEM_STATUS_NORMAL;
3949 sh2_scache* abuf = sem;
3950 unsigned long long written = 0;
3951 PCADDR pc = abuf->addr;
3952 PCADDR npc = pc + 2;
3955 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
3956 if (UNLIKELY(current_cpu->trace_result_p))
3957 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3958 current_cpu->h_grc_set (FLD (f_rn), opval);
3961 current_cpu->done_insn (npc, status);
3965 // ********** tasb-compact: tas.b @$rn
3968 sh2_sem_tasb_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
3969 sh2::write_stacks &buf)
3971 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3972 sem_status status = SEM_STATUS_NORMAL;
3973 sh2_scache* abuf = sem;
3974 unsigned long long written = 0;
3975 PCADDR pc = abuf->addr;
3976 PCADDR npc = pc + 2;
3980 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
3982 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
3983 if (UNLIKELY(current_cpu->trace_result_p))
3984 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3985 current_cpu->h_tbit_set (opval);
3987 tmp_byte = ORQI (tmp_byte, 128);
3989 UQI opval = tmp_byte;
3990 if (UNLIKELY(current_cpu->trace_result_p))
3991 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3992 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3996 current_cpu->done_insn (npc, status);
4000 // ********** trapa-compact: trapa #$uimm8
4003 sh2_sem_trapa_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4004 sh2::write_stacks &buf)
4006 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4007 sem_status status = SEM_STATUS_NORMAL;
4008 sh2_scache* abuf = sem;
4009 unsigned long long written = 0;
4010 PCADDR pc = abuf->addr;
4011 PCADDR npc = pc + 2;
4013 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4015 current_cpu->done_insn (npc, status);
4019 // ********** tst-compact: tst $rm, $rn
4022 sh2_sem_tst_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4023 sh2::write_stacks &buf)
4025 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
4026 sem_status status = SEM_STATUS_NORMAL;
4027 sh2_scache* abuf = sem;
4028 unsigned long long written = 0;
4029 PCADDR pc = abuf->addr;
4030 PCADDR npc = pc + 2;
4033 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
4034 if (UNLIKELY(current_cpu->trace_result_p))
4035 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4036 current_cpu->h_tbit_set (opval);
4039 current_cpu->done_insn (npc, status);
4043 // ********** tsti-compact: tst #$uimm8, r0
4046 sh2_sem_tsti_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4047 sh2::write_stacks &buf)
4049 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4050 sem_status status = SEM_STATUS_NORMAL;
4051 sh2_scache* abuf = sem;
4052 unsigned long long written = 0;
4053 PCADDR pc = abuf->addr;
4054 PCADDR npc = pc + 2;
4057 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
4058 if (UNLIKELY(current_cpu->trace_result_p))
4059 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4060 current_cpu->h_tbit_set (opval);
4063 current_cpu->done_insn (npc, status);
4067 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
4070 sh2_sem_tstb_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4071 sh2::write_stacks &buf)
4073 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4074 sem_status status = SEM_STATUS_NORMAL;
4075 sh2_scache* abuf = sem;
4076 unsigned long long written = 0;
4077 PCADDR pc = abuf->addr;
4078 PCADDR npc = pc + 2;
4082 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4084 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
4085 if (UNLIKELY(current_cpu->trace_result_p))
4086 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4087 current_cpu->h_tbit_set (opval);
4091 current_cpu->done_insn (npc, status);
4095 // ********** xor-compact: xor $rm64, $rn64
4098 sh2_sem_xor_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4099 sh2::write_stacks &buf)
4101 #define FLD(f) abuf->fields.sfmt_and_compact.f
4102 sem_status status = SEM_STATUS_NORMAL;
4103 sh2_scache* abuf = sem;
4104 unsigned long long written = 0;
4105 PCADDR pc = abuf->addr;
4106 PCADDR npc = pc + 2;
4109 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
4110 if (UNLIKELY(current_cpu->trace_result_p))
4111 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4112 current_cpu->h_gr_set (FLD (f_rn), opval);
4115 current_cpu->done_insn (npc, status);
4119 // ********** xori-compact: xor #$uimm8, r0
4122 sh2_sem_xori_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4123 sh2::write_stacks &buf)
4125 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4126 sem_status status = SEM_STATUS_NORMAL;
4127 sh2_scache* abuf = sem;
4128 unsigned long long written = 0;
4129 PCADDR pc = abuf->addr;
4130 PCADDR npc = pc + 2;
4133 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4134 if (UNLIKELY(current_cpu->trace_result_p))
4135 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4136 current_cpu->h_grc_set (((UINT) 0), opval);
4139 current_cpu->done_insn (npc, status);
4143 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
4146 sh2_sem_xorb_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4147 sh2::write_stacks &buf)
4149 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4150 sem_status status = SEM_STATUS_NORMAL;
4151 sh2_scache* abuf = sem;
4152 unsigned long long written = 0;
4153 PCADDR pc = abuf->addr;
4154 PCADDR npc = pc + 2;
4159 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4160 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4162 UQI opval = tmp_data;
4163 if (UNLIKELY(current_cpu->trace_result_p))
4164 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4165 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4169 current_cpu->done_insn (npc, status);
4173 // ********** xtrct-compact: xtrct $rm, $rn
4176 sh2_sem_xtrct_compact (sh2_cpu* current_cpu, sh2_scache* sem, const int tick,
4177 sh2::write_stacks &buf)
4179 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4180 sem_status status = SEM_STATUS_NORMAL;
4181 sh2_scache* abuf = sem;
4182 unsigned long long written = 0;
4183 PCADDR pc = abuf->addr;
4184 PCADDR npc = pc + 2;
4187 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
4188 if (UNLIKELY(current_cpu->trace_result_p))
4189 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4190 current_cpu->h_grc_set (FLD (f_rn), opval);
4193 current_cpu->done_insn (npc, status);