1 /* Simulator instruction semantics for sh3.
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 sh3; // FIXME: namespace organization still wip
19 using namespace sh3; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh3_sem_x_invalid (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
27 sh3::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh3_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 sh3_sem_add_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
50 sh3::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh3_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 sh3_sem_addi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
74 sh3::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh3_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 sh3_sem_addc_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
98 sh3::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh3_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 sh3_sem_addv_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
132 sh3::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh3_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 sh3_sem_and_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
166 sh3::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh3_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 sh3_sem_andi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
190 sh3::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh3_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 sh3_sem_andb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
214 sh3::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh3_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 sh3_sem_bf_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
244 sh3::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh3_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 sh3_sem_bfs_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
272 sh3::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bra_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
309 sh3::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_braf_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
342 sh3::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_addi_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bsr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
375 sh3::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh3_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) % sh3::pipe_sz].push (sh3::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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bsrf_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
414 sh3::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_addi_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh3_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) % sh3::pipe_sz].push (sh3::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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
453 sh3::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh3_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 sh3_sem_bts_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
481 sh3::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_clrmac_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
518 sh3::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh3_scache* abuf = sem;
523 unsigned long long written = 0;
524 PCADDR pc = abuf->addr;
530 if (UNLIKELY(current_cpu->trace_result_p))
531 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
532 current_cpu->h_macl_set (opval);
536 if (UNLIKELY(current_cpu->trace_result_p))
537 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
538 current_cpu->h_mach_set (opval);
542 current_cpu->done_insn (npc, status);
546 // ********** clrs-compact: clrs
549 sh3_sem_clrs_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
550 sh3::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh3_scache* abuf = sem;
555 unsigned long long written = 0;
556 PCADDR pc = abuf->addr;
561 if (UNLIKELY(current_cpu->trace_result_p))
562 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
563 current_cpu->h_sbit_set (opval);
566 current_cpu->done_insn (npc, status);
570 // ********** clrt-compact: clrt
573 sh3_sem_clrt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
574 sh3::write_stacks &buf)
576 #define FLD(f) abuf->fields.fmt_empty.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh3_scache* abuf = sem;
579 unsigned long long written = 0;
580 PCADDR pc = abuf->addr;
585 if (UNLIKELY(current_cpu->trace_result_p))
586 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
587 current_cpu->h_tbit_set (opval);
590 current_cpu->done_insn (npc, status);
594 // ********** cmpeq-compact: cmp/eq $rm, $rn
597 sh3_sem_cmpeq_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
598 sh3::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh3_scache* abuf = sem;
603 unsigned long long written = 0;
604 PCADDR pc = abuf->addr;
608 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
609 if (UNLIKELY(current_cpu->trace_result_p))
610 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
611 current_cpu->h_tbit_set (opval);
614 current_cpu->done_insn (npc, status);
618 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
621 sh3_sem_cmpeqi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
622 sh3::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_andi_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh3_scache* abuf = sem;
627 unsigned long long written = 0;
628 PCADDR pc = abuf->addr;
632 BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
633 if (UNLIKELY(current_cpu->trace_result_p))
634 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
635 current_cpu->h_tbit_set (opval);
638 current_cpu->done_insn (npc, status);
642 // ********** cmpge-compact: cmp/ge $rm, $rn
645 sh3_sem_cmpge_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
646 sh3::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh3_scache* abuf = sem;
651 unsigned long long written = 0;
652 PCADDR pc = abuf->addr;
656 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
657 if (UNLIKELY(current_cpu->trace_result_p))
658 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
659 current_cpu->h_tbit_set (opval);
662 current_cpu->done_insn (npc, status);
666 // ********** cmpgt-compact: cmp/gt $rm, $rn
669 sh3_sem_cmpgt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
670 sh3::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh3_scache* abuf = sem;
675 unsigned long long written = 0;
676 PCADDR pc = abuf->addr;
680 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
681 if (UNLIKELY(current_cpu->trace_result_p))
682 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
683 current_cpu->h_tbit_set (opval);
686 current_cpu->done_insn (npc, status);
690 // ********** cmphi-compact: cmp/hi $rm, $rn
693 sh3_sem_cmphi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
694 sh3::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh3_scache* abuf = sem;
699 unsigned long long written = 0;
700 PCADDR pc = abuf->addr;
704 BI opval = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
705 if (UNLIKELY(current_cpu->trace_result_p))
706 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
707 current_cpu->h_tbit_set (opval);
710 current_cpu->done_insn (npc, status);
714 // ********** cmphs-compact: cmp/hs $rm, $rn
717 sh3_sem_cmphs_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
718 sh3::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh3_scache* abuf = sem;
723 unsigned long long written = 0;
724 PCADDR pc = abuf->addr;
728 BI opval = GEUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
729 if (UNLIKELY(current_cpu->trace_result_p))
730 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
731 current_cpu->h_tbit_set (opval);
734 current_cpu->done_insn (npc, status);
738 // ********** cmppl-compact: cmp/pl $rn
741 sh3_sem_cmppl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
742 sh3::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_addi_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh3_scache* abuf = sem;
747 unsigned long long written = 0;
748 PCADDR pc = abuf->addr;
752 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
753 if (UNLIKELY(current_cpu->trace_result_p))
754 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
755 current_cpu->h_tbit_set (opval);
758 current_cpu->done_insn (npc, status);
762 // ********** cmppz-compact: cmp/pz $rn
765 sh3_sem_cmppz_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
766 sh3::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_addi_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh3_scache* abuf = sem;
771 unsigned long long written = 0;
772 PCADDR pc = abuf->addr;
776 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), 0);
777 if (UNLIKELY(current_cpu->trace_result_p))
778 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
779 current_cpu->h_tbit_set (opval);
782 current_cpu->done_insn (npc, status);
786 // ********** cmpstr-compact: cmp/str $rm, $rn
789 sh3_sem_cmpstr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
790 sh3::write_stacks &buf)
792 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
793 sem_status status = SEM_STATUS_NORMAL;
794 sh3_scache* abuf = sem;
795 unsigned long long written = 0;
796 PCADDR pc = abuf->addr;
802 tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
803 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
804 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
805 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
806 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
808 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
809 if (UNLIKELY(current_cpu->trace_result_p))
810 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
811 current_cpu->h_tbit_set (opval);
815 current_cpu->done_insn (npc, status);
819 // ********** div0s-compact: div0s $rm, $rn
822 sh3_sem_div0s_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
823 sh3::write_stacks &buf)
825 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
826 sem_status status = SEM_STATUS_NORMAL;
827 sh3_scache* abuf = sem;
828 unsigned long long written = 0;
829 PCADDR pc = abuf->addr;
834 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
835 if (UNLIKELY(current_cpu->trace_result_p))
836 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
837 current_cpu->h_qbit_set (opval);
840 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
841 if (UNLIKELY(current_cpu->trace_result_p))
842 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
843 current_cpu->h_mbit_set (opval);
846 BI opval = ((EQSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31))) ? (0) : (1));
847 if (UNLIKELY(current_cpu->trace_result_p))
848 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
849 current_cpu->h_tbit_set (opval);
853 current_cpu->done_insn (npc, status);
857 // ********** div0u-compact: div0u
860 sh3_sem_div0u_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
861 sh3::write_stacks &buf)
863 #define FLD(f) abuf->fields.fmt_empty.f
864 sem_status status = SEM_STATUS_NORMAL;
865 sh3_scache* abuf = sem;
866 unsigned long long written = 0;
867 PCADDR pc = abuf->addr;
873 if (UNLIKELY(current_cpu->trace_result_p))
874 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
875 current_cpu->h_tbit_set (opval);
879 if (UNLIKELY(current_cpu->trace_result_p))
880 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
881 current_cpu->h_qbit_set (opval);
885 if (UNLIKELY(current_cpu->trace_result_p))
886 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
887 current_cpu->h_mbit_set (opval);
891 current_cpu->done_insn (npc, status);
895 // ********** div1-compact: div1 $rm, $rn
898 sh3_sem_div1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
899 sh3::write_stacks &buf)
901 #define FLD(f) abuf->fields.sfmt_macl_compact.f
902 sem_status status = SEM_STATUS_NORMAL;
903 sh3_scache* abuf = sem;
904 unsigned long long written = 0;
905 PCADDR pc = abuf->addr;
912 tmp_oldq = current_cpu->h_qbit_get ();
914 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
915 if (UNLIKELY(current_cpu->trace_result_p))
916 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
917 current_cpu->h_qbit_set (opval);
920 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
921 if (UNLIKELY(current_cpu->trace_result_p))
922 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
923 current_cpu->h_grc_set (FLD (f_rn), opval);
925 if (NOTBI (tmp_oldq)) {
926 if (NOTBI (current_cpu->h_mbit_get ())) {
928 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
930 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
931 if (UNLIKELY(current_cpu->trace_result_p))
932 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
933 current_cpu->h_grc_set (FLD (f_rn), opval);
935 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
936 if (NOTBI (current_cpu->h_qbit_get ())) {
938 BI opval = ((tmp_tmp1) ? (1) : (0));
939 if (UNLIKELY(current_cpu->trace_result_p))
940 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
941 current_cpu->h_qbit_set (opval);
945 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
946 if (UNLIKELY(current_cpu->trace_result_p))
947 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
948 current_cpu->h_qbit_set (opval);
954 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
956 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
957 if (UNLIKELY(current_cpu->trace_result_p))
958 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
959 current_cpu->h_grc_set (FLD (f_rn), opval);
961 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
962 if (NOTBI (current_cpu->h_qbit_get ())) {
964 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
965 if (UNLIKELY(current_cpu->trace_result_p))
966 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
967 current_cpu->h_qbit_set (opval);
971 BI opval = ((tmp_tmp1) ? (1) : (0));
972 if (UNLIKELY(current_cpu->trace_result_p))
973 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
974 current_cpu->h_qbit_set (opval);
980 if (NOTBI (current_cpu->h_mbit_get ())) {
982 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
984 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
985 if (UNLIKELY(current_cpu->trace_result_p))
986 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
987 current_cpu->h_grc_set (FLD (f_rn), opval);
989 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
990 if (NOTBI (current_cpu->h_qbit_get ())) {
992 BI opval = ((tmp_tmp1) ? (1) : (0));
993 if (UNLIKELY(current_cpu->trace_result_p))
994 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
995 current_cpu->h_qbit_set (opval);
999 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1000 if (UNLIKELY(current_cpu->trace_result_p))
1001 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1002 current_cpu->h_qbit_set (opval);
1008 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
1010 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
1011 if (UNLIKELY(current_cpu->trace_result_p))
1012 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1013 current_cpu->h_grc_set (FLD (f_rn), opval);
1015 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
1016 if (NOTBI (current_cpu->h_qbit_get ())) {
1018 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1019 if (UNLIKELY(current_cpu->trace_result_p))
1020 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1021 current_cpu->h_qbit_set (opval);
1025 BI opval = ((tmp_tmp1) ? (1) : (0));
1026 if (UNLIKELY(current_cpu->trace_result_p))
1027 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1028 current_cpu->h_qbit_set (opval);
1035 BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1036 if (UNLIKELY(current_cpu->trace_result_p))
1037 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1038 current_cpu->h_tbit_set (opval);
1042 current_cpu->done_insn (npc, status);
1046 // ********** dmulsl-compact: dmuls.l $rm, $rn
1049 sh3_sem_dmulsl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1050 sh3::write_stacks &buf)
1052 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1053 sem_status status = SEM_STATUS_NORMAL;
1054 sh3_scache* abuf = sem;
1055 unsigned long long written = 0;
1056 PCADDR pc = abuf->addr;
1057 PCADDR npc = pc + 2;
1061 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1063 SI opval = SUBWORDDISI (tmp_result, 0);
1064 if (UNLIKELY(current_cpu->trace_result_p))
1065 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1066 current_cpu->h_mach_set (opval);
1069 SI opval = SUBWORDDISI (tmp_result, 1);
1070 if (UNLIKELY(current_cpu->trace_result_p))
1071 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1072 current_cpu->h_macl_set (opval);
1076 current_cpu->done_insn (npc, status);
1080 // ********** dmulul-compact: dmulu.l $rm, $rn
1083 sh3_sem_dmulul_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1084 sh3::write_stacks &buf)
1086 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1087 sem_status status = SEM_STATUS_NORMAL;
1088 sh3_scache* abuf = sem;
1089 unsigned long long written = 0;
1090 PCADDR pc = abuf->addr;
1091 PCADDR npc = pc + 2;
1095 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1097 SI opval = SUBWORDDISI (tmp_result, 0);
1098 if (UNLIKELY(current_cpu->trace_result_p))
1099 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1100 current_cpu->h_mach_set (opval);
1103 SI opval = SUBWORDDISI (tmp_result, 1);
1104 if (UNLIKELY(current_cpu->trace_result_p))
1105 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1106 current_cpu->h_macl_set (opval);
1110 current_cpu->done_insn (npc, status);
1114 // ********** dt-compact: dt $rn
1117 sh3_sem_dt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1118 sh3::write_stacks &buf)
1120 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1121 sem_status status = SEM_STATUS_NORMAL;
1122 sh3_scache* abuf = sem;
1123 unsigned long long written = 0;
1124 PCADDR pc = abuf->addr;
1125 PCADDR npc = pc + 2;
1129 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1130 if (UNLIKELY(current_cpu->trace_result_p))
1131 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1132 current_cpu->h_grc_set (FLD (f_rn), opval);
1135 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1136 if (UNLIKELY(current_cpu->trace_result_p))
1137 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1138 current_cpu->h_tbit_set (opval);
1142 current_cpu->done_insn (npc, status);
1146 // ********** extsb-compact: exts.b $rm, $rn
1149 sh3_sem_extsb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1150 sh3::write_stacks &buf)
1152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1153 sem_status status = SEM_STATUS_NORMAL;
1154 sh3_scache* abuf = sem;
1155 unsigned long long written = 0;
1156 PCADDR pc = abuf->addr;
1157 PCADDR npc = pc + 2;
1160 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1161 if (UNLIKELY(current_cpu->trace_result_p))
1162 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1163 current_cpu->h_grc_set (FLD (f_rn), opval);
1166 current_cpu->done_insn (npc, status);
1170 // ********** extsw-compact: exts.w $rm, $rn
1173 sh3_sem_extsw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1174 sh3::write_stacks &buf)
1176 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1177 sem_status status = SEM_STATUS_NORMAL;
1178 sh3_scache* abuf = sem;
1179 unsigned long long written = 0;
1180 PCADDR pc = abuf->addr;
1181 PCADDR npc = pc + 2;
1184 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1185 if (UNLIKELY(current_cpu->trace_result_p))
1186 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1187 current_cpu->h_grc_set (FLD (f_rn), opval);
1190 current_cpu->done_insn (npc, status);
1194 // ********** extub-compact: extu.b $rm, $rn
1197 sh3_sem_extub_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1198 sh3::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh3_scache* abuf = sem;
1203 unsigned long long written = 0;
1204 PCADDR pc = abuf->addr;
1205 PCADDR npc = pc + 2;
1208 SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1209 if (UNLIKELY(current_cpu->trace_result_p))
1210 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1211 current_cpu->h_grc_set (FLD (f_rn), opval);
1214 current_cpu->done_insn (npc, status);
1218 // ********** extuw-compact: extu.w $rm, $rn
1221 sh3_sem_extuw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1222 sh3::write_stacks &buf)
1224 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh3_scache* abuf = sem;
1227 unsigned long long written = 0;
1228 PCADDR pc = abuf->addr;
1229 PCADDR npc = pc + 2;
1232 SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1233 if (UNLIKELY(current_cpu->trace_result_p))
1234 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1235 current_cpu->h_grc_set (FLD (f_rn), opval);
1238 current_cpu->done_insn (npc, status);
1242 // ********** frchg-compact: frchg
1245 sh3_sem_frchg_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1246 sh3::write_stacks &buf)
1248 #define FLD(f) abuf->fields.fmt_empty.f
1249 sem_status status = SEM_STATUS_NORMAL;
1250 sh3_scache* abuf = sem;
1251 unsigned long long written = 0;
1252 PCADDR pc = abuf->addr;
1253 PCADDR npc = pc + 2;
1256 BI opval = NOTBI (current_cpu->h_frbit_get ());
1257 if (UNLIKELY(current_cpu->trace_result_p))
1258 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
1259 current_cpu->h_frbit_set (opval);
1262 current_cpu->done_insn (npc, status);
1266 // ********** fschg-compact: fschg
1269 sh3_sem_fschg_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1270 sh3::write_stacks &buf)
1272 #define FLD(f) abuf->fields.fmt_empty.f
1273 sem_status status = SEM_STATUS_NORMAL;
1274 sh3_scache* abuf = sem;
1275 unsigned long long written = 0;
1276 PCADDR pc = abuf->addr;
1277 PCADDR npc = pc + 2;
1280 BI opval = NOTBI (current_cpu->h_szbit_get ());
1281 if (UNLIKELY(current_cpu->trace_result_p))
1282 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
1283 current_cpu->h_szbit_set (opval);
1286 current_cpu->done_insn (npc, status);
1290 // ********** jmp-compact: jmp @$rn
1293 sh3_sem_jmp_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1294 sh3::write_stacks &buf)
1296 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1297 sem_status status = SEM_STATUS_NORMAL;
1298 sh3_scache* abuf = sem;
1299 unsigned long long written = 0;
1300 PCADDR pc = abuf->addr;
1301 PCADDR npc = pc + 2;
1305 UDI opval = ADDDI (pc, 2);
1306 if (UNLIKELY(current_cpu->trace_result_p))
1307 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1308 current_cpu->branch (opval, npc, status);
1310 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1312 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1313 buf.h_pc_writes [(tick + 1) % sh3::pipe_sz].push (sh3::write<UDI>(pc, opval));
1314 if (UNLIKELY(current_cpu->trace_result_p))
1315 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1317 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1320 current_cpu->done_cti_insn (npc, status);
1324 // ********** jsr-compact: jsr @$rn
1327 sh3_sem_jsr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1328 sh3::write_stacks &buf)
1330 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1331 sem_status status = SEM_STATUS_NORMAL;
1332 sh3_scache* abuf = sem;
1333 unsigned long long written = 0;
1334 PCADDR pc = abuf->addr;
1335 PCADDR npc = pc + 2;
1339 SI opval = ADDDI (pc, 4);
1340 buf.h_pr_writes [(tick + 1) % sh3::pipe_sz].push (sh3::write<SI>(pc, opval));
1341 if (UNLIKELY(current_cpu->trace_result_p))
1342 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1345 UDI opval = ADDDI (pc, 2);
1346 if (UNLIKELY(current_cpu->trace_result_p))
1347 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1348 current_cpu->branch (opval, npc, status);
1350 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1352 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1353 buf.h_pc_writes [(tick + 1) % sh3::pipe_sz].push (sh3::write<UDI>(pc, opval));
1354 if (UNLIKELY(current_cpu->trace_result_p))
1355 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1357 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1360 current_cpu->done_cti_insn (npc, status);
1364 // ********** ldc-gbr-compact: ldc $rn, gbr
1367 sh3_sem_ldc_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1368 sh3::write_stacks &buf)
1370 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1371 sem_status status = SEM_STATUS_NORMAL;
1372 sh3_scache* abuf = sem;
1373 unsigned long long written = 0;
1374 PCADDR pc = abuf->addr;
1375 PCADDR npc = pc + 2;
1378 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1379 if (UNLIKELY(current_cpu->trace_result_p))
1380 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1381 current_cpu->h_gbr_set (opval);
1384 current_cpu->done_insn (npc, status);
1388 // ********** ldc-vbr-compact: ldc $rn, vbr
1391 sh3_sem_ldc_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1392 sh3::write_stacks &buf)
1394 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1395 sem_status status = SEM_STATUS_NORMAL;
1396 sh3_scache* abuf = sem;
1397 unsigned long long written = 0;
1398 PCADDR pc = abuf->addr;
1399 PCADDR npc = pc + 2;
1402 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1403 if (UNLIKELY(current_cpu->trace_result_p))
1404 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1405 current_cpu->h_vbr_set (opval);
1408 current_cpu->done_insn (npc, status);
1412 // ********** ldc-sr-compact: ldc $rn, sr
1415 sh3_sem_ldc_sr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1416 sh3::write_stacks &buf)
1418 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1419 sem_status status = SEM_STATUS_NORMAL;
1420 sh3_scache* abuf = sem;
1421 unsigned long long written = 0;
1422 PCADDR pc = abuf->addr;
1423 PCADDR npc = pc + 2;
1426 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1427 if (UNLIKELY(current_cpu->trace_result_p))
1428 current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << " ";
1429 current_cpu->hardware.h_sr = opval;
1432 current_cpu->done_insn (npc, status);
1436 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
1439 sh3_sem_ldcl_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1440 sh3::write_stacks &buf)
1442 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1443 sem_status status = SEM_STATUS_NORMAL;
1444 sh3_scache* abuf = sem;
1445 unsigned long long written = 0;
1446 PCADDR pc = abuf->addr;
1447 PCADDR npc = pc + 2;
1451 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1452 if (UNLIKELY(current_cpu->trace_result_p))
1453 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1454 current_cpu->h_gbr_set (opval);
1457 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1458 if (UNLIKELY(current_cpu->trace_result_p))
1459 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1460 current_cpu->h_grc_set (FLD (f_rn), opval);
1464 current_cpu->done_insn (npc, status);
1468 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
1471 sh3_sem_ldcl_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1472 sh3::write_stacks &buf)
1474 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1475 sem_status status = SEM_STATUS_NORMAL;
1476 sh3_scache* abuf = sem;
1477 unsigned long long written = 0;
1478 PCADDR pc = abuf->addr;
1479 PCADDR npc = pc + 2;
1483 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1484 if (UNLIKELY(current_cpu->trace_result_p))
1485 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1486 current_cpu->h_vbr_set (opval);
1489 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1490 if (UNLIKELY(current_cpu->trace_result_p))
1491 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1492 current_cpu->h_grc_set (FLD (f_rn), opval);
1496 current_cpu->done_insn (npc, status);
1500 // ********** lds-mach-compact: lds $rn, mach
1503 sh3_sem_lds_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1504 sh3::write_stacks &buf)
1506 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1507 sem_status status = SEM_STATUS_NORMAL;
1508 sh3_scache* abuf = sem;
1509 unsigned long long written = 0;
1510 PCADDR pc = abuf->addr;
1511 PCADDR npc = pc + 2;
1514 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1515 if (UNLIKELY(current_cpu->trace_result_p))
1516 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1517 current_cpu->h_mach_set (opval);
1520 current_cpu->done_insn (npc, status);
1524 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
1527 sh3_sem_ldsl_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1528 sh3::write_stacks &buf)
1530 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1531 sem_status status = SEM_STATUS_NORMAL;
1532 sh3_scache* abuf = sem;
1533 unsigned long long written = 0;
1534 PCADDR pc = abuf->addr;
1535 PCADDR npc = pc + 2;
1539 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1540 if (UNLIKELY(current_cpu->trace_result_p))
1541 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1542 current_cpu->h_mach_set (opval);
1545 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1546 if (UNLIKELY(current_cpu->trace_result_p))
1547 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1548 current_cpu->h_grc_set (FLD (f_rn), opval);
1552 current_cpu->done_insn (npc, status);
1556 // ********** lds-macl-compact: lds $rn, macl
1559 sh3_sem_lds_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1560 sh3::write_stacks &buf)
1562 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1563 sem_status status = SEM_STATUS_NORMAL;
1564 sh3_scache* abuf = sem;
1565 unsigned long long written = 0;
1566 PCADDR pc = abuf->addr;
1567 PCADDR npc = pc + 2;
1570 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1571 if (UNLIKELY(current_cpu->trace_result_p))
1572 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1573 current_cpu->h_macl_set (opval);
1576 current_cpu->done_insn (npc, status);
1580 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
1583 sh3_sem_ldsl_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1584 sh3::write_stacks &buf)
1586 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1587 sem_status status = SEM_STATUS_NORMAL;
1588 sh3_scache* abuf = sem;
1589 unsigned long long written = 0;
1590 PCADDR pc = abuf->addr;
1591 PCADDR npc = pc + 2;
1595 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1596 if (UNLIKELY(current_cpu->trace_result_p))
1597 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1598 current_cpu->h_macl_set (opval);
1601 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1602 if (UNLIKELY(current_cpu->trace_result_p))
1603 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1604 current_cpu->h_grc_set (FLD (f_rn), opval);
1608 current_cpu->done_insn (npc, status);
1612 // ********** lds-pr-compact: lds $rn, pr
1615 sh3_sem_lds_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1616 sh3::write_stacks &buf)
1618 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1619 sem_status status = SEM_STATUS_NORMAL;
1620 sh3_scache* abuf = sem;
1621 unsigned long long written = 0;
1622 PCADDR pc = abuf->addr;
1623 PCADDR npc = pc + 2;
1626 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1627 if (UNLIKELY(current_cpu->trace_result_p))
1628 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1629 current_cpu->h_pr_set (opval);
1632 current_cpu->done_insn (npc, status);
1636 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
1639 sh3_sem_ldsl_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1640 sh3::write_stacks &buf)
1642 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1643 sem_status status = SEM_STATUS_NORMAL;
1644 sh3_scache* abuf = sem;
1645 unsigned long long written = 0;
1646 PCADDR pc = abuf->addr;
1647 PCADDR npc = pc + 2;
1651 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1652 if (UNLIKELY(current_cpu->trace_result_p))
1653 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1654 current_cpu->h_pr_set (opval);
1657 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1658 if (UNLIKELY(current_cpu->trace_result_p))
1659 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1660 current_cpu->h_grc_set (FLD (f_rn), opval);
1664 current_cpu->done_insn (npc, status);
1668 // ********** macl-compact: mac.l @${rm}+, @${rn}+
1671 sh3_sem_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1672 sh3::write_stacks &buf)
1674 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1675 sem_status status = SEM_STATUS_NORMAL;
1676 sh3_scache* abuf = sem;
1677 unsigned long long written = 0;
1678 PCADDR pc = abuf->addr;
1679 PCADDR npc = pc + 2;
1687 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1689 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1690 if (UNLIKELY(current_cpu->trace_result_p))
1691 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1692 current_cpu->h_grc_set (FLD (f_rn), opval);
1694 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1697 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1698 if (UNLIKELY(current_cpu->trace_result_p))
1699 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1700 current_cpu->h_grc_set (FLD (f_rn), opval);
1703 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1704 written |= (1ULL << 11);
1705 if (UNLIKELY(current_cpu->trace_result_p))
1706 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1707 current_cpu->h_grc_set (FLD (f_rm), opval);
1711 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1713 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1714 written |= (1ULL << 11);
1715 if (UNLIKELY(current_cpu->trace_result_p))
1716 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1717 current_cpu->h_grc_set (FLD (f_rm), opval);
1719 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
1720 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1721 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
1723 if (current_cpu->h_sbit_get ()) {
1727 tmp_max = SRLDI (INVDI (0), 16);
1728 tmp_min = SRLDI (INVDI (0), 15);
1729 if (GTDI (tmp_result, tmp_max)) {
1730 tmp_result = tmp_max;
1732 if (LTDI (tmp_result, tmp_min)) {
1733 tmp_result = tmp_min;
1739 SI opval = SUBWORDDISI (tmp_result, 0);
1740 if (UNLIKELY(current_cpu->trace_result_p))
1741 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1742 current_cpu->h_mach_set (opval);
1745 SI opval = SUBWORDDISI (tmp_result, 1);
1746 if (UNLIKELY(current_cpu->trace_result_p))
1747 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1748 current_cpu->h_macl_set (opval);
1753 abuf->written = written;
1754 current_cpu->done_insn (npc, status);
1758 // ********** macw-compact: mac.w @${rm}+, @${rn}+
1761 sh3_sem_macw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1762 sh3::write_stacks &buf)
1764 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1765 sem_status status = SEM_STATUS_NORMAL;
1766 sh3_scache* abuf = sem;
1767 unsigned long long written = 0;
1768 PCADDR pc = abuf->addr;
1769 PCADDR npc = pc + 2;
1777 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1779 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1780 if (UNLIKELY(current_cpu->trace_result_p))
1781 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1782 current_cpu->h_grc_set (FLD (f_rn), opval);
1784 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1787 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1788 if (UNLIKELY(current_cpu->trace_result_p))
1789 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1790 current_cpu->h_grc_set (FLD (f_rn), opval);
1793 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1794 written |= (1ULL << 11);
1795 if (UNLIKELY(current_cpu->trace_result_p))
1796 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1797 current_cpu->h_grc_set (FLD (f_rm), opval);
1801 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1803 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1804 written |= (1ULL << 11);
1805 if (UNLIKELY(current_cpu->trace_result_p))
1806 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1807 current_cpu->h_grc_set (FLD (f_rm), opval);
1809 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
1810 if (current_cpu->h_sbit_get ()) {
1812 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
1815 written |= (1ULL << 9);
1816 if (UNLIKELY(current_cpu->trace_result_p))
1817 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1818 current_cpu->h_mach_set (opval);
1822 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
1823 written |= (1ULL << 10);
1824 if (UNLIKELY(current_cpu->trace_result_p))
1825 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1826 current_cpu->h_macl_set (opval);
1831 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1832 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
1834 SI opval = SUBWORDDISI (tmp_result, 0);
1835 written |= (1ULL << 9);
1836 if (UNLIKELY(current_cpu->trace_result_p))
1837 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1838 current_cpu->h_mach_set (opval);
1841 SI opval = SUBWORDDISI (tmp_result, 1);
1842 written |= (1ULL << 10);
1843 if (UNLIKELY(current_cpu->trace_result_p))
1844 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1845 current_cpu->h_macl_set (opval);
1851 abuf->written = written;
1852 current_cpu->done_insn (npc, status);
1856 // ********** mov-compact: mov $rm64, $rn64
1859 sh3_sem_mov_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1860 sh3::write_stacks &buf)
1862 #define FLD(f) abuf->fields.sfmt_and_compact.f
1863 sem_status status = SEM_STATUS_NORMAL;
1864 sh3_scache* abuf = sem;
1865 unsigned long long written = 0;
1866 PCADDR pc = abuf->addr;
1867 PCADDR npc = pc + 2;
1870 DI opval = current_cpu->h_gr_get (FLD (f_rm));
1871 if (UNLIKELY(current_cpu->trace_result_p))
1872 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1873 current_cpu->h_gr_set (FLD (f_rn), opval);
1876 current_cpu->done_insn (npc, status);
1880 // ********** movi-compact: mov #$imm8, $rn
1883 sh3_sem_movi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1884 sh3::write_stacks &buf)
1886 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1887 sem_status status = SEM_STATUS_NORMAL;
1888 sh3_scache* abuf = sem;
1889 unsigned long long written = 0;
1890 PCADDR pc = abuf->addr;
1891 PCADDR npc = pc + 2;
1894 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
1895 if (UNLIKELY(current_cpu->trace_result_p))
1896 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1897 current_cpu->h_grc_set (FLD (f_rn), opval);
1900 current_cpu->done_insn (npc, status);
1904 // ********** movb1-compact: mov.b $rm, @$rn
1907 sh3_sem_movb1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1908 sh3::write_stacks &buf)
1910 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1911 sem_status status = SEM_STATUS_NORMAL;
1912 sh3_scache* abuf = sem;
1913 unsigned long long written = 0;
1914 PCADDR pc = abuf->addr;
1915 PCADDR npc = pc + 2;
1918 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1919 if (UNLIKELY(current_cpu->trace_result_p))
1920 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1921 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1924 current_cpu->done_insn (npc, status);
1928 // ********** movb2-compact: mov.b $rm, @-$rn
1931 sh3_sem_movb2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1932 sh3::write_stacks &buf)
1934 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1935 sem_status status = SEM_STATUS_NORMAL;
1936 sh3_scache* abuf = sem;
1937 unsigned long long written = 0;
1938 PCADDR pc = abuf->addr;
1939 PCADDR npc = pc + 2;
1943 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1945 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1946 if (UNLIKELY(current_cpu->trace_result_p))
1947 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1948 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
1951 SI opval = tmp_addr;
1952 if (UNLIKELY(current_cpu->trace_result_p))
1953 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1954 current_cpu->h_grc_set (FLD (f_rn), opval);
1958 current_cpu->done_insn (npc, status);
1962 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
1965 sh3_sem_movb3_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1966 sh3::write_stacks &buf)
1968 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
1969 sem_status status = SEM_STATUS_NORMAL;
1970 sh3_scache* abuf = sem;
1971 unsigned long long written = 0;
1972 PCADDR pc = abuf->addr;
1973 PCADDR npc = pc + 2;
1976 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1977 if (UNLIKELY(current_cpu->trace_result_p))
1978 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1979 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1982 current_cpu->done_insn (npc, status);
1986 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
1989 sh3_sem_movb4_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
1990 sh3::write_stacks &buf)
1992 #define FLD(f) abuf->fields.sfmt_andi_compact.f
1993 sem_status status = SEM_STATUS_NORMAL;
1994 sh3_scache* abuf = sem;
1995 unsigned long long written = 0;
1996 PCADDR pc = abuf->addr;
1997 PCADDR npc = pc + 2;
2001 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
2003 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2004 if (UNLIKELY(current_cpu->trace_result_p))
2005 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2006 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2010 current_cpu->done_insn (npc, status);
2014 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
2017 sh3_sem_movb5_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2018 sh3::write_stacks &buf)
2020 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2021 sem_status status = SEM_STATUS_NORMAL;
2022 sh3_scache* abuf = sem;
2023 unsigned long long written = 0;
2024 PCADDR pc = abuf->addr;
2025 PCADDR npc = pc + 2;
2029 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2031 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2032 if (UNLIKELY(current_cpu->trace_result_p))
2033 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2034 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2038 current_cpu->done_insn (npc, status);
2042 // ********** movb6-compact: mov.b @$rm, $rn
2045 sh3_sem_movb6_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2046 sh3::write_stacks &buf)
2048 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2049 sem_status status = SEM_STATUS_NORMAL;
2050 sh3_scache* abuf = sem;
2051 unsigned long long written = 0;
2052 PCADDR pc = abuf->addr;
2053 PCADDR npc = pc + 2;
2056 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2057 if (UNLIKELY(current_cpu->trace_result_p))
2058 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2059 current_cpu->h_grc_set (FLD (f_rn), opval);
2062 current_cpu->done_insn (npc, status);
2066 // ********** movb7-compact: mov.b @${rm}+, $rn
2069 sh3_sem_movb7_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2070 sh3::write_stacks &buf)
2072 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2073 sem_status status = SEM_STATUS_NORMAL;
2074 sh3_scache* abuf = sem;
2075 unsigned long long written = 0;
2076 PCADDR pc = abuf->addr;
2077 PCADDR npc = pc + 2;
2081 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2082 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2084 SI opval = EXTQISI (tmp_data);
2085 written |= (1ULL << 4);
2086 if (UNLIKELY(current_cpu->trace_result_p))
2087 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2088 current_cpu->h_grc_set (FLD (f_rm), opval);
2092 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2093 written |= (1ULL << 4);
2094 if (UNLIKELY(current_cpu->trace_result_p))
2095 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2096 current_cpu->h_grc_set (FLD (f_rm), opval);
2100 SI opval = EXTQISI (tmp_data);
2101 if (UNLIKELY(current_cpu->trace_result_p))
2102 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2103 current_cpu->h_grc_set (FLD (f_rn), opval);
2107 abuf->written = written;
2108 current_cpu->done_insn (npc, status);
2112 // ********** movb8-compact: mov.b @(r0, $rm), $rn
2115 sh3_sem_movb8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2116 sh3::write_stacks &buf)
2118 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2119 sem_status status = SEM_STATUS_NORMAL;
2120 sh3_scache* abuf = sem;
2121 unsigned long long written = 0;
2122 PCADDR pc = abuf->addr;
2123 PCADDR npc = pc + 2;
2126 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2127 if (UNLIKELY(current_cpu->trace_result_p))
2128 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2129 current_cpu->h_grc_set (FLD (f_rn), opval);
2132 current_cpu->done_insn (npc, status);
2136 // ********** movb9-compact: mov.b @($imm8, gbr), r0
2139 sh3_sem_movb9_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2140 sh3::write_stacks &buf)
2142 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2143 sem_status status = SEM_STATUS_NORMAL;
2144 sh3_scache* abuf = sem;
2145 unsigned long long written = 0;
2146 PCADDR pc = abuf->addr;
2147 PCADDR npc = pc + 2;
2150 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
2151 if (UNLIKELY(current_cpu->trace_result_p))
2152 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2153 current_cpu->h_grc_set (((UINT) 0), opval);
2156 current_cpu->done_insn (npc, status);
2160 // ********** movb10-compact: mov.b @($imm4, $rm), r0
2163 sh3_sem_movb10_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2164 sh3::write_stacks &buf)
2166 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2167 sem_status status = SEM_STATUS_NORMAL;
2168 sh3_scache* abuf = sem;
2169 unsigned long long written = 0;
2170 PCADDR pc = abuf->addr;
2171 PCADDR npc = pc + 2;
2174 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
2175 if (UNLIKELY(current_cpu->trace_result_p))
2176 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2177 current_cpu->h_grc_set (((UINT) 0), opval);
2180 current_cpu->done_insn (npc, status);
2184 // ********** movl1-compact: mov.l $rm, @$rn
2187 sh3_sem_movl1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2188 sh3::write_stacks &buf)
2190 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2191 sem_status status = SEM_STATUS_NORMAL;
2192 sh3_scache* abuf = sem;
2193 unsigned long long written = 0;
2194 PCADDR pc = abuf->addr;
2195 PCADDR npc = pc + 2;
2198 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2199 if (UNLIKELY(current_cpu->trace_result_p))
2200 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2201 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2204 current_cpu->done_insn (npc, status);
2208 // ********** movl2-compact: mov.l $rm, @-$rn
2211 sh3_sem_movl2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2212 sh3::write_stacks &buf)
2214 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2215 sem_status status = SEM_STATUS_NORMAL;
2216 sh3_scache* abuf = sem;
2217 unsigned long long written = 0;
2218 PCADDR pc = abuf->addr;
2219 PCADDR npc = pc + 2;
2223 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2225 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2226 if (UNLIKELY(current_cpu->trace_result_p))
2227 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2228 current_cpu->SETMEMSI (pc, tmp_addr, opval);
2231 SI opval = tmp_addr;
2232 if (UNLIKELY(current_cpu->trace_result_p))
2233 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2234 current_cpu->h_grc_set (FLD (f_rn), opval);
2238 current_cpu->done_insn (npc, status);
2242 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
2245 sh3_sem_movl3_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2246 sh3::write_stacks &buf)
2248 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2249 sem_status status = SEM_STATUS_NORMAL;
2250 sh3_scache* abuf = sem;
2251 unsigned long long written = 0;
2252 PCADDR pc = abuf->addr;
2253 PCADDR npc = pc + 2;
2256 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2257 if (UNLIKELY(current_cpu->trace_result_p))
2258 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2259 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2262 current_cpu->done_insn (npc, status);
2266 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
2269 sh3_sem_movl4_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2270 sh3::write_stacks &buf)
2272 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
2273 sem_status status = SEM_STATUS_NORMAL;
2274 sh3_scache* abuf = sem;
2275 unsigned long long written = 0;
2276 PCADDR pc = abuf->addr;
2277 PCADDR npc = pc + 2;
2280 SI opval = current_cpu->h_grc_get (((UINT) 0));
2281 if (UNLIKELY(current_cpu->trace_result_p))
2282 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2283 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
2286 current_cpu->done_insn (npc, status);
2290 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
2293 sh3_sem_movl5_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2294 sh3::write_stacks &buf)
2296 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2297 sem_status status = SEM_STATUS_NORMAL;
2298 sh3_scache* abuf = sem;
2299 unsigned long long written = 0;
2300 PCADDR pc = abuf->addr;
2301 PCADDR npc = pc + 2;
2304 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2305 if (UNLIKELY(current_cpu->trace_result_p))
2306 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2307 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
2310 current_cpu->done_insn (npc, status);
2314 // ********** movl6-compact: mov.l @$rm, $rn
2317 sh3_sem_movl6_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2318 sh3::write_stacks &buf)
2320 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2321 sem_status status = SEM_STATUS_NORMAL;
2322 sh3_scache* abuf = sem;
2323 unsigned long long written = 0;
2324 PCADDR pc = abuf->addr;
2325 PCADDR npc = pc + 2;
2328 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2329 if (UNLIKELY(current_cpu->trace_result_p))
2330 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2331 current_cpu->h_grc_set (FLD (f_rn), opval);
2334 current_cpu->done_insn (npc, status);
2338 // ********** movl7-compact: mov.l @${rm}+, $rn
2341 sh3_sem_movl7_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2342 sh3::write_stacks &buf)
2344 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2345 sem_status status = SEM_STATUS_NORMAL;
2346 sh3_scache* abuf = sem;
2347 unsigned long long written = 0;
2348 PCADDR pc = abuf->addr;
2349 PCADDR npc = pc + 2;
2353 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2354 if (UNLIKELY(current_cpu->trace_result_p))
2355 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2356 current_cpu->h_grc_set (FLD (f_rn), opval);
2358 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2360 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2361 written |= (1ULL << 5);
2362 if (UNLIKELY(current_cpu->trace_result_p))
2363 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2364 current_cpu->h_grc_set (FLD (f_rm), opval);
2368 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2369 written |= (1ULL << 5);
2370 if (UNLIKELY(current_cpu->trace_result_p))
2371 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2372 current_cpu->h_grc_set (FLD (f_rm), opval);
2377 abuf->written = written;
2378 current_cpu->done_insn (npc, status);
2382 // ********** movl8-compact: mov.l @(r0, $rm), $rn
2385 sh3_sem_movl8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2386 sh3::write_stacks &buf)
2388 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2389 sem_status status = SEM_STATUS_NORMAL;
2390 sh3_scache* abuf = sem;
2391 unsigned long long written = 0;
2392 PCADDR pc = abuf->addr;
2393 PCADDR npc = pc + 2;
2396 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
2397 if (UNLIKELY(current_cpu->trace_result_p))
2398 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2399 current_cpu->h_grc_set (FLD (f_rn), opval);
2402 current_cpu->done_insn (npc, status);
2406 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
2409 sh3_sem_movl9_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2410 sh3::write_stacks &buf)
2412 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2413 sem_status status = SEM_STATUS_NORMAL;
2414 sh3_scache* abuf = sem;
2415 unsigned long long written = 0;
2416 PCADDR pc = abuf->addr;
2417 PCADDR npc = pc + 2;
2420 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
2421 if (UNLIKELY(current_cpu->trace_result_p))
2422 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2423 current_cpu->h_grc_set (((UINT) 0), opval);
2426 current_cpu->done_insn (npc, status);
2430 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
2433 sh3_sem_movl10_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2434 sh3::write_stacks &buf)
2436 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
2437 sem_status status = SEM_STATUS_NORMAL;
2438 sh3_scache* abuf = sem;
2439 unsigned long long written = 0;
2440 PCADDR pc = abuf->addr;
2441 PCADDR npc = pc + 2;
2444 SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
2445 if (UNLIKELY(current_cpu->trace_result_p))
2446 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2447 current_cpu->h_grc_set (FLD (f_rn), opval);
2450 current_cpu->done_insn (npc, status);
2454 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
2457 sh3_sem_movl11_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2458 sh3::write_stacks &buf)
2460 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2461 sem_status status = SEM_STATUS_NORMAL;
2462 sh3_scache* abuf = sem;
2463 unsigned long long written = 0;
2464 PCADDR pc = abuf->addr;
2465 PCADDR npc = pc + 2;
2468 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
2469 if (UNLIKELY(current_cpu->trace_result_p))
2470 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2471 current_cpu->h_grc_set (FLD (f_rn), opval);
2474 current_cpu->done_insn (npc, status);
2478 // ********** movw1-compact: mov.w $rm, @$rn
2481 sh3_sem_movw1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2482 sh3::write_stacks &buf)
2484 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2485 sem_status status = SEM_STATUS_NORMAL;
2486 sh3_scache* abuf = sem;
2487 unsigned long long written = 0;
2488 PCADDR pc = abuf->addr;
2489 PCADDR npc = pc + 2;
2492 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2493 if (UNLIKELY(current_cpu->trace_result_p))
2494 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2495 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2498 current_cpu->done_insn (npc, status);
2502 // ********** movw2-compact: mov.w $rm, @-$rn
2505 sh3_sem_movw2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2506 sh3::write_stacks &buf)
2508 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2509 sem_status status = SEM_STATUS_NORMAL;
2510 sh3_scache* abuf = sem;
2511 unsigned long long written = 0;
2512 PCADDR pc = abuf->addr;
2513 PCADDR npc = pc + 2;
2517 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2519 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2520 if (UNLIKELY(current_cpu->trace_result_p))
2521 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2522 current_cpu->SETMEMHI (pc, tmp_addr, opval);
2525 SI opval = tmp_addr;
2526 if (UNLIKELY(current_cpu->trace_result_p))
2527 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2528 current_cpu->h_grc_set (FLD (f_rn), opval);
2532 current_cpu->done_insn (npc, status);
2536 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
2539 sh3_sem_movw3_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2540 sh3::write_stacks &buf)
2542 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2543 sem_status status = SEM_STATUS_NORMAL;
2544 sh3_scache* abuf = sem;
2545 unsigned long long written = 0;
2546 PCADDR pc = abuf->addr;
2547 PCADDR npc = pc + 2;
2550 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2551 if (UNLIKELY(current_cpu->trace_result_p))
2552 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2553 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2556 current_cpu->done_insn (npc, status);
2560 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
2563 sh3_sem_movw4_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2564 sh3::write_stacks &buf)
2566 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
2567 sem_status status = SEM_STATUS_NORMAL;
2568 sh3_scache* abuf = sem;
2569 unsigned long long written = 0;
2570 PCADDR pc = abuf->addr;
2571 PCADDR npc = pc + 2;
2574 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2575 if (UNLIKELY(current_cpu->trace_result_p))
2576 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2577 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
2580 current_cpu->done_insn (npc, status);
2584 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
2587 sh3_sem_movw5_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2588 sh3::write_stacks &buf)
2590 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
2591 sem_status status = SEM_STATUS_NORMAL;
2592 sh3_scache* abuf = sem;
2593 unsigned long long written = 0;
2594 PCADDR pc = abuf->addr;
2595 PCADDR npc = pc + 2;
2598 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2599 if (UNLIKELY(current_cpu->trace_result_p))
2600 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2601 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
2604 current_cpu->done_insn (npc, status);
2608 // ********** movw6-compact: mov.w @$rm, $rn
2611 sh3_sem_movw6_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2612 sh3::write_stacks &buf)
2614 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2615 sem_status status = SEM_STATUS_NORMAL;
2616 sh3_scache* abuf = sem;
2617 unsigned long long written = 0;
2618 PCADDR pc = abuf->addr;
2619 PCADDR npc = pc + 2;
2622 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2623 if (UNLIKELY(current_cpu->trace_result_p))
2624 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2625 current_cpu->h_grc_set (FLD (f_rn), opval);
2628 current_cpu->done_insn (npc, status);
2632 // ********** movw7-compact: mov.w @${rm}+, $rn
2635 sh3_sem_movw7_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2636 sh3::write_stacks &buf)
2638 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2639 sem_status status = SEM_STATUS_NORMAL;
2640 sh3_scache* abuf = sem;
2641 unsigned long long written = 0;
2642 PCADDR pc = abuf->addr;
2643 PCADDR npc = pc + 2;
2647 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2648 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2650 SI opval = EXTHISI (tmp_data);
2651 written |= (1ULL << 4);
2652 if (UNLIKELY(current_cpu->trace_result_p))
2653 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2654 current_cpu->h_grc_set (FLD (f_rm), opval);
2658 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2659 written |= (1ULL << 4);
2660 if (UNLIKELY(current_cpu->trace_result_p))
2661 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2662 current_cpu->h_grc_set (FLD (f_rm), opval);
2666 SI opval = EXTHISI (tmp_data);
2667 if (UNLIKELY(current_cpu->trace_result_p))
2668 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2669 current_cpu->h_grc_set (FLD (f_rn), opval);
2673 abuf->written = written;
2674 current_cpu->done_insn (npc, status);
2678 // ********** movw8-compact: mov.w @(r0, $rm), $rn
2681 sh3_sem_movw8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2682 sh3::write_stacks &buf)
2684 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2685 sem_status status = SEM_STATUS_NORMAL;
2686 sh3_scache* abuf = sem;
2687 unsigned long long written = 0;
2688 PCADDR pc = abuf->addr;
2689 PCADDR npc = pc + 2;
2692 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2693 if (UNLIKELY(current_cpu->trace_result_p))
2694 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2695 current_cpu->h_grc_set (FLD (f_rn), opval);
2698 current_cpu->done_insn (npc, status);
2702 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
2705 sh3_sem_movw9_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2706 sh3::write_stacks &buf)
2708 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
2709 sem_status status = SEM_STATUS_NORMAL;
2710 sh3_scache* abuf = sem;
2711 unsigned long long written = 0;
2712 PCADDR pc = abuf->addr;
2713 PCADDR npc = pc + 2;
2716 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
2717 if (UNLIKELY(current_cpu->trace_result_p))
2718 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2719 current_cpu->h_grc_set (((UINT) 0), opval);
2722 current_cpu->done_insn (npc, status);
2726 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
2729 sh3_sem_movw10_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2730 sh3::write_stacks &buf)
2732 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2733 sem_status status = SEM_STATUS_NORMAL;
2734 sh3_scache* abuf = sem;
2735 unsigned long long written = 0;
2736 PCADDR pc = abuf->addr;
2737 PCADDR npc = pc + 2;
2740 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
2741 if (UNLIKELY(current_cpu->trace_result_p))
2742 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2743 current_cpu->h_grc_set (FLD (f_rn), opval);
2746 current_cpu->done_insn (npc, status);
2750 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
2753 sh3_sem_movw11_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2754 sh3::write_stacks &buf)
2756 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
2757 sem_status status = SEM_STATUS_NORMAL;
2758 sh3_scache* abuf = sem;
2759 unsigned long long written = 0;
2760 PCADDR pc = abuf->addr;
2761 PCADDR npc = pc + 2;
2764 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
2765 if (UNLIKELY(current_cpu->trace_result_p))
2766 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2767 current_cpu->h_grc_set (((UINT) 0), opval);
2770 current_cpu->done_insn (npc, status);
2774 // ********** mova-compact: mova @($imm8x4, pc), r0
2777 sh3_sem_mova_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2778 sh3::write_stacks &buf)
2780 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2781 sem_status status = SEM_STATUS_NORMAL;
2782 sh3_scache* abuf = sem;
2783 unsigned long long written = 0;
2784 PCADDR pc = abuf->addr;
2785 PCADDR npc = pc + 2;
2788 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
2789 if (UNLIKELY(current_cpu->trace_result_p))
2790 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2791 current_cpu->h_grc_set (((UINT) 0), opval);
2794 current_cpu->done_insn (npc, status);
2798 // ********** movt-compact: movt $rn
2801 sh3_sem_movt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2802 sh3::write_stacks &buf)
2804 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2805 sem_status status = SEM_STATUS_NORMAL;
2806 sh3_scache* abuf = sem;
2807 unsigned long long written = 0;
2808 PCADDR pc = abuf->addr;
2809 PCADDR npc = pc + 2;
2812 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
2813 if (UNLIKELY(current_cpu->trace_result_p))
2814 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2815 current_cpu->h_grc_set (FLD (f_rn), opval);
2818 current_cpu->done_insn (npc, status);
2822 // ********** mull-compact: mul.l $rm, $rn
2825 sh3_sem_mull_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2826 sh3::write_stacks &buf)
2828 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2829 sem_status status = SEM_STATUS_NORMAL;
2830 sh3_scache* abuf = sem;
2831 unsigned long long written = 0;
2832 PCADDR pc = abuf->addr;
2833 PCADDR npc = pc + 2;
2836 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
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 // ********** mulsw-compact: muls.w $rm, $rn
2849 sh3_sem_mulsw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2850 sh3::write_stacks &buf)
2852 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2853 sem_status status = SEM_STATUS_NORMAL;
2854 sh3_scache* abuf = sem;
2855 unsigned long long written = 0;
2856 PCADDR pc = abuf->addr;
2857 PCADDR npc = pc + 2;
2860 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)));
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 // ********** muluw-compact: mulu.w $rm, $rn
2873 sh3_sem_muluw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2874 sh3::write_stacks &buf)
2876 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2877 sem_status status = SEM_STATUS_NORMAL;
2878 sh3_scache* abuf = sem;
2879 unsigned long long written = 0;
2880 PCADDR pc = abuf->addr;
2881 PCADDR npc = pc + 2;
2884 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)));
2885 if (UNLIKELY(current_cpu->trace_result_p))
2886 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2887 current_cpu->h_macl_set (opval);
2890 current_cpu->done_insn (npc, status);
2894 // ********** neg-compact: neg $rm, $rn
2897 sh3_sem_neg_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2898 sh3::write_stacks &buf)
2900 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2901 sem_status status = SEM_STATUS_NORMAL;
2902 sh3_scache* abuf = sem;
2903 unsigned long long written = 0;
2904 PCADDR pc = abuf->addr;
2905 PCADDR npc = pc + 2;
2908 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
2909 if (UNLIKELY(current_cpu->trace_result_p))
2910 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2911 current_cpu->h_grc_set (FLD (f_rn), opval);
2914 current_cpu->done_insn (npc, status);
2918 // ********** negc-compact: negc $rm, $rn
2921 sh3_sem_negc_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2922 sh3::write_stacks &buf)
2924 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2925 sem_status status = SEM_STATUS_NORMAL;
2926 sh3_scache* abuf = sem;
2927 unsigned long long written = 0;
2928 PCADDR pc = abuf->addr;
2929 PCADDR npc = pc + 2;
2933 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
2935 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
2936 if (UNLIKELY(current_cpu->trace_result_p))
2937 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2938 current_cpu->h_grc_set (FLD (f_rn), opval);
2941 BI opval = tmp_flag;
2942 if (UNLIKELY(current_cpu->trace_result_p))
2943 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
2944 current_cpu->h_tbit_set (opval);
2948 current_cpu->done_insn (npc, status);
2952 // ********** nop-compact: nop
2955 sh3_sem_nop_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2956 sh3::write_stacks &buf)
2958 #define FLD(f) abuf->fields.fmt_empty.f
2959 sem_status status = SEM_STATUS_NORMAL;
2960 sh3_scache* abuf = sem;
2961 unsigned long long written = 0;
2962 PCADDR pc = abuf->addr;
2963 PCADDR npc = pc + 2;
2967 current_cpu->done_insn (npc, status);
2971 // ********** not-compact: not $rm64, $rn64
2974 sh3_sem_not_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2975 sh3::write_stacks &buf)
2977 #define FLD(f) abuf->fields.sfmt_and_compact.f
2978 sem_status status = SEM_STATUS_NORMAL;
2979 sh3_scache* abuf = sem;
2980 unsigned long long written = 0;
2981 PCADDR pc = abuf->addr;
2982 PCADDR npc = pc + 2;
2985 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
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 // ********** or-compact: or $rm64, $rn64
2998 sh3_sem_or_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
2999 sh3::write_stacks &buf)
3001 #define FLD(f) abuf->fields.sfmt_and_compact.f
3002 sem_status status = SEM_STATUS_NORMAL;
3003 sh3_scache* abuf = sem;
3004 unsigned long long written = 0;
3005 PCADDR pc = abuf->addr;
3006 PCADDR npc = pc + 2;
3009 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
3010 if (UNLIKELY(current_cpu->trace_result_p))
3011 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3012 current_cpu->h_gr_set (FLD (f_rn), opval);
3015 current_cpu->done_insn (npc, status);
3019 // ********** ori-compact: or #$uimm8, r0
3022 sh3_sem_ori_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3023 sh3::write_stacks &buf)
3025 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3026 sem_status status = SEM_STATUS_NORMAL;
3027 sh3_scache* abuf = sem;
3028 unsigned long long written = 0;
3029 PCADDR pc = abuf->addr;
3030 PCADDR npc = pc + 2;
3033 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3034 if (UNLIKELY(current_cpu->trace_result_p))
3035 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3036 current_cpu->h_grc_set (((UINT) 0), opval);
3039 current_cpu->done_insn (npc, status);
3043 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3046 sh3_sem_orb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3047 sh3::write_stacks &buf)
3049 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3050 sem_status status = SEM_STATUS_NORMAL;
3051 sh3_scache* abuf = sem;
3052 unsigned long long written = 0;
3053 PCADDR pc = abuf->addr;
3054 PCADDR npc = pc + 2;
3059 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3060 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3062 UQI opval = tmp_data;
3063 if (UNLIKELY(current_cpu->trace_result_p))
3064 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3065 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3069 current_cpu->done_insn (npc, status);
3073 // ********** pref-compact: pref @$rn
3076 sh3_sem_pref_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3077 sh3::write_stacks &buf)
3079 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3080 sem_status status = SEM_STATUS_NORMAL;
3081 sh3_scache* abuf = sem;
3082 unsigned long long written = 0;
3083 PCADDR pc = abuf->addr;
3084 PCADDR npc = pc + 2;
3086 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
3088 current_cpu->done_insn (npc, status);
3092 // ********** rotcl-compact: rotcl $rn
3095 sh3_sem_rotcl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3096 sh3::write_stacks &buf)
3098 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3099 sem_status status = SEM_STATUS_NORMAL;
3100 sh3_scache* abuf = sem;
3101 unsigned long long written = 0;
3102 PCADDR pc = abuf->addr;
3103 PCADDR npc = pc + 2;
3107 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3109 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3110 if (UNLIKELY(current_cpu->trace_result_p))
3111 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3112 current_cpu->h_grc_set (FLD (f_rn), opval);
3115 BI opval = ((tmp_temp) ? (1) : (0));
3116 if (UNLIKELY(current_cpu->trace_result_p))
3117 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3118 current_cpu->h_tbit_set (opval);
3122 current_cpu->done_insn (npc, status);
3126 // ********** rotcr-compact: rotcr $rn
3129 sh3_sem_rotcr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3130 sh3::write_stacks &buf)
3132 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3133 sem_status status = SEM_STATUS_NORMAL;
3134 sh3_scache* abuf = sem;
3135 unsigned long long written = 0;
3136 PCADDR pc = abuf->addr;
3137 PCADDR npc = pc + 2;
3142 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3143 tmp_temp = current_cpu->h_tbit_get ();
3145 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3146 if (UNLIKELY(current_cpu->trace_result_p))
3147 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3148 current_cpu->h_grc_set (FLD (f_rn), opval);
3151 BI opval = ((tmp_lsbit) ? (1) : (0));
3152 if (UNLIKELY(current_cpu->trace_result_p))
3153 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3154 current_cpu->h_tbit_set (opval);
3158 current_cpu->done_insn (npc, status);
3162 // ********** rotl-compact: rotl $rn
3165 sh3_sem_rotl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3166 sh3::write_stacks &buf)
3168 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3169 sem_status status = SEM_STATUS_NORMAL;
3170 sh3_scache* abuf = sem;
3171 unsigned long long written = 0;
3172 PCADDR pc = abuf->addr;
3173 PCADDR npc = pc + 2;
3177 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3179 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3180 if (UNLIKELY(current_cpu->trace_result_p))
3181 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3182 current_cpu->h_grc_set (FLD (f_rn), opval);
3185 BI opval = ((tmp_temp) ? (1) : (0));
3186 if (UNLIKELY(current_cpu->trace_result_p))
3187 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3188 current_cpu->h_tbit_set (opval);
3192 current_cpu->done_insn (npc, status);
3196 // ********** rotr-compact: rotr $rn
3199 sh3_sem_rotr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3200 sh3::write_stacks &buf)
3202 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3203 sem_status status = SEM_STATUS_NORMAL;
3204 sh3_scache* abuf = sem;
3205 unsigned long long written = 0;
3206 PCADDR pc = abuf->addr;
3207 PCADDR npc = pc + 2;
3212 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3213 tmp_temp = tmp_lsbit;
3215 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3216 if (UNLIKELY(current_cpu->trace_result_p))
3217 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3218 current_cpu->h_grc_set (FLD (f_rn), opval);
3221 BI opval = ((tmp_lsbit) ? (1) : (0));
3222 if (UNLIKELY(current_cpu->trace_result_p))
3223 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3224 current_cpu->h_tbit_set (opval);
3228 current_cpu->done_insn (npc, status);
3232 // ********** rts-compact: rts
3235 sh3_sem_rts_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3236 sh3::write_stacks &buf)
3238 #define FLD(f) abuf->fields.fmt_empty.f
3239 sem_status status = SEM_STATUS_NORMAL;
3240 sh3_scache* abuf = sem;
3241 unsigned long long written = 0;
3242 PCADDR pc = abuf->addr;
3243 PCADDR npc = pc + 2;
3247 UDI opval = ADDDI (pc, 2);
3248 if (UNLIKELY(current_cpu->trace_result_p))
3249 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3250 current_cpu->branch (opval, npc, status);
3252 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
3254 UDI opval = current_cpu->h_pr_get ();
3255 buf.h_pc_writes [(tick + 1) % sh3::pipe_sz].push (sh3::write<UDI>(pc, opval));
3256 if (UNLIKELY(current_cpu->trace_result_p))
3257 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3259 current_cpu->notify_ret (current_cpu->h_pr_get ());
3262 current_cpu->done_cti_insn (npc, status);
3266 // ********** sets-compact: sets
3269 sh3_sem_sets_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3270 sh3::write_stacks &buf)
3272 #define FLD(f) abuf->fields.fmt_empty.f
3273 sem_status status = SEM_STATUS_NORMAL;
3274 sh3_scache* abuf = sem;
3275 unsigned long long written = 0;
3276 PCADDR pc = abuf->addr;
3277 PCADDR npc = pc + 2;
3281 if (UNLIKELY(current_cpu->trace_result_p))
3282 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
3283 current_cpu->h_sbit_set (opval);
3286 current_cpu->done_insn (npc, status);
3290 // ********** sett-compact: sett
3293 sh3_sem_sett_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3294 sh3::write_stacks &buf)
3296 #define FLD(f) abuf->fields.fmt_empty.f
3297 sem_status status = SEM_STATUS_NORMAL;
3298 sh3_scache* abuf = sem;
3299 unsigned long long written = 0;
3300 PCADDR pc = abuf->addr;
3301 PCADDR npc = pc + 2;
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);
3310 current_cpu->done_insn (npc, status);
3314 // ********** shad-compact: shad $rm, $rn
3317 sh3_sem_shad_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3318 sh3::write_stacks &buf)
3320 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3321 sem_status status = SEM_STATUS_NORMAL;
3322 sh3_scache* abuf = sem;
3323 unsigned long long written = 0;
3324 PCADDR pc = abuf->addr;
3325 PCADDR npc = pc + 2;
3329 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3330 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3332 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3333 written |= (1ULL << 2);
3334 if (UNLIKELY(current_cpu->trace_result_p))
3335 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3336 current_cpu->h_grc_set (FLD (f_rn), opval);
3339 if (NESI (tmp_shamt, 0)) {
3341 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3342 written |= (1ULL << 2);
3343 if (UNLIKELY(current_cpu->trace_result_p))
3344 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3345 current_cpu->h_grc_set (FLD (f_rn), opval);
3348 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
3350 SI opval = NEGSI (1);
3351 written |= (1ULL << 2);
3352 if (UNLIKELY(current_cpu->trace_result_p))
3353 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3354 current_cpu->h_grc_set (FLD (f_rn), opval);
3359 written |= (1ULL << 2);
3360 if (UNLIKELY(current_cpu->trace_result_p))
3361 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3362 current_cpu->h_grc_set (FLD (f_rn), opval);
3369 abuf->written = written;
3370 current_cpu->done_insn (npc, status);
3374 // ********** shal-compact: shal $rn
3377 sh3_sem_shal_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3378 sh3::write_stacks &buf)
3380 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3381 sem_status status = SEM_STATUS_NORMAL;
3382 sh3_scache* abuf = sem;
3383 unsigned long long written = 0;
3384 PCADDR pc = abuf->addr;
3385 PCADDR npc = pc + 2;
3389 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3391 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3392 if (UNLIKELY(current_cpu->trace_result_p))
3393 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3394 current_cpu->h_grc_set (FLD (f_rn), opval);
3397 BI opval = ((tmp_t) ? (1) : (0));
3398 if (UNLIKELY(current_cpu->trace_result_p))
3399 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3400 current_cpu->h_tbit_set (opval);
3404 current_cpu->done_insn (npc, status);
3408 // ********** shar-compact: shar $rn
3411 sh3_sem_shar_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3412 sh3::write_stacks &buf)
3414 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3415 sem_status status = SEM_STATUS_NORMAL;
3416 sh3_scache* abuf = sem;
3417 unsigned long long written = 0;
3418 PCADDR pc = abuf->addr;
3419 PCADDR npc = pc + 2;
3423 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3425 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3426 if (UNLIKELY(current_cpu->trace_result_p))
3427 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3428 current_cpu->h_grc_set (FLD (f_rn), opval);
3431 BI opval = ((tmp_t) ? (1) : (0));
3432 if (UNLIKELY(current_cpu->trace_result_p))
3433 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3434 current_cpu->h_tbit_set (opval);
3438 current_cpu->done_insn (npc, status);
3442 // ********** shld-compact: shld $rm, $rn
3445 sh3_sem_shld_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3446 sh3::write_stacks &buf)
3448 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3449 sem_status status = SEM_STATUS_NORMAL;
3450 sh3_scache* abuf = sem;
3451 unsigned long long written = 0;
3452 PCADDR pc = abuf->addr;
3453 PCADDR npc = pc + 2;
3457 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3458 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3460 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3461 written |= (1ULL << 2);
3462 if (UNLIKELY(current_cpu->trace_result_p))
3463 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3464 current_cpu->h_grc_set (FLD (f_rn), opval);
3467 if (NESI (tmp_shamt, 0)) {
3469 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3470 written |= (1ULL << 2);
3471 if (UNLIKELY(current_cpu->trace_result_p))
3472 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3473 current_cpu->h_grc_set (FLD (f_rn), opval);
3478 written |= (1ULL << 2);
3479 if (UNLIKELY(current_cpu->trace_result_p))
3480 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3481 current_cpu->h_grc_set (FLD (f_rn), opval);
3487 abuf->written = written;
3488 current_cpu->done_insn (npc, status);
3492 // ********** shll-compact: shll $rn
3495 sh3_sem_shll_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3496 sh3::write_stacks &buf)
3498 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3499 sem_status status = SEM_STATUS_NORMAL;
3500 sh3_scache* abuf = sem;
3501 unsigned long long written = 0;
3502 PCADDR pc = abuf->addr;
3503 PCADDR npc = pc + 2;
3507 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3509 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3510 if (UNLIKELY(current_cpu->trace_result_p))
3511 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3512 current_cpu->h_grc_set (FLD (f_rn), opval);
3515 BI opval = ((tmp_t) ? (1) : (0));
3516 if (UNLIKELY(current_cpu->trace_result_p))
3517 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3518 current_cpu->h_tbit_set (opval);
3522 current_cpu->done_insn (npc, status);
3526 // ********** shll2-compact: shll2 $rn
3529 sh3_sem_shll2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3530 sh3::write_stacks &buf)
3532 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3533 sem_status status = SEM_STATUS_NORMAL;
3534 sh3_scache* abuf = sem;
3535 unsigned long long written = 0;
3536 PCADDR pc = abuf->addr;
3537 PCADDR npc = pc + 2;
3540 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3541 if (UNLIKELY(current_cpu->trace_result_p))
3542 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3543 current_cpu->h_grc_set (FLD (f_rn), opval);
3546 current_cpu->done_insn (npc, status);
3550 // ********** shll8-compact: shll8 $rn
3553 sh3_sem_shll8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3554 sh3::write_stacks &buf)
3556 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3557 sem_status status = SEM_STATUS_NORMAL;
3558 sh3_scache* abuf = sem;
3559 unsigned long long written = 0;
3560 PCADDR pc = abuf->addr;
3561 PCADDR npc = pc + 2;
3564 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3565 if (UNLIKELY(current_cpu->trace_result_p))
3566 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3567 current_cpu->h_grc_set (FLD (f_rn), opval);
3570 current_cpu->done_insn (npc, status);
3574 // ********** shll16-compact: shll16 $rn
3577 sh3_sem_shll16_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3578 sh3::write_stacks &buf)
3580 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3581 sem_status status = SEM_STATUS_NORMAL;
3582 sh3_scache* abuf = sem;
3583 unsigned long long written = 0;
3584 PCADDR pc = abuf->addr;
3585 PCADDR npc = pc + 2;
3588 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3589 if (UNLIKELY(current_cpu->trace_result_p))
3590 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3591 current_cpu->h_grc_set (FLD (f_rn), opval);
3594 current_cpu->done_insn (npc, status);
3598 // ********** shlr-compact: shlr $rn
3601 sh3_sem_shlr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3602 sh3::write_stacks &buf)
3604 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3605 sem_status status = SEM_STATUS_NORMAL;
3606 sh3_scache* abuf = sem;
3607 unsigned long long written = 0;
3608 PCADDR pc = abuf->addr;
3609 PCADDR npc = pc + 2;
3613 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3615 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3616 if (UNLIKELY(current_cpu->trace_result_p))
3617 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3618 current_cpu->h_grc_set (FLD (f_rn), opval);
3621 BI opval = ((tmp_t) ? (1) : (0));
3622 if (UNLIKELY(current_cpu->trace_result_p))
3623 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3624 current_cpu->h_tbit_set (opval);
3628 current_cpu->done_insn (npc, status);
3632 // ********** shlr2-compact: shlr2 $rn
3635 sh3_sem_shlr2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3636 sh3::write_stacks &buf)
3638 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3639 sem_status status = SEM_STATUS_NORMAL;
3640 sh3_scache* abuf = sem;
3641 unsigned long long written = 0;
3642 PCADDR pc = abuf->addr;
3643 PCADDR npc = pc + 2;
3646 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3647 if (UNLIKELY(current_cpu->trace_result_p))
3648 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3649 current_cpu->h_grc_set (FLD (f_rn), opval);
3652 current_cpu->done_insn (npc, status);
3656 // ********** shlr8-compact: shlr8 $rn
3659 sh3_sem_shlr8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3660 sh3::write_stacks &buf)
3662 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3663 sem_status status = SEM_STATUS_NORMAL;
3664 sh3_scache* abuf = sem;
3665 unsigned long long written = 0;
3666 PCADDR pc = abuf->addr;
3667 PCADDR npc = pc + 2;
3670 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3671 if (UNLIKELY(current_cpu->trace_result_p))
3672 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3673 current_cpu->h_grc_set (FLD (f_rn), opval);
3676 current_cpu->done_insn (npc, status);
3680 // ********** shlr16-compact: shlr16 $rn
3683 sh3_sem_shlr16_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3684 sh3::write_stacks &buf)
3686 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3687 sem_status status = SEM_STATUS_NORMAL;
3688 sh3_scache* abuf = sem;
3689 unsigned long long written = 0;
3690 PCADDR pc = abuf->addr;
3691 PCADDR npc = pc + 2;
3694 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3695 if (UNLIKELY(current_cpu->trace_result_p))
3696 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3697 current_cpu->h_grc_set (FLD (f_rn), opval);
3700 current_cpu->done_insn (npc, status);
3704 // ********** stc-gbr-compact: stc gbr, $rn
3707 sh3_sem_stc_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3708 sh3::write_stacks &buf)
3710 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3711 sem_status status = SEM_STATUS_NORMAL;
3712 sh3_scache* abuf = sem;
3713 unsigned long long written = 0;
3714 PCADDR pc = abuf->addr;
3715 PCADDR npc = pc + 2;
3718 SI opval = current_cpu->h_gbr_get ();
3719 if (UNLIKELY(current_cpu->trace_result_p))
3720 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3721 current_cpu->h_grc_set (FLD (f_rn), opval);
3724 current_cpu->done_insn (npc, status);
3728 // ********** stc-vbr-compact: stc vbr, $rn
3731 sh3_sem_stc_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3732 sh3::write_stacks &buf)
3734 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3735 sem_status status = SEM_STATUS_NORMAL;
3736 sh3_scache* abuf = sem;
3737 unsigned long long written = 0;
3738 PCADDR pc = abuf->addr;
3739 PCADDR npc = pc + 2;
3742 SI opval = current_cpu->h_vbr_get ();
3743 if (UNLIKELY(current_cpu->trace_result_p))
3744 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3745 current_cpu->h_grc_set (FLD (f_rn), opval);
3748 current_cpu->done_insn (npc, status);
3752 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
3755 sh3_sem_stcl_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3756 sh3::write_stacks &buf)
3758 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3759 sem_status status = SEM_STATUS_NORMAL;
3760 sh3_scache* abuf = sem;
3761 unsigned long long written = 0;
3762 PCADDR pc = abuf->addr;
3763 PCADDR npc = pc + 2;
3767 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3769 SI opval = current_cpu->h_gbr_get ();
3770 if (UNLIKELY(current_cpu->trace_result_p))
3771 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3772 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3775 SI opval = tmp_addr;
3776 if (UNLIKELY(current_cpu->trace_result_p))
3777 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3778 current_cpu->h_grc_set (FLD (f_rn), opval);
3782 current_cpu->done_insn (npc, status);
3786 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
3789 sh3_sem_stcl_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3790 sh3::write_stacks &buf)
3792 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3793 sem_status status = SEM_STATUS_NORMAL;
3794 sh3_scache* abuf = sem;
3795 unsigned long long written = 0;
3796 PCADDR pc = abuf->addr;
3797 PCADDR npc = pc + 2;
3801 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3803 SI opval = current_cpu->h_vbr_get ();
3804 if (UNLIKELY(current_cpu->trace_result_p))
3805 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3806 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3809 SI opval = tmp_addr;
3810 if (UNLIKELY(current_cpu->trace_result_p))
3811 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3812 current_cpu->h_grc_set (FLD (f_rn), opval);
3816 current_cpu->done_insn (npc, status);
3820 // ********** sts-mach-compact: sts mach, $rn
3823 sh3_sem_sts_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3824 sh3::write_stacks &buf)
3826 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3827 sem_status status = SEM_STATUS_NORMAL;
3828 sh3_scache* abuf = sem;
3829 unsigned long long written = 0;
3830 PCADDR pc = abuf->addr;
3831 PCADDR npc = pc + 2;
3834 SI opval = current_cpu->h_mach_get ();
3835 if (UNLIKELY(current_cpu->trace_result_p))
3836 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3837 current_cpu->h_grc_set (FLD (f_rn), opval);
3840 current_cpu->done_insn (npc, status);
3844 // ********** stsl-mach-compact: sts.l mach, @-$rn
3847 sh3_sem_stsl_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3848 sh3::write_stacks &buf)
3850 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3851 sem_status status = SEM_STATUS_NORMAL;
3852 sh3_scache* abuf = sem;
3853 unsigned long long written = 0;
3854 PCADDR pc = abuf->addr;
3855 PCADDR npc = pc + 2;
3859 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3861 SI opval = current_cpu->h_mach_get ();
3862 if (UNLIKELY(current_cpu->trace_result_p))
3863 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3864 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3867 SI opval = tmp_addr;
3868 if (UNLIKELY(current_cpu->trace_result_p))
3869 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3870 current_cpu->h_grc_set (FLD (f_rn), opval);
3874 current_cpu->done_insn (npc, status);
3878 // ********** sts-macl-compact: sts macl, $rn
3881 sh3_sem_sts_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3882 sh3::write_stacks &buf)
3884 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3885 sem_status status = SEM_STATUS_NORMAL;
3886 sh3_scache* abuf = sem;
3887 unsigned long long written = 0;
3888 PCADDR pc = abuf->addr;
3889 PCADDR npc = pc + 2;
3892 SI opval = current_cpu->h_macl_get ();
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 current_cpu->done_insn (npc, status);
3902 // ********** stsl-macl-compact: sts.l macl, @-$rn
3905 sh3_sem_stsl_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3906 sh3::write_stacks &buf)
3908 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3909 sem_status status = SEM_STATUS_NORMAL;
3910 sh3_scache* abuf = sem;
3911 unsigned long long written = 0;
3912 PCADDR pc = abuf->addr;
3913 PCADDR npc = pc + 2;
3917 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3919 SI opval = current_cpu->h_macl_get ();
3920 if (UNLIKELY(current_cpu->trace_result_p))
3921 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3922 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3925 SI opval = tmp_addr;
3926 if (UNLIKELY(current_cpu->trace_result_p))
3927 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3928 current_cpu->h_grc_set (FLD (f_rn), opval);
3932 current_cpu->done_insn (npc, status);
3936 // ********** sts-pr-compact: sts pr, $rn
3939 sh3_sem_sts_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3940 sh3::write_stacks &buf)
3942 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3943 sem_status status = SEM_STATUS_NORMAL;
3944 sh3_scache* abuf = sem;
3945 unsigned long long written = 0;
3946 PCADDR pc = abuf->addr;
3947 PCADDR npc = pc + 2;
3950 SI opval = current_cpu->h_pr_get ();
3951 if (UNLIKELY(current_cpu->trace_result_p))
3952 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3953 current_cpu->h_grc_set (FLD (f_rn), opval);
3956 current_cpu->done_insn (npc, status);
3960 // ********** stsl-pr-compact: sts.l pr, @-$rn
3963 sh3_sem_stsl_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3964 sh3::write_stacks &buf)
3966 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3967 sem_status status = SEM_STATUS_NORMAL;
3968 sh3_scache* abuf = sem;
3969 unsigned long long written = 0;
3970 PCADDR pc = abuf->addr;
3971 PCADDR npc = pc + 2;
3975 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3977 SI opval = current_cpu->h_pr_get ();
3978 if (UNLIKELY(current_cpu->trace_result_p))
3979 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3980 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3983 SI opval = tmp_addr;
3984 if (UNLIKELY(current_cpu->trace_result_p))
3985 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3986 current_cpu->h_grc_set (FLD (f_rn), opval);
3990 current_cpu->done_insn (npc, status);
3994 // ********** sub-compact: sub $rm, $rn
3997 sh3_sem_sub_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
3998 sh3::write_stacks &buf)
4000 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4001 sem_status status = SEM_STATUS_NORMAL;
4002 sh3_scache* abuf = sem;
4003 unsigned long long written = 0;
4004 PCADDR pc = abuf->addr;
4005 PCADDR npc = pc + 2;
4008 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4009 if (UNLIKELY(current_cpu->trace_result_p))
4010 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4011 current_cpu->h_grc_set (FLD (f_rn), opval);
4014 current_cpu->done_insn (npc, status);
4018 // ********** subc-compact: subc $rm, $rn
4021 sh3_sem_subc_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4022 sh3::write_stacks &buf)
4024 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4025 sem_status status = SEM_STATUS_NORMAL;
4026 sh3_scache* abuf = sem;
4027 unsigned long long written = 0;
4028 PCADDR pc = abuf->addr;
4029 PCADDR npc = pc + 2;
4033 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4035 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4036 if (UNLIKELY(current_cpu->trace_result_p))
4037 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4038 current_cpu->h_grc_set (FLD (f_rn), opval);
4041 BI opval = tmp_flag;
4042 if (UNLIKELY(current_cpu->trace_result_p))
4043 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4044 current_cpu->h_tbit_set (opval);
4048 current_cpu->done_insn (npc, status);
4052 // ********** subv-compact: subv $rm, $rn
4055 sh3_sem_subv_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4056 sh3::write_stacks &buf)
4058 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4059 sem_status status = SEM_STATUS_NORMAL;
4060 sh3_scache* abuf = sem;
4061 unsigned long long written = 0;
4062 PCADDR pc = abuf->addr;
4063 PCADDR npc = pc + 2;
4067 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
4069 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4070 if (UNLIKELY(current_cpu->trace_result_p))
4071 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4072 current_cpu->h_grc_set (FLD (f_rn), opval);
4075 BI opval = ((tmp_t) ? (1) : (0));
4076 if (UNLIKELY(current_cpu->trace_result_p))
4077 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4078 current_cpu->h_tbit_set (opval);
4082 current_cpu->done_insn (npc, status);
4086 // ********** swapb-compact: swap.b $rm, $rn
4089 sh3_sem_swapb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4090 sh3::write_stacks &buf)
4092 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4093 sem_status status = SEM_STATUS_NORMAL;
4094 sh3_scache* abuf = sem;
4095 unsigned long long written = 0;
4096 PCADDR pc = abuf->addr;
4097 PCADDR npc = pc + 2;
4103 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
4104 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
4105 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
4107 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
4108 if (UNLIKELY(current_cpu->trace_result_p))
4109 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4110 current_cpu->h_grc_set (FLD (f_rn), opval);
4114 current_cpu->done_insn (npc, status);
4118 // ********** swapw-compact: swap.w $rm, $rn
4121 sh3_sem_swapw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4122 sh3::write_stacks &buf)
4124 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4125 sem_status status = SEM_STATUS_NORMAL;
4126 sh3_scache* abuf = sem;
4127 unsigned long long written = 0;
4128 PCADDR pc = abuf->addr;
4129 PCADDR npc = pc + 2;
4132 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
4133 if (UNLIKELY(current_cpu->trace_result_p))
4134 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4135 current_cpu->h_grc_set (FLD (f_rn), opval);
4138 current_cpu->done_insn (npc, status);
4142 // ********** tasb-compact: tas.b @$rn
4145 sh3_sem_tasb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4146 sh3::write_stacks &buf)
4148 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4149 sem_status status = SEM_STATUS_NORMAL;
4150 sh3_scache* abuf = sem;
4151 unsigned long long written = 0;
4152 PCADDR pc = abuf->addr;
4153 PCADDR npc = pc + 2;
4157 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
4159 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
4160 if (UNLIKELY(current_cpu->trace_result_p))
4161 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4162 current_cpu->h_tbit_set (opval);
4164 tmp_byte = ORQI (tmp_byte, 128);
4166 UQI opval = tmp_byte;
4167 if (UNLIKELY(current_cpu->trace_result_p))
4168 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4169 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
4173 current_cpu->done_insn (npc, status);
4177 // ********** trapa-compact: trapa #$uimm8
4180 sh3_sem_trapa_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4181 sh3::write_stacks &buf)
4183 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4184 sem_status status = SEM_STATUS_NORMAL;
4185 sh3_scache* abuf = sem;
4186 unsigned long long written = 0;
4187 PCADDR pc = abuf->addr;
4188 PCADDR npc = pc + 2;
4190 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4192 current_cpu->done_insn (npc, status);
4196 // ********** tst-compact: tst $rm, $rn
4199 sh3_sem_tst_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4200 sh3::write_stacks &buf)
4202 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
4203 sem_status status = SEM_STATUS_NORMAL;
4204 sh3_scache* abuf = sem;
4205 unsigned long long written = 0;
4206 PCADDR pc = abuf->addr;
4207 PCADDR npc = pc + 2;
4210 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
4211 if (UNLIKELY(current_cpu->trace_result_p))
4212 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4213 current_cpu->h_tbit_set (opval);
4216 current_cpu->done_insn (npc, status);
4220 // ********** tsti-compact: tst #$uimm8, r0
4223 sh3_sem_tsti_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4224 sh3::write_stacks &buf)
4226 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4227 sem_status status = SEM_STATUS_NORMAL;
4228 sh3_scache* abuf = sem;
4229 unsigned long long written = 0;
4230 PCADDR pc = abuf->addr;
4231 PCADDR npc = pc + 2;
4234 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
4235 if (UNLIKELY(current_cpu->trace_result_p))
4236 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4237 current_cpu->h_tbit_set (opval);
4240 current_cpu->done_insn (npc, status);
4244 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
4247 sh3_sem_tstb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4248 sh3::write_stacks &buf)
4250 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4251 sem_status status = SEM_STATUS_NORMAL;
4252 sh3_scache* abuf = sem;
4253 unsigned long long written = 0;
4254 PCADDR pc = abuf->addr;
4255 PCADDR npc = pc + 2;
4259 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4261 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
4262 if (UNLIKELY(current_cpu->trace_result_p))
4263 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4264 current_cpu->h_tbit_set (opval);
4268 current_cpu->done_insn (npc, status);
4272 // ********** xor-compact: xor $rm64, $rn64
4275 sh3_sem_xor_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4276 sh3::write_stacks &buf)
4278 #define FLD(f) abuf->fields.sfmt_and_compact.f
4279 sem_status status = SEM_STATUS_NORMAL;
4280 sh3_scache* abuf = sem;
4281 unsigned long long written = 0;
4282 PCADDR pc = abuf->addr;
4283 PCADDR npc = pc + 2;
4286 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
4287 if (UNLIKELY(current_cpu->trace_result_p))
4288 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4289 current_cpu->h_gr_set (FLD (f_rn), opval);
4292 current_cpu->done_insn (npc, status);
4296 // ********** xori-compact: xor #$uimm8, r0
4299 sh3_sem_xori_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4300 sh3::write_stacks &buf)
4302 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4303 sem_status status = SEM_STATUS_NORMAL;
4304 sh3_scache* abuf = sem;
4305 unsigned long long written = 0;
4306 PCADDR pc = abuf->addr;
4307 PCADDR npc = pc + 2;
4310 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4311 if (UNLIKELY(current_cpu->trace_result_p))
4312 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4313 current_cpu->h_grc_set (((UINT) 0), opval);
4316 current_cpu->done_insn (npc, status);
4320 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
4323 sh3_sem_xorb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4324 sh3::write_stacks &buf)
4326 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4327 sem_status status = SEM_STATUS_NORMAL;
4328 sh3_scache* abuf = sem;
4329 unsigned long long written = 0;
4330 PCADDR pc = abuf->addr;
4331 PCADDR npc = pc + 2;
4336 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4337 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4339 UQI opval = tmp_data;
4340 if (UNLIKELY(current_cpu->trace_result_p))
4341 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4342 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4346 current_cpu->done_insn (npc, status);
4350 // ********** xtrct-compact: xtrct $rm, $rn
4353 sh3_sem_xtrct_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick,
4354 sh3::write_stacks &buf)
4356 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4357 sem_status status = SEM_STATUS_NORMAL;
4358 sh3_scache* abuf = sem;
4359 unsigned long long written = 0;
4360 PCADDR pc = abuf->addr;
4361 PCADDR npc = pc + 2;
4364 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
4365 if (UNLIKELY(current_cpu->trace_result_p))
4366 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4367 current_cpu->h_grc_set (FLD (f_rn), opval);
4370 current_cpu->done_insn (npc, status);