1 /* Simulator instruction semantics for sh4a.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 2000-2010 Red Hat, Inc.
7 This file is part of the Red Hat simulators.
18 using namespace sh4a; // FIXME: namespace organization still wip
19 using namespace sh4a; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh4a_sem_x_invalid (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
27 sh4a::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh4a_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 sh4a_sem_add_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
50 sh4a::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh4a_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 sh4a_sem_addi_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
74 sh4a::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh4a_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 sh4a_sem_addc_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
98 sh4a::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh4a_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 sh4a_sem_addv_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
132 sh4a::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh4a_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 sh4a_sem_and_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
166 sh4a::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh4a_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 sh4a_sem_andi_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
190 sh4a::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh4a_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 sh4a_sem_andb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
214 sh4a::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh4a_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 sh4a_sem_bf_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
244 sh4a::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh4a_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 sh4a_sem_bfs_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
272 sh4a::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh4a_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) % sh4a::pipe_sz].push (sh4a::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 sh4a_sem_bra_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
309 sh4a::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh4a_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) % sh4a::pipe_sz].push (sh4a::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 sh4a_sem_braf_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
342 sh4a::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh4a_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) % sh4a::pipe_sz].push (sh4a::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 sh4a_sem_bsr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
375 sh4a::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh4a_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) % sh4a::pipe_sz].push (sh4a::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) % sh4a::pipe_sz].push (sh4a::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 sh4a_sem_bsrf_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
414 sh4a::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh4a_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) % sh4a::pipe_sz].push (sh4a::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) % sh4a::pipe_sz].push (sh4a::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 sh4a_sem_bt_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
453 sh4a::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh4a_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 sh4a_sem_bts_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
481 sh4a::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh4a_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) % sh4a::pipe_sz].push (sh4a::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 sh4a_sem_clrmac_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
518 sh4a::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh4a_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 sh4a_sem_clrs_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
550 sh4a::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh4a_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 sh4a_sem_clrt_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
574 sh4a::write_stacks &buf)
576 #define FLD(f) abuf->fields.fmt_empty.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh4a_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 sh4a_sem_cmpeq_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
598 sh4a::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh4a_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 sh4a_sem_cmpeqi_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
622 sh4a::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_andi_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh4a_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 sh4a_sem_cmpge_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
646 sh4a::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh4a_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 sh4a_sem_cmpgt_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
670 sh4a::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh4a_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 sh4a_sem_cmphi_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
694 sh4a::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh4a_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 sh4a_sem_cmphs_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
718 sh4a::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh4a_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 sh4a_sem_cmppl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
742 sh4a::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh4a_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 sh4a_sem_cmppz_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
766 sh4a::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh4a_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 sh4a_sem_cmpstr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
790 sh4a::write_stacks &buf)
792 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
793 sem_status status = SEM_STATUS_NORMAL;
794 sh4a_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 sh4a_sem_div0s_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
823 sh4a::write_stacks &buf)
825 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
826 sem_status status = SEM_STATUS_NORMAL;
827 sh4a_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 sh4a_sem_div0u_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
861 sh4a::write_stacks &buf)
863 #define FLD(f) abuf->fields.fmt_empty.f
864 sem_status status = SEM_STATUS_NORMAL;
865 sh4a_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 sh4a_sem_div1_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
899 sh4a::write_stacks &buf)
901 #define FLD(f) abuf->fields.sfmt_macl_compact.f
902 sem_status status = SEM_STATUS_NORMAL;
903 sh4a_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 sh4a_sem_dmulsl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1050 sh4a::write_stacks &buf)
1052 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1053 sem_status status = SEM_STATUS_NORMAL;
1054 sh4a_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 sh4a_sem_dmulul_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1084 sh4a::write_stacks &buf)
1086 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1087 sem_status status = SEM_STATUS_NORMAL;
1088 sh4a_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 sh4a_sem_dt_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1118 sh4a::write_stacks &buf)
1120 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
1121 sem_status status = SEM_STATUS_NORMAL;
1122 sh4a_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 sh4a_sem_extsb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1150 sh4a::write_stacks &buf)
1152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1153 sem_status status = SEM_STATUS_NORMAL;
1154 sh4a_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 sh4a_sem_extsw_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1174 sh4a::write_stacks &buf)
1176 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1177 sem_status status = SEM_STATUS_NORMAL;
1178 sh4a_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 sh4a_sem_extub_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1198 sh4a::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh4a_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 sh4a_sem_extuw_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1222 sh4a::write_stacks &buf)
1224 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh4a_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 // ********** fabs-compact: fabs $fsdn
1245 sh4a_sem_fabs_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1246 sh4a::write_stacks &buf)
1248 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1249 sem_status status = SEM_STATUS_NORMAL;
1250 sh4a_scache* abuf = sem;
1251 unsigned long long written = 0;
1252 PCADDR pc = abuf->addr;
1253 PCADDR npc = pc + 2;
1255 if (current_cpu->h_prbit_get ()) {
1257 DF opval = current_cpu->sh64_fabsd (current_cpu->h_fsd_get (FLD (f_rn)));
1258 written |= (1ULL << 2);
1259 if (UNLIKELY(current_cpu->trace_result_p))
1260 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1261 current_cpu->h_fsd_set (FLD (f_rn), opval);
1265 DF opval = current_cpu->sh64_fabss (current_cpu->h_fsd_get (FLD (f_rn)));
1266 written |= (1ULL << 2);
1267 if (UNLIKELY(current_cpu->trace_result_p))
1268 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1269 current_cpu->h_fsd_set (FLD (f_rn), opval);
1273 abuf->written = written;
1274 current_cpu->done_insn (npc, status);
1278 // ********** fadd-compact: fadd $fsdm, $fsdn
1281 sh4a_sem_fadd_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1282 sh4a::write_stacks &buf)
1284 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1285 sem_status status = SEM_STATUS_NORMAL;
1286 sh4a_scache* abuf = sem;
1287 unsigned long long written = 0;
1288 PCADDR pc = abuf->addr;
1289 PCADDR npc = pc + 2;
1291 if (current_cpu->h_prbit_get ()) {
1293 DF opval = current_cpu->sh64_faddd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1294 written |= (1ULL << 3);
1295 if (UNLIKELY(current_cpu->trace_result_p))
1296 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1297 current_cpu->h_fsd_set (FLD (f_rn), opval);
1301 DF opval = current_cpu->sh64_fadds (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1302 written |= (1ULL << 3);
1303 if (UNLIKELY(current_cpu->trace_result_p))
1304 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1305 current_cpu->h_fsd_set (FLD (f_rn), opval);
1309 abuf->written = written;
1310 current_cpu->done_insn (npc, status);
1314 // ********** fcmpeq-compact: fcmp/eq $fsdm, $fsdn
1317 sh4a_sem_fcmpeq_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1318 sh4a::write_stacks &buf)
1320 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1321 sem_status status = SEM_STATUS_NORMAL;
1322 sh4a_scache* abuf = sem;
1323 unsigned long long written = 0;
1324 PCADDR pc = abuf->addr;
1325 PCADDR npc = pc + 2;
1327 if (current_cpu->h_prbit_get ()) {
1329 BI opval = current_cpu->sh64_fcmpeqd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1330 written |= (1ULL << 3);
1331 if (UNLIKELY(current_cpu->trace_result_p))
1332 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1333 current_cpu->h_tbit_set (opval);
1337 BI opval = current_cpu->sh64_fcmpeqs (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1338 written |= (1ULL << 3);
1339 if (UNLIKELY(current_cpu->trace_result_p))
1340 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1341 current_cpu->h_tbit_set (opval);
1345 abuf->written = written;
1346 current_cpu->done_insn (npc, status);
1350 // ********** fcmpgt-compact: fcmp/gt $fsdm, $fsdn
1353 sh4a_sem_fcmpgt_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1354 sh4a::write_stacks &buf)
1356 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1357 sem_status status = SEM_STATUS_NORMAL;
1358 sh4a_scache* abuf = sem;
1359 unsigned long long written = 0;
1360 PCADDR pc = abuf->addr;
1361 PCADDR npc = pc + 2;
1363 if (current_cpu->h_prbit_get ()) {
1365 BI opval = current_cpu->sh64_fcmpgtd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1366 written |= (1ULL << 3);
1367 if (UNLIKELY(current_cpu->trace_result_p))
1368 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1369 current_cpu->h_tbit_set (opval);
1373 BI opval = current_cpu->sh64_fcmpgts (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1374 written |= (1ULL << 3);
1375 if (UNLIKELY(current_cpu->trace_result_p))
1376 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1377 current_cpu->h_tbit_set (opval);
1381 abuf->written = written;
1382 current_cpu->done_insn (npc, status);
1386 // ********** fdiv-compact: fdiv $fsdm, $fsdn
1389 sh4a_sem_fdiv_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1390 sh4a::write_stacks &buf)
1392 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1393 sem_status status = SEM_STATUS_NORMAL;
1394 sh4a_scache* abuf = sem;
1395 unsigned long long written = 0;
1396 PCADDR pc = abuf->addr;
1397 PCADDR npc = pc + 2;
1399 if (current_cpu->h_prbit_get ()) {
1401 DF opval = current_cpu->sh64_fdivd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1402 written |= (1ULL << 3);
1403 if (UNLIKELY(current_cpu->trace_result_p))
1404 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1405 current_cpu->h_fsd_set (FLD (f_rn), opval);
1409 DF opval = current_cpu->sh64_fdivs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1410 written |= (1ULL << 3);
1411 if (UNLIKELY(current_cpu->trace_result_p))
1412 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1413 current_cpu->h_fsd_set (FLD (f_rn), opval);
1417 abuf->written = written;
1418 current_cpu->done_insn (npc, status);
1422 // ********** fipr-compact: fipr $fvm, $fvn
1425 sh4a_sem_fipr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1426 sh4a::write_stacks &buf)
1428 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
1429 sem_status status = SEM_STATUS_NORMAL;
1430 sh4a_scache* abuf = sem;
1431 unsigned long long written = 0;
1432 PCADDR pc = abuf->addr;
1433 PCADDR npc = pc + 2;
1435 current_cpu->sh64_fipr (FLD (f_vm), FLD (f_vn));
1437 current_cpu->done_insn (npc, status);
1441 // ********** flds-compact: flds $frn, fpul
1444 sh4a_sem_flds_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1445 sh4a::write_stacks &buf)
1447 #define FLD(f) abuf->fields.sfmt_flds_compact.f
1448 sem_status status = SEM_STATUS_NORMAL;
1449 sh4a_scache* abuf = sem;
1450 unsigned long long written = 0;
1451 PCADDR pc = abuf->addr;
1452 PCADDR npc = pc + 2;
1455 SF opval = current_cpu->h_frc_get (FLD (f_rn));
1456 if (UNLIKELY(current_cpu->trace_result_p))
1457 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
1458 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1461 current_cpu->done_insn (npc, status);
1465 // ********** fldi0-compact: fldi0 $frn
1468 sh4a_sem_fldi0_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1469 sh4a::write_stacks &buf)
1471 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1472 sem_status status = SEM_STATUS_NORMAL;
1473 sh4a_scache* abuf = sem;
1474 unsigned long long written = 0;
1475 PCADDR pc = abuf->addr;
1476 PCADDR npc = pc + 2;
1479 SF opval = current_cpu->sh64_fldi0 ();
1480 if (UNLIKELY(current_cpu->trace_result_p))
1481 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1482 current_cpu->h_frc_set (FLD (f_rn), opval);
1485 current_cpu->done_insn (npc, status);
1489 // ********** fldi1-compact: fldi1 $frn
1492 sh4a_sem_fldi1_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1493 sh4a::write_stacks &buf)
1495 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1496 sem_status status = SEM_STATUS_NORMAL;
1497 sh4a_scache* abuf = sem;
1498 unsigned long long written = 0;
1499 PCADDR pc = abuf->addr;
1500 PCADDR npc = pc + 2;
1503 SF opval = current_cpu->sh64_fldi1 ();
1504 if (UNLIKELY(current_cpu->trace_result_p))
1505 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1506 current_cpu->h_frc_set (FLD (f_rn), opval);
1509 current_cpu->done_insn (npc, status);
1513 // ********** float-compact: float fpul, $fsdn
1516 sh4a_sem_float_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1517 sh4a::write_stacks &buf)
1519 #define FLD(f) abuf->fields.sfmt_float_compact.f
1520 sem_status status = SEM_STATUS_NORMAL;
1521 sh4a_scache* abuf = sem;
1522 unsigned long long written = 0;
1523 PCADDR pc = abuf->addr;
1524 PCADDR npc = pc + 2;
1526 if (current_cpu->h_prbit_get ()) {
1528 DF opval = current_cpu->sh64_floatld (current_cpu->hardware.h_fr[((UINT) 32)]);
1529 written |= (1ULL << 2);
1530 if (UNLIKELY(current_cpu->trace_result_p))
1531 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1532 current_cpu->h_fsd_set (FLD (f_rn), opval);
1536 DF opval = current_cpu->sh64_floatls (current_cpu->hardware.h_fr[((UINT) 32)]);
1537 written |= (1ULL << 2);
1538 if (UNLIKELY(current_cpu->trace_result_p))
1539 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1540 current_cpu->h_fsd_set (FLD (f_rn), opval);
1544 abuf->written = written;
1545 current_cpu->done_insn (npc, status);
1549 // ********** fmac-compact: fmac fr0, $frm, $frn
1552 sh4a_sem_fmac_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1553 sh4a::write_stacks &buf)
1555 #define FLD(f) abuf->fields.sfmt_fmac_compact.f
1556 sem_status status = SEM_STATUS_NORMAL;
1557 sh4a_scache* abuf = sem;
1558 unsigned long long written = 0;
1559 PCADDR pc = abuf->addr;
1560 PCADDR npc = pc + 2;
1563 SF opval = current_cpu->sh64_fmacs (current_cpu->h_frc_get (((UINT) 0)), current_cpu->h_frc_get (FLD (f_rm)), current_cpu->h_frc_get (FLD (f_rn)));
1564 if (UNLIKELY(current_cpu->trace_result_p))
1565 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1566 current_cpu->h_frc_set (FLD (f_rn), opval);
1569 current_cpu->done_insn (npc, status);
1573 // ********** fmov1-compact: fmov $fmovm, $fmovn
1576 sh4a_sem_fmov1_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1577 sh4a::write_stacks &buf)
1579 #define FLD(f) abuf->fields.sfmt_fmov1_compact.f
1580 sem_status status = SEM_STATUS_NORMAL;
1581 sh4a_scache* abuf = sem;
1582 unsigned long long written = 0;
1583 PCADDR pc = abuf->addr;
1584 PCADDR npc = pc + 2;
1587 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1588 if (UNLIKELY(current_cpu->trace_result_p))
1589 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1590 current_cpu->h_fmov_set (FLD (f_rn), opval);
1593 current_cpu->done_insn (npc, status);
1597 // ********** fmov2-compact: fmov @$rm, $fmovn
1600 sh4a_sem_fmov2_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1601 sh4a::write_stacks &buf)
1603 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1604 sem_status status = SEM_STATUS_NORMAL;
1605 sh4a_scache* abuf = sem;
1606 unsigned long long written = 0;
1607 PCADDR pc = abuf->addr;
1608 PCADDR npc = pc + 2;
1610 if (NOTBI (current_cpu->h_szbit_get ())) {
1612 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1613 written |= (1ULL << 4);
1614 if (UNLIKELY(current_cpu->trace_result_p))
1615 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1616 current_cpu->h_fmov_set (FLD (f_rn), opval);
1620 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1621 written |= (1ULL << 4);
1622 if (UNLIKELY(current_cpu->trace_result_p))
1623 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1624 current_cpu->h_fmov_set (FLD (f_rn), opval);
1628 abuf->written = written;
1629 current_cpu->done_insn (npc, status);
1633 // ********** fmov3-compact: fmov @${rm}+, fmovn
1636 sh4a_sem_fmov3_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1637 sh4a::write_stacks &buf)
1639 #define FLD(f) abuf->fields.sfmt_fmov3_compact.f
1640 sem_status status = SEM_STATUS_NORMAL;
1641 sh4a_scache* abuf = sem;
1642 unsigned long long written = 0;
1643 PCADDR pc = abuf->addr;
1644 PCADDR npc = pc + 2;
1646 if (NOTBI (current_cpu->h_szbit_get ())) {
1649 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1650 written |= (1ULL << 4);
1651 if (UNLIKELY(current_cpu->trace_result_p))
1652 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1653 current_cpu->h_fmov_set (FLD (f_rn), opval);
1656 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1657 written |= (1ULL << 5);
1658 if (UNLIKELY(current_cpu->trace_result_p))
1659 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1660 current_cpu->h_grc_set (FLD (f_rm), opval);
1666 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1667 written |= (1ULL << 4);
1668 if (UNLIKELY(current_cpu->trace_result_p))
1669 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1670 current_cpu->h_fmov_set (FLD (f_rn), opval);
1673 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 8);
1674 written |= (1ULL << 5);
1675 if (UNLIKELY(current_cpu->trace_result_p))
1676 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1677 current_cpu->h_grc_set (FLD (f_rm), opval);
1682 abuf->written = written;
1683 current_cpu->done_insn (npc, status);
1687 // ********** fmov4-compact: fmov @(r0, $rm), $fmovn
1690 sh4a_sem_fmov4_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1691 sh4a::write_stacks &buf)
1693 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1694 sem_status status = SEM_STATUS_NORMAL;
1695 sh4a_scache* abuf = sem;
1696 unsigned long long written = 0;
1697 PCADDR pc = abuf->addr;
1698 PCADDR npc = pc + 2;
1700 if (NOTBI (current_cpu->h_szbit_get ())) {
1702 DF opval = current_cpu->GETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1703 written |= (1ULL << 5);
1704 if (UNLIKELY(current_cpu->trace_result_p))
1705 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1706 current_cpu->h_fmov_set (FLD (f_rn), opval);
1710 DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1711 written |= (1ULL << 5);
1712 if (UNLIKELY(current_cpu->trace_result_p))
1713 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1714 current_cpu->h_fmov_set (FLD (f_rn), opval);
1718 abuf->written = written;
1719 current_cpu->done_insn (npc, status);
1723 // ********** fmov5-compact: fmov $fmovm, @$rn
1726 sh4a_sem_fmov5_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1727 sh4a::write_stacks &buf)
1729 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1730 sem_status status = SEM_STATUS_NORMAL;
1731 sh4a_scache* abuf = sem;
1732 unsigned long long written = 0;
1733 PCADDR pc = abuf->addr;
1734 PCADDR npc = pc + 2;
1736 if (NOTBI (current_cpu->h_szbit_get ())) {
1738 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1739 written |= (1ULL << 4);
1740 if (UNLIKELY(current_cpu->trace_result_p))
1741 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1742 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1746 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1747 written |= (1ULL << 3);
1748 if (UNLIKELY(current_cpu->trace_result_p))
1749 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1750 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1754 abuf->written = written;
1755 current_cpu->done_insn (npc, status);
1759 // ********** fmov6-compact: fmov $fmovm, @-$rn
1762 sh4a_sem_fmov6_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1763 sh4a::write_stacks &buf)
1765 #define FLD(f) abuf->fields.sfmt_fmov6_compact.f
1766 sem_status status = SEM_STATUS_NORMAL;
1767 sh4a_scache* abuf = sem;
1768 unsigned long long written = 0;
1769 PCADDR pc = abuf->addr;
1770 PCADDR npc = pc + 2;
1772 if (NOTBI (current_cpu->h_szbit_get ())) {
1775 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1776 written |= (1ULL << 5);
1777 if (UNLIKELY(current_cpu->trace_result_p))
1778 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1779 current_cpu->h_grc_set (FLD (f_rn), opval);
1782 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1783 written |= (1ULL << 4);
1784 if (UNLIKELY(current_cpu->trace_result_p))
1785 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1786 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1792 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
1793 written |= (1ULL << 5);
1794 if (UNLIKELY(current_cpu->trace_result_p))
1795 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1796 current_cpu->h_grc_set (FLD (f_rn), opval);
1799 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1800 written |= (1ULL << 3);
1801 if (UNLIKELY(current_cpu->trace_result_p))
1802 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1803 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1808 abuf->written = written;
1809 current_cpu->done_insn (npc, status);
1813 // ********** fmov7-compact: fmov $fmovm, @(r0, $rn)
1816 sh4a_sem_fmov7_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1817 sh4a::write_stacks &buf)
1819 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1820 sem_status status = SEM_STATUS_NORMAL;
1821 sh4a_scache* abuf = sem;
1822 unsigned long long written = 0;
1823 PCADDR pc = abuf->addr;
1824 PCADDR npc = pc + 2;
1826 if (NOTBI (current_cpu->h_szbit_get ())) {
1828 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1829 written |= (1ULL << 5);
1830 if (UNLIKELY(current_cpu->trace_result_p))
1831 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 << " ";
1832 current_cpu->SETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1836 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1837 written |= (1ULL << 4);
1838 if (UNLIKELY(current_cpu->trace_result_p))
1839 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 << " ";
1840 current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1844 abuf->written = written;
1845 current_cpu->done_insn (npc, status);
1849 // ********** fmul-compact: fmul $fsdm, $fsdn
1852 sh4a_sem_fmul_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1853 sh4a::write_stacks &buf)
1855 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1856 sem_status status = SEM_STATUS_NORMAL;
1857 sh4a_scache* abuf = sem;
1858 unsigned long long written = 0;
1859 PCADDR pc = abuf->addr;
1860 PCADDR npc = pc + 2;
1862 if (current_cpu->h_prbit_get ()) {
1864 DF opval = current_cpu->sh64_fmuld (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1865 written |= (1ULL << 3);
1866 if (UNLIKELY(current_cpu->trace_result_p))
1867 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1868 current_cpu->h_fsd_set (FLD (f_rn), opval);
1872 DF opval = current_cpu->sh64_fmuls (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1873 written |= (1ULL << 3);
1874 if (UNLIKELY(current_cpu->trace_result_p))
1875 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1876 current_cpu->h_fsd_set (FLD (f_rn), opval);
1880 abuf->written = written;
1881 current_cpu->done_insn (npc, status);
1885 // ********** fneg-compact: fneg $fsdn
1888 sh4a_sem_fneg_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1889 sh4a::write_stacks &buf)
1891 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1892 sem_status status = SEM_STATUS_NORMAL;
1893 sh4a_scache* abuf = sem;
1894 unsigned long long written = 0;
1895 PCADDR pc = abuf->addr;
1896 PCADDR npc = pc + 2;
1898 if (current_cpu->h_prbit_get ()) {
1900 DF opval = current_cpu->sh64_fnegd (current_cpu->h_fsd_get (FLD (f_rn)));
1901 written |= (1ULL << 2);
1902 if (UNLIKELY(current_cpu->trace_result_p))
1903 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1904 current_cpu->h_fsd_set (FLD (f_rn), opval);
1908 DF opval = current_cpu->sh64_fnegs (current_cpu->h_fsd_get (FLD (f_rn)));
1909 written |= (1ULL << 2);
1910 if (UNLIKELY(current_cpu->trace_result_p))
1911 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1912 current_cpu->h_fsd_set (FLD (f_rn), opval);
1916 abuf->written = written;
1917 current_cpu->done_insn (npc, status);
1921 // ********** frchg-compact: frchg
1924 sh4a_sem_frchg_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1925 sh4a::write_stacks &buf)
1927 #define FLD(f) abuf->fields.fmt_empty.f
1928 sem_status status = SEM_STATUS_NORMAL;
1929 sh4a_scache* abuf = sem;
1930 unsigned long long written = 0;
1931 PCADDR pc = abuf->addr;
1932 PCADDR npc = pc + 2;
1935 BI opval = NOTBI (current_cpu->h_frbit_get ());
1936 if (UNLIKELY(current_cpu->trace_result_p))
1937 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
1938 current_cpu->h_frbit_set (opval);
1941 current_cpu->done_insn (npc, status);
1945 // ********** fschg-compact: fschg
1948 sh4a_sem_fschg_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1949 sh4a::write_stacks &buf)
1951 #define FLD(f) abuf->fields.fmt_empty.f
1952 sem_status status = SEM_STATUS_NORMAL;
1953 sh4a_scache* abuf = sem;
1954 unsigned long long written = 0;
1955 PCADDR pc = abuf->addr;
1956 PCADDR npc = pc + 2;
1959 BI opval = NOTBI (current_cpu->h_szbit_get ());
1960 if (UNLIKELY(current_cpu->trace_result_p))
1961 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
1962 current_cpu->h_szbit_set (opval);
1965 current_cpu->done_insn (npc, status);
1969 // ********** fsqrt-compact: fsqrt $fsdn
1972 sh4a_sem_fsqrt_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
1973 sh4a::write_stacks &buf)
1975 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1976 sem_status status = SEM_STATUS_NORMAL;
1977 sh4a_scache* abuf = sem;
1978 unsigned long long written = 0;
1979 PCADDR pc = abuf->addr;
1980 PCADDR npc = pc + 2;
1982 if (current_cpu->h_prbit_get ()) {
1984 DF opval = current_cpu->sh64_fsqrtd (current_cpu->h_fsd_get (FLD (f_rn)));
1985 written |= (1ULL << 2);
1986 if (UNLIKELY(current_cpu->trace_result_p))
1987 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1988 current_cpu->h_fsd_set (FLD (f_rn), opval);
1992 DF opval = current_cpu->sh64_fsqrts (current_cpu->h_fsd_get (FLD (f_rn)));
1993 written |= (1ULL << 2);
1994 if (UNLIKELY(current_cpu->trace_result_p))
1995 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1996 current_cpu->h_fsd_set (FLD (f_rn), opval);
2000 abuf->written = written;
2001 current_cpu->done_insn (npc, status);
2005 // ********** fsts-compact: fsts fpul, $frn
2008 sh4a_sem_fsts_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2009 sh4a::write_stacks &buf)
2011 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
2012 sem_status status = SEM_STATUS_NORMAL;
2013 sh4a_scache* abuf = sem;
2014 unsigned long long written = 0;
2015 PCADDR pc = abuf->addr;
2016 PCADDR npc = pc + 2;
2019 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
2020 if (UNLIKELY(current_cpu->trace_result_p))
2021 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2022 current_cpu->h_frc_set (FLD (f_rn), opval);
2025 current_cpu->done_insn (npc, status);
2029 // ********** fsub-compact: fsub $fsdm, $fsdn
2032 sh4a_sem_fsub_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2033 sh4a::write_stacks &buf)
2035 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2036 sem_status status = SEM_STATUS_NORMAL;
2037 sh4a_scache* abuf = sem;
2038 unsigned long long written = 0;
2039 PCADDR pc = abuf->addr;
2040 PCADDR npc = pc + 2;
2042 if (current_cpu->h_prbit_get ()) {
2044 DF opval = current_cpu->sh64_fsubd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2045 written |= (1ULL << 3);
2046 if (UNLIKELY(current_cpu->trace_result_p))
2047 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2048 current_cpu->h_fsd_set (FLD (f_rn), opval);
2052 DF opval = current_cpu->sh64_fsubs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2053 written |= (1ULL << 3);
2054 if (UNLIKELY(current_cpu->trace_result_p))
2055 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2056 current_cpu->h_fsd_set (FLD (f_rn), opval);
2060 abuf->written = written;
2061 current_cpu->done_insn (npc, status);
2065 // ********** ftrc-compact: ftrc $fsdn, fpul
2068 sh4a_sem_ftrc_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2069 sh4a::write_stacks &buf)
2071 #define FLD(f) abuf->fields.sfmt_ftrc_compact.f
2072 sem_status status = SEM_STATUS_NORMAL;
2073 sh4a_scache* abuf = sem;
2074 unsigned long long written = 0;
2075 PCADDR pc = abuf->addr;
2076 PCADDR npc = pc + 2;
2079 SF opval = ((current_cpu->h_prbit_get ()) ? (current_cpu->sh64_ftrcdl (current_cpu->h_fsd_get (FLD (f_rn)))) : (current_cpu->sh64_ftrcsl (current_cpu->h_fsd_get (FLD (f_rn)))));
2080 if (UNLIKELY(current_cpu->trace_result_p))
2081 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2082 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2085 current_cpu->done_insn (npc, status);
2089 // ********** ftrv-compact: ftrv xmtrx, $fvn
2092 sh4a_sem_ftrv_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2093 sh4a::write_stacks &buf)
2095 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
2096 sem_status status = SEM_STATUS_NORMAL;
2097 sh4a_scache* abuf = sem;
2098 unsigned long long written = 0;
2099 PCADDR pc = abuf->addr;
2100 PCADDR npc = pc + 2;
2102 current_cpu->sh64_ftrv (FLD (f_vn));
2104 current_cpu->done_insn (npc, status);
2108 // ********** jmp-compact: jmp @$rn
2111 sh4a_sem_jmp_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2112 sh4a::write_stacks &buf)
2114 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2115 sem_status status = SEM_STATUS_NORMAL;
2116 sh4a_scache* abuf = sem;
2117 unsigned long long written = 0;
2118 PCADDR pc = abuf->addr;
2119 PCADDR npc = pc + 2;
2123 UDI opval = ADDDI (pc, 2);
2124 if (UNLIKELY(current_cpu->trace_result_p))
2125 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2126 current_cpu->branch (opval, npc, status);
2128 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2130 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2131 buf.h_pc_writes [(tick + 1) % sh4a::pipe_sz].push (sh4a::write<UDI>(pc, opval));
2132 if (UNLIKELY(current_cpu->trace_result_p))
2133 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2135 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2138 current_cpu->done_cti_insn (npc, status);
2142 // ********** jsr-compact: jsr @$rn
2145 sh4a_sem_jsr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2146 sh4a::write_stacks &buf)
2148 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2149 sem_status status = SEM_STATUS_NORMAL;
2150 sh4a_scache* abuf = sem;
2151 unsigned long long written = 0;
2152 PCADDR pc = abuf->addr;
2153 PCADDR npc = pc + 2;
2157 SI opval = ADDDI (pc, 4);
2158 buf.h_pr_writes [(tick + 1) % sh4a::pipe_sz].push (sh4a::write<SI>(pc, opval));
2159 if (UNLIKELY(current_cpu->trace_result_p))
2160 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2163 UDI opval = ADDDI (pc, 2);
2164 if (UNLIKELY(current_cpu->trace_result_p))
2165 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2166 current_cpu->branch (opval, npc, status);
2168 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2170 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2171 buf.h_pc_writes [(tick + 1) % sh4a::pipe_sz].push (sh4a::write<UDI>(pc, opval));
2172 if (UNLIKELY(current_cpu->trace_result_p))
2173 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2175 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2178 current_cpu->done_cti_insn (npc, status);
2182 // ********** ldc-gbr-compact: ldc $rn, gbr
2185 sh4a_sem_ldc_gbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2186 sh4a::write_stacks &buf)
2188 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2189 sem_status status = SEM_STATUS_NORMAL;
2190 sh4a_scache* abuf = sem;
2191 unsigned long long written = 0;
2192 PCADDR pc = abuf->addr;
2193 PCADDR npc = pc + 2;
2196 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2197 if (UNLIKELY(current_cpu->trace_result_p))
2198 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2199 current_cpu->h_gbr_set (opval);
2202 current_cpu->done_insn (npc, status);
2206 // ********** ldc-vbr-compact: ldc $rn, vbr
2209 sh4a_sem_ldc_vbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2210 sh4a::write_stacks &buf)
2212 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2213 sem_status status = SEM_STATUS_NORMAL;
2214 sh4a_scache* abuf = sem;
2215 unsigned long long written = 0;
2216 PCADDR pc = abuf->addr;
2217 PCADDR npc = pc + 2;
2220 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2221 if (UNLIKELY(current_cpu->trace_result_p))
2222 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2223 current_cpu->h_vbr_set (opval);
2226 current_cpu->done_insn (npc, status);
2230 // ********** ldc-sr-compact: ldc $rn, sr
2233 sh4a_sem_ldc_sr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2234 sh4a::write_stacks &buf)
2236 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2237 sem_status status = SEM_STATUS_NORMAL;
2238 sh4a_scache* abuf = sem;
2239 unsigned long long written = 0;
2240 PCADDR pc = abuf->addr;
2241 PCADDR npc = pc + 2;
2244 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2245 if (UNLIKELY(current_cpu->trace_result_p))
2246 current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << " ";
2247 current_cpu->hardware.h_sr = opval;
2250 current_cpu->done_insn (npc, status);
2254 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
2257 sh4a_sem_ldcl_gbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2258 sh4a::write_stacks &buf)
2260 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2261 sem_status status = SEM_STATUS_NORMAL;
2262 sh4a_scache* abuf = sem;
2263 unsigned long long written = 0;
2264 PCADDR pc = abuf->addr;
2265 PCADDR npc = pc + 2;
2269 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2270 if (UNLIKELY(current_cpu->trace_result_p))
2271 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2272 current_cpu->h_gbr_set (opval);
2275 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2276 if (UNLIKELY(current_cpu->trace_result_p))
2277 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2278 current_cpu->h_grc_set (FLD (f_rn), opval);
2282 current_cpu->done_insn (npc, status);
2286 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
2289 sh4a_sem_ldcl_vbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2290 sh4a::write_stacks &buf)
2292 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2293 sem_status status = SEM_STATUS_NORMAL;
2294 sh4a_scache* abuf = sem;
2295 unsigned long long written = 0;
2296 PCADDR pc = abuf->addr;
2297 PCADDR npc = pc + 2;
2301 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2302 if (UNLIKELY(current_cpu->trace_result_p))
2303 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2304 current_cpu->h_vbr_set (opval);
2307 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2308 if (UNLIKELY(current_cpu->trace_result_p))
2309 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2310 current_cpu->h_grc_set (FLD (f_rn), opval);
2314 current_cpu->done_insn (npc, status);
2318 // ********** lds-fpscr-compact: lds $rn, fpscr
2321 sh4a_sem_lds_fpscr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2322 sh4a::write_stacks &buf)
2324 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2325 sem_status status = SEM_STATUS_NORMAL;
2326 sh4a_scache* abuf = sem;
2327 unsigned long long written = 0;
2328 PCADDR pc = abuf->addr;
2329 PCADDR npc = pc + 2;
2332 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2333 if (UNLIKELY(current_cpu->trace_result_p))
2334 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2335 current_cpu->hardware.h_fpscr = opval;
2338 current_cpu->done_insn (npc, status);
2342 // ********** ldsl-fpscr-compact: lds.l @${rn}+, fpscr
2345 sh4a_sem_ldsl_fpscr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2346 sh4a::write_stacks &buf)
2348 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2349 sem_status status = SEM_STATUS_NORMAL;
2350 sh4a_scache* abuf = sem;
2351 unsigned long long written = 0;
2352 PCADDR pc = abuf->addr;
2353 PCADDR npc = pc + 2;
2357 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2358 if (UNLIKELY(current_cpu->trace_result_p))
2359 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2360 current_cpu->hardware.h_fpscr = opval;
2363 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2364 if (UNLIKELY(current_cpu->trace_result_p))
2365 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2366 current_cpu->h_grc_set (FLD (f_rn), opval);
2370 current_cpu->done_insn (npc, status);
2374 // ********** lds-fpul-compact: lds $rn, fpul
2377 sh4a_sem_lds_fpul_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2378 sh4a::write_stacks &buf)
2380 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2381 sem_status status = SEM_STATUS_NORMAL;
2382 sh4a_scache* abuf = sem;
2383 unsigned long long written = 0;
2384 PCADDR pc = abuf->addr;
2385 PCADDR npc = pc + 2;
2388 SF opval = SUBWORDSISF (current_cpu->h_grc_get (FLD (f_rn)));
2389 if (UNLIKELY(current_cpu->trace_result_p))
2390 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2391 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2394 current_cpu->done_insn (npc, status);
2398 // ********** ldsl-fpul-compact: lds.l @${rn}+, fpul
2401 sh4a_sem_ldsl_fpul_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2402 sh4a::write_stacks &buf)
2404 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2405 sem_status status = SEM_STATUS_NORMAL;
2406 sh4a_scache* abuf = sem;
2407 unsigned long long written = 0;
2408 PCADDR pc = abuf->addr;
2409 PCADDR npc = pc + 2;
2413 SF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)));
2414 if (UNLIKELY(current_cpu->trace_result_p))
2415 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2416 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2419 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2420 if (UNLIKELY(current_cpu->trace_result_p))
2421 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2422 current_cpu->h_grc_set (FLD (f_rn), opval);
2426 current_cpu->done_insn (npc, status);
2430 // ********** lds-mach-compact: lds $rn, mach
2433 sh4a_sem_lds_mach_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2434 sh4a::write_stacks &buf)
2436 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2437 sem_status status = SEM_STATUS_NORMAL;
2438 sh4a_scache* abuf = sem;
2439 unsigned long long written = 0;
2440 PCADDR pc = abuf->addr;
2441 PCADDR npc = pc + 2;
2444 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2445 if (UNLIKELY(current_cpu->trace_result_p))
2446 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2447 current_cpu->h_mach_set (opval);
2450 current_cpu->done_insn (npc, status);
2454 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
2457 sh4a_sem_ldsl_mach_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2458 sh4a::write_stacks &buf)
2460 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2461 sem_status status = SEM_STATUS_NORMAL;
2462 sh4a_scache* abuf = sem;
2463 unsigned long long written = 0;
2464 PCADDR pc = abuf->addr;
2465 PCADDR npc = pc + 2;
2469 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2470 if (UNLIKELY(current_cpu->trace_result_p))
2471 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2472 current_cpu->h_mach_set (opval);
2475 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2476 if (UNLIKELY(current_cpu->trace_result_p))
2477 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2478 current_cpu->h_grc_set (FLD (f_rn), opval);
2482 current_cpu->done_insn (npc, status);
2486 // ********** lds-macl-compact: lds $rn, macl
2489 sh4a_sem_lds_macl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2490 sh4a::write_stacks &buf)
2492 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2493 sem_status status = SEM_STATUS_NORMAL;
2494 sh4a_scache* abuf = sem;
2495 unsigned long long written = 0;
2496 PCADDR pc = abuf->addr;
2497 PCADDR npc = pc + 2;
2500 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2501 if (UNLIKELY(current_cpu->trace_result_p))
2502 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2503 current_cpu->h_macl_set (opval);
2506 current_cpu->done_insn (npc, status);
2510 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
2513 sh4a_sem_ldsl_macl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2514 sh4a::write_stacks &buf)
2516 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2517 sem_status status = SEM_STATUS_NORMAL;
2518 sh4a_scache* abuf = sem;
2519 unsigned long long written = 0;
2520 PCADDR pc = abuf->addr;
2521 PCADDR npc = pc + 2;
2525 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2526 if (UNLIKELY(current_cpu->trace_result_p))
2527 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2528 current_cpu->h_macl_set (opval);
2531 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2532 if (UNLIKELY(current_cpu->trace_result_p))
2533 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2534 current_cpu->h_grc_set (FLD (f_rn), opval);
2538 current_cpu->done_insn (npc, status);
2542 // ********** lds-pr-compact: lds $rn, pr
2545 sh4a_sem_lds_pr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2546 sh4a::write_stacks &buf)
2548 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2549 sem_status status = SEM_STATUS_NORMAL;
2550 sh4a_scache* abuf = sem;
2551 unsigned long long written = 0;
2552 PCADDR pc = abuf->addr;
2553 PCADDR npc = pc + 2;
2556 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2557 if (UNLIKELY(current_cpu->trace_result_p))
2558 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2559 current_cpu->h_pr_set (opval);
2562 current_cpu->done_insn (npc, status);
2566 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
2569 sh4a_sem_ldsl_pr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2570 sh4a::write_stacks &buf)
2572 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2573 sem_status status = SEM_STATUS_NORMAL;
2574 sh4a_scache* abuf = sem;
2575 unsigned long long written = 0;
2576 PCADDR pc = abuf->addr;
2577 PCADDR npc = pc + 2;
2581 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2582 if (UNLIKELY(current_cpu->trace_result_p))
2583 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2584 current_cpu->h_pr_set (opval);
2587 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2588 if (UNLIKELY(current_cpu->trace_result_p))
2589 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2590 current_cpu->h_grc_set (FLD (f_rn), opval);
2594 current_cpu->done_insn (npc, status);
2598 // ********** macl-compact: mac.l @${rm}+, @${rn}+
2601 sh4a_sem_macl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2602 sh4a::write_stacks &buf)
2604 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2605 sem_status status = SEM_STATUS_NORMAL;
2606 sh4a_scache* abuf = sem;
2607 unsigned long long written = 0;
2608 PCADDR pc = abuf->addr;
2609 PCADDR npc = pc + 2;
2617 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2619 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2620 if (UNLIKELY(current_cpu->trace_result_p))
2621 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2622 current_cpu->h_grc_set (FLD (f_rn), opval);
2624 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2627 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2628 if (UNLIKELY(current_cpu->trace_result_p))
2629 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2630 current_cpu->h_grc_set (FLD (f_rn), opval);
2633 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2634 written |= (1ULL << 11);
2635 if (UNLIKELY(current_cpu->trace_result_p))
2636 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2637 current_cpu->h_grc_set (FLD (f_rm), opval);
2641 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2643 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2644 written |= (1ULL << 11);
2645 if (UNLIKELY(current_cpu->trace_result_p))
2646 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2647 current_cpu->h_grc_set (FLD (f_rm), opval);
2649 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2650 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2651 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2653 if (current_cpu->h_sbit_get ()) {
2657 tmp_max = SRLDI (INVDI (0), 16);
2658 tmp_min = SRLDI (INVDI (0), 15);
2659 if (GTDI (tmp_result, tmp_max)) {
2660 tmp_result = tmp_max;
2662 if (LTDI (tmp_result, tmp_min)) {
2663 tmp_result = tmp_min;
2669 SI opval = SUBWORDDISI (tmp_result, 0);
2670 if (UNLIKELY(current_cpu->trace_result_p))
2671 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2672 current_cpu->h_mach_set (opval);
2675 SI opval = SUBWORDDISI (tmp_result, 1);
2676 if (UNLIKELY(current_cpu->trace_result_p))
2677 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2678 current_cpu->h_macl_set (opval);
2683 abuf->written = written;
2684 current_cpu->done_insn (npc, status);
2688 // ********** macw-compact: mac.w @${rm}+, @${rn}+
2691 sh4a_sem_macw_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2692 sh4a::write_stacks &buf)
2694 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2695 sem_status status = SEM_STATUS_NORMAL;
2696 sh4a_scache* abuf = sem;
2697 unsigned long long written = 0;
2698 PCADDR pc = abuf->addr;
2699 PCADDR npc = pc + 2;
2707 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2709 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2710 if (UNLIKELY(current_cpu->trace_result_p))
2711 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2712 current_cpu->h_grc_set (FLD (f_rn), opval);
2714 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2717 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2718 if (UNLIKELY(current_cpu->trace_result_p))
2719 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2720 current_cpu->h_grc_set (FLD (f_rn), opval);
2723 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2724 written |= (1ULL << 11);
2725 if (UNLIKELY(current_cpu->trace_result_p))
2726 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2727 current_cpu->h_grc_set (FLD (f_rm), opval);
2731 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2733 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2734 written |= (1ULL << 11);
2735 if (UNLIKELY(current_cpu->trace_result_p))
2736 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2737 current_cpu->h_grc_set (FLD (f_rm), opval);
2739 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2740 if (current_cpu->h_sbit_get ()) {
2742 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
2745 written |= (1ULL << 9);
2746 if (UNLIKELY(current_cpu->trace_result_p))
2747 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2748 current_cpu->h_mach_set (opval);
2752 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
2753 written |= (1ULL << 10);
2754 if (UNLIKELY(current_cpu->trace_result_p))
2755 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2756 current_cpu->h_macl_set (opval);
2761 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2762 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2764 SI opval = SUBWORDDISI (tmp_result, 0);
2765 written |= (1ULL << 9);
2766 if (UNLIKELY(current_cpu->trace_result_p))
2767 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2768 current_cpu->h_mach_set (opval);
2771 SI opval = SUBWORDDISI (tmp_result, 1);
2772 written |= (1ULL << 10);
2773 if (UNLIKELY(current_cpu->trace_result_p))
2774 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2775 current_cpu->h_macl_set (opval);
2781 abuf->written = written;
2782 current_cpu->done_insn (npc, status);
2786 // ********** mov-compact: mov $rm64, $rn64
2789 sh4a_sem_mov_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2790 sh4a::write_stacks &buf)
2792 #define FLD(f) abuf->fields.sfmt_and_compact.f
2793 sem_status status = SEM_STATUS_NORMAL;
2794 sh4a_scache* abuf = sem;
2795 unsigned long long written = 0;
2796 PCADDR pc = abuf->addr;
2797 PCADDR npc = pc + 2;
2800 DI opval = current_cpu->h_gr_get (FLD (f_rm));
2801 if (UNLIKELY(current_cpu->trace_result_p))
2802 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2803 current_cpu->h_gr_set (FLD (f_rn), opval);
2806 current_cpu->done_insn (npc, status);
2810 // ********** movi-compact: mov #$imm8, $rn
2813 sh4a_sem_movi_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2814 sh4a::write_stacks &buf)
2816 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2817 sem_status status = SEM_STATUS_NORMAL;
2818 sh4a_scache* abuf = sem;
2819 unsigned long long written = 0;
2820 PCADDR pc = abuf->addr;
2821 PCADDR npc = pc + 2;
2824 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2825 if (UNLIKELY(current_cpu->trace_result_p))
2826 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2827 current_cpu->h_grc_set (FLD (f_rn), opval);
2830 current_cpu->done_insn (npc, status);
2834 // ********** movb1-compact: mov.b $rm, @$rn
2837 sh4a_sem_movb1_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2838 sh4a::write_stacks &buf)
2840 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2841 sem_status status = SEM_STATUS_NORMAL;
2842 sh4a_scache* abuf = sem;
2843 unsigned long long written = 0;
2844 PCADDR pc = abuf->addr;
2845 PCADDR npc = pc + 2;
2848 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2849 if (UNLIKELY(current_cpu->trace_result_p))
2850 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2851 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2854 current_cpu->done_insn (npc, status);
2858 // ********** movb2-compact: mov.b $rm, @-$rn
2861 sh4a_sem_movb2_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2862 sh4a::write_stacks &buf)
2864 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2865 sem_status status = SEM_STATUS_NORMAL;
2866 sh4a_scache* abuf = sem;
2867 unsigned long long written = 0;
2868 PCADDR pc = abuf->addr;
2869 PCADDR npc = pc + 2;
2873 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
2875 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2876 if (UNLIKELY(current_cpu->trace_result_p))
2877 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2878 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2881 SI opval = tmp_addr;
2882 if (UNLIKELY(current_cpu->trace_result_p))
2883 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2884 current_cpu->h_grc_set (FLD (f_rn), opval);
2888 current_cpu->done_insn (npc, status);
2892 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
2895 sh4a_sem_movb3_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2896 sh4a::write_stacks &buf)
2898 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2899 sem_status status = SEM_STATUS_NORMAL;
2900 sh4a_scache* abuf = sem;
2901 unsigned long long written = 0;
2902 PCADDR pc = abuf->addr;
2903 PCADDR npc = pc + 2;
2906 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2907 if (UNLIKELY(current_cpu->trace_result_p))
2908 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 << " ";
2909 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2912 current_cpu->done_insn (npc, status);
2916 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
2919 sh4a_sem_movb4_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2920 sh4a::write_stacks &buf)
2922 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2923 sem_status status = SEM_STATUS_NORMAL;
2924 sh4a_scache* abuf = sem;
2925 unsigned long long written = 0;
2926 PCADDR pc = abuf->addr;
2927 PCADDR npc = pc + 2;
2931 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
2933 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2934 if (UNLIKELY(current_cpu->trace_result_p))
2935 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2936 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2940 current_cpu->done_insn (npc, status);
2944 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
2947 sh4a_sem_movb5_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2948 sh4a::write_stacks &buf)
2950 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2951 sem_status status = SEM_STATUS_NORMAL;
2952 sh4a_scache* abuf = sem;
2953 unsigned long long written = 0;
2954 PCADDR pc = abuf->addr;
2955 PCADDR npc = pc + 2;
2959 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2961 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2962 if (UNLIKELY(current_cpu->trace_result_p))
2963 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2964 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2968 current_cpu->done_insn (npc, status);
2972 // ********** movb6-compact: mov.b @$rm, $rn
2975 sh4a_sem_movb6_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
2976 sh4a::write_stacks &buf)
2978 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2979 sem_status status = SEM_STATUS_NORMAL;
2980 sh4a_scache* abuf = sem;
2981 unsigned long long written = 0;
2982 PCADDR pc = abuf->addr;
2983 PCADDR npc = pc + 2;
2986 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2987 if (UNLIKELY(current_cpu->trace_result_p))
2988 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2989 current_cpu->h_grc_set (FLD (f_rn), opval);
2992 current_cpu->done_insn (npc, status);
2996 // ********** movb7-compact: mov.b @${rm}+, $rn
2999 sh4a_sem_movb7_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3000 sh4a::write_stacks &buf)
3002 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3003 sem_status status = SEM_STATUS_NORMAL;
3004 sh4a_scache* abuf = sem;
3005 unsigned long long written = 0;
3006 PCADDR pc = abuf->addr;
3007 PCADDR npc = pc + 2;
3011 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3012 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3014 SI opval = EXTQISI (tmp_data);
3015 written |= (1ULL << 4);
3016 if (UNLIKELY(current_cpu->trace_result_p))
3017 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3018 current_cpu->h_grc_set (FLD (f_rm), opval);
3022 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3023 written |= (1ULL << 4);
3024 if (UNLIKELY(current_cpu->trace_result_p))
3025 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3026 current_cpu->h_grc_set (FLD (f_rm), opval);
3030 SI opval = EXTQISI (tmp_data);
3031 if (UNLIKELY(current_cpu->trace_result_p))
3032 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3033 current_cpu->h_grc_set (FLD (f_rn), opval);
3037 abuf->written = written;
3038 current_cpu->done_insn (npc, status);
3042 // ********** movb8-compact: mov.b @(r0, $rm), $rn
3045 sh4a_sem_movb8_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3046 sh4a::write_stacks &buf)
3048 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3049 sem_status status = SEM_STATUS_NORMAL;
3050 sh4a_scache* abuf = sem;
3051 unsigned long long written = 0;
3052 PCADDR pc = abuf->addr;
3053 PCADDR npc = pc + 2;
3056 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3057 if (UNLIKELY(current_cpu->trace_result_p))
3058 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3059 current_cpu->h_grc_set (FLD (f_rn), opval);
3062 current_cpu->done_insn (npc, status);
3066 // ********** movb9-compact: mov.b @($imm8, gbr), r0
3069 sh4a_sem_movb9_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3070 sh4a::write_stacks &buf)
3072 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3073 sem_status status = SEM_STATUS_NORMAL;
3074 sh4a_scache* abuf = sem;
3075 unsigned long long written = 0;
3076 PCADDR pc = abuf->addr;
3077 PCADDR npc = pc + 2;
3080 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
3081 if (UNLIKELY(current_cpu->trace_result_p))
3082 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3083 current_cpu->h_grc_set (((UINT) 0), opval);
3086 current_cpu->done_insn (npc, status);
3090 // ********** movb10-compact: mov.b @($imm4, $rm), r0
3093 sh4a_sem_movb10_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3094 sh4a::write_stacks &buf)
3096 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
3097 sem_status status = SEM_STATUS_NORMAL;
3098 sh4a_scache* abuf = sem;
3099 unsigned long long written = 0;
3100 PCADDR pc = abuf->addr;
3101 PCADDR npc = pc + 2;
3104 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
3105 if (UNLIKELY(current_cpu->trace_result_p))
3106 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3107 current_cpu->h_grc_set (((UINT) 0), opval);
3110 current_cpu->done_insn (npc, status);
3114 // ********** movl1-compact: mov.l $rm, @$rn
3117 sh4a_sem_movl1_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3118 sh4a::write_stacks &buf)
3120 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3121 sem_status status = SEM_STATUS_NORMAL;
3122 sh4a_scache* abuf = sem;
3123 unsigned long long written = 0;
3124 PCADDR pc = abuf->addr;
3125 PCADDR npc = pc + 2;
3128 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3129 if (UNLIKELY(current_cpu->trace_result_p))
3130 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3131 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3134 current_cpu->done_insn (npc, status);
3138 // ********** movl2-compact: mov.l $rm, @-$rn
3141 sh4a_sem_movl2_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3142 sh4a::write_stacks &buf)
3144 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3145 sem_status status = SEM_STATUS_NORMAL;
3146 sh4a_scache* abuf = sem;
3147 unsigned long long written = 0;
3148 PCADDR pc = abuf->addr;
3149 PCADDR npc = pc + 2;
3153 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3155 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3156 if (UNLIKELY(current_cpu->trace_result_p))
3157 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3158 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3161 SI opval = tmp_addr;
3162 if (UNLIKELY(current_cpu->trace_result_p))
3163 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3164 current_cpu->h_grc_set (FLD (f_rn), opval);
3168 current_cpu->done_insn (npc, status);
3172 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
3175 sh4a_sem_movl3_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3176 sh4a::write_stacks &buf)
3178 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3179 sem_status status = SEM_STATUS_NORMAL;
3180 sh4a_scache* abuf = sem;
3181 unsigned long long written = 0;
3182 PCADDR pc = abuf->addr;
3183 PCADDR npc = pc + 2;
3186 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3187 if (UNLIKELY(current_cpu->trace_result_p))
3188 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 << " ";
3189 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3192 current_cpu->done_insn (npc, status);
3196 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
3199 sh4a_sem_movl4_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3200 sh4a::write_stacks &buf)
3202 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
3203 sem_status status = SEM_STATUS_NORMAL;
3204 sh4a_scache* abuf = sem;
3205 unsigned long long written = 0;
3206 PCADDR pc = abuf->addr;
3207 PCADDR npc = pc + 2;
3210 SI opval = current_cpu->h_grc_get (((UINT) 0));
3211 if (UNLIKELY(current_cpu->trace_result_p))
3212 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3213 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
3216 current_cpu->done_insn (npc, status);
3220 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
3223 sh4a_sem_movl5_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3224 sh4a::write_stacks &buf)
3226 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3227 sem_status status = SEM_STATUS_NORMAL;
3228 sh4a_scache* abuf = sem;
3229 unsigned long long written = 0;
3230 PCADDR pc = abuf->addr;
3231 PCADDR npc = pc + 2;
3234 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3235 if (UNLIKELY(current_cpu->trace_result_p))
3236 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 << " ";
3237 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
3240 current_cpu->done_insn (npc, status);
3244 // ********** movl6-compact: mov.l @$rm, $rn
3247 sh4a_sem_movl6_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3248 sh4a::write_stacks &buf)
3250 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3251 sem_status status = SEM_STATUS_NORMAL;
3252 sh4a_scache* abuf = sem;
3253 unsigned long long written = 0;
3254 PCADDR pc = abuf->addr;
3255 PCADDR npc = pc + 2;
3258 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3259 if (UNLIKELY(current_cpu->trace_result_p))
3260 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3261 current_cpu->h_grc_set (FLD (f_rn), opval);
3264 current_cpu->done_insn (npc, status);
3268 // ********** movl7-compact: mov.l @${rm}+, $rn
3271 sh4a_sem_movl7_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3272 sh4a::write_stacks &buf)
3274 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3275 sem_status status = SEM_STATUS_NORMAL;
3276 sh4a_scache* abuf = sem;
3277 unsigned long long written = 0;
3278 PCADDR pc = abuf->addr;
3279 PCADDR npc = pc + 2;
3283 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3284 if (UNLIKELY(current_cpu->trace_result_p))
3285 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3286 current_cpu->h_grc_set (FLD (f_rn), opval);
3288 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3290 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3291 written |= (1ULL << 5);
3292 if (UNLIKELY(current_cpu->trace_result_p))
3293 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3294 current_cpu->h_grc_set (FLD (f_rm), opval);
3298 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
3299 written |= (1ULL << 5);
3300 if (UNLIKELY(current_cpu->trace_result_p))
3301 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3302 current_cpu->h_grc_set (FLD (f_rm), opval);
3307 abuf->written = written;
3308 current_cpu->done_insn (npc, status);
3312 // ********** movl8-compact: mov.l @(r0, $rm), $rn
3315 sh4a_sem_movl8_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3316 sh4a::write_stacks &buf)
3318 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3319 sem_status status = SEM_STATUS_NORMAL;
3320 sh4a_scache* abuf = sem;
3321 unsigned long long written = 0;
3322 PCADDR pc = abuf->addr;
3323 PCADDR npc = pc + 2;
3326 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
3327 if (UNLIKELY(current_cpu->trace_result_p))
3328 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3329 current_cpu->h_grc_set (FLD (f_rn), opval);
3332 current_cpu->done_insn (npc, status);
3336 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
3339 sh4a_sem_movl9_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3340 sh4a::write_stacks &buf)
3342 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3343 sem_status status = SEM_STATUS_NORMAL;
3344 sh4a_scache* abuf = sem;
3345 unsigned long long written = 0;
3346 PCADDR pc = abuf->addr;
3347 PCADDR npc = pc + 2;
3350 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
3351 if (UNLIKELY(current_cpu->trace_result_p))
3352 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3353 current_cpu->h_grc_set (((UINT) 0), opval);
3356 current_cpu->done_insn (npc, status);
3360 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
3363 sh4a_sem_movl10_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3364 sh4a::write_stacks &buf)
3366 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3367 sem_status status = SEM_STATUS_NORMAL;
3368 sh4a_scache* abuf = sem;
3369 unsigned long long written = 0;
3370 PCADDR pc = abuf->addr;
3371 PCADDR npc = pc + 2;
3374 SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3375 if (UNLIKELY(current_cpu->trace_result_p))
3376 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3377 current_cpu->h_grc_set (FLD (f_rn), opval);
3380 current_cpu->done_insn (npc, status);
3384 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
3387 sh4a_sem_movl11_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3388 sh4a::write_stacks &buf)
3390 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3391 sem_status status = SEM_STATUS_NORMAL;
3392 sh4a_scache* abuf = sem;
3393 unsigned long long written = 0;
3394 PCADDR pc = abuf->addr;
3395 PCADDR npc = pc + 2;
3398 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
3399 if (UNLIKELY(current_cpu->trace_result_p))
3400 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3401 current_cpu->h_grc_set (FLD (f_rn), opval);
3404 current_cpu->done_insn (npc, status);
3408 // ********** movw1-compact: mov.w $rm, @$rn
3411 sh4a_sem_movw1_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3412 sh4a::write_stacks &buf)
3414 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3415 sem_status status = SEM_STATUS_NORMAL;
3416 sh4a_scache* abuf = sem;
3417 unsigned long long written = 0;
3418 PCADDR pc = abuf->addr;
3419 PCADDR npc = pc + 2;
3422 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3423 if (UNLIKELY(current_cpu->trace_result_p))
3424 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3425 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3428 current_cpu->done_insn (npc, status);
3432 // ********** movw2-compact: mov.w $rm, @-$rn
3435 sh4a_sem_movw2_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3436 sh4a::write_stacks &buf)
3438 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3439 sem_status status = SEM_STATUS_NORMAL;
3440 sh4a_scache* abuf = sem;
3441 unsigned long long written = 0;
3442 PCADDR pc = abuf->addr;
3443 PCADDR npc = pc + 2;
3447 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3449 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3450 if (UNLIKELY(current_cpu->trace_result_p))
3451 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3452 current_cpu->SETMEMHI (pc, tmp_addr, opval);
3455 SI opval = tmp_addr;
3456 if (UNLIKELY(current_cpu->trace_result_p))
3457 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3458 current_cpu->h_grc_set (FLD (f_rn), opval);
3462 current_cpu->done_insn (npc, status);
3466 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
3469 sh4a_sem_movw3_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3470 sh4a::write_stacks &buf)
3472 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3473 sem_status status = SEM_STATUS_NORMAL;
3474 sh4a_scache* abuf = sem;
3475 unsigned long long written = 0;
3476 PCADDR pc = abuf->addr;
3477 PCADDR npc = pc + 2;
3480 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3481 if (UNLIKELY(current_cpu->trace_result_p))
3482 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 << " ";
3483 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3486 current_cpu->done_insn (npc, status);
3490 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
3493 sh4a_sem_movw4_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3494 sh4a::write_stacks &buf)
3496 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
3497 sem_status status = SEM_STATUS_NORMAL;
3498 sh4a_scache* abuf = sem;
3499 unsigned long long written = 0;
3500 PCADDR pc = abuf->addr;
3501 PCADDR npc = pc + 2;
3504 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3505 if (UNLIKELY(current_cpu->trace_result_p))
3506 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3507 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
3510 current_cpu->done_insn (npc, status);
3514 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
3517 sh4a_sem_movw5_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3518 sh4a::write_stacks &buf)
3520 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3521 sem_status status = SEM_STATUS_NORMAL;
3522 sh4a_scache* abuf = sem;
3523 unsigned long long written = 0;
3524 PCADDR pc = abuf->addr;
3525 PCADDR npc = pc + 2;
3528 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3529 if (UNLIKELY(current_cpu->trace_result_p))
3530 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 << " ";
3531 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
3534 current_cpu->done_insn (npc, status);
3538 // ********** movw6-compact: mov.w @$rm, $rn
3541 sh4a_sem_movw6_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3542 sh4a::write_stacks &buf)
3544 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3545 sem_status status = SEM_STATUS_NORMAL;
3546 sh4a_scache* abuf = sem;
3547 unsigned long long written = 0;
3548 PCADDR pc = abuf->addr;
3549 PCADDR npc = pc + 2;
3552 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3553 if (UNLIKELY(current_cpu->trace_result_p))
3554 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3555 current_cpu->h_grc_set (FLD (f_rn), opval);
3558 current_cpu->done_insn (npc, status);
3562 // ********** movw7-compact: mov.w @${rm}+, $rn
3565 sh4a_sem_movw7_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3566 sh4a::write_stacks &buf)
3568 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3569 sem_status status = SEM_STATUS_NORMAL;
3570 sh4a_scache* abuf = sem;
3571 unsigned long long written = 0;
3572 PCADDR pc = abuf->addr;
3573 PCADDR npc = pc + 2;
3577 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3578 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3580 SI opval = EXTHISI (tmp_data);
3581 written |= (1ULL << 4);
3582 if (UNLIKELY(current_cpu->trace_result_p))
3583 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3584 current_cpu->h_grc_set (FLD (f_rm), opval);
3588 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
3589 written |= (1ULL << 4);
3590 if (UNLIKELY(current_cpu->trace_result_p))
3591 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3592 current_cpu->h_grc_set (FLD (f_rm), opval);
3596 SI opval = EXTHISI (tmp_data);
3597 if (UNLIKELY(current_cpu->trace_result_p))
3598 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3599 current_cpu->h_grc_set (FLD (f_rn), opval);
3603 abuf->written = written;
3604 current_cpu->done_insn (npc, status);
3608 // ********** movw8-compact: mov.w @(r0, $rm), $rn
3611 sh4a_sem_movw8_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3612 sh4a::write_stacks &buf)
3614 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3615 sem_status status = SEM_STATUS_NORMAL;
3616 sh4a_scache* abuf = sem;
3617 unsigned long long written = 0;
3618 PCADDR pc = abuf->addr;
3619 PCADDR npc = pc + 2;
3622 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3623 if (UNLIKELY(current_cpu->trace_result_p))
3624 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3625 current_cpu->h_grc_set (FLD (f_rn), opval);
3628 current_cpu->done_insn (npc, status);
3632 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
3635 sh4a_sem_movw9_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3636 sh4a::write_stacks &buf)
3638 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
3639 sem_status status = SEM_STATUS_NORMAL;
3640 sh4a_scache* abuf = sem;
3641 unsigned long long written = 0;
3642 PCADDR pc = abuf->addr;
3643 PCADDR npc = pc + 2;
3646 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
3647 if (UNLIKELY(current_cpu->trace_result_p))
3648 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3649 current_cpu->h_grc_set (((UINT) 0), opval);
3652 current_cpu->done_insn (npc, status);
3656 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
3659 sh4a_sem_movw10_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3660 sh4a::write_stacks &buf)
3662 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3663 sem_status status = SEM_STATUS_NORMAL;
3664 sh4a_scache* abuf = sem;
3665 unsigned long long written = 0;
3666 PCADDR pc = abuf->addr;
3667 PCADDR npc = pc + 2;
3670 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
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 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
3683 sh4a_sem_movw11_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3684 sh4a::write_stacks &buf)
3686 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
3687 sem_status status = SEM_STATUS_NORMAL;
3688 sh4a_scache* abuf = sem;
3689 unsigned long long written = 0;
3690 PCADDR pc = abuf->addr;
3691 PCADDR npc = pc + 2;
3694 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
3695 if (UNLIKELY(current_cpu->trace_result_p))
3696 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3697 current_cpu->h_grc_set (((UINT) 0), opval);
3700 current_cpu->done_insn (npc, status);
3704 // ********** mova-compact: mova @($imm8x4, pc), r0
3707 sh4a_sem_mova_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3708 sh4a::write_stacks &buf)
3710 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3711 sem_status status = SEM_STATUS_NORMAL;
3712 sh4a_scache* abuf = sem;
3713 unsigned long long written = 0;
3714 PCADDR pc = abuf->addr;
3715 PCADDR npc = pc + 2;
3718 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3719 if (UNLIKELY(current_cpu->trace_result_p))
3720 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3721 current_cpu->h_grc_set (((UINT) 0), opval);
3724 current_cpu->done_insn (npc, status);
3728 // ********** movcal-compact: movca.l r0, @$rn
3731 sh4a_sem_movcal_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3732 sh4a::write_stacks &buf)
3734 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3735 sem_status status = SEM_STATUS_NORMAL;
3736 sh4a_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_grc_get (((UINT) 0));
3743 if (UNLIKELY(current_cpu->trace_result_p))
3744 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3745 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3748 current_cpu->done_insn (npc, status);
3752 // ********** movcol-compact: movco.l r0, @$rn
3755 sh4a_sem_movcol_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3756 sh4a::write_stacks &buf)
3758 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
3759 sem_status status = SEM_STATUS_NORMAL;
3760 sh4a_scache* abuf = sem;
3761 unsigned long long written = 0;
3762 PCADDR pc = abuf->addr;
3763 PCADDR npc = pc + 2;
3766 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3767 if (UNLIKELY(current_cpu->trace_result_p))
3768 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3769 current_cpu->h_grc_set (FLD (f_rn), opval);
3772 current_cpu->done_insn (npc, status);
3776 // ********** movt-compact: movt $rn
3779 sh4a_sem_movt_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3780 sh4a::write_stacks &buf)
3782 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3783 sem_status status = SEM_STATUS_NORMAL;
3784 sh4a_scache* abuf = sem;
3785 unsigned long long written = 0;
3786 PCADDR pc = abuf->addr;
3787 PCADDR npc = pc + 2;
3790 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
3791 if (UNLIKELY(current_cpu->trace_result_p))
3792 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3793 current_cpu->h_grc_set (FLD (f_rn), opval);
3796 current_cpu->done_insn (npc, status);
3800 // ********** movual-compact: movua.l @$rn, r0
3803 sh4a_sem_movual_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3804 sh4a::write_stacks &buf)
3806 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3807 sem_status status = SEM_STATUS_NORMAL;
3808 sh4a_scache* abuf = sem;
3809 unsigned long long written = 0;
3810 PCADDR pc = abuf->addr;
3811 PCADDR npc = pc + 2;
3814 SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
3815 if (UNLIKELY(current_cpu->trace_result_p))
3816 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3817 current_cpu->h_grc_set (((UINT) 0), opval);
3820 current_cpu->done_insn (npc, status);
3824 // ********** movual2-compact: movua.l @$rn+, r0
3827 sh4a_sem_movual2_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3828 sh4a::write_stacks &buf)
3830 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3831 sem_status status = SEM_STATUS_NORMAL;
3832 sh4a_scache* abuf = sem;
3833 unsigned long long written = 0;
3834 PCADDR pc = abuf->addr;
3835 PCADDR npc = pc + 2;
3839 SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
3840 if (UNLIKELY(current_cpu->trace_result_p))
3841 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3842 current_cpu->h_grc_set (((UINT) 0), opval);
3845 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3846 if (UNLIKELY(current_cpu->trace_result_p))
3847 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3848 current_cpu->h_grc_set (FLD (f_rn), opval);
3852 current_cpu->done_insn (npc, status);
3856 // ********** mull-compact: mul.l $rm, $rn
3859 sh4a_sem_mull_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3860 sh4a::write_stacks &buf)
3862 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3863 sem_status status = SEM_STATUS_NORMAL;
3864 sh4a_scache* abuf = sem;
3865 unsigned long long written = 0;
3866 PCADDR pc = abuf->addr;
3867 PCADDR npc = pc + 2;
3870 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
3871 if (UNLIKELY(current_cpu->trace_result_p))
3872 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3873 current_cpu->h_macl_set (opval);
3876 current_cpu->done_insn (npc, status);
3880 // ********** mulsw-compact: muls.w $rm, $rn
3883 sh4a_sem_mulsw_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3884 sh4a::write_stacks &buf)
3886 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3887 sem_status status = SEM_STATUS_NORMAL;
3888 sh4a_scache* abuf = sem;
3889 unsigned long long written = 0;
3890 PCADDR pc = abuf->addr;
3891 PCADDR npc = pc + 2;
3894 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)));
3895 if (UNLIKELY(current_cpu->trace_result_p))
3896 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3897 current_cpu->h_macl_set (opval);
3900 current_cpu->done_insn (npc, status);
3904 // ********** muluw-compact: mulu.w $rm, $rn
3907 sh4a_sem_muluw_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3908 sh4a::write_stacks &buf)
3910 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3911 sem_status status = SEM_STATUS_NORMAL;
3912 sh4a_scache* abuf = sem;
3913 unsigned long long written = 0;
3914 PCADDR pc = abuf->addr;
3915 PCADDR npc = pc + 2;
3918 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)));
3919 if (UNLIKELY(current_cpu->trace_result_p))
3920 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3921 current_cpu->h_macl_set (opval);
3924 current_cpu->done_insn (npc, status);
3928 // ********** neg-compact: neg $rm, $rn
3931 sh4a_sem_neg_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3932 sh4a::write_stacks &buf)
3934 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3935 sem_status status = SEM_STATUS_NORMAL;
3936 sh4a_scache* abuf = sem;
3937 unsigned long long written = 0;
3938 PCADDR pc = abuf->addr;
3939 PCADDR npc = pc + 2;
3942 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
3943 if (UNLIKELY(current_cpu->trace_result_p))
3944 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3945 current_cpu->h_grc_set (FLD (f_rn), opval);
3948 current_cpu->done_insn (npc, status);
3952 // ********** negc-compact: negc $rm, $rn
3955 sh4a_sem_negc_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3956 sh4a::write_stacks &buf)
3958 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3959 sem_status status = SEM_STATUS_NORMAL;
3960 sh4a_scache* abuf = sem;
3961 unsigned long long written = 0;
3962 PCADDR pc = abuf->addr;
3963 PCADDR npc = pc + 2;
3967 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3969 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3970 if (UNLIKELY(current_cpu->trace_result_p))
3971 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3972 current_cpu->h_grc_set (FLD (f_rn), opval);
3975 BI opval = tmp_flag;
3976 if (UNLIKELY(current_cpu->trace_result_p))
3977 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3978 current_cpu->h_tbit_set (opval);
3982 current_cpu->done_insn (npc, status);
3986 // ********** nop-compact: nop
3989 sh4a_sem_nop_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
3990 sh4a::write_stacks &buf)
3992 #define FLD(f) abuf->fields.fmt_empty.f
3993 sem_status status = SEM_STATUS_NORMAL;
3994 sh4a_scache* abuf = sem;
3995 unsigned long long written = 0;
3996 PCADDR pc = abuf->addr;
3997 PCADDR npc = pc + 2;
4001 current_cpu->done_insn (npc, status);
4005 // ********** not-compact: not $rm64, $rn64
4008 sh4a_sem_not_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4009 sh4a::write_stacks &buf)
4011 #define FLD(f) abuf->fields.sfmt_and_compact.f
4012 sem_status status = SEM_STATUS_NORMAL;
4013 sh4a_scache* abuf = sem;
4014 unsigned long long written = 0;
4015 PCADDR pc = abuf->addr;
4016 PCADDR npc = pc + 2;
4019 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
4020 if (UNLIKELY(current_cpu->trace_result_p))
4021 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4022 current_cpu->h_gr_set (FLD (f_rn), opval);
4025 current_cpu->done_insn (npc, status);
4029 // ********** ocbi-compact: ocbi @$rn
4032 sh4a_sem_ocbi_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4033 sh4a::write_stacks &buf)
4035 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4036 sem_status status = SEM_STATUS_NORMAL;
4037 sh4a_scache* abuf = sem;
4038 unsigned long long written = 0;
4039 PCADDR pc = abuf->addr;
4040 PCADDR npc = pc + 2;
4044 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4045 if (UNLIKELY(current_cpu->trace_result_p))
4046 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4047 current_cpu->h_grc_set (FLD (f_rn), opval);
4052 current_cpu->done_insn (npc, status);
4056 // ********** ocbp-compact: ocbp @$rn
4059 sh4a_sem_ocbp_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4060 sh4a::write_stacks &buf)
4062 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4063 sem_status status = SEM_STATUS_NORMAL;
4064 sh4a_scache* abuf = sem;
4065 unsigned long long written = 0;
4066 PCADDR pc = abuf->addr;
4067 PCADDR npc = pc + 2;
4071 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4072 if (UNLIKELY(current_cpu->trace_result_p))
4073 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4074 current_cpu->h_grc_set (FLD (f_rn), opval);
4079 current_cpu->done_insn (npc, status);
4083 // ********** ocbwb-compact: ocbwb @$rn
4086 sh4a_sem_ocbwb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4087 sh4a::write_stacks &buf)
4089 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4090 sem_status status = SEM_STATUS_NORMAL;
4091 sh4a_scache* abuf = sem;
4092 unsigned long long written = 0;
4093 PCADDR pc = abuf->addr;
4094 PCADDR npc = pc + 2;
4098 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4099 if (UNLIKELY(current_cpu->trace_result_p))
4100 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4101 current_cpu->h_grc_set (FLD (f_rn), opval);
4106 current_cpu->done_insn (npc, status);
4110 // ********** or-compact: or $rm64, $rn64
4113 sh4a_sem_or_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4114 sh4a::write_stacks &buf)
4116 #define FLD(f) abuf->fields.sfmt_and_compact.f
4117 sem_status status = SEM_STATUS_NORMAL;
4118 sh4a_scache* abuf = sem;
4119 unsigned long long written = 0;
4120 PCADDR pc = abuf->addr;
4121 PCADDR npc = pc + 2;
4124 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
4125 if (UNLIKELY(current_cpu->trace_result_p))
4126 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4127 current_cpu->h_gr_set (FLD (f_rn), opval);
4130 current_cpu->done_insn (npc, status);
4134 // ********** ori-compact: or #$uimm8, r0
4137 sh4a_sem_ori_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4138 sh4a::write_stacks &buf)
4140 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4141 sem_status status = SEM_STATUS_NORMAL;
4142 sh4a_scache* abuf = sem;
4143 unsigned long long written = 0;
4144 PCADDR pc = abuf->addr;
4145 PCADDR npc = pc + 2;
4148 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4149 if (UNLIKELY(current_cpu->trace_result_p))
4150 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4151 current_cpu->h_grc_set (((UINT) 0), opval);
4154 current_cpu->done_insn (npc, status);
4158 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
4161 sh4a_sem_orb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4162 sh4a::write_stacks &buf)
4164 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4165 sem_status status = SEM_STATUS_NORMAL;
4166 sh4a_scache* abuf = sem;
4167 unsigned long long written = 0;
4168 PCADDR pc = abuf->addr;
4169 PCADDR npc = pc + 2;
4174 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4175 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4177 UQI opval = tmp_data;
4178 if (UNLIKELY(current_cpu->trace_result_p))
4179 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4180 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4184 current_cpu->done_insn (npc, status);
4188 // ********** pref-compact: pref @$rn
4191 sh4a_sem_pref_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4192 sh4a::write_stacks &buf)
4194 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4195 sem_status status = SEM_STATUS_NORMAL;
4196 sh4a_scache* abuf = sem;
4197 unsigned long long written = 0;
4198 PCADDR pc = abuf->addr;
4199 PCADDR npc = pc + 2;
4201 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
4203 current_cpu->done_insn (npc, status);
4207 // ********** rotcl-compact: rotcl $rn
4210 sh4a_sem_rotcl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4211 sh4a::write_stacks &buf)
4213 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4214 sem_status status = SEM_STATUS_NORMAL;
4215 sh4a_scache* abuf = sem;
4216 unsigned long long written = 0;
4217 PCADDR pc = abuf->addr;
4218 PCADDR npc = pc + 2;
4222 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4224 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
4225 if (UNLIKELY(current_cpu->trace_result_p))
4226 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4227 current_cpu->h_grc_set (FLD (f_rn), opval);
4230 BI opval = ((tmp_temp) ? (1) : (0));
4231 if (UNLIKELY(current_cpu->trace_result_p))
4232 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4233 current_cpu->h_tbit_set (opval);
4237 current_cpu->done_insn (npc, status);
4241 // ********** rotcr-compact: rotcr $rn
4244 sh4a_sem_rotcr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4245 sh4a::write_stacks &buf)
4247 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4248 sem_status status = SEM_STATUS_NORMAL;
4249 sh4a_scache* abuf = sem;
4250 unsigned long long written = 0;
4251 PCADDR pc = abuf->addr;
4252 PCADDR npc = pc + 2;
4257 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4258 tmp_temp = current_cpu->h_tbit_get ();
4260 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4261 if (UNLIKELY(current_cpu->trace_result_p))
4262 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4263 current_cpu->h_grc_set (FLD (f_rn), opval);
4266 BI opval = ((tmp_lsbit) ? (1) : (0));
4267 if (UNLIKELY(current_cpu->trace_result_p))
4268 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4269 current_cpu->h_tbit_set (opval);
4273 current_cpu->done_insn (npc, status);
4277 // ********** rotl-compact: rotl $rn
4280 sh4a_sem_rotl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4281 sh4a::write_stacks &buf)
4283 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4284 sem_status status = SEM_STATUS_NORMAL;
4285 sh4a_scache* abuf = sem;
4286 unsigned long long written = 0;
4287 PCADDR pc = abuf->addr;
4288 PCADDR npc = pc + 2;
4292 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4294 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
4295 if (UNLIKELY(current_cpu->trace_result_p))
4296 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4297 current_cpu->h_grc_set (FLD (f_rn), opval);
4300 BI opval = ((tmp_temp) ? (1) : (0));
4301 if (UNLIKELY(current_cpu->trace_result_p))
4302 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4303 current_cpu->h_tbit_set (opval);
4307 current_cpu->done_insn (npc, status);
4311 // ********** rotr-compact: rotr $rn
4314 sh4a_sem_rotr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4315 sh4a::write_stacks &buf)
4317 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4318 sem_status status = SEM_STATUS_NORMAL;
4319 sh4a_scache* abuf = sem;
4320 unsigned long long written = 0;
4321 PCADDR pc = abuf->addr;
4322 PCADDR npc = pc + 2;
4327 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4328 tmp_temp = tmp_lsbit;
4330 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4331 if (UNLIKELY(current_cpu->trace_result_p))
4332 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4333 current_cpu->h_grc_set (FLD (f_rn), opval);
4336 BI opval = ((tmp_lsbit) ? (1) : (0));
4337 if (UNLIKELY(current_cpu->trace_result_p))
4338 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4339 current_cpu->h_tbit_set (opval);
4343 current_cpu->done_insn (npc, status);
4347 // ********** rts-compact: rts
4350 sh4a_sem_rts_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4351 sh4a::write_stacks &buf)
4353 #define FLD(f) abuf->fields.fmt_empty.f
4354 sem_status status = SEM_STATUS_NORMAL;
4355 sh4a_scache* abuf = sem;
4356 unsigned long long written = 0;
4357 PCADDR pc = abuf->addr;
4358 PCADDR npc = pc + 2;
4362 UDI opval = ADDDI (pc, 2);
4363 if (UNLIKELY(current_cpu->trace_result_p))
4364 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4365 current_cpu->branch (opval, npc, status);
4367 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
4369 UDI opval = current_cpu->h_pr_get ();
4370 buf.h_pc_writes [(tick + 1) % sh4a::pipe_sz].push (sh4a::write<UDI>(pc, opval));
4371 if (UNLIKELY(current_cpu->trace_result_p))
4372 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4374 current_cpu->notify_ret (current_cpu->h_pr_get ());
4377 current_cpu->done_cti_insn (npc, status);
4381 // ********** sets-compact: sets
4384 sh4a_sem_sets_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4385 sh4a::write_stacks &buf)
4387 #define FLD(f) abuf->fields.fmt_empty.f
4388 sem_status status = SEM_STATUS_NORMAL;
4389 sh4a_scache* abuf = sem;
4390 unsigned long long written = 0;
4391 PCADDR pc = abuf->addr;
4392 PCADDR npc = pc + 2;
4396 if (UNLIKELY(current_cpu->trace_result_p))
4397 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
4398 current_cpu->h_sbit_set (opval);
4401 current_cpu->done_insn (npc, status);
4405 // ********** sett-compact: sett
4408 sh4a_sem_sett_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4409 sh4a::write_stacks &buf)
4411 #define FLD(f) abuf->fields.fmt_empty.f
4412 sem_status status = SEM_STATUS_NORMAL;
4413 sh4a_scache* abuf = sem;
4414 unsigned long long written = 0;
4415 PCADDR pc = abuf->addr;
4416 PCADDR npc = pc + 2;
4420 if (UNLIKELY(current_cpu->trace_result_p))
4421 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4422 current_cpu->h_tbit_set (opval);
4425 current_cpu->done_insn (npc, status);
4429 // ********** shad-compact: shad $rm, $rn
4432 sh4a_sem_shad_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4433 sh4a::write_stacks &buf)
4435 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4436 sem_status status = SEM_STATUS_NORMAL;
4437 sh4a_scache* abuf = sem;
4438 unsigned long long written = 0;
4439 PCADDR pc = abuf->addr;
4440 PCADDR npc = pc + 2;
4444 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4445 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4447 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4448 written |= (1ULL << 2);
4449 if (UNLIKELY(current_cpu->trace_result_p))
4450 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4451 current_cpu->h_grc_set (FLD (f_rn), opval);
4454 if (NESI (tmp_shamt, 0)) {
4456 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4457 written |= (1ULL << 2);
4458 if (UNLIKELY(current_cpu->trace_result_p))
4459 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4460 current_cpu->h_grc_set (FLD (f_rn), opval);
4463 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
4465 SI opval = NEGSI (1);
4466 written |= (1ULL << 2);
4467 if (UNLIKELY(current_cpu->trace_result_p))
4468 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4469 current_cpu->h_grc_set (FLD (f_rn), opval);
4474 written |= (1ULL << 2);
4475 if (UNLIKELY(current_cpu->trace_result_p))
4476 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4477 current_cpu->h_grc_set (FLD (f_rn), opval);
4484 abuf->written = written;
4485 current_cpu->done_insn (npc, status);
4489 // ********** shal-compact: shal $rn
4492 sh4a_sem_shal_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4493 sh4a::write_stacks &buf)
4495 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4496 sem_status status = SEM_STATUS_NORMAL;
4497 sh4a_scache* abuf = sem;
4498 unsigned long long written = 0;
4499 PCADDR pc = abuf->addr;
4500 PCADDR npc = pc + 2;
4504 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4506 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4507 if (UNLIKELY(current_cpu->trace_result_p))
4508 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4509 current_cpu->h_grc_set (FLD (f_rn), opval);
4512 BI opval = ((tmp_t) ? (1) : (0));
4513 if (UNLIKELY(current_cpu->trace_result_p))
4514 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4515 current_cpu->h_tbit_set (opval);
4519 current_cpu->done_insn (npc, status);
4523 // ********** shar-compact: shar $rn
4526 sh4a_sem_shar_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4527 sh4a::write_stacks &buf)
4529 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4530 sem_status status = SEM_STATUS_NORMAL;
4531 sh4a_scache* abuf = sem;
4532 unsigned long long written = 0;
4533 PCADDR pc = abuf->addr;
4534 PCADDR npc = pc + 2;
4538 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4540 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4541 if (UNLIKELY(current_cpu->trace_result_p))
4542 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4543 current_cpu->h_grc_set (FLD (f_rn), opval);
4546 BI opval = ((tmp_t) ? (1) : (0));
4547 if (UNLIKELY(current_cpu->trace_result_p))
4548 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4549 current_cpu->h_tbit_set (opval);
4553 current_cpu->done_insn (npc, status);
4557 // ********** shld-compact: shld $rm, $rn
4560 sh4a_sem_shld_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4561 sh4a::write_stacks &buf)
4563 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4564 sem_status status = SEM_STATUS_NORMAL;
4565 sh4a_scache* abuf = sem;
4566 unsigned long long written = 0;
4567 PCADDR pc = abuf->addr;
4568 PCADDR npc = pc + 2;
4572 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4573 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4575 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4576 written |= (1ULL << 2);
4577 if (UNLIKELY(current_cpu->trace_result_p))
4578 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4579 current_cpu->h_grc_set (FLD (f_rn), opval);
4582 if (NESI (tmp_shamt, 0)) {
4584 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4585 written |= (1ULL << 2);
4586 if (UNLIKELY(current_cpu->trace_result_p))
4587 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4588 current_cpu->h_grc_set (FLD (f_rn), opval);
4593 written |= (1ULL << 2);
4594 if (UNLIKELY(current_cpu->trace_result_p))
4595 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4596 current_cpu->h_grc_set (FLD (f_rn), opval);
4602 abuf->written = written;
4603 current_cpu->done_insn (npc, status);
4607 // ********** shll-compact: shll $rn
4610 sh4a_sem_shll_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4611 sh4a::write_stacks &buf)
4613 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4614 sem_status status = SEM_STATUS_NORMAL;
4615 sh4a_scache* abuf = sem;
4616 unsigned long long written = 0;
4617 PCADDR pc = abuf->addr;
4618 PCADDR npc = pc + 2;
4622 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4624 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4625 if (UNLIKELY(current_cpu->trace_result_p))
4626 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4627 current_cpu->h_grc_set (FLD (f_rn), opval);
4630 BI opval = ((tmp_t) ? (1) : (0));
4631 if (UNLIKELY(current_cpu->trace_result_p))
4632 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4633 current_cpu->h_tbit_set (opval);
4637 current_cpu->done_insn (npc, status);
4641 // ********** shll2-compact: shll2 $rn
4644 sh4a_sem_shll2_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4645 sh4a::write_stacks &buf)
4647 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4648 sem_status status = SEM_STATUS_NORMAL;
4649 sh4a_scache* abuf = sem;
4650 unsigned long long written = 0;
4651 PCADDR pc = abuf->addr;
4652 PCADDR npc = pc + 2;
4655 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4656 if (UNLIKELY(current_cpu->trace_result_p))
4657 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4658 current_cpu->h_grc_set (FLD (f_rn), opval);
4661 current_cpu->done_insn (npc, status);
4665 // ********** shll8-compact: shll8 $rn
4668 sh4a_sem_shll8_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4669 sh4a::write_stacks &buf)
4671 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4672 sem_status status = SEM_STATUS_NORMAL;
4673 sh4a_scache* abuf = sem;
4674 unsigned long long written = 0;
4675 PCADDR pc = abuf->addr;
4676 PCADDR npc = pc + 2;
4679 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4680 if (UNLIKELY(current_cpu->trace_result_p))
4681 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4682 current_cpu->h_grc_set (FLD (f_rn), opval);
4685 current_cpu->done_insn (npc, status);
4689 // ********** shll16-compact: shll16 $rn
4692 sh4a_sem_shll16_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4693 sh4a::write_stacks &buf)
4695 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4696 sem_status status = SEM_STATUS_NORMAL;
4697 sh4a_scache* abuf = sem;
4698 unsigned long long written = 0;
4699 PCADDR pc = abuf->addr;
4700 PCADDR npc = pc + 2;
4703 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4704 if (UNLIKELY(current_cpu->trace_result_p))
4705 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4706 current_cpu->h_grc_set (FLD (f_rn), opval);
4709 current_cpu->done_insn (npc, status);
4713 // ********** shlr-compact: shlr $rn
4716 sh4a_sem_shlr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4717 sh4a::write_stacks &buf)
4719 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4720 sem_status status = SEM_STATUS_NORMAL;
4721 sh4a_scache* abuf = sem;
4722 unsigned long long written = 0;
4723 PCADDR pc = abuf->addr;
4724 PCADDR npc = pc + 2;
4728 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4730 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4731 if (UNLIKELY(current_cpu->trace_result_p))
4732 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4733 current_cpu->h_grc_set (FLD (f_rn), opval);
4736 BI opval = ((tmp_t) ? (1) : (0));
4737 if (UNLIKELY(current_cpu->trace_result_p))
4738 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4739 current_cpu->h_tbit_set (opval);
4743 current_cpu->done_insn (npc, status);
4747 // ********** shlr2-compact: shlr2 $rn
4750 sh4a_sem_shlr2_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4751 sh4a::write_stacks &buf)
4753 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4754 sem_status status = SEM_STATUS_NORMAL;
4755 sh4a_scache* abuf = sem;
4756 unsigned long long written = 0;
4757 PCADDR pc = abuf->addr;
4758 PCADDR npc = pc + 2;
4761 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4762 if (UNLIKELY(current_cpu->trace_result_p))
4763 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4764 current_cpu->h_grc_set (FLD (f_rn), opval);
4767 current_cpu->done_insn (npc, status);
4771 // ********** shlr8-compact: shlr8 $rn
4774 sh4a_sem_shlr8_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4775 sh4a::write_stacks &buf)
4777 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4778 sem_status status = SEM_STATUS_NORMAL;
4779 sh4a_scache* abuf = sem;
4780 unsigned long long written = 0;
4781 PCADDR pc = abuf->addr;
4782 PCADDR npc = pc + 2;
4785 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4786 if (UNLIKELY(current_cpu->trace_result_p))
4787 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4788 current_cpu->h_grc_set (FLD (f_rn), opval);
4791 current_cpu->done_insn (npc, status);
4795 // ********** shlr16-compact: shlr16 $rn
4798 sh4a_sem_shlr16_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4799 sh4a::write_stacks &buf)
4801 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4802 sem_status status = SEM_STATUS_NORMAL;
4803 sh4a_scache* abuf = sem;
4804 unsigned long long written = 0;
4805 PCADDR pc = abuf->addr;
4806 PCADDR npc = pc + 2;
4809 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4810 if (UNLIKELY(current_cpu->trace_result_p))
4811 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4812 current_cpu->h_grc_set (FLD (f_rn), opval);
4815 current_cpu->done_insn (npc, status);
4819 // ********** stc-gbr-compact: stc gbr, $rn
4822 sh4a_sem_stc_gbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4823 sh4a::write_stacks &buf)
4825 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4826 sem_status status = SEM_STATUS_NORMAL;
4827 sh4a_scache* abuf = sem;
4828 unsigned long long written = 0;
4829 PCADDR pc = abuf->addr;
4830 PCADDR npc = pc + 2;
4833 SI opval = current_cpu->h_gbr_get ();
4834 if (UNLIKELY(current_cpu->trace_result_p))
4835 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4836 current_cpu->h_grc_set (FLD (f_rn), opval);
4839 current_cpu->done_insn (npc, status);
4843 // ********** stc-vbr-compact: stc vbr, $rn
4846 sh4a_sem_stc_vbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4847 sh4a::write_stacks &buf)
4849 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4850 sem_status status = SEM_STATUS_NORMAL;
4851 sh4a_scache* abuf = sem;
4852 unsigned long long written = 0;
4853 PCADDR pc = abuf->addr;
4854 PCADDR npc = pc + 2;
4857 SI opval = current_cpu->h_vbr_get ();
4858 if (UNLIKELY(current_cpu->trace_result_p))
4859 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4860 current_cpu->h_grc_set (FLD (f_rn), opval);
4863 current_cpu->done_insn (npc, status);
4867 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
4870 sh4a_sem_stcl_gbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4871 sh4a::write_stacks &buf)
4873 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4874 sem_status status = SEM_STATUS_NORMAL;
4875 sh4a_scache* abuf = sem;
4876 unsigned long long written = 0;
4877 PCADDR pc = abuf->addr;
4878 PCADDR npc = pc + 2;
4882 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4884 SI opval = current_cpu->h_gbr_get ();
4885 if (UNLIKELY(current_cpu->trace_result_p))
4886 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4887 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4890 SI opval = tmp_addr;
4891 if (UNLIKELY(current_cpu->trace_result_p))
4892 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4893 current_cpu->h_grc_set (FLD (f_rn), opval);
4897 current_cpu->done_insn (npc, status);
4901 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
4904 sh4a_sem_stcl_vbr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4905 sh4a::write_stacks &buf)
4907 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4908 sem_status status = SEM_STATUS_NORMAL;
4909 sh4a_scache* abuf = sem;
4910 unsigned long long written = 0;
4911 PCADDR pc = abuf->addr;
4912 PCADDR npc = pc + 2;
4916 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4918 SI opval = current_cpu->h_vbr_get ();
4919 if (UNLIKELY(current_cpu->trace_result_p))
4920 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4921 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4924 SI opval = tmp_addr;
4925 if (UNLIKELY(current_cpu->trace_result_p))
4926 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4927 current_cpu->h_grc_set (FLD (f_rn), opval);
4931 current_cpu->done_insn (npc, status);
4935 // ********** sts-fpscr-compact: sts fpscr, $rn
4938 sh4a_sem_sts_fpscr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4939 sh4a::write_stacks &buf)
4941 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4942 sem_status status = SEM_STATUS_NORMAL;
4943 sh4a_scache* abuf = sem;
4944 unsigned long long written = 0;
4945 PCADDR pc = abuf->addr;
4946 PCADDR npc = pc + 2;
4949 SI opval = current_cpu->hardware.h_fpscr;
4950 if (UNLIKELY(current_cpu->trace_result_p))
4951 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4952 current_cpu->h_grc_set (FLD (f_rn), opval);
4955 current_cpu->done_insn (npc, status);
4959 // ********** stsl-fpscr-compact: sts.l fpscr, @-$rn
4962 sh4a_sem_stsl_fpscr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4963 sh4a::write_stacks &buf)
4965 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4966 sem_status status = SEM_STATUS_NORMAL;
4967 sh4a_scache* abuf = sem;
4968 unsigned long long written = 0;
4969 PCADDR pc = abuf->addr;
4970 PCADDR npc = pc + 2;
4974 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4976 SI opval = current_cpu->hardware.h_fpscr;
4977 if (UNLIKELY(current_cpu->trace_result_p))
4978 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4979 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4982 SI opval = tmp_addr;
4983 if (UNLIKELY(current_cpu->trace_result_p))
4984 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4985 current_cpu->h_grc_set (FLD (f_rn), opval);
4989 current_cpu->done_insn (npc, status);
4993 // ********** sts-fpul-compact: sts fpul, $rn
4996 sh4a_sem_sts_fpul_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
4997 sh4a::write_stacks &buf)
4999 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5000 sem_status status = SEM_STATUS_NORMAL;
5001 sh4a_scache* abuf = sem;
5002 unsigned long long written = 0;
5003 PCADDR pc = abuf->addr;
5004 PCADDR npc = pc + 2;
5007 SI opval = SUBWORDSFSI (current_cpu->hardware.h_fr[((UINT) 32)]);
5008 if (UNLIKELY(current_cpu->trace_result_p))
5009 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5010 current_cpu->h_grc_set (FLD (f_rn), opval);
5013 current_cpu->done_insn (npc, status);
5017 // ********** stsl-fpul-compact: sts.l fpul, @-$rn
5020 sh4a_sem_stsl_fpul_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5021 sh4a::write_stacks &buf)
5023 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5024 sem_status status = SEM_STATUS_NORMAL;
5025 sh4a_scache* abuf = sem;
5026 unsigned long long written = 0;
5027 PCADDR pc = abuf->addr;
5028 PCADDR npc = pc + 2;
5032 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5034 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
5035 if (UNLIKELY(current_cpu->trace_result_p))
5036 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5037 current_cpu->SETMEMSF (pc, tmp_addr, opval);
5040 SI opval = tmp_addr;
5041 if (UNLIKELY(current_cpu->trace_result_p))
5042 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5043 current_cpu->h_grc_set (FLD (f_rn), opval);
5047 current_cpu->done_insn (npc, status);
5051 // ********** sts-mach-compact: sts mach, $rn
5054 sh4a_sem_sts_mach_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5055 sh4a::write_stacks &buf)
5057 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5058 sem_status status = SEM_STATUS_NORMAL;
5059 sh4a_scache* abuf = sem;
5060 unsigned long long written = 0;
5061 PCADDR pc = abuf->addr;
5062 PCADDR npc = pc + 2;
5065 SI opval = current_cpu->h_mach_get ();
5066 if (UNLIKELY(current_cpu->trace_result_p))
5067 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5068 current_cpu->h_grc_set (FLD (f_rn), opval);
5071 current_cpu->done_insn (npc, status);
5075 // ********** stsl-mach-compact: sts.l mach, @-$rn
5078 sh4a_sem_stsl_mach_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5079 sh4a::write_stacks &buf)
5081 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5082 sem_status status = SEM_STATUS_NORMAL;
5083 sh4a_scache* abuf = sem;
5084 unsigned long long written = 0;
5085 PCADDR pc = abuf->addr;
5086 PCADDR npc = pc + 2;
5090 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5092 SI opval = current_cpu->h_mach_get ();
5093 if (UNLIKELY(current_cpu->trace_result_p))
5094 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5095 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5098 SI opval = tmp_addr;
5099 if (UNLIKELY(current_cpu->trace_result_p))
5100 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5101 current_cpu->h_grc_set (FLD (f_rn), opval);
5105 current_cpu->done_insn (npc, status);
5109 // ********** sts-macl-compact: sts macl, $rn
5112 sh4a_sem_sts_macl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5113 sh4a::write_stacks &buf)
5115 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5116 sem_status status = SEM_STATUS_NORMAL;
5117 sh4a_scache* abuf = sem;
5118 unsigned long long written = 0;
5119 PCADDR pc = abuf->addr;
5120 PCADDR npc = pc + 2;
5123 SI opval = current_cpu->h_macl_get ();
5124 if (UNLIKELY(current_cpu->trace_result_p))
5125 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5126 current_cpu->h_grc_set (FLD (f_rn), opval);
5129 current_cpu->done_insn (npc, status);
5133 // ********** stsl-macl-compact: sts.l macl, @-$rn
5136 sh4a_sem_stsl_macl_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5137 sh4a::write_stacks &buf)
5139 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5140 sem_status status = SEM_STATUS_NORMAL;
5141 sh4a_scache* abuf = sem;
5142 unsigned long long written = 0;
5143 PCADDR pc = abuf->addr;
5144 PCADDR npc = pc + 2;
5148 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5150 SI opval = current_cpu->h_macl_get ();
5151 if (UNLIKELY(current_cpu->trace_result_p))
5152 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5153 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5156 SI opval = tmp_addr;
5157 if (UNLIKELY(current_cpu->trace_result_p))
5158 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5159 current_cpu->h_grc_set (FLD (f_rn), opval);
5163 current_cpu->done_insn (npc, status);
5167 // ********** sts-pr-compact: sts pr, $rn
5170 sh4a_sem_sts_pr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5171 sh4a::write_stacks &buf)
5173 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5174 sem_status status = SEM_STATUS_NORMAL;
5175 sh4a_scache* abuf = sem;
5176 unsigned long long written = 0;
5177 PCADDR pc = abuf->addr;
5178 PCADDR npc = pc + 2;
5181 SI opval = current_cpu->h_pr_get ();
5182 if (UNLIKELY(current_cpu->trace_result_p))
5183 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5184 current_cpu->h_grc_set (FLD (f_rn), opval);
5187 current_cpu->done_insn (npc, status);
5191 // ********** stsl-pr-compact: sts.l pr, @-$rn
5194 sh4a_sem_stsl_pr_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5195 sh4a::write_stacks &buf)
5197 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5198 sem_status status = SEM_STATUS_NORMAL;
5199 sh4a_scache* abuf = sem;
5200 unsigned long long written = 0;
5201 PCADDR pc = abuf->addr;
5202 PCADDR npc = pc + 2;
5206 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5208 SI opval = current_cpu->h_pr_get ();
5209 if (UNLIKELY(current_cpu->trace_result_p))
5210 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5211 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5214 SI opval = tmp_addr;
5215 if (UNLIKELY(current_cpu->trace_result_p))
5216 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5217 current_cpu->h_grc_set (FLD (f_rn), opval);
5221 current_cpu->done_insn (npc, status);
5225 // ********** sub-compact: sub $rm, $rn
5228 sh4a_sem_sub_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5229 sh4a::write_stacks &buf)
5231 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5232 sem_status status = SEM_STATUS_NORMAL;
5233 sh4a_scache* abuf = sem;
5234 unsigned long long written = 0;
5235 PCADDR pc = abuf->addr;
5236 PCADDR npc = pc + 2;
5239 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5240 if (UNLIKELY(current_cpu->trace_result_p))
5241 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5242 current_cpu->h_grc_set (FLD (f_rn), opval);
5245 current_cpu->done_insn (npc, status);
5249 // ********** subc-compact: subc $rm, $rn
5252 sh4a_sem_subc_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5253 sh4a::write_stacks &buf)
5255 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5256 sem_status status = SEM_STATUS_NORMAL;
5257 sh4a_scache* abuf = sem;
5258 unsigned long long written = 0;
5259 PCADDR pc = abuf->addr;
5260 PCADDR npc = pc + 2;
5264 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5266 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5267 if (UNLIKELY(current_cpu->trace_result_p))
5268 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5269 current_cpu->h_grc_set (FLD (f_rn), opval);
5272 BI opval = tmp_flag;
5273 if (UNLIKELY(current_cpu->trace_result_p))
5274 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5275 current_cpu->h_tbit_set (opval);
5279 current_cpu->done_insn (npc, status);
5283 // ********** subv-compact: subv $rm, $rn
5286 sh4a_sem_subv_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5287 sh4a::write_stacks &buf)
5289 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5290 sem_status status = SEM_STATUS_NORMAL;
5291 sh4a_scache* abuf = sem;
5292 unsigned long long written = 0;
5293 PCADDR pc = abuf->addr;
5294 PCADDR npc = pc + 2;
5298 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
5300 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5301 if (UNLIKELY(current_cpu->trace_result_p))
5302 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5303 current_cpu->h_grc_set (FLD (f_rn), opval);
5306 BI opval = ((tmp_t) ? (1) : (0));
5307 if (UNLIKELY(current_cpu->trace_result_p))
5308 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5309 current_cpu->h_tbit_set (opval);
5313 current_cpu->done_insn (npc, status);
5317 // ********** swapb-compact: swap.b $rm, $rn
5320 sh4a_sem_swapb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5321 sh4a::write_stacks &buf)
5323 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
5324 sem_status status = SEM_STATUS_NORMAL;
5325 sh4a_scache* abuf = sem;
5326 unsigned long long written = 0;
5327 PCADDR pc = abuf->addr;
5328 PCADDR npc = pc + 2;
5334 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
5335 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
5336 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
5338 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
5339 if (UNLIKELY(current_cpu->trace_result_p))
5340 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5341 current_cpu->h_grc_set (FLD (f_rn), opval);
5345 current_cpu->done_insn (npc, status);
5349 // ********** swapw-compact: swap.w $rm, $rn
5352 sh4a_sem_swapw_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5353 sh4a::write_stacks &buf)
5355 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
5356 sem_status status = SEM_STATUS_NORMAL;
5357 sh4a_scache* abuf = sem;
5358 unsigned long long written = 0;
5359 PCADDR pc = abuf->addr;
5360 PCADDR npc = pc + 2;
5363 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
5364 if (UNLIKELY(current_cpu->trace_result_p))
5365 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5366 current_cpu->h_grc_set (FLD (f_rn), opval);
5369 current_cpu->done_insn (npc, status);
5373 // ********** tasb-compact: tas.b @$rn
5376 sh4a_sem_tasb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5377 sh4a::write_stacks &buf)
5379 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5380 sem_status status = SEM_STATUS_NORMAL;
5381 sh4a_scache* abuf = sem;
5382 unsigned long long written = 0;
5383 PCADDR pc = abuf->addr;
5384 PCADDR npc = pc + 2;
5388 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
5390 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
5391 if (UNLIKELY(current_cpu->trace_result_p))
5392 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5393 current_cpu->h_tbit_set (opval);
5395 tmp_byte = ORQI (tmp_byte, 128);
5397 UQI opval = tmp_byte;
5398 if (UNLIKELY(current_cpu->trace_result_p))
5399 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5400 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
5404 current_cpu->done_insn (npc, status);
5408 // ********** trapa-compact: trapa #$uimm8
5411 sh4a_sem_trapa_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5412 sh4a::write_stacks &buf)
5414 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5415 sem_status status = SEM_STATUS_NORMAL;
5416 sh4a_scache* abuf = sem;
5417 unsigned long long written = 0;
5418 PCADDR pc = abuf->addr;
5419 PCADDR npc = pc + 2;
5421 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
5423 current_cpu->done_insn (npc, status);
5427 // ********** tst-compact: tst $rm, $rn
5430 sh4a_sem_tst_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5431 sh4a::write_stacks &buf)
5433 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
5434 sem_status status = SEM_STATUS_NORMAL;
5435 sh4a_scache* abuf = sem;
5436 unsigned long long written = 0;
5437 PCADDR pc = abuf->addr;
5438 PCADDR npc = pc + 2;
5441 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
5442 if (UNLIKELY(current_cpu->trace_result_p))
5443 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5444 current_cpu->h_tbit_set (opval);
5447 current_cpu->done_insn (npc, status);
5451 // ********** tsti-compact: tst #$uimm8, r0
5454 sh4a_sem_tsti_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5455 sh4a::write_stacks &buf)
5457 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5458 sem_status status = SEM_STATUS_NORMAL;
5459 sh4a_scache* abuf = sem;
5460 unsigned long long written = 0;
5461 PCADDR pc = abuf->addr;
5462 PCADDR npc = pc + 2;
5465 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5466 if (UNLIKELY(current_cpu->trace_result_p))
5467 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5468 current_cpu->h_tbit_set (opval);
5471 current_cpu->done_insn (npc, status);
5475 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
5478 sh4a_sem_tstb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5479 sh4a::write_stacks &buf)
5481 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5482 sem_status status = SEM_STATUS_NORMAL;
5483 sh4a_scache* abuf = sem;
5484 unsigned long long written = 0;
5485 PCADDR pc = abuf->addr;
5486 PCADDR npc = pc + 2;
5490 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5492 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5493 if (UNLIKELY(current_cpu->trace_result_p))
5494 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5495 current_cpu->h_tbit_set (opval);
5499 current_cpu->done_insn (npc, status);
5503 // ********** xor-compact: xor $rm64, $rn64
5506 sh4a_sem_xor_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5507 sh4a::write_stacks &buf)
5509 #define FLD(f) abuf->fields.sfmt_and_compact.f
5510 sem_status status = SEM_STATUS_NORMAL;
5511 sh4a_scache* abuf = sem;
5512 unsigned long long written = 0;
5513 PCADDR pc = abuf->addr;
5514 PCADDR npc = pc + 2;
5517 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
5518 if (UNLIKELY(current_cpu->trace_result_p))
5519 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5520 current_cpu->h_gr_set (FLD (f_rn), opval);
5523 current_cpu->done_insn (npc, status);
5527 // ********** xori-compact: xor #$uimm8, r0
5530 sh4a_sem_xori_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5531 sh4a::write_stacks &buf)
5533 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5534 sem_status status = SEM_STATUS_NORMAL;
5535 sh4a_scache* abuf = sem;
5536 unsigned long long written = 0;
5537 PCADDR pc = abuf->addr;
5538 PCADDR npc = pc + 2;
5541 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5542 if (UNLIKELY(current_cpu->trace_result_p))
5543 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
5544 current_cpu->h_grc_set (((UINT) 0), opval);
5547 current_cpu->done_insn (npc, status);
5551 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
5554 sh4a_sem_xorb_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5555 sh4a::write_stacks &buf)
5557 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5558 sem_status status = SEM_STATUS_NORMAL;
5559 sh4a_scache* abuf = sem;
5560 unsigned long long written = 0;
5561 PCADDR pc = abuf->addr;
5562 PCADDR npc = pc + 2;
5567 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5568 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
5570 UQI opval = tmp_data;
5571 if (UNLIKELY(current_cpu->trace_result_p))
5572 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5573 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5577 current_cpu->done_insn (npc, status);
5581 // ********** xtrct-compact: xtrct $rm, $rn
5584 sh4a_sem_xtrct_compact (sh4a_cpu* current_cpu, sh4a_scache* sem, const int tick,
5585 sh4a::write_stacks &buf)
5587 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5588 sem_status status = SEM_STATUS_NORMAL;
5589 sh4a_scache* abuf = sem;
5590 unsigned long long written = 0;
5591 PCADDR pc = abuf->addr;
5592 PCADDR npc = pc + 2;
5595 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
5596 if (UNLIKELY(current_cpu->trace_result_p))
5597 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5598 current_cpu->h_grc_set (FLD (f_rn), opval);
5601 current_cpu->done_insn (npc, status);