1 /* Simulator instruction semantics for sh4_nofpu.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 2000-2010 Red Hat, Inc.
7 This file is part of the Red Hat simulators.
16 #include "sh4_nofpu.h"
18 using namespace sh4_nofpu; // FIXME: namespace organization still wip
19 using namespace sh4_nofpu; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh4_nofpu_sem_x_invalid (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
27 sh4_nofpu::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh4_nofpu_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 sh4_nofpu_sem_add_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
50 sh4_nofpu::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh4_nofpu_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 sh4_nofpu_sem_addi_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
74 sh4_nofpu::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh4_nofpu_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 sh4_nofpu_sem_addc_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
98 sh4_nofpu::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh4_nofpu_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 sh4_nofpu_sem_addv_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
132 sh4_nofpu::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh4_nofpu_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 sh4_nofpu_sem_and_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
166 sh4_nofpu::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh4_nofpu_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 sh4_nofpu_sem_andi_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
190 sh4_nofpu::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh4_nofpu_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 sh4_nofpu_sem_andb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
214 sh4_nofpu::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh4_nofpu_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 sh4_nofpu_sem_bf_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
244 sh4_nofpu::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh4_nofpu_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 sh4_nofpu_sem_bfs_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
272 sh4_nofpu::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh4_nofpu_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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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 sh4_nofpu_sem_bra_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
309 sh4_nofpu::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh4_nofpu_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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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 sh4_nofpu_sem_braf_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
342 sh4_nofpu::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_divu_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh4_nofpu_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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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 sh4_nofpu_sem_bsr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
375 sh4_nofpu::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh4_nofpu_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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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 sh4_nofpu_sem_bsrf_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
414 sh4_nofpu::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_divu_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh4_nofpu_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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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 sh4_nofpu_sem_bt_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
453 sh4_nofpu::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh4_nofpu_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 sh4_nofpu_sem_bts_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
481 sh4_nofpu::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh4_nofpu_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) % sh4_nofpu::pipe_sz].push (sh4_nofpu::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 sh4_nofpu_sem_clrmac_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
518 sh4_nofpu::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh4_nofpu_scache* abuf = sem;
523 unsigned long long written = 0;
524 PCADDR pc = abuf->addr;
530 if (UNLIKELY(current_cpu->trace_result_p))
531 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
532 current_cpu->h_macl_set (opval);
536 if (UNLIKELY(current_cpu->trace_result_p))
537 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
538 current_cpu->h_mach_set (opval);
542 current_cpu->done_insn (npc, status);
546 // ********** clrs-compact: clrs
549 sh4_nofpu_sem_clrs_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
550 sh4_nofpu::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh4_nofpu_scache* abuf = sem;
555 unsigned long long written = 0;
556 PCADDR pc = abuf->addr;
561 if (UNLIKELY(current_cpu->trace_result_p))
562 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
563 current_cpu->h_sbit_set (opval);
566 current_cpu->done_insn (npc, status);
570 // ********** clrt-compact: clrt
573 sh4_nofpu_sem_clrt_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
574 sh4_nofpu::write_stacks &buf)
576 #define FLD(f) abuf->fields.fmt_empty.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh4_nofpu_scache* abuf = sem;
579 unsigned long long written = 0;
580 PCADDR pc = abuf->addr;
585 if (UNLIKELY(current_cpu->trace_result_p))
586 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
587 current_cpu->h_tbit_set (opval);
590 current_cpu->done_insn (npc, status);
594 // ********** cmpeq-compact: cmp/eq $rm, $rn
597 sh4_nofpu_sem_cmpeq_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
598 sh4_nofpu::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh4_nofpu_scache* abuf = sem;
603 unsigned long long written = 0;
604 PCADDR pc = abuf->addr;
608 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
609 if (UNLIKELY(current_cpu->trace_result_p))
610 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
611 current_cpu->h_tbit_set (opval);
614 current_cpu->done_insn (npc, status);
618 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
621 sh4_nofpu_sem_cmpeqi_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
622 sh4_nofpu::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_andi_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh4_nofpu_scache* abuf = sem;
627 unsigned long long written = 0;
628 PCADDR pc = abuf->addr;
632 BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
633 if (UNLIKELY(current_cpu->trace_result_p))
634 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
635 current_cpu->h_tbit_set (opval);
638 current_cpu->done_insn (npc, status);
642 // ********** cmpge-compact: cmp/ge $rm, $rn
645 sh4_nofpu_sem_cmpge_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
646 sh4_nofpu::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh4_nofpu_scache* abuf = sem;
651 unsigned long long written = 0;
652 PCADDR pc = abuf->addr;
656 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
657 if (UNLIKELY(current_cpu->trace_result_p))
658 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
659 current_cpu->h_tbit_set (opval);
662 current_cpu->done_insn (npc, status);
666 // ********** cmpgt-compact: cmp/gt $rm, $rn
669 sh4_nofpu_sem_cmpgt_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
670 sh4_nofpu::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh4_nofpu_scache* abuf = sem;
675 unsigned long long written = 0;
676 PCADDR pc = abuf->addr;
680 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
681 if (UNLIKELY(current_cpu->trace_result_p))
682 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
683 current_cpu->h_tbit_set (opval);
686 current_cpu->done_insn (npc, status);
690 // ********** cmphi-compact: cmp/hi $rm, $rn
693 sh4_nofpu_sem_cmphi_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
694 sh4_nofpu::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh4_nofpu_scache* abuf = sem;
699 unsigned long long written = 0;
700 PCADDR pc = abuf->addr;
704 BI opval = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
705 if (UNLIKELY(current_cpu->trace_result_p))
706 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
707 current_cpu->h_tbit_set (opval);
710 current_cpu->done_insn (npc, status);
714 // ********** cmphs-compact: cmp/hs $rm, $rn
717 sh4_nofpu_sem_cmphs_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
718 sh4_nofpu::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh4_nofpu_scache* abuf = sem;
723 unsigned long long written = 0;
724 PCADDR pc = abuf->addr;
728 BI opval = GEUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
729 if (UNLIKELY(current_cpu->trace_result_p))
730 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
731 current_cpu->h_tbit_set (opval);
734 current_cpu->done_insn (npc, status);
738 // ********** cmppl-compact: cmp/pl $rn
741 sh4_nofpu_sem_cmppl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
742 sh4_nofpu::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_divu_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh4_nofpu_scache* abuf = sem;
747 unsigned long long written = 0;
748 PCADDR pc = abuf->addr;
752 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
753 if (UNLIKELY(current_cpu->trace_result_p))
754 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
755 current_cpu->h_tbit_set (opval);
758 current_cpu->done_insn (npc, status);
762 // ********** cmppz-compact: cmp/pz $rn
765 sh4_nofpu_sem_cmppz_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
766 sh4_nofpu::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_divu_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh4_nofpu_scache* abuf = sem;
771 unsigned long long written = 0;
772 PCADDR pc = abuf->addr;
776 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), 0);
777 if (UNLIKELY(current_cpu->trace_result_p))
778 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
779 current_cpu->h_tbit_set (opval);
782 current_cpu->done_insn (npc, status);
786 // ********** cmpstr-compact: cmp/str $rm, $rn
789 sh4_nofpu_sem_cmpstr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
790 sh4_nofpu::write_stacks &buf)
792 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
793 sem_status status = SEM_STATUS_NORMAL;
794 sh4_nofpu_scache* abuf = sem;
795 unsigned long long written = 0;
796 PCADDR pc = abuf->addr;
802 tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
803 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
804 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
805 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
806 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
808 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
809 if (UNLIKELY(current_cpu->trace_result_p))
810 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
811 current_cpu->h_tbit_set (opval);
815 current_cpu->done_insn (npc, status);
819 // ********** div0s-compact: div0s $rm, $rn
822 sh4_nofpu_sem_div0s_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
823 sh4_nofpu::write_stacks &buf)
825 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
826 sem_status status = SEM_STATUS_NORMAL;
827 sh4_nofpu_scache* abuf = sem;
828 unsigned long long written = 0;
829 PCADDR pc = abuf->addr;
834 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
835 if (UNLIKELY(current_cpu->trace_result_p))
836 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
837 current_cpu->h_qbit_set (opval);
840 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
841 if (UNLIKELY(current_cpu->trace_result_p))
842 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
843 current_cpu->h_mbit_set (opval);
846 BI opval = ((EQSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31))) ? (0) : (1));
847 if (UNLIKELY(current_cpu->trace_result_p))
848 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
849 current_cpu->h_tbit_set (opval);
853 current_cpu->done_insn (npc, status);
857 // ********** div0u-compact: div0u
860 sh4_nofpu_sem_div0u_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
861 sh4_nofpu::write_stacks &buf)
863 #define FLD(f) abuf->fields.fmt_empty.f
864 sem_status status = SEM_STATUS_NORMAL;
865 sh4_nofpu_scache* abuf = sem;
866 unsigned long long written = 0;
867 PCADDR pc = abuf->addr;
873 if (UNLIKELY(current_cpu->trace_result_p))
874 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
875 current_cpu->h_tbit_set (opval);
879 if (UNLIKELY(current_cpu->trace_result_p))
880 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
881 current_cpu->h_qbit_set (opval);
885 if (UNLIKELY(current_cpu->trace_result_p))
886 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
887 current_cpu->h_mbit_set (opval);
891 current_cpu->done_insn (npc, status);
895 // ********** div1-compact: div1 $rm, $rn
898 sh4_nofpu_sem_div1_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
899 sh4_nofpu::write_stacks &buf)
901 #define FLD(f) abuf->fields.sfmt_macl_compact.f
902 sem_status status = SEM_STATUS_NORMAL;
903 sh4_nofpu_scache* abuf = sem;
904 unsigned long long written = 0;
905 PCADDR pc = abuf->addr;
912 tmp_oldq = current_cpu->h_qbit_get ();
914 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
915 if (UNLIKELY(current_cpu->trace_result_p))
916 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
917 current_cpu->h_qbit_set (opval);
920 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
921 if (UNLIKELY(current_cpu->trace_result_p))
922 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
923 current_cpu->h_grc_set (FLD (f_rn), opval);
925 if (NOTBI (tmp_oldq)) {
926 if (NOTBI (current_cpu->h_mbit_get ())) {
928 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
930 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
931 if (UNLIKELY(current_cpu->trace_result_p))
932 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
933 current_cpu->h_grc_set (FLD (f_rn), opval);
935 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
936 if (NOTBI (current_cpu->h_qbit_get ())) {
938 BI opval = ((tmp_tmp1) ? (1) : (0));
939 if (UNLIKELY(current_cpu->trace_result_p))
940 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
941 current_cpu->h_qbit_set (opval);
945 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
946 if (UNLIKELY(current_cpu->trace_result_p))
947 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
948 current_cpu->h_qbit_set (opval);
954 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
956 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
957 if (UNLIKELY(current_cpu->trace_result_p))
958 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
959 current_cpu->h_grc_set (FLD (f_rn), opval);
961 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
962 if (NOTBI (current_cpu->h_qbit_get ())) {
964 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
965 if (UNLIKELY(current_cpu->trace_result_p))
966 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
967 current_cpu->h_qbit_set (opval);
971 BI opval = ((tmp_tmp1) ? (1) : (0));
972 if (UNLIKELY(current_cpu->trace_result_p))
973 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
974 current_cpu->h_qbit_set (opval);
980 if (NOTBI (current_cpu->h_mbit_get ())) {
982 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
984 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
985 if (UNLIKELY(current_cpu->trace_result_p))
986 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
987 current_cpu->h_grc_set (FLD (f_rn), opval);
989 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
990 if (NOTBI (current_cpu->h_qbit_get ())) {
992 BI opval = ((tmp_tmp1) ? (1) : (0));
993 if (UNLIKELY(current_cpu->trace_result_p))
994 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
995 current_cpu->h_qbit_set (opval);
999 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1000 if (UNLIKELY(current_cpu->trace_result_p))
1001 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1002 current_cpu->h_qbit_set (opval);
1008 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
1010 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
1011 if (UNLIKELY(current_cpu->trace_result_p))
1012 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1013 current_cpu->h_grc_set (FLD (f_rn), opval);
1015 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
1016 if (NOTBI (current_cpu->h_qbit_get ())) {
1018 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1019 if (UNLIKELY(current_cpu->trace_result_p))
1020 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1021 current_cpu->h_qbit_set (opval);
1025 BI opval = ((tmp_tmp1) ? (1) : (0));
1026 if (UNLIKELY(current_cpu->trace_result_p))
1027 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1028 current_cpu->h_qbit_set (opval);
1035 BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1036 if (UNLIKELY(current_cpu->trace_result_p))
1037 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1038 current_cpu->h_tbit_set (opval);
1042 current_cpu->done_insn (npc, status);
1046 // ********** divu-compact: divu r0, $rn
1049 sh4_nofpu_sem_divu_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1050 sh4_nofpu::write_stacks &buf)
1052 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1053 sem_status status = SEM_STATUS_NORMAL;
1054 sh4_nofpu_scache* abuf = sem;
1055 unsigned long long written = 0;
1056 PCADDR pc = abuf->addr;
1057 PCADDR npc = pc + 2;
1060 SI opval = UDIVSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1061 if (UNLIKELY(current_cpu->trace_result_p))
1062 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1063 current_cpu->h_grc_set (FLD (f_rn), opval);
1066 current_cpu->done_insn (npc, status);
1070 // ********** mulr-compact: mulr r0, $rn
1073 sh4_nofpu_sem_mulr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1074 sh4_nofpu::write_stacks &buf)
1076 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1077 sem_status status = SEM_STATUS_NORMAL;
1078 sh4_nofpu_scache* abuf = sem;
1079 unsigned long long written = 0;
1080 PCADDR pc = abuf->addr;
1081 PCADDR npc = pc + 2;
1084 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1085 if (UNLIKELY(current_cpu->trace_result_p))
1086 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1087 current_cpu->h_grc_set (FLD (f_rn), opval);
1090 current_cpu->done_insn (npc, status);
1094 // ********** dmulsl-compact: dmuls.l $rm, $rn
1097 sh4_nofpu_sem_dmulsl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1098 sh4_nofpu::write_stacks &buf)
1100 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1101 sem_status status = SEM_STATUS_NORMAL;
1102 sh4_nofpu_scache* abuf = sem;
1103 unsigned long long written = 0;
1104 PCADDR pc = abuf->addr;
1105 PCADDR npc = pc + 2;
1109 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1111 SI opval = SUBWORDDISI (tmp_result, 0);
1112 if (UNLIKELY(current_cpu->trace_result_p))
1113 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1114 current_cpu->h_mach_set (opval);
1117 SI opval = SUBWORDDISI (tmp_result, 1);
1118 if (UNLIKELY(current_cpu->trace_result_p))
1119 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1120 current_cpu->h_macl_set (opval);
1124 current_cpu->done_insn (npc, status);
1128 // ********** dmulul-compact: dmulu.l $rm, $rn
1131 sh4_nofpu_sem_dmulul_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1132 sh4_nofpu::write_stacks &buf)
1134 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1135 sem_status status = SEM_STATUS_NORMAL;
1136 sh4_nofpu_scache* abuf = sem;
1137 unsigned long long written = 0;
1138 PCADDR pc = abuf->addr;
1139 PCADDR npc = pc + 2;
1143 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1145 SI opval = SUBWORDDISI (tmp_result, 0);
1146 if (UNLIKELY(current_cpu->trace_result_p))
1147 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1148 current_cpu->h_mach_set (opval);
1151 SI opval = SUBWORDDISI (tmp_result, 1);
1152 if (UNLIKELY(current_cpu->trace_result_p))
1153 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1154 current_cpu->h_macl_set (opval);
1158 current_cpu->done_insn (npc, status);
1162 // ********** dt-compact: dt $rn
1165 sh4_nofpu_sem_dt_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1166 sh4_nofpu::write_stacks &buf)
1168 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1169 sem_status status = SEM_STATUS_NORMAL;
1170 sh4_nofpu_scache* abuf = sem;
1171 unsigned long long written = 0;
1172 PCADDR pc = abuf->addr;
1173 PCADDR npc = pc + 2;
1177 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1178 if (UNLIKELY(current_cpu->trace_result_p))
1179 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1180 current_cpu->h_grc_set (FLD (f_rn), opval);
1183 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1184 if (UNLIKELY(current_cpu->trace_result_p))
1185 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1186 current_cpu->h_tbit_set (opval);
1190 current_cpu->done_insn (npc, status);
1194 // ********** extsb-compact: exts.b $rm, $rn
1197 sh4_nofpu_sem_extsb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1198 sh4_nofpu::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh4_nofpu_scache* abuf = sem;
1203 unsigned long long written = 0;
1204 PCADDR pc = abuf->addr;
1205 PCADDR npc = pc + 2;
1208 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1209 if (UNLIKELY(current_cpu->trace_result_p))
1210 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1211 current_cpu->h_grc_set (FLD (f_rn), opval);
1214 current_cpu->done_insn (npc, status);
1218 // ********** extsw-compact: exts.w $rm, $rn
1221 sh4_nofpu_sem_extsw_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1222 sh4_nofpu::write_stacks &buf)
1224 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh4_nofpu_scache* abuf = sem;
1227 unsigned long long written = 0;
1228 PCADDR pc = abuf->addr;
1229 PCADDR npc = pc + 2;
1232 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1233 if (UNLIKELY(current_cpu->trace_result_p))
1234 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1235 current_cpu->h_grc_set (FLD (f_rn), opval);
1238 current_cpu->done_insn (npc, status);
1242 // ********** extub-compact: extu.b $rm, $rn
1245 sh4_nofpu_sem_extub_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1246 sh4_nofpu::write_stacks &buf)
1248 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1249 sem_status status = SEM_STATUS_NORMAL;
1250 sh4_nofpu_scache* abuf = sem;
1251 unsigned long long written = 0;
1252 PCADDR pc = abuf->addr;
1253 PCADDR npc = pc + 2;
1256 SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1257 if (UNLIKELY(current_cpu->trace_result_p))
1258 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1259 current_cpu->h_grc_set (FLD (f_rn), opval);
1262 current_cpu->done_insn (npc, status);
1266 // ********** extuw-compact: extu.w $rm, $rn
1269 sh4_nofpu_sem_extuw_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1270 sh4_nofpu::write_stacks &buf)
1272 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1273 sem_status status = SEM_STATUS_NORMAL;
1274 sh4_nofpu_scache* abuf = sem;
1275 unsigned long long written = 0;
1276 PCADDR pc = abuf->addr;
1277 PCADDR npc = pc + 2;
1280 SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1281 if (UNLIKELY(current_cpu->trace_result_p))
1282 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1283 current_cpu->h_grc_set (FLD (f_rn), opval);
1286 current_cpu->done_insn (npc, status);
1290 // ********** frchg-compact: frchg
1293 sh4_nofpu_sem_frchg_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1294 sh4_nofpu::write_stacks &buf)
1296 #define FLD(f) abuf->fields.fmt_empty.f
1297 sem_status status = SEM_STATUS_NORMAL;
1298 sh4_nofpu_scache* abuf = sem;
1299 unsigned long long written = 0;
1300 PCADDR pc = abuf->addr;
1301 PCADDR npc = pc + 2;
1304 BI opval = NOTBI (current_cpu->h_frbit_get ());
1305 if (UNLIKELY(current_cpu->trace_result_p))
1306 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
1307 current_cpu->h_frbit_set (opval);
1310 current_cpu->done_insn (npc, status);
1314 // ********** fschg-compact: fschg
1317 sh4_nofpu_sem_fschg_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1318 sh4_nofpu::write_stacks &buf)
1320 #define FLD(f) abuf->fields.fmt_empty.f
1321 sem_status status = SEM_STATUS_NORMAL;
1322 sh4_nofpu_scache* abuf = sem;
1323 unsigned long long written = 0;
1324 PCADDR pc = abuf->addr;
1325 PCADDR npc = pc + 2;
1328 BI opval = NOTBI (current_cpu->h_szbit_get ());
1329 if (UNLIKELY(current_cpu->trace_result_p))
1330 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
1331 current_cpu->h_szbit_set (opval);
1334 current_cpu->done_insn (npc, status);
1338 // ********** jmp-compact: jmp @$rn
1341 sh4_nofpu_sem_jmp_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1342 sh4_nofpu::write_stacks &buf)
1344 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1345 sem_status status = SEM_STATUS_NORMAL;
1346 sh4_nofpu_scache* abuf = sem;
1347 unsigned long long written = 0;
1348 PCADDR pc = abuf->addr;
1349 PCADDR npc = pc + 2;
1353 UDI opval = ADDDI (pc, 2);
1354 if (UNLIKELY(current_cpu->trace_result_p))
1355 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1356 current_cpu->branch (opval, npc, status);
1358 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1360 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1361 buf.h_pc_writes [(tick + 1) % sh4_nofpu::pipe_sz].push (sh4_nofpu::write<UDI>(pc, opval));
1362 if (UNLIKELY(current_cpu->trace_result_p))
1363 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1365 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1368 current_cpu->done_cti_insn (npc, status);
1372 // ********** jsr-compact: jsr @$rn
1375 sh4_nofpu_sem_jsr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1376 sh4_nofpu::write_stacks &buf)
1378 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1379 sem_status status = SEM_STATUS_NORMAL;
1380 sh4_nofpu_scache* abuf = sem;
1381 unsigned long long written = 0;
1382 PCADDR pc = abuf->addr;
1383 PCADDR npc = pc + 2;
1387 SI opval = ADDDI (pc, 4);
1388 buf.h_pr_writes [(tick + 1) % sh4_nofpu::pipe_sz].push (sh4_nofpu::write<SI>(pc, opval));
1389 if (UNLIKELY(current_cpu->trace_result_p))
1390 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1393 UDI opval = ADDDI (pc, 2);
1394 if (UNLIKELY(current_cpu->trace_result_p))
1395 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1396 current_cpu->branch (opval, npc, status);
1398 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1400 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1401 buf.h_pc_writes [(tick + 1) % sh4_nofpu::pipe_sz].push (sh4_nofpu::write<UDI>(pc, opval));
1402 if (UNLIKELY(current_cpu->trace_result_p))
1403 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1405 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1408 current_cpu->done_cti_insn (npc, status);
1412 // ********** ldc-gbr-compact: ldc $rn, gbr
1415 sh4_nofpu_sem_ldc_gbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1416 sh4_nofpu::write_stacks &buf)
1418 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1419 sem_status status = SEM_STATUS_NORMAL;
1420 sh4_nofpu_scache* abuf = sem;
1421 unsigned long long written = 0;
1422 PCADDR pc = abuf->addr;
1423 PCADDR npc = pc + 2;
1426 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1427 if (UNLIKELY(current_cpu->trace_result_p))
1428 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1429 current_cpu->h_gbr_set (opval);
1432 current_cpu->done_insn (npc, status);
1436 // ********** ldc-vbr-compact: ldc $rn, vbr
1439 sh4_nofpu_sem_ldc_vbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1440 sh4_nofpu::write_stacks &buf)
1442 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1443 sem_status status = SEM_STATUS_NORMAL;
1444 sh4_nofpu_scache* abuf = sem;
1445 unsigned long long written = 0;
1446 PCADDR pc = abuf->addr;
1447 PCADDR npc = pc + 2;
1450 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1451 if (UNLIKELY(current_cpu->trace_result_p))
1452 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1453 current_cpu->h_vbr_set (opval);
1456 current_cpu->done_insn (npc, status);
1460 // ********** ldc-sr-compact: ldc $rn, sr
1463 sh4_nofpu_sem_ldc_sr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1464 sh4_nofpu::write_stacks &buf)
1466 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1467 sem_status status = SEM_STATUS_NORMAL;
1468 sh4_nofpu_scache* abuf = sem;
1469 unsigned long long written = 0;
1470 PCADDR pc = abuf->addr;
1471 PCADDR npc = pc + 2;
1474 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1475 if (UNLIKELY(current_cpu->trace_result_p))
1476 current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << " ";
1477 current_cpu->hardware.h_sr = opval;
1480 current_cpu->done_insn (npc, status);
1484 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
1487 sh4_nofpu_sem_ldcl_gbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1488 sh4_nofpu::write_stacks &buf)
1490 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1491 sem_status status = SEM_STATUS_NORMAL;
1492 sh4_nofpu_scache* abuf = sem;
1493 unsigned long long written = 0;
1494 PCADDR pc = abuf->addr;
1495 PCADDR npc = pc + 2;
1499 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1500 if (UNLIKELY(current_cpu->trace_result_p))
1501 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1502 current_cpu->h_gbr_set (opval);
1505 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1506 if (UNLIKELY(current_cpu->trace_result_p))
1507 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1508 current_cpu->h_grc_set (FLD (f_rn), opval);
1512 current_cpu->done_insn (npc, status);
1516 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
1519 sh4_nofpu_sem_ldcl_vbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1520 sh4_nofpu::write_stacks &buf)
1522 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1523 sem_status status = SEM_STATUS_NORMAL;
1524 sh4_nofpu_scache* abuf = sem;
1525 unsigned long long written = 0;
1526 PCADDR pc = abuf->addr;
1527 PCADDR npc = pc + 2;
1531 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1532 if (UNLIKELY(current_cpu->trace_result_p))
1533 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1534 current_cpu->h_vbr_set (opval);
1537 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1538 if (UNLIKELY(current_cpu->trace_result_p))
1539 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1540 current_cpu->h_grc_set (FLD (f_rn), opval);
1544 current_cpu->done_insn (npc, status);
1548 // ********** lds-mach-compact: lds $rn, mach
1551 sh4_nofpu_sem_lds_mach_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1552 sh4_nofpu::write_stacks &buf)
1554 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1555 sem_status status = SEM_STATUS_NORMAL;
1556 sh4_nofpu_scache* abuf = sem;
1557 unsigned long long written = 0;
1558 PCADDR pc = abuf->addr;
1559 PCADDR npc = pc + 2;
1562 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1563 if (UNLIKELY(current_cpu->trace_result_p))
1564 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1565 current_cpu->h_mach_set (opval);
1568 current_cpu->done_insn (npc, status);
1572 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
1575 sh4_nofpu_sem_ldsl_mach_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1576 sh4_nofpu::write_stacks &buf)
1578 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1579 sem_status status = SEM_STATUS_NORMAL;
1580 sh4_nofpu_scache* abuf = sem;
1581 unsigned long long written = 0;
1582 PCADDR pc = abuf->addr;
1583 PCADDR npc = pc + 2;
1587 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1588 if (UNLIKELY(current_cpu->trace_result_p))
1589 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1590 current_cpu->h_mach_set (opval);
1593 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1594 if (UNLIKELY(current_cpu->trace_result_p))
1595 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1596 current_cpu->h_grc_set (FLD (f_rn), opval);
1600 current_cpu->done_insn (npc, status);
1604 // ********** lds-macl-compact: lds $rn, macl
1607 sh4_nofpu_sem_lds_macl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1608 sh4_nofpu::write_stacks &buf)
1610 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1611 sem_status status = SEM_STATUS_NORMAL;
1612 sh4_nofpu_scache* abuf = sem;
1613 unsigned long long written = 0;
1614 PCADDR pc = abuf->addr;
1615 PCADDR npc = pc + 2;
1618 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1619 if (UNLIKELY(current_cpu->trace_result_p))
1620 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1621 current_cpu->h_macl_set (opval);
1624 current_cpu->done_insn (npc, status);
1628 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
1631 sh4_nofpu_sem_ldsl_macl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1632 sh4_nofpu::write_stacks &buf)
1634 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1635 sem_status status = SEM_STATUS_NORMAL;
1636 sh4_nofpu_scache* abuf = sem;
1637 unsigned long long written = 0;
1638 PCADDR pc = abuf->addr;
1639 PCADDR npc = pc + 2;
1643 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1644 if (UNLIKELY(current_cpu->trace_result_p))
1645 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1646 current_cpu->h_macl_set (opval);
1649 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1650 if (UNLIKELY(current_cpu->trace_result_p))
1651 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1652 current_cpu->h_grc_set (FLD (f_rn), opval);
1656 current_cpu->done_insn (npc, status);
1660 // ********** lds-pr-compact: lds $rn, pr
1663 sh4_nofpu_sem_lds_pr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1664 sh4_nofpu::write_stacks &buf)
1666 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1667 sem_status status = SEM_STATUS_NORMAL;
1668 sh4_nofpu_scache* abuf = sem;
1669 unsigned long long written = 0;
1670 PCADDR pc = abuf->addr;
1671 PCADDR npc = pc + 2;
1674 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1675 if (UNLIKELY(current_cpu->trace_result_p))
1676 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1677 current_cpu->h_pr_set (opval);
1680 current_cpu->done_insn (npc, status);
1684 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
1687 sh4_nofpu_sem_ldsl_pr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1688 sh4_nofpu::write_stacks &buf)
1690 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1691 sem_status status = SEM_STATUS_NORMAL;
1692 sh4_nofpu_scache* abuf = sem;
1693 unsigned long long written = 0;
1694 PCADDR pc = abuf->addr;
1695 PCADDR npc = pc + 2;
1699 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1700 if (UNLIKELY(current_cpu->trace_result_p))
1701 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1702 current_cpu->h_pr_set (opval);
1705 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1706 if (UNLIKELY(current_cpu->trace_result_p))
1707 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1708 current_cpu->h_grc_set (FLD (f_rn), opval);
1712 current_cpu->done_insn (npc, status);
1716 // ********** macl-compact: mac.l @${rm}+, @${rn}+
1719 sh4_nofpu_sem_macl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1720 sh4_nofpu::write_stacks &buf)
1722 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1723 sem_status status = SEM_STATUS_NORMAL;
1724 sh4_nofpu_scache* abuf = sem;
1725 unsigned long long written = 0;
1726 PCADDR pc = abuf->addr;
1727 PCADDR npc = pc + 2;
1735 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1737 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1738 if (UNLIKELY(current_cpu->trace_result_p))
1739 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1740 current_cpu->h_grc_set (FLD (f_rn), opval);
1742 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1745 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1746 if (UNLIKELY(current_cpu->trace_result_p))
1747 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1748 current_cpu->h_grc_set (FLD (f_rn), opval);
1751 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1752 written |= (1ULL << 11);
1753 if (UNLIKELY(current_cpu->trace_result_p))
1754 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1755 current_cpu->h_grc_set (FLD (f_rm), opval);
1759 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1761 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1762 written |= (1ULL << 11);
1763 if (UNLIKELY(current_cpu->trace_result_p))
1764 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1765 current_cpu->h_grc_set (FLD (f_rm), opval);
1767 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
1768 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1769 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
1771 if (current_cpu->h_sbit_get ()) {
1775 tmp_max = SRLDI (INVDI (0), 16);
1776 tmp_min = SRLDI (INVDI (0), 15);
1777 if (GTDI (tmp_result, tmp_max)) {
1778 tmp_result = tmp_max;
1780 if (LTDI (tmp_result, tmp_min)) {
1781 tmp_result = tmp_min;
1787 SI opval = SUBWORDDISI (tmp_result, 0);
1788 if (UNLIKELY(current_cpu->trace_result_p))
1789 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1790 current_cpu->h_mach_set (opval);
1793 SI opval = SUBWORDDISI (tmp_result, 1);
1794 if (UNLIKELY(current_cpu->trace_result_p))
1795 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1796 current_cpu->h_macl_set (opval);
1801 abuf->written = written;
1802 current_cpu->done_insn (npc, status);
1806 // ********** macw-compact: mac.w @${rm}+, @${rn}+
1809 sh4_nofpu_sem_macw_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1810 sh4_nofpu::write_stacks &buf)
1812 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1813 sem_status status = SEM_STATUS_NORMAL;
1814 sh4_nofpu_scache* abuf = sem;
1815 unsigned long long written = 0;
1816 PCADDR pc = abuf->addr;
1817 PCADDR npc = pc + 2;
1825 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1827 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1828 if (UNLIKELY(current_cpu->trace_result_p))
1829 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1830 current_cpu->h_grc_set (FLD (f_rn), opval);
1832 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1835 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1836 if (UNLIKELY(current_cpu->trace_result_p))
1837 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1838 current_cpu->h_grc_set (FLD (f_rn), opval);
1841 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1842 written |= (1ULL << 11);
1843 if (UNLIKELY(current_cpu->trace_result_p))
1844 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1845 current_cpu->h_grc_set (FLD (f_rm), opval);
1849 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1851 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1852 written |= (1ULL << 11);
1853 if (UNLIKELY(current_cpu->trace_result_p))
1854 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1855 current_cpu->h_grc_set (FLD (f_rm), opval);
1857 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
1858 if (current_cpu->h_sbit_get ()) {
1860 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
1863 written |= (1ULL << 9);
1864 if (UNLIKELY(current_cpu->trace_result_p))
1865 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1866 current_cpu->h_mach_set (opval);
1870 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
1871 written |= (1ULL << 10);
1872 if (UNLIKELY(current_cpu->trace_result_p))
1873 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1874 current_cpu->h_macl_set (opval);
1879 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1880 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
1882 SI opval = SUBWORDDISI (tmp_result, 0);
1883 written |= (1ULL << 9);
1884 if (UNLIKELY(current_cpu->trace_result_p))
1885 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1886 current_cpu->h_mach_set (opval);
1889 SI opval = SUBWORDDISI (tmp_result, 1);
1890 written |= (1ULL << 10);
1891 if (UNLIKELY(current_cpu->trace_result_p))
1892 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1893 current_cpu->h_macl_set (opval);
1899 abuf->written = written;
1900 current_cpu->done_insn (npc, status);
1904 // ********** mov-compact: mov $rm64, $rn64
1907 sh4_nofpu_sem_mov_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1908 sh4_nofpu::write_stacks &buf)
1910 #define FLD(f) abuf->fields.sfmt_and_compact.f
1911 sem_status status = SEM_STATUS_NORMAL;
1912 sh4_nofpu_scache* abuf = sem;
1913 unsigned long long written = 0;
1914 PCADDR pc = abuf->addr;
1915 PCADDR npc = pc + 2;
1918 DI opval = current_cpu->h_gr_get (FLD (f_rm));
1919 if (UNLIKELY(current_cpu->trace_result_p))
1920 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1921 current_cpu->h_gr_set (FLD (f_rn), opval);
1924 current_cpu->done_insn (npc, status);
1928 // ********** movi-compact: mov #$imm8, $rn
1931 sh4_nofpu_sem_movi_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1932 sh4_nofpu::write_stacks &buf)
1934 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1935 sem_status status = SEM_STATUS_NORMAL;
1936 sh4_nofpu_scache* abuf = sem;
1937 unsigned long long written = 0;
1938 PCADDR pc = abuf->addr;
1939 PCADDR npc = pc + 2;
1942 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
1943 if (UNLIKELY(current_cpu->trace_result_p))
1944 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1945 current_cpu->h_grc_set (FLD (f_rn), opval);
1948 current_cpu->done_insn (npc, status);
1952 // ********** movi20-compact: movi20 #$imm20, $rn
1955 sh4_nofpu_sem_movi20_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1956 sh4_nofpu::write_stacks &buf)
1958 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
1959 sem_status status = SEM_STATUS_NORMAL;
1960 sh4_nofpu_scache* abuf = sem;
1961 unsigned long long written = 0;
1962 PCADDR pc = abuf->addr;
1963 PCADDR npc = pc + 4;
1966 SI opval = FLD (f_imm20);
1967 if (UNLIKELY(current_cpu->trace_result_p))
1968 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1969 current_cpu->h_grc_set (FLD (f_rn), opval);
1972 current_cpu->done_insn (npc, status);
1976 // ********** movb1-compact: mov.b $rm, @$rn
1979 sh4_nofpu_sem_movb1_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
1980 sh4_nofpu::write_stacks &buf)
1982 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1983 sem_status status = SEM_STATUS_NORMAL;
1984 sh4_nofpu_scache* abuf = sem;
1985 unsigned long long written = 0;
1986 PCADDR pc = abuf->addr;
1987 PCADDR npc = pc + 2;
1990 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1991 if (UNLIKELY(current_cpu->trace_result_p))
1992 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1993 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1996 current_cpu->done_insn (npc, status);
2000 // ********** movb2-compact: mov.b $rm, @-$rn
2003 sh4_nofpu_sem_movb2_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2004 sh4_nofpu::write_stacks &buf)
2006 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2007 sem_status status = SEM_STATUS_NORMAL;
2008 sh4_nofpu_scache* abuf = sem;
2009 unsigned long long written = 0;
2010 PCADDR pc = abuf->addr;
2011 PCADDR npc = pc + 2;
2015 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
2017 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2018 if (UNLIKELY(current_cpu->trace_result_p))
2019 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2020 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2023 SI opval = tmp_addr;
2024 if (UNLIKELY(current_cpu->trace_result_p))
2025 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2026 current_cpu->h_grc_set (FLD (f_rn), opval);
2030 current_cpu->done_insn (npc, status);
2034 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
2037 sh4_nofpu_sem_movb3_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2038 sh4_nofpu::write_stacks &buf)
2040 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2041 sem_status status = SEM_STATUS_NORMAL;
2042 sh4_nofpu_scache* abuf = sem;
2043 unsigned long long written = 0;
2044 PCADDR pc = abuf->addr;
2045 PCADDR npc = pc + 2;
2048 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2049 if (UNLIKELY(current_cpu->trace_result_p))
2050 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 << " ";
2051 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2054 current_cpu->done_insn (npc, status);
2058 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
2061 sh4_nofpu_sem_movb4_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2062 sh4_nofpu::write_stacks &buf)
2064 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2065 sem_status status = SEM_STATUS_NORMAL;
2066 sh4_nofpu_scache* abuf = sem;
2067 unsigned long long written = 0;
2068 PCADDR pc = abuf->addr;
2069 PCADDR npc = pc + 2;
2073 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
2075 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2076 if (UNLIKELY(current_cpu->trace_result_p))
2077 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2078 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2082 current_cpu->done_insn (npc, status);
2086 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
2089 sh4_nofpu_sem_movb5_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2090 sh4_nofpu::write_stacks &buf)
2092 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2093 sem_status status = SEM_STATUS_NORMAL;
2094 sh4_nofpu_scache* abuf = sem;
2095 unsigned long long written = 0;
2096 PCADDR pc = abuf->addr;
2097 PCADDR npc = pc + 2;
2101 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2103 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2104 if (UNLIKELY(current_cpu->trace_result_p))
2105 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2106 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2110 current_cpu->done_insn (npc, status);
2114 // ********** movb6-compact: mov.b @$rm, $rn
2117 sh4_nofpu_sem_movb6_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2118 sh4_nofpu::write_stacks &buf)
2120 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2121 sem_status status = SEM_STATUS_NORMAL;
2122 sh4_nofpu_scache* abuf = sem;
2123 unsigned long long written = 0;
2124 PCADDR pc = abuf->addr;
2125 PCADDR npc = pc + 2;
2128 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2129 if (UNLIKELY(current_cpu->trace_result_p))
2130 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2131 current_cpu->h_grc_set (FLD (f_rn), opval);
2134 current_cpu->done_insn (npc, status);
2138 // ********** movb7-compact: mov.b @${rm}+, $rn
2141 sh4_nofpu_sem_movb7_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2142 sh4_nofpu::write_stacks &buf)
2144 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2145 sem_status status = SEM_STATUS_NORMAL;
2146 sh4_nofpu_scache* abuf = sem;
2147 unsigned long long written = 0;
2148 PCADDR pc = abuf->addr;
2149 PCADDR npc = pc + 2;
2153 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2154 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2156 SI opval = EXTQISI (tmp_data);
2157 written |= (1ULL << 4);
2158 if (UNLIKELY(current_cpu->trace_result_p))
2159 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2160 current_cpu->h_grc_set (FLD (f_rm), opval);
2164 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2165 written |= (1ULL << 4);
2166 if (UNLIKELY(current_cpu->trace_result_p))
2167 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2168 current_cpu->h_grc_set (FLD (f_rm), opval);
2172 SI opval = EXTQISI (tmp_data);
2173 if (UNLIKELY(current_cpu->trace_result_p))
2174 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2175 current_cpu->h_grc_set (FLD (f_rn), opval);
2179 abuf->written = written;
2180 current_cpu->done_insn (npc, status);
2184 // ********** movb8-compact: mov.b @(r0, $rm), $rn
2187 sh4_nofpu_sem_movb8_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2188 sh4_nofpu::write_stacks &buf)
2190 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2191 sem_status status = SEM_STATUS_NORMAL;
2192 sh4_nofpu_scache* abuf = sem;
2193 unsigned long long written = 0;
2194 PCADDR pc = abuf->addr;
2195 PCADDR npc = pc + 2;
2198 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2199 if (UNLIKELY(current_cpu->trace_result_p))
2200 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2201 current_cpu->h_grc_set (FLD (f_rn), opval);
2204 current_cpu->done_insn (npc, status);
2208 // ********** movb9-compact: mov.b @($imm8, gbr), r0
2211 sh4_nofpu_sem_movb9_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2212 sh4_nofpu::write_stacks &buf)
2214 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2215 sem_status status = SEM_STATUS_NORMAL;
2216 sh4_nofpu_scache* abuf = sem;
2217 unsigned long long written = 0;
2218 PCADDR pc = abuf->addr;
2219 PCADDR npc = pc + 2;
2222 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
2223 if (UNLIKELY(current_cpu->trace_result_p))
2224 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2225 current_cpu->h_grc_set (((UINT) 0), opval);
2228 current_cpu->done_insn (npc, status);
2232 // ********** movb10-compact: mov.b @($imm4, $rm), r0
2235 sh4_nofpu_sem_movb10_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2236 sh4_nofpu::write_stacks &buf)
2238 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2239 sem_status status = SEM_STATUS_NORMAL;
2240 sh4_nofpu_scache* abuf = sem;
2241 unsigned long long written = 0;
2242 PCADDR pc = abuf->addr;
2243 PCADDR npc = pc + 2;
2246 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
2247 if (UNLIKELY(current_cpu->trace_result_p))
2248 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2249 current_cpu->h_grc_set (((UINT) 0), opval);
2252 current_cpu->done_insn (npc, status);
2256 // ********** movl1-compact: mov.l $rm, @$rn
2259 sh4_nofpu_sem_movl1_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2260 sh4_nofpu::write_stacks &buf)
2262 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2263 sem_status status = SEM_STATUS_NORMAL;
2264 sh4_nofpu_scache* abuf = sem;
2265 unsigned long long written = 0;
2266 PCADDR pc = abuf->addr;
2267 PCADDR npc = pc + 2;
2270 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2271 if (UNLIKELY(current_cpu->trace_result_p))
2272 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2273 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2276 current_cpu->done_insn (npc, status);
2280 // ********** movl2-compact: mov.l $rm, @-$rn
2283 sh4_nofpu_sem_movl2_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2284 sh4_nofpu::write_stacks &buf)
2286 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2287 sem_status status = SEM_STATUS_NORMAL;
2288 sh4_nofpu_scache* abuf = sem;
2289 unsigned long long written = 0;
2290 PCADDR pc = abuf->addr;
2291 PCADDR npc = pc + 2;
2295 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2297 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2298 if (UNLIKELY(current_cpu->trace_result_p))
2299 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2300 current_cpu->SETMEMSI (pc, tmp_addr, opval);
2303 SI opval = tmp_addr;
2304 if (UNLIKELY(current_cpu->trace_result_p))
2305 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2306 current_cpu->h_grc_set (FLD (f_rn), opval);
2310 current_cpu->done_insn (npc, status);
2314 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
2317 sh4_nofpu_sem_movl3_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2318 sh4_nofpu::write_stacks &buf)
2320 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2321 sem_status status = SEM_STATUS_NORMAL;
2322 sh4_nofpu_scache* abuf = sem;
2323 unsigned long long written = 0;
2324 PCADDR pc = abuf->addr;
2325 PCADDR npc = pc + 2;
2328 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2329 if (UNLIKELY(current_cpu->trace_result_p))
2330 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 << " ";
2331 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2334 current_cpu->done_insn (npc, status);
2338 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
2341 sh4_nofpu_sem_movl4_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2342 sh4_nofpu::write_stacks &buf)
2344 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
2345 sem_status status = SEM_STATUS_NORMAL;
2346 sh4_nofpu_scache* abuf = sem;
2347 unsigned long long written = 0;
2348 PCADDR pc = abuf->addr;
2349 PCADDR npc = pc + 2;
2352 SI opval = current_cpu->h_grc_get (((UINT) 0));
2353 if (UNLIKELY(current_cpu->trace_result_p))
2354 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2355 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
2358 current_cpu->done_insn (npc, status);
2362 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
2365 sh4_nofpu_sem_movl5_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2366 sh4_nofpu::write_stacks &buf)
2368 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2369 sem_status status = SEM_STATUS_NORMAL;
2370 sh4_nofpu_scache* abuf = sem;
2371 unsigned long long written = 0;
2372 PCADDR pc = abuf->addr;
2373 PCADDR npc = pc + 2;
2376 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2377 if (UNLIKELY(current_cpu->trace_result_p))
2378 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 << " ";
2379 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
2382 current_cpu->done_insn (npc, status);
2386 // ********** movl6-compact: mov.l @$rm, $rn
2389 sh4_nofpu_sem_movl6_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2390 sh4_nofpu::write_stacks &buf)
2392 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2393 sem_status status = SEM_STATUS_NORMAL;
2394 sh4_nofpu_scache* abuf = sem;
2395 unsigned long long written = 0;
2396 PCADDR pc = abuf->addr;
2397 PCADDR npc = pc + 2;
2400 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2401 if (UNLIKELY(current_cpu->trace_result_p))
2402 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2403 current_cpu->h_grc_set (FLD (f_rn), opval);
2406 current_cpu->done_insn (npc, status);
2410 // ********** movl7-compact: mov.l @${rm}+, $rn
2413 sh4_nofpu_sem_movl7_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2414 sh4_nofpu::write_stacks &buf)
2416 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2417 sem_status status = SEM_STATUS_NORMAL;
2418 sh4_nofpu_scache* abuf = sem;
2419 unsigned long long written = 0;
2420 PCADDR pc = abuf->addr;
2421 PCADDR npc = pc + 2;
2425 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2426 if (UNLIKELY(current_cpu->trace_result_p))
2427 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2428 current_cpu->h_grc_set (FLD (f_rn), opval);
2430 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2432 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2433 written |= (1ULL << 5);
2434 if (UNLIKELY(current_cpu->trace_result_p))
2435 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2436 current_cpu->h_grc_set (FLD (f_rm), opval);
2440 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2441 written |= (1ULL << 5);
2442 if (UNLIKELY(current_cpu->trace_result_p))
2443 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2444 current_cpu->h_grc_set (FLD (f_rm), opval);
2449 abuf->written = written;
2450 current_cpu->done_insn (npc, status);
2454 // ********** movl8-compact: mov.l @(r0, $rm), $rn
2457 sh4_nofpu_sem_movl8_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2458 sh4_nofpu::write_stacks &buf)
2460 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2461 sem_status status = SEM_STATUS_NORMAL;
2462 sh4_nofpu_scache* abuf = sem;
2463 unsigned long long written = 0;
2464 PCADDR pc = abuf->addr;
2465 PCADDR npc = pc + 2;
2468 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
2469 if (UNLIKELY(current_cpu->trace_result_p))
2470 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2471 current_cpu->h_grc_set (FLD (f_rn), opval);
2474 current_cpu->done_insn (npc, status);
2478 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
2481 sh4_nofpu_sem_movl9_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2482 sh4_nofpu::write_stacks &buf)
2484 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2485 sem_status status = SEM_STATUS_NORMAL;
2486 sh4_nofpu_scache* abuf = sem;
2487 unsigned long long written = 0;
2488 PCADDR pc = abuf->addr;
2489 PCADDR npc = pc + 2;
2492 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
2493 if (UNLIKELY(current_cpu->trace_result_p))
2494 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2495 current_cpu->h_grc_set (((UINT) 0), opval);
2498 current_cpu->done_insn (npc, status);
2502 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
2505 sh4_nofpu_sem_movl10_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2506 sh4_nofpu::write_stacks &buf)
2508 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
2509 sem_status status = SEM_STATUS_NORMAL;
2510 sh4_nofpu_scache* abuf = sem;
2511 unsigned long long written = 0;
2512 PCADDR pc = abuf->addr;
2513 PCADDR npc = pc + 2;
2516 SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
2517 if (UNLIKELY(current_cpu->trace_result_p))
2518 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2519 current_cpu->h_grc_set (FLD (f_rn), opval);
2522 current_cpu->done_insn (npc, status);
2526 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
2529 sh4_nofpu_sem_movl11_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2530 sh4_nofpu::write_stacks &buf)
2532 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2533 sem_status status = SEM_STATUS_NORMAL;
2534 sh4_nofpu_scache* abuf = sem;
2535 unsigned long long written = 0;
2536 PCADDR pc = abuf->addr;
2537 PCADDR npc = pc + 2;
2540 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
2541 if (UNLIKELY(current_cpu->trace_result_p))
2542 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2543 current_cpu->h_grc_set (FLD (f_rn), opval);
2546 current_cpu->done_insn (npc, status);
2550 // ********** movl12-compact: mov.l @($imm12x4, $rm), $rn
2553 sh4_nofpu_sem_movl12_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2554 sh4_nofpu::write_stacks &buf)
2556 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2557 sem_status status = SEM_STATUS_NORMAL;
2558 sh4_nofpu_scache* abuf = sem;
2559 unsigned long long written = 0;
2560 PCADDR pc = abuf->addr;
2561 PCADDR npc = pc + 4;
2564 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x4)));
2565 if (UNLIKELY(current_cpu->trace_result_p))
2566 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2567 current_cpu->h_grc_set (FLD (f_rn), opval);
2570 current_cpu->done_insn (npc, status);
2574 // ********** movl13-compact: mov.l $rm, @($imm12x4, $rn)
2577 sh4_nofpu_sem_movl13_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2578 sh4_nofpu::write_stacks &buf)
2580 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2581 sem_status status = SEM_STATUS_NORMAL;
2582 sh4_nofpu_scache* abuf = sem;
2583 unsigned long long written = 0;
2584 PCADDR pc = abuf->addr;
2585 PCADDR npc = pc + 4;
2588 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2589 if (UNLIKELY(current_cpu->trace_result_p))
2590 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2591 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)), opval);
2594 current_cpu->done_insn (npc, status);
2598 // ********** movw1-compact: mov.w $rm, @$rn
2601 sh4_nofpu_sem_movw1_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2602 sh4_nofpu::write_stacks &buf)
2604 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2605 sem_status status = SEM_STATUS_NORMAL;
2606 sh4_nofpu_scache* abuf = sem;
2607 unsigned long long written = 0;
2608 PCADDR pc = abuf->addr;
2609 PCADDR npc = pc + 2;
2612 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2613 if (UNLIKELY(current_cpu->trace_result_p))
2614 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2615 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2618 current_cpu->done_insn (npc, status);
2622 // ********** movw2-compact: mov.w $rm, @-$rn
2625 sh4_nofpu_sem_movw2_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2626 sh4_nofpu::write_stacks &buf)
2628 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2629 sem_status status = SEM_STATUS_NORMAL;
2630 sh4_nofpu_scache* abuf = sem;
2631 unsigned long long written = 0;
2632 PCADDR pc = abuf->addr;
2633 PCADDR npc = pc + 2;
2637 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2639 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2640 if (UNLIKELY(current_cpu->trace_result_p))
2641 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2642 current_cpu->SETMEMHI (pc, tmp_addr, opval);
2645 SI opval = tmp_addr;
2646 if (UNLIKELY(current_cpu->trace_result_p))
2647 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2648 current_cpu->h_grc_set (FLD (f_rn), opval);
2652 current_cpu->done_insn (npc, status);
2656 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
2659 sh4_nofpu_sem_movw3_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2660 sh4_nofpu::write_stacks &buf)
2662 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2663 sem_status status = SEM_STATUS_NORMAL;
2664 sh4_nofpu_scache* abuf = sem;
2665 unsigned long long written = 0;
2666 PCADDR pc = abuf->addr;
2667 PCADDR npc = pc + 2;
2670 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2671 if (UNLIKELY(current_cpu->trace_result_p))
2672 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 << " ";
2673 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2676 current_cpu->done_insn (npc, status);
2680 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
2683 sh4_nofpu_sem_movw4_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2684 sh4_nofpu::write_stacks &buf)
2686 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
2687 sem_status status = SEM_STATUS_NORMAL;
2688 sh4_nofpu_scache* abuf = sem;
2689 unsigned long long written = 0;
2690 PCADDR pc = abuf->addr;
2691 PCADDR npc = pc + 2;
2694 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2695 if (UNLIKELY(current_cpu->trace_result_p))
2696 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2697 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
2700 current_cpu->done_insn (npc, status);
2704 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
2707 sh4_nofpu_sem_movw5_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2708 sh4_nofpu::write_stacks &buf)
2710 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
2711 sem_status status = SEM_STATUS_NORMAL;
2712 sh4_nofpu_scache* abuf = sem;
2713 unsigned long long written = 0;
2714 PCADDR pc = abuf->addr;
2715 PCADDR npc = pc + 2;
2718 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2719 if (UNLIKELY(current_cpu->trace_result_p))
2720 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 << " ";
2721 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
2724 current_cpu->done_insn (npc, status);
2728 // ********** movw6-compact: mov.w @$rm, $rn
2731 sh4_nofpu_sem_movw6_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2732 sh4_nofpu::write_stacks &buf)
2734 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2735 sem_status status = SEM_STATUS_NORMAL;
2736 sh4_nofpu_scache* abuf = sem;
2737 unsigned long long written = 0;
2738 PCADDR pc = abuf->addr;
2739 PCADDR npc = pc + 2;
2742 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2743 if (UNLIKELY(current_cpu->trace_result_p))
2744 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2745 current_cpu->h_grc_set (FLD (f_rn), opval);
2748 current_cpu->done_insn (npc, status);
2752 // ********** movw7-compact: mov.w @${rm}+, $rn
2755 sh4_nofpu_sem_movw7_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2756 sh4_nofpu::write_stacks &buf)
2758 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2759 sem_status status = SEM_STATUS_NORMAL;
2760 sh4_nofpu_scache* abuf = sem;
2761 unsigned long long written = 0;
2762 PCADDR pc = abuf->addr;
2763 PCADDR npc = pc + 2;
2767 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2768 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2770 SI opval = EXTHISI (tmp_data);
2771 written |= (1ULL << 4);
2772 if (UNLIKELY(current_cpu->trace_result_p))
2773 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2774 current_cpu->h_grc_set (FLD (f_rm), opval);
2778 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2779 written |= (1ULL << 4);
2780 if (UNLIKELY(current_cpu->trace_result_p))
2781 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2782 current_cpu->h_grc_set (FLD (f_rm), opval);
2786 SI opval = EXTHISI (tmp_data);
2787 if (UNLIKELY(current_cpu->trace_result_p))
2788 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2789 current_cpu->h_grc_set (FLD (f_rn), opval);
2793 abuf->written = written;
2794 current_cpu->done_insn (npc, status);
2798 // ********** movw8-compact: mov.w @(r0, $rm), $rn
2801 sh4_nofpu_sem_movw8_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2802 sh4_nofpu::write_stacks &buf)
2804 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2805 sem_status status = SEM_STATUS_NORMAL;
2806 sh4_nofpu_scache* abuf = sem;
2807 unsigned long long written = 0;
2808 PCADDR pc = abuf->addr;
2809 PCADDR npc = pc + 2;
2812 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2813 if (UNLIKELY(current_cpu->trace_result_p))
2814 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2815 current_cpu->h_grc_set (FLD (f_rn), opval);
2818 current_cpu->done_insn (npc, status);
2822 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
2825 sh4_nofpu_sem_movw9_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2826 sh4_nofpu::write_stacks &buf)
2828 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
2829 sem_status status = SEM_STATUS_NORMAL;
2830 sh4_nofpu_scache* abuf = sem;
2831 unsigned long long written = 0;
2832 PCADDR pc = abuf->addr;
2833 PCADDR npc = pc + 2;
2836 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
2837 if (UNLIKELY(current_cpu->trace_result_p))
2838 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2839 current_cpu->h_grc_set (((UINT) 0), opval);
2842 current_cpu->done_insn (npc, status);
2846 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
2849 sh4_nofpu_sem_movw10_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2850 sh4_nofpu::write_stacks &buf)
2852 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2853 sem_status status = SEM_STATUS_NORMAL;
2854 sh4_nofpu_scache* abuf = sem;
2855 unsigned long long written = 0;
2856 PCADDR pc = abuf->addr;
2857 PCADDR npc = pc + 2;
2860 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
2861 if (UNLIKELY(current_cpu->trace_result_p))
2862 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2863 current_cpu->h_grc_set (FLD (f_rn), opval);
2866 current_cpu->done_insn (npc, status);
2870 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
2873 sh4_nofpu_sem_movw11_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2874 sh4_nofpu::write_stacks &buf)
2876 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
2877 sem_status status = SEM_STATUS_NORMAL;
2878 sh4_nofpu_scache* abuf = sem;
2879 unsigned long long written = 0;
2880 PCADDR pc = abuf->addr;
2881 PCADDR npc = pc + 2;
2884 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
2885 if (UNLIKELY(current_cpu->trace_result_p))
2886 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2887 current_cpu->h_grc_set (((UINT) 0), opval);
2890 current_cpu->done_insn (npc, status);
2894 // ********** mova-compact: mova @($imm8x4, pc), r0
2897 sh4_nofpu_sem_mova_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2898 sh4_nofpu::write_stacks &buf)
2900 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2901 sem_status status = SEM_STATUS_NORMAL;
2902 sh4_nofpu_scache* abuf = sem;
2903 unsigned long long written = 0;
2904 PCADDR pc = abuf->addr;
2905 PCADDR npc = pc + 2;
2908 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
2909 if (UNLIKELY(current_cpu->trace_result_p))
2910 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2911 current_cpu->h_grc_set (((UINT) 0), opval);
2914 current_cpu->done_insn (npc, status);
2918 // ********** movcal-compact: movca.l r0, @$rn
2921 sh4_nofpu_sem_movcal_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2922 sh4_nofpu::write_stacks &buf)
2924 #define FLD(f) abuf->fields.sfmt_divu_compact.f
2925 sem_status status = SEM_STATUS_NORMAL;
2926 sh4_nofpu_scache* abuf = sem;
2927 unsigned long long written = 0;
2928 PCADDR pc = abuf->addr;
2929 PCADDR npc = pc + 2;
2932 SI opval = current_cpu->h_grc_get (((UINT) 0));
2933 if (UNLIKELY(current_cpu->trace_result_p))
2934 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2935 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2938 current_cpu->done_insn (npc, status);
2942 // ********** movt-compact: movt $rn
2945 sh4_nofpu_sem_movt_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2946 sh4_nofpu::write_stacks &buf)
2948 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2949 sem_status status = SEM_STATUS_NORMAL;
2950 sh4_nofpu_scache* abuf = sem;
2951 unsigned long long written = 0;
2952 PCADDR pc = abuf->addr;
2953 PCADDR npc = pc + 2;
2956 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
2957 if (UNLIKELY(current_cpu->trace_result_p))
2958 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2959 current_cpu->h_grc_set (FLD (f_rn), opval);
2962 current_cpu->done_insn (npc, status);
2966 // ********** mull-compact: mul.l $rm, $rn
2969 sh4_nofpu_sem_mull_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2970 sh4_nofpu::write_stacks &buf)
2972 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2973 sem_status status = SEM_STATUS_NORMAL;
2974 sh4_nofpu_scache* abuf = sem;
2975 unsigned long long written = 0;
2976 PCADDR pc = abuf->addr;
2977 PCADDR npc = pc + 2;
2980 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
2981 if (UNLIKELY(current_cpu->trace_result_p))
2982 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2983 current_cpu->h_macl_set (opval);
2986 current_cpu->done_insn (npc, status);
2990 // ********** mulsw-compact: muls.w $rm, $rn
2993 sh4_nofpu_sem_mulsw_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
2994 sh4_nofpu::write_stacks &buf)
2996 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2997 sem_status status = SEM_STATUS_NORMAL;
2998 sh4_nofpu_scache* abuf = sem;
2999 unsigned long long written = 0;
3000 PCADDR pc = abuf->addr;
3001 PCADDR npc = pc + 2;
3004 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)));
3005 if (UNLIKELY(current_cpu->trace_result_p))
3006 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3007 current_cpu->h_macl_set (opval);
3010 current_cpu->done_insn (npc, status);
3014 // ********** muluw-compact: mulu.w $rm, $rn
3017 sh4_nofpu_sem_muluw_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3018 sh4_nofpu::write_stacks &buf)
3020 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3021 sem_status status = SEM_STATUS_NORMAL;
3022 sh4_nofpu_scache* abuf = sem;
3023 unsigned long long written = 0;
3024 PCADDR pc = abuf->addr;
3025 PCADDR npc = pc + 2;
3028 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)));
3029 if (UNLIKELY(current_cpu->trace_result_p))
3030 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
3031 current_cpu->h_macl_set (opval);
3034 current_cpu->done_insn (npc, status);
3038 // ********** neg-compact: neg $rm, $rn
3041 sh4_nofpu_sem_neg_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3042 sh4_nofpu::write_stacks &buf)
3044 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3045 sem_status status = SEM_STATUS_NORMAL;
3046 sh4_nofpu_scache* abuf = sem;
3047 unsigned long long written = 0;
3048 PCADDR pc = abuf->addr;
3049 PCADDR npc = pc + 2;
3052 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
3053 if (UNLIKELY(current_cpu->trace_result_p))
3054 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3055 current_cpu->h_grc_set (FLD (f_rn), opval);
3058 current_cpu->done_insn (npc, status);
3062 // ********** negc-compact: negc $rm, $rn
3065 sh4_nofpu_sem_negc_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3066 sh4_nofpu::write_stacks &buf)
3068 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3069 sem_status status = SEM_STATUS_NORMAL;
3070 sh4_nofpu_scache* abuf = sem;
3071 unsigned long long written = 0;
3072 PCADDR pc = abuf->addr;
3073 PCADDR npc = pc + 2;
3077 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3079 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3080 if (UNLIKELY(current_cpu->trace_result_p))
3081 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3082 current_cpu->h_grc_set (FLD (f_rn), opval);
3085 BI opval = tmp_flag;
3086 if (UNLIKELY(current_cpu->trace_result_p))
3087 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3088 current_cpu->h_tbit_set (opval);
3092 current_cpu->done_insn (npc, status);
3096 // ********** nop-compact: nop
3099 sh4_nofpu_sem_nop_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3100 sh4_nofpu::write_stacks &buf)
3102 #define FLD(f) abuf->fields.fmt_empty.f
3103 sem_status status = SEM_STATUS_NORMAL;
3104 sh4_nofpu_scache* abuf = sem;
3105 unsigned long long written = 0;
3106 PCADDR pc = abuf->addr;
3107 PCADDR npc = pc + 2;
3111 current_cpu->done_insn (npc, status);
3115 // ********** not-compact: not $rm64, $rn64
3118 sh4_nofpu_sem_not_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3119 sh4_nofpu::write_stacks &buf)
3121 #define FLD(f) abuf->fields.sfmt_and_compact.f
3122 sem_status status = SEM_STATUS_NORMAL;
3123 sh4_nofpu_scache* abuf = sem;
3124 unsigned long long written = 0;
3125 PCADDR pc = abuf->addr;
3126 PCADDR npc = pc + 2;
3129 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
3130 if (UNLIKELY(current_cpu->trace_result_p))
3131 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3132 current_cpu->h_gr_set (FLD (f_rn), opval);
3135 current_cpu->done_insn (npc, status);
3139 // ********** ocbi-compact: ocbi @$rn
3142 sh4_nofpu_sem_ocbi_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3143 sh4_nofpu::write_stacks &buf)
3145 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3146 sem_status status = SEM_STATUS_NORMAL;
3147 sh4_nofpu_scache* abuf = sem;
3148 unsigned long long written = 0;
3149 PCADDR pc = abuf->addr;
3150 PCADDR npc = pc + 2;
3154 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3155 if (UNLIKELY(current_cpu->trace_result_p))
3156 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3157 current_cpu->h_grc_set (FLD (f_rn), opval);
3162 current_cpu->done_insn (npc, status);
3166 // ********** ocbp-compact: ocbp @$rn
3169 sh4_nofpu_sem_ocbp_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3170 sh4_nofpu::write_stacks &buf)
3172 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3173 sem_status status = SEM_STATUS_NORMAL;
3174 sh4_nofpu_scache* abuf = sem;
3175 unsigned long long written = 0;
3176 PCADDR pc = abuf->addr;
3177 PCADDR npc = pc + 2;
3181 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3182 if (UNLIKELY(current_cpu->trace_result_p))
3183 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3184 current_cpu->h_grc_set (FLD (f_rn), opval);
3189 current_cpu->done_insn (npc, status);
3193 // ********** ocbwb-compact: ocbwb @$rn
3196 sh4_nofpu_sem_ocbwb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3197 sh4_nofpu::write_stacks &buf)
3199 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3200 sem_status status = SEM_STATUS_NORMAL;
3201 sh4_nofpu_scache* abuf = sem;
3202 unsigned long long written = 0;
3203 PCADDR pc = abuf->addr;
3204 PCADDR npc = pc + 2;
3208 SI opval = current_cpu->h_grc_get (FLD (f_rn));
3209 if (UNLIKELY(current_cpu->trace_result_p))
3210 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3211 current_cpu->h_grc_set (FLD (f_rn), opval);
3216 current_cpu->done_insn (npc, status);
3220 // ********** or-compact: or $rm64, $rn64
3223 sh4_nofpu_sem_or_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3224 sh4_nofpu::write_stacks &buf)
3226 #define FLD(f) abuf->fields.sfmt_and_compact.f
3227 sem_status status = SEM_STATUS_NORMAL;
3228 sh4_nofpu_scache* abuf = sem;
3229 unsigned long long written = 0;
3230 PCADDR pc = abuf->addr;
3231 PCADDR npc = pc + 2;
3234 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
3235 if (UNLIKELY(current_cpu->trace_result_p))
3236 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3237 current_cpu->h_gr_set (FLD (f_rn), opval);
3240 current_cpu->done_insn (npc, status);
3244 // ********** ori-compact: or #$uimm8, r0
3247 sh4_nofpu_sem_ori_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3248 sh4_nofpu::write_stacks &buf)
3250 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3251 sem_status status = SEM_STATUS_NORMAL;
3252 sh4_nofpu_scache* abuf = sem;
3253 unsigned long long written = 0;
3254 PCADDR pc = abuf->addr;
3255 PCADDR npc = pc + 2;
3258 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3259 if (UNLIKELY(current_cpu->trace_result_p))
3260 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3261 current_cpu->h_grc_set (((UINT) 0), opval);
3264 current_cpu->done_insn (npc, status);
3268 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3271 sh4_nofpu_sem_orb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3272 sh4_nofpu::write_stacks &buf)
3274 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3275 sem_status status = SEM_STATUS_NORMAL;
3276 sh4_nofpu_scache* abuf = sem;
3277 unsigned long long written = 0;
3278 PCADDR pc = abuf->addr;
3279 PCADDR npc = pc + 2;
3284 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3285 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3287 UQI opval = tmp_data;
3288 if (UNLIKELY(current_cpu->trace_result_p))
3289 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3290 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3294 current_cpu->done_insn (npc, status);
3298 // ********** pref-compact: pref @$rn
3301 sh4_nofpu_sem_pref_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3302 sh4_nofpu::write_stacks &buf)
3304 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3305 sem_status status = SEM_STATUS_NORMAL;
3306 sh4_nofpu_scache* abuf = sem;
3307 unsigned long long written = 0;
3308 PCADDR pc = abuf->addr;
3309 PCADDR npc = pc + 2;
3311 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
3313 current_cpu->done_insn (npc, status);
3317 // ********** rotcl-compact: rotcl $rn
3320 sh4_nofpu_sem_rotcl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3321 sh4_nofpu::write_stacks &buf)
3323 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3324 sem_status status = SEM_STATUS_NORMAL;
3325 sh4_nofpu_scache* abuf = sem;
3326 unsigned long long written = 0;
3327 PCADDR pc = abuf->addr;
3328 PCADDR npc = pc + 2;
3332 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3334 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3335 if (UNLIKELY(current_cpu->trace_result_p))
3336 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3337 current_cpu->h_grc_set (FLD (f_rn), opval);
3340 BI opval = ((tmp_temp) ? (1) : (0));
3341 if (UNLIKELY(current_cpu->trace_result_p))
3342 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3343 current_cpu->h_tbit_set (opval);
3347 current_cpu->done_insn (npc, status);
3351 // ********** rotcr-compact: rotcr $rn
3354 sh4_nofpu_sem_rotcr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3355 sh4_nofpu::write_stacks &buf)
3357 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3358 sem_status status = SEM_STATUS_NORMAL;
3359 sh4_nofpu_scache* abuf = sem;
3360 unsigned long long written = 0;
3361 PCADDR pc = abuf->addr;
3362 PCADDR npc = pc + 2;
3367 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3368 tmp_temp = current_cpu->h_tbit_get ();
3370 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3371 if (UNLIKELY(current_cpu->trace_result_p))
3372 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3373 current_cpu->h_grc_set (FLD (f_rn), opval);
3376 BI opval = ((tmp_lsbit) ? (1) : (0));
3377 if (UNLIKELY(current_cpu->trace_result_p))
3378 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3379 current_cpu->h_tbit_set (opval);
3383 current_cpu->done_insn (npc, status);
3387 // ********** rotl-compact: rotl $rn
3390 sh4_nofpu_sem_rotl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3391 sh4_nofpu::write_stacks &buf)
3393 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3394 sem_status status = SEM_STATUS_NORMAL;
3395 sh4_nofpu_scache* abuf = sem;
3396 unsigned long long written = 0;
3397 PCADDR pc = abuf->addr;
3398 PCADDR npc = pc + 2;
3402 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3404 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3405 if (UNLIKELY(current_cpu->trace_result_p))
3406 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3407 current_cpu->h_grc_set (FLD (f_rn), opval);
3410 BI opval = ((tmp_temp) ? (1) : (0));
3411 if (UNLIKELY(current_cpu->trace_result_p))
3412 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3413 current_cpu->h_tbit_set (opval);
3417 current_cpu->done_insn (npc, status);
3421 // ********** rotr-compact: rotr $rn
3424 sh4_nofpu_sem_rotr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3425 sh4_nofpu::write_stacks &buf)
3427 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3428 sem_status status = SEM_STATUS_NORMAL;
3429 sh4_nofpu_scache* abuf = sem;
3430 unsigned long long written = 0;
3431 PCADDR pc = abuf->addr;
3432 PCADDR npc = pc + 2;
3437 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3438 tmp_temp = tmp_lsbit;
3440 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3441 if (UNLIKELY(current_cpu->trace_result_p))
3442 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3443 current_cpu->h_grc_set (FLD (f_rn), opval);
3446 BI opval = ((tmp_lsbit) ? (1) : (0));
3447 if (UNLIKELY(current_cpu->trace_result_p))
3448 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3449 current_cpu->h_tbit_set (opval);
3453 current_cpu->done_insn (npc, status);
3457 // ********** rts-compact: rts
3460 sh4_nofpu_sem_rts_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3461 sh4_nofpu::write_stacks &buf)
3463 #define FLD(f) abuf->fields.fmt_empty.f
3464 sem_status status = SEM_STATUS_NORMAL;
3465 sh4_nofpu_scache* abuf = sem;
3466 unsigned long long written = 0;
3467 PCADDR pc = abuf->addr;
3468 PCADDR npc = pc + 2;
3472 UDI opval = ADDDI (pc, 2);
3473 if (UNLIKELY(current_cpu->trace_result_p))
3474 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3475 current_cpu->branch (opval, npc, status);
3477 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
3479 UDI opval = current_cpu->h_pr_get ();
3480 buf.h_pc_writes [(tick + 1) % sh4_nofpu::pipe_sz].push (sh4_nofpu::write<UDI>(pc, opval));
3481 if (UNLIKELY(current_cpu->trace_result_p))
3482 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3484 current_cpu->notify_ret (current_cpu->h_pr_get ());
3487 current_cpu->done_cti_insn (npc, status);
3491 // ********** sets-compact: sets
3494 sh4_nofpu_sem_sets_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3495 sh4_nofpu::write_stacks &buf)
3497 #define FLD(f) abuf->fields.fmt_empty.f
3498 sem_status status = SEM_STATUS_NORMAL;
3499 sh4_nofpu_scache* abuf = sem;
3500 unsigned long long written = 0;
3501 PCADDR pc = abuf->addr;
3502 PCADDR npc = pc + 2;
3506 if (UNLIKELY(current_cpu->trace_result_p))
3507 current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << " ";
3508 current_cpu->h_sbit_set (opval);
3511 current_cpu->done_insn (npc, status);
3515 // ********** sett-compact: sett
3518 sh4_nofpu_sem_sett_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3519 sh4_nofpu::write_stacks &buf)
3521 #define FLD(f) abuf->fields.fmt_empty.f
3522 sem_status status = SEM_STATUS_NORMAL;
3523 sh4_nofpu_scache* abuf = sem;
3524 unsigned long long written = 0;
3525 PCADDR pc = abuf->addr;
3526 PCADDR npc = pc + 2;
3530 if (UNLIKELY(current_cpu->trace_result_p))
3531 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3532 current_cpu->h_tbit_set (opval);
3535 current_cpu->done_insn (npc, status);
3539 // ********** shad-compact: shad $rm, $rn
3542 sh4_nofpu_sem_shad_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3543 sh4_nofpu::write_stacks &buf)
3545 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3546 sem_status status = SEM_STATUS_NORMAL;
3547 sh4_nofpu_scache* abuf = sem;
3548 unsigned long long written = 0;
3549 PCADDR pc = abuf->addr;
3550 PCADDR npc = pc + 2;
3554 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3555 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3557 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3558 written |= (1ULL << 2);
3559 if (UNLIKELY(current_cpu->trace_result_p))
3560 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3561 current_cpu->h_grc_set (FLD (f_rn), opval);
3564 if (NESI (tmp_shamt, 0)) {
3566 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3567 written |= (1ULL << 2);
3568 if (UNLIKELY(current_cpu->trace_result_p))
3569 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3570 current_cpu->h_grc_set (FLD (f_rn), opval);
3573 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
3575 SI opval = NEGSI (1);
3576 written |= (1ULL << 2);
3577 if (UNLIKELY(current_cpu->trace_result_p))
3578 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3579 current_cpu->h_grc_set (FLD (f_rn), opval);
3584 written |= (1ULL << 2);
3585 if (UNLIKELY(current_cpu->trace_result_p))
3586 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3587 current_cpu->h_grc_set (FLD (f_rn), opval);
3594 abuf->written = written;
3595 current_cpu->done_insn (npc, status);
3599 // ********** shal-compact: shal $rn
3602 sh4_nofpu_sem_shal_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3603 sh4_nofpu::write_stacks &buf)
3605 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3606 sem_status status = SEM_STATUS_NORMAL;
3607 sh4_nofpu_scache* abuf = sem;
3608 unsigned long long written = 0;
3609 PCADDR pc = abuf->addr;
3610 PCADDR npc = pc + 2;
3614 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3616 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3617 if (UNLIKELY(current_cpu->trace_result_p))
3618 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3619 current_cpu->h_grc_set (FLD (f_rn), opval);
3622 BI opval = ((tmp_t) ? (1) : (0));
3623 if (UNLIKELY(current_cpu->trace_result_p))
3624 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3625 current_cpu->h_tbit_set (opval);
3629 current_cpu->done_insn (npc, status);
3633 // ********** shar-compact: shar $rn
3636 sh4_nofpu_sem_shar_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3637 sh4_nofpu::write_stacks &buf)
3639 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3640 sem_status status = SEM_STATUS_NORMAL;
3641 sh4_nofpu_scache* abuf = sem;
3642 unsigned long long written = 0;
3643 PCADDR pc = abuf->addr;
3644 PCADDR npc = pc + 2;
3648 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3650 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3651 if (UNLIKELY(current_cpu->trace_result_p))
3652 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3653 current_cpu->h_grc_set (FLD (f_rn), opval);
3656 BI opval = ((tmp_t) ? (1) : (0));
3657 if (UNLIKELY(current_cpu->trace_result_p))
3658 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3659 current_cpu->h_tbit_set (opval);
3663 current_cpu->done_insn (npc, status);
3667 // ********** shld-compact: shld $rm, $rn
3670 sh4_nofpu_sem_shld_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3671 sh4_nofpu::write_stacks &buf)
3673 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3674 sem_status status = SEM_STATUS_NORMAL;
3675 sh4_nofpu_scache* abuf = sem;
3676 unsigned long long written = 0;
3677 PCADDR pc = abuf->addr;
3678 PCADDR npc = pc + 2;
3682 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3683 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3685 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3686 written |= (1ULL << 2);
3687 if (UNLIKELY(current_cpu->trace_result_p))
3688 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3689 current_cpu->h_grc_set (FLD (f_rn), opval);
3692 if (NESI (tmp_shamt, 0)) {
3694 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3695 written |= (1ULL << 2);
3696 if (UNLIKELY(current_cpu->trace_result_p))
3697 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3698 current_cpu->h_grc_set (FLD (f_rn), opval);
3703 written |= (1ULL << 2);
3704 if (UNLIKELY(current_cpu->trace_result_p))
3705 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3706 current_cpu->h_grc_set (FLD (f_rn), opval);
3712 abuf->written = written;
3713 current_cpu->done_insn (npc, status);
3717 // ********** shll-compact: shll $rn
3720 sh4_nofpu_sem_shll_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3721 sh4_nofpu::write_stacks &buf)
3723 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3724 sem_status status = SEM_STATUS_NORMAL;
3725 sh4_nofpu_scache* abuf = sem;
3726 unsigned long long written = 0;
3727 PCADDR pc = abuf->addr;
3728 PCADDR npc = pc + 2;
3732 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3734 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3735 if (UNLIKELY(current_cpu->trace_result_p))
3736 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3737 current_cpu->h_grc_set (FLD (f_rn), opval);
3740 BI opval = ((tmp_t) ? (1) : (0));
3741 if (UNLIKELY(current_cpu->trace_result_p))
3742 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3743 current_cpu->h_tbit_set (opval);
3747 current_cpu->done_insn (npc, status);
3751 // ********** shll2-compact: shll2 $rn
3754 sh4_nofpu_sem_shll2_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3755 sh4_nofpu::write_stacks &buf)
3757 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3758 sem_status status = SEM_STATUS_NORMAL;
3759 sh4_nofpu_scache* abuf = sem;
3760 unsigned long long written = 0;
3761 PCADDR pc = abuf->addr;
3762 PCADDR npc = pc + 2;
3765 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3766 if (UNLIKELY(current_cpu->trace_result_p))
3767 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3768 current_cpu->h_grc_set (FLD (f_rn), opval);
3771 current_cpu->done_insn (npc, status);
3775 // ********** shll8-compact: shll8 $rn
3778 sh4_nofpu_sem_shll8_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3779 sh4_nofpu::write_stacks &buf)
3781 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3782 sem_status status = SEM_STATUS_NORMAL;
3783 sh4_nofpu_scache* abuf = sem;
3784 unsigned long long written = 0;
3785 PCADDR pc = abuf->addr;
3786 PCADDR npc = pc + 2;
3789 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3790 if (UNLIKELY(current_cpu->trace_result_p))
3791 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3792 current_cpu->h_grc_set (FLD (f_rn), opval);
3795 current_cpu->done_insn (npc, status);
3799 // ********** shll16-compact: shll16 $rn
3802 sh4_nofpu_sem_shll16_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3803 sh4_nofpu::write_stacks &buf)
3805 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3806 sem_status status = SEM_STATUS_NORMAL;
3807 sh4_nofpu_scache* abuf = sem;
3808 unsigned long long written = 0;
3809 PCADDR pc = abuf->addr;
3810 PCADDR npc = pc + 2;
3813 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3814 if (UNLIKELY(current_cpu->trace_result_p))
3815 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3816 current_cpu->h_grc_set (FLD (f_rn), opval);
3819 current_cpu->done_insn (npc, status);
3823 // ********** shlr-compact: shlr $rn
3826 sh4_nofpu_sem_shlr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3827 sh4_nofpu::write_stacks &buf)
3829 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3830 sem_status status = SEM_STATUS_NORMAL;
3831 sh4_nofpu_scache* abuf = sem;
3832 unsigned long long written = 0;
3833 PCADDR pc = abuf->addr;
3834 PCADDR npc = pc + 2;
3838 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3840 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3841 if (UNLIKELY(current_cpu->trace_result_p))
3842 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3843 current_cpu->h_grc_set (FLD (f_rn), opval);
3846 BI opval = ((tmp_t) ? (1) : (0));
3847 if (UNLIKELY(current_cpu->trace_result_p))
3848 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3849 current_cpu->h_tbit_set (opval);
3853 current_cpu->done_insn (npc, status);
3857 // ********** shlr2-compact: shlr2 $rn
3860 sh4_nofpu_sem_shlr2_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3861 sh4_nofpu::write_stacks &buf)
3863 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3864 sem_status status = SEM_STATUS_NORMAL;
3865 sh4_nofpu_scache* abuf = sem;
3866 unsigned long long written = 0;
3867 PCADDR pc = abuf->addr;
3868 PCADDR npc = pc + 2;
3871 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3872 if (UNLIKELY(current_cpu->trace_result_p))
3873 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3874 current_cpu->h_grc_set (FLD (f_rn), opval);
3877 current_cpu->done_insn (npc, status);
3881 // ********** shlr8-compact: shlr8 $rn
3884 sh4_nofpu_sem_shlr8_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3885 sh4_nofpu::write_stacks &buf)
3887 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3888 sem_status status = SEM_STATUS_NORMAL;
3889 sh4_nofpu_scache* abuf = sem;
3890 unsigned long long written = 0;
3891 PCADDR pc = abuf->addr;
3892 PCADDR npc = pc + 2;
3895 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3896 if (UNLIKELY(current_cpu->trace_result_p))
3897 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3898 current_cpu->h_grc_set (FLD (f_rn), opval);
3901 current_cpu->done_insn (npc, status);
3905 // ********** shlr16-compact: shlr16 $rn
3908 sh4_nofpu_sem_shlr16_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3909 sh4_nofpu::write_stacks &buf)
3911 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3912 sem_status status = SEM_STATUS_NORMAL;
3913 sh4_nofpu_scache* abuf = sem;
3914 unsigned long long written = 0;
3915 PCADDR pc = abuf->addr;
3916 PCADDR npc = pc + 2;
3919 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3920 if (UNLIKELY(current_cpu->trace_result_p))
3921 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3922 current_cpu->h_grc_set (FLD (f_rn), opval);
3925 current_cpu->done_insn (npc, status);
3929 // ********** stc-gbr-compact: stc gbr, $rn
3932 sh4_nofpu_sem_stc_gbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3933 sh4_nofpu::write_stacks &buf)
3935 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3936 sem_status status = SEM_STATUS_NORMAL;
3937 sh4_nofpu_scache* abuf = sem;
3938 unsigned long long written = 0;
3939 PCADDR pc = abuf->addr;
3940 PCADDR npc = pc + 2;
3943 SI opval = current_cpu->h_gbr_get ();
3944 if (UNLIKELY(current_cpu->trace_result_p))
3945 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3946 current_cpu->h_grc_set (FLD (f_rn), opval);
3949 current_cpu->done_insn (npc, status);
3953 // ********** stc-vbr-compact: stc vbr, $rn
3956 sh4_nofpu_sem_stc_vbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3957 sh4_nofpu::write_stacks &buf)
3959 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3960 sem_status status = SEM_STATUS_NORMAL;
3961 sh4_nofpu_scache* abuf = sem;
3962 unsigned long long written = 0;
3963 PCADDR pc = abuf->addr;
3964 PCADDR npc = pc + 2;
3967 SI opval = current_cpu->h_vbr_get ();
3968 if (UNLIKELY(current_cpu->trace_result_p))
3969 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3970 current_cpu->h_grc_set (FLD (f_rn), opval);
3973 current_cpu->done_insn (npc, status);
3977 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
3980 sh4_nofpu_sem_stcl_gbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
3981 sh4_nofpu::write_stacks &buf)
3983 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3984 sem_status status = SEM_STATUS_NORMAL;
3985 sh4_nofpu_scache* abuf = sem;
3986 unsigned long long written = 0;
3987 PCADDR pc = abuf->addr;
3988 PCADDR npc = pc + 2;
3992 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3994 SI opval = current_cpu->h_gbr_get ();
3995 if (UNLIKELY(current_cpu->trace_result_p))
3996 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3997 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4000 SI opval = tmp_addr;
4001 if (UNLIKELY(current_cpu->trace_result_p))
4002 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4003 current_cpu->h_grc_set (FLD (f_rn), opval);
4007 current_cpu->done_insn (npc, status);
4011 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
4014 sh4_nofpu_sem_stcl_vbr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4015 sh4_nofpu::write_stacks &buf)
4017 #define FLD(f) abuf->fields.sfmt_divu_compact.f
4018 sem_status status = SEM_STATUS_NORMAL;
4019 sh4_nofpu_scache* abuf = sem;
4020 unsigned long long written = 0;
4021 PCADDR pc = abuf->addr;
4022 PCADDR npc = pc + 2;
4026 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4028 SI opval = current_cpu->h_vbr_get ();
4029 if (UNLIKELY(current_cpu->trace_result_p))
4030 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4031 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4034 SI opval = tmp_addr;
4035 if (UNLIKELY(current_cpu->trace_result_p))
4036 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4037 current_cpu->h_grc_set (FLD (f_rn), opval);
4041 current_cpu->done_insn (npc, status);
4045 // ********** sts-mach-compact: sts mach, $rn
4048 sh4_nofpu_sem_sts_mach_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4049 sh4_nofpu::write_stacks &buf)
4051 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4052 sem_status status = SEM_STATUS_NORMAL;
4053 sh4_nofpu_scache* abuf = sem;
4054 unsigned long long written = 0;
4055 PCADDR pc = abuf->addr;
4056 PCADDR npc = pc + 2;
4059 SI opval = current_cpu->h_mach_get ();
4060 if (UNLIKELY(current_cpu->trace_result_p))
4061 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4062 current_cpu->h_grc_set (FLD (f_rn), opval);
4065 current_cpu->done_insn (npc, status);
4069 // ********** stsl-mach-compact: sts.l mach, @-$rn
4072 sh4_nofpu_sem_stsl_mach_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4073 sh4_nofpu::write_stacks &buf)
4075 #define FLD(f) abuf->fields.sfmt_divu_compact.f
4076 sem_status status = SEM_STATUS_NORMAL;
4077 sh4_nofpu_scache* abuf = sem;
4078 unsigned long long written = 0;
4079 PCADDR pc = abuf->addr;
4080 PCADDR npc = pc + 2;
4084 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4086 SI opval = current_cpu->h_mach_get ();
4087 if (UNLIKELY(current_cpu->trace_result_p))
4088 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4089 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4092 SI opval = tmp_addr;
4093 if (UNLIKELY(current_cpu->trace_result_p))
4094 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4095 current_cpu->h_grc_set (FLD (f_rn), opval);
4099 current_cpu->done_insn (npc, status);
4103 // ********** sts-macl-compact: sts macl, $rn
4106 sh4_nofpu_sem_sts_macl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4107 sh4_nofpu::write_stacks &buf)
4109 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4110 sem_status status = SEM_STATUS_NORMAL;
4111 sh4_nofpu_scache* abuf = sem;
4112 unsigned long long written = 0;
4113 PCADDR pc = abuf->addr;
4114 PCADDR npc = pc + 2;
4117 SI opval = current_cpu->h_macl_get ();
4118 if (UNLIKELY(current_cpu->trace_result_p))
4119 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4120 current_cpu->h_grc_set (FLD (f_rn), opval);
4123 current_cpu->done_insn (npc, status);
4127 // ********** stsl-macl-compact: sts.l macl, @-$rn
4130 sh4_nofpu_sem_stsl_macl_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4131 sh4_nofpu::write_stacks &buf)
4133 #define FLD(f) abuf->fields.sfmt_divu_compact.f
4134 sem_status status = SEM_STATUS_NORMAL;
4135 sh4_nofpu_scache* abuf = sem;
4136 unsigned long long written = 0;
4137 PCADDR pc = abuf->addr;
4138 PCADDR npc = pc + 2;
4142 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4144 SI opval = current_cpu->h_macl_get ();
4145 if (UNLIKELY(current_cpu->trace_result_p))
4146 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4147 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4150 SI opval = tmp_addr;
4151 if (UNLIKELY(current_cpu->trace_result_p))
4152 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4153 current_cpu->h_grc_set (FLD (f_rn), opval);
4157 current_cpu->done_insn (npc, status);
4161 // ********** sts-pr-compact: sts pr, $rn
4164 sh4_nofpu_sem_sts_pr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4165 sh4_nofpu::write_stacks &buf)
4167 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4168 sem_status status = SEM_STATUS_NORMAL;
4169 sh4_nofpu_scache* abuf = sem;
4170 unsigned long long written = 0;
4171 PCADDR pc = abuf->addr;
4172 PCADDR npc = pc + 2;
4175 SI opval = current_cpu->h_pr_get ();
4176 if (UNLIKELY(current_cpu->trace_result_p))
4177 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4178 current_cpu->h_grc_set (FLD (f_rn), opval);
4181 current_cpu->done_insn (npc, status);
4185 // ********** stsl-pr-compact: sts.l pr, @-$rn
4188 sh4_nofpu_sem_stsl_pr_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4189 sh4_nofpu::write_stacks &buf)
4191 #define FLD(f) abuf->fields.sfmt_divu_compact.f
4192 sem_status status = SEM_STATUS_NORMAL;
4193 sh4_nofpu_scache* abuf = sem;
4194 unsigned long long written = 0;
4195 PCADDR pc = abuf->addr;
4196 PCADDR npc = pc + 2;
4200 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4202 SI opval = current_cpu->h_pr_get ();
4203 if (UNLIKELY(current_cpu->trace_result_p))
4204 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
4205 current_cpu->SETMEMSI (pc, tmp_addr, opval);
4208 SI opval = tmp_addr;
4209 if (UNLIKELY(current_cpu->trace_result_p))
4210 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4211 current_cpu->h_grc_set (FLD (f_rn), opval);
4215 current_cpu->done_insn (npc, status);
4219 // ********** sub-compact: sub $rm, $rn
4222 sh4_nofpu_sem_sub_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4223 sh4_nofpu::write_stacks &buf)
4225 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4226 sem_status status = SEM_STATUS_NORMAL;
4227 sh4_nofpu_scache* abuf = sem;
4228 unsigned long long written = 0;
4229 PCADDR pc = abuf->addr;
4230 PCADDR npc = pc + 2;
4233 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4234 if (UNLIKELY(current_cpu->trace_result_p))
4235 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4236 current_cpu->h_grc_set (FLD (f_rn), opval);
4239 current_cpu->done_insn (npc, status);
4243 // ********** subc-compact: subc $rm, $rn
4246 sh4_nofpu_sem_subc_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4247 sh4_nofpu::write_stacks &buf)
4249 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4250 sem_status status = SEM_STATUS_NORMAL;
4251 sh4_nofpu_scache* abuf = sem;
4252 unsigned long long written = 0;
4253 PCADDR pc = abuf->addr;
4254 PCADDR npc = pc + 2;
4258 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4260 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4261 if (UNLIKELY(current_cpu->trace_result_p))
4262 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4263 current_cpu->h_grc_set (FLD (f_rn), opval);
4266 BI opval = tmp_flag;
4267 if (UNLIKELY(current_cpu->trace_result_p))
4268 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4269 current_cpu->h_tbit_set (opval);
4273 current_cpu->done_insn (npc, status);
4277 // ********** subv-compact: subv $rm, $rn
4280 sh4_nofpu_sem_subv_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4281 sh4_nofpu::write_stacks &buf)
4283 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4284 sem_status status = SEM_STATUS_NORMAL;
4285 sh4_nofpu_scache* abuf = sem;
4286 unsigned long long written = 0;
4287 PCADDR pc = abuf->addr;
4288 PCADDR npc = pc + 2;
4292 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
4294 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
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 // ********** swapb-compact: swap.b $rm, $rn
4314 sh4_nofpu_sem_swapb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4315 sh4_nofpu::write_stacks &buf)
4317 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4318 sem_status status = SEM_STATUS_NORMAL;
4319 sh4_nofpu_scache* abuf = sem;
4320 unsigned long long written = 0;
4321 PCADDR pc = abuf->addr;
4322 PCADDR npc = pc + 2;
4328 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
4329 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
4330 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
4332 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
4333 if (UNLIKELY(current_cpu->trace_result_p))
4334 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4335 current_cpu->h_grc_set (FLD (f_rn), opval);
4339 current_cpu->done_insn (npc, status);
4343 // ********** swapw-compact: swap.w $rm, $rn
4346 sh4_nofpu_sem_swapw_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4347 sh4_nofpu::write_stacks &buf)
4349 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4350 sem_status status = SEM_STATUS_NORMAL;
4351 sh4_nofpu_scache* abuf = sem;
4352 unsigned long long written = 0;
4353 PCADDR pc = abuf->addr;
4354 PCADDR npc = pc + 2;
4357 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
4358 if (UNLIKELY(current_cpu->trace_result_p))
4359 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4360 current_cpu->h_grc_set (FLD (f_rn), opval);
4363 current_cpu->done_insn (npc, status);
4367 // ********** tasb-compact: tas.b @$rn
4370 sh4_nofpu_sem_tasb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4371 sh4_nofpu::write_stacks &buf)
4373 #define FLD(f) abuf->fields.sfmt_divu_compact.f
4374 sem_status status = SEM_STATUS_NORMAL;
4375 sh4_nofpu_scache* abuf = sem;
4376 unsigned long long written = 0;
4377 PCADDR pc = abuf->addr;
4378 PCADDR npc = pc + 2;
4382 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
4384 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
4385 if (UNLIKELY(current_cpu->trace_result_p))
4386 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4387 current_cpu->h_tbit_set (opval);
4389 tmp_byte = ORQI (tmp_byte, 128);
4391 UQI opval = tmp_byte;
4392 if (UNLIKELY(current_cpu->trace_result_p))
4393 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4394 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
4398 current_cpu->done_insn (npc, status);
4402 // ********** trapa-compact: trapa #$uimm8
4405 sh4_nofpu_sem_trapa_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4406 sh4_nofpu::write_stacks &buf)
4408 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4409 sem_status status = SEM_STATUS_NORMAL;
4410 sh4_nofpu_scache* abuf = sem;
4411 unsigned long long written = 0;
4412 PCADDR pc = abuf->addr;
4413 PCADDR npc = pc + 2;
4415 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4417 current_cpu->done_insn (npc, status);
4421 // ********** tst-compact: tst $rm, $rn
4424 sh4_nofpu_sem_tst_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4425 sh4_nofpu::write_stacks &buf)
4427 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4428 sem_status status = SEM_STATUS_NORMAL;
4429 sh4_nofpu_scache* abuf = sem;
4430 unsigned long long written = 0;
4431 PCADDR pc = abuf->addr;
4432 PCADDR npc = pc + 2;
4435 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
4436 if (UNLIKELY(current_cpu->trace_result_p))
4437 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4438 current_cpu->h_tbit_set (opval);
4441 current_cpu->done_insn (npc, status);
4445 // ********** tsti-compact: tst #$uimm8, r0
4448 sh4_nofpu_sem_tsti_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4449 sh4_nofpu::write_stacks &buf)
4451 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4452 sem_status status = SEM_STATUS_NORMAL;
4453 sh4_nofpu_scache* abuf = sem;
4454 unsigned long long written = 0;
4455 PCADDR pc = abuf->addr;
4456 PCADDR npc = pc + 2;
4459 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
4460 if (UNLIKELY(current_cpu->trace_result_p))
4461 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4462 current_cpu->h_tbit_set (opval);
4465 current_cpu->done_insn (npc, status);
4469 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
4472 sh4_nofpu_sem_tstb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4473 sh4_nofpu::write_stacks &buf)
4475 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4476 sem_status status = SEM_STATUS_NORMAL;
4477 sh4_nofpu_scache* abuf = sem;
4478 unsigned long long written = 0;
4479 PCADDR pc = abuf->addr;
4480 PCADDR npc = pc + 2;
4484 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4486 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
4487 if (UNLIKELY(current_cpu->trace_result_p))
4488 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4489 current_cpu->h_tbit_set (opval);
4493 current_cpu->done_insn (npc, status);
4497 // ********** xor-compact: xor $rm64, $rn64
4500 sh4_nofpu_sem_xor_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4501 sh4_nofpu::write_stacks &buf)
4503 #define FLD(f) abuf->fields.sfmt_and_compact.f
4504 sem_status status = SEM_STATUS_NORMAL;
4505 sh4_nofpu_scache* abuf = sem;
4506 unsigned long long written = 0;
4507 PCADDR pc = abuf->addr;
4508 PCADDR npc = pc + 2;
4511 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
4512 if (UNLIKELY(current_cpu->trace_result_p))
4513 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4514 current_cpu->h_gr_set (FLD (f_rn), opval);
4517 current_cpu->done_insn (npc, status);
4521 // ********** xori-compact: xor #$uimm8, r0
4524 sh4_nofpu_sem_xori_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4525 sh4_nofpu::write_stacks &buf)
4527 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4528 sem_status status = SEM_STATUS_NORMAL;
4529 sh4_nofpu_scache* abuf = sem;
4530 unsigned long long written = 0;
4531 PCADDR pc = abuf->addr;
4532 PCADDR npc = pc + 2;
4535 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4536 if (UNLIKELY(current_cpu->trace_result_p))
4537 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4538 current_cpu->h_grc_set (((UINT) 0), opval);
4541 current_cpu->done_insn (npc, status);
4545 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
4548 sh4_nofpu_sem_xorb_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4549 sh4_nofpu::write_stacks &buf)
4551 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4552 sem_status status = SEM_STATUS_NORMAL;
4553 sh4_nofpu_scache* abuf = sem;
4554 unsigned long long written = 0;
4555 PCADDR pc = abuf->addr;
4556 PCADDR npc = pc + 2;
4561 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4562 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4564 UQI opval = tmp_data;
4565 if (UNLIKELY(current_cpu->trace_result_p))
4566 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4567 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4571 current_cpu->done_insn (npc, status);
4575 // ********** xtrct-compact: xtrct $rm, $rn
4578 sh4_nofpu_sem_xtrct_compact (sh4_nofpu_cpu* current_cpu, sh4_nofpu_scache* sem, const int tick,
4579 sh4_nofpu::write_stacks &buf)
4581 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4582 sem_status status = SEM_STATUS_NORMAL;
4583 sh4_nofpu_scache* abuf = sem;
4584 unsigned long long written = 0;
4585 PCADDR pc = abuf->addr;
4586 PCADDR npc = pc + 2;
4589 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
4590 if (UNLIKELY(current_cpu->trace_result_p))
4591 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4592 current_cpu->h_grc_set (FLD (f_rn), opval);
4595 current_cpu->done_insn (npc, status);