1 /* Simulator instruction semantics for sh5_compact.
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 sh5; // FIXME: namespace organization still wip
19 using namespace sh5_compact; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh5_compact_sem_x_invalid (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
27 sh5_compact::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh5_compact_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 sh5_compact_sem_add_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
50 sh5_compact::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh5_compact_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 sh5_compact_sem_addi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
74 sh5_compact::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh5_compact_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 sh5_compact_sem_addc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
98 sh5_compact::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh5_compact_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 sh5_compact_sem_addv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
132 sh5_compact::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh5_compact_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 sh5_compact_sem_and_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
166 sh5_compact::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh5_compact_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 sh5_compact_sem_andi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
190 sh5_compact::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh5_compact_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 sh5_compact_sem_andb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
214 sh5_compact::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh5_compact_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 sh5_compact_sem_bf_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
244 sh5_compact::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh5_compact_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 sh5_compact_sem_bfs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
272 sh5_compact::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh5_compact_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) % sh5_compact::pipe_sz].push (sh5_compact::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 sh5_compact_sem_bra_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
309 sh5_compact::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh5_compact_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) % sh5_compact::pipe_sz].push (sh5_compact::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 sh5_compact_sem_braf_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
342 sh5_compact::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh5_compact_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) % sh5_compact::pipe_sz].push (sh5_compact::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 // ********** brk-compact: brk
374 sh5_compact_sem_brk_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
375 sh5_compact::write_stacks &buf)
377 #define FLD(f) abuf->fields.fmt_empty.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh5_compact_scache* abuf = sem;
380 unsigned long long written = 0;
381 PCADDR pc = abuf->addr;
384 current_cpu->sh64_break (pc);
386 current_cpu->done_insn (npc, status);
390 // ********** bsr-compact: bsr $disp12
393 sh5_compact_sem_bsr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
394 sh5_compact::write_stacks &buf)
396 #define FLD(f) abuf->fields.sfmt_bra_compact.f
397 sem_status status = SEM_STATUS_NORMAL;
398 sh5_compact_scache* abuf = sem;
399 unsigned long long written = 0;
400 PCADDR pc = abuf->addr;
405 SI opval = ADDDI (pc, 4);
406 buf.h_pr_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<SI>(pc, opval));
407 if (UNLIKELY(current_cpu->trace_result_p))
408 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
411 UDI opval = ADDDI (pc, 2);
412 if (UNLIKELY(current_cpu->trace_result_p))
413 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
414 current_cpu->branch (opval, npc, status);
416 current_cpu->save_delayed_pc (FLD (i_disp12));
418 UDI opval = FLD (i_disp12);
419 buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
420 if (UNLIKELY(current_cpu->trace_result_p))
421 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
425 current_cpu->done_cti_insn (npc, status);
429 // ********** bsrf-compact: bsrf $rn
432 sh5_compact_sem_bsrf_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
433 sh5_compact::write_stacks &buf)
435 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
436 sem_status status = SEM_STATUS_NORMAL;
437 sh5_compact_scache* abuf = sem;
438 unsigned long long written = 0;
439 PCADDR pc = abuf->addr;
444 SI opval = ADDDI (pc, 4);
445 buf.h_pr_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<SI>(pc, opval));
446 if (UNLIKELY(current_cpu->trace_result_p))
447 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
450 UDI opval = ADDDI (pc, 2);
451 if (UNLIKELY(current_cpu->trace_result_p))
452 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
453 current_cpu->branch (opval, npc, status);
455 current_cpu->save_delayed_pc (ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4)));
457 UDI opval = ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4));
458 buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
459 if (UNLIKELY(current_cpu->trace_result_p))
460 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
464 current_cpu->done_cti_insn (npc, status);
468 // ********** bt-compact: bt $disp8
471 sh5_compact_sem_bt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
472 sh5_compact::write_stacks &buf)
474 #define FLD(f) abuf->fields.sfmt_bf_compact.f
475 sem_status status = SEM_STATUS_NORMAL;
476 sh5_compact_scache* abuf = sem;
477 unsigned long long written = 0;
478 PCADDR pc = abuf->addr;
481 if (current_cpu->h_tbit_get ()) {
483 UDI opval = FLD (i_disp8);
484 written |= (1ULL << 2);
485 if (UNLIKELY(current_cpu->trace_result_p))
486 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
487 current_cpu->branch (opval, npc, status);
491 abuf->written = written;
492 current_cpu->done_cti_insn (npc, status);
496 // ********** bts-compact: bt/s $disp8
499 sh5_compact_sem_bts_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
500 sh5_compact::write_stacks &buf)
502 #define FLD(f) abuf->fields.sfmt_bf_compact.f
503 sem_status status = SEM_STATUS_NORMAL;
504 sh5_compact_scache* abuf = sem;
505 unsigned long long written = 0;
506 PCADDR pc = abuf->addr;
509 if (current_cpu->h_tbit_get ()) {
512 UDI opval = ADDDI (pc, 2);
513 written |= (1ULL << 3);
514 if (UNLIKELY(current_cpu->trace_result_p))
515 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
516 current_cpu->branch (opval, npc, status);
518 current_cpu->save_delayed_pc (FLD (i_disp8));
520 UDI opval = FLD (i_disp8);
521 buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
522 if (UNLIKELY(current_cpu->trace_result_p))
523 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
528 abuf->written = written;
529 current_cpu->done_cti_insn (npc, status);
533 // ********** clrmac-compact: clrmac
536 sh5_compact_sem_clrmac_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
537 sh5_compact::write_stacks &buf)
539 #define FLD(f) abuf->fields.fmt_empty.f
540 sem_status status = SEM_STATUS_NORMAL;
541 sh5_compact_scache* abuf = sem;
542 unsigned long long written = 0;
543 PCADDR pc = abuf->addr;
549 if (UNLIKELY(current_cpu->trace_result_p))
550 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
551 current_cpu->h_macl_set (opval);
555 if (UNLIKELY(current_cpu->trace_result_p))
556 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
557 current_cpu->h_mach_set (opval);
561 current_cpu->done_insn (npc, status);
565 // ********** clrs-compact: clrs
568 sh5_compact_sem_clrs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
569 sh5_compact::write_stacks &buf)
571 #define FLD(f) abuf->fields.fmt_empty.f
572 sem_status status = SEM_STATUS_NORMAL;
573 sh5_compact_scache* abuf = sem;
574 unsigned long long written = 0;
575 PCADDR pc = abuf->addr;
580 if (UNLIKELY(current_cpu->trace_result_p))
581 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
582 current_cpu->h_sbit_set (opval);
585 current_cpu->done_insn (npc, status);
589 // ********** clrt-compact: clrt
592 sh5_compact_sem_clrt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
593 sh5_compact::write_stacks &buf)
595 #define FLD(f) abuf->fields.fmt_empty.f
596 sem_status status = SEM_STATUS_NORMAL;
597 sh5_compact_scache* abuf = sem;
598 unsigned long long written = 0;
599 PCADDR pc = abuf->addr;
604 if (UNLIKELY(current_cpu->trace_result_p))
605 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
606 current_cpu->h_tbit_set (opval);
609 current_cpu->done_insn (npc, status);
613 // ********** cmpeq-compact: cmp/eq $rm, $rn
616 sh5_compact_sem_cmpeq_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
617 sh5_compact::write_stacks &buf)
619 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
620 sem_status status = SEM_STATUS_NORMAL;
621 sh5_compact_scache* abuf = sem;
622 unsigned long long written = 0;
623 PCADDR pc = abuf->addr;
627 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
628 if (UNLIKELY(current_cpu->trace_result_p))
629 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
630 current_cpu->h_tbit_set (opval);
633 current_cpu->done_insn (npc, status);
637 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
640 sh5_compact_sem_cmpeqi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
641 sh5_compact::write_stacks &buf)
643 #define FLD(f) abuf->fields.sfmt_andi_compact.f
644 sem_status status = SEM_STATUS_NORMAL;
645 sh5_compact_scache* abuf = sem;
646 unsigned long long written = 0;
647 PCADDR pc = abuf->addr;
651 BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
652 if (UNLIKELY(current_cpu->trace_result_p))
653 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
654 current_cpu->h_tbit_set (opval);
657 current_cpu->done_insn (npc, status);
661 // ********** cmpge-compact: cmp/ge $rm, $rn
664 sh5_compact_sem_cmpge_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
665 sh5_compact::write_stacks &buf)
667 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
668 sem_status status = SEM_STATUS_NORMAL;
669 sh5_compact_scache* abuf = sem;
670 unsigned long long written = 0;
671 PCADDR pc = abuf->addr;
675 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
676 if (UNLIKELY(current_cpu->trace_result_p))
677 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
678 current_cpu->h_tbit_set (opval);
681 current_cpu->done_insn (npc, status);
685 // ********** cmpgt-compact: cmp/gt $rm, $rn
688 sh5_compact_sem_cmpgt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
689 sh5_compact::write_stacks &buf)
691 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
692 sem_status status = SEM_STATUS_NORMAL;
693 sh5_compact_scache* abuf = sem;
694 unsigned long long written = 0;
695 PCADDR pc = abuf->addr;
699 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
700 if (UNLIKELY(current_cpu->trace_result_p))
701 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
702 current_cpu->h_tbit_set (opval);
705 current_cpu->done_insn (npc, status);
709 // ********** cmphi-compact: cmp/hi $rm, $rn
712 sh5_compact_sem_cmphi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
713 sh5_compact::write_stacks &buf)
715 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
716 sem_status status = SEM_STATUS_NORMAL;
717 sh5_compact_scache* abuf = sem;
718 unsigned long long written = 0;
719 PCADDR pc = abuf->addr;
723 BI opval = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
724 if (UNLIKELY(current_cpu->trace_result_p))
725 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
726 current_cpu->h_tbit_set (opval);
729 current_cpu->done_insn (npc, status);
733 // ********** cmphs-compact: cmp/hs $rm, $rn
736 sh5_compact_sem_cmphs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
737 sh5_compact::write_stacks &buf)
739 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
740 sem_status status = SEM_STATUS_NORMAL;
741 sh5_compact_scache* abuf = sem;
742 unsigned long long written = 0;
743 PCADDR pc = abuf->addr;
747 BI opval = GEUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
748 if (UNLIKELY(current_cpu->trace_result_p))
749 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
750 current_cpu->h_tbit_set (opval);
753 current_cpu->done_insn (npc, status);
757 // ********** cmppl-compact: cmp/pl $rn
760 sh5_compact_sem_cmppl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
761 sh5_compact::write_stacks &buf)
763 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
764 sem_status status = SEM_STATUS_NORMAL;
765 sh5_compact_scache* abuf = sem;
766 unsigned long long written = 0;
767 PCADDR pc = abuf->addr;
771 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
772 if (UNLIKELY(current_cpu->trace_result_p))
773 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
774 current_cpu->h_tbit_set (opval);
777 current_cpu->done_insn (npc, status);
781 // ********** cmppz-compact: cmp/pz $rn
784 sh5_compact_sem_cmppz_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
785 sh5_compact::write_stacks &buf)
787 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
788 sem_status status = SEM_STATUS_NORMAL;
789 sh5_compact_scache* abuf = sem;
790 unsigned long long written = 0;
791 PCADDR pc = abuf->addr;
795 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), 0);
796 if (UNLIKELY(current_cpu->trace_result_p))
797 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
798 current_cpu->h_tbit_set (opval);
801 current_cpu->done_insn (npc, status);
805 // ********** cmpstr-compact: cmp/str $rm, $rn
808 sh5_compact_sem_cmpstr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
809 sh5_compact::write_stacks &buf)
811 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
812 sem_status status = SEM_STATUS_NORMAL;
813 sh5_compact_scache* abuf = sem;
814 unsigned long long written = 0;
815 PCADDR pc = abuf->addr;
821 tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
822 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
823 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
824 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
825 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
827 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
828 if (UNLIKELY(current_cpu->trace_result_p))
829 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
830 current_cpu->h_tbit_set (opval);
834 current_cpu->done_insn (npc, status);
838 // ********** div0s-compact: div0s $rm, $rn
841 sh5_compact_sem_div0s_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
842 sh5_compact::write_stacks &buf)
844 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
845 sem_status status = SEM_STATUS_NORMAL;
846 sh5_compact_scache* abuf = sem;
847 unsigned long long written = 0;
848 PCADDR pc = abuf->addr;
853 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
854 if (UNLIKELY(current_cpu->trace_result_p))
855 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
856 current_cpu->h_qbit_set (opval);
859 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
860 if (UNLIKELY(current_cpu->trace_result_p))
861 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
862 current_cpu->h_mbit_set (opval);
865 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));
866 if (UNLIKELY(current_cpu->trace_result_p))
867 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
868 current_cpu->h_tbit_set (opval);
872 current_cpu->done_insn (npc, status);
876 // ********** div0u-compact: div0u
879 sh5_compact_sem_div0u_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
880 sh5_compact::write_stacks &buf)
882 #define FLD(f) abuf->fields.fmt_empty.f
883 sem_status status = SEM_STATUS_NORMAL;
884 sh5_compact_scache* abuf = sem;
885 unsigned long long written = 0;
886 PCADDR pc = abuf->addr;
892 if (UNLIKELY(current_cpu->trace_result_p))
893 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
894 current_cpu->h_tbit_set (opval);
898 if (UNLIKELY(current_cpu->trace_result_p))
899 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
900 current_cpu->h_qbit_set (opval);
904 if (UNLIKELY(current_cpu->trace_result_p))
905 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
906 current_cpu->h_mbit_set (opval);
910 current_cpu->done_insn (npc, status);
914 // ********** div1-compact: div1 $rm, $rn
917 sh5_compact_sem_div1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
918 sh5_compact::write_stacks &buf)
920 #define FLD(f) abuf->fields.sfmt_macl_compact.f
921 sem_status status = SEM_STATUS_NORMAL;
922 sh5_compact_scache* abuf = sem;
923 unsigned long long written = 0;
924 PCADDR pc = abuf->addr;
931 tmp_oldq = current_cpu->h_qbit_get ();
933 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
934 if (UNLIKELY(current_cpu->trace_result_p))
935 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
936 current_cpu->h_qbit_set (opval);
939 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
940 if (UNLIKELY(current_cpu->trace_result_p))
941 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
942 current_cpu->h_grc_set (FLD (f_rn), opval);
944 if (NOTBI (tmp_oldq)) {
945 if (NOTBI (current_cpu->h_mbit_get ())) {
947 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
949 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
950 if (UNLIKELY(current_cpu->trace_result_p))
951 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
952 current_cpu->h_grc_set (FLD (f_rn), opval);
954 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
955 if (NOTBI (current_cpu->h_qbit_get ())) {
957 BI opval = ((tmp_tmp1) ? (1) : (0));
958 if (UNLIKELY(current_cpu->trace_result_p))
959 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
960 current_cpu->h_qbit_set (opval);
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);
973 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
975 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
976 if (UNLIKELY(current_cpu->trace_result_p))
977 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
978 current_cpu->h_grc_set (FLD (f_rn), opval);
980 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
981 if (NOTBI (current_cpu->h_qbit_get ())) {
983 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
984 if (UNLIKELY(current_cpu->trace_result_p))
985 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
986 current_cpu->h_qbit_set (opval);
990 BI opval = ((tmp_tmp1) ? (1) : (0));
991 if (UNLIKELY(current_cpu->trace_result_p))
992 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
993 current_cpu->h_qbit_set (opval);
999 if (NOTBI (current_cpu->h_mbit_get ())) {
1001 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
1003 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
1004 if (UNLIKELY(current_cpu->trace_result_p))
1005 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1006 current_cpu->h_grc_set (FLD (f_rn), opval);
1008 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
1009 if (NOTBI (current_cpu->h_qbit_get ())) {
1011 BI opval = ((tmp_tmp1) ? (1) : (0));
1012 if (UNLIKELY(current_cpu->trace_result_p))
1013 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1014 current_cpu->h_qbit_set (opval);
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);
1027 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
1029 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
1030 if (UNLIKELY(current_cpu->trace_result_p))
1031 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1032 current_cpu->h_grc_set (FLD (f_rn), opval);
1034 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
1035 if (NOTBI (current_cpu->h_qbit_get ())) {
1037 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1038 if (UNLIKELY(current_cpu->trace_result_p))
1039 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1040 current_cpu->h_qbit_set (opval);
1044 BI opval = ((tmp_tmp1) ? (1) : (0));
1045 if (UNLIKELY(current_cpu->trace_result_p))
1046 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1047 current_cpu->h_qbit_set (opval);
1054 BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1055 if (UNLIKELY(current_cpu->trace_result_p))
1056 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1057 current_cpu->h_tbit_set (opval);
1061 current_cpu->done_insn (npc, status);
1065 // ********** divu-compact: divu r0, $rn
1068 sh5_compact_sem_divu_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1069 sh5_compact::write_stacks &buf)
1071 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1072 sem_status status = SEM_STATUS_NORMAL;
1073 sh5_compact_scache* abuf = sem;
1074 unsigned long long written = 0;
1075 PCADDR pc = abuf->addr;
1076 PCADDR npc = pc + 2;
1079 SI opval = UDIVSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1080 if (UNLIKELY(current_cpu->trace_result_p))
1081 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1082 current_cpu->h_grc_set (FLD (f_rn), opval);
1085 current_cpu->done_insn (npc, status);
1089 // ********** mulr-compact: mulr r0, $rn
1092 sh5_compact_sem_mulr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1093 sh5_compact::write_stacks &buf)
1095 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1096 sem_status status = SEM_STATUS_NORMAL;
1097 sh5_compact_scache* abuf = sem;
1098 unsigned long long written = 0;
1099 PCADDR pc = abuf->addr;
1100 PCADDR npc = pc + 2;
1103 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1104 if (UNLIKELY(current_cpu->trace_result_p))
1105 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1106 current_cpu->h_grc_set (FLD (f_rn), opval);
1109 current_cpu->done_insn (npc, status);
1113 // ********** dmulsl-compact: dmuls.l $rm, $rn
1116 sh5_compact_sem_dmulsl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1117 sh5_compact::write_stacks &buf)
1119 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1120 sem_status status = SEM_STATUS_NORMAL;
1121 sh5_compact_scache* abuf = sem;
1122 unsigned long long written = 0;
1123 PCADDR pc = abuf->addr;
1124 PCADDR npc = pc + 2;
1128 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1130 SI opval = SUBWORDDISI (tmp_result, 0);
1131 if (UNLIKELY(current_cpu->trace_result_p))
1132 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1133 current_cpu->h_mach_set (opval);
1136 SI opval = SUBWORDDISI (tmp_result, 1);
1137 if (UNLIKELY(current_cpu->trace_result_p))
1138 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1139 current_cpu->h_macl_set (opval);
1143 current_cpu->done_insn (npc, status);
1147 // ********** dmulul-compact: dmulu.l $rm, $rn
1150 sh5_compact_sem_dmulul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1151 sh5_compact::write_stacks &buf)
1153 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1154 sem_status status = SEM_STATUS_NORMAL;
1155 sh5_compact_scache* abuf = sem;
1156 unsigned long long written = 0;
1157 PCADDR pc = abuf->addr;
1158 PCADDR npc = pc + 2;
1162 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1164 SI opval = SUBWORDDISI (tmp_result, 0);
1165 if (UNLIKELY(current_cpu->trace_result_p))
1166 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1167 current_cpu->h_mach_set (opval);
1170 SI opval = SUBWORDDISI (tmp_result, 1);
1171 if (UNLIKELY(current_cpu->trace_result_p))
1172 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1173 current_cpu->h_macl_set (opval);
1177 current_cpu->done_insn (npc, status);
1181 // ********** dt-compact: dt $rn
1184 sh5_compact_sem_dt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1185 sh5_compact::write_stacks &buf)
1187 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
1188 sem_status status = SEM_STATUS_NORMAL;
1189 sh5_compact_scache* abuf = sem;
1190 unsigned long long written = 0;
1191 PCADDR pc = abuf->addr;
1192 PCADDR npc = pc + 2;
1196 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1197 if (UNLIKELY(current_cpu->trace_result_p))
1198 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1199 current_cpu->h_grc_set (FLD (f_rn), opval);
1202 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1203 if (UNLIKELY(current_cpu->trace_result_p))
1204 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1205 current_cpu->h_tbit_set (opval);
1209 current_cpu->done_insn (npc, status);
1213 // ********** extsb-compact: exts.b $rm, $rn
1216 sh5_compact_sem_extsb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1217 sh5_compact::write_stacks &buf)
1219 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1220 sem_status status = SEM_STATUS_NORMAL;
1221 sh5_compact_scache* abuf = sem;
1222 unsigned long long written = 0;
1223 PCADDR pc = abuf->addr;
1224 PCADDR npc = pc + 2;
1227 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1228 if (UNLIKELY(current_cpu->trace_result_p))
1229 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1230 current_cpu->h_grc_set (FLD (f_rn), opval);
1233 current_cpu->done_insn (npc, status);
1237 // ********** extsw-compact: exts.w $rm, $rn
1240 sh5_compact_sem_extsw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1241 sh5_compact::write_stacks &buf)
1243 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1244 sem_status status = SEM_STATUS_NORMAL;
1245 sh5_compact_scache* abuf = sem;
1246 unsigned long long written = 0;
1247 PCADDR pc = abuf->addr;
1248 PCADDR npc = pc + 2;
1251 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1252 if (UNLIKELY(current_cpu->trace_result_p))
1253 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1254 current_cpu->h_grc_set (FLD (f_rn), opval);
1257 current_cpu->done_insn (npc, status);
1261 // ********** extub-compact: extu.b $rm, $rn
1264 sh5_compact_sem_extub_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1265 sh5_compact::write_stacks &buf)
1267 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1268 sem_status status = SEM_STATUS_NORMAL;
1269 sh5_compact_scache* abuf = sem;
1270 unsigned long long written = 0;
1271 PCADDR pc = abuf->addr;
1272 PCADDR npc = pc + 2;
1275 SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1276 if (UNLIKELY(current_cpu->trace_result_p))
1277 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1278 current_cpu->h_grc_set (FLD (f_rn), opval);
1281 current_cpu->done_insn (npc, status);
1285 // ********** extuw-compact: extu.w $rm, $rn
1288 sh5_compact_sem_extuw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1289 sh5_compact::write_stacks &buf)
1291 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1292 sem_status status = SEM_STATUS_NORMAL;
1293 sh5_compact_scache* abuf = sem;
1294 unsigned long long written = 0;
1295 PCADDR pc = abuf->addr;
1296 PCADDR npc = pc + 2;
1299 SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1300 if (UNLIKELY(current_cpu->trace_result_p))
1301 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1302 current_cpu->h_grc_set (FLD (f_rn), opval);
1305 current_cpu->done_insn (npc, status);
1309 // ********** fabs-compact: fabs $fsdn
1312 sh5_compact_sem_fabs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1313 sh5_compact::write_stacks &buf)
1315 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1316 sem_status status = SEM_STATUS_NORMAL;
1317 sh5_compact_scache* abuf = sem;
1318 unsigned long long written = 0;
1319 PCADDR pc = abuf->addr;
1320 PCADDR npc = pc + 2;
1322 if (current_cpu->h_prbit_get ()) {
1324 DF opval = current_cpu->sh64_fabsd (current_cpu->h_fsd_get (FLD (f_rn)));
1325 written |= (1ULL << 2);
1326 if (UNLIKELY(current_cpu->trace_result_p))
1327 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1328 current_cpu->h_fsd_set (FLD (f_rn), opval);
1332 DF opval = current_cpu->sh64_fabss (current_cpu->h_fsd_get (FLD (f_rn)));
1333 written |= (1ULL << 2);
1334 if (UNLIKELY(current_cpu->trace_result_p))
1335 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1336 current_cpu->h_fsd_set (FLD (f_rn), opval);
1340 abuf->written = written;
1341 current_cpu->done_insn (npc, status);
1345 // ********** fadd-compact: fadd $fsdm, $fsdn
1348 sh5_compact_sem_fadd_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1349 sh5_compact::write_stacks &buf)
1351 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1352 sem_status status = SEM_STATUS_NORMAL;
1353 sh5_compact_scache* abuf = sem;
1354 unsigned long long written = 0;
1355 PCADDR pc = abuf->addr;
1356 PCADDR npc = pc + 2;
1358 if (current_cpu->h_prbit_get ()) {
1360 DF opval = current_cpu->sh64_faddd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1361 written |= (1ULL << 3);
1362 if (UNLIKELY(current_cpu->trace_result_p))
1363 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1364 current_cpu->h_fsd_set (FLD (f_rn), opval);
1368 DF opval = current_cpu->sh64_fadds (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1369 written |= (1ULL << 3);
1370 if (UNLIKELY(current_cpu->trace_result_p))
1371 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1372 current_cpu->h_fsd_set (FLD (f_rn), opval);
1376 abuf->written = written;
1377 current_cpu->done_insn (npc, status);
1381 // ********** fcmpeq-compact: fcmp/eq $fsdm, $fsdn
1384 sh5_compact_sem_fcmpeq_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1385 sh5_compact::write_stacks &buf)
1387 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1388 sem_status status = SEM_STATUS_NORMAL;
1389 sh5_compact_scache* abuf = sem;
1390 unsigned long long written = 0;
1391 PCADDR pc = abuf->addr;
1392 PCADDR npc = pc + 2;
1394 if (current_cpu->h_prbit_get ()) {
1396 BI opval = current_cpu->sh64_fcmpeqd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1397 written |= (1ULL << 3);
1398 if (UNLIKELY(current_cpu->trace_result_p))
1399 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1400 current_cpu->h_tbit_set (opval);
1404 BI opval = current_cpu->sh64_fcmpeqs (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1405 written |= (1ULL << 3);
1406 if (UNLIKELY(current_cpu->trace_result_p))
1407 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1408 current_cpu->h_tbit_set (opval);
1412 abuf->written = written;
1413 current_cpu->done_insn (npc, status);
1417 // ********** fcmpgt-compact: fcmp/gt $fsdm, $fsdn
1420 sh5_compact_sem_fcmpgt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1421 sh5_compact::write_stacks &buf)
1423 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1424 sem_status status = SEM_STATUS_NORMAL;
1425 sh5_compact_scache* abuf = sem;
1426 unsigned long long written = 0;
1427 PCADDR pc = abuf->addr;
1428 PCADDR npc = pc + 2;
1430 if (current_cpu->h_prbit_get ()) {
1432 BI opval = current_cpu->sh64_fcmpgtd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1433 written |= (1ULL << 3);
1434 if (UNLIKELY(current_cpu->trace_result_p))
1435 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1436 current_cpu->h_tbit_set (opval);
1440 BI opval = current_cpu->sh64_fcmpgts (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1441 written |= (1ULL << 3);
1442 if (UNLIKELY(current_cpu->trace_result_p))
1443 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1444 current_cpu->h_tbit_set (opval);
1448 abuf->written = written;
1449 current_cpu->done_insn (npc, status);
1453 // ********** fcnvds-compact: fcnvds $drn, fpul
1456 sh5_compact_sem_fcnvds_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1457 sh5_compact::write_stacks &buf)
1459 #define FLD(f) abuf->fields.sfmt_fcnvds_compact.f
1460 sem_status status = SEM_STATUS_NORMAL;
1461 sh5_compact_scache* abuf = sem;
1462 unsigned long long written = 0;
1463 PCADDR pc = abuf->addr;
1464 PCADDR npc = pc + 2;
1467 SF opval = current_cpu->sh64_fcnvds (current_cpu->h_drc_get (FLD (f_dn)));
1468 if (UNLIKELY(current_cpu->trace_result_p))
1469 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
1470 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1473 current_cpu->done_insn (npc, status);
1477 // ********** fcnvsd-compact: fcnvsd fpul, $drn
1480 sh5_compact_sem_fcnvsd_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1481 sh5_compact::write_stacks &buf)
1483 #define FLD(f) abuf->fields.sfmt_fcnvsd_compact.f
1484 sem_status status = SEM_STATUS_NORMAL;
1485 sh5_compact_scache* abuf = sem;
1486 unsigned long long written = 0;
1487 PCADDR pc = abuf->addr;
1488 PCADDR npc = pc + 2;
1491 DF opval = current_cpu->sh64_fcnvsd (current_cpu->hardware.h_fr[((UINT) 32)]);
1492 if (UNLIKELY(current_cpu->trace_result_p))
1493 current_cpu->trace_stream << "drc" << '[' << FLD (f_dn) << ']' << ":=0x" << hex << opval << dec << " ";
1494 current_cpu->h_drc_set (FLD (f_dn), opval);
1497 current_cpu->done_insn (npc, status);
1501 // ********** fdiv-compact: fdiv $fsdm, $fsdn
1504 sh5_compact_sem_fdiv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1505 sh5_compact::write_stacks &buf)
1507 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1508 sem_status status = SEM_STATUS_NORMAL;
1509 sh5_compact_scache* abuf = sem;
1510 unsigned long long written = 0;
1511 PCADDR pc = abuf->addr;
1512 PCADDR npc = pc + 2;
1514 if (current_cpu->h_prbit_get ()) {
1516 DF opval = current_cpu->sh64_fdivd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1517 written |= (1ULL << 3);
1518 if (UNLIKELY(current_cpu->trace_result_p))
1519 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1520 current_cpu->h_fsd_set (FLD (f_rn), opval);
1524 DF opval = current_cpu->sh64_fdivs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1525 written |= (1ULL << 3);
1526 if (UNLIKELY(current_cpu->trace_result_p))
1527 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1528 current_cpu->h_fsd_set (FLD (f_rn), opval);
1532 abuf->written = written;
1533 current_cpu->done_insn (npc, status);
1537 // ********** fipr-compact: fipr $fvm, $fvn
1540 sh5_compact_sem_fipr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1541 sh5_compact::write_stacks &buf)
1543 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
1544 sem_status status = SEM_STATUS_NORMAL;
1545 sh5_compact_scache* abuf = sem;
1546 unsigned long long written = 0;
1547 PCADDR pc = abuf->addr;
1548 PCADDR npc = pc + 2;
1550 current_cpu->sh64_fipr (FLD (f_vm), FLD (f_vn));
1552 current_cpu->done_insn (npc, status);
1556 // ********** flds-compact: flds $frn, fpul
1559 sh5_compact_sem_flds_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1560 sh5_compact::write_stacks &buf)
1562 #define FLD(f) abuf->fields.sfmt_flds_compact.f
1563 sem_status status = SEM_STATUS_NORMAL;
1564 sh5_compact_scache* abuf = sem;
1565 unsigned long long written = 0;
1566 PCADDR pc = abuf->addr;
1567 PCADDR npc = pc + 2;
1570 SF opval = current_cpu->h_frc_get (FLD (f_rn));
1571 if (UNLIKELY(current_cpu->trace_result_p))
1572 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
1573 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1576 current_cpu->done_insn (npc, status);
1580 // ********** fldi0-compact: fldi0 $frn
1583 sh5_compact_sem_fldi0_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1584 sh5_compact::write_stacks &buf)
1586 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1587 sem_status status = SEM_STATUS_NORMAL;
1588 sh5_compact_scache* abuf = sem;
1589 unsigned long long written = 0;
1590 PCADDR pc = abuf->addr;
1591 PCADDR npc = pc + 2;
1594 SF opval = current_cpu->sh64_fldi0 ();
1595 if (UNLIKELY(current_cpu->trace_result_p))
1596 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1597 current_cpu->h_frc_set (FLD (f_rn), opval);
1600 current_cpu->done_insn (npc, status);
1604 // ********** fldi1-compact: fldi1 $frn
1607 sh5_compact_sem_fldi1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1608 sh5_compact::write_stacks &buf)
1610 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1611 sem_status status = SEM_STATUS_NORMAL;
1612 sh5_compact_scache* abuf = sem;
1613 unsigned long long written = 0;
1614 PCADDR pc = abuf->addr;
1615 PCADDR npc = pc + 2;
1618 SF opval = current_cpu->sh64_fldi1 ();
1619 if (UNLIKELY(current_cpu->trace_result_p))
1620 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1621 current_cpu->h_frc_set (FLD (f_rn), opval);
1624 current_cpu->done_insn (npc, status);
1628 // ********** float-compact: float fpul, $fsdn
1631 sh5_compact_sem_float_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1632 sh5_compact::write_stacks &buf)
1634 #define FLD(f) abuf->fields.sfmt_float_compact.f
1635 sem_status status = SEM_STATUS_NORMAL;
1636 sh5_compact_scache* abuf = sem;
1637 unsigned long long written = 0;
1638 PCADDR pc = abuf->addr;
1639 PCADDR npc = pc + 2;
1641 if (current_cpu->h_prbit_get ()) {
1643 DF opval = current_cpu->sh64_floatld (current_cpu->hardware.h_fr[((UINT) 32)]);
1644 written |= (1ULL << 2);
1645 if (UNLIKELY(current_cpu->trace_result_p))
1646 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1647 current_cpu->h_fsd_set (FLD (f_rn), opval);
1651 DF opval = current_cpu->sh64_floatls (current_cpu->hardware.h_fr[((UINT) 32)]);
1652 written |= (1ULL << 2);
1653 if (UNLIKELY(current_cpu->trace_result_p))
1654 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1655 current_cpu->h_fsd_set (FLD (f_rn), opval);
1659 abuf->written = written;
1660 current_cpu->done_insn (npc, status);
1664 // ********** fmac-compact: fmac fr0, $frm, $frn
1667 sh5_compact_sem_fmac_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1668 sh5_compact::write_stacks &buf)
1670 #define FLD(f) abuf->fields.sfmt_fmac_compact.f
1671 sem_status status = SEM_STATUS_NORMAL;
1672 sh5_compact_scache* abuf = sem;
1673 unsigned long long written = 0;
1674 PCADDR pc = abuf->addr;
1675 PCADDR npc = pc + 2;
1678 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)));
1679 if (UNLIKELY(current_cpu->trace_result_p))
1680 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1681 current_cpu->h_frc_set (FLD (f_rn), opval);
1684 current_cpu->done_insn (npc, status);
1688 // ********** fmov1-compact: fmov $fmovm, $fmovn
1691 sh5_compact_sem_fmov1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1692 sh5_compact::write_stacks &buf)
1694 #define FLD(f) abuf->fields.sfmt_fmov1_compact.f
1695 sem_status status = SEM_STATUS_NORMAL;
1696 sh5_compact_scache* abuf = sem;
1697 unsigned long long written = 0;
1698 PCADDR pc = abuf->addr;
1699 PCADDR npc = pc + 2;
1702 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1703 if (UNLIKELY(current_cpu->trace_result_p))
1704 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1705 current_cpu->h_fmov_set (FLD (f_rn), opval);
1708 current_cpu->done_insn (npc, status);
1712 // ********** fmov2-compact: fmov @$rm, $fmovn
1715 sh5_compact_sem_fmov2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1716 sh5_compact::write_stacks &buf)
1718 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1719 sem_status status = SEM_STATUS_NORMAL;
1720 sh5_compact_scache* abuf = sem;
1721 unsigned long long written = 0;
1722 PCADDR pc = abuf->addr;
1723 PCADDR npc = pc + 2;
1725 if (NOTBI (current_cpu->h_szbit_get ())) {
1727 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1728 written |= (1ULL << 4);
1729 if (UNLIKELY(current_cpu->trace_result_p))
1730 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1731 current_cpu->h_fmov_set (FLD (f_rn), opval);
1735 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1736 written |= (1ULL << 4);
1737 if (UNLIKELY(current_cpu->trace_result_p))
1738 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1739 current_cpu->h_fmov_set (FLD (f_rn), opval);
1743 abuf->written = written;
1744 current_cpu->done_insn (npc, status);
1748 // ********** fmov3-compact: fmov @${rm}+, fmovn
1751 sh5_compact_sem_fmov3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1752 sh5_compact::write_stacks &buf)
1754 #define FLD(f) abuf->fields.sfmt_fmov3_compact.f
1755 sem_status status = SEM_STATUS_NORMAL;
1756 sh5_compact_scache* abuf = sem;
1757 unsigned long long written = 0;
1758 PCADDR pc = abuf->addr;
1759 PCADDR npc = pc + 2;
1761 if (NOTBI (current_cpu->h_szbit_get ())) {
1764 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1765 written |= (1ULL << 4);
1766 if (UNLIKELY(current_cpu->trace_result_p))
1767 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1768 current_cpu->h_fmov_set (FLD (f_rn), opval);
1771 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1772 written |= (1ULL << 5);
1773 if (UNLIKELY(current_cpu->trace_result_p))
1774 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1775 current_cpu->h_grc_set (FLD (f_rm), opval);
1781 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1782 written |= (1ULL << 4);
1783 if (UNLIKELY(current_cpu->trace_result_p))
1784 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1785 current_cpu->h_fmov_set (FLD (f_rn), opval);
1788 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 8);
1789 written |= (1ULL << 5);
1790 if (UNLIKELY(current_cpu->trace_result_p))
1791 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1792 current_cpu->h_grc_set (FLD (f_rm), opval);
1797 abuf->written = written;
1798 current_cpu->done_insn (npc, status);
1802 // ********** fmov4-compact: fmov @(r0, $rm), $fmovn
1805 sh5_compact_sem_fmov4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1806 sh5_compact::write_stacks &buf)
1808 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1809 sem_status status = SEM_STATUS_NORMAL;
1810 sh5_compact_scache* abuf = sem;
1811 unsigned long long written = 0;
1812 PCADDR pc = abuf->addr;
1813 PCADDR npc = pc + 2;
1815 if (NOTBI (current_cpu->h_szbit_get ())) {
1817 DF opval = current_cpu->GETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1818 written |= (1ULL << 5);
1819 if (UNLIKELY(current_cpu->trace_result_p))
1820 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1821 current_cpu->h_fmov_set (FLD (f_rn), opval);
1825 DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1826 written |= (1ULL << 5);
1827 if (UNLIKELY(current_cpu->trace_result_p))
1828 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1829 current_cpu->h_fmov_set (FLD (f_rn), opval);
1833 abuf->written = written;
1834 current_cpu->done_insn (npc, status);
1838 // ********** fmov5-compact: fmov $fmovm, @$rn
1841 sh5_compact_sem_fmov5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1842 sh5_compact::write_stacks &buf)
1844 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1845 sem_status status = SEM_STATUS_NORMAL;
1846 sh5_compact_scache* abuf = sem;
1847 unsigned long long written = 0;
1848 PCADDR pc = abuf->addr;
1849 PCADDR npc = pc + 2;
1851 if (NOTBI (current_cpu->h_szbit_get ())) {
1853 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1854 written |= (1ULL << 4);
1855 if (UNLIKELY(current_cpu->trace_result_p))
1856 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1857 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1861 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1862 written |= (1ULL << 3);
1863 if (UNLIKELY(current_cpu->trace_result_p))
1864 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1865 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1869 abuf->written = written;
1870 current_cpu->done_insn (npc, status);
1874 // ********** fmov6-compact: fmov $fmovm, @-$rn
1877 sh5_compact_sem_fmov6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1878 sh5_compact::write_stacks &buf)
1880 #define FLD(f) abuf->fields.sfmt_fmov6_compact.f
1881 sem_status status = SEM_STATUS_NORMAL;
1882 sh5_compact_scache* abuf = sem;
1883 unsigned long long written = 0;
1884 PCADDR pc = abuf->addr;
1885 PCADDR npc = pc + 2;
1887 if (NOTBI (current_cpu->h_szbit_get ())) {
1890 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1891 written |= (1ULL << 5);
1892 if (UNLIKELY(current_cpu->trace_result_p))
1893 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1894 current_cpu->h_grc_set (FLD (f_rn), opval);
1897 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1898 written |= (1ULL << 4);
1899 if (UNLIKELY(current_cpu->trace_result_p))
1900 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1901 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1907 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
1908 written |= (1ULL << 5);
1909 if (UNLIKELY(current_cpu->trace_result_p))
1910 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1911 current_cpu->h_grc_set (FLD (f_rn), opval);
1914 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1915 written |= (1ULL << 3);
1916 if (UNLIKELY(current_cpu->trace_result_p))
1917 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1918 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1923 abuf->written = written;
1924 current_cpu->done_insn (npc, status);
1928 // ********** fmov7-compact: fmov $fmovm, @(r0, $rn)
1931 sh5_compact_sem_fmov7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1932 sh5_compact::write_stacks &buf)
1934 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1935 sem_status status = SEM_STATUS_NORMAL;
1936 sh5_compact_scache* abuf = sem;
1937 unsigned long long written = 0;
1938 PCADDR pc = abuf->addr;
1939 PCADDR npc = pc + 2;
1941 if (NOTBI (current_cpu->h_szbit_get ())) {
1943 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1944 written |= (1ULL << 5);
1945 if (UNLIKELY(current_cpu->trace_result_p))
1946 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 << " ";
1947 current_cpu->SETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1951 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1952 written |= (1ULL << 4);
1953 if (UNLIKELY(current_cpu->trace_result_p))
1954 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1955 current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1959 abuf->written = written;
1960 current_cpu->done_insn (npc, status);
1964 // ********** fmov8-compact: fmov.d @($imm12x8, $rm), $drn
1967 sh5_compact_sem_fmov8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1968 sh5_compact::write_stacks &buf)
1970 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1971 sem_status status = SEM_STATUS_NORMAL;
1972 sh5_compact_scache* abuf = sem;
1973 unsigned long long written = 0;
1974 PCADDR pc = abuf->addr;
1975 PCADDR npc = pc + 4;
1978 DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x8)));
1979 if (UNLIKELY(current_cpu->trace_result_p))
1980 current_cpu->trace_stream << "drc" << '[' << FLD (f_dn) << ']' << ":=0x" << hex << opval << dec << " ";
1981 current_cpu->h_drc_set (FLD (f_dn), opval);
1984 current_cpu->done_insn (npc, status);
1988 // ********** fmov9-compact: mov.l $drm, @($imm12x8, $rn)
1991 sh5_compact_sem_fmov9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
1992 sh5_compact::write_stacks &buf)
1994 #define FLD(f) abuf->fields.sfmt_fmov9_compact.f
1995 sem_status status = SEM_STATUS_NORMAL;
1996 sh5_compact_scache* abuf = sem;
1997 unsigned long long written = 0;
1998 PCADDR pc = abuf->addr;
1999 PCADDR npc = pc + 4;
2002 DF opval = current_cpu->h_drc_get (FLD (f_dm));
2003 if (UNLIKELY(current_cpu->trace_result_p))
2004 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x8)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2005 current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x8)), opval);
2008 current_cpu->done_insn (npc, status);
2012 // ********** fmul-compact: fmul $fsdm, $fsdn
2015 sh5_compact_sem_fmul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2016 sh5_compact::write_stacks &buf)
2018 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2019 sem_status status = SEM_STATUS_NORMAL;
2020 sh5_compact_scache* abuf = sem;
2021 unsigned long long written = 0;
2022 PCADDR pc = abuf->addr;
2023 PCADDR npc = pc + 2;
2025 if (current_cpu->h_prbit_get ()) {
2027 DF opval = current_cpu->sh64_fmuld (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
2028 written |= (1ULL << 3);
2029 if (UNLIKELY(current_cpu->trace_result_p))
2030 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2031 current_cpu->h_fsd_set (FLD (f_rn), opval);
2035 DF opval = current_cpu->sh64_fmuls (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
2036 written |= (1ULL << 3);
2037 if (UNLIKELY(current_cpu->trace_result_p))
2038 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2039 current_cpu->h_fsd_set (FLD (f_rn), opval);
2043 abuf->written = written;
2044 current_cpu->done_insn (npc, status);
2048 // ********** fneg-compact: fneg $fsdn
2051 sh5_compact_sem_fneg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2052 sh5_compact::write_stacks &buf)
2054 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2055 sem_status status = SEM_STATUS_NORMAL;
2056 sh5_compact_scache* abuf = sem;
2057 unsigned long long written = 0;
2058 PCADDR pc = abuf->addr;
2059 PCADDR npc = pc + 2;
2061 if (current_cpu->h_prbit_get ()) {
2063 DF opval = current_cpu->sh64_fnegd (current_cpu->h_fsd_get (FLD (f_rn)));
2064 written |= (1ULL << 2);
2065 if (UNLIKELY(current_cpu->trace_result_p))
2066 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2067 current_cpu->h_fsd_set (FLD (f_rn), opval);
2071 DF opval = current_cpu->sh64_fnegs (current_cpu->h_fsd_get (FLD (f_rn)));
2072 written |= (1ULL << 2);
2073 if (UNLIKELY(current_cpu->trace_result_p))
2074 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2075 current_cpu->h_fsd_set (FLD (f_rn), opval);
2079 abuf->written = written;
2080 current_cpu->done_insn (npc, status);
2084 // ********** frchg-compact: frchg
2087 sh5_compact_sem_frchg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2088 sh5_compact::write_stacks &buf)
2090 #define FLD(f) abuf->fields.fmt_empty.f
2091 sem_status status = SEM_STATUS_NORMAL;
2092 sh5_compact_scache* abuf = sem;
2093 unsigned long long written = 0;
2094 PCADDR pc = abuf->addr;
2095 PCADDR npc = pc + 2;
2098 BI opval = NOTBI (current_cpu->h_frbit_get ());
2099 if (UNLIKELY(current_cpu->trace_result_p))
2100 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
2101 current_cpu->h_frbit_set (opval);
2104 current_cpu->done_insn (npc, status);
2108 // ********** fschg-compact: fschg
2111 sh5_compact_sem_fschg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2112 sh5_compact::write_stacks &buf)
2114 #define FLD(f) abuf->fields.fmt_empty.f
2115 sem_status status = SEM_STATUS_NORMAL;
2116 sh5_compact_scache* abuf = sem;
2117 unsigned long long written = 0;
2118 PCADDR pc = abuf->addr;
2119 PCADDR npc = pc + 2;
2122 BI opval = NOTBI (current_cpu->h_szbit_get ());
2123 if (UNLIKELY(current_cpu->trace_result_p))
2124 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
2125 current_cpu->h_szbit_set (opval);
2128 current_cpu->done_insn (npc, status);
2132 // ********** fsqrt-compact: fsqrt $fsdn
2135 sh5_compact_sem_fsqrt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2136 sh5_compact::write_stacks &buf)
2138 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2139 sem_status status = SEM_STATUS_NORMAL;
2140 sh5_compact_scache* abuf = sem;
2141 unsigned long long written = 0;
2142 PCADDR pc = abuf->addr;
2143 PCADDR npc = pc + 2;
2145 if (current_cpu->h_prbit_get ()) {
2147 DF opval = current_cpu->sh64_fsqrtd (current_cpu->h_fsd_get (FLD (f_rn)));
2148 written |= (1ULL << 2);
2149 if (UNLIKELY(current_cpu->trace_result_p))
2150 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2151 current_cpu->h_fsd_set (FLD (f_rn), opval);
2155 DF opval = current_cpu->sh64_fsqrts (current_cpu->h_fsd_get (FLD (f_rn)));
2156 written |= (1ULL << 2);
2157 if (UNLIKELY(current_cpu->trace_result_p))
2158 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2159 current_cpu->h_fsd_set (FLD (f_rn), opval);
2163 abuf->written = written;
2164 current_cpu->done_insn (npc, status);
2168 // ********** fsts-compact: fsts fpul, $frn
2171 sh5_compact_sem_fsts_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2172 sh5_compact::write_stacks &buf)
2174 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
2175 sem_status status = SEM_STATUS_NORMAL;
2176 sh5_compact_scache* abuf = sem;
2177 unsigned long long written = 0;
2178 PCADDR pc = abuf->addr;
2179 PCADDR npc = pc + 2;
2182 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
2183 if (UNLIKELY(current_cpu->trace_result_p))
2184 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2185 current_cpu->h_frc_set (FLD (f_rn), opval);
2188 current_cpu->done_insn (npc, status);
2192 // ********** fsub-compact: fsub $fsdm, $fsdn
2195 sh5_compact_sem_fsub_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2196 sh5_compact::write_stacks &buf)
2198 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2199 sem_status status = SEM_STATUS_NORMAL;
2200 sh5_compact_scache* abuf = sem;
2201 unsigned long long written = 0;
2202 PCADDR pc = abuf->addr;
2203 PCADDR npc = pc + 2;
2205 if (current_cpu->h_prbit_get ()) {
2207 DF opval = current_cpu->sh64_fsubd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2208 written |= (1ULL << 3);
2209 if (UNLIKELY(current_cpu->trace_result_p))
2210 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2211 current_cpu->h_fsd_set (FLD (f_rn), opval);
2215 DF opval = current_cpu->sh64_fsubs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2216 written |= (1ULL << 3);
2217 if (UNLIKELY(current_cpu->trace_result_p))
2218 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2219 current_cpu->h_fsd_set (FLD (f_rn), opval);
2223 abuf->written = written;
2224 current_cpu->done_insn (npc, status);
2228 // ********** ftrc-compact: ftrc $fsdn, fpul
2231 sh5_compact_sem_ftrc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2232 sh5_compact::write_stacks &buf)
2234 #define FLD(f) abuf->fields.sfmt_ftrc_compact.f
2235 sem_status status = SEM_STATUS_NORMAL;
2236 sh5_compact_scache* abuf = sem;
2237 unsigned long long written = 0;
2238 PCADDR pc = abuf->addr;
2239 PCADDR npc = pc + 2;
2242 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)))));
2243 if (UNLIKELY(current_cpu->trace_result_p))
2244 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2245 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2248 current_cpu->done_insn (npc, status);
2252 // ********** ftrv-compact: ftrv xmtrx, $fvn
2255 sh5_compact_sem_ftrv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2256 sh5_compact::write_stacks &buf)
2258 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
2259 sem_status status = SEM_STATUS_NORMAL;
2260 sh5_compact_scache* abuf = sem;
2261 unsigned long long written = 0;
2262 PCADDR pc = abuf->addr;
2263 PCADDR npc = pc + 2;
2265 current_cpu->sh64_ftrv (FLD (f_vn));
2267 current_cpu->done_insn (npc, status);
2271 // ********** jmp-compact: jmp @$rn
2274 sh5_compact_sem_jmp_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2275 sh5_compact::write_stacks &buf)
2277 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2278 sem_status status = SEM_STATUS_NORMAL;
2279 sh5_compact_scache* abuf = sem;
2280 unsigned long long written = 0;
2281 PCADDR pc = abuf->addr;
2282 PCADDR npc = pc + 2;
2286 UDI opval = ADDDI (pc, 2);
2287 if (UNLIKELY(current_cpu->trace_result_p))
2288 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2289 current_cpu->branch (opval, npc, status);
2291 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2293 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2294 buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
2295 if (UNLIKELY(current_cpu->trace_result_p))
2296 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2298 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2301 current_cpu->done_cti_insn (npc, status);
2305 // ********** jsr-compact: jsr @$rn
2308 sh5_compact_sem_jsr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2309 sh5_compact::write_stacks &buf)
2311 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2312 sem_status status = SEM_STATUS_NORMAL;
2313 sh5_compact_scache* abuf = sem;
2314 unsigned long long written = 0;
2315 PCADDR pc = abuf->addr;
2316 PCADDR npc = pc + 2;
2320 SI opval = ADDDI (pc, 4);
2321 buf.h_pr_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<SI>(pc, opval));
2322 if (UNLIKELY(current_cpu->trace_result_p))
2323 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2326 UDI opval = ADDDI (pc, 2);
2327 if (UNLIKELY(current_cpu->trace_result_p))
2328 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2329 current_cpu->branch (opval, npc, status);
2331 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2333 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2334 buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
2335 if (UNLIKELY(current_cpu->trace_result_p))
2336 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2338 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2341 current_cpu->done_cti_insn (npc, status);
2345 // ********** ldc-gbr-compact: ldc $rn, gbr
2348 sh5_compact_sem_ldc_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2349 sh5_compact::write_stacks &buf)
2351 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2352 sem_status status = SEM_STATUS_NORMAL;
2353 sh5_compact_scache* abuf = sem;
2354 unsigned long long written = 0;
2355 PCADDR pc = abuf->addr;
2356 PCADDR npc = pc + 2;
2359 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2360 if (UNLIKELY(current_cpu->trace_result_p))
2361 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2362 current_cpu->h_gbr_set (opval);
2365 current_cpu->done_insn (npc, status);
2369 // ********** ldc-vbr-compact: ldc $rn, vbr
2372 sh5_compact_sem_ldc_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2373 sh5_compact::write_stacks &buf)
2375 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2376 sem_status status = SEM_STATUS_NORMAL;
2377 sh5_compact_scache* abuf = sem;
2378 unsigned long long written = 0;
2379 PCADDR pc = abuf->addr;
2380 PCADDR npc = pc + 2;
2383 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2384 if (UNLIKELY(current_cpu->trace_result_p))
2385 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2386 current_cpu->h_vbr_set (opval);
2389 current_cpu->done_insn (npc, status);
2393 // ********** ldc-sr-compact: ldc $rn, sr
2396 sh5_compact_sem_ldc_sr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2397 sh5_compact::write_stacks &buf)
2399 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2400 sem_status status = SEM_STATUS_NORMAL;
2401 sh5_compact_scache* abuf = sem;
2402 unsigned long long written = 0;
2403 PCADDR pc = abuf->addr;
2404 PCADDR npc = pc + 2;
2407 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2408 if (UNLIKELY(current_cpu->trace_result_p))
2409 current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << " ";
2410 current_cpu->hardware.h_sr = opval;
2413 current_cpu->done_insn (npc, status);
2417 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
2420 sh5_compact_sem_ldcl_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2421 sh5_compact::write_stacks &buf)
2423 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2424 sem_status status = SEM_STATUS_NORMAL;
2425 sh5_compact_scache* abuf = sem;
2426 unsigned long long written = 0;
2427 PCADDR pc = abuf->addr;
2428 PCADDR npc = pc + 2;
2432 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2433 if (UNLIKELY(current_cpu->trace_result_p))
2434 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2435 current_cpu->h_gbr_set (opval);
2438 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2439 if (UNLIKELY(current_cpu->trace_result_p))
2440 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2441 current_cpu->h_grc_set (FLD (f_rn), opval);
2445 current_cpu->done_insn (npc, status);
2449 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
2452 sh5_compact_sem_ldcl_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2453 sh5_compact::write_stacks &buf)
2455 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2456 sem_status status = SEM_STATUS_NORMAL;
2457 sh5_compact_scache* abuf = sem;
2458 unsigned long long written = 0;
2459 PCADDR pc = abuf->addr;
2460 PCADDR npc = pc + 2;
2464 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2465 if (UNLIKELY(current_cpu->trace_result_p))
2466 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2467 current_cpu->h_vbr_set (opval);
2470 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2471 if (UNLIKELY(current_cpu->trace_result_p))
2472 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2473 current_cpu->h_grc_set (FLD (f_rn), opval);
2477 current_cpu->done_insn (npc, status);
2481 // ********** lds-fpscr-compact: lds $rn, fpscr
2484 sh5_compact_sem_lds_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2485 sh5_compact::write_stacks &buf)
2487 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2488 sem_status status = SEM_STATUS_NORMAL;
2489 sh5_compact_scache* abuf = sem;
2490 unsigned long long written = 0;
2491 PCADDR pc = abuf->addr;
2492 PCADDR npc = pc + 2;
2495 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2496 if (UNLIKELY(current_cpu->trace_result_p))
2497 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2498 current_cpu->hardware.h_fpscr = opval;
2501 current_cpu->done_insn (npc, status);
2505 // ********** ldsl-fpscr-compact: lds.l @${rn}+, fpscr
2508 sh5_compact_sem_ldsl_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2509 sh5_compact::write_stacks &buf)
2511 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2512 sem_status status = SEM_STATUS_NORMAL;
2513 sh5_compact_scache* abuf = sem;
2514 unsigned long long written = 0;
2515 PCADDR pc = abuf->addr;
2516 PCADDR npc = pc + 2;
2520 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2521 if (UNLIKELY(current_cpu->trace_result_p))
2522 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2523 current_cpu->hardware.h_fpscr = opval;
2526 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2527 if (UNLIKELY(current_cpu->trace_result_p))
2528 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2529 current_cpu->h_grc_set (FLD (f_rn), opval);
2533 current_cpu->done_insn (npc, status);
2537 // ********** lds-fpul-compact: lds $rn, fpul
2540 sh5_compact_sem_lds_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2541 sh5_compact::write_stacks &buf)
2543 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2544 sem_status status = SEM_STATUS_NORMAL;
2545 sh5_compact_scache* abuf = sem;
2546 unsigned long long written = 0;
2547 PCADDR pc = abuf->addr;
2548 PCADDR npc = pc + 2;
2551 SF opval = SUBWORDSISF (current_cpu->h_grc_get (FLD (f_rn)));
2552 if (UNLIKELY(current_cpu->trace_result_p))
2553 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2554 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2557 current_cpu->done_insn (npc, status);
2561 // ********** ldsl-fpul-compact: lds.l @${rn}+, fpul
2564 sh5_compact_sem_ldsl_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2565 sh5_compact::write_stacks &buf)
2567 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2568 sem_status status = SEM_STATUS_NORMAL;
2569 sh5_compact_scache* abuf = sem;
2570 unsigned long long written = 0;
2571 PCADDR pc = abuf->addr;
2572 PCADDR npc = pc + 2;
2576 SF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)));
2577 if (UNLIKELY(current_cpu->trace_result_p))
2578 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2579 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2582 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2583 if (UNLIKELY(current_cpu->trace_result_p))
2584 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2585 current_cpu->h_grc_set (FLD (f_rn), opval);
2589 current_cpu->done_insn (npc, status);
2593 // ********** lds-mach-compact: lds $rn, mach
2596 sh5_compact_sem_lds_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2597 sh5_compact::write_stacks &buf)
2599 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2600 sem_status status = SEM_STATUS_NORMAL;
2601 sh5_compact_scache* abuf = sem;
2602 unsigned long long written = 0;
2603 PCADDR pc = abuf->addr;
2604 PCADDR npc = pc + 2;
2607 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2608 if (UNLIKELY(current_cpu->trace_result_p))
2609 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2610 current_cpu->h_mach_set (opval);
2613 current_cpu->done_insn (npc, status);
2617 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
2620 sh5_compact_sem_ldsl_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2621 sh5_compact::write_stacks &buf)
2623 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2624 sem_status status = SEM_STATUS_NORMAL;
2625 sh5_compact_scache* abuf = sem;
2626 unsigned long long written = 0;
2627 PCADDR pc = abuf->addr;
2628 PCADDR npc = pc + 2;
2632 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2633 if (UNLIKELY(current_cpu->trace_result_p))
2634 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2635 current_cpu->h_mach_set (opval);
2638 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2639 if (UNLIKELY(current_cpu->trace_result_p))
2640 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2641 current_cpu->h_grc_set (FLD (f_rn), opval);
2645 current_cpu->done_insn (npc, status);
2649 // ********** lds-macl-compact: lds $rn, macl
2652 sh5_compact_sem_lds_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2653 sh5_compact::write_stacks &buf)
2655 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2656 sem_status status = SEM_STATUS_NORMAL;
2657 sh5_compact_scache* abuf = sem;
2658 unsigned long long written = 0;
2659 PCADDR pc = abuf->addr;
2660 PCADDR npc = pc + 2;
2663 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2664 if (UNLIKELY(current_cpu->trace_result_p))
2665 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2666 current_cpu->h_macl_set (opval);
2669 current_cpu->done_insn (npc, status);
2673 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
2676 sh5_compact_sem_ldsl_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2677 sh5_compact::write_stacks &buf)
2679 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2680 sem_status status = SEM_STATUS_NORMAL;
2681 sh5_compact_scache* abuf = sem;
2682 unsigned long long written = 0;
2683 PCADDR pc = abuf->addr;
2684 PCADDR npc = pc + 2;
2688 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2689 if (UNLIKELY(current_cpu->trace_result_p))
2690 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2691 current_cpu->h_macl_set (opval);
2694 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2695 if (UNLIKELY(current_cpu->trace_result_p))
2696 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2697 current_cpu->h_grc_set (FLD (f_rn), opval);
2701 current_cpu->done_insn (npc, status);
2705 // ********** lds-pr-compact: lds $rn, pr
2708 sh5_compact_sem_lds_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2709 sh5_compact::write_stacks &buf)
2711 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2712 sem_status status = SEM_STATUS_NORMAL;
2713 sh5_compact_scache* abuf = sem;
2714 unsigned long long written = 0;
2715 PCADDR pc = abuf->addr;
2716 PCADDR npc = pc + 2;
2719 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2720 if (UNLIKELY(current_cpu->trace_result_p))
2721 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2722 current_cpu->h_pr_set (opval);
2725 current_cpu->done_insn (npc, status);
2729 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
2732 sh5_compact_sem_ldsl_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2733 sh5_compact::write_stacks &buf)
2735 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2736 sem_status status = SEM_STATUS_NORMAL;
2737 sh5_compact_scache* abuf = sem;
2738 unsigned long long written = 0;
2739 PCADDR pc = abuf->addr;
2740 PCADDR npc = pc + 2;
2744 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2745 if (UNLIKELY(current_cpu->trace_result_p))
2746 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2747 current_cpu->h_pr_set (opval);
2750 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2751 if (UNLIKELY(current_cpu->trace_result_p))
2752 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2753 current_cpu->h_grc_set (FLD (f_rn), opval);
2757 current_cpu->done_insn (npc, status);
2761 // ********** macl-compact: mac.l @${rm}+, @${rn}+
2764 sh5_compact_sem_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2765 sh5_compact::write_stacks &buf)
2767 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2768 sem_status status = SEM_STATUS_NORMAL;
2769 sh5_compact_scache* abuf = sem;
2770 unsigned long long written = 0;
2771 PCADDR pc = abuf->addr;
2772 PCADDR npc = pc + 2;
2780 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2782 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2783 if (UNLIKELY(current_cpu->trace_result_p))
2784 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2785 current_cpu->h_grc_set (FLD (f_rn), opval);
2787 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2790 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2791 if (UNLIKELY(current_cpu->trace_result_p))
2792 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2793 current_cpu->h_grc_set (FLD (f_rn), opval);
2796 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2797 written |= (1ULL << 11);
2798 if (UNLIKELY(current_cpu->trace_result_p))
2799 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2800 current_cpu->h_grc_set (FLD (f_rm), opval);
2804 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2806 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2807 written |= (1ULL << 11);
2808 if (UNLIKELY(current_cpu->trace_result_p))
2809 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2810 current_cpu->h_grc_set (FLD (f_rm), opval);
2812 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2813 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2814 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2816 if (current_cpu->h_sbit_get ()) {
2820 tmp_max = SRLDI (INVDI (0), 16);
2821 tmp_min = SRLDI (INVDI (0), 15);
2822 if (GTDI (tmp_result, tmp_max)) {
2823 tmp_result = tmp_max;
2825 if (LTDI (tmp_result, tmp_min)) {
2826 tmp_result = tmp_min;
2832 SI opval = SUBWORDDISI (tmp_result, 0);
2833 if (UNLIKELY(current_cpu->trace_result_p))
2834 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2835 current_cpu->h_mach_set (opval);
2838 SI opval = SUBWORDDISI (tmp_result, 1);
2839 if (UNLIKELY(current_cpu->trace_result_p))
2840 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2841 current_cpu->h_macl_set (opval);
2846 abuf->written = written;
2847 current_cpu->done_insn (npc, status);
2851 // ********** macw-compact: mac.w @${rm}+, @${rn}+
2854 sh5_compact_sem_macw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2855 sh5_compact::write_stacks &buf)
2857 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2858 sem_status status = SEM_STATUS_NORMAL;
2859 sh5_compact_scache* abuf = sem;
2860 unsigned long long written = 0;
2861 PCADDR pc = abuf->addr;
2862 PCADDR npc = pc + 2;
2870 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2872 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2873 if (UNLIKELY(current_cpu->trace_result_p))
2874 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2875 current_cpu->h_grc_set (FLD (f_rn), opval);
2877 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2880 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2881 if (UNLIKELY(current_cpu->trace_result_p))
2882 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2883 current_cpu->h_grc_set (FLD (f_rn), opval);
2886 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2887 written |= (1ULL << 11);
2888 if (UNLIKELY(current_cpu->trace_result_p))
2889 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2890 current_cpu->h_grc_set (FLD (f_rm), opval);
2894 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2896 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2897 written |= (1ULL << 11);
2898 if (UNLIKELY(current_cpu->trace_result_p))
2899 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2900 current_cpu->h_grc_set (FLD (f_rm), opval);
2902 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2903 if (current_cpu->h_sbit_get ()) {
2905 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
2908 written |= (1ULL << 9);
2909 if (UNLIKELY(current_cpu->trace_result_p))
2910 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2911 current_cpu->h_mach_set (opval);
2915 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
2916 written |= (1ULL << 10);
2917 if (UNLIKELY(current_cpu->trace_result_p))
2918 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2919 current_cpu->h_macl_set (opval);
2924 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2925 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2927 SI opval = SUBWORDDISI (tmp_result, 0);
2928 written |= (1ULL << 9);
2929 if (UNLIKELY(current_cpu->trace_result_p))
2930 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2931 current_cpu->h_mach_set (opval);
2934 SI opval = SUBWORDDISI (tmp_result, 1);
2935 written |= (1ULL << 10);
2936 if (UNLIKELY(current_cpu->trace_result_p))
2937 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2938 current_cpu->h_macl_set (opval);
2944 abuf->written = written;
2945 current_cpu->done_insn (npc, status);
2949 // ********** mov-compact: mov $rm64, $rn64
2952 sh5_compact_sem_mov_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2953 sh5_compact::write_stacks &buf)
2955 #define FLD(f) abuf->fields.sfmt_and_compact.f
2956 sem_status status = SEM_STATUS_NORMAL;
2957 sh5_compact_scache* abuf = sem;
2958 unsigned long long written = 0;
2959 PCADDR pc = abuf->addr;
2960 PCADDR npc = pc + 2;
2963 DI opval = current_cpu->h_gr_get (FLD (f_rm));
2964 if (UNLIKELY(current_cpu->trace_result_p))
2965 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2966 current_cpu->h_gr_set (FLD (f_rn), opval);
2969 current_cpu->done_insn (npc, status);
2973 // ********** movi-compact: mov #$imm8, $rn
2976 sh5_compact_sem_movi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
2977 sh5_compact::write_stacks &buf)
2979 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2980 sem_status status = SEM_STATUS_NORMAL;
2981 sh5_compact_scache* abuf = sem;
2982 unsigned long long written = 0;
2983 PCADDR pc = abuf->addr;
2984 PCADDR npc = pc + 2;
2987 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2988 if (UNLIKELY(current_cpu->trace_result_p))
2989 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2990 current_cpu->h_grc_set (FLD (f_rn), opval);
2993 current_cpu->done_insn (npc, status);
2997 // ********** movi20-compact: movi20 #$imm20, $rn
3000 sh5_compact_sem_movi20_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3001 sh5_compact::write_stacks &buf)
3003 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
3004 sem_status status = SEM_STATUS_NORMAL;
3005 sh5_compact_scache* abuf = sem;
3006 unsigned long long written = 0;
3007 PCADDR pc = abuf->addr;
3008 PCADDR npc = pc + 4;
3011 SI opval = FLD (f_imm20);
3012 if (UNLIKELY(current_cpu->trace_result_p))
3013 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3014 current_cpu->h_grc_set (FLD (f_rn), opval);
3017 current_cpu->done_insn (npc, status);
3021 // ********** movb1-compact: mov.b $rm, @$rn
3024 sh5_compact_sem_movb1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3025 sh5_compact::write_stacks &buf)
3027 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3028 sem_status status = SEM_STATUS_NORMAL;
3029 sh5_compact_scache* abuf = sem;
3030 unsigned long long written = 0;
3031 PCADDR pc = abuf->addr;
3032 PCADDR npc = pc + 2;
3035 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3036 if (UNLIKELY(current_cpu->trace_result_p))
3037 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3038 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3041 current_cpu->done_insn (npc, status);
3045 // ********** movb2-compact: mov.b $rm, @-$rn
3048 sh5_compact_sem_movb2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3049 sh5_compact::write_stacks &buf)
3051 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3052 sem_status status = SEM_STATUS_NORMAL;
3053 sh5_compact_scache* abuf = sem;
3054 unsigned long long written = 0;
3055 PCADDR pc = abuf->addr;
3056 PCADDR npc = pc + 2;
3060 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3062 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3063 if (UNLIKELY(current_cpu->trace_result_p))
3064 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3065 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3068 SI opval = tmp_addr;
3069 if (UNLIKELY(current_cpu->trace_result_p))
3070 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3071 current_cpu->h_grc_set (FLD (f_rn), opval);
3075 current_cpu->done_insn (npc, status);
3079 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
3082 sh5_compact_sem_movb3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3083 sh5_compact::write_stacks &buf)
3085 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3086 sem_status status = SEM_STATUS_NORMAL;
3087 sh5_compact_scache* abuf = sem;
3088 unsigned long long written = 0;
3089 PCADDR pc = abuf->addr;
3090 PCADDR npc = pc + 2;
3093 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3094 if (UNLIKELY(current_cpu->trace_result_p))
3095 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 << " ";
3096 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3099 current_cpu->done_insn (npc, status);
3103 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
3106 sh5_compact_sem_movb4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3107 sh5_compact::write_stacks &buf)
3109 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3110 sem_status status = SEM_STATUS_NORMAL;
3111 sh5_compact_scache* abuf = sem;
3112 unsigned long long written = 0;
3113 PCADDR pc = abuf->addr;
3114 PCADDR npc = pc + 2;
3118 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
3120 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
3121 if (UNLIKELY(current_cpu->trace_result_p))
3122 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3123 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3127 current_cpu->done_insn (npc, status);
3131 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
3134 sh5_compact_sem_movb5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3135 sh5_compact::write_stacks &buf)
3137 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
3138 sem_status status = SEM_STATUS_NORMAL;
3139 sh5_compact_scache* abuf = sem;
3140 unsigned long long written = 0;
3141 PCADDR pc = abuf->addr;
3142 PCADDR npc = pc + 2;
3146 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
3148 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
3149 if (UNLIKELY(current_cpu->trace_result_p))
3150 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3151 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3155 current_cpu->done_insn (npc, status);
3159 // ********** movb6-compact: mov.b @$rm, $rn
3162 sh5_compact_sem_movb6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3163 sh5_compact::write_stacks &buf)
3165 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3166 sem_status status = SEM_STATUS_NORMAL;
3167 sh5_compact_scache* abuf = sem;
3168 unsigned long long written = 0;
3169 PCADDR pc = abuf->addr;
3170 PCADDR npc = pc + 2;
3173 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3174 if (UNLIKELY(current_cpu->trace_result_p))
3175 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3176 current_cpu->h_grc_set (FLD (f_rn), opval);
3179 current_cpu->done_insn (npc, status);
3183 // ********** movb7-compact: mov.b @${rm}+, $rn
3186 sh5_compact_sem_movb7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3187 sh5_compact::write_stacks &buf)
3189 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3190 sem_status status = SEM_STATUS_NORMAL;
3191 sh5_compact_scache* abuf = sem;
3192 unsigned long long written = 0;
3193 PCADDR pc = abuf->addr;
3194 PCADDR npc = pc + 2;
3198 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3199 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3201 SI opval = EXTQISI (tmp_data);
3202 written |= (1ULL << 4);
3203 if (UNLIKELY(current_cpu->trace_result_p))
3204 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3205 current_cpu->h_grc_set (FLD (f_rm), opval);
3209 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3210 written |= (1ULL << 4);
3211 if (UNLIKELY(current_cpu->trace_result_p))
3212 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3213 current_cpu->h_grc_set (FLD (f_rm), opval);
3217 SI opval = EXTQISI (tmp_data);
3218 if (UNLIKELY(current_cpu->trace_result_p))
3219 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3220 current_cpu->h_grc_set (FLD (f_rn), opval);
3224 abuf->written = written;
3225 current_cpu->done_insn (npc, status);
3229 // ********** movb8-compact: mov.b @(r0, $rm), $rn
3232 sh5_compact_sem_movb8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3233 sh5_compact::write_stacks &buf)
3235 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3236 sem_status status = SEM_STATUS_NORMAL;
3237 sh5_compact_scache* abuf = sem;
3238 unsigned long long written = 0;
3239 PCADDR pc = abuf->addr;
3240 PCADDR npc = pc + 2;
3243 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3244 if (UNLIKELY(current_cpu->trace_result_p))
3245 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3246 current_cpu->h_grc_set (FLD (f_rn), opval);
3249 current_cpu->done_insn (npc, status);
3253 // ********** movb9-compact: mov.b @($imm8, gbr), r0
3256 sh5_compact_sem_movb9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3257 sh5_compact::write_stacks &buf)
3259 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3260 sem_status status = SEM_STATUS_NORMAL;
3261 sh5_compact_scache* abuf = sem;
3262 unsigned long long written = 0;
3263 PCADDR pc = abuf->addr;
3264 PCADDR npc = pc + 2;
3267 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
3268 if (UNLIKELY(current_cpu->trace_result_p))
3269 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3270 current_cpu->h_grc_set (((UINT) 0), opval);
3273 current_cpu->done_insn (npc, status);
3277 // ********** movb10-compact: mov.b @($imm4, $rm), r0
3280 sh5_compact_sem_movb10_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3281 sh5_compact::write_stacks &buf)
3283 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
3284 sem_status status = SEM_STATUS_NORMAL;
3285 sh5_compact_scache* abuf = sem;
3286 unsigned long long written = 0;
3287 PCADDR pc = abuf->addr;
3288 PCADDR npc = pc + 2;
3291 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
3292 if (UNLIKELY(current_cpu->trace_result_p))
3293 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3294 current_cpu->h_grc_set (((UINT) 0), opval);
3297 current_cpu->done_insn (npc, status);
3301 // ********** movl1-compact: mov.l $rm, @$rn
3304 sh5_compact_sem_movl1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3305 sh5_compact::write_stacks &buf)
3307 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3308 sem_status status = SEM_STATUS_NORMAL;
3309 sh5_compact_scache* abuf = sem;
3310 unsigned long long written = 0;
3311 PCADDR pc = abuf->addr;
3312 PCADDR npc = pc + 2;
3315 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3316 if (UNLIKELY(current_cpu->trace_result_p))
3317 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3318 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3321 current_cpu->done_insn (npc, status);
3325 // ********** movl2-compact: mov.l $rm, @-$rn
3328 sh5_compact_sem_movl2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3329 sh5_compact::write_stacks &buf)
3331 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3332 sem_status status = SEM_STATUS_NORMAL;
3333 sh5_compact_scache* abuf = sem;
3334 unsigned long long written = 0;
3335 PCADDR pc = abuf->addr;
3336 PCADDR npc = pc + 2;
3340 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3342 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3343 if (UNLIKELY(current_cpu->trace_result_p))
3344 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3345 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3348 SI opval = tmp_addr;
3349 if (UNLIKELY(current_cpu->trace_result_p))
3350 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3351 current_cpu->h_grc_set (FLD (f_rn), opval);
3355 current_cpu->done_insn (npc, status);
3359 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
3362 sh5_compact_sem_movl3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3363 sh5_compact::write_stacks &buf)
3365 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3366 sem_status status = SEM_STATUS_NORMAL;
3367 sh5_compact_scache* abuf = sem;
3368 unsigned long long written = 0;
3369 PCADDR pc = abuf->addr;
3370 PCADDR npc = pc + 2;
3373 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3374 if (UNLIKELY(current_cpu->trace_result_p))
3375 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 << " ";
3376 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3379 current_cpu->done_insn (npc, status);
3383 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
3386 sh5_compact_sem_movl4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3387 sh5_compact::write_stacks &buf)
3389 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
3390 sem_status status = SEM_STATUS_NORMAL;
3391 sh5_compact_scache* abuf = sem;
3392 unsigned long long written = 0;
3393 PCADDR pc = abuf->addr;
3394 PCADDR npc = pc + 2;
3397 SI opval = current_cpu->h_grc_get (((UINT) 0));
3398 if (UNLIKELY(current_cpu->trace_result_p))
3399 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3400 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
3403 current_cpu->done_insn (npc, status);
3407 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
3410 sh5_compact_sem_movl5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3411 sh5_compact::write_stacks &buf)
3413 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3414 sem_status status = SEM_STATUS_NORMAL;
3415 sh5_compact_scache* abuf = sem;
3416 unsigned long long written = 0;
3417 PCADDR pc = abuf->addr;
3418 PCADDR npc = pc + 2;
3421 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3422 if (UNLIKELY(current_cpu->trace_result_p))
3423 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 << " ";
3424 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
3427 current_cpu->done_insn (npc, status);
3431 // ********** movl6-compact: mov.l @$rm, $rn
3434 sh5_compact_sem_movl6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3435 sh5_compact::write_stacks &buf)
3437 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3438 sem_status status = SEM_STATUS_NORMAL;
3439 sh5_compact_scache* abuf = sem;
3440 unsigned long long written = 0;
3441 PCADDR pc = abuf->addr;
3442 PCADDR npc = pc + 2;
3445 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3446 if (UNLIKELY(current_cpu->trace_result_p))
3447 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3448 current_cpu->h_grc_set (FLD (f_rn), opval);
3451 current_cpu->done_insn (npc, status);
3455 // ********** movl7-compact: mov.l @${rm}+, $rn
3458 sh5_compact_sem_movl7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3459 sh5_compact::write_stacks &buf)
3461 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3462 sem_status status = SEM_STATUS_NORMAL;
3463 sh5_compact_scache* abuf = sem;
3464 unsigned long long written = 0;
3465 PCADDR pc = abuf->addr;
3466 PCADDR npc = pc + 2;
3470 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3471 if (UNLIKELY(current_cpu->trace_result_p))
3472 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3473 current_cpu->h_grc_set (FLD (f_rn), opval);
3475 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3477 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3478 written |= (1ULL << 5);
3479 if (UNLIKELY(current_cpu->trace_result_p))
3480 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3481 current_cpu->h_grc_set (FLD (f_rm), opval);
3485 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
3486 written |= (1ULL << 5);
3487 if (UNLIKELY(current_cpu->trace_result_p))
3488 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3489 current_cpu->h_grc_set (FLD (f_rm), opval);
3494 abuf->written = written;
3495 current_cpu->done_insn (npc, status);
3499 // ********** movl8-compact: mov.l @(r0, $rm), $rn
3502 sh5_compact_sem_movl8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3503 sh5_compact::write_stacks &buf)
3505 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3506 sem_status status = SEM_STATUS_NORMAL;
3507 sh5_compact_scache* abuf = sem;
3508 unsigned long long written = 0;
3509 PCADDR pc = abuf->addr;
3510 PCADDR npc = pc + 2;
3513 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
3514 if (UNLIKELY(current_cpu->trace_result_p))
3515 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3516 current_cpu->h_grc_set (FLD (f_rn), opval);
3519 current_cpu->done_insn (npc, status);
3523 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
3526 sh5_compact_sem_movl9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3527 sh5_compact::write_stacks &buf)
3529 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3530 sem_status status = SEM_STATUS_NORMAL;
3531 sh5_compact_scache* abuf = sem;
3532 unsigned long long written = 0;
3533 PCADDR pc = abuf->addr;
3534 PCADDR npc = pc + 2;
3537 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
3538 if (UNLIKELY(current_cpu->trace_result_p))
3539 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3540 current_cpu->h_grc_set (((UINT) 0), opval);
3543 current_cpu->done_insn (npc, status);
3547 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
3550 sh5_compact_sem_movl10_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3551 sh5_compact::write_stacks &buf)
3553 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3554 sem_status status = SEM_STATUS_NORMAL;
3555 sh5_compact_scache* abuf = sem;
3556 unsigned long long written = 0;
3557 PCADDR pc = abuf->addr;
3558 PCADDR npc = pc + 2;
3561 SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3562 if (UNLIKELY(current_cpu->trace_result_p))
3563 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3564 current_cpu->h_grc_set (FLD (f_rn), opval);
3567 current_cpu->done_insn (npc, status);
3571 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
3574 sh5_compact_sem_movl11_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3575 sh5_compact::write_stacks &buf)
3577 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3578 sem_status status = SEM_STATUS_NORMAL;
3579 sh5_compact_scache* abuf = sem;
3580 unsigned long long written = 0;
3581 PCADDR pc = abuf->addr;
3582 PCADDR npc = pc + 2;
3585 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
3586 if (UNLIKELY(current_cpu->trace_result_p))
3587 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3588 current_cpu->h_grc_set (FLD (f_rn), opval);
3591 current_cpu->done_insn (npc, status);
3595 // ********** movl12-compact: mov.l @($imm12x4, $rm), $rn
3598 sh5_compact_sem_movl12_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3599 sh5_compact::write_stacks &buf)
3601 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3602 sem_status status = SEM_STATUS_NORMAL;
3603 sh5_compact_scache* abuf = sem;
3604 unsigned long long written = 0;
3605 PCADDR pc = abuf->addr;
3606 PCADDR npc = pc + 4;
3609 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x4)));
3610 if (UNLIKELY(current_cpu->trace_result_p))
3611 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3612 current_cpu->h_grc_set (FLD (f_rn), opval);
3615 current_cpu->done_insn (npc, status);
3619 // ********** movl13-compact: mov.l $rm, @($imm12x4, $rn)
3622 sh5_compact_sem_movl13_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3623 sh5_compact::write_stacks &buf)
3625 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3626 sem_status status = SEM_STATUS_NORMAL;
3627 sh5_compact_scache* abuf = sem;
3628 unsigned long long written = 0;
3629 PCADDR pc = abuf->addr;
3630 PCADDR npc = pc + 4;
3633 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3634 if (UNLIKELY(current_cpu->trace_result_p))
3635 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3636 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)), opval);
3639 current_cpu->done_insn (npc, status);
3643 // ********** movw1-compact: mov.w $rm, @$rn
3646 sh5_compact_sem_movw1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3647 sh5_compact::write_stacks &buf)
3649 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3650 sem_status status = SEM_STATUS_NORMAL;
3651 sh5_compact_scache* abuf = sem;
3652 unsigned long long written = 0;
3653 PCADDR pc = abuf->addr;
3654 PCADDR npc = pc + 2;
3657 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3658 if (UNLIKELY(current_cpu->trace_result_p))
3659 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3660 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3663 current_cpu->done_insn (npc, status);
3667 // ********** movw2-compact: mov.w $rm, @-$rn
3670 sh5_compact_sem_movw2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3671 sh5_compact::write_stacks &buf)
3673 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3674 sem_status status = SEM_STATUS_NORMAL;
3675 sh5_compact_scache* abuf = sem;
3676 unsigned long long written = 0;
3677 PCADDR pc = abuf->addr;
3678 PCADDR npc = pc + 2;
3682 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3684 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3685 if (UNLIKELY(current_cpu->trace_result_p))
3686 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3687 current_cpu->SETMEMHI (pc, tmp_addr, opval);
3690 SI opval = tmp_addr;
3691 if (UNLIKELY(current_cpu->trace_result_p))
3692 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3693 current_cpu->h_grc_set (FLD (f_rn), opval);
3697 current_cpu->done_insn (npc, status);
3701 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
3704 sh5_compact_sem_movw3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3705 sh5_compact::write_stacks &buf)
3707 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3708 sem_status status = SEM_STATUS_NORMAL;
3709 sh5_compact_scache* abuf = sem;
3710 unsigned long long written = 0;
3711 PCADDR pc = abuf->addr;
3712 PCADDR npc = pc + 2;
3715 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3716 if (UNLIKELY(current_cpu->trace_result_p))
3717 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 << " ";
3718 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3721 current_cpu->done_insn (npc, status);
3725 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
3728 sh5_compact_sem_movw4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3729 sh5_compact::write_stacks &buf)
3731 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
3732 sem_status status = SEM_STATUS_NORMAL;
3733 sh5_compact_scache* abuf = sem;
3734 unsigned long long written = 0;
3735 PCADDR pc = abuf->addr;
3736 PCADDR npc = pc + 2;
3739 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3740 if (UNLIKELY(current_cpu->trace_result_p))
3741 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3742 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
3745 current_cpu->done_insn (npc, status);
3749 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
3752 sh5_compact_sem_movw5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3753 sh5_compact::write_stacks &buf)
3755 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3756 sem_status status = SEM_STATUS_NORMAL;
3757 sh5_compact_scache* abuf = sem;
3758 unsigned long long written = 0;
3759 PCADDR pc = abuf->addr;
3760 PCADDR npc = pc + 2;
3763 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3764 if (UNLIKELY(current_cpu->trace_result_p))
3765 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 << " ";
3766 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
3769 current_cpu->done_insn (npc, status);
3773 // ********** movw6-compact: mov.w @$rm, $rn
3776 sh5_compact_sem_movw6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3777 sh5_compact::write_stacks &buf)
3779 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3780 sem_status status = SEM_STATUS_NORMAL;
3781 sh5_compact_scache* abuf = sem;
3782 unsigned long long written = 0;
3783 PCADDR pc = abuf->addr;
3784 PCADDR npc = pc + 2;
3787 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3788 if (UNLIKELY(current_cpu->trace_result_p))
3789 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3790 current_cpu->h_grc_set (FLD (f_rn), opval);
3793 current_cpu->done_insn (npc, status);
3797 // ********** movw7-compact: mov.w @${rm}+, $rn
3800 sh5_compact_sem_movw7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3801 sh5_compact::write_stacks &buf)
3803 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3804 sem_status status = SEM_STATUS_NORMAL;
3805 sh5_compact_scache* abuf = sem;
3806 unsigned long long written = 0;
3807 PCADDR pc = abuf->addr;
3808 PCADDR npc = pc + 2;
3812 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3813 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3815 SI opval = EXTHISI (tmp_data);
3816 written |= (1ULL << 4);
3817 if (UNLIKELY(current_cpu->trace_result_p))
3818 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3819 current_cpu->h_grc_set (FLD (f_rm), opval);
3823 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
3824 written |= (1ULL << 4);
3825 if (UNLIKELY(current_cpu->trace_result_p))
3826 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3827 current_cpu->h_grc_set (FLD (f_rm), opval);
3831 SI opval = EXTHISI (tmp_data);
3832 if (UNLIKELY(current_cpu->trace_result_p))
3833 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3834 current_cpu->h_grc_set (FLD (f_rn), opval);
3838 abuf->written = written;
3839 current_cpu->done_insn (npc, status);
3843 // ********** movw8-compact: mov.w @(r0, $rm), $rn
3846 sh5_compact_sem_movw8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3847 sh5_compact::write_stacks &buf)
3849 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3850 sem_status status = SEM_STATUS_NORMAL;
3851 sh5_compact_scache* abuf = sem;
3852 unsigned long long written = 0;
3853 PCADDR pc = abuf->addr;
3854 PCADDR npc = pc + 2;
3857 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3858 if (UNLIKELY(current_cpu->trace_result_p))
3859 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3860 current_cpu->h_grc_set (FLD (f_rn), opval);
3863 current_cpu->done_insn (npc, status);
3867 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
3870 sh5_compact_sem_movw9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3871 sh5_compact::write_stacks &buf)
3873 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
3874 sem_status status = SEM_STATUS_NORMAL;
3875 sh5_compact_scache* abuf = sem;
3876 unsigned long long written = 0;
3877 PCADDR pc = abuf->addr;
3878 PCADDR npc = pc + 2;
3881 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
3882 if (UNLIKELY(current_cpu->trace_result_p))
3883 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3884 current_cpu->h_grc_set (((UINT) 0), opval);
3887 current_cpu->done_insn (npc, status);
3891 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
3894 sh5_compact_sem_movw10_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3895 sh5_compact::write_stacks &buf)
3897 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3898 sem_status status = SEM_STATUS_NORMAL;
3899 sh5_compact_scache* abuf = sem;
3900 unsigned long long written = 0;
3901 PCADDR pc = abuf->addr;
3902 PCADDR npc = pc + 2;
3905 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
3906 if (UNLIKELY(current_cpu->trace_result_p))
3907 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3908 current_cpu->h_grc_set (FLD (f_rn), opval);
3911 current_cpu->done_insn (npc, status);
3915 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
3918 sh5_compact_sem_movw11_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3919 sh5_compact::write_stacks &buf)
3921 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
3922 sem_status status = SEM_STATUS_NORMAL;
3923 sh5_compact_scache* abuf = sem;
3924 unsigned long long written = 0;
3925 PCADDR pc = abuf->addr;
3926 PCADDR npc = pc + 2;
3929 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
3930 if (UNLIKELY(current_cpu->trace_result_p))
3931 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3932 current_cpu->h_grc_set (((UINT) 0), opval);
3935 current_cpu->done_insn (npc, status);
3939 // ********** mova-compact: mova @($imm8x4, pc), r0
3942 sh5_compact_sem_mova_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3943 sh5_compact::write_stacks &buf)
3945 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3946 sem_status status = SEM_STATUS_NORMAL;
3947 sh5_compact_scache* abuf = sem;
3948 unsigned long long written = 0;
3949 PCADDR pc = abuf->addr;
3950 PCADDR npc = pc + 2;
3953 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3954 if (UNLIKELY(current_cpu->trace_result_p))
3955 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3956 current_cpu->h_grc_set (((UINT) 0), opval);
3959 current_cpu->done_insn (npc, status);
3963 // ********** movcal-compact: movca.l r0, @$rn
3966 sh5_compact_sem_movcal_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3967 sh5_compact::write_stacks &buf)
3969 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3970 sem_status status = SEM_STATUS_NORMAL;
3971 sh5_compact_scache* abuf = sem;
3972 unsigned long long written = 0;
3973 PCADDR pc = abuf->addr;
3974 PCADDR npc = pc + 2;
3977 SI opval = current_cpu->h_grc_get (((UINT) 0));
3978 if (UNLIKELY(current_cpu->trace_result_p))
3979 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3980 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3983 current_cpu->done_insn (npc, status);
3987 // ********** movcol-compact: movco.l r0, @$rn
3990 sh5_compact_sem_movcol_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
3991 sh5_compact::write_stacks &buf)
3993 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
3994 sem_status status = SEM_STATUS_NORMAL;
3995 sh5_compact_scache* abuf = sem;
3996 unsigned long long written = 0;
3997 PCADDR pc = abuf->addr;
3998 PCADDR npc = pc + 2;
4001 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4002 if (UNLIKELY(current_cpu->trace_result_p))
4003 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4004 current_cpu->h_grc_set (FLD (f_rn), opval);
4007 current_cpu->done_insn (npc, status);
4011 // ********** movt-compact: movt $rn
4014 sh5_compact_sem_movt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4015 sh5_compact::write_stacks &buf)
4017 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4018 sem_status status = SEM_STATUS_NORMAL;
4019 sh5_compact_scache* abuf = sem;
4020 unsigned long long written = 0;
4021 PCADDR pc = abuf->addr;
4022 PCADDR npc = pc + 2;
4025 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
4026 if (UNLIKELY(current_cpu->trace_result_p))
4027 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4028 current_cpu->h_grc_set (FLD (f_rn), opval);
4031 current_cpu->done_insn (npc, status);
4035 // ********** movual-compact: movua.l @$rn, r0
4038 sh5_compact_sem_movual_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4039 sh5_compact::write_stacks &buf)
4041 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4042 sem_status status = SEM_STATUS_NORMAL;
4043 sh5_compact_scache* abuf = sem;
4044 unsigned long long written = 0;
4045 PCADDR pc = abuf->addr;
4046 PCADDR npc = pc + 2;
4049 SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
4050 if (UNLIKELY(current_cpu->trace_result_p))
4051 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4052 current_cpu->h_grc_set (((UINT) 0), opval);
4055 current_cpu->done_insn (npc, status);
4059 // ********** movual2-compact: movua.l @$rn+, r0
4062 sh5_compact_sem_movual2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4063 sh5_compact::write_stacks &buf)
4065 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4066 sem_status status = SEM_STATUS_NORMAL;
4067 sh5_compact_scache* abuf = sem;
4068 unsigned long long written = 0;
4069 PCADDR pc = abuf->addr;
4070 PCADDR npc = pc + 2;
4074 SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
4075 if (UNLIKELY(current_cpu->trace_result_p))
4076 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4077 current_cpu->h_grc_set (((UINT) 0), opval);
4080 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4081 if (UNLIKELY(current_cpu->trace_result_p))
4082 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4083 current_cpu->h_grc_set (FLD (f_rn), opval);
4087 current_cpu->done_insn (npc, status);
4091 // ********** mull-compact: mul.l $rm, $rn
4094 sh5_compact_sem_mull_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4095 sh5_compact::write_stacks &buf)
4097 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4098 sem_status status = SEM_STATUS_NORMAL;
4099 sh5_compact_scache* abuf = sem;
4100 unsigned long long written = 0;
4101 PCADDR pc = abuf->addr;
4102 PCADDR npc = pc + 2;
4105 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
4106 if (UNLIKELY(current_cpu->trace_result_p))
4107 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
4108 current_cpu->h_macl_set (opval);
4111 current_cpu->done_insn (npc, status);
4115 // ********** mulsw-compact: muls.w $rm, $rn
4118 sh5_compact_sem_mulsw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4119 sh5_compact::write_stacks &buf)
4121 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4122 sem_status status = SEM_STATUS_NORMAL;
4123 sh5_compact_scache* abuf = sem;
4124 unsigned long long written = 0;
4125 PCADDR pc = abuf->addr;
4126 PCADDR npc = pc + 2;
4129 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)));
4130 if (UNLIKELY(current_cpu->trace_result_p))
4131 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
4132 current_cpu->h_macl_set (opval);
4135 current_cpu->done_insn (npc, status);
4139 // ********** muluw-compact: mulu.w $rm, $rn
4142 sh5_compact_sem_muluw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4143 sh5_compact::write_stacks &buf)
4145 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4146 sem_status status = SEM_STATUS_NORMAL;
4147 sh5_compact_scache* abuf = sem;
4148 unsigned long long written = 0;
4149 PCADDR pc = abuf->addr;
4150 PCADDR npc = pc + 2;
4153 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)));
4154 if (UNLIKELY(current_cpu->trace_result_p))
4155 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
4156 current_cpu->h_macl_set (opval);
4159 current_cpu->done_insn (npc, status);
4163 // ********** neg-compact: neg $rm, $rn
4166 sh5_compact_sem_neg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4167 sh5_compact::write_stacks &buf)
4169 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4170 sem_status status = SEM_STATUS_NORMAL;
4171 sh5_compact_scache* abuf = sem;
4172 unsigned long long written = 0;
4173 PCADDR pc = abuf->addr;
4174 PCADDR npc = pc + 2;
4177 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
4178 if (UNLIKELY(current_cpu->trace_result_p))
4179 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4180 current_cpu->h_grc_set (FLD (f_rn), opval);
4183 current_cpu->done_insn (npc, status);
4187 // ********** negc-compact: negc $rm, $rn
4190 sh5_compact_sem_negc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4191 sh5_compact::write_stacks &buf)
4193 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4194 sem_status status = SEM_STATUS_NORMAL;
4195 sh5_compact_scache* abuf = sem;
4196 unsigned long long written = 0;
4197 PCADDR pc = abuf->addr;
4198 PCADDR npc = pc + 2;
4202 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4204 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4205 if (UNLIKELY(current_cpu->trace_result_p))
4206 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4207 current_cpu->h_grc_set (FLD (f_rn), opval);
4210 BI opval = tmp_flag;
4211 if (UNLIKELY(current_cpu->trace_result_p))
4212 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4213 current_cpu->h_tbit_set (opval);
4217 current_cpu->done_insn (npc, status);
4221 // ********** nop-compact: nop
4224 sh5_compact_sem_nop_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4225 sh5_compact::write_stacks &buf)
4227 #define FLD(f) abuf->fields.fmt_empty.f
4228 sem_status status = SEM_STATUS_NORMAL;
4229 sh5_compact_scache* abuf = sem;
4230 unsigned long long written = 0;
4231 PCADDR pc = abuf->addr;
4232 PCADDR npc = pc + 2;
4236 current_cpu->done_insn (npc, status);
4240 // ********** not-compact: not $rm64, $rn64
4243 sh5_compact_sem_not_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4244 sh5_compact::write_stacks &buf)
4246 #define FLD(f) abuf->fields.sfmt_and_compact.f
4247 sem_status status = SEM_STATUS_NORMAL;
4248 sh5_compact_scache* abuf = sem;
4249 unsigned long long written = 0;
4250 PCADDR pc = abuf->addr;
4251 PCADDR npc = pc + 2;
4254 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
4255 if (UNLIKELY(current_cpu->trace_result_p))
4256 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4257 current_cpu->h_gr_set (FLD (f_rn), opval);
4260 current_cpu->done_insn (npc, status);
4264 // ********** ocbi-compact: ocbi @$rn
4267 sh5_compact_sem_ocbi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4268 sh5_compact::write_stacks &buf)
4270 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4271 sem_status status = SEM_STATUS_NORMAL;
4272 sh5_compact_scache* abuf = sem;
4273 unsigned long long written = 0;
4274 PCADDR pc = abuf->addr;
4275 PCADDR npc = pc + 2;
4279 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4280 if (UNLIKELY(current_cpu->trace_result_p))
4281 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4282 current_cpu->h_grc_set (FLD (f_rn), opval);
4287 current_cpu->done_insn (npc, status);
4291 // ********** ocbp-compact: ocbp @$rn
4294 sh5_compact_sem_ocbp_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4295 sh5_compact::write_stacks &buf)
4297 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4298 sem_status status = SEM_STATUS_NORMAL;
4299 sh5_compact_scache* abuf = sem;
4300 unsigned long long written = 0;
4301 PCADDR pc = abuf->addr;
4302 PCADDR npc = pc + 2;
4306 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4307 if (UNLIKELY(current_cpu->trace_result_p))
4308 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4309 current_cpu->h_grc_set (FLD (f_rn), opval);
4314 current_cpu->done_insn (npc, status);
4318 // ********** ocbwb-compact: ocbwb @$rn
4321 sh5_compact_sem_ocbwb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4322 sh5_compact::write_stacks &buf)
4324 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4325 sem_status status = SEM_STATUS_NORMAL;
4326 sh5_compact_scache* abuf = sem;
4327 unsigned long long written = 0;
4328 PCADDR pc = abuf->addr;
4329 PCADDR npc = pc + 2;
4333 SI opval = current_cpu->h_grc_get (FLD (f_rn));
4334 if (UNLIKELY(current_cpu->trace_result_p))
4335 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4336 current_cpu->h_grc_set (FLD (f_rn), opval);
4341 current_cpu->done_insn (npc, status);
4345 // ********** or-compact: or $rm64, $rn64
4348 sh5_compact_sem_or_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4349 sh5_compact::write_stacks &buf)
4351 #define FLD(f) abuf->fields.sfmt_and_compact.f
4352 sem_status status = SEM_STATUS_NORMAL;
4353 sh5_compact_scache* abuf = sem;
4354 unsigned long long written = 0;
4355 PCADDR pc = abuf->addr;
4356 PCADDR npc = pc + 2;
4359 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
4360 if (UNLIKELY(current_cpu->trace_result_p))
4361 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4362 current_cpu->h_gr_set (FLD (f_rn), opval);
4365 current_cpu->done_insn (npc, status);
4369 // ********** ori-compact: or #$uimm8, r0
4372 sh5_compact_sem_ori_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4373 sh5_compact::write_stacks &buf)
4375 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4376 sem_status status = SEM_STATUS_NORMAL;
4377 sh5_compact_scache* abuf = sem;
4378 unsigned long long written = 0;
4379 PCADDR pc = abuf->addr;
4380 PCADDR npc = pc + 2;
4383 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4384 if (UNLIKELY(current_cpu->trace_result_p))
4385 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4386 current_cpu->h_grc_set (((UINT) 0), opval);
4389 current_cpu->done_insn (npc, status);
4393 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
4396 sh5_compact_sem_orb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4397 sh5_compact::write_stacks &buf)
4399 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4400 sem_status status = SEM_STATUS_NORMAL;
4401 sh5_compact_scache* abuf = sem;
4402 unsigned long long written = 0;
4403 PCADDR pc = abuf->addr;
4404 PCADDR npc = pc + 2;
4409 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4410 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4412 UQI opval = tmp_data;
4413 if (UNLIKELY(current_cpu->trace_result_p))
4414 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4415 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4419 current_cpu->done_insn (npc, status);
4423 // ********** pref-compact: pref @$rn
4426 sh5_compact_sem_pref_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4427 sh5_compact::write_stacks &buf)
4429 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4430 sem_status status = SEM_STATUS_NORMAL;
4431 sh5_compact_scache* abuf = sem;
4432 unsigned long long written = 0;
4433 PCADDR pc = abuf->addr;
4434 PCADDR npc = pc + 2;
4436 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
4438 current_cpu->done_insn (npc, status);
4442 // ********** rotcl-compact: rotcl $rn
4445 sh5_compact_sem_rotcl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4446 sh5_compact::write_stacks &buf)
4448 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4449 sem_status status = SEM_STATUS_NORMAL;
4450 sh5_compact_scache* abuf = sem;
4451 unsigned long long written = 0;
4452 PCADDR pc = abuf->addr;
4453 PCADDR npc = pc + 2;
4457 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4459 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
4460 if (UNLIKELY(current_cpu->trace_result_p))
4461 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4462 current_cpu->h_grc_set (FLD (f_rn), opval);
4465 BI opval = ((tmp_temp) ? (1) : (0));
4466 if (UNLIKELY(current_cpu->trace_result_p))
4467 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4468 current_cpu->h_tbit_set (opval);
4472 current_cpu->done_insn (npc, status);
4476 // ********** rotcr-compact: rotcr $rn
4479 sh5_compact_sem_rotcr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4480 sh5_compact::write_stacks &buf)
4482 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4483 sem_status status = SEM_STATUS_NORMAL;
4484 sh5_compact_scache* abuf = sem;
4485 unsigned long long written = 0;
4486 PCADDR pc = abuf->addr;
4487 PCADDR npc = pc + 2;
4492 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4493 tmp_temp = current_cpu->h_tbit_get ();
4495 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4496 if (UNLIKELY(current_cpu->trace_result_p))
4497 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4498 current_cpu->h_grc_set (FLD (f_rn), opval);
4501 BI opval = ((tmp_lsbit) ? (1) : (0));
4502 if (UNLIKELY(current_cpu->trace_result_p))
4503 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4504 current_cpu->h_tbit_set (opval);
4508 current_cpu->done_insn (npc, status);
4512 // ********** rotl-compact: rotl $rn
4515 sh5_compact_sem_rotl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4516 sh5_compact::write_stacks &buf)
4518 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4519 sem_status status = SEM_STATUS_NORMAL;
4520 sh5_compact_scache* abuf = sem;
4521 unsigned long long written = 0;
4522 PCADDR pc = abuf->addr;
4523 PCADDR npc = pc + 2;
4527 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4529 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
4530 if (UNLIKELY(current_cpu->trace_result_p))
4531 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4532 current_cpu->h_grc_set (FLD (f_rn), opval);
4535 BI opval = ((tmp_temp) ? (1) : (0));
4536 if (UNLIKELY(current_cpu->trace_result_p))
4537 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4538 current_cpu->h_tbit_set (opval);
4542 current_cpu->done_insn (npc, status);
4546 // ********** rotr-compact: rotr $rn
4549 sh5_compact_sem_rotr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4550 sh5_compact::write_stacks &buf)
4552 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4553 sem_status status = SEM_STATUS_NORMAL;
4554 sh5_compact_scache* abuf = sem;
4555 unsigned long long written = 0;
4556 PCADDR pc = abuf->addr;
4557 PCADDR npc = pc + 2;
4562 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4563 tmp_temp = tmp_lsbit;
4565 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4566 if (UNLIKELY(current_cpu->trace_result_p))
4567 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4568 current_cpu->h_grc_set (FLD (f_rn), opval);
4571 BI opval = ((tmp_lsbit) ? (1) : (0));
4572 if (UNLIKELY(current_cpu->trace_result_p))
4573 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4574 current_cpu->h_tbit_set (opval);
4578 current_cpu->done_insn (npc, status);
4582 // ********** rts-compact: rts
4585 sh5_compact_sem_rts_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4586 sh5_compact::write_stacks &buf)
4588 #define FLD(f) abuf->fields.fmt_empty.f
4589 sem_status status = SEM_STATUS_NORMAL;
4590 sh5_compact_scache* abuf = sem;
4591 unsigned long long written = 0;
4592 PCADDR pc = abuf->addr;
4593 PCADDR npc = pc + 2;
4597 UDI opval = ADDDI (pc, 2);
4598 if (UNLIKELY(current_cpu->trace_result_p))
4599 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4600 current_cpu->branch (opval, npc, status);
4602 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
4604 UDI opval = current_cpu->h_pr_get ();
4605 buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
4606 if (UNLIKELY(current_cpu->trace_result_p))
4607 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4609 current_cpu->notify_ret (current_cpu->h_pr_get ());
4612 current_cpu->done_cti_insn (npc, status);
4616 // ********** sets-compact: sets
4619 sh5_compact_sem_sets_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4620 sh5_compact::write_stacks &buf)
4622 #define FLD(f) abuf->fields.fmt_empty.f
4623 sem_status status = SEM_STATUS_NORMAL;
4624 sh5_compact_scache* abuf = sem;
4625 unsigned long long written = 0;
4626 PCADDR pc = abuf->addr;
4627 PCADDR npc = pc + 2;
4631 if (UNLIKELY(current_cpu->trace_result_p))
4632 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
4633 current_cpu->h_sbit_set (opval);
4636 current_cpu->done_insn (npc, status);
4640 // ********** sett-compact: sett
4643 sh5_compact_sem_sett_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4644 sh5_compact::write_stacks &buf)
4646 #define FLD(f) abuf->fields.fmt_empty.f
4647 sem_status status = SEM_STATUS_NORMAL;
4648 sh5_compact_scache* abuf = sem;
4649 unsigned long long written = 0;
4650 PCADDR pc = abuf->addr;
4651 PCADDR npc = pc + 2;
4655 if (UNLIKELY(current_cpu->trace_result_p))
4656 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4657 current_cpu->h_tbit_set (opval);
4660 current_cpu->done_insn (npc, status);
4664 // ********** shad-compact: shad $rm, $rn
4667 sh5_compact_sem_shad_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4668 sh5_compact::write_stacks &buf)
4670 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4671 sem_status status = SEM_STATUS_NORMAL;
4672 sh5_compact_scache* abuf = sem;
4673 unsigned long long written = 0;
4674 PCADDR pc = abuf->addr;
4675 PCADDR npc = pc + 2;
4679 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4680 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4682 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4683 written |= (1ULL << 2);
4684 if (UNLIKELY(current_cpu->trace_result_p))
4685 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4686 current_cpu->h_grc_set (FLD (f_rn), opval);
4689 if (NESI (tmp_shamt, 0)) {
4691 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4692 written |= (1ULL << 2);
4693 if (UNLIKELY(current_cpu->trace_result_p))
4694 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4695 current_cpu->h_grc_set (FLD (f_rn), opval);
4698 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
4700 SI opval = NEGSI (1);
4701 written |= (1ULL << 2);
4702 if (UNLIKELY(current_cpu->trace_result_p))
4703 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4704 current_cpu->h_grc_set (FLD (f_rn), opval);
4709 written |= (1ULL << 2);
4710 if (UNLIKELY(current_cpu->trace_result_p))
4711 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4712 current_cpu->h_grc_set (FLD (f_rn), opval);
4719 abuf->written = written;
4720 current_cpu->done_insn (npc, status);
4724 // ********** shal-compact: shal $rn
4727 sh5_compact_sem_shal_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4728 sh5_compact::write_stacks &buf)
4730 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4731 sem_status status = SEM_STATUS_NORMAL;
4732 sh5_compact_scache* abuf = sem;
4733 unsigned long long written = 0;
4734 PCADDR pc = abuf->addr;
4735 PCADDR npc = pc + 2;
4739 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4741 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4742 if (UNLIKELY(current_cpu->trace_result_p))
4743 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4744 current_cpu->h_grc_set (FLD (f_rn), opval);
4747 BI opval = ((tmp_t) ? (1) : (0));
4748 if (UNLIKELY(current_cpu->trace_result_p))
4749 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4750 current_cpu->h_tbit_set (opval);
4754 current_cpu->done_insn (npc, status);
4758 // ********** shar-compact: shar $rn
4761 sh5_compact_sem_shar_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4762 sh5_compact::write_stacks &buf)
4764 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4765 sem_status status = SEM_STATUS_NORMAL;
4766 sh5_compact_scache* abuf = sem;
4767 unsigned long long written = 0;
4768 PCADDR pc = abuf->addr;
4769 PCADDR npc = pc + 2;
4773 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4775 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4776 if (UNLIKELY(current_cpu->trace_result_p))
4777 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4778 current_cpu->h_grc_set (FLD (f_rn), opval);
4781 BI opval = ((tmp_t) ? (1) : (0));
4782 if (UNLIKELY(current_cpu->trace_result_p))
4783 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4784 current_cpu->h_tbit_set (opval);
4788 current_cpu->done_insn (npc, status);
4792 // ********** shld-compact: shld $rm, $rn
4795 sh5_compact_sem_shld_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4796 sh5_compact::write_stacks &buf)
4798 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4799 sem_status status = SEM_STATUS_NORMAL;
4800 sh5_compact_scache* abuf = sem;
4801 unsigned long long written = 0;
4802 PCADDR pc = abuf->addr;
4803 PCADDR npc = pc + 2;
4807 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4808 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4810 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4811 written |= (1ULL << 2);
4812 if (UNLIKELY(current_cpu->trace_result_p))
4813 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4814 current_cpu->h_grc_set (FLD (f_rn), opval);
4817 if (NESI (tmp_shamt, 0)) {
4819 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4820 written |= (1ULL << 2);
4821 if (UNLIKELY(current_cpu->trace_result_p))
4822 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4823 current_cpu->h_grc_set (FLD (f_rn), opval);
4828 written |= (1ULL << 2);
4829 if (UNLIKELY(current_cpu->trace_result_p))
4830 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4831 current_cpu->h_grc_set (FLD (f_rn), opval);
4837 abuf->written = written;
4838 current_cpu->done_insn (npc, status);
4842 // ********** shll-compact: shll $rn
4845 sh5_compact_sem_shll_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4846 sh5_compact::write_stacks &buf)
4848 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4849 sem_status status = SEM_STATUS_NORMAL;
4850 sh5_compact_scache* abuf = sem;
4851 unsigned long long written = 0;
4852 PCADDR pc = abuf->addr;
4853 PCADDR npc = pc + 2;
4857 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4859 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4860 if (UNLIKELY(current_cpu->trace_result_p))
4861 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4862 current_cpu->h_grc_set (FLD (f_rn), opval);
4865 BI opval = ((tmp_t) ? (1) : (0));
4866 if (UNLIKELY(current_cpu->trace_result_p))
4867 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4868 current_cpu->h_tbit_set (opval);
4872 current_cpu->done_insn (npc, status);
4876 // ********** shll2-compact: shll2 $rn
4879 sh5_compact_sem_shll2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4880 sh5_compact::write_stacks &buf)
4882 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4883 sem_status status = SEM_STATUS_NORMAL;
4884 sh5_compact_scache* abuf = sem;
4885 unsigned long long written = 0;
4886 PCADDR pc = abuf->addr;
4887 PCADDR npc = pc + 2;
4890 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
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);
4896 current_cpu->done_insn (npc, status);
4900 // ********** shll8-compact: shll8 $rn
4903 sh5_compact_sem_shll8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4904 sh5_compact::write_stacks &buf)
4906 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4907 sem_status status = SEM_STATUS_NORMAL;
4908 sh5_compact_scache* abuf = sem;
4909 unsigned long long written = 0;
4910 PCADDR pc = abuf->addr;
4911 PCADDR npc = pc + 2;
4914 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4915 if (UNLIKELY(current_cpu->trace_result_p))
4916 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4917 current_cpu->h_grc_set (FLD (f_rn), opval);
4920 current_cpu->done_insn (npc, status);
4924 // ********** shll16-compact: shll16 $rn
4927 sh5_compact_sem_shll16_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4928 sh5_compact::write_stacks &buf)
4930 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4931 sem_status status = SEM_STATUS_NORMAL;
4932 sh5_compact_scache* abuf = sem;
4933 unsigned long long written = 0;
4934 PCADDR pc = abuf->addr;
4935 PCADDR npc = pc + 2;
4938 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4939 if (UNLIKELY(current_cpu->trace_result_p))
4940 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4941 current_cpu->h_grc_set (FLD (f_rn), opval);
4944 current_cpu->done_insn (npc, status);
4948 // ********** shlr-compact: shlr $rn
4951 sh5_compact_sem_shlr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4952 sh5_compact::write_stacks &buf)
4954 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4955 sem_status status = SEM_STATUS_NORMAL;
4956 sh5_compact_scache* abuf = sem;
4957 unsigned long long written = 0;
4958 PCADDR pc = abuf->addr;
4959 PCADDR npc = pc + 2;
4963 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4965 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4966 if (UNLIKELY(current_cpu->trace_result_p))
4967 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4968 current_cpu->h_grc_set (FLD (f_rn), opval);
4971 BI opval = ((tmp_t) ? (1) : (0));
4972 if (UNLIKELY(current_cpu->trace_result_p))
4973 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4974 current_cpu->h_tbit_set (opval);
4978 current_cpu->done_insn (npc, status);
4982 // ********** shlr2-compact: shlr2 $rn
4985 sh5_compact_sem_shlr2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
4986 sh5_compact::write_stacks &buf)
4988 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4989 sem_status status = SEM_STATUS_NORMAL;
4990 sh5_compact_scache* abuf = sem;
4991 unsigned long long written = 0;
4992 PCADDR pc = abuf->addr;
4993 PCADDR npc = pc + 2;
4996 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4997 if (UNLIKELY(current_cpu->trace_result_p))
4998 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4999 current_cpu->h_grc_set (FLD (f_rn), opval);
5002 current_cpu->done_insn (npc, status);
5006 // ********** shlr8-compact: shlr8 $rn
5009 sh5_compact_sem_shlr8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5010 sh5_compact::write_stacks &buf)
5012 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5013 sem_status status = SEM_STATUS_NORMAL;
5014 sh5_compact_scache* abuf = sem;
5015 unsigned long long written = 0;
5016 PCADDR pc = abuf->addr;
5017 PCADDR npc = pc + 2;
5020 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
5021 if (UNLIKELY(current_cpu->trace_result_p))
5022 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5023 current_cpu->h_grc_set (FLD (f_rn), opval);
5026 current_cpu->done_insn (npc, status);
5030 // ********** shlr16-compact: shlr16 $rn
5033 sh5_compact_sem_shlr16_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5034 sh5_compact::write_stacks &buf)
5036 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5037 sem_status status = SEM_STATUS_NORMAL;
5038 sh5_compact_scache* abuf = sem;
5039 unsigned long long written = 0;
5040 PCADDR pc = abuf->addr;
5041 PCADDR npc = pc + 2;
5044 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
5045 if (UNLIKELY(current_cpu->trace_result_p))
5046 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5047 current_cpu->h_grc_set (FLD (f_rn), opval);
5050 current_cpu->done_insn (npc, status);
5054 // ********** stc-gbr-compact: stc gbr, $rn
5057 sh5_compact_sem_stc_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5058 sh5_compact::write_stacks &buf)
5060 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5061 sem_status status = SEM_STATUS_NORMAL;
5062 sh5_compact_scache* abuf = sem;
5063 unsigned long long written = 0;
5064 PCADDR pc = abuf->addr;
5065 PCADDR npc = pc + 2;
5068 SI opval = current_cpu->h_gbr_get ();
5069 if (UNLIKELY(current_cpu->trace_result_p))
5070 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5071 current_cpu->h_grc_set (FLD (f_rn), opval);
5074 current_cpu->done_insn (npc, status);
5078 // ********** stc-vbr-compact: stc vbr, $rn
5081 sh5_compact_sem_stc_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5082 sh5_compact::write_stacks &buf)
5084 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5085 sem_status status = SEM_STATUS_NORMAL;
5086 sh5_compact_scache* abuf = sem;
5087 unsigned long long written = 0;
5088 PCADDR pc = abuf->addr;
5089 PCADDR npc = pc + 2;
5092 SI opval = current_cpu->h_vbr_get ();
5093 if (UNLIKELY(current_cpu->trace_result_p))
5094 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5095 current_cpu->h_grc_set (FLD (f_rn), opval);
5098 current_cpu->done_insn (npc, status);
5102 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
5105 sh5_compact_sem_stcl_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5106 sh5_compact::write_stacks &buf)
5108 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5109 sem_status status = SEM_STATUS_NORMAL;
5110 sh5_compact_scache* abuf = sem;
5111 unsigned long long written = 0;
5112 PCADDR pc = abuf->addr;
5113 PCADDR npc = pc + 2;
5117 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5119 SI opval = current_cpu->h_gbr_get ();
5120 if (UNLIKELY(current_cpu->trace_result_p))
5121 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5122 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5125 SI opval = tmp_addr;
5126 if (UNLIKELY(current_cpu->trace_result_p))
5127 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5128 current_cpu->h_grc_set (FLD (f_rn), opval);
5132 current_cpu->done_insn (npc, status);
5136 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
5139 sh5_compact_sem_stcl_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5140 sh5_compact::write_stacks &buf)
5142 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5143 sem_status status = SEM_STATUS_NORMAL;
5144 sh5_compact_scache* abuf = sem;
5145 unsigned long long written = 0;
5146 PCADDR pc = abuf->addr;
5147 PCADDR npc = pc + 2;
5151 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5153 SI opval = current_cpu->h_vbr_get ();
5154 if (UNLIKELY(current_cpu->trace_result_p))
5155 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5156 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5159 SI opval = tmp_addr;
5160 if (UNLIKELY(current_cpu->trace_result_p))
5161 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5162 current_cpu->h_grc_set (FLD (f_rn), opval);
5166 current_cpu->done_insn (npc, status);
5170 // ********** sts-fpscr-compact: sts fpscr, $rn
5173 sh5_compact_sem_sts_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5174 sh5_compact::write_stacks &buf)
5176 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5177 sem_status status = SEM_STATUS_NORMAL;
5178 sh5_compact_scache* abuf = sem;
5179 unsigned long long written = 0;
5180 PCADDR pc = abuf->addr;
5181 PCADDR npc = pc + 2;
5184 SI opval = current_cpu->hardware.h_fpscr;
5185 if (UNLIKELY(current_cpu->trace_result_p))
5186 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5187 current_cpu->h_grc_set (FLD (f_rn), opval);
5190 current_cpu->done_insn (npc, status);
5194 // ********** stsl-fpscr-compact: sts.l fpscr, @-$rn
5197 sh5_compact_sem_stsl_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5198 sh5_compact::write_stacks &buf)
5200 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5201 sem_status status = SEM_STATUS_NORMAL;
5202 sh5_compact_scache* abuf = sem;
5203 unsigned long long written = 0;
5204 PCADDR pc = abuf->addr;
5205 PCADDR npc = pc + 2;
5209 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5211 SI opval = current_cpu->hardware.h_fpscr;
5212 if (UNLIKELY(current_cpu->trace_result_p))
5213 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5214 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5217 SI opval = tmp_addr;
5218 if (UNLIKELY(current_cpu->trace_result_p))
5219 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5220 current_cpu->h_grc_set (FLD (f_rn), opval);
5224 current_cpu->done_insn (npc, status);
5228 // ********** sts-fpul-compact: sts fpul, $rn
5231 sh5_compact_sem_sts_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5232 sh5_compact::write_stacks &buf)
5234 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5235 sem_status status = SEM_STATUS_NORMAL;
5236 sh5_compact_scache* abuf = sem;
5237 unsigned long long written = 0;
5238 PCADDR pc = abuf->addr;
5239 PCADDR npc = pc + 2;
5242 SI opval = SUBWORDSFSI (current_cpu->hardware.h_fr[((UINT) 32)]);
5243 if (UNLIKELY(current_cpu->trace_result_p))
5244 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5245 current_cpu->h_grc_set (FLD (f_rn), opval);
5248 current_cpu->done_insn (npc, status);
5252 // ********** stsl-fpul-compact: sts.l fpul, @-$rn
5255 sh5_compact_sem_stsl_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5256 sh5_compact::write_stacks &buf)
5258 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5259 sem_status status = SEM_STATUS_NORMAL;
5260 sh5_compact_scache* abuf = sem;
5261 unsigned long long written = 0;
5262 PCADDR pc = abuf->addr;
5263 PCADDR npc = pc + 2;
5267 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5269 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
5270 if (UNLIKELY(current_cpu->trace_result_p))
5271 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5272 current_cpu->SETMEMSF (pc, tmp_addr, opval);
5275 SI opval = tmp_addr;
5276 if (UNLIKELY(current_cpu->trace_result_p))
5277 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5278 current_cpu->h_grc_set (FLD (f_rn), opval);
5282 current_cpu->done_insn (npc, status);
5286 // ********** sts-mach-compact: sts mach, $rn
5289 sh5_compact_sem_sts_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5290 sh5_compact::write_stacks &buf)
5292 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5293 sem_status status = SEM_STATUS_NORMAL;
5294 sh5_compact_scache* abuf = sem;
5295 unsigned long long written = 0;
5296 PCADDR pc = abuf->addr;
5297 PCADDR npc = pc + 2;
5300 SI opval = current_cpu->h_mach_get ();
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 current_cpu->done_insn (npc, status);
5310 // ********** stsl-mach-compact: sts.l mach, @-$rn
5313 sh5_compact_sem_stsl_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5314 sh5_compact::write_stacks &buf)
5316 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5317 sem_status status = SEM_STATUS_NORMAL;
5318 sh5_compact_scache* abuf = sem;
5319 unsigned long long written = 0;
5320 PCADDR pc = abuf->addr;
5321 PCADDR npc = pc + 2;
5325 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5327 SI opval = current_cpu->h_mach_get ();
5328 if (UNLIKELY(current_cpu->trace_result_p))
5329 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5330 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5333 SI opval = tmp_addr;
5334 if (UNLIKELY(current_cpu->trace_result_p))
5335 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5336 current_cpu->h_grc_set (FLD (f_rn), opval);
5340 current_cpu->done_insn (npc, status);
5344 // ********** sts-macl-compact: sts macl, $rn
5347 sh5_compact_sem_sts_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5348 sh5_compact::write_stacks &buf)
5350 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5351 sem_status status = SEM_STATUS_NORMAL;
5352 sh5_compact_scache* abuf = sem;
5353 unsigned long long written = 0;
5354 PCADDR pc = abuf->addr;
5355 PCADDR npc = pc + 2;
5358 SI opval = current_cpu->h_macl_get ();
5359 if (UNLIKELY(current_cpu->trace_result_p))
5360 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5361 current_cpu->h_grc_set (FLD (f_rn), opval);
5364 current_cpu->done_insn (npc, status);
5368 // ********** stsl-macl-compact: sts.l macl, @-$rn
5371 sh5_compact_sem_stsl_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5372 sh5_compact::write_stacks &buf)
5374 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5375 sem_status status = SEM_STATUS_NORMAL;
5376 sh5_compact_scache* abuf = sem;
5377 unsigned long long written = 0;
5378 PCADDR pc = abuf->addr;
5379 PCADDR npc = pc + 2;
5383 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5385 SI opval = current_cpu->h_macl_get ();
5386 if (UNLIKELY(current_cpu->trace_result_p))
5387 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5388 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5391 SI opval = tmp_addr;
5392 if (UNLIKELY(current_cpu->trace_result_p))
5393 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5394 current_cpu->h_grc_set (FLD (f_rn), opval);
5398 current_cpu->done_insn (npc, status);
5402 // ********** sts-pr-compact: sts pr, $rn
5405 sh5_compact_sem_sts_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5406 sh5_compact::write_stacks &buf)
5408 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5409 sem_status status = SEM_STATUS_NORMAL;
5410 sh5_compact_scache* abuf = sem;
5411 unsigned long long written = 0;
5412 PCADDR pc = abuf->addr;
5413 PCADDR npc = pc + 2;
5416 SI opval = current_cpu->h_pr_get ();
5417 if (UNLIKELY(current_cpu->trace_result_p))
5418 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5419 current_cpu->h_grc_set (FLD (f_rn), opval);
5422 current_cpu->done_insn (npc, status);
5426 // ********** stsl-pr-compact: sts.l pr, @-$rn
5429 sh5_compact_sem_stsl_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5430 sh5_compact::write_stacks &buf)
5432 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5433 sem_status status = SEM_STATUS_NORMAL;
5434 sh5_compact_scache* abuf = sem;
5435 unsigned long long written = 0;
5436 PCADDR pc = abuf->addr;
5437 PCADDR npc = pc + 2;
5441 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5443 SI opval = current_cpu->h_pr_get ();
5444 if (UNLIKELY(current_cpu->trace_result_p))
5445 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
5446 current_cpu->SETMEMSI (pc, tmp_addr, opval);
5449 SI opval = tmp_addr;
5450 if (UNLIKELY(current_cpu->trace_result_p))
5451 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5452 current_cpu->h_grc_set (FLD (f_rn), opval);
5456 current_cpu->done_insn (npc, status);
5460 // ********** sub-compact: sub $rm, $rn
5463 sh5_compact_sem_sub_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5464 sh5_compact::write_stacks &buf)
5466 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5467 sem_status status = SEM_STATUS_NORMAL;
5468 sh5_compact_scache* abuf = sem;
5469 unsigned long long written = 0;
5470 PCADDR pc = abuf->addr;
5471 PCADDR npc = pc + 2;
5474 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5475 if (UNLIKELY(current_cpu->trace_result_p))
5476 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5477 current_cpu->h_grc_set (FLD (f_rn), opval);
5480 current_cpu->done_insn (npc, status);
5484 // ********** subc-compact: subc $rm, $rn
5487 sh5_compact_sem_subc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5488 sh5_compact::write_stacks &buf)
5490 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5491 sem_status status = SEM_STATUS_NORMAL;
5492 sh5_compact_scache* abuf = sem;
5493 unsigned long long written = 0;
5494 PCADDR pc = abuf->addr;
5495 PCADDR npc = pc + 2;
5499 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5501 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5502 if (UNLIKELY(current_cpu->trace_result_p))
5503 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5504 current_cpu->h_grc_set (FLD (f_rn), opval);
5507 BI opval = tmp_flag;
5508 if (UNLIKELY(current_cpu->trace_result_p))
5509 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5510 current_cpu->h_tbit_set (opval);
5514 current_cpu->done_insn (npc, status);
5518 // ********** subv-compact: subv $rm, $rn
5521 sh5_compact_sem_subv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5522 sh5_compact::write_stacks &buf)
5524 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5525 sem_status status = SEM_STATUS_NORMAL;
5526 sh5_compact_scache* abuf = sem;
5527 unsigned long long written = 0;
5528 PCADDR pc = abuf->addr;
5529 PCADDR npc = pc + 2;
5533 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
5535 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5536 if (UNLIKELY(current_cpu->trace_result_p))
5537 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5538 current_cpu->h_grc_set (FLD (f_rn), opval);
5541 BI opval = ((tmp_t) ? (1) : (0));
5542 if (UNLIKELY(current_cpu->trace_result_p))
5543 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5544 current_cpu->h_tbit_set (opval);
5548 current_cpu->done_insn (npc, status);
5552 // ********** swapb-compact: swap.b $rm, $rn
5555 sh5_compact_sem_swapb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5556 sh5_compact::write_stacks &buf)
5558 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5559 sem_status status = SEM_STATUS_NORMAL;
5560 sh5_compact_scache* abuf = sem;
5561 unsigned long long written = 0;
5562 PCADDR pc = abuf->addr;
5563 PCADDR npc = pc + 2;
5569 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
5570 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
5571 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
5573 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
5574 if (UNLIKELY(current_cpu->trace_result_p))
5575 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5576 current_cpu->h_grc_set (FLD (f_rn), opval);
5580 current_cpu->done_insn (npc, status);
5584 // ********** swapw-compact: swap.w $rm, $rn
5587 sh5_compact_sem_swapw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5588 sh5_compact::write_stacks &buf)
5590 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5591 sem_status status = SEM_STATUS_NORMAL;
5592 sh5_compact_scache* abuf = sem;
5593 unsigned long long written = 0;
5594 PCADDR pc = abuf->addr;
5595 PCADDR npc = pc + 2;
5598 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
5599 if (UNLIKELY(current_cpu->trace_result_p))
5600 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5601 current_cpu->h_grc_set (FLD (f_rn), opval);
5604 current_cpu->done_insn (npc, status);
5608 // ********** tasb-compact: tas.b @$rn
5611 sh5_compact_sem_tasb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5612 sh5_compact::write_stacks &buf)
5614 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5615 sem_status status = SEM_STATUS_NORMAL;
5616 sh5_compact_scache* abuf = sem;
5617 unsigned long long written = 0;
5618 PCADDR pc = abuf->addr;
5619 PCADDR npc = pc + 2;
5623 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
5625 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
5626 if (UNLIKELY(current_cpu->trace_result_p))
5627 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5628 current_cpu->h_tbit_set (opval);
5630 tmp_byte = ORQI (tmp_byte, 128);
5632 UQI opval = tmp_byte;
5633 if (UNLIKELY(current_cpu->trace_result_p))
5634 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5635 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
5639 current_cpu->done_insn (npc, status);
5643 // ********** trapa-compact: trapa #$uimm8
5646 sh5_compact_sem_trapa_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5647 sh5_compact::write_stacks &buf)
5649 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5650 sem_status status = SEM_STATUS_NORMAL;
5651 sh5_compact_scache* abuf = sem;
5652 unsigned long long written = 0;
5653 PCADDR pc = abuf->addr;
5654 PCADDR npc = pc + 2;
5656 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
5658 current_cpu->done_insn (npc, status);
5662 // ********** tst-compact: tst $rm, $rn
5665 sh5_compact_sem_tst_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5666 sh5_compact::write_stacks &buf)
5668 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
5669 sem_status status = SEM_STATUS_NORMAL;
5670 sh5_compact_scache* abuf = sem;
5671 unsigned long long written = 0;
5672 PCADDR pc = abuf->addr;
5673 PCADDR npc = pc + 2;
5676 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
5677 if (UNLIKELY(current_cpu->trace_result_p))
5678 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5679 current_cpu->h_tbit_set (opval);
5682 current_cpu->done_insn (npc, status);
5686 // ********** tsti-compact: tst #$uimm8, r0
5689 sh5_compact_sem_tsti_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5690 sh5_compact::write_stacks &buf)
5692 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5693 sem_status status = SEM_STATUS_NORMAL;
5694 sh5_compact_scache* abuf = sem;
5695 unsigned long long written = 0;
5696 PCADDR pc = abuf->addr;
5697 PCADDR npc = pc + 2;
5700 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5701 if (UNLIKELY(current_cpu->trace_result_p))
5702 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5703 current_cpu->h_tbit_set (opval);
5706 current_cpu->done_insn (npc, status);
5710 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
5713 sh5_compact_sem_tstb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5714 sh5_compact::write_stacks &buf)
5716 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5717 sem_status status = SEM_STATUS_NORMAL;
5718 sh5_compact_scache* abuf = sem;
5719 unsigned long long written = 0;
5720 PCADDR pc = abuf->addr;
5721 PCADDR npc = pc + 2;
5725 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5727 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5728 if (UNLIKELY(current_cpu->trace_result_p))
5729 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5730 current_cpu->h_tbit_set (opval);
5734 current_cpu->done_insn (npc, status);
5738 // ********** xor-compact: xor $rm64, $rn64
5741 sh5_compact_sem_xor_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5742 sh5_compact::write_stacks &buf)
5744 #define FLD(f) abuf->fields.sfmt_and_compact.f
5745 sem_status status = SEM_STATUS_NORMAL;
5746 sh5_compact_scache* abuf = sem;
5747 unsigned long long written = 0;
5748 PCADDR pc = abuf->addr;
5749 PCADDR npc = pc + 2;
5752 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
5753 if (UNLIKELY(current_cpu->trace_result_p))
5754 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5755 current_cpu->h_gr_set (FLD (f_rn), opval);
5758 current_cpu->done_insn (npc, status);
5762 // ********** xori-compact: xor #$uimm8, r0
5765 sh5_compact_sem_xori_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5766 sh5_compact::write_stacks &buf)
5768 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5769 sem_status status = SEM_STATUS_NORMAL;
5770 sh5_compact_scache* abuf = sem;
5771 unsigned long long written = 0;
5772 PCADDR pc = abuf->addr;
5773 PCADDR npc = pc + 2;
5776 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5777 if (UNLIKELY(current_cpu->trace_result_p))
5778 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
5779 current_cpu->h_grc_set (((UINT) 0), opval);
5782 current_cpu->done_insn (npc, status);
5786 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
5789 sh5_compact_sem_xorb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5790 sh5_compact::write_stacks &buf)
5792 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5793 sem_status status = SEM_STATUS_NORMAL;
5794 sh5_compact_scache* abuf = sem;
5795 unsigned long long written = 0;
5796 PCADDR pc = abuf->addr;
5797 PCADDR npc = pc + 2;
5802 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5803 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
5805 UQI opval = tmp_data;
5806 if (UNLIKELY(current_cpu->trace_result_p))
5807 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5808 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5812 current_cpu->done_insn (npc, status);
5816 // ********** xtrct-compact: xtrct $rm, $rn
5819 sh5_compact_sem_xtrct_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick,
5820 sh5_compact::write_stacks &buf)
5822 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5823 sem_status status = SEM_STATUS_NORMAL;
5824 sh5_compact_scache* abuf = sem;
5825 unsigned long long written = 0;
5826 PCADDR pc = abuf->addr;
5827 PCADDR npc = pc + 2;
5830 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
5831 if (UNLIKELY(current_cpu->trace_result_p))
5832 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5833 current_cpu->h_grc_set (FLD (f_rn), opval);
5836 current_cpu->done_insn (npc, status);