1 /* Simulator instruction semantics for sh2e.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 2000-2009 Red Hat, Inc.
7 This file is part of the Red Hat simulators.
18 using namespace sh2e; // FIXME: namespace organization still wip
19 using namespace sh2e; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh2e_sem_x_invalid (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
27 sh2e::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh2e_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 sh2e_sem_add_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
50 sh2e::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh2e_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 sh2e_sem_addi_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
74 sh2e::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh2e_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 sh2e_sem_addc_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
98 sh2e::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh2e_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 sh2e_sem_addv_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
132 sh2e::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh2e_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 sh2e_sem_and_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
166 sh2e::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh2e_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 sh2e_sem_andi_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
190 sh2e::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh2e_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 sh2e_sem_andb_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
214 sh2e::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh2e_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 sh2e_sem_bf_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
244 sh2e::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh2e_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 sh2e_sem_bfs_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
272 sh2e::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh2e_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) % sh2e::pipe_sz].push (sh2e::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 sh2e_sem_bra_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
309 sh2e::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh2e_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) % sh2e::pipe_sz].push (sh2e::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 sh2e_sem_braf_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
342 sh2e::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh2e_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) % sh2e::pipe_sz].push (sh2e::write<UDI>(pc, opval));
362 if (UNLIKELY(current_cpu->trace_result_p))
363 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
367 current_cpu->done_cti_insn (npc, status);
371 // ********** bsr-compact: bsr $disp12
374 sh2e_sem_bsr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
375 sh2e::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh2e_scache* abuf = sem;
380 unsigned long long written = 0;
381 PCADDR pc = abuf->addr;
386 SI opval = ADDDI (pc, 4);
387 buf.h_pr_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<SI>(pc, opval));
388 if (UNLIKELY(current_cpu->trace_result_p))
389 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
392 UDI opval = ADDDI (pc, 2);
393 if (UNLIKELY(current_cpu->trace_result_p))
394 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
395 current_cpu->branch (opval, npc, status);
397 current_cpu->save_delayed_pc (FLD (i_disp12));
399 UDI opval = FLD (i_disp12);
400 buf.h_pc_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<UDI>(pc, opval));
401 if (UNLIKELY(current_cpu->trace_result_p))
402 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
406 current_cpu->done_cti_insn (npc, status);
410 // ********** bsrf-compact: bsrf $rn
413 sh2e_sem_bsrf_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
414 sh2e::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh2e_scache* abuf = sem;
419 unsigned long long written = 0;
420 PCADDR pc = abuf->addr;
425 SI opval = ADDDI (pc, 4);
426 buf.h_pr_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<SI>(pc, opval));
427 if (UNLIKELY(current_cpu->trace_result_p))
428 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
431 UDI opval = ADDDI (pc, 2);
432 if (UNLIKELY(current_cpu->trace_result_p))
433 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
434 current_cpu->branch (opval, npc, status);
436 current_cpu->save_delayed_pc (ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4)));
438 UDI opval = ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4));
439 buf.h_pc_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<UDI>(pc, opval));
440 if (UNLIKELY(current_cpu->trace_result_p))
441 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
445 current_cpu->done_cti_insn (npc, status);
449 // ********** bt-compact: bt $disp8
452 sh2e_sem_bt_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
453 sh2e::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh2e_scache* abuf = sem;
458 unsigned long long written = 0;
459 PCADDR pc = abuf->addr;
462 if (current_cpu->h_tbit_get ()) {
464 UDI opval = FLD (i_disp8);
465 written |= (1ULL << 2);
466 if (UNLIKELY(current_cpu->trace_result_p))
467 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
468 current_cpu->branch (opval, npc, status);
472 abuf->written = written;
473 current_cpu->done_cti_insn (npc, status);
477 // ********** bts-compact: bt/s $disp8
480 sh2e_sem_bts_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
481 sh2e::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh2e_scache* abuf = sem;
486 unsigned long long written = 0;
487 PCADDR pc = abuf->addr;
490 if (current_cpu->h_tbit_get ()) {
493 UDI opval = ADDDI (pc, 2);
494 written |= (1ULL << 3);
495 if (UNLIKELY(current_cpu->trace_result_p))
496 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
497 current_cpu->branch (opval, npc, status);
499 current_cpu->save_delayed_pc (FLD (i_disp8));
501 UDI opval = FLD (i_disp8);
502 buf.h_pc_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<UDI>(pc, opval));
503 if (UNLIKELY(current_cpu->trace_result_p))
504 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
509 abuf->written = written;
510 current_cpu->done_cti_insn (npc, status);
514 // ********** clrmac-compact: clrmac
517 sh2e_sem_clrmac_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
518 sh2e::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh2e_scache* abuf = sem;
523 unsigned long long written = 0;
524 PCADDR pc = abuf->addr;
530 if (UNLIKELY(current_cpu->trace_result_p))
531 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
532 current_cpu->h_macl_set (opval);
536 if (UNLIKELY(current_cpu->trace_result_p))
537 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
538 current_cpu->h_mach_set (opval);
542 current_cpu->done_insn (npc, status);
546 // ********** clrt-compact: clrt
549 sh2e_sem_clrt_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
550 sh2e::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh2e_scache* abuf = sem;
555 unsigned long long written = 0;
556 PCADDR pc = abuf->addr;
561 if (UNLIKELY(current_cpu->trace_result_p))
562 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
563 current_cpu->h_tbit_set (opval);
566 current_cpu->done_insn (npc, status);
570 // ********** cmpeq-compact: cmp/eq $rm, $rn
573 sh2e_sem_cmpeq_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
574 sh2e::write_stacks &buf)
576 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh2e_scache* abuf = sem;
579 unsigned long long written = 0;
580 PCADDR pc = abuf->addr;
584 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
585 if (UNLIKELY(current_cpu->trace_result_p))
586 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
587 current_cpu->h_tbit_set (opval);
590 current_cpu->done_insn (npc, status);
594 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
597 sh2e_sem_cmpeqi_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
598 sh2e::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_andi_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh2e_scache* abuf = sem;
603 unsigned long long written = 0;
604 PCADDR pc = abuf->addr;
608 BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
609 if (UNLIKELY(current_cpu->trace_result_p))
610 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
611 current_cpu->h_tbit_set (opval);
614 current_cpu->done_insn (npc, status);
618 // ********** cmpge-compact: cmp/ge $rm, $rn
621 sh2e_sem_cmpge_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
622 sh2e::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh2e_scache* abuf = sem;
627 unsigned long long written = 0;
628 PCADDR pc = abuf->addr;
632 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
633 if (UNLIKELY(current_cpu->trace_result_p))
634 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
635 current_cpu->h_tbit_set (opval);
638 current_cpu->done_insn (npc, status);
642 // ********** cmpgt-compact: cmp/gt $rm, $rn
645 sh2e_sem_cmpgt_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
646 sh2e::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh2e_scache* abuf = sem;
651 unsigned long long written = 0;
652 PCADDR pc = abuf->addr;
656 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
657 if (UNLIKELY(current_cpu->trace_result_p))
658 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
659 current_cpu->h_tbit_set (opval);
662 current_cpu->done_insn (npc, status);
666 // ********** cmphi-compact: cmp/hi $rm, $rn
669 sh2e_sem_cmphi_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
670 sh2e::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh2e_scache* abuf = sem;
675 unsigned long long written = 0;
676 PCADDR pc = abuf->addr;
680 BI opval = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
681 if (UNLIKELY(current_cpu->trace_result_p))
682 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
683 current_cpu->h_tbit_set (opval);
686 current_cpu->done_insn (npc, status);
690 // ********** cmphs-compact: cmp/hs $rm, $rn
693 sh2e_sem_cmphs_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
694 sh2e::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh2e_scache* abuf = sem;
699 unsigned long long written = 0;
700 PCADDR pc = abuf->addr;
704 BI opval = GEUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
705 if (UNLIKELY(current_cpu->trace_result_p))
706 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
707 current_cpu->h_tbit_set (opval);
710 current_cpu->done_insn (npc, status);
714 // ********** cmppl-compact: cmp/pl $rn
717 sh2e_sem_cmppl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
718 sh2e::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh2e_scache* abuf = sem;
723 unsigned long long written = 0;
724 PCADDR pc = abuf->addr;
728 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
729 if (UNLIKELY(current_cpu->trace_result_p))
730 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
731 current_cpu->h_tbit_set (opval);
734 current_cpu->done_insn (npc, status);
738 // ********** cmppz-compact: cmp/pz $rn
741 sh2e_sem_cmppz_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
742 sh2e::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh2e_scache* abuf = sem;
747 unsigned long long written = 0;
748 PCADDR pc = abuf->addr;
752 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), 0);
753 if (UNLIKELY(current_cpu->trace_result_p))
754 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
755 current_cpu->h_tbit_set (opval);
758 current_cpu->done_insn (npc, status);
762 // ********** cmpstr-compact: cmp/str $rm, $rn
765 sh2e_sem_cmpstr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
766 sh2e::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh2e_scache* abuf = sem;
771 unsigned long long written = 0;
772 PCADDR pc = abuf->addr;
778 tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
779 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
780 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
781 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
782 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
784 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
785 if (UNLIKELY(current_cpu->trace_result_p))
786 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
787 current_cpu->h_tbit_set (opval);
791 current_cpu->done_insn (npc, status);
795 // ********** div0s-compact: div0s $rm, $rn
798 sh2e_sem_div0s_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
799 sh2e::write_stacks &buf)
801 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
802 sem_status status = SEM_STATUS_NORMAL;
803 sh2e_scache* abuf = sem;
804 unsigned long long written = 0;
805 PCADDR pc = abuf->addr;
810 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
811 if (UNLIKELY(current_cpu->trace_result_p))
812 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
813 current_cpu->h_qbit_set (opval);
816 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
817 if (UNLIKELY(current_cpu->trace_result_p))
818 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
819 current_cpu->h_mbit_set (opval);
822 BI opval = ((EQSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31))) ? (0) : (1));
823 if (UNLIKELY(current_cpu->trace_result_p))
824 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
825 current_cpu->h_tbit_set (opval);
829 current_cpu->done_insn (npc, status);
833 // ********** div0u-compact: div0u
836 sh2e_sem_div0u_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
837 sh2e::write_stacks &buf)
839 #define FLD(f) abuf->fields.fmt_empty.f
840 sem_status status = SEM_STATUS_NORMAL;
841 sh2e_scache* abuf = sem;
842 unsigned long long written = 0;
843 PCADDR pc = abuf->addr;
849 if (UNLIKELY(current_cpu->trace_result_p))
850 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
851 current_cpu->h_tbit_set (opval);
855 if (UNLIKELY(current_cpu->trace_result_p))
856 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
857 current_cpu->h_qbit_set (opval);
861 if (UNLIKELY(current_cpu->trace_result_p))
862 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
863 current_cpu->h_mbit_set (opval);
867 current_cpu->done_insn (npc, status);
871 // ********** div1-compact: div1 $rm, $rn
874 sh2e_sem_div1_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
875 sh2e::write_stacks &buf)
877 #define FLD(f) abuf->fields.sfmt_macl_compact.f
878 sem_status status = SEM_STATUS_NORMAL;
879 sh2e_scache* abuf = sem;
880 unsigned long long written = 0;
881 PCADDR pc = abuf->addr;
888 tmp_oldq = current_cpu->h_qbit_get ();
890 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
891 if (UNLIKELY(current_cpu->trace_result_p))
892 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
893 current_cpu->h_qbit_set (opval);
896 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
897 if (UNLIKELY(current_cpu->trace_result_p))
898 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
899 current_cpu->h_grc_set (FLD (f_rn), opval);
901 if (NOTBI (tmp_oldq)) {
902 if (NOTBI (current_cpu->h_mbit_get ())) {
904 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
906 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
907 if (UNLIKELY(current_cpu->trace_result_p))
908 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
909 current_cpu->h_grc_set (FLD (f_rn), opval);
911 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
912 if (NOTBI (current_cpu->h_qbit_get ())) {
914 BI opval = ((tmp_tmp1) ? (1) : (0));
915 if (UNLIKELY(current_cpu->trace_result_p))
916 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
917 current_cpu->h_qbit_set (opval);
921 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
922 if (UNLIKELY(current_cpu->trace_result_p))
923 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
924 current_cpu->h_qbit_set (opval);
930 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
932 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
933 if (UNLIKELY(current_cpu->trace_result_p))
934 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
935 current_cpu->h_grc_set (FLD (f_rn), opval);
937 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
938 if (NOTBI (current_cpu->h_qbit_get ())) {
940 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
941 if (UNLIKELY(current_cpu->trace_result_p))
942 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
943 current_cpu->h_qbit_set (opval);
947 BI opval = ((tmp_tmp1) ? (1) : (0));
948 if (UNLIKELY(current_cpu->trace_result_p))
949 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
950 current_cpu->h_qbit_set (opval);
956 if (NOTBI (current_cpu->h_mbit_get ())) {
958 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
960 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
961 if (UNLIKELY(current_cpu->trace_result_p))
962 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
963 current_cpu->h_grc_set (FLD (f_rn), opval);
965 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
966 if (NOTBI (current_cpu->h_qbit_get ())) {
968 BI opval = ((tmp_tmp1) ? (1) : (0));
969 if (UNLIKELY(current_cpu->trace_result_p))
970 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
971 current_cpu->h_qbit_set (opval);
975 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
976 if (UNLIKELY(current_cpu->trace_result_p))
977 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
978 current_cpu->h_qbit_set (opval);
984 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
986 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
987 if (UNLIKELY(current_cpu->trace_result_p))
988 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
989 current_cpu->h_grc_set (FLD (f_rn), opval);
991 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
992 if (NOTBI (current_cpu->h_qbit_get ())) {
994 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
995 if (UNLIKELY(current_cpu->trace_result_p))
996 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
997 current_cpu->h_qbit_set (opval);
1001 BI opval = ((tmp_tmp1) ? (1) : (0));
1002 if (UNLIKELY(current_cpu->trace_result_p))
1003 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1004 current_cpu->h_qbit_set (opval);
1011 BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1012 if (UNLIKELY(current_cpu->trace_result_p))
1013 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1014 current_cpu->h_tbit_set (opval);
1018 current_cpu->done_insn (npc, status);
1022 // ********** dmulsl-compact: dmuls.l $rm, $rn
1025 sh2e_sem_dmulsl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1026 sh2e::write_stacks &buf)
1028 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1029 sem_status status = SEM_STATUS_NORMAL;
1030 sh2e_scache* abuf = sem;
1031 unsigned long long written = 0;
1032 PCADDR pc = abuf->addr;
1033 PCADDR npc = pc + 2;
1037 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1039 SI opval = SUBWORDDISI (tmp_result, 0);
1040 if (UNLIKELY(current_cpu->trace_result_p))
1041 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1042 current_cpu->h_mach_set (opval);
1045 SI opval = SUBWORDDISI (tmp_result, 1);
1046 if (UNLIKELY(current_cpu->trace_result_p))
1047 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1048 current_cpu->h_macl_set (opval);
1052 current_cpu->done_insn (npc, status);
1056 // ********** dmulul-compact: dmulu.l $rm, $rn
1059 sh2e_sem_dmulul_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1060 sh2e::write_stacks &buf)
1062 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1063 sem_status status = SEM_STATUS_NORMAL;
1064 sh2e_scache* abuf = sem;
1065 unsigned long long written = 0;
1066 PCADDR pc = abuf->addr;
1067 PCADDR npc = pc + 2;
1071 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1073 SI opval = SUBWORDDISI (tmp_result, 0);
1074 if (UNLIKELY(current_cpu->trace_result_p))
1075 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1076 current_cpu->h_mach_set (opval);
1079 SI opval = SUBWORDDISI (tmp_result, 1);
1080 if (UNLIKELY(current_cpu->trace_result_p))
1081 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1082 current_cpu->h_macl_set (opval);
1086 current_cpu->done_insn (npc, status);
1090 // ********** dt-compact: dt $rn
1093 sh2e_sem_dt_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1094 sh2e::write_stacks &buf)
1096 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
1097 sem_status status = SEM_STATUS_NORMAL;
1098 sh2e_scache* abuf = sem;
1099 unsigned long long written = 0;
1100 PCADDR pc = abuf->addr;
1101 PCADDR npc = pc + 2;
1105 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1106 if (UNLIKELY(current_cpu->trace_result_p))
1107 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1108 current_cpu->h_grc_set (FLD (f_rn), opval);
1111 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1112 if (UNLIKELY(current_cpu->trace_result_p))
1113 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1114 current_cpu->h_tbit_set (opval);
1118 current_cpu->done_insn (npc, status);
1122 // ********** extsb-compact: exts.b $rm, $rn
1125 sh2e_sem_extsb_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1126 sh2e::write_stacks &buf)
1128 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1129 sem_status status = SEM_STATUS_NORMAL;
1130 sh2e_scache* abuf = sem;
1131 unsigned long long written = 0;
1132 PCADDR pc = abuf->addr;
1133 PCADDR npc = pc + 2;
1136 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1137 if (UNLIKELY(current_cpu->trace_result_p))
1138 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1139 current_cpu->h_grc_set (FLD (f_rn), opval);
1142 current_cpu->done_insn (npc, status);
1146 // ********** extsw-compact: exts.w $rm, $rn
1149 sh2e_sem_extsw_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1150 sh2e::write_stacks &buf)
1152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1153 sem_status status = SEM_STATUS_NORMAL;
1154 sh2e_scache* abuf = sem;
1155 unsigned long long written = 0;
1156 PCADDR pc = abuf->addr;
1157 PCADDR npc = pc + 2;
1160 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1161 if (UNLIKELY(current_cpu->trace_result_p))
1162 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1163 current_cpu->h_grc_set (FLD (f_rn), opval);
1166 current_cpu->done_insn (npc, status);
1170 // ********** extub-compact: extu.b $rm, $rn
1173 sh2e_sem_extub_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1174 sh2e::write_stacks &buf)
1176 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1177 sem_status status = SEM_STATUS_NORMAL;
1178 sh2e_scache* abuf = sem;
1179 unsigned long long written = 0;
1180 PCADDR pc = abuf->addr;
1181 PCADDR npc = pc + 2;
1184 SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1185 if (UNLIKELY(current_cpu->trace_result_p))
1186 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1187 current_cpu->h_grc_set (FLD (f_rn), opval);
1190 current_cpu->done_insn (npc, status);
1194 // ********** extuw-compact: extu.w $rm, $rn
1197 sh2e_sem_extuw_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1198 sh2e::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh2e_scache* abuf = sem;
1203 unsigned long long written = 0;
1204 PCADDR pc = abuf->addr;
1205 PCADDR npc = pc + 2;
1208 SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1209 if (UNLIKELY(current_cpu->trace_result_p))
1210 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1211 current_cpu->h_grc_set (FLD (f_rn), opval);
1214 current_cpu->done_insn (npc, status);
1218 // ********** fabs-compact: fabs $fsdn
1221 sh2e_sem_fabs_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1222 sh2e::write_stacks &buf)
1224 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh2e_scache* abuf = sem;
1227 unsigned long long written = 0;
1228 PCADDR pc = abuf->addr;
1229 PCADDR npc = pc + 2;
1231 if (current_cpu->h_prbit_get ()) {
1233 DF opval = current_cpu->sh64_fabsd (current_cpu->h_fsd_get (FLD (f_rn)));
1234 written |= (1ULL << 2);
1235 if (UNLIKELY(current_cpu->trace_result_p))
1236 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1237 current_cpu->h_fsd_set (FLD (f_rn), opval);
1241 DF opval = current_cpu->sh64_fabss (current_cpu->h_fsd_get (FLD (f_rn)));
1242 written |= (1ULL << 2);
1243 if (UNLIKELY(current_cpu->trace_result_p))
1244 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1245 current_cpu->h_fsd_set (FLD (f_rn), opval);
1249 abuf->written = written;
1250 current_cpu->done_insn (npc, status);
1254 // ********** fadd-compact: fadd $fsdm, $fsdn
1257 sh2e_sem_fadd_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1258 sh2e::write_stacks &buf)
1260 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1261 sem_status status = SEM_STATUS_NORMAL;
1262 sh2e_scache* abuf = sem;
1263 unsigned long long written = 0;
1264 PCADDR pc = abuf->addr;
1265 PCADDR npc = pc + 2;
1267 if (current_cpu->h_prbit_get ()) {
1269 DF opval = current_cpu->sh64_faddd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1270 written |= (1ULL << 3);
1271 if (UNLIKELY(current_cpu->trace_result_p))
1272 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1273 current_cpu->h_fsd_set (FLD (f_rn), opval);
1277 DF opval = current_cpu->sh64_fadds (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1278 written |= (1ULL << 3);
1279 if (UNLIKELY(current_cpu->trace_result_p))
1280 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1281 current_cpu->h_fsd_set (FLD (f_rn), opval);
1285 abuf->written = written;
1286 current_cpu->done_insn (npc, status);
1290 // ********** fcmpeq-compact: fcmp/eq $fsdm, $fsdn
1293 sh2e_sem_fcmpeq_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1294 sh2e::write_stacks &buf)
1296 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1297 sem_status status = SEM_STATUS_NORMAL;
1298 sh2e_scache* abuf = sem;
1299 unsigned long long written = 0;
1300 PCADDR pc = abuf->addr;
1301 PCADDR npc = pc + 2;
1303 if (current_cpu->h_prbit_get ()) {
1305 BI opval = current_cpu->sh64_fcmpeqd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1306 written |= (1ULL << 3);
1307 if (UNLIKELY(current_cpu->trace_result_p))
1308 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1309 current_cpu->h_tbit_set (opval);
1313 BI opval = current_cpu->sh64_fcmpeqs (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1314 written |= (1ULL << 3);
1315 if (UNLIKELY(current_cpu->trace_result_p))
1316 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1317 current_cpu->h_tbit_set (opval);
1321 abuf->written = written;
1322 current_cpu->done_insn (npc, status);
1326 // ********** fcmpgt-compact: fcmp/gt $fsdm, $fsdn
1329 sh2e_sem_fcmpgt_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1330 sh2e::write_stacks &buf)
1332 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1333 sem_status status = SEM_STATUS_NORMAL;
1334 sh2e_scache* abuf = sem;
1335 unsigned long long written = 0;
1336 PCADDR pc = abuf->addr;
1337 PCADDR npc = pc + 2;
1339 if (current_cpu->h_prbit_get ()) {
1341 BI opval = current_cpu->sh64_fcmpgtd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1342 written |= (1ULL << 3);
1343 if (UNLIKELY(current_cpu->trace_result_p))
1344 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1345 current_cpu->h_tbit_set (opval);
1349 BI opval = current_cpu->sh64_fcmpgts (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1350 written |= (1ULL << 3);
1351 if (UNLIKELY(current_cpu->trace_result_p))
1352 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1353 current_cpu->h_tbit_set (opval);
1357 abuf->written = written;
1358 current_cpu->done_insn (npc, status);
1362 // ********** fdiv-compact: fdiv $fsdm, $fsdn
1365 sh2e_sem_fdiv_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1366 sh2e::write_stacks &buf)
1368 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1369 sem_status status = SEM_STATUS_NORMAL;
1370 sh2e_scache* abuf = sem;
1371 unsigned long long written = 0;
1372 PCADDR pc = abuf->addr;
1373 PCADDR npc = pc + 2;
1375 if (current_cpu->h_prbit_get ()) {
1377 DF opval = current_cpu->sh64_fdivd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1378 written |= (1ULL << 3);
1379 if (UNLIKELY(current_cpu->trace_result_p))
1380 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1381 current_cpu->h_fsd_set (FLD (f_rn), opval);
1385 DF opval = current_cpu->sh64_fdivs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1386 written |= (1ULL << 3);
1387 if (UNLIKELY(current_cpu->trace_result_p))
1388 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1389 current_cpu->h_fsd_set (FLD (f_rn), opval);
1393 abuf->written = written;
1394 current_cpu->done_insn (npc, status);
1398 // ********** flds-compact: flds $frn, fpul
1401 sh2e_sem_flds_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1402 sh2e::write_stacks &buf)
1404 #define FLD(f) abuf->fields.sfmt_flds_compact.f
1405 sem_status status = SEM_STATUS_NORMAL;
1406 sh2e_scache* abuf = sem;
1407 unsigned long long written = 0;
1408 PCADDR pc = abuf->addr;
1409 PCADDR npc = pc + 2;
1412 SF opval = current_cpu->h_frc_get (FLD (f_rn));
1413 if (UNLIKELY(current_cpu->trace_result_p))
1414 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
1415 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1418 current_cpu->done_insn (npc, status);
1422 // ********** fldi0-compact: fldi0 $frn
1425 sh2e_sem_fldi0_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1426 sh2e::write_stacks &buf)
1428 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1429 sem_status status = SEM_STATUS_NORMAL;
1430 sh2e_scache* abuf = sem;
1431 unsigned long long written = 0;
1432 PCADDR pc = abuf->addr;
1433 PCADDR npc = pc + 2;
1436 SF opval = current_cpu->sh64_fldi0 ();
1437 if (UNLIKELY(current_cpu->trace_result_p))
1438 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1439 current_cpu->h_frc_set (FLD (f_rn), opval);
1442 current_cpu->done_insn (npc, status);
1446 // ********** fldi1-compact: fldi1 $frn
1449 sh2e_sem_fldi1_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1450 sh2e::write_stacks &buf)
1452 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1453 sem_status status = SEM_STATUS_NORMAL;
1454 sh2e_scache* abuf = sem;
1455 unsigned long long written = 0;
1456 PCADDR pc = abuf->addr;
1457 PCADDR npc = pc + 2;
1460 SF opval = current_cpu->sh64_fldi1 ();
1461 if (UNLIKELY(current_cpu->trace_result_p))
1462 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1463 current_cpu->h_frc_set (FLD (f_rn), opval);
1466 current_cpu->done_insn (npc, status);
1470 // ********** float-compact: float fpul, $fsdn
1473 sh2e_sem_float_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1474 sh2e::write_stacks &buf)
1476 #define FLD(f) abuf->fields.sfmt_float_compact.f
1477 sem_status status = SEM_STATUS_NORMAL;
1478 sh2e_scache* abuf = sem;
1479 unsigned long long written = 0;
1480 PCADDR pc = abuf->addr;
1481 PCADDR npc = pc + 2;
1483 if (current_cpu->h_prbit_get ()) {
1485 DF opval = current_cpu->sh64_floatld (current_cpu->hardware.h_fr[((UINT) 32)]);
1486 written |= (1ULL << 2);
1487 if (UNLIKELY(current_cpu->trace_result_p))
1488 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1489 current_cpu->h_fsd_set (FLD (f_rn), opval);
1493 DF opval = current_cpu->sh64_floatls (current_cpu->hardware.h_fr[((UINT) 32)]);
1494 written |= (1ULL << 2);
1495 if (UNLIKELY(current_cpu->trace_result_p))
1496 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1497 current_cpu->h_fsd_set (FLD (f_rn), opval);
1501 abuf->written = written;
1502 current_cpu->done_insn (npc, status);
1506 // ********** fmac-compact: fmac fr0, $frm, $frn
1509 sh2e_sem_fmac_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1510 sh2e::write_stacks &buf)
1512 #define FLD(f) abuf->fields.sfmt_fmac_compact.f
1513 sem_status status = SEM_STATUS_NORMAL;
1514 sh2e_scache* abuf = sem;
1515 unsigned long long written = 0;
1516 PCADDR pc = abuf->addr;
1517 PCADDR npc = pc + 2;
1520 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)));
1521 if (UNLIKELY(current_cpu->trace_result_p))
1522 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1523 current_cpu->h_frc_set (FLD (f_rn), opval);
1526 current_cpu->done_insn (npc, status);
1530 // ********** fmov1-compact: fmov $fmovm, $fmovn
1533 sh2e_sem_fmov1_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1534 sh2e::write_stacks &buf)
1536 #define FLD(f) abuf->fields.sfmt_fmov1_compact.f
1537 sem_status status = SEM_STATUS_NORMAL;
1538 sh2e_scache* abuf = sem;
1539 unsigned long long written = 0;
1540 PCADDR pc = abuf->addr;
1541 PCADDR npc = pc + 2;
1544 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1545 if (UNLIKELY(current_cpu->trace_result_p))
1546 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1547 current_cpu->h_fmov_set (FLD (f_rn), opval);
1550 current_cpu->done_insn (npc, status);
1554 // ********** fmov2-compact: fmov @$rm, $fmovn
1557 sh2e_sem_fmov2_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1558 sh2e::write_stacks &buf)
1560 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1561 sem_status status = SEM_STATUS_NORMAL;
1562 sh2e_scache* abuf = sem;
1563 unsigned long long written = 0;
1564 PCADDR pc = abuf->addr;
1565 PCADDR npc = pc + 2;
1567 if (NOTBI (current_cpu->h_szbit_get ())) {
1569 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1570 written |= (1ULL << 4);
1571 if (UNLIKELY(current_cpu->trace_result_p))
1572 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1573 current_cpu->h_fmov_set (FLD (f_rn), opval);
1577 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1578 written |= (1ULL << 4);
1579 if (UNLIKELY(current_cpu->trace_result_p))
1580 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1581 current_cpu->h_fmov_set (FLD (f_rn), opval);
1585 abuf->written = written;
1586 current_cpu->done_insn (npc, status);
1590 // ********** fmov3-compact: fmov @${rm}+, fmovn
1593 sh2e_sem_fmov3_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1594 sh2e::write_stacks &buf)
1596 #define FLD(f) abuf->fields.sfmt_fmov3_compact.f
1597 sem_status status = SEM_STATUS_NORMAL;
1598 sh2e_scache* abuf = sem;
1599 unsigned long long written = 0;
1600 PCADDR pc = abuf->addr;
1601 PCADDR npc = pc + 2;
1603 if (NOTBI (current_cpu->h_szbit_get ())) {
1606 DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1607 written |= (1ULL << 4);
1608 if (UNLIKELY(current_cpu->trace_result_p))
1609 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1610 current_cpu->h_fmov_set (FLD (f_rn), opval);
1613 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1614 written |= (1ULL << 5);
1615 if (UNLIKELY(current_cpu->trace_result_p))
1616 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1617 current_cpu->h_grc_set (FLD (f_rm), opval);
1623 DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1624 written |= (1ULL << 4);
1625 if (UNLIKELY(current_cpu->trace_result_p))
1626 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1627 current_cpu->h_fmov_set (FLD (f_rn), opval);
1630 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 8);
1631 written |= (1ULL << 5);
1632 if (UNLIKELY(current_cpu->trace_result_p))
1633 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1634 current_cpu->h_grc_set (FLD (f_rm), opval);
1639 abuf->written = written;
1640 current_cpu->done_insn (npc, status);
1644 // ********** fmov4-compact: fmov @(r0, $rm), $fmovn
1647 sh2e_sem_fmov4_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1648 sh2e::write_stacks &buf)
1650 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1651 sem_status status = SEM_STATUS_NORMAL;
1652 sh2e_scache* abuf = sem;
1653 unsigned long long written = 0;
1654 PCADDR pc = abuf->addr;
1655 PCADDR npc = pc + 2;
1657 if (NOTBI (current_cpu->h_szbit_get ())) {
1659 DF opval = current_cpu->GETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1660 written |= (1ULL << 5);
1661 if (UNLIKELY(current_cpu->trace_result_p))
1662 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1663 current_cpu->h_fmov_set (FLD (f_rn), opval);
1667 DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1668 written |= (1ULL << 5);
1669 if (UNLIKELY(current_cpu->trace_result_p))
1670 current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1671 current_cpu->h_fmov_set (FLD (f_rn), opval);
1675 abuf->written = written;
1676 current_cpu->done_insn (npc, status);
1680 // ********** fmov5-compact: fmov $fmovm, @$rn
1683 sh2e_sem_fmov5_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1684 sh2e::write_stacks &buf)
1686 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1687 sem_status status = SEM_STATUS_NORMAL;
1688 sh2e_scache* abuf = sem;
1689 unsigned long long written = 0;
1690 PCADDR pc = abuf->addr;
1691 PCADDR npc = pc + 2;
1693 if (NOTBI (current_cpu->h_szbit_get ())) {
1695 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1696 written |= (1ULL << 4);
1697 if (UNLIKELY(current_cpu->trace_result_p))
1698 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1699 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1703 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1704 written |= (1ULL << 3);
1705 if (UNLIKELY(current_cpu->trace_result_p))
1706 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1707 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1711 abuf->written = written;
1712 current_cpu->done_insn (npc, status);
1716 // ********** fmov6-compact: fmov $fmovm, @-$rn
1719 sh2e_sem_fmov6_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1720 sh2e::write_stacks &buf)
1722 #define FLD(f) abuf->fields.sfmt_fmov6_compact.f
1723 sem_status status = SEM_STATUS_NORMAL;
1724 sh2e_scache* abuf = sem;
1725 unsigned long long written = 0;
1726 PCADDR pc = abuf->addr;
1727 PCADDR npc = pc + 2;
1729 if (NOTBI (current_cpu->h_szbit_get ())) {
1732 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1733 written |= (1ULL << 5);
1734 if (UNLIKELY(current_cpu->trace_result_p))
1735 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1736 current_cpu->h_grc_set (FLD (f_rn), opval);
1739 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1740 written |= (1ULL << 4);
1741 if (UNLIKELY(current_cpu->trace_result_p))
1742 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1743 current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1749 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
1750 written |= (1ULL << 5);
1751 if (UNLIKELY(current_cpu->trace_result_p))
1752 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1753 current_cpu->h_grc_set (FLD (f_rn), opval);
1756 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1757 written |= (1ULL << 3);
1758 if (UNLIKELY(current_cpu->trace_result_p))
1759 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
1760 current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1765 abuf->written = written;
1766 current_cpu->done_insn (npc, status);
1770 // ********** fmov7-compact: fmov $fmovm, @(r0, $rn)
1773 sh2e_sem_fmov7_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1774 sh2e::write_stacks &buf)
1776 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1777 sem_status status = SEM_STATUS_NORMAL;
1778 sh2e_scache* abuf = sem;
1779 unsigned long long written = 0;
1780 PCADDR pc = abuf->addr;
1781 PCADDR npc = pc + 2;
1783 if (NOTBI (current_cpu->h_szbit_get ())) {
1785 SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1786 written |= (1ULL << 5);
1787 if (UNLIKELY(current_cpu->trace_result_p))
1788 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 << " ";
1789 current_cpu->SETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1793 DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1794 written |= (1ULL << 4);
1795 if (UNLIKELY(current_cpu->trace_result_p))
1796 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 << " ";
1797 current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1801 abuf->written = written;
1802 current_cpu->done_insn (npc, status);
1806 // ********** fmul-compact: fmul $fsdm, $fsdn
1809 sh2e_sem_fmul_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1810 sh2e::write_stacks &buf)
1812 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1813 sem_status status = SEM_STATUS_NORMAL;
1814 sh2e_scache* abuf = sem;
1815 unsigned long long written = 0;
1816 PCADDR pc = abuf->addr;
1817 PCADDR npc = pc + 2;
1819 if (current_cpu->h_prbit_get ()) {
1821 DF opval = current_cpu->sh64_fmuld (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1822 written |= (1ULL << 3);
1823 if (UNLIKELY(current_cpu->trace_result_p))
1824 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1825 current_cpu->h_fsd_set (FLD (f_rn), opval);
1829 DF opval = current_cpu->sh64_fmuls (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1830 written |= (1ULL << 3);
1831 if (UNLIKELY(current_cpu->trace_result_p))
1832 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1833 current_cpu->h_fsd_set (FLD (f_rn), opval);
1837 abuf->written = written;
1838 current_cpu->done_insn (npc, status);
1842 // ********** fneg-compact: fneg $fsdn
1845 sh2e_sem_fneg_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1846 sh2e::write_stacks &buf)
1848 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1849 sem_status status = SEM_STATUS_NORMAL;
1850 sh2e_scache* abuf = sem;
1851 unsigned long long written = 0;
1852 PCADDR pc = abuf->addr;
1853 PCADDR npc = pc + 2;
1855 if (current_cpu->h_prbit_get ()) {
1857 DF opval = current_cpu->sh64_fnegd (current_cpu->h_fsd_get (FLD (f_rn)));
1858 written |= (1ULL << 2);
1859 if (UNLIKELY(current_cpu->trace_result_p))
1860 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1861 current_cpu->h_fsd_set (FLD (f_rn), opval);
1865 DF opval = current_cpu->sh64_fnegs (current_cpu->h_fsd_get (FLD (f_rn)));
1866 written |= (1ULL << 2);
1867 if (UNLIKELY(current_cpu->trace_result_p))
1868 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1869 current_cpu->h_fsd_set (FLD (f_rn), opval);
1873 abuf->written = written;
1874 current_cpu->done_insn (npc, status);
1878 // ********** frchg-compact: frchg
1881 sh2e_sem_frchg_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1882 sh2e::write_stacks &buf)
1884 #define FLD(f) abuf->fields.fmt_empty.f
1885 sem_status status = SEM_STATUS_NORMAL;
1886 sh2e_scache* abuf = sem;
1887 unsigned long long written = 0;
1888 PCADDR pc = abuf->addr;
1889 PCADDR npc = pc + 2;
1892 BI opval = NOTBI (current_cpu->h_frbit_get ());
1893 if (UNLIKELY(current_cpu->trace_result_p))
1894 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
1895 current_cpu->h_frbit_set (opval);
1898 current_cpu->done_insn (npc, status);
1902 // ********** fschg-compact: fschg
1905 sh2e_sem_fschg_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1906 sh2e::write_stacks &buf)
1908 #define FLD(f) abuf->fields.fmt_empty.f
1909 sem_status status = SEM_STATUS_NORMAL;
1910 sh2e_scache* abuf = sem;
1911 unsigned long long written = 0;
1912 PCADDR pc = abuf->addr;
1913 PCADDR npc = pc + 2;
1916 BI opval = NOTBI (current_cpu->h_szbit_get ());
1917 if (UNLIKELY(current_cpu->trace_result_p))
1918 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
1919 current_cpu->h_szbit_set (opval);
1922 current_cpu->done_insn (npc, status);
1926 // ********** fsts-compact: fsts fpul, $frn
1929 sh2e_sem_fsts_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1930 sh2e::write_stacks &buf)
1932 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1933 sem_status status = SEM_STATUS_NORMAL;
1934 sh2e_scache* abuf = sem;
1935 unsigned long long written = 0;
1936 PCADDR pc = abuf->addr;
1937 PCADDR npc = pc + 2;
1940 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
1941 if (UNLIKELY(current_cpu->trace_result_p))
1942 current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1943 current_cpu->h_frc_set (FLD (f_rn), opval);
1946 current_cpu->done_insn (npc, status);
1950 // ********** fsub-compact: fsub $fsdm, $fsdn
1953 sh2e_sem_fsub_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1954 sh2e::write_stacks &buf)
1956 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1957 sem_status status = SEM_STATUS_NORMAL;
1958 sh2e_scache* abuf = sem;
1959 unsigned long long written = 0;
1960 PCADDR pc = abuf->addr;
1961 PCADDR npc = pc + 2;
1963 if (current_cpu->h_prbit_get ()) {
1965 DF opval = current_cpu->sh64_fsubd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1966 written |= (1ULL << 3);
1967 if (UNLIKELY(current_cpu->trace_result_p))
1968 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1969 current_cpu->h_fsd_set (FLD (f_rn), opval);
1973 DF opval = current_cpu->sh64_fsubs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1974 written |= (1ULL << 3);
1975 if (UNLIKELY(current_cpu->trace_result_p))
1976 current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1977 current_cpu->h_fsd_set (FLD (f_rn), opval);
1981 abuf->written = written;
1982 current_cpu->done_insn (npc, status);
1986 // ********** ftrc-compact: ftrc $fsdn, fpul
1989 sh2e_sem_ftrc_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
1990 sh2e::write_stacks &buf)
1992 #define FLD(f) abuf->fields.sfmt_ftrc_compact.f
1993 sem_status status = SEM_STATUS_NORMAL;
1994 sh2e_scache* abuf = sem;
1995 unsigned long long written = 0;
1996 PCADDR pc = abuf->addr;
1997 PCADDR npc = pc + 2;
2000 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)))));
2001 if (UNLIKELY(current_cpu->trace_result_p))
2002 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2003 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2006 current_cpu->done_insn (npc, status);
2010 // ********** jmp-compact: jmp @$rn
2013 sh2e_sem_jmp_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2014 sh2e::write_stacks &buf)
2016 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2017 sem_status status = SEM_STATUS_NORMAL;
2018 sh2e_scache* abuf = sem;
2019 unsigned long long written = 0;
2020 PCADDR pc = abuf->addr;
2021 PCADDR npc = pc + 2;
2025 UDI opval = ADDDI (pc, 2);
2026 if (UNLIKELY(current_cpu->trace_result_p))
2027 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2028 current_cpu->branch (opval, npc, status);
2030 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2032 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2033 buf.h_pc_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<UDI>(pc, opval));
2034 if (UNLIKELY(current_cpu->trace_result_p))
2035 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2037 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2040 current_cpu->done_cti_insn (npc, status);
2044 // ********** jsr-compact: jsr @$rn
2047 sh2e_sem_jsr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2048 sh2e::write_stacks &buf)
2050 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2051 sem_status status = SEM_STATUS_NORMAL;
2052 sh2e_scache* abuf = sem;
2053 unsigned long long written = 0;
2054 PCADDR pc = abuf->addr;
2055 PCADDR npc = pc + 2;
2059 SI opval = ADDDI (pc, 4);
2060 buf.h_pr_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<SI>(pc, opval));
2061 if (UNLIKELY(current_cpu->trace_result_p))
2062 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2065 UDI opval = ADDDI (pc, 2);
2066 if (UNLIKELY(current_cpu->trace_result_p))
2067 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2068 current_cpu->branch (opval, npc, status);
2070 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2072 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2073 buf.h_pc_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<UDI>(pc, opval));
2074 if (UNLIKELY(current_cpu->trace_result_p))
2075 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
2077 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2080 current_cpu->done_cti_insn (npc, status);
2084 // ********** ldc-gbr-compact: ldc $rn, gbr
2087 sh2e_sem_ldc_gbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2088 sh2e::write_stacks &buf)
2090 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2091 sem_status status = SEM_STATUS_NORMAL;
2092 sh2e_scache* abuf = sem;
2093 unsigned long long written = 0;
2094 PCADDR pc = abuf->addr;
2095 PCADDR npc = pc + 2;
2098 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2099 if (UNLIKELY(current_cpu->trace_result_p))
2100 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2101 current_cpu->h_gbr_set (opval);
2104 current_cpu->done_insn (npc, status);
2108 // ********** ldc-vbr-compact: ldc $rn, vbr
2111 sh2e_sem_ldc_vbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2112 sh2e::write_stacks &buf)
2114 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2115 sem_status status = SEM_STATUS_NORMAL;
2116 sh2e_scache* abuf = sem;
2117 unsigned long long written = 0;
2118 PCADDR pc = abuf->addr;
2119 PCADDR npc = pc + 2;
2122 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2123 if (UNLIKELY(current_cpu->trace_result_p))
2124 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2125 current_cpu->h_vbr_set (opval);
2128 current_cpu->done_insn (npc, status);
2132 // ********** ldc-sr-compact: ldc $rn, sr
2135 sh2e_sem_ldc_sr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2136 sh2e::write_stacks &buf)
2138 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2139 sem_status status = SEM_STATUS_NORMAL;
2140 sh2e_scache* abuf = sem;
2141 unsigned long long written = 0;
2142 PCADDR pc = abuf->addr;
2143 PCADDR npc = pc + 2;
2146 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2147 if (UNLIKELY(current_cpu->trace_result_p))
2148 current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << " ";
2149 current_cpu->hardware.h_sr = opval;
2152 current_cpu->done_insn (npc, status);
2156 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
2159 sh2e_sem_ldcl_gbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2160 sh2e::write_stacks &buf)
2162 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2163 sem_status status = SEM_STATUS_NORMAL;
2164 sh2e_scache* abuf = sem;
2165 unsigned long long written = 0;
2166 PCADDR pc = abuf->addr;
2167 PCADDR npc = pc + 2;
2171 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2172 if (UNLIKELY(current_cpu->trace_result_p))
2173 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
2174 current_cpu->h_gbr_set (opval);
2177 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2178 if (UNLIKELY(current_cpu->trace_result_p))
2179 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2180 current_cpu->h_grc_set (FLD (f_rn), opval);
2184 current_cpu->done_insn (npc, status);
2188 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
2191 sh2e_sem_ldcl_vbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2192 sh2e::write_stacks &buf)
2194 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2195 sem_status status = SEM_STATUS_NORMAL;
2196 sh2e_scache* abuf = sem;
2197 unsigned long long written = 0;
2198 PCADDR pc = abuf->addr;
2199 PCADDR npc = pc + 2;
2203 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2204 if (UNLIKELY(current_cpu->trace_result_p))
2205 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
2206 current_cpu->h_vbr_set (opval);
2209 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2210 if (UNLIKELY(current_cpu->trace_result_p))
2211 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2212 current_cpu->h_grc_set (FLD (f_rn), opval);
2216 current_cpu->done_insn (npc, status);
2220 // ********** lds-fpscr-compact: lds $rn, fpscr
2223 sh2e_sem_lds_fpscr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2224 sh2e::write_stacks &buf)
2226 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2227 sem_status status = SEM_STATUS_NORMAL;
2228 sh2e_scache* abuf = sem;
2229 unsigned long long written = 0;
2230 PCADDR pc = abuf->addr;
2231 PCADDR npc = pc + 2;
2234 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2235 if (UNLIKELY(current_cpu->trace_result_p))
2236 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2237 current_cpu->hardware.h_fpscr = opval;
2240 current_cpu->done_insn (npc, status);
2244 // ********** ldsl-fpscr-compact: lds.l @${rn}+, fpscr
2247 sh2e_sem_ldsl_fpscr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2248 sh2e::write_stacks &buf)
2250 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2251 sem_status status = SEM_STATUS_NORMAL;
2252 sh2e_scache* abuf = sem;
2253 unsigned long long written = 0;
2254 PCADDR pc = abuf->addr;
2255 PCADDR npc = pc + 2;
2259 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2260 if (UNLIKELY(current_cpu->trace_result_p))
2261 current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << " ";
2262 current_cpu->hardware.h_fpscr = opval;
2265 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2266 if (UNLIKELY(current_cpu->trace_result_p))
2267 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2268 current_cpu->h_grc_set (FLD (f_rn), opval);
2272 current_cpu->done_insn (npc, status);
2276 // ********** lds-fpul-compact: lds $rn, fpul
2279 sh2e_sem_lds_fpul_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2280 sh2e::write_stacks &buf)
2282 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2283 sem_status status = SEM_STATUS_NORMAL;
2284 sh2e_scache* abuf = sem;
2285 unsigned long long written = 0;
2286 PCADDR pc = abuf->addr;
2287 PCADDR npc = pc + 2;
2290 SF opval = SUBWORDSISF (current_cpu->h_grc_get (FLD (f_rn)));
2291 if (UNLIKELY(current_cpu->trace_result_p))
2292 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2293 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2296 current_cpu->done_insn (npc, status);
2300 // ********** ldsl-fpul-compact: lds.l @${rn}+, fpul
2303 sh2e_sem_ldsl_fpul_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2304 sh2e::write_stacks &buf)
2306 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2307 sem_status status = SEM_STATUS_NORMAL;
2308 sh2e_scache* abuf = sem;
2309 unsigned long long written = 0;
2310 PCADDR pc = abuf->addr;
2311 PCADDR npc = pc + 2;
2315 SF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)));
2316 if (UNLIKELY(current_cpu->trace_result_p))
2317 current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << " ";
2318 current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2321 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2322 if (UNLIKELY(current_cpu->trace_result_p))
2323 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2324 current_cpu->h_grc_set (FLD (f_rn), opval);
2328 current_cpu->done_insn (npc, status);
2332 // ********** lds-mach-compact: lds $rn, mach
2335 sh2e_sem_lds_mach_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2336 sh2e::write_stacks &buf)
2338 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2339 sem_status status = SEM_STATUS_NORMAL;
2340 sh2e_scache* abuf = sem;
2341 unsigned long long written = 0;
2342 PCADDR pc = abuf->addr;
2343 PCADDR npc = pc + 2;
2346 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2347 if (UNLIKELY(current_cpu->trace_result_p))
2348 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2349 current_cpu->h_mach_set (opval);
2352 current_cpu->done_insn (npc, status);
2356 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
2359 sh2e_sem_ldsl_mach_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2360 sh2e::write_stacks &buf)
2362 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2363 sem_status status = SEM_STATUS_NORMAL;
2364 sh2e_scache* abuf = sem;
2365 unsigned long long written = 0;
2366 PCADDR pc = abuf->addr;
2367 PCADDR npc = pc + 2;
2371 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2372 if (UNLIKELY(current_cpu->trace_result_p))
2373 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2374 current_cpu->h_mach_set (opval);
2377 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2378 if (UNLIKELY(current_cpu->trace_result_p))
2379 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2380 current_cpu->h_grc_set (FLD (f_rn), opval);
2384 current_cpu->done_insn (npc, status);
2388 // ********** lds-macl-compact: lds $rn, macl
2391 sh2e_sem_lds_macl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2392 sh2e::write_stacks &buf)
2394 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2395 sem_status status = SEM_STATUS_NORMAL;
2396 sh2e_scache* abuf = sem;
2397 unsigned long long written = 0;
2398 PCADDR pc = abuf->addr;
2399 PCADDR npc = pc + 2;
2402 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2403 if (UNLIKELY(current_cpu->trace_result_p))
2404 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2405 current_cpu->h_macl_set (opval);
2408 current_cpu->done_insn (npc, status);
2412 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
2415 sh2e_sem_ldsl_macl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2416 sh2e::write_stacks &buf)
2418 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2419 sem_status status = SEM_STATUS_NORMAL;
2420 sh2e_scache* abuf = sem;
2421 unsigned long long written = 0;
2422 PCADDR pc = abuf->addr;
2423 PCADDR npc = pc + 2;
2427 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2428 if (UNLIKELY(current_cpu->trace_result_p))
2429 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2430 current_cpu->h_macl_set (opval);
2433 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2434 if (UNLIKELY(current_cpu->trace_result_p))
2435 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2436 current_cpu->h_grc_set (FLD (f_rn), opval);
2440 current_cpu->done_insn (npc, status);
2444 // ********** lds-pr-compact: lds $rn, pr
2447 sh2e_sem_lds_pr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2448 sh2e::write_stacks &buf)
2450 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2451 sem_status status = SEM_STATUS_NORMAL;
2452 sh2e_scache* abuf = sem;
2453 unsigned long long written = 0;
2454 PCADDR pc = abuf->addr;
2455 PCADDR npc = pc + 2;
2458 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2459 if (UNLIKELY(current_cpu->trace_result_p))
2460 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2461 current_cpu->h_pr_set (opval);
2464 current_cpu->done_insn (npc, status);
2468 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
2471 sh2e_sem_ldsl_pr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2472 sh2e::write_stacks &buf)
2474 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2475 sem_status status = SEM_STATUS_NORMAL;
2476 sh2e_scache* abuf = sem;
2477 unsigned long long written = 0;
2478 PCADDR pc = abuf->addr;
2479 PCADDR npc = pc + 2;
2483 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2484 if (UNLIKELY(current_cpu->trace_result_p))
2485 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
2486 current_cpu->h_pr_set (opval);
2489 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2490 if (UNLIKELY(current_cpu->trace_result_p))
2491 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2492 current_cpu->h_grc_set (FLD (f_rn), opval);
2496 current_cpu->done_insn (npc, status);
2500 // ********** macl-compact: mac.l @${rm}+, @${rn}+
2503 sh2e_sem_macl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2504 sh2e::write_stacks &buf)
2506 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2507 sem_status status = SEM_STATUS_NORMAL;
2508 sh2e_scache* abuf = sem;
2509 unsigned long long written = 0;
2510 PCADDR pc = abuf->addr;
2511 PCADDR npc = pc + 2;
2519 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2521 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2522 if (UNLIKELY(current_cpu->trace_result_p))
2523 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2524 current_cpu->h_grc_set (FLD (f_rn), opval);
2526 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2529 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2530 if (UNLIKELY(current_cpu->trace_result_p))
2531 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2532 current_cpu->h_grc_set (FLD (f_rn), opval);
2535 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2536 written |= (1ULL << 11);
2537 if (UNLIKELY(current_cpu->trace_result_p))
2538 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2539 current_cpu->h_grc_set (FLD (f_rm), opval);
2543 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2545 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2546 written |= (1ULL << 11);
2547 if (UNLIKELY(current_cpu->trace_result_p))
2548 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2549 current_cpu->h_grc_set (FLD (f_rm), opval);
2551 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2552 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2553 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2555 if (current_cpu->h_sbit_get ()) {
2559 tmp_max = SRLDI (INVDI (0), 16);
2560 tmp_min = SRLDI (INVDI (0), 15);
2561 if (GTDI (tmp_result, tmp_max)) {
2562 tmp_result = tmp_max;
2564 if (LTDI (tmp_result, tmp_min)) {
2565 tmp_result = tmp_min;
2571 SI opval = SUBWORDDISI (tmp_result, 0);
2572 if (UNLIKELY(current_cpu->trace_result_p))
2573 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2574 current_cpu->h_mach_set (opval);
2577 SI opval = SUBWORDDISI (tmp_result, 1);
2578 if (UNLIKELY(current_cpu->trace_result_p))
2579 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2580 current_cpu->h_macl_set (opval);
2585 abuf->written = written;
2586 current_cpu->done_insn (npc, status);
2590 // ********** macw-compact: mac.w @${rm}+, @${rn}+
2593 sh2e_sem_macw_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2594 sh2e::write_stacks &buf)
2596 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2597 sem_status status = SEM_STATUS_NORMAL;
2598 sh2e_scache* abuf = sem;
2599 unsigned long long written = 0;
2600 PCADDR pc = abuf->addr;
2601 PCADDR npc = pc + 2;
2609 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2611 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2612 if (UNLIKELY(current_cpu->trace_result_p))
2613 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2614 current_cpu->h_grc_set (FLD (f_rn), opval);
2616 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2619 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2620 if (UNLIKELY(current_cpu->trace_result_p))
2621 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2622 current_cpu->h_grc_set (FLD (f_rn), opval);
2625 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2626 written |= (1ULL << 11);
2627 if (UNLIKELY(current_cpu->trace_result_p))
2628 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2629 current_cpu->h_grc_set (FLD (f_rm), opval);
2633 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2635 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2636 written |= (1ULL << 11);
2637 if (UNLIKELY(current_cpu->trace_result_p))
2638 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2639 current_cpu->h_grc_set (FLD (f_rm), opval);
2641 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2642 if (current_cpu->h_sbit_get ()) {
2644 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
2647 written |= (1ULL << 9);
2648 if (UNLIKELY(current_cpu->trace_result_p))
2649 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2650 current_cpu->h_mach_set (opval);
2654 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
2655 written |= (1ULL << 10);
2656 if (UNLIKELY(current_cpu->trace_result_p))
2657 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2658 current_cpu->h_macl_set (opval);
2663 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2664 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2666 SI opval = SUBWORDDISI (tmp_result, 0);
2667 written |= (1ULL << 9);
2668 if (UNLIKELY(current_cpu->trace_result_p))
2669 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
2670 current_cpu->h_mach_set (opval);
2673 SI opval = SUBWORDDISI (tmp_result, 1);
2674 written |= (1ULL << 10);
2675 if (UNLIKELY(current_cpu->trace_result_p))
2676 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2677 current_cpu->h_macl_set (opval);
2683 abuf->written = written;
2684 current_cpu->done_insn (npc, status);
2688 // ********** mov-compact: mov $rm64, $rn64
2691 sh2e_sem_mov_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2692 sh2e::write_stacks &buf)
2694 #define FLD(f) abuf->fields.sfmt_and_compact.f
2695 sem_status status = SEM_STATUS_NORMAL;
2696 sh2e_scache* abuf = sem;
2697 unsigned long long written = 0;
2698 PCADDR pc = abuf->addr;
2699 PCADDR npc = pc + 2;
2702 DI opval = current_cpu->h_gr_get (FLD (f_rm));
2703 if (UNLIKELY(current_cpu->trace_result_p))
2704 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2705 current_cpu->h_gr_set (FLD (f_rn), opval);
2708 current_cpu->done_insn (npc, status);
2712 // ********** movi-compact: mov #$imm8, $rn
2715 sh2e_sem_movi_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2716 sh2e::write_stacks &buf)
2718 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2719 sem_status status = SEM_STATUS_NORMAL;
2720 sh2e_scache* abuf = sem;
2721 unsigned long long written = 0;
2722 PCADDR pc = abuf->addr;
2723 PCADDR npc = pc + 2;
2726 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2727 if (UNLIKELY(current_cpu->trace_result_p))
2728 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2729 current_cpu->h_grc_set (FLD (f_rn), opval);
2732 current_cpu->done_insn (npc, status);
2736 // ********** movb1-compact: mov.b $rm, @$rn
2739 sh2e_sem_movb1_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2740 sh2e::write_stacks &buf)
2742 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2743 sem_status status = SEM_STATUS_NORMAL;
2744 sh2e_scache* abuf = sem;
2745 unsigned long long written = 0;
2746 PCADDR pc = abuf->addr;
2747 PCADDR npc = pc + 2;
2750 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2751 if (UNLIKELY(current_cpu->trace_result_p))
2752 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2753 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2756 current_cpu->done_insn (npc, status);
2760 // ********** movb2-compact: mov.b $rm, @-$rn
2763 sh2e_sem_movb2_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2764 sh2e::write_stacks &buf)
2766 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2767 sem_status status = SEM_STATUS_NORMAL;
2768 sh2e_scache* abuf = sem;
2769 unsigned long long written = 0;
2770 PCADDR pc = abuf->addr;
2771 PCADDR npc = pc + 2;
2775 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
2777 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2778 if (UNLIKELY(current_cpu->trace_result_p))
2779 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2780 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2783 SI opval = tmp_addr;
2784 if (UNLIKELY(current_cpu->trace_result_p))
2785 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2786 current_cpu->h_grc_set (FLD (f_rn), opval);
2790 current_cpu->done_insn (npc, status);
2794 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
2797 sh2e_sem_movb3_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2798 sh2e::write_stacks &buf)
2800 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2801 sem_status status = SEM_STATUS_NORMAL;
2802 sh2e_scache* abuf = sem;
2803 unsigned long long written = 0;
2804 PCADDR pc = abuf->addr;
2805 PCADDR npc = pc + 2;
2808 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2809 if (UNLIKELY(current_cpu->trace_result_p))
2810 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 << " ";
2811 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2814 current_cpu->done_insn (npc, status);
2818 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
2821 sh2e_sem_movb4_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2822 sh2e::write_stacks &buf)
2824 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2825 sem_status status = SEM_STATUS_NORMAL;
2826 sh2e_scache* abuf = sem;
2827 unsigned long long written = 0;
2828 PCADDR pc = abuf->addr;
2829 PCADDR npc = pc + 2;
2833 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
2835 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2836 if (UNLIKELY(current_cpu->trace_result_p))
2837 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2838 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2842 current_cpu->done_insn (npc, status);
2846 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
2849 sh2e_sem_movb5_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2850 sh2e::write_stacks &buf)
2852 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2853 sem_status status = SEM_STATUS_NORMAL;
2854 sh2e_scache* abuf = sem;
2855 unsigned long long written = 0;
2856 PCADDR pc = abuf->addr;
2857 PCADDR npc = pc + 2;
2861 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2863 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2864 if (UNLIKELY(current_cpu->trace_result_p))
2865 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2866 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2870 current_cpu->done_insn (npc, status);
2874 // ********** movb6-compact: mov.b @$rm, $rn
2877 sh2e_sem_movb6_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2878 sh2e::write_stacks &buf)
2880 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2881 sem_status status = SEM_STATUS_NORMAL;
2882 sh2e_scache* abuf = sem;
2883 unsigned long long written = 0;
2884 PCADDR pc = abuf->addr;
2885 PCADDR npc = pc + 2;
2888 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2889 if (UNLIKELY(current_cpu->trace_result_p))
2890 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2891 current_cpu->h_grc_set (FLD (f_rn), opval);
2894 current_cpu->done_insn (npc, status);
2898 // ********** movb7-compact: mov.b @${rm}+, $rn
2901 sh2e_sem_movb7_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2902 sh2e::write_stacks &buf)
2904 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2905 sem_status status = SEM_STATUS_NORMAL;
2906 sh2e_scache* abuf = sem;
2907 unsigned long long written = 0;
2908 PCADDR pc = abuf->addr;
2909 PCADDR npc = pc + 2;
2913 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2914 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2916 SI opval = EXTQISI (tmp_data);
2917 written |= (1ULL << 4);
2918 if (UNLIKELY(current_cpu->trace_result_p))
2919 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2920 current_cpu->h_grc_set (FLD (f_rm), opval);
2924 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2925 written |= (1ULL << 4);
2926 if (UNLIKELY(current_cpu->trace_result_p))
2927 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2928 current_cpu->h_grc_set (FLD (f_rm), opval);
2932 SI opval = EXTQISI (tmp_data);
2933 if (UNLIKELY(current_cpu->trace_result_p))
2934 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2935 current_cpu->h_grc_set (FLD (f_rn), opval);
2939 abuf->written = written;
2940 current_cpu->done_insn (npc, status);
2944 // ********** movb8-compact: mov.b @(r0, $rm), $rn
2947 sh2e_sem_movb8_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2948 sh2e::write_stacks &buf)
2950 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2951 sem_status status = SEM_STATUS_NORMAL;
2952 sh2e_scache* abuf = sem;
2953 unsigned long long written = 0;
2954 PCADDR pc = abuf->addr;
2955 PCADDR npc = pc + 2;
2958 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2959 if (UNLIKELY(current_cpu->trace_result_p))
2960 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2961 current_cpu->h_grc_set (FLD (f_rn), opval);
2964 current_cpu->done_insn (npc, status);
2968 // ********** movb9-compact: mov.b @($imm8, gbr), r0
2971 sh2e_sem_movb9_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2972 sh2e::write_stacks &buf)
2974 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2975 sem_status status = SEM_STATUS_NORMAL;
2976 sh2e_scache* abuf = sem;
2977 unsigned long long written = 0;
2978 PCADDR pc = abuf->addr;
2979 PCADDR npc = pc + 2;
2982 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
2983 if (UNLIKELY(current_cpu->trace_result_p))
2984 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2985 current_cpu->h_grc_set (((UINT) 0), opval);
2988 current_cpu->done_insn (npc, status);
2992 // ********** movb10-compact: mov.b @($imm4, $rm), r0
2995 sh2e_sem_movb10_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
2996 sh2e::write_stacks &buf)
2998 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2999 sem_status status = SEM_STATUS_NORMAL;
3000 sh2e_scache* abuf = sem;
3001 unsigned long long written = 0;
3002 PCADDR pc = abuf->addr;
3003 PCADDR npc = pc + 2;
3006 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
3007 if (UNLIKELY(current_cpu->trace_result_p))
3008 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3009 current_cpu->h_grc_set (((UINT) 0), opval);
3012 current_cpu->done_insn (npc, status);
3016 // ********** movl1-compact: mov.l $rm, @$rn
3019 sh2e_sem_movl1_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3020 sh2e::write_stacks &buf)
3022 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3023 sem_status status = SEM_STATUS_NORMAL;
3024 sh2e_scache* abuf = sem;
3025 unsigned long long written = 0;
3026 PCADDR pc = abuf->addr;
3027 PCADDR npc = pc + 2;
3030 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3031 if (UNLIKELY(current_cpu->trace_result_p))
3032 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3033 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3036 current_cpu->done_insn (npc, status);
3040 // ********** movl2-compact: mov.l $rm, @-$rn
3043 sh2e_sem_movl2_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3044 sh2e::write_stacks &buf)
3046 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3047 sem_status status = SEM_STATUS_NORMAL;
3048 sh2e_scache* abuf = sem;
3049 unsigned long long written = 0;
3050 PCADDR pc = abuf->addr;
3051 PCADDR npc = pc + 2;
3055 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3057 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3058 if (UNLIKELY(current_cpu->trace_result_p))
3059 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3060 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3063 SI opval = tmp_addr;
3064 if (UNLIKELY(current_cpu->trace_result_p))
3065 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3066 current_cpu->h_grc_set (FLD (f_rn), opval);
3070 current_cpu->done_insn (npc, status);
3074 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
3077 sh2e_sem_movl3_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3078 sh2e::write_stacks &buf)
3080 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3081 sem_status status = SEM_STATUS_NORMAL;
3082 sh2e_scache* abuf = sem;
3083 unsigned long long written = 0;
3084 PCADDR pc = abuf->addr;
3085 PCADDR npc = pc + 2;
3088 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3089 if (UNLIKELY(current_cpu->trace_result_p))
3090 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 << " ";
3091 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3094 current_cpu->done_insn (npc, status);
3098 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
3101 sh2e_sem_movl4_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3102 sh2e::write_stacks &buf)
3104 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
3105 sem_status status = SEM_STATUS_NORMAL;
3106 sh2e_scache* abuf = sem;
3107 unsigned long long written = 0;
3108 PCADDR pc = abuf->addr;
3109 PCADDR npc = pc + 2;
3112 SI opval = current_cpu->h_grc_get (((UINT) 0));
3113 if (UNLIKELY(current_cpu->trace_result_p))
3114 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3115 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
3118 current_cpu->done_insn (npc, status);
3122 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
3125 sh2e_sem_movl5_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3126 sh2e::write_stacks &buf)
3128 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3129 sem_status status = SEM_STATUS_NORMAL;
3130 sh2e_scache* abuf = sem;
3131 unsigned long long written = 0;
3132 PCADDR pc = abuf->addr;
3133 PCADDR npc = pc + 2;
3136 SI opval = current_cpu->h_grc_get (FLD (f_rm));
3137 if (UNLIKELY(current_cpu->trace_result_p))
3138 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 << " ";
3139 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
3142 current_cpu->done_insn (npc, status);
3146 // ********** movl6-compact: mov.l @$rm, $rn
3149 sh2e_sem_movl6_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3150 sh2e::write_stacks &buf)
3152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3153 sem_status status = SEM_STATUS_NORMAL;
3154 sh2e_scache* abuf = sem;
3155 unsigned long long written = 0;
3156 PCADDR pc = abuf->addr;
3157 PCADDR npc = pc + 2;
3160 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3161 if (UNLIKELY(current_cpu->trace_result_p))
3162 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3163 current_cpu->h_grc_set (FLD (f_rn), opval);
3166 current_cpu->done_insn (npc, status);
3170 // ********** movl7-compact: mov.l @${rm}+, $rn
3173 sh2e_sem_movl7_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3174 sh2e::write_stacks &buf)
3176 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3177 sem_status status = SEM_STATUS_NORMAL;
3178 sh2e_scache* abuf = sem;
3179 unsigned long long written = 0;
3180 PCADDR pc = abuf->addr;
3181 PCADDR npc = pc + 2;
3185 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3186 if (UNLIKELY(current_cpu->trace_result_p))
3187 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3188 current_cpu->h_grc_set (FLD (f_rn), opval);
3190 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3192 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3193 written |= (1ULL << 5);
3194 if (UNLIKELY(current_cpu->trace_result_p))
3195 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3196 current_cpu->h_grc_set (FLD (f_rm), opval);
3200 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
3201 written |= (1ULL << 5);
3202 if (UNLIKELY(current_cpu->trace_result_p))
3203 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3204 current_cpu->h_grc_set (FLD (f_rm), opval);
3209 abuf->written = written;
3210 current_cpu->done_insn (npc, status);
3214 // ********** movl8-compact: mov.l @(r0, $rm), $rn
3217 sh2e_sem_movl8_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3218 sh2e::write_stacks &buf)
3220 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3221 sem_status status = SEM_STATUS_NORMAL;
3222 sh2e_scache* abuf = sem;
3223 unsigned long long written = 0;
3224 PCADDR pc = abuf->addr;
3225 PCADDR npc = pc + 2;
3228 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
3229 if (UNLIKELY(current_cpu->trace_result_p))
3230 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3231 current_cpu->h_grc_set (FLD (f_rn), opval);
3234 current_cpu->done_insn (npc, status);
3238 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
3241 sh2e_sem_movl9_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3242 sh2e::write_stacks &buf)
3244 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3245 sem_status status = SEM_STATUS_NORMAL;
3246 sh2e_scache* abuf = sem;
3247 unsigned long long written = 0;
3248 PCADDR pc = abuf->addr;
3249 PCADDR npc = pc + 2;
3252 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
3253 if (UNLIKELY(current_cpu->trace_result_p))
3254 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3255 current_cpu->h_grc_set (((UINT) 0), opval);
3258 current_cpu->done_insn (npc, status);
3262 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
3265 sh2e_sem_movl10_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3266 sh2e::write_stacks &buf)
3268 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3269 sem_status status = SEM_STATUS_NORMAL;
3270 sh2e_scache* abuf = sem;
3271 unsigned long long written = 0;
3272 PCADDR pc = abuf->addr;
3273 PCADDR npc = pc + 2;
3276 SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3277 if (UNLIKELY(current_cpu->trace_result_p))
3278 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3279 current_cpu->h_grc_set (FLD (f_rn), opval);
3282 current_cpu->done_insn (npc, status);
3286 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
3289 sh2e_sem_movl11_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3290 sh2e::write_stacks &buf)
3292 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3293 sem_status status = SEM_STATUS_NORMAL;
3294 sh2e_scache* abuf = sem;
3295 unsigned long long written = 0;
3296 PCADDR pc = abuf->addr;
3297 PCADDR npc = pc + 2;
3300 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
3301 if (UNLIKELY(current_cpu->trace_result_p))
3302 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3303 current_cpu->h_grc_set (FLD (f_rn), opval);
3306 current_cpu->done_insn (npc, status);
3310 // ********** movw1-compact: mov.w $rm, @$rn
3313 sh2e_sem_movw1_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3314 sh2e::write_stacks &buf)
3316 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3317 sem_status status = SEM_STATUS_NORMAL;
3318 sh2e_scache* abuf = sem;
3319 unsigned long long written = 0;
3320 PCADDR pc = abuf->addr;
3321 PCADDR npc = pc + 2;
3324 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3325 if (UNLIKELY(current_cpu->trace_result_p))
3326 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3327 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3330 current_cpu->done_insn (npc, status);
3334 // ********** movw2-compact: mov.w $rm, @-$rn
3337 sh2e_sem_movw2_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3338 sh2e::write_stacks &buf)
3340 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3341 sem_status status = SEM_STATUS_NORMAL;
3342 sh2e_scache* abuf = sem;
3343 unsigned long long written = 0;
3344 PCADDR pc = abuf->addr;
3345 PCADDR npc = pc + 2;
3349 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3351 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3352 if (UNLIKELY(current_cpu->trace_result_p))
3353 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3354 current_cpu->SETMEMHI (pc, tmp_addr, opval);
3357 SI opval = tmp_addr;
3358 if (UNLIKELY(current_cpu->trace_result_p))
3359 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3360 current_cpu->h_grc_set (FLD (f_rn), opval);
3364 current_cpu->done_insn (npc, status);
3368 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
3371 sh2e_sem_movw3_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3372 sh2e::write_stacks &buf)
3374 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3375 sem_status status = SEM_STATUS_NORMAL;
3376 sh2e_scache* abuf = sem;
3377 unsigned long long written = 0;
3378 PCADDR pc = abuf->addr;
3379 PCADDR npc = pc + 2;
3382 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3383 if (UNLIKELY(current_cpu->trace_result_p))
3384 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 << " ";
3385 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3388 current_cpu->done_insn (npc, status);
3392 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
3395 sh2e_sem_movw4_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3396 sh2e::write_stacks &buf)
3398 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
3399 sem_status status = SEM_STATUS_NORMAL;
3400 sh2e_scache* abuf = sem;
3401 unsigned long long written = 0;
3402 PCADDR pc = abuf->addr;
3403 PCADDR npc = pc + 2;
3406 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3407 if (UNLIKELY(current_cpu->trace_result_p))
3408 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
3409 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
3412 current_cpu->done_insn (npc, status);
3416 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
3419 sh2e_sem_movw5_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3420 sh2e::write_stacks &buf)
3422 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3423 sem_status status = SEM_STATUS_NORMAL;
3424 sh2e_scache* abuf = sem;
3425 unsigned long long written = 0;
3426 PCADDR pc = abuf->addr;
3427 PCADDR npc = pc + 2;
3430 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3431 if (UNLIKELY(current_cpu->trace_result_p))
3432 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 << " ";
3433 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
3436 current_cpu->done_insn (npc, status);
3440 // ********** movw6-compact: mov.w @$rm, $rn
3443 sh2e_sem_movw6_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3444 sh2e::write_stacks &buf)
3446 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3447 sem_status status = SEM_STATUS_NORMAL;
3448 sh2e_scache* abuf = sem;
3449 unsigned long long written = 0;
3450 PCADDR pc = abuf->addr;
3451 PCADDR npc = pc + 2;
3454 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3455 if (UNLIKELY(current_cpu->trace_result_p))
3456 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3457 current_cpu->h_grc_set (FLD (f_rn), opval);
3460 current_cpu->done_insn (npc, status);
3464 // ********** movw7-compact: mov.w @${rm}+, $rn
3467 sh2e_sem_movw7_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3468 sh2e::write_stacks &buf)
3470 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3471 sem_status status = SEM_STATUS_NORMAL;
3472 sh2e_scache* abuf = sem;
3473 unsigned long long written = 0;
3474 PCADDR pc = abuf->addr;
3475 PCADDR npc = pc + 2;
3479 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3480 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3482 SI opval = EXTHISI (tmp_data);
3483 written |= (1ULL << 4);
3484 if (UNLIKELY(current_cpu->trace_result_p))
3485 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3486 current_cpu->h_grc_set (FLD (f_rm), opval);
3490 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
3491 written |= (1ULL << 4);
3492 if (UNLIKELY(current_cpu->trace_result_p))
3493 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
3494 current_cpu->h_grc_set (FLD (f_rm), opval);
3498 SI opval = EXTHISI (tmp_data);
3499 if (UNLIKELY(current_cpu->trace_result_p))
3500 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3501 current_cpu->h_grc_set (FLD (f_rn), opval);
3505 abuf->written = written;
3506 current_cpu->done_insn (npc, status);
3510 // ********** movw8-compact: mov.w @(r0, $rm), $rn
3513 sh2e_sem_movw8_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3514 sh2e::write_stacks &buf)
3516 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3517 sem_status status = SEM_STATUS_NORMAL;
3518 sh2e_scache* abuf = sem;
3519 unsigned long long written = 0;
3520 PCADDR pc = abuf->addr;
3521 PCADDR npc = pc + 2;
3524 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3525 if (UNLIKELY(current_cpu->trace_result_p))
3526 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3527 current_cpu->h_grc_set (FLD (f_rn), opval);
3530 current_cpu->done_insn (npc, status);
3534 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
3537 sh2e_sem_movw9_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3538 sh2e::write_stacks &buf)
3540 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
3541 sem_status status = SEM_STATUS_NORMAL;
3542 sh2e_scache* abuf = sem;
3543 unsigned long long written = 0;
3544 PCADDR pc = abuf->addr;
3545 PCADDR npc = pc + 2;
3548 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
3549 if (UNLIKELY(current_cpu->trace_result_p))
3550 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3551 current_cpu->h_grc_set (((UINT) 0), opval);
3554 current_cpu->done_insn (npc, status);
3558 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
3561 sh2e_sem_movw10_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3562 sh2e::write_stacks &buf)
3564 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3565 sem_status status = SEM_STATUS_NORMAL;
3566 sh2e_scache* abuf = sem;
3567 unsigned long long written = 0;
3568 PCADDR pc = abuf->addr;
3569 PCADDR npc = pc + 2;
3572 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
3573 if (UNLIKELY(current_cpu->trace_result_p))
3574 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3575 current_cpu->h_grc_set (FLD (f_rn), opval);
3578 current_cpu->done_insn (npc, status);
3582 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
3585 sh2e_sem_movw11_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3586 sh2e::write_stacks &buf)
3588 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
3589 sem_status status = SEM_STATUS_NORMAL;
3590 sh2e_scache* abuf = sem;
3591 unsigned long long written = 0;
3592 PCADDR pc = abuf->addr;
3593 PCADDR npc = pc + 2;
3596 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
3597 if (UNLIKELY(current_cpu->trace_result_p))
3598 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3599 current_cpu->h_grc_set (((UINT) 0), opval);
3602 current_cpu->done_insn (npc, status);
3606 // ********** mova-compact: mova @($imm8x4, pc), r0
3609 sh2e_sem_mova_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3610 sh2e::write_stacks &buf)
3612 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3613 sem_status status = SEM_STATUS_NORMAL;
3614 sh2e_scache* abuf = sem;
3615 unsigned long long written = 0;
3616 PCADDR pc = abuf->addr;
3617 PCADDR npc = pc + 2;
3620 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3621 if (UNLIKELY(current_cpu->trace_result_p))
3622 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3623 current_cpu->h_grc_set (((UINT) 0), opval);
3626 current_cpu->done_insn (npc, status);
3630 // ********** movt-compact: movt $rn
3633 sh2e_sem_movt_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3634 sh2e::write_stacks &buf)
3636 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3637 sem_status status = SEM_STATUS_NORMAL;
3638 sh2e_scache* abuf = sem;
3639 unsigned long long written = 0;
3640 PCADDR pc = abuf->addr;
3641 PCADDR npc = pc + 2;
3644 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
3645 if (UNLIKELY(current_cpu->trace_result_p))
3646 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3647 current_cpu->h_grc_set (FLD (f_rn), opval);
3650 current_cpu->done_insn (npc, status);
3654 // ********** mull-compact: mul.l $rm, $rn
3657 sh2e_sem_mull_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3658 sh2e::write_stacks &buf)
3660 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3661 sem_status status = SEM_STATUS_NORMAL;
3662 sh2e_scache* abuf = sem;
3663 unsigned long long written = 0;
3664 PCADDR pc = abuf->addr;
3665 PCADDR npc = pc + 2;
3668 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
3669 if (UNLIKELY(current_cpu->trace_result_p))
3670 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3671 current_cpu->h_macl_set (opval);
3674 current_cpu->done_insn (npc, status);
3678 // ********** mulsw-compact: muls.w $rm, $rn
3681 sh2e_sem_mulsw_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3682 sh2e::write_stacks &buf)
3684 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3685 sem_status status = SEM_STATUS_NORMAL;
3686 sh2e_scache* abuf = sem;
3687 unsigned long long written = 0;
3688 PCADDR pc = abuf->addr;
3689 PCADDR npc = pc + 2;
3692 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)));
3693 if (UNLIKELY(current_cpu->trace_result_p))
3694 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3695 current_cpu->h_macl_set (opval);
3698 current_cpu->done_insn (npc, status);
3702 // ********** muluw-compact: mulu.w $rm, $rn
3705 sh2e_sem_muluw_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3706 sh2e::write_stacks &buf)
3708 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3709 sem_status status = SEM_STATUS_NORMAL;
3710 sh2e_scache* abuf = sem;
3711 unsigned long long written = 0;
3712 PCADDR pc = abuf->addr;
3713 PCADDR npc = pc + 2;
3716 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)));
3717 if (UNLIKELY(current_cpu->trace_result_p))
3718 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3719 current_cpu->h_macl_set (opval);
3722 current_cpu->done_insn (npc, status);
3726 // ********** neg-compact: neg $rm, $rn
3729 sh2e_sem_neg_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3730 sh2e::write_stacks &buf)
3732 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3733 sem_status status = SEM_STATUS_NORMAL;
3734 sh2e_scache* abuf = sem;
3735 unsigned long long written = 0;
3736 PCADDR pc = abuf->addr;
3737 PCADDR npc = pc + 2;
3740 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
3741 if (UNLIKELY(current_cpu->trace_result_p))
3742 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3743 current_cpu->h_grc_set (FLD (f_rn), opval);
3746 current_cpu->done_insn (npc, status);
3750 // ********** negc-compact: negc $rm, $rn
3753 sh2e_sem_negc_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3754 sh2e::write_stacks &buf)
3756 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3757 sem_status status = SEM_STATUS_NORMAL;
3758 sh2e_scache* abuf = sem;
3759 unsigned long long written = 0;
3760 PCADDR pc = abuf->addr;
3761 PCADDR npc = pc + 2;
3765 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3767 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3768 if (UNLIKELY(current_cpu->trace_result_p))
3769 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3770 current_cpu->h_grc_set (FLD (f_rn), opval);
3773 BI opval = tmp_flag;
3774 if (UNLIKELY(current_cpu->trace_result_p))
3775 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3776 current_cpu->h_tbit_set (opval);
3780 current_cpu->done_insn (npc, status);
3784 // ********** nop-compact: nop
3787 sh2e_sem_nop_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3788 sh2e::write_stacks &buf)
3790 #define FLD(f) abuf->fields.fmt_empty.f
3791 sem_status status = SEM_STATUS_NORMAL;
3792 sh2e_scache* abuf = sem;
3793 unsigned long long written = 0;
3794 PCADDR pc = abuf->addr;
3795 PCADDR npc = pc + 2;
3799 current_cpu->done_insn (npc, status);
3803 // ********** not-compact: not $rm64, $rn64
3806 sh2e_sem_not_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3807 sh2e::write_stacks &buf)
3809 #define FLD(f) abuf->fields.sfmt_and_compact.f
3810 sem_status status = SEM_STATUS_NORMAL;
3811 sh2e_scache* abuf = sem;
3812 unsigned long long written = 0;
3813 PCADDR pc = abuf->addr;
3814 PCADDR npc = pc + 2;
3817 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
3818 if (UNLIKELY(current_cpu->trace_result_p))
3819 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3820 current_cpu->h_gr_set (FLD (f_rn), opval);
3823 current_cpu->done_insn (npc, status);
3827 // ********** or-compact: or $rm64, $rn64
3830 sh2e_sem_or_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3831 sh2e::write_stacks &buf)
3833 #define FLD(f) abuf->fields.sfmt_and_compact.f
3834 sem_status status = SEM_STATUS_NORMAL;
3835 sh2e_scache* abuf = sem;
3836 unsigned long long written = 0;
3837 PCADDR pc = abuf->addr;
3838 PCADDR npc = pc + 2;
3841 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
3842 if (UNLIKELY(current_cpu->trace_result_p))
3843 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3844 current_cpu->h_gr_set (FLD (f_rn), opval);
3847 current_cpu->done_insn (npc, status);
3851 // ********** ori-compact: or #$uimm8, r0
3854 sh2e_sem_ori_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3855 sh2e::write_stacks &buf)
3857 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3858 sem_status status = SEM_STATUS_NORMAL;
3859 sh2e_scache* abuf = sem;
3860 unsigned long long written = 0;
3861 PCADDR pc = abuf->addr;
3862 PCADDR npc = pc + 2;
3865 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3866 if (UNLIKELY(current_cpu->trace_result_p))
3867 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3868 current_cpu->h_grc_set (((UINT) 0), opval);
3871 current_cpu->done_insn (npc, status);
3875 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3878 sh2e_sem_orb_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3879 sh2e::write_stacks &buf)
3881 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3882 sem_status status = SEM_STATUS_NORMAL;
3883 sh2e_scache* abuf = sem;
3884 unsigned long long written = 0;
3885 PCADDR pc = abuf->addr;
3886 PCADDR npc = pc + 2;
3891 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3892 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3894 UQI opval = tmp_data;
3895 if (UNLIKELY(current_cpu->trace_result_p))
3896 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3897 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3901 current_cpu->done_insn (npc, status);
3905 // ********** rotcl-compact: rotcl $rn
3908 sh2e_sem_rotcl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3909 sh2e::write_stacks &buf)
3911 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
3912 sem_status status = SEM_STATUS_NORMAL;
3913 sh2e_scache* abuf = sem;
3914 unsigned long long written = 0;
3915 PCADDR pc = abuf->addr;
3916 PCADDR npc = pc + 2;
3920 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3922 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3923 if (UNLIKELY(current_cpu->trace_result_p))
3924 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3925 current_cpu->h_grc_set (FLD (f_rn), opval);
3928 BI opval = ((tmp_temp) ? (1) : (0));
3929 if (UNLIKELY(current_cpu->trace_result_p))
3930 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3931 current_cpu->h_tbit_set (opval);
3935 current_cpu->done_insn (npc, status);
3939 // ********** rotcr-compact: rotcr $rn
3942 sh2e_sem_rotcr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3943 sh2e::write_stacks &buf)
3945 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
3946 sem_status status = SEM_STATUS_NORMAL;
3947 sh2e_scache* abuf = sem;
3948 unsigned long long written = 0;
3949 PCADDR pc = abuf->addr;
3950 PCADDR npc = pc + 2;
3955 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3956 tmp_temp = current_cpu->h_tbit_get ();
3958 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3959 if (UNLIKELY(current_cpu->trace_result_p))
3960 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3961 current_cpu->h_grc_set (FLD (f_rn), opval);
3964 BI opval = ((tmp_lsbit) ? (1) : (0));
3965 if (UNLIKELY(current_cpu->trace_result_p))
3966 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3967 current_cpu->h_tbit_set (opval);
3971 current_cpu->done_insn (npc, status);
3975 // ********** rotl-compact: rotl $rn
3978 sh2e_sem_rotl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
3979 sh2e::write_stacks &buf)
3981 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
3982 sem_status status = SEM_STATUS_NORMAL;
3983 sh2e_scache* abuf = sem;
3984 unsigned long long written = 0;
3985 PCADDR pc = abuf->addr;
3986 PCADDR npc = pc + 2;
3990 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3992 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3993 if (UNLIKELY(current_cpu->trace_result_p))
3994 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3995 current_cpu->h_grc_set (FLD (f_rn), opval);
3998 BI opval = ((tmp_temp) ? (1) : (0));
3999 if (UNLIKELY(current_cpu->trace_result_p))
4000 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4001 current_cpu->h_tbit_set (opval);
4005 current_cpu->done_insn (npc, status);
4009 // ********** rotr-compact: rotr $rn
4012 sh2e_sem_rotr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4013 sh2e::write_stacks &buf)
4015 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4016 sem_status status = SEM_STATUS_NORMAL;
4017 sh2e_scache* abuf = sem;
4018 unsigned long long written = 0;
4019 PCADDR pc = abuf->addr;
4020 PCADDR npc = pc + 2;
4025 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4026 tmp_temp = tmp_lsbit;
4028 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4029 if (UNLIKELY(current_cpu->trace_result_p))
4030 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4031 current_cpu->h_grc_set (FLD (f_rn), opval);
4034 BI opval = ((tmp_lsbit) ? (1) : (0));
4035 if (UNLIKELY(current_cpu->trace_result_p))
4036 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4037 current_cpu->h_tbit_set (opval);
4041 current_cpu->done_insn (npc, status);
4045 // ********** rts-compact: rts
4048 sh2e_sem_rts_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4049 sh2e::write_stacks &buf)
4051 #define FLD(f) abuf->fields.fmt_empty.f
4052 sem_status status = SEM_STATUS_NORMAL;
4053 sh2e_scache* abuf = sem;
4054 unsigned long long written = 0;
4055 PCADDR pc = abuf->addr;
4056 PCADDR npc = pc + 2;
4060 UDI opval = ADDDI (pc, 2);
4061 if (UNLIKELY(current_cpu->trace_result_p))
4062 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4063 current_cpu->branch (opval, npc, status);
4065 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
4067 UDI opval = current_cpu->h_pr_get ();
4068 buf.h_pc_writes [(tick + 1) % sh2e::pipe_sz].push (sh2e::write<UDI>(pc, opval));
4069 if (UNLIKELY(current_cpu->trace_result_p))
4070 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
4072 current_cpu->notify_ret (current_cpu->h_pr_get ());
4075 current_cpu->done_cti_insn (npc, status);
4079 // ********** sett-compact: sett
4082 sh2e_sem_sett_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4083 sh2e::write_stacks &buf)
4085 #define FLD(f) abuf->fields.fmt_empty.f
4086 sem_status status = SEM_STATUS_NORMAL;
4087 sh2e_scache* abuf = sem;
4088 unsigned long long written = 0;
4089 PCADDR pc = abuf->addr;
4090 PCADDR npc = pc + 2;
4094 if (UNLIKELY(current_cpu->trace_result_p))
4095 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4096 current_cpu->h_tbit_set (opval);
4099 current_cpu->done_insn (npc, status);
4103 // ********** shal-compact: shal $rn
4106 sh2e_sem_shal_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4107 sh2e::write_stacks &buf)
4109 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4110 sem_status status = SEM_STATUS_NORMAL;
4111 sh2e_scache* abuf = sem;
4112 unsigned long long written = 0;
4113 PCADDR pc = abuf->addr;
4114 PCADDR npc = pc + 2;
4118 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4120 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4121 if (UNLIKELY(current_cpu->trace_result_p))
4122 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4123 current_cpu->h_grc_set (FLD (f_rn), opval);
4126 BI opval = ((tmp_t) ? (1) : (0));
4127 if (UNLIKELY(current_cpu->trace_result_p))
4128 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4129 current_cpu->h_tbit_set (opval);
4133 current_cpu->done_insn (npc, status);
4137 // ********** shar-compact: shar $rn
4140 sh2e_sem_shar_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4141 sh2e::write_stacks &buf)
4143 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4144 sem_status status = SEM_STATUS_NORMAL;
4145 sh2e_scache* abuf = sem;
4146 unsigned long long written = 0;
4147 PCADDR pc = abuf->addr;
4148 PCADDR npc = pc + 2;
4152 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4154 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4155 if (UNLIKELY(current_cpu->trace_result_p))
4156 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4157 current_cpu->h_grc_set (FLD (f_rn), opval);
4160 BI opval = ((tmp_t) ? (1) : (0));
4161 if (UNLIKELY(current_cpu->trace_result_p))
4162 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4163 current_cpu->h_tbit_set (opval);
4167 current_cpu->done_insn (npc, status);
4171 // ********** shll-compact: shll $rn
4174 sh2e_sem_shll_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4175 sh2e::write_stacks &buf)
4177 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4178 sem_status status = SEM_STATUS_NORMAL;
4179 sh2e_scache* abuf = sem;
4180 unsigned long long written = 0;
4181 PCADDR pc = abuf->addr;
4182 PCADDR npc = pc + 2;
4186 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4188 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4189 if (UNLIKELY(current_cpu->trace_result_p))
4190 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4191 current_cpu->h_grc_set (FLD (f_rn), opval);
4194 BI opval = ((tmp_t) ? (1) : (0));
4195 if (UNLIKELY(current_cpu->trace_result_p))
4196 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4197 current_cpu->h_tbit_set (opval);
4201 current_cpu->done_insn (npc, status);
4205 // ********** shll2-compact: shll2 $rn
4208 sh2e_sem_shll2_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4209 sh2e::write_stacks &buf)
4211 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4212 sem_status status = SEM_STATUS_NORMAL;
4213 sh2e_scache* abuf = sem;
4214 unsigned long long written = 0;
4215 PCADDR pc = abuf->addr;
4216 PCADDR npc = pc + 2;
4219 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4220 if (UNLIKELY(current_cpu->trace_result_p))
4221 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4222 current_cpu->h_grc_set (FLD (f_rn), opval);
4225 current_cpu->done_insn (npc, status);
4229 // ********** shll8-compact: shll8 $rn
4232 sh2e_sem_shll8_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4233 sh2e::write_stacks &buf)
4235 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4236 sem_status status = SEM_STATUS_NORMAL;
4237 sh2e_scache* abuf = sem;
4238 unsigned long long written = 0;
4239 PCADDR pc = abuf->addr;
4240 PCADDR npc = pc + 2;
4243 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4244 if (UNLIKELY(current_cpu->trace_result_p))
4245 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4246 current_cpu->h_grc_set (FLD (f_rn), opval);
4249 current_cpu->done_insn (npc, status);
4253 // ********** shll16-compact: shll16 $rn
4256 sh2e_sem_shll16_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4257 sh2e::write_stacks &buf)
4259 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4260 sem_status status = SEM_STATUS_NORMAL;
4261 sh2e_scache* abuf = sem;
4262 unsigned long long written = 0;
4263 PCADDR pc = abuf->addr;
4264 PCADDR npc = pc + 2;
4267 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4268 if (UNLIKELY(current_cpu->trace_result_p))
4269 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4270 current_cpu->h_grc_set (FLD (f_rn), opval);
4273 current_cpu->done_insn (npc, status);
4277 // ********** shlr-compact: shlr $rn
4280 sh2e_sem_shlr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4281 sh2e::write_stacks &buf)
4283 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4284 sem_status status = SEM_STATUS_NORMAL;
4285 sh2e_scache* abuf = sem;
4286 unsigned long long written = 0;
4287 PCADDR pc = abuf->addr;
4288 PCADDR npc = pc + 2;
4292 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4294 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4295 if (UNLIKELY(current_cpu->trace_result_p))
4296 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4297 current_cpu->h_grc_set (FLD (f_rn), opval);
4300 BI opval = ((tmp_t) ? (1) : (0));
4301 if (UNLIKELY(current_cpu->trace_result_p))
4302 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4303 current_cpu->h_tbit_set (opval);
4307 current_cpu->done_insn (npc, status);
4311 // ********** shlr2-compact: shlr2 $rn
4314 sh2e_sem_shlr2_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4315 sh2e::write_stacks &buf)
4317 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4318 sem_status status = SEM_STATUS_NORMAL;
4319 sh2e_scache* abuf = sem;
4320 unsigned long long written = 0;
4321 PCADDR pc = abuf->addr;
4322 PCADDR npc = pc + 2;
4325 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4326 if (UNLIKELY(current_cpu->trace_result_p))
4327 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4328 current_cpu->h_grc_set (FLD (f_rn), opval);
4331 current_cpu->done_insn (npc, status);
4335 // ********** shlr8-compact: shlr8 $rn
4338 sh2e_sem_shlr8_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4339 sh2e::write_stacks &buf)
4341 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4342 sem_status status = SEM_STATUS_NORMAL;
4343 sh2e_scache* abuf = sem;
4344 unsigned long long written = 0;
4345 PCADDR pc = abuf->addr;
4346 PCADDR npc = pc + 2;
4349 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4350 if (UNLIKELY(current_cpu->trace_result_p))
4351 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4352 current_cpu->h_grc_set (FLD (f_rn), opval);
4355 current_cpu->done_insn (npc, status);
4359 // ********** shlr16-compact: shlr16 $rn
4362 sh2e_sem_shlr16_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4363 sh2e::write_stacks &buf)
4365 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4366 sem_status status = SEM_STATUS_NORMAL;
4367 sh2e_scache* abuf = sem;
4368 unsigned long long written = 0;
4369 PCADDR pc = abuf->addr;
4370 PCADDR npc = pc + 2;
4373 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4374 if (UNLIKELY(current_cpu->trace_result_p))
4375 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4376 current_cpu->h_grc_set (FLD (f_rn), opval);
4379 current_cpu->done_insn (npc, status);
4383 // ********** stc-gbr-compact: stc gbr, $rn
4386 sh2e_sem_stc_gbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4387 sh2e::write_stacks &buf)
4389 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4390 sem_status status = SEM_STATUS_NORMAL;
4391 sh2e_scache* abuf = sem;
4392 unsigned long long written = 0;
4393 PCADDR pc = abuf->addr;
4394 PCADDR npc = pc + 2;
4397 SI opval = current_cpu->h_gbr_get ();
4398 if (UNLIKELY(current_cpu->trace_result_p))
4399 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4400 current_cpu->h_grc_set (FLD (f_rn), opval);
4403 current_cpu->done_insn (npc, status);
4407 // ********** stc-vbr-compact: stc vbr, $rn
4410 sh2e_sem_stc_vbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4411 sh2e::write_stacks &buf)
4413 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4414 sem_status status = SEM_STATUS_NORMAL;
4415 sh2e_scache* abuf = sem;
4416 unsigned long long written = 0;
4417 PCADDR pc = abuf->addr;
4418 PCADDR npc = pc + 2;
4421 SI opval = current_cpu->h_vbr_get ();
4422 if (UNLIKELY(current_cpu->trace_result_p))
4423 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4424 current_cpu->h_grc_set (FLD (f_rn), opval);
4427 current_cpu->done_insn (npc, status);
4431 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
4434 sh2e_sem_stcl_gbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4435 sh2e::write_stacks &buf)
4437 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4438 sem_status status = SEM_STATUS_NORMAL;
4439 sh2e_scache* abuf = sem;
4440 unsigned long long written = 0;
4441 PCADDR pc = abuf->addr;
4442 PCADDR npc = pc + 2;
4446 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4448 SI opval = current_cpu->h_gbr_get ();
4449 if (UNLIKELY(current_cpu->trace_result_p))
4450 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4451 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4454 SI opval = tmp_addr;
4455 if (UNLIKELY(current_cpu->trace_result_p))
4456 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4457 current_cpu->h_grc_set (FLD (f_rn), opval);
4461 current_cpu->done_insn (npc, status);
4465 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
4468 sh2e_sem_stcl_vbr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4469 sh2e::write_stacks &buf)
4471 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4472 sem_status status = SEM_STATUS_NORMAL;
4473 sh2e_scache* abuf = sem;
4474 unsigned long long written = 0;
4475 PCADDR pc = abuf->addr;
4476 PCADDR npc = pc + 2;
4480 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4482 SI opval = current_cpu->h_vbr_get ();
4483 if (UNLIKELY(current_cpu->trace_result_p))
4484 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4485 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4488 SI opval = tmp_addr;
4489 if (UNLIKELY(current_cpu->trace_result_p))
4490 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4491 current_cpu->h_grc_set (FLD (f_rn), opval);
4495 current_cpu->done_insn (npc, status);
4499 // ********** sts-fpscr-compact: sts fpscr, $rn
4502 sh2e_sem_sts_fpscr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4503 sh2e::write_stacks &buf)
4505 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4506 sem_status status = SEM_STATUS_NORMAL;
4507 sh2e_scache* abuf = sem;
4508 unsigned long long written = 0;
4509 PCADDR pc = abuf->addr;
4510 PCADDR npc = pc + 2;
4513 SI opval = current_cpu->hardware.h_fpscr;
4514 if (UNLIKELY(current_cpu->trace_result_p))
4515 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4516 current_cpu->h_grc_set (FLD (f_rn), opval);
4519 current_cpu->done_insn (npc, status);
4523 // ********** stsl-fpscr-compact: sts.l fpscr, @-$rn
4526 sh2e_sem_stsl_fpscr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4527 sh2e::write_stacks &buf)
4529 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4530 sem_status status = SEM_STATUS_NORMAL;
4531 sh2e_scache* abuf = sem;
4532 unsigned long long written = 0;
4533 PCADDR pc = abuf->addr;
4534 PCADDR npc = pc + 2;
4538 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4540 SI opval = current_cpu->hardware.h_fpscr;
4541 if (UNLIKELY(current_cpu->trace_result_p))
4542 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4543 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4546 SI opval = tmp_addr;
4547 if (UNLIKELY(current_cpu->trace_result_p))
4548 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4549 current_cpu->h_grc_set (FLD (f_rn), opval);
4553 current_cpu->done_insn (npc, status);
4557 // ********** sts-fpul-compact: sts fpul, $rn
4560 sh2e_sem_sts_fpul_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4561 sh2e::write_stacks &buf)
4563 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4564 sem_status status = SEM_STATUS_NORMAL;
4565 sh2e_scache* abuf = sem;
4566 unsigned long long written = 0;
4567 PCADDR pc = abuf->addr;
4568 PCADDR npc = pc + 2;
4571 SI opval = SUBWORDSFSI (current_cpu->hardware.h_fr[((UINT) 32)]);
4572 if (UNLIKELY(current_cpu->trace_result_p))
4573 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4574 current_cpu->h_grc_set (FLD (f_rn), opval);
4577 current_cpu->done_insn (npc, status);
4581 // ********** stsl-fpul-compact: sts.l fpul, @-$rn
4584 sh2e_sem_stsl_fpul_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4585 sh2e::write_stacks &buf)
4587 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4588 sem_status status = SEM_STATUS_NORMAL;
4589 sh2e_scache* abuf = sem;
4590 unsigned long long written = 0;
4591 PCADDR pc = abuf->addr;
4592 PCADDR npc = pc + 2;
4596 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4598 SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
4599 if (UNLIKELY(current_cpu->trace_result_p))
4600 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4601 current_cpu->SETMEMSF (pc, tmp_addr, opval);
4604 SI opval = tmp_addr;
4605 if (UNLIKELY(current_cpu->trace_result_p))
4606 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4607 current_cpu->h_grc_set (FLD (f_rn), opval);
4611 current_cpu->done_insn (npc, status);
4615 // ********** sts-mach-compact: sts mach, $rn
4618 sh2e_sem_sts_mach_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4619 sh2e::write_stacks &buf)
4621 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4622 sem_status status = SEM_STATUS_NORMAL;
4623 sh2e_scache* abuf = sem;
4624 unsigned long long written = 0;
4625 PCADDR pc = abuf->addr;
4626 PCADDR npc = pc + 2;
4629 SI opval = current_cpu->h_mach_get ();
4630 if (UNLIKELY(current_cpu->trace_result_p))
4631 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4632 current_cpu->h_grc_set (FLD (f_rn), opval);
4635 current_cpu->done_insn (npc, status);
4639 // ********** stsl-mach-compact: sts.l mach, @-$rn
4642 sh2e_sem_stsl_mach_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4643 sh2e::write_stacks &buf)
4645 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4646 sem_status status = SEM_STATUS_NORMAL;
4647 sh2e_scache* abuf = sem;
4648 unsigned long long written = 0;
4649 PCADDR pc = abuf->addr;
4650 PCADDR npc = pc + 2;
4654 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4656 SI opval = current_cpu->h_mach_get ();
4657 if (UNLIKELY(current_cpu->trace_result_p))
4658 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4659 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4662 SI opval = tmp_addr;
4663 if (UNLIKELY(current_cpu->trace_result_p))
4664 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4665 current_cpu->h_grc_set (FLD (f_rn), opval);
4669 current_cpu->done_insn (npc, status);
4673 // ********** sts-macl-compact: sts macl, $rn
4676 sh2e_sem_sts_macl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4677 sh2e::write_stacks &buf)
4679 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4680 sem_status status = SEM_STATUS_NORMAL;
4681 sh2e_scache* abuf = sem;
4682 unsigned long long written = 0;
4683 PCADDR pc = abuf->addr;
4684 PCADDR npc = pc + 2;
4687 SI opval = current_cpu->h_macl_get ();
4688 if (UNLIKELY(current_cpu->trace_result_p))
4689 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4690 current_cpu->h_grc_set (FLD (f_rn), opval);
4693 current_cpu->done_insn (npc, status);
4697 // ********** stsl-macl-compact: sts.l macl, @-$rn
4700 sh2e_sem_stsl_macl_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4701 sh2e::write_stacks &buf)
4703 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4704 sem_status status = SEM_STATUS_NORMAL;
4705 sh2e_scache* abuf = sem;
4706 unsigned long long written = 0;
4707 PCADDR pc = abuf->addr;
4708 PCADDR npc = pc + 2;
4712 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4714 SI opval = current_cpu->h_macl_get ();
4715 if (UNLIKELY(current_cpu->trace_result_p))
4716 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4717 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4720 SI opval = tmp_addr;
4721 if (UNLIKELY(current_cpu->trace_result_p))
4722 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4723 current_cpu->h_grc_set (FLD (f_rn), opval);
4727 current_cpu->done_insn (npc, status);
4731 // ********** sts-pr-compact: sts pr, $rn
4734 sh2e_sem_sts_pr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4735 sh2e::write_stacks &buf)
4737 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4738 sem_status status = SEM_STATUS_NORMAL;
4739 sh2e_scache* abuf = sem;
4740 unsigned long long written = 0;
4741 PCADDR pc = abuf->addr;
4742 PCADDR npc = pc + 2;
4745 SI opval = current_cpu->h_pr_get ();
4746 if (UNLIKELY(current_cpu->trace_result_p))
4747 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4748 current_cpu->h_grc_set (FLD (f_rn), opval);
4751 current_cpu->done_insn (npc, status);
4755 // ********** stsl-pr-compact: sts.l pr, @-$rn
4758 sh2e_sem_stsl_pr_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4759 sh2e::write_stacks &buf)
4761 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4762 sem_status status = SEM_STATUS_NORMAL;
4763 sh2e_scache* abuf = sem;
4764 unsigned long long written = 0;
4765 PCADDR pc = abuf->addr;
4766 PCADDR npc = pc + 2;
4770 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4772 SI opval = current_cpu->h_pr_get ();
4773 if (UNLIKELY(current_cpu->trace_result_p))
4774 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4775 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4778 SI opval = tmp_addr;
4779 if (UNLIKELY(current_cpu->trace_result_p))
4780 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4781 current_cpu->h_grc_set (FLD (f_rn), opval);
4785 current_cpu->done_insn (npc, status);
4789 // ********** sub-compact: sub $rm, $rn
4792 sh2e_sem_sub_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4793 sh2e::write_stacks &buf)
4795 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4796 sem_status status = SEM_STATUS_NORMAL;
4797 sh2e_scache* abuf = sem;
4798 unsigned long long written = 0;
4799 PCADDR pc = abuf->addr;
4800 PCADDR npc = pc + 2;
4803 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4804 if (UNLIKELY(current_cpu->trace_result_p))
4805 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4806 current_cpu->h_grc_set (FLD (f_rn), opval);
4809 current_cpu->done_insn (npc, status);
4813 // ********** subc-compact: subc $rm, $rn
4816 sh2e_sem_subc_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4817 sh2e::write_stacks &buf)
4819 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4820 sem_status status = SEM_STATUS_NORMAL;
4821 sh2e_scache* abuf = sem;
4822 unsigned long long written = 0;
4823 PCADDR pc = abuf->addr;
4824 PCADDR npc = pc + 2;
4828 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4830 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4831 if (UNLIKELY(current_cpu->trace_result_p))
4832 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4833 current_cpu->h_grc_set (FLD (f_rn), opval);
4836 BI opval = tmp_flag;
4837 if (UNLIKELY(current_cpu->trace_result_p))
4838 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4839 current_cpu->h_tbit_set (opval);
4843 current_cpu->done_insn (npc, status);
4847 // ********** subv-compact: subv $rm, $rn
4850 sh2e_sem_subv_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4851 sh2e::write_stacks &buf)
4853 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4854 sem_status status = SEM_STATUS_NORMAL;
4855 sh2e_scache* abuf = sem;
4856 unsigned long long written = 0;
4857 PCADDR pc = abuf->addr;
4858 PCADDR npc = pc + 2;
4862 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
4864 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4865 if (UNLIKELY(current_cpu->trace_result_p))
4866 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4867 current_cpu->h_grc_set (FLD (f_rn), opval);
4870 BI opval = ((tmp_t) ? (1) : (0));
4871 if (UNLIKELY(current_cpu->trace_result_p))
4872 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4873 current_cpu->h_tbit_set (opval);
4877 current_cpu->done_insn (npc, status);
4881 // ********** swapb-compact: swap.b $rm, $rn
4884 sh2e_sem_swapb_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4885 sh2e::write_stacks &buf)
4887 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4888 sem_status status = SEM_STATUS_NORMAL;
4889 sh2e_scache* abuf = sem;
4890 unsigned long long written = 0;
4891 PCADDR pc = abuf->addr;
4892 PCADDR npc = pc + 2;
4898 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
4899 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
4900 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
4902 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
4903 if (UNLIKELY(current_cpu->trace_result_p))
4904 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4905 current_cpu->h_grc_set (FLD (f_rn), opval);
4909 current_cpu->done_insn (npc, status);
4913 // ********** swapw-compact: swap.w $rm, $rn
4916 sh2e_sem_swapw_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4917 sh2e::write_stacks &buf)
4919 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4920 sem_status status = SEM_STATUS_NORMAL;
4921 sh2e_scache* abuf = sem;
4922 unsigned long long written = 0;
4923 PCADDR pc = abuf->addr;
4924 PCADDR npc = pc + 2;
4927 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
4928 if (UNLIKELY(current_cpu->trace_result_p))
4929 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4930 current_cpu->h_grc_set (FLD (f_rn), opval);
4933 current_cpu->done_insn (npc, status);
4937 // ********** tasb-compact: tas.b @$rn
4940 sh2e_sem_tasb_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4941 sh2e::write_stacks &buf)
4943 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4944 sem_status status = SEM_STATUS_NORMAL;
4945 sh2e_scache* abuf = sem;
4946 unsigned long long written = 0;
4947 PCADDR pc = abuf->addr;
4948 PCADDR npc = pc + 2;
4952 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
4954 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
4955 if (UNLIKELY(current_cpu->trace_result_p))
4956 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4957 current_cpu->h_tbit_set (opval);
4959 tmp_byte = ORQI (tmp_byte, 128);
4961 UQI opval = tmp_byte;
4962 if (UNLIKELY(current_cpu->trace_result_p))
4963 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4964 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
4968 current_cpu->done_insn (npc, status);
4972 // ********** trapa-compact: trapa #$uimm8
4975 sh2e_sem_trapa_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4976 sh2e::write_stacks &buf)
4978 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4979 sem_status status = SEM_STATUS_NORMAL;
4980 sh2e_scache* abuf = sem;
4981 unsigned long long written = 0;
4982 PCADDR pc = abuf->addr;
4983 PCADDR npc = pc + 2;
4985 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4987 current_cpu->done_insn (npc, status);
4991 // ********** tst-compact: tst $rm, $rn
4994 sh2e_sem_tst_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
4995 sh2e::write_stacks &buf)
4997 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
4998 sem_status status = SEM_STATUS_NORMAL;
4999 sh2e_scache* abuf = sem;
5000 unsigned long long written = 0;
5001 PCADDR pc = abuf->addr;
5002 PCADDR npc = pc + 2;
5005 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
5006 if (UNLIKELY(current_cpu->trace_result_p))
5007 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5008 current_cpu->h_tbit_set (opval);
5011 current_cpu->done_insn (npc, status);
5015 // ********** tsti-compact: tst #$uimm8, r0
5018 sh2e_sem_tsti_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
5019 sh2e::write_stacks &buf)
5021 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5022 sem_status status = SEM_STATUS_NORMAL;
5023 sh2e_scache* abuf = sem;
5024 unsigned long long written = 0;
5025 PCADDR pc = abuf->addr;
5026 PCADDR npc = pc + 2;
5029 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5030 if (UNLIKELY(current_cpu->trace_result_p))
5031 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5032 current_cpu->h_tbit_set (opval);
5035 current_cpu->done_insn (npc, status);
5039 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
5042 sh2e_sem_tstb_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
5043 sh2e::write_stacks &buf)
5045 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5046 sem_status status = SEM_STATUS_NORMAL;
5047 sh2e_scache* abuf = sem;
5048 unsigned long long written = 0;
5049 PCADDR pc = abuf->addr;
5050 PCADDR npc = pc + 2;
5054 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5056 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5057 if (UNLIKELY(current_cpu->trace_result_p))
5058 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
5059 current_cpu->h_tbit_set (opval);
5063 current_cpu->done_insn (npc, status);
5067 // ********** xor-compact: xor $rm64, $rn64
5070 sh2e_sem_xor_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
5071 sh2e::write_stacks &buf)
5073 #define FLD(f) abuf->fields.sfmt_and_compact.f
5074 sem_status status = SEM_STATUS_NORMAL;
5075 sh2e_scache* abuf = sem;
5076 unsigned long long written = 0;
5077 PCADDR pc = abuf->addr;
5078 PCADDR npc = pc + 2;
5081 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
5082 if (UNLIKELY(current_cpu->trace_result_p))
5083 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
5084 current_cpu->h_gr_set (FLD (f_rn), opval);
5087 current_cpu->done_insn (npc, status);
5091 // ********** xori-compact: xor #$uimm8, r0
5094 sh2e_sem_xori_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
5095 sh2e::write_stacks &buf)
5097 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5098 sem_status status = SEM_STATUS_NORMAL;
5099 sh2e_scache* abuf = sem;
5100 unsigned long long written = 0;
5101 PCADDR pc = abuf->addr;
5102 PCADDR npc = pc + 2;
5105 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5106 if (UNLIKELY(current_cpu->trace_result_p))
5107 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
5108 current_cpu->h_grc_set (((UINT) 0), opval);
5111 current_cpu->done_insn (npc, status);
5115 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
5118 sh2e_sem_xorb_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
5119 sh2e::write_stacks &buf)
5121 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5122 sem_status status = SEM_STATUS_NORMAL;
5123 sh2e_scache* abuf = sem;
5124 unsigned long long written = 0;
5125 PCADDR pc = abuf->addr;
5126 PCADDR npc = pc + 2;
5131 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5132 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
5134 UQI opval = tmp_data;
5135 if (UNLIKELY(current_cpu->trace_result_p))
5136 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
5137 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5141 current_cpu->done_insn (npc, status);
5145 // ********** xtrct-compact: xtrct $rm, $rn
5148 sh2e_sem_xtrct_compact (sh2e_cpu* current_cpu, sh2e_scache* sem, const int tick,
5149 sh2e::write_stacks &buf)
5151 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5152 sem_status status = SEM_STATUS_NORMAL;
5153 sh2e_scache* abuf = sem;
5154 unsigned long long written = 0;
5155 PCADDR pc = abuf->addr;
5156 PCADDR npc = pc + 2;
5159 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
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);
5165 current_cpu->done_insn (npc, status);