1 /* Simulator instruction semantics for sh2a_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 "sh2a_nofpu.h"
18 using namespace sh2a_nofpu; // FIXME: namespace organization still wip
19 using namespace sh2a_nofpu; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
23 // ********** x-invalid: --invalid--
26 sh2a_nofpu_sem_x_invalid (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
27 sh2a_nofpu::write_stacks &buf)
29 #define FLD(f) abuf->fields.fmt_empty.f
30 sem_status status = SEM_STATUS_NORMAL;
31 sh2a_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 sh2a_nofpu_sem_add_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
50 sh2a_nofpu::write_stacks &buf)
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53 sem_status status = SEM_STATUS_NORMAL;
54 sh2a_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 sh2a_nofpu_sem_addi_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
74 sh2a_nofpu::write_stacks &buf)
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77 sem_status status = SEM_STATUS_NORMAL;
78 sh2a_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 sh2a_nofpu_sem_addc_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
98 sh2a_nofpu::write_stacks &buf)
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101 sem_status status = SEM_STATUS_NORMAL;
102 sh2a_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 sh2a_nofpu_sem_addv_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
132 sh2a_nofpu::write_stacks &buf)
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135 sem_status status = SEM_STATUS_NORMAL;
136 sh2a_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 sh2a_nofpu_sem_and_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
166 sh2a_nofpu::write_stacks &buf)
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169 sem_status status = SEM_STATUS_NORMAL;
170 sh2a_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 sh2a_nofpu_sem_andi_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
190 sh2a_nofpu::write_stacks &buf)
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193 sem_status status = SEM_STATUS_NORMAL;
194 sh2a_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 sh2a_nofpu_sem_andb_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
214 sh2a_nofpu::write_stacks &buf)
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217 sem_status status = SEM_STATUS_NORMAL;
218 sh2a_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 sh2a_nofpu_sem_bf_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
244 sh2a_nofpu::write_stacks &buf)
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247 sem_status status = SEM_STATUS_NORMAL;
248 sh2a_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 sh2a_nofpu_sem_bfs_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
272 sh2a_nofpu::write_stacks &buf)
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275 sem_status status = SEM_STATUS_NORMAL;
276 sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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 sh2a_nofpu_sem_bra_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
309 sh2a_nofpu::write_stacks &buf)
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312 sem_status status = SEM_STATUS_NORMAL;
313 sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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 sh2a_nofpu_sem_braf_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
342 sh2a_nofpu::write_stacks &buf)
344 #define FLD(f) abuf->fields.sfmt_divu_compact.f
345 sem_status status = SEM_STATUS_NORMAL;
346 sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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 sh2a_nofpu_sem_bsr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
375 sh2a_nofpu::write_stacks &buf)
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378 sem_status status = SEM_STATUS_NORMAL;
379 sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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 sh2a_nofpu_sem_bsrf_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
414 sh2a_nofpu::write_stacks &buf)
416 #define FLD(f) abuf->fields.sfmt_divu_compact.f
417 sem_status status = SEM_STATUS_NORMAL;
418 sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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 sh2a_nofpu_sem_bt_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
453 sh2a_nofpu::write_stacks &buf)
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456 sem_status status = SEM_STATUS_NORMAL;
457 sh2a_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 sh2a_nofpu_sem_bts_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
481 sh2a_nofpu::write_stacks &buf)
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484 sem_status status = SEM_STATUS_NORMAL;
485 sh2a_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) % sh2a_nofpu::pipe_sz].push (sh2a_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 sh2a_nofpu_sem_clrmac_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
518 sh2a_nofpu::write_stacks &buf)
520 #define FLD(f) abuf->fields.fmt_empty.f
521 sem_status status = SEM_STATUS_NORMAL;
522 sh2a_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 // ********** clrt-compact: clrt
549 sh2a_nofpu_sem_clrt_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
550 sh2a_nofpu::write_stacks &buf)
552 #define FLD(f) abuf->fields.fmt_empty.f
553 sem_status status = SEM_STATUS_NORMAL;
554 sh2a_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 << "tbit" << ":=0x" << hex << opval << dec << " ";
563 current_cpu->h_tbit_set (opval);
566 current_cpu->done_insn (npc, status);
570 // ********** cmpeq-compact: cmp/eq $rm, $rn
573 sh2a_nofpu_sem_cmpeq_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
574 sh2a_nofpu::write_stacks &buf)
576 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
577 sem_status status = SEM_STATUS_NORMAL;
578 sh2a_nofpu_scache* abuf = sem;
579 unsigned long long written = 0;
580 PCADDR pc = abuf->addr;
584 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
585 if (UNLIKELY(current_cpu->trace_result_p))
586 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
587 current_cpu->h_tbit_set (opval);
590 current_cpu->done_insn (npc, status);
594 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
597 sh2a_nofpu_sem_cmpeqi_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
598 sh2a_nofpu::write_stacks &buf)
600 #define FLD(f) abuf->fields.sfmt_andi_compact.f
601 sem_status status = SEM_STATUS_NORMAL;
602 sh2a_nofpu_scache* abuf = sem;
603 unsigned long long written = 0;
604 PCADDR pc = abuf->addr;
608 BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
609 if (UNLIKELY(current_cpu->trace_result_p))
610 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
611 current_cpu->h_tbit_set (opval);
614 current_cpu->done_insn (npc, status);
618 // ********** cmpge-compact: cmp/ge $rm, $rn
621 sh2a_nofpu_sem_cmpge_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
622 sh2a_nofpu::write_stacks &buf)
624 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
625 sem_status status = SEM_STATUS_NORMAL;
626 sh2a_nofpu_scache* abuf = sem;
627 unsigned long long written = 0;
628 PCADDR pc = abuf->addr;
632 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
633 if (UNLIKELY(current_cpu->trace_result_p))
634 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
635 current_cpu->h_tbit_set (opval);
638 current_cpu->done_insn (npc, status);
642 // ********** cmpgt-compact: cmp/gt $rm, $rn
645 sh2a_nofpu_sem_cmpgt_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
646 sh2a_nofpu::write_stacks &buf)
648 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
649 sem_status status = SEM_STATUS_NORMAL;
650 sh2a_nofpu_scache* abuf = sem;
651 unsigned long long written = 0;
652 PCADDR pc = abuf->addr;
656 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
657 if (UNLIKELY(current_cpu->trace_result_p))
658 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
659 current_cpu->h_tbit_set (opval);
662 current_cpu->done_insn (npc, status);
666 // ********** cmphi-compact: cmp/hi $rm, $rn
669 sh2a_nofpu_sem_cmphi_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
670 sh2a_nofpu::write_stacks &buf)
672 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
673 sem_status status = SEM_STATUS_NORMAL;
674 sh2a_nofpu_scache* abuf = sem;
675 unsigned long long written = 0;
676 PCADDR pc = abuf->addr;
680 BI opval = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
681 if (UNLIKELY(current_cpu->trace_result_p))
682 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
683 current_cpu->h_tbit_set (opval);
686 current_cpu->done_insn (npc, status);
690 // ********** cmphs-compact: cmp/hs $rm, $rn
693 sh2a_nofpu_sem_cmphs_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
694 sh2a_nofpu::write_stacks &buf)
696 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
697 sem_status status = SEM_STATUS_NORMAL;
698 sh2a_nofpu_scache* abuf = sem;
699 unsigned long long written = 0;
700 PCADDR pc = abuf->addr;
704 BI opval = GEUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
705 if (UNLIKELY(current_cpu->trace_result_p))
706 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
707 current_cpu->h_tbit_set (opval);
710 current_cpu->done_insn (npc, status);
714 // ********** cmppl-compact: cmp/pl $rn
717 sh2a_nofpu_sem_cmppl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
718 sh2a_nofpu::write_stacks &buf)
720 #define FLD(f) abuf->fields.sfmt_divu_compact.f
721 sem_status status = SEM_STATUS_NORMAL;
722 sh2a_nofpu_scache* abuf = sem;
723 unsigned long long written = 0;
724 PCADDR pc = abuf->addr;
728 BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
729 if (UNLIKELY(current_cpu->trace_result_p))
730 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
731 current_cpu->h_tbit_set (opval);
734 current_cpu->done_insn (npc, status);
738 // ********** cmppz-compact: cmp/pz $rn
741 sh2a_nofpu_sem_cmppz_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
742 sh2a_nofpu::write_stacks &buf)
744 #define FLD(f) abuf->fields.sfmt_divu_compact.f
745 sem_status status = SEM_STATUS_NORMAL;
746 sh2a_nofpu_scache* abuf = sem;
747 unsigned long long written = 0;
748 PCADDR pc = abuf->addr;
752 BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), 0);
753 if (UNLIKELY(current_cpu->trace_result_p))
754 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
755 current_cpu->h_tbit_set (opval);
758 current_cpu->done_insn (npc, status);
762 // ********** cmpstr-compact: cmp/str $rm, $rn
765 sh2a_nofpu_sem_cmpstr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
766 sh2a_nofpu::write_stacks &buf)
768 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
769 sem_status status = SEM_STATUS_NORMAL;
770 sh2a_nofpu_scache* abuf = sem;
771 unsigned long long written = 0;
772 PCADDR pc = abuf->addr;
778 tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
779 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
780 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
781 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
782 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
784 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
785 if (UNLIKELY(current_cpu->trace_result_p))
786 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
787 current_cpu->h_tbit_set (opval);
791 current_cpu->done_insn (npc, status);
795 // ********** div0s-compact: div0s $rm, $rn
798 sh2a_nofpu_sem_div0s_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
799 sh2a_nofpu::write_stacks &buf)
801 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
802 sem_status status = SEM_STATUS_NORMAL;
803 sh2a_nofpu_scache* abuf = sem;
804 unsigned long long written = 0;
805 PCADDR pc = abuf->addr;
810 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
811 if (UNLIKELY(current_cpu->trace_result_p))
812 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
813 current_cpu->h_qbit_set (opval);
816 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
817 if (UNLIKELY(current_cpu->trace_result_p))
818 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
819 current_cpu->h_mbit_set (opval);
822 BI opval = ((EQSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31))) ? (0) : (1));
823 if (UNLIKELY(current_cpu->trace_result_p))
824 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
825 current_cpu->h_tbit_set (opval);
829 current_cpu->done_insn (npc, status);
833 // ********** div0u-compact: div0u
836 sh2a_nofpu_sem_div0u_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
837 sh2a_nofpu::write_stacks &buf)
839 #define FLD(f) abuf->fields.fmt_empty.f
840 sem_status status = SEM_STATUS_NORMAL;
841 sh2a_nofpu_scache* abuf = sem;
842 unsigned long long written = 0;
843 PCADDR pc = abuf->addr;
849 if (UNLIKELY(current_cpu->trace_result_p))
850 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
851 current_cpu->h_tbit_set (opval);
855 if (UNLIKELY(current_cpu->trace_result_p))
856 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
857 current_cpu->h_qbit_set (opval);
861 if (UNLIKELY(current_cpu->trace_result_p))
862 current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << " ";
863 current_cpu->h_mbit_set (opval);
867 current_cpu->done_insn (npc, status);
871 // ********** div1-compact: div1 $rm, $rn
874 sh2a_nofpu_sem_div1_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
875 sh2a_nofpu::write_stacks &buf)
877 #define FLD(f) abuf->fields.sfmt_macl_compact.f
878 sem_status status = SEM_STATUS_NORMAL;
879 sh2a_nofpu_scache* abuf = sem;
880 unsigned long long written = 0;
881 PCADDR pc = abuf->addr;
888 tmp_oldq = current_cpu->h_qbit_get ();
890 BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
891 if (UNLIKELY(current_cpu->trace_result_p))
892 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
893 current_cpu->h_qbit_set (opval);
896 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
897 if (UNLIKELY(current_cpu->trace_result_p))
898 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
899 current_cpu->h_grc_set (FLD (f_rn), opval);
901 if (NOTBI (tmp_oldq)) {
902 if (NOTBI (current_cpu->h_mbit_get ())) {
904 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
906 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
907 if (UNLIKELY(current_cpu->trace_result_p))
908 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
909 current_cpu->h_grc_set (FLD (f_rn), opval);
911 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
912 if (NOTBI (current_cpu->h_qbit_get ())) {
914 BI opval = ((tmp_tmp1) ? (1) : (0));
915 if (UNLIKELY(current_cpu->trace_result_p))
916 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
917 current_cpu->h_qbit_set (opval);
921 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
922 if (UNLIKELY(current_cpu->trace_result_p))
923 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
924 current_cpu->h_qbit_set (opval);
930 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
932 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
933 if (UNLIKELY(current_cpu->trace_result_p))
934 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
935 current_cpu->h_grc_set (FLD (f_rn), opval);
937 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
938 if (NOTBI (current_cpu->h_qbit_get ())) {
940 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
941 if (UNLIKELY(current_cpu->trace_result_p))
942 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
943 current_cpu->h_qbit_set (opval);
947 BI opval = ((tmp_tmp1) ? (1) : (0));
948 if (UNLIKELY(current_cpu->trace_result_p))
949 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
950 current_cpu->h_qbit_set (opval);
956 if (NOTBI (current_cpu->h_mbit_get ())) {
958 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
960 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
961 if (UNLIKELY(current_cpu->trace_result_p))
962 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
963 current_cpu->h_grc_set (FLD (f_rn), opval);
965 tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
966 if (NOTBI (current_cpu->h_qbit_get ())) {
968 BI opval = ((tmp_tmp1) ? (1) : (0));
969 if (UNLIKELY(current_cpu->trace_result_p))
970 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
971 current_cpu->h_qbit_set (opval);
975 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
976 if (UNLIKELY(current_cpu->trace_result_p))
977 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
978 current_cpu->h_qbit_set (opval);
984 tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
986 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
987 if (UNLIKELY(current_cpu->trace_result_p))
988 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
989 current_cpu->h_grc_set (FLD (f_rn), opval);
991 tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
992 if (NOTBI (current_cpu->h_qbit_get ())) {
994 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
995 if (UNLIKELY(current_cpu->trace_result_p))
996 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
997 current_cpu->h_qbit_set (opval);
1001 BI opval = ((tmp_tmp1) ? (1) : (0));
1002 if (UNLIKELY(current_cpu->trace_result_p))
1003 current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << " ";
1004 current_cpu->h_qbit_set (opval);
1011 BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1012 if (UNLIKELY(current_cpu->trace_result_p))
1013 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1014 current_cpu->h_tbit_set (opval);
1018 current_cpu->done_insn (npc, status);
1022 // ********** divu-compact: divu r0, $rn
1025 sh2a_nofpu_sem_divu_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1026 sh2a_nofpu::write_stacks &buf)
1028 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1029 sem_status status = SEM_STATUS_NORMAL;
1030 sh2a_nofpu_scache* abuf = sem;
1031 unsigned long long written = 0;
1032 PCADDR pc = abuf->addr;
1033 PCADDR npc = pc + 2;
1036 SI opval = UDIVSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1037 if (UNLIKELY(current_cpu->trace_result_p))
1038 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1039 current_cpu->h_grc_set (FLD (f_rn), opval);
1042 current_cpu->done_insn (npc, status);
1046 // ********** mulr-compact: mulr r0, $rn
1049 sh2a_nofpu_sem_mulr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1050 sh2a_nofpu::write_stacks &buf)
1052 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1053 sem_status status = SEM_STATUS_NORMAL;
1054 sh2a_nofpu_scache* abuf = sem;
1055 unsigned long long written = 0;
1056 PCADDR pc = abuf->addr;
1057 PCADDR npc = pc + 2;
1060 SI opval = MULSI (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 // ********** dmulsl-compact: dmuls.l $rm, $rn
1073 sh2a_nofpu_sem_dmulsl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1074 sh2a_nofpu::write_stacks &buf)
1076 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1077 sem_status status = SEM_STATUS_NORMAL;
1078 sh2a_nofpu_scache* abuf = sem;
1079 unsigned long long written = 0;
1080 PCADDR pc = abuf->addr;
1081 PCADDR npc = pc + 2;
1085 tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1087 SI opval = SUBWORDDISI (tmp_result, 0);
1088 if (UNLIKELY(current_cpu->trace_result_p))
1089 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1090 current_cpu->h_mach_set (opval);
1093 SI opval = SUBWORDDISI (tmp_result, 1);
1094 if (UNLIKELY(current_cpu->trace_result_p))
1095 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1096 current_cpu->h_macl_set (opval);
1100 current_cpu->done_insn (npc, status);
1104 // ********** dmulul-compact: dmulu.l $rm, $rn
1107 sh2a_nofpu_sem_dmulul_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1108 sh2a_nofpu::write_stacks &buf)
1110 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1111 sem_status status = SEM_STATUS_NORMAL;
1112 sh2a_nofpu_scache* abuf = sem;
1113 unsigned long long written = 0;
1114 PCADDR pc = abuf->addr;
1115 PCADDR npc = pc + 2;
1119 tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1121 SI opval = SUBWORDDISI (tmp_result, 0);
1122 if (UNLIKELY(current_cpu->trace_result_p))
1123 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1124 current_cpu->h_mach_set (opval);
1127 SI opval = SUBWORDDISI (tmp_result, 1);
1128 if (UNLIKELY(current_cpu->trace_result_p))
1129 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1130 current_cpu->h_macl_set (opval);
1134 current_cpu->done_insn (npc, status);
1138 // ********** dt-compact: dt $rn
1141 sh2a_nofpu_sem_dt_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1142 sh2a_nofpu::write_stacks &buf)
1144 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1145 sem_status status = SEM_STATUS_NORMAL;
1146 sh2a_nofpu_scache* abuf = sem;
1147 unsigned long long written = 0;
1148 PCADDR pc = abuf->addr;
1149 PCADDR npc = pc + 2;
1153 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1154 if (UNLIKELY(current_cpu->trace_result_p))
1155 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1156 current_cpu->h_grc_set (FLD (f_rn), opval);
1159 BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1160 if (UNLIKELY(current_cpu->trace_result_p))
1161 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
1162 current_cpu->h_tbit_set (opval);
1166 current_cpu->done_insn (npc, status);
1170 // ********** extsb-compact: exts.b $rm, $rn
1173 sh2a_nofpu_sem_extsb_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1174 sh2a_nofpu::write_stacks &buf)
1176 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1177 sem_status status = SEM_STATUS_NORMAL;
1178 sh2a_nofpu_scache* abuf = sem;
1179 unsigned long long written = 0;
1180 PCADDR pc = abuf->addr;
1181 PCADDR npc = pc + 2;
1184 SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1185 if (UNLIKELY(current_cpu->trace_result_p))
1186 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1187 current_cpu->h_grc_set (FLD (f_rn), opval);
1190 current_cpu->done_insn (npc, status);
1194 // ********** extsw-compact: exts.w $rm, $rn
1197 sh2a_nofpu_sem_extsw_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1198 sh2a_nofpu::write_stacks &buf)
1200 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1201 sem_status status = SEM_STATUS_NORMAL;
1202 sh2a_nofpu_scache* abuf = sem;
1203 unsigned long long written = 0;
1204 PCADDR pc = abuf->addr;
1205 PCADDR npc = pc + 2;
1208 SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1209 if (UNLIKELY(current_cpu->trace_result_p))
1210 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1211 current_cpu->h_grc_set (FLD (f_rn), opval);
1214 current_cpu->done_insn (npc, status);
1218 // ********** extub-compact: extu.b $rm, $rn
1221 sh2a_nofpu_sem_extub_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1222 sh2a_nofpu::write_stacks &buf)
1224 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1225 sem_status status = SEM_STATUS_NORMAL;
1226 sh2a_nofpu_scache* abuf = sem;
1227 unsigned long long written = 0;
1228 PCADDR pc = abuf->addr;
1229 PCADDR npc = pc + 2;
1232 SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
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 // ********** extuw-compact: extu.w $rm, $rn
1245 sh2a_nofpu_sem_extuw_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1246 sh2a_nofpu::write_stacks &buf)
1248 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1249 sem_status status = SEM_STATUS_NORMAL;
1250 sh2a_nofpu_scache* abuf = sem;
1251 unsigned long long written = 0;
1252 PCADDR pc = abuf->addr;
1253 PCADDR npc = pc + 2;
1256 SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
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 // ********** frchg-compact: frchg
1269 sh2a_nofpu_sem_frchg_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1270 sh2a_nofpu::write_stacks &buf)
1272 #define FLD(f) abuf->fields.fmt_empty.f
1273 sem_status status = SEM_STATUS_NORMAL;
1274 sh2a_nofpu_scache* abuf = sem;
1275 unsigned long long written = 0;
1276 PCADDR pc = abuf->addr;
1277 PCADDR npc = pc + 2;
1280 BI opval = NOTBI (current_cpu->h_frbit_get ());
1281 if (UNLIKELY(current_cpu->trace_result_p))
1282 current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << " ";
1283 current_cpu->h_frbit_set (opval);
1286 current_cpu->done_insn (npc, status);
1290 // ********** fschg-compact: fschg
1293 sh2a_nofpu_sem_fschg_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1294 sh2a_nofpu::write_stacks &buf)
1296 #define FLD(f) abuf->fields.fmt_empty.f
1297 sem_status status = SEM_STATUS_NORMAL;
1298 sh2a_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_szbit_get ());
1305 if (UNLIKELY(current_cpu->trace_result_p))
1306 current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << " ";
1307 current_cpu->h_szbit_set (opval);
1310 current_cpu->done_insn (npc, status);
1314 // ********** jmp-compact: jmp @$rn
1317 sh2a_nofpu_sem_jmp_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1318 sh2a_nofpu::write_stacks &buf)
1320 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1321 sem_status status = SEM_STATUS_NORMAL;
1322 sh2a_nofpu_scache* abuf = sem;
1323 unsigned long long written = 0;
1324 PCADDR pc = abuf->addr;
1325 PCADDR npc = pc + 2;
1329 UDI opval = ADDDI (pc, 2);
1330 if (UNLIKELY(current_cpu->trace_result_p))
1331 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1332 current_cpu->branch (opval, npc, status);
1334 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1336 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1337 buf.h_pc_writes [(tick + 1) % sh2a_nofpu::pipe_sz].push (sh2a_nofpu::write<UDI>(pc, opval));
1338 if (UNLIKELY(current_cpu->trace_result_p))
1339 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1341 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1344 current_cpu->done_cti_insn (npc, status);
1348 // ********** jsr-compact: jsr @$rn
1351 sh2a_nofpu_sem_jsr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1352 sh2a_nofpu::write_stacks &buf)
1354 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1355 sem_status status = SEM_STATUS_NORMAL;
1356 sh2a_nofpu_scache* abuf = sem;
1357 unsigned long long written = 0;
1358 PCADDR pc = abuf->addr;
1359 PCADDR npc = pc + 2;
1363 SI opval = ADDDI (pc, 4);
1364 buf.h_pr_writes [(tick + 1) % sh2a_nofpu::pipe_sz].push (sh2a_nofpu::write<SI>(pc, opval));
1365 if (UNLIKELY(current_cpu->trace_result_p))
1366 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1369 UDI opval = ADDDI (pc, 2);
1370 if (UNLIKELY(current_cpu->trace_result_p))
1371 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1372 current_cpu->branch (opval, npc, status);
1374 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1376 UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1377 buf.h_pc_writes [(tick + 1) % sh2a_nofpu::pipe_sz].push (sh2a_nofpu::write<UDI>(pc, opval));
1378 if (UNLIKELY(current_cpu->trace_result_p))
1379 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
1381 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1384 current_cpu->done_cti_insn (npc, status);
1388 // ********** ldc-gbr-compact: ldc $rn, gbr
1391 sh2a_nofpu_sem_ldc_gbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1392 sh2a_nofpu::write_stacks &buf)
1394 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1395 sem_status status = SEM_STATUS_NORMAL;
1396 sh2a_nofpu_scache* abuf = sem;
1397 unsigned long long written = 0;
1398 PCADDR pc = abuf->addr;
1399 PCADDR npc = pc + 2;
1402 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1403 if (UNLIKELY(current_cpu->trace_result_p))
1404 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1405 current_cpu->h_gbr_set (opval);
1408 current_cpu->done_insn (npc, status);
1412 // ********** ldc-vbr-compact: ldc $rn, vbr
1415 sh2a_nofpu_sem_ldc_vbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1416 sh2a_nofpu::write_stacks &buf)
1418 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1419 sem_status status = SEM_STATUS_NORMAL;
1420 sh2a_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 << "vbr" << ":=0x" << hex << opval << dec << " ";
1429 current_cpu->h_vbr_set (opval);
1432 current_cpu->done_insn (npc, status);
1436 // ********** ldc-sr-compact: ldc $rn, sr
1439 sh2a_nofpu_sem_ldc_sr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1440 sh2a_nofpu::write_stacks &buf)
1442 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1443 sem_status status = SEM_STATUS_NORMAL;
1444 sh2a_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 << "sr" << ":=0x" << hex << opval << dec << " ";
1453 current_cpu->hardware.h_sr = opval;
1456 current_cpu->done_insn (npc, status);
1460 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
1463 sh2a_nofpu_sem_ldcl_gbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1464 sh2a_nofpu::write_stacks &buf)
1466 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1467 sem_status status = SEM_STATUS_NORMAL;
1468 sh2a_nofpu_scache* abuf = sem;
1469 unsigned long long written = 0;
1470 PCADDR pc = abuf->addr;
1471 PCADDR npc = pc + 2;
1475 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1476 if (UNLIKELY(current_cpu->trace_result_p))
1477 current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << " ";
1478 current_cpu->h_gbr_set (opval);
1481 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1482 if (UNLIKELY(current_cpu->trace_result_p))
1483 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1484 current_cpu->h_grc_set (FLD (f_rn), opval);
1488 current_cpu->done_insn (npc, status);
1492 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
1495 sh2a_nofpu_sem_ldcl_vbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1496 sh2a_nofpu::write_stacks &buf)
1498 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1499 sem_status status = SEM_STATUS_NORMAL;
1500 sh2a_nofpu_scache* abuf = sem;
1501 unsigned long long written = 0;
1502 PCADDR pc = abuf->addr;
1503 PCADDR npc = pc + 2;
1507 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1508 if (UNLIKELY(current_cpu->trace_result_p))
1509 current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << " ";
1510 current_cpu->h_vbr_set (opval);
1513 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1514 if (UNLIKELY(current_cpu->trace_result_p))
1515 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1516 current_cpu->h_grc_set (FLD (f_rn), opval);
1520 current_cpu->done_insn (npc, status);
1524 // ********** lds-mach-compact: lds $rn, mach
1527 sh2a_nofpu_sem_lds_mach_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1528 sh2a_nofpu::write_stacks &buf)
1530 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1531 sem_status status = SEM_STATUS_NORMAL;
1532 sh2a_nofpu_scache* abuf = sem;
1533 unsigned long long written = 0;
1534 PCADDR pc = abuf->addr;
1535 PCADDR npc = pc + 2;
1538 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1539 if (UNLIKELY(current_cpu->trace_result_p))
1540 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1541 current_cpu->h_mach_set (opval);
1544 current_cpu->done_insn (npc, status);
1548 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
1551 sh2a_nofpu_sem_ldsl_mach_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1552 sh2a_nofpu::write_stacks &buf)
1554 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1555 sem_status status = SEM_STATUS_NORMAL;
1556 sh2a_nofpu_scache* abuf = sem;
1557 unsigned long long written = 0;
1558 PCADDR pc = abuf->addr;
1559 PCADDR npc = pc + 2;
1563 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1564 if (UNLIKELY(current_cpu->trace_result_p))
1565 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1566 current_cpu->h_mach_set (opval);
1569 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1570 if (UNLIKELY(current_cpu->trace_result_p))
1571 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1572 current_cpu->h_grc_set (FLD (f_rn), opval);
1576 current_cpu->done_insn (npc, status);
1580 // ********** lds-macl-compact: lds $rn, macl
1583 sh2a_nofpu_sem_lds_macl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1584 sh2a_nofpu::write_stacks &buf)
1586 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1587 sem_status status = SEM_STATUS_NORMAL;
1588 sh2a_nofpu_scache* abuf = sem;
1589 unsigned long long written = 0;
1590 PCADDR pc = abuf->addr;
1591 PCADDR npc = pc + 2;
1594 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1595 if (UNLIKELY(current_cpu->trace_result_p))
1596 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1597 current_cpu->h_macl_set (opval);
1600 current_cpu->done_insn (npc, status);
1604 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
1607 sh2a_nofpu_sem_ldsl_macl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1608 sh2a_nofpu::write_stacks &buf)
1610 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1611 sem_status status = SEM_STATUS_NORMAL;
1612 sh2a_nofpu_scache* abuf = sem;
1613 unsigned long long written = 0;
1614 PCADDR pc = abuf->addr;
1615 PCADDR npc = pc + 2;
1619 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1620 if (UNLIKELY(current_cpu->trace_result_p))
1621 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1622 current_cpu->h_macl_set (opval);
1625 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1626 if (UNLIKELY(current_cpu->trace_result_p))
1627 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1628 current_cpu->h_grc_set (FLD (f_rn), opval);
1632 current_cpu->done_insn (npc, status);
1636 // ********** lds-pr-compact: lds $rn, pr
1639 sh2a_nofpu_sem_lds_pr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1640 sh2a_nofpu::write_stacks &buf)
1642 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1643 sem_status status = SEM_STATUS_NORMAL;
1644 sh2a_nofpu_scache* abuf = sem;
1645 unsigned long long written = 0;
1646 PCADDR pc = abuf->addr;
1647 PCADDR npc = pc + 2;
1650 SI opval = current_cpu->h_grc_get (FLD (f_rn));
1651 if (UNLIKELY(current_cpu->trace_result_p))
1652 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1653 current_cpu->h_pr_set (opval);
1656 current_cpu->done_insn (npc, status);
1660 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
1663 sh2a_nofpu_sem_ldsl_pr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1664 sh2a_nofpu::write_stacks &buf)
1666 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1667 sem_status status = SEM_STATUS_NORMAL;
1668 sh2a_nofpu_scache* abuf = sem;
1669 unsigned long long written = 0;
1670 PCADDR pc = abuf->addr;
1671 PCADDR npc = pc + 2;
1675 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1676 if (UNLIKELY(current_cpu->trace_result_p))
1677 current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << " ";
1678 current_cpu->h_pr_set (opval);
1681 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1682 if (UNLIKELY(current_cpu->trace_result_p))
1683 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1684 current_cpu->h_grc_set (FLD (f_rn), opval);
1688 current_cpu->done_insn (npc, status);
1692 // ********** macl-compact: mac.l @${rm}+, @${rn}+
1695 sh2a_nofpu_sem_macl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1696 sh2a_nofpu::write_stacks &buf)
1698 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1699 sem_status status = SEM_STATUS_NORMAL;
1700 sh2a_nofpu_scache* abuf = sem;
1701 unsigned long long written = 0;
1702 PCADDR pc = abuf->addr;
1703 PCADDR npc = pc + 2;
1711 tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1713 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1714 if (UNLIKELY(current_cpu->trace_result_p))
1715 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1716 current_cpu->h_grc_set (FLD (f_rn), opval);
1718 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1721 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1722 if (UNLIKELY(current_cpu->trace_result_p))
1723 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1724 current_cpu->h_grc_set (FLD (f_rn), opval);
1727 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1728 written |= (1ULL << 11);
1729 if (UNLIKELY(current_cpu->trace_result_p))
1730 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1731 current_cpu->h_grc_set (FLD (f_rm), opval);
1735 tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1737 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1738 written |= (1ULL << 11);
1739 if (UNLIKELY(current_cpu->trace_result_p))
1740 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1741 current_cpu->h_grc_set (FLD (f_rm), opval);
1743 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
1744 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1745 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
1747 if (current_cpu->h_sbit_get ()) {
1751 tmp_max = SRLDI (INVDI (0), 16);
1752 tmp_min = SRLDI (INVDI (0), 15);
1753 if (GTDI (tmp_result, tmp_max)) {
1754 tmp_result = tmp_max;
1756 if (LTDI (tmp_result, tmp_min)) {
1757 tmp_result = tmp_min;
1763 SI opval = SUBWORDDISI (tmp_result, 0);
1764 if (UNLIKELY(current_cpu->trace_result_p))
1765 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1766 current_cpu->h_mach_set (opval);
1769 SI opval = SUBWORDDISI (tmp_result, 1);
1770 if (UNLIKELY(current_cpu->trace_result_p))
1771 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1772 current_cpu->h_macl_set (opval);
1777 abuf->written = written;
1778 current_cpu->done_insn (npc, status);
1782 // ********** macw-compact: mac.w @${rm}+, @${rn}+
1785 sh2a_nofpu_sem_macw_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1786 sh2a_nofpu::write_stacks &buf)
1788 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1789 sem_status status = SEM_STATUS_NORMAL;
1790 sh2a_nofpu_scache* abuf = sem;
1791 unsigned long long written = 0;
1792 PCADDR pc = abuf->addr;
1793 PCADDR npc = pc + 2;
1801 tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1803 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1804 if (UNLIKELY(current_cpu->trace_result_p))
1805 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1806 current_cpu->h_grc_set (FLD (f_rn), opval);
1808 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1811 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1812 if (UNLIKELY(current_cpu->trace_result_p))
1813 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1814 current_cpu->h_grc_set (FLD (f_rn), opval);
1817 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1818 written |= (1ULL << 11);
1819 if (UNLIKELY(current_cpu->trace_result_p))
1820 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1821 current_cpu->h_grc_set (FLD (f_rm), opval);
1825 tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1827 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1828 written |= (1ULL << 11);
1829 if (UNLIKELY(current_cpu->trace_result_p))
1830 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
1831 current_cpu->h_grc_set (FLD (f_rm), opval);
1833 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
1834 if (current_cpu->h_sbit_get ()) {
1836 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
1839 written |= (1ULL << 9);
1840 if (UNLIKELY(current_cpu->trace_result_p))
1841 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1842 current_cpu->h_mach_set (opval);
1846 SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
1847 written |= (1ULL << 10);
1848 if (UNLIKELY(current_cpu->trace_result_p))
1849 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1850 current_cpu->h_macl_set (opval);
1855 tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1856 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
1858 SI opval = SUBWORDDISI (tmp_result, 0);
1859 written |= (1ULL << 9);
1860 if (UNLIKELY(current_cpu->trace_result_p))
1861 current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << " ";
1862 current_cpu->h_mach_set (opval);
1865 SI opval = SUBWORDDISI (tmp_result, 1);
1866 written |= (1ULL << 10);
1867 if (UNLIKELY(current_cpu->trace_result_p))
1868 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
1869 current_cpu->h_macl_set (opval);
1875 abuf->written = written;
1876 current_cpu->done_insn (npc, status);
1880 // ********** mov-compact: mov $rm64, $rn64
1883 sh2a_nofpu_sem_mov_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1884 sh2a_nofpu::write_stacks &buf)
1886 #define FLD(f) abuf->fields.sfmt_and_compact.f
1887 sem_status status = SEM_STATUS_NORMAL;
1888 sh2a_nofpu_scache* abuf = sem;
1889 unsigned long long written = 0;
1890 PCADDR pc = abuf->addr;
1891 PCADDR npc = pc + 2;
1894 DI opval = current_cpu->h_gr_get (FLD (f_rm));
1895 if (UNLIKELY(current_cpu->trace_result_p))
1896 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1897 current_cpu->h_gr_set (FLD (f_rn), opval);
1900 current_cpu->done_insn (npc, status);
1904 // ********** movi-compact: mov #$imm8, $rn
1907 sh2a_nofpu_sem_movi_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1908 sh2a_nofpu::write_stacks &buf)
1910 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1911 sem_status status = SEM_STATUS_NORMAL;
1912 sh2a_nofpu_scache* abuf = sem;
1913 unsigned long long written = 0;
1914 PCADDR pc = abuf->addr;
1915 PCADDR npc = pc + 2;
1918 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
1919 if (UNLIKELY(current_cpu->trace_result_p))
1920 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
1921 current_cpu->h_grc_set (FLD (f_rn), opval);
1924 current_cpu->done_insn (npc, status);
1928 // ********** movi20-compact: movi20 #$imm20, $rn
1931 sh2a_nofpu_sem_movi20_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1932 sh2a_nofpu::write_stacks &buf)
1934 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
1935 sem_status status = SEM_STATUS_NORMAL;
1936 sh2a_nofpu_scache* abuf = sem;
1937 unsigned long long written = 0;
1938 PCADDR pc = abuf->addr;
1939 PCADDR npc = pc + 4;
1942 SI opval = FLD (f_imm20);
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 // ********** movb1-compact: mov.b $rm, @$rn
1955 sh2a_nofpu_sem_movb1_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1956 sh2a_nofpu::write_stacks &buf)
1958 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1959 sem_status status = SEM_STATUS_NORMAL;
1960 sh2a_nofpu_scache* abuf = sem;
1961 unsigned long long written = 0;
1962 PCADDR pc = abuf->addr;
1963 PCADDR npc = pc + 2;
1966 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1967 if (UNLIKELY(current_cpu->trace_result_p))
1968 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1969 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1972 current_cpu->done_insn (npc, status);
1976 // ********** movb2-compact: mov.b $rm, @-$rn
1979 sh2a_nofpu_sem_movb2_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
1980 sh2a_nofpu::write_stacks &buf)
1982 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1983 sem_status status = SEM_STATUS_NORMAL;
1984 sh2a_nofpu_scache* abuf = sem;
1985 unsigned long long written = 0;
1986 PCADDR pc = abuf->addr;
1987 PCADDR npc = pc + 2;
1991 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1993 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1994 if (UNLIKELY(current_cpu->trace_result_p))
1995 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
1996 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
1999 SI opval = tmp_addr;
2000 if (UNLIKELY(current_cpu->trace_result_p))
2001 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2002 current_cpu->h_grc_set (FLD (f_rn), opval);
2006 current_cpu->done_insn (npc, status);
2010 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
2013 sh2a_nofpu_sem_movb3_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2014 sh2a_nofpu::write_stacks &buf)
2016 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2017 sem_status status = SEM_STATUS_NORMAL;
2018 sh2a_nofpu_scache* abuf = sem;
2019 unsigned long long written = 0;
2020 PCADDR pc = abuf->addr;
2021 PCADDR npc = pc + 2;
2024 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
2025 if (UNLIKELY(current_cpu->trace_result_p))
2026 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 << " ";
2027 current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2030 current_cpu->done_insn (npc, status);
2034 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
2037 sh2a_nofpu_sem_movb4_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2038 sh2a_nofpu::write_stacks &buf)
2040 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2041 sem_status status = SEM_STATUS_NORMAL;
2042 sh2a_nofpu_scache* abuf = sem;
2043 unsigned long long written = 0;
2044 PCADDR pc = abuf->addr;
2045 PCADDR npc = pc + 2;
2049 tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
2051 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2052 if (UNLIKELY(current_cpu->trace_result_p))
2053 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2054 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2058 current_cpu->done_insn (npc, status);
2062 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
2065 sh2a_nofpu_sem_movb5_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2066 sh2a_nofpu::write_stacks &buf)
2068 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2069 sem_status status = SEM_STATUS_NORMAL;
2070 sh2a_nofpu_scache* abuf = sem;
2071 unsigned long long written = 0;
2072 PCADDR pc = abuf->addr;
2073 PCADDR npc = pc + 2;
2077 tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2079 UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2080 if (UNLIKELY(current_cpu->trace_result_p))
2081 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
2082 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2086 current_cpu->done_insn (npc, status);
2090 // ********** movb6-compact: mov.b @$rm, $rn
2093 sh2a_nofpu_sem_movb6_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2094 sh2a_nofpu::write_stacks &buf)
2096 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2097 sem_status status = SEM_STATUS_NORMAL;
2098 sh2a_nofpu_scache* abuf = sem;
2099 unsigned long long written = 0;
2100 PCADDR pc = abuf->addr;
2101 PCADDR npc = pc + 2;
2104 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2105 if (UNLIKELY(current_cpu->trace_result_p))
2106 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2107 current_cpu->h_grc_set (FLD (f_rn), opval);
2110 current_cpu->done_insn (npc, status);
2114 // ********** movb7-compact: mov.b @${rm}+, $rn
2117 sh2a_nofpu_sem_movb7_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2118 sh2a_nofpu::write_stacks &buf)
2120 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2121 sem_status status = SEM_STATUS_NORMAL;
2122 sh2a_nofpu_scache* abuf = sem;
2123 unsigned long long written = 0;
2124 PCADDR pc = abuf->addr;
2125 PCADDR npc = pc + 2;
2129 tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2130 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2132 SI opval = EXTQISI (tmp_data);
2133 written |= (1ULL << 4);
2134 if (UNLIKELY(current_cpu->trace_result_p))
2135 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2136 current_cpu->h_grc_set (FLD (f_rm), opval);
2140 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2141 written |= (1ULL << 4);
2142 if (UNLIKELY(current_cpu->trace_result_p))
2143 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2144 current_cpu->h_grc_set (FLD (f_rm), opval);
2148 SI opval = EXTQISI (tmp_data);
2149 if (UNLIKELY(current_cpu->trace_result_p))
2150 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2151 current_cpu->h_grc_set (FLD (f_rn), opval);
2155 abuf->written = written;
2156 current_cpu->done_insn (npc, status);
2160 // ********** movb8-compact: mov.b @(r0, $rm), $rn
2163 sh2a_nofpu_sem_movb8_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2164 sh2a_nofpu::write_stacks &buf)
2166 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2167 sem_status status = SEM_STATUS_NORMAL;
2168 sh2a_nofpu_scache* abuf = sem;
2169 unsigned long long written = 0;
2170 PCADDR pc = abuf->addr;
2171 PCADDR npc = pc + 2;
2174 SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2175 if (UNLIKELY(current_cpu->trace_result_p))
2176 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2177 current_cpu->h_grc_set (FLD (f_rn), opval);
2180 current_cpu->done_insn (npc, status);
2184 // ********** movb9-compact: mov.b @($imm8, gbr), r0
2187 sh2a_nofpu_sem_movb9_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2188 sh2a_nofpu::write_stacks &buf)
2190 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2191 sem_status status = SEM_STATUS_NORMAL;
2192 sh2a_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_gbr_get (), FLD (f_imm8))));
2199 if (UNLIKELY(current_cpu->trace_result_p))
2200 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2201 current_cpu->h_grc_set (((UINT) 0), opval);
2204 current_cpu->done_insn (npc, status);
2208 // ********** movb10-compact: mov.b @($imm4, $rm), r0
2211 sh2a_nofpu_sem_movb10_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2212 sh2a_nofpu::write_stacks &buf)
2214 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2215 sem_status status = SEM_STATUS_NORMAL;
2216 sh2a_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_grc_get (FLD (f_rm)), FLD (f_imm4))));
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 // ********** movl1-compact: mov.l $rm, @$rn
2235 sh2a_nofpu_sem_movl1_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2236 sh2a_nofpu::write_stacks &buf)
2238 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2239 sem_status status = SEM_STATUS_NORMAL;
2240 sh2a_nofpu_scache* abuf = sem;
2241 unsigned long long written = 0;
2242 PCADDR pc = abuf->addr;
2243 PCADDR npc = pc + 2;
2246 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2247 if (UNLIKELY(current_cpu->trace_result_p))
2248 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2249 current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2252 current_cpu->done_insn (npc, status);
2256 // ********** movl2-compact: mov.l $rm, @-$rn
2259 sh2a_nofpu_sem_movl2_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2260 sh2a_nofpu::write_stacks &buf)
2262 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2263 sem_status status = SEM_STATUS_NORMAL;
2264 sh2a_nofpu_scache* abuf = sem;
2265 unsigned long long written = 0;
2266 PCADDR pc = abuf->addr;
2267 PCADDR npc = pc + 2;
2271 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2273 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2274 if (UNLIKELY(current_cpu->trace_result_p))
2275 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2276 current_cpu->SETMEMSI (pc, tmp_addr, opval);
2279 SI opval = tmp_addr;
2280 if (UNLIKELY(current_cpu->trace_result_p))
2281 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2282 current_cpu->h_grc_set (FLD (f_rn), opval);
2286 current_cpu->done_insn (npc, status);
2290 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
2293 sh2a_nofpu_sem_movl3_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2294 sh2a_nofpu::write_stacks &buf)
2296 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2297 sem_status status = SEM_STATUS_NORMAL;
2298 sh2a_nofpu_scache* abuf = sem;
2299 unsigned long long written = 0;
2300 PCADDR pc = abuf->addr;
2301 PCADDR npc = pc + 2;
2304 SI opval = current_cpu->h_grc_get (FLD (f_rm));
2305 if (UNLIKELY(current_cpu->trace_result_p))
2306 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2307 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2310 current_cpu->done_insn (npc, status);
2314 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
2317 sh2a_nofpu_sem_movl4_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2318 sh2a_nofpu::write_stacks &buf)
2320 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
2321 sem_status status = SEM_STATUS_NORMAL;
2322 sh2a_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 (((UINT) 0));
2329 if (UNLIKELY(current_cpu->trace_result_p))
2330 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2331 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
2334 current_cpu->done_insn (npc, status);
2338 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
2341 sh2a_nofpu_sem_movl5_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2342 sh2a_nofpu::write_stacks &buf)
2344 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2345 sem_status status = SEM_STATUS_NORMAL;
2346 sh2a_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 (FLD (f_rm));
2353 if (UNLIKELY(current_cpu->trace_result_p))
2354 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 << " ";
2355 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
2358 current_cpu->done_insn (npc, status);
2362 // ********** movl6-compact: mov.l @$rm, $rn
2365 sh2a_nofpu_sem_movl6_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2366 sh2a_nofpu::write_stacks &buf)
2368 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2369 sem_status status = SEM_STATUS_NORMAL;
2370 sh2a_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->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2377 if (UNLIKELY(current_cpu->trace_result_p))
2378 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2379 current_cpu->h_grc_set (FLD (f_rn), opval);
2382 current_cpu->done_insn (npc, status);
2386 // ********** movl7-compact: mov.l @${rm}+, $rn
2389 sh2a_nofpu_sem_movl7_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2390 sh2a_nofpu::write_stacks &buf)
2392 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2393 sem_status status = SEM_STATUS_NORMAL;
2394 sh2a_nofpu_scache* abuf = sem;
2395 unsigned long long written = 0;
2396 PCADDR pc = abuf->addr;
2397 PCADDR npc = pc + 2;
2401 SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2402 if (UNLIKELY(current_cpu->trace_result_p))
2403 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2404 current_cpu->h_grc_set (FLD (f_rn), opval);
2406 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2408 SI opval = current_cpu->h_grc_get (FLD (f_rn));
2409 written |= (1ULL << 5);
2410 if (UNLIKELY(current_cpu->trace_result_p))
2411 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2412 current_cpu->h_grc_set (FLD (f_rm), opval);
2416 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2417 written |= (1ULL << 5);
2418 if (UNLIKELY(current_cpu->trace_result_p))
2419 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2420 current_cpu->h_grc_set (FLD (f_rm), opval);
2425 abuf->written = written;
2426 current_cpu->done_insn (npc, status);
2430 // ********** movl8-compact: mov.l @(r0, $rm), $rn
2433 sh2a_nofpu_sem_movl8_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2434 sh2a_nofpu::write_stacks &buf)
2436 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2437 sem_status status = SEM_STATUS_NORMAL;
2438 sh2a_nofpu_scache* abuf = sem;
2439 unsigned long long written = 0;
2440 PCADDR pc = abuf->addr;
2441 PCADDR npc = pc + 2;
2444 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
2445 if (UNLIKELY(current_cpu->trace_result_p))
2446 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2447 current_cpu->h_grc_set (FLD (f_rn), opval);
2450 current_cpu->done_insn (npc, status);
2454 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
2457 sh2a_nofpu_sem_movl9_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2458 sh2a_nofpu::write_stacks &buf)
2460 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2461 sem_status status = SEM_STATUS_NORMAL;
2462 sh2a_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_gbr_get (), FLD (f_imm8x4)));
2469 if (UNLIKELY(current_cpu->trace_result_p))
2470 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2471 current_cpu->h_grc_set (((UINT) 0), opval);
2474 current_cpu->done_insn (npc, status);
2478 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
2481 sh2a_nofpu_sem_movl10_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2482 sh2a_nofpu::write_stacks &buf)
2484 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
2485 sem_status status = SEM_STATUS_NORMAL;
2486 sh2a_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 (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
2493 if (UNLIKELY(current_cpu->trace_result_p))
2494 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2495 current_cpu->h_grc_set (FLD (f_rn), opval);
2498 current_cpu->done_insn (npc, status);
2502 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
2505 sh2a_nofpu_sem_movl11_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2506 sh2a_nofpu::write_stacks &buf)
2508 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2509 sem_status status = SEM_STATUS_NORMAL;
2510 sh2a_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 (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
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 // ********** movl12-compact: mov.l @($imm12x4, $rm), $rn
2529 sh2a_nofpu_sem_movl12_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2530 sh2a_nofpu::write_stacks &buf)
2532 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2533 sem_status status = SEM_STATUS_NORMAL;
2534 sh2a_nofpu_scache* abuf = sem;
2535 unsigned long long written = 0;
2536 PCADDR pc = abuf->addr;
2537 PCADDR npc = pc + 4;
2540 SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x4)));
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 // ********** movl13-compact: mov.l $rm, @($imm12x4, $rn)
2553 sh2a_nofpu_sem_movl13_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2554 sh2a_nofpu::write_stacks &buf)
2556 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2557 sem_status status = SEM_STATUS_NORMAL;
2558 sh2a_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->h_grc_get (FLD (f_rm));
2565 if (UNLIKELY(current_cpu->trace_result_p))
2566 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 << " ";
2567 current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)), opval);
2570 current_cpu->done_insn (npc, status);
2574 // ********** movw1-compact: mov.w $rm, @$rn
2577 sh2a_nofpu_sem_movw1_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2578 sh2a_nofpu::write_stacks &buf)
2580 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2581 sem_status status = SEM_STATUS_NORMAL;
2582 sh2a_nofpu_scache* abuf = sem;
2583 unsigned long long written = 0;
2584 PCADDR pc = abuf->addr;
2585 PCADDR npc = pc + 2;
2588 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2589 if (UNLIKELY(current_cpu->trace_result_p))
2590 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2591 current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2594 current_cpu->done_insn (npc, status);
2598 // ********** movw2-compact: mov.w $rm, @-$rn
2601 sh2a_nofpu_sem_movw2_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2602 sh2a_nofpu::write_stacks &buf)
2604 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2605 sem_status status = SEM_STATUS_NORMAL;
2606 sh2a_nofpu_scache* abuf = sem;
2607 unsigned long long written = 0;
2608 PCADDR pc = abuf->addr;
2609 PCADDR npc = pc + 2;
2613 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2615 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2616 if (UNLIKELY(current_cpu->trace_result_p))
2617 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
2618 current_cpu->SETMEMHI (pc, tmp_addr, opval);
2621 SI opval = tmp_addr;
2622 if (UNLIKELY(current_cpu->trace_result_p))
2623 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2624 current_cpu->h_grc_set (FLD (f_rn), opval);
2628 current_cpu->done_insn (npc, status);
2632 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
2635 sh2a_nofpu_sem_movw3_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2636 sh2a_nofpu::write_stacks &buf)
2638 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2639 sem_status status = SEM_STATUS_NORMAL;
2640 sh2a_nofpu_scache* abuf = sem;
2641 unsigned long long written = 0;
2642 PCADDR pc = abuf->addr;
2643 PCADDR npc = pc + 2;
2646 HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2647 if (UNLIKELY(current_cpu->trace_result_p))
2648 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 << " ";
2649 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2652 current_cpu->done_insn (npc, status);
2656 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
2659 sh2a_nofpu_sem_movw4_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2660 sh2a_nofpu::write_stacks &buf)
2662 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
2663 sem_status status = SEM_STATUS_NORMAL;
2664 sh2a_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 (((UINT) 0)), 1);
2671 if (UNLIKELY(current_cpu->trace_result_p))
2672 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2673 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
2676 current_cpu->done_insn (npc, status);
2680 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
2683 sh2a_nofpu_sem_movw5_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2684 sh2a_nofpu::write_stacks &buf)
2686 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
2687 sem_status status = SEM_STATUS_NORMAL;
2688 sh2a_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_grc_get (FLD (f_rm)), FLD (f_imm4x2)) << dec << ']' << ":=0x" << hex << opval << dec << " ";
2697 current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
2700 current_cpu->done_insn (npc, status);
2704 // ********** movw6-compact: mov.w @$rm, $rn
2707 sh2a_nofpu_sem_movw6_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2708 sh2a_nofpu::write_stacks &buf)
2710 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2711 sem_status status = SEM_STATUS_NORMAL;
2712 sh2a_nofpu_scache* abuf = sem;
2713 unsigned long long written = 0;
2714 PCADDR pc = abuf->addr;
2715 PCADDR npc = pc + 2;
2718 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2719 if (UNLIKELY(current_cpu->trace_result_p))
2720 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2721 current_cpu->h_grc_set (FLD (f_rn), opval);
2724 current_cpu->done_insn (npc, status);
2728 // ********** movw7-compact: mov.w @${rm}+, $rn
2731 sh2a_nofpu_sem_movw7_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2732 sh2a_nofpu::write_stacks &buf)
2734 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2735 sem_status status = SEM_STATUS_NORMAL;
2736 sh2a_nofpu_scache* abuf = sem;
2737 unsigned long long written = 0;
2738 PCADDR pc = abuf->addr;
2739 PCADDR npc = pc + 2;
2743 tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2744 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2746 SI opval = EXTHISI (tmp_data);
2747 written |= (1ULL << 4);
2748 if (UNLIKELY(current_cpu->trace_result_p))
2749 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2750 current_cpu->h_grc_set (FLD (f_rm), opval);
2754 SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2755 written |= (1ULL << 4);
2756 if (UNLIKELY(current_cpu->trace_result_p))
2757 current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << " ";
2758 current_cpu->h_grc_set (FLD (f_rm), opval);
2762 SI opval = EXTHISI (tmp_data);
2763 if (UNLIKELY(current_cpu->trace_result_p))
2764 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2765 current_cpu->h_grc_set (FLD (f_rn), opval);
2769 abuf->written = written;
2770 current_cpu->done_insn (npc, status);
2774 // ********** movw8-compact: mov.w @(r0, $rm), $rn
2777 sh2a_nofpu_sem_movw8_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2778 sh2a_nofpu::write_stacks &buf)
2780 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2781 sem_status status = SEM_STATUS_NORMAL;
2782 sh2a_nofpu_scache* abuf = sem;
2783 unsigned long long written = 0;
2784 PCADDR pc = abuf->addr;
2785 PCADDR npc = pc + 2;
2788 SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2789 if (UNLIKELY(current_cpu->trace_result_p))
2790 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2791 current_cpu->h_grc_set (FLD (f_rn), opval);
2794 current_cpu->done_insn (npc, status);
2798 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
2801 sh2a_nofpu_sem_movw9_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2802 sh2a_nofpu::write_stacks &buf)
2804 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
2805 sem_status status = SEM_STATUS_NORMAL;
2806 sh2a_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_gbr_get (), FLD (f_imm8x2))));
2813 if (UNLIKELY(current_cpu->trace_result_p))
2814 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2815 current_cpu->h_grc_set (((UINT) 0), opval);
2818 current_cpu->done_insn (npc, status);
2822 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
2825 sh2a_nofpu_sem_movw10_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2826 sh2a_nofpu::write_stacks &buf)
2828 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2829 sem_status status = SEM_STATUS_NORMAL;
2830 sh2a_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, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
2837 if (UNLIKELY(current_cpu->trace_result_p))
2838 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2839 current_cpu->h_grc_set (FLD (f_rn), opval);
2842 current_cpu->done_insn (npc, status);
2846 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
2849 sh2a_nofpu_sem_movw11_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2850 sh2a_nofpu::write_stacks &buf)
2852 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
2853 sem_status status = SEM_STATUS_NORMAL;
2854 sh2a_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, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
2861 if (UNLIKELY(current_cpu->trace_result_p))
2862 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
2863 current_cpu->h_grc_set (((UINT) 0), opval);
2866 current_cpu->done_insn (npc, status);
2870 // ********** mova-compact: mova @($imm8x4, pc), r0
2873 sh2a_nofpu_sem_mova_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2874 sh2a_nofpu::write_stacks &buf)
2876 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2877 sem_status status = SEM_STATUS_NORMAL;
2878 sh2a_nofpu_scache* abuf = sem;
2879 unsigned long long written = 0;
2880 PCADDR pc = abuf->addr;
2881 PCADDR npc = pc + 2;
2884 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
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 // ********** movt-compact: movt $rn
2897 sh2a_nofpu_sem_movt_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2898 sh2a_nofpu::write_stacks &buf)
2900 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2901 sem_status status = SEM_STATUS_NORMAL;
2902 sh2a_nofpu_scache* abuf = sem;
2903 unsigned long long written = 0;
2904 PCADDR pc = abuf->addr;
2905 PCADDR npc = pc + 2;
2908 SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
2909 if (UNLIKELY(current_cpu->trace_result_p))
2910 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
2911 current_cpu->h_grc_set (FLD (f_rn), opval);
2914 current_cpu->done_insn (npc, status);
2918 // ********** mull-compact: mul.l $rm, $rn
2921 sh2a_nofpu_sem_mull_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2922 sh2a_nofpu::write_stacks &buf)
2924 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2925 sem_status status = SEM_STATUS_NORMAL;
2926 sh2a_nofpu_scache* abuf = sem;
2927 unsigned long long written = 0;
2928 PCADDR pc = abuf->addr;
2929 PCADDR npc = pc + 2;
2932 SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
2933 if (UNLIKELY(current_cpu->trace_result_p))
2934 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2935 current_cpu->h_macl_set (opval);
2938 current_cpu->done_insn (npc, status);
2942 // ********** mulsw-compact: muls.w $rm, $rn
2945 sh2a_nofpu_sem_mulsw_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2946 sh2a_nofpu::write_stacks &buf)
2948 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2949 sem_status status = SEM_STATUS_NORMAL;
2950 sh2a_nofpu_scache* abuf = sem;
2951 unsigned long long written = 0;
2952 PCADDR pc = abuf->addr;
2953 PCADDR npc = pc + 2;
2956 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)));
2957 if (UNLIKELY(current_cpu->trace_result_p))
2958 current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << " ";
2959 current_cpu->h_macl_set (opval);
2962 current_cpu->done_insn (npc, status);
2966 // ********** muluw-compact: mulu.w $rm, $rn
2969 sh2a_nofpu_sem_muluw_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2970 sh2a_nofpu::write_stacks &buf)
2972 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
2973 sem_status status = SEM_STATUS_NORMAL;
2974 sh2a_nofpu_scache* abuf = sem;
2975 unsigned long long written = 0;
2976 PCADDR pc = abuf->addr;
2977 PCADDR npc = pc + 2;
2980 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)));
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 // ********** neg-compact: neg $rm, $rn
2993 sh2a_nofpu_sem_neg_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
2994 sh2a_nofpu::write_stacks &buf)
2996 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2997 sem_status status = SEM_STATUS_NORMAL;
2998 sh2a_nofpu_scache* abuf = sem;
2999 unsigned long long written = 0;
3000 PCADDR pc = abuf->addr;
3001 PCADDR npc = pc + 2;
3004 SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
3005 if (UNLIKELY(current_cpu->trace_result_p))
3006 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3007 current_cpu->h_grc_set (FLD (f_rn), opval);
3010 current_cpu->done_insn (npc, status);
3014 // ********** negc-compact: negc $rm, $rn
3017 sh2a_nofpu_sem_negc_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3018 sh2a_nofpu::write_stacks &buf)
3020 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3021 sem_status status = SEM_STATUS_NORMAL;
3022 sh2a_nofpu_scache* abuf = sem;
3023 unsigned long long written = 0;
3024 PCADDR pc = abuf->addr;
3025 PCADDR npc = pc + 2;
3029 tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3031 SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3032 if (UNLIKELY(current_cpu->trace_result_p))
3033 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3034 current_cpu->h_grc_set (FLD (f_rn), opval);
3037 BI opval = tmp_flag;
3038 if (UNLIKELY(current_cpu->trace_result_p))
3039 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3040 current_cpu->h_tbit_set (opval);
3044 current_cpu->done_insn (npc, status);
3048 // ********** nop-compact: nop
3051 sh2a_nofpu_sem_nop_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3052 sh2a_nofpu::write_stacks &buf)
3054 #define FLD(f) abuf->fields.fmt_empty.f
3055 sem_status status = SEM_STATUS_NORMAL;
3056 sh2a_nofpu_scache* abuf = sem;
3057 unsigned long long written = 0;
3058 PCADDR pc = abuf->addr;
3059 PCADDR npc = pc + 2;
3063 current_cpu->done_insn (npc, status);
3067 // ********** not-compact: not $rm64, $rn64
3070 sh2a_nofpu_sem_not_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3071 sh2a_nofpu::write_stacks &buf)
3073 #define FLD(f) abuf->fields.sfmt_and_compact.f
3074 sem_status status = SEM_STATUS_NORMAL;
3075 sh2a_nofpu_scache* abuf = sem;
3076 unsigned long long written = 0;
3077 PCADDR pc = abuf->addr;
3078 PCADDR npc = pc + 2;
3081 DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
3082 if (UNLIKELY(current_cpu->trace_result_p))
3083 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3084 current_cpu->h_gr_set (FLD (f_rn), opval);
3087 current_cpu->done_insn (npc, status);
3091 // ********** or-compact: or $rm64, $rn64
3094 sh2a_nofpu_sem_or_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3095 sh2a_nofpu::write_stacks &buf)
3097 #define FLD(f) abuf->fields.sfmt_and_compact.f
3098 sem_status status = SEM_STATUS_NORMAL;
3099 sh2a_nofpu_scache* abuf = sem;
3100 unsigned long long written = 0;
3101 PCADDR pc = abuf->addr;
3102 PCADDR npc = pc + 2;
3105 DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
3106 if (UNLIKELY(current_cpu->trace_result_p))
3107 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3108 current_cpu->h_gr_set (FLD (f_rn), opval);
3111 current_cpu->done_insn (npc, status);
3115 // ********** ori-compact: or #$uimm8, r0
3118 sh2a_nofpu_sem_ori_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3119 sh2a_nofpu::write_stacks &buf)
3121 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3122 sem_status status = SEM_STATUS_NORMAL;
3123 sh2a_nofpu_scache* abuf = sem;
3124 unsigned long long written = 0;
3125 PCADDR pc = abuf->addr;
3126 PCADDR npc = pc + 2;
3129 SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3130 if (UNLIKELY(current_cpu->trace_result_p))
3131 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
3132 current_cpu->h_grc_set (((UINT) 0), opval);
3135 current_cpu->done_insn (npc, status);
3139 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3142 sh2a_nofpu_sem_orb_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3143 sh2a_nofpu::write_stacks &buf)
3145 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3146 sem_status status = SEM_STATUS_NORMAL;
3147 sh2a_nofpu_scache* abuf = sem;
3148 unsigned long long written = 0;
3149 PCADDR pc = abuf->addr;
3150 PCADDR npc = pc + 2;
3155 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3156 tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3158 UQI opval = tmp_data;
3159 if (UNLIKELY(current_cpu->trace_result_p))
3160 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
3161 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3165 current_cpu->done_insn (npc, status);
3169 // ********** rotcl-compact: rotcl $rn
3172 sh2a_nofpu_sem_rotcl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3173 sh2a_nofpu::write_stacks &buf)
3175 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3176 sem_status status = SEM_STATUS_NORMAL;
3177 sh2a_nofpu_scache* abuf = sem;
3178 unsigned long long written = 0;
3179 PCADDR pc = abuf->addr;
3180 PCADDR npc = pc + 2;
3184 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3186 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3187 if (UNLIKELY(current_cpu->trace_result_p))
3188 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3189 current_cpu->h_grc_set (FLD (f_rn), opval);
3192 BI opval = ((tmp_temp) ? (1) : (0));
3193 if (UNLIKELY(current_cpu->trace_result_p))
3194 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3195 current_cpu->h_tbit_set (opval);
3199 current_cpu->done_insn (npc, status);
3203 // ********** rotcr-compact: rotcr $rn
3206 sh2a_nofpu_sem_rotcr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3207 sh2a_nofpu::write_stacks &buf)
3209 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3210 sem_status status = SEM_STATUS_NORMAL;
3211 sh2a_nofpu_scache* abuf = sem;
3212 unsigned long long written = 0;
3213 PCADDR pc = abuf->addr;
3214 PCADDR npc = pc + 2;
3219 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3220 tmp_temp = current_cpu->h_tbit_get ();
3222 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3223 if (UNLIKELY(current_cpu->trace_result_p))
3224 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3225 current_cpu->h_grc_set (FLD (f_rn), opval);
3228 BI opval = ((tmp_lsbit) ? (1) : (0));
3229 if (UNLIKELY(current_cpu->trace_result_p))
3230 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3231 current_cpu->h_tbit_set (opval);
3235 current_cpu->done_insn (npc, status);
3239 // ********** rotl-compact: rotl $rn
3242 sh2a_nofpu_sem_rotl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3243 sh2a_nofpu::write_stacks &buf)
3245 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3246 sem_status status = SEM_STATUS_NORMAL;
3247 sh2a_nofpu_scache* abuf = sem;
3248 unsigned long long written = 0;
3249 PCADDR pc = abuf->addr;
3250 PCADDR npc = pc + 2;
3254 tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3256 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3257 if (UNLIKELY(current_cpu->trace_result_p))
3258 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3259 current_cpu->h_grc_set (FLD (f_rn), opval);
3262 BI opval = ((tmp_temp) ? (1) : (0));
3263 if (UNLIKELY(current_cpu->trace_result_p))
3264 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3265 current_cpu->h_tbit_set (opval);
3269 current_cpu->done_insn (npc, status);
3273 // ********** rotr-compact: rotr $rn
3276 sh2a_nofpu_sem_rotr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3277 sh2a_nofpu::write_stacks &buf)
3279 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3280 sem_status status = SEM_STATUS_NORMAL;
3281 sh2a_nofpu_scache* abuf = sem;
3282 unsigned long long written = 0;
3283 PCADDR pc = abuf->addr;
3284 PCADDR npc = pc + 2;
3289 tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3290 tmp_temp = tmp_lsbit;
3292 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3293 if (UNLIKELY(current_cpu->trace_result_p))
3294 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3295 current_cpu->h_grc_set (FLD (f_rn), opval);
3298 BI opval = ((tmp_lsbit) ? (1) : (0));
3299 if (UNLIKELY(current_cpu->trace_result_p))
3300 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3301 current_cpu->h_tbit_set (opval);
3305 current_cpu->done_insn (npc, status);
3309 // ********** rts-compact: rts
3312 sh2a_nofpu_sem_rts_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3313 sh2a_nofpu::write_stacks &buf)
3315 #define FLD(f) abuf->fields.fmt_empty.f
3316 sem_status status = SEM_STATUS_NORMAL;
3317 sh2a_nofpu_scache* abuf = sem;
3318 unsigned long long written = 0;
3319 PCADDR pc = abuf->addr;
3320 PCADDR npc = pc + 2;
3324 UDI opval = ADDDI (pc, 2);
3325 if (UNLIKELY(current_cpu->trace_result_p))
3326 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3327 current_cpu->branch (opval, npc, status);
3329 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
3331 UDI opval = current_cpu->h_pr_get ();
3332 buf.h_pc_writes [(tick + 1) % sh2a_nofpu::pipe_sz].push (sh2a_nofpu::write<UDI>(pc, opval));
3333 if (UNLIKELY(current_cpu->trace_result_p))
3334 current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << " ";
3336 current_cpu->notify_ret (current_cpu->h_pr_get ());
3339 current_cpu->done_cti_insn (npc, status);
3343 // ********** sett-compact: sett
3346 sh2a_nofpu_sem_sett_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3347 sh2a_nofpu::write_stacks &buf)
3349 #define FLD(f) abuf->fields.fmt_empty.f
3350 sem_status status = SEM_STATUS_NORMAL;
3351 sh2a_nofpu_scache* abuf = sem;
3352 unsigned long long written = 0;
3353 PCADDR pc = abuf->addr;
3354 PCADDR npc = pc + 2;
3358 if (UNLIKELY(current_cpu->trace_result_p))
3359 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3360 current_cpu->h_tbit_set (opval);
3363 current_cpu->done_insn (npc, status);
3367 // ********** shad-compact: shad $rm, $rn
3370 sh2a_nofpu_sem_shad_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3371 sh2a_nofpu::write_stacks &buf)
3373 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3374 sem_status status = SEM_STATUS_NORMAL;
3375 sh2a_nofpu_scache* abuf = sem;
3376 unsigned long long written = 0;
3377 PCADDR pc = abuf->addr;
3378 PCADDR npc = pc + 2;
3382 tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3383 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3385 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3386 written |= (1ULL << 2);
3387 if (UNLIKELY(current_cpu->trace_result_p))
3388 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3389 current_cpu->h_grc_set (FLD (f_rn), opval);
3392 if (NESI (tmp_shamt, 0)) {
3394 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3395 written |= (1ULL << 2);
3396 if (UNLIKELY(current_cpu->trace_result_p))
3397 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3398 current_cpu->h_grc_set (FLD (f_rn), opval);
3401 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
3403 SI opval = NEGSI (1);
3404 written |= (1ULL << 2);
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);
3412 written |= (1ULL << 2);
3413 if (UNLIKELY(current_cpu->trace_result_p))
3414 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3415 current_cpu->h_grc_set (FLD (f_rn), opval);
3422 abuf->written = written;
3423 current_cpu->done_insn (npc, status);
3427 // ********** shal-compact: shal $rn
3430 sh2a_nofpu_sem_shal_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3431 sh2a_nofpu::write_stacks &buf)
3433 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3434 sem_status status = SEM_STATUS_NORMAL;
3435 sh2a_nofpu_scache* abuf = sem;
3436 unsigned long long written = 0;
3437 PCADDR pc = abuf->addr;
3438 PCADDR npc = pc + 2;
3442 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3444 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3445 if (UNLIKELY(current_cpu->trace_result_p))
3446 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3447 current_cpu->h_grc_set (FLD (f_rn), opval);
3450 BI opval = ((tmp_t) ? (1) : (0));
3451 if (UNLIKELY(current_cpu->trace_result_p))
3452 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3453 current_cpu->h_tbit_set (opval);
3457 current_cpu->done_insn (npc, status);
3461 // ********** shar-compact: shar $rn
3464 sh2a_nofpu_sem_shar_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3465 sh2a_nofpu::write_stacks &buf)
3467 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3468 sem_status status = SEM_STATUS_NORMAL;
3469 sh2a_nofpu_scache* abuf = sem;
3470 unsigned long long written = 0;
3471 PCADDR pc = abuf->addr;
3472 PCADDR npc = pc + 2;
3476 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3478 SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3479 if (UNLIKELY(current_cpu->trace_result_p))
3480 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3481 current_cpu->h_grc_set (FLD (f_rn), opval);
3484 BI opval = ((tmp_t) ? (1) : (0));
3485 if (UNLIKELY(current_cpu->trace_result_p))
3486 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3487 current_cpu->h_tbit_set (opval);
3491 current_cpu->done_insn (npc, status);
3495 // ********** shll-compact: shll $rn
3498 sh2a_nofpu_sem_shll_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3499 sh2a_nofpu::write_stacks &buf)
3501 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3502 sem_status status = SEM_STATUS_NORMAL;
3503 sh2a_nofpu_scache* abuf = sem;
3504 unsigned long long written = 0;
3505 PCADDR pc = abuf->addr;
3506 PCADDR npc = pc + 2;
3510 tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3512 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3513 if (UNLIKELY(current_cpu->trace_result_p))
3514 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3515 current_cpu->h_grc_set (FLD (f_rn), opval);
3518 BI opval = ((tmp_t) ? (1) : (0));
3519 if (UNLIKELY(current_cpu->trace_result_p))
3520 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3521 current_cpu->h_tbit_set (opval);
3525 current_cpu->done_insn (npc, status);
3529 // ********** shll2-compact: shll2 $rn
3532 sh2a_nofpu_sem_shll2_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3533 sh2a_nofpu::write_stacks &buf)
3535 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3536 sem_status status = SEM_STATUS_NORMAL;
3537 sh2a_nofpu_scache* abuf = sem;
3538 unsigned long long written = 0;
3539 PCADDR pc = abuf->addr;
3540 PCADDR npc = pc + 2;
3543 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3544 if (UNLIKELY(current_cpu->trace_result_p))
3545 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3546 current_cpu->h_grc_set (FLD (f_rn), opval);
3549 current_cpu->done_insn (npc, status);
3553 // ********** shll8-compact: shll8 $rn
3556 sh2a_nofpu_sem_shll8_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3557 sh2a_nofpu::write_stacks &buf)
3559 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3560 sem_status status = SEM_STATUS_NORMAL;
3561 sh2a_nofpu_scache* abuf = sem;
3562 unsigned long long written = 0;
3563 PCADDR pc = abuf->addr;
3564 PCADDR npc = pc + 2;
3567 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
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 current_cpu->done_insn (npc, status);
3577 // ********** shll16-compact: shll16 $rn
3580 sh2a_nofpu_sem_shll16_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3581 sh2a_nofpu::write_stacks &buf)
3583 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3584 sem_status status = SEM_STATUS_NORMAL;
3585 sh2a_nofpu_scache* abuf = sem;
3586 unsigned long long written = 0;
3587 PCADDR pc = abuf->addr;
3588 PCADDR npc = pc + 2;
3591 SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3592 if (UNLIKELY(current_cpu->trace_result_p))
3593 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3594 current_cpu->h_grc_set (FLD (f_rn), opval);
3597 current_cpu->done_insn (npc, status);
3601 // ********** shlr-compact: shlr $rn
3604 sh2a_nofpu_sem_shlr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3605 sh2a_nofpu::write_stacks &buf)
3607 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3608 sem_status status = SEM_STATUS_NORMAL;
3609 sh2a_nofpu_scache* abuf = sem;
3610 unsigned long long written = 0;
3611 PCADDR pc = abuf->addr;
3612 PCADDR npc = pc + 2;
3616 tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3618 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3619 if (UNLIKELY(current_cpu->trace_result_p))
3620 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3621 current_cpu->h_grc_set (FLD (f_rn), opval);
3624 BI opval = ((tmp_t) ? (1) : (0));
3625 if (UNLIKELY(current_cpu->trace_result_p))
3626 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
3627 current_cpu->h_tbit_set (opval);
3631 current_cpu->done_insn (npc, status);
3635 // ********** shlr2-compact: shlr2 $rn
3638 sh2a_nofpu_sem_shlr2_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3639 sh2a_nofpu::write_stacks &buf)
3641 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3642 sem_status status = SEM_STATUS_NORMAL;
3643 sh2a_nofpu_scache* abuf = sem;
3644 unsigned long long written = 0;
3645 PCADDR pc = abuf->addr;
3646 PCADDR npc = pc + 2;
3649 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3650 if (UNLIKELY(current_cpu->trace_result_p))
3651 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3652 current_cpu->h_grc_set (FLD (f_rn), opval);
3655 current_cpu->done_insn (npc, status);
3659 // ********** shlr8-compact: shlr8 $rn
3662 sh2a_nofpu_sem_shlr8_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3663 sh2a_nofpu::write_stacks &buf)
3665 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3666 sem_status status = SEM_STATUS_NORMAL;
3667 sh2a_nofpu_scache* abuf = sem;
3668 unsigned long long written = 0;
3669 PCADDR pc = abuf->addr;
3670 PCADDR npc = pc + 2;
3673 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3674 if (UNLIKELY(current_cpu->trace_result_p))
3675 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3676 current_cpu->h_grc_set (FLD (f_rn), opval);
3679 current_cpu->done_insn (npc, status);
3683 // ********** shlr16-compact: shlr16 $rn
3686 sh2a_nofpu_sem_shlr16_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3687 sh2a_nofpu::write_stacks &buf)
3689 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3690 sem_status status = SEM_STATUS_NORMAL;
3691 sh2a_nofpu_scache* abuf = sem;
3692 unsigned long long written = 0;
3693 PCADDR pc = abuf->addr;
3694 PCADDR npc = pc + 2;
3697 SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3698 if (UNLIKELY(current_cpu->trace_result_p))
3699 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3700 current_cpu->h_grc_set (FLD (f_rn), opval);
3703 current_cpu->done_insn (npc, status);
3707 // ********** stc-gbr-compact: stc gbr, $rn
3710 sh2a_nofpu_sem_stc_gbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3711 sh2a_nofpu::write_stacks &buf)
3713 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3714 sem_status status = SEM_STATUS_NORMAL;
3715 sh2a_nofpu_scache* abuf = sem;
3716 unsigned long long written = 0;
3717 PCADDR pc = abuf->addr;
3718 PCADDR npc = pc + 2;
3721 SI opval = current_cpu->h_gbr_get ();
3722 if (UNLIKELY(current_cpu->trace_result_p))
3723 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3724 current_cpu->h_grc_set (FLD (f_rn), opval);
3727 current_cpu->done_insn (npc, status);
3731 // ********** stc-vbr-compact: stc vbr, $rn
3734 sh2a_nofpu_sem_stc_vbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3735 sh2a_nofpu::write_stacks &buf)
3737 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3738 sem_status status = SEM_STATUS_NORMAL;
3739 sh2a_nofpu_scache* abuf = sem;
3740 unsigned long long written = 0;
3741 PCADDR pc = abuf->addr;
3742 PCADDR npc = pc + 2;
3745 SI opval = current_cpu->h_vbr_get ();
3746 if (UNLIKELY(current_cpu->trace_result_p))
3747 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3748 current_cpu->h_grc_set (FLD (f_rn), opval);
3751 current_cpu->done_insn (npc, status);
3755 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
3758 sh2a_nofpu_sem_stcl_gbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3759 sh2a_nofpu::write_stacks &buf)
3761 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3762 sem_status status = SEM_STATUS_NORMAL;
3763 sh2a_nofpu_scache* abuf = sem;
3764 unsigned long long written = 0;
3765 PCADDR pc = abuf->addr;
3766 PCADDR npc = pc + 2;
3770 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3772 SI opval = current_cpu->h_gbr_get ();
3773 if (UNLIKELY(current_cpu->trace_result_p))
3774 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3775 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3778 SI opval = tmp_addr;
3779 if (UNLIKELY(current_cpu->trace_result_p))
3780 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3781 current_cpu->h_grc_set (FLD (f_rn), opval);
3785 current_cpu->done_insn (npc, status);
3789 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
3792 sh2a_nofpu_sem_stcl_vbr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3793 sh2a_nofpu::write_stacks &buf)
3795 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3796 sem_status status = SEM_STATUS_NORMAL;
3797 sh2a_nofpu_scache* abuf = sem;
3798 unsigned long long written = 0;
3799 PCADDR pc = abuf->addr;
3800 PCADDR npc = pc + 2;
3804 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3806 SI opval = current_cpu->h_vbr_get ();
3807 if (UNLIKELY(current_cpu->trace_result_p))
3808 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3809 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3812 SI opval = tmp_addr;
3813 if (UNLIKELY(current_cpu->trace_result_p))
3814 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3815 current_cpu->h_grc_set (FLD (f_rn), opval);
3819 current_cpu->done_insn (npc, status);
3823 // ********** sts-mach-compact: sts mach, $rn
3826 sh2a_nofpu_sem_sts_mach_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3827 sh2a_nofpu::write_stacks &buf)
3829 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3830 sem_status status = SEM_STATUS_NORMAL;
3831 sh2a_nofpu_scache* abuf = sem;
3832 unsigned long long written = 0;
3833 PCADDR pc = abuf->addr;
3834 PCADDR npc = pc + 2;
3837 SI opval = current_cpu->h_mach_get ();
3838 if (UNLIKELY(current_cpu->trace_result_p))
3839 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3840 current_cpu->h_grc_set (FLD (f_rn), opval);
3843 current_cpu->done_insn (npc, status);
3847 // ********** stsl-mach-compact: sts.l mach, @-$rn
3850 sh2a_nofpu_sem_stsl_mach_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3851 sh2a_nofpu::write_stacks &buf)
3853 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3854 sem_status status = SEM_STATUS_NORMAL;
3855 sh2a_nofpu_scache* abuf = sem;
3856 unsigned long long written = 0;
3857 PCADDR pc = abuf->addr;
3858 PCADDR npc = pc + 2;
3862 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3864 SI opval = current_cpu->h_mach_get ();
3865 if (UNLIKELY(current_cpu->trace_result_p))
3866 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3867 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3870 SI opval = tmp_addr;
3871 if (UNLIKELY(current_cpu->trace_result_p))
3872 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3873 current_cpu->h_grc_set (FLD (f_rn), opval);
3877 current_cpu->done_insn (npc, status);
3881 // ********** sts-macl-compact: sts macl, $rn
3884 sh2a_nofpu_sem_sts_macl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3885 sh2a_nofpu::write_stacks &buf)
3887 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3888 sem_status status = SEM_STATUS_NORMAL;
3889 sh2a_nofpu_scache* abuf = sem;
3890 unsigned long long written = 0;
3891 PCADDR pc = abuf->addr;
3892 PCADDR npc = pc + 2;
3895 SI opval = current_cpu->h_macl_get ();
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 // ********** stsl-macl-compact: sts.l macl, @-$rn
3908 sh2a_nofpu_sem_stsl_macl_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3909 sh2a_nofpu::write_stacks &buf)
3911 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3912 sem_status status = SEM_STATUS_NORMAL;
3913 sh2a_nofpu_scache* abuf = sem;
3914 unsigned long long written = 0;
3915 PCADDR pc = abuf->addr;
3916 PCADDR npc = pc + 2;
3920 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3922 SI opval = current_cpu->h_macl_get ();
3923 if (UNLIKELY(current_cpu->trace_result_p))
3924 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3925 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3928 SI opval = tmp_addr;
3929 if (UNLIKELY(current_cpu->trace_result_p))
3930 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3931 current_cpu->h_grc_set (FLD (f_rn), opval);
3935 current_cpu->done_insn (npc, status);
3939 // ********** sts-pr-compact: sts pr, $rn
3942 sh2a_nofpu_sem_sts_pr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3943 sh2a_nofpu::write_stacks &buf)
3945 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3946 sem_status status = SEM_STATUS_NORMAL;
3947 sh2a_nofpu_scache* abuf = sem;
3948 unsigned long long written = 0;
3949 PCADDR pc = abuf->addr;
3950 PCADDR npc = pc + 2;
3953 SI opval = current_cpu->h_pr_get ();
3954 if (UNLIKELY(current_cpu->trace_result_p))
3955 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3956 current_cpu->h_grc_set (FLD (f_rn), opval);
3959 current_cpu->done_insn (npc, status);
3963 // ********** stsl-pr-compact: sts.l pr, @-$rn
3966 sh2a_nofpu_sem_stsl_pr_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
3967 sh2a_nofpu::write_stacks &buf)
3969 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3970 sem_status status = SEM_STATUS_NORMAL;
3971 sh2a_nofpu_scache* abuf = sem;
3972 unsigned long long written = 0;
3973 PCADDR pc = abuf->addr;
3974 PCADDR npc = pc + 2;
3978 tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3980 SI opval = current_cpu->h_pr_get ();
3981 if (UNLIKELY(current_cpu->trace_result_p))
3982 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << " ";
3983 current_cpu->SETMEMSI (pc, tmp_addr, opval);
3986 SI opval = tmp_addr;
3987 if (UNLIKELY(current_cpu->trace_result_p))
3988 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
3989 current_cpu->h_grc_set (FLD (f_rn), opval);
3993 current_cpu->done_insn (npc, status);
3997 // ********** sub-compact: sub $rm, $rn
4000 sh2a_nofpu_sem_sub_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4001 sh2a_nofpu::write_stacks &buf)
4003 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4004 sem_status status = SEM_STATUS_NORMAL;
4005 sh2a_nofpu_scache* abuf = sem;
4006 unsigned long long written = 0;
4007 PCADDR pc = abuf->addr;
4008 PCADDR npc = pc + 2;
4011 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4012 if (UNLIKELY(current_cpu->trace_result_p))
4013 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4014 current_cpu->h_grc_set (FLD (f_rn), opval);
4017 current_cpu->done_insn (npc, status);
4021 // ********** subc-compact: subc $rm, $rn
4024 sh2a_nofpu_sem_subc_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4025 sh2a_nofpu::write_stacks &buf)
4027 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4028 sem_status status = SEM_STATUS_NORMAL;
4029 sh2a_nofpu_scache* abuf = sem;
4030 unsigned long long written = 0;
4031 PCADDR pc = abuf->addr;
4032 PCADDR npc = pc + 2;
4036 tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4038 SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4039 if (UNLIKELY(current_cpu->trace_result_p))
4040 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4041 current_cpu->h_grc_set (FLD (f_rn), opval);
4044 BI opval = tmp_flag;
4045 if (UNLIKELY(current_cpu->trace_result_p))
4046 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4047 current_cpu->h_tbit_set (opval);
4051 current_cpu->done_insn (npc, status);
4055 // ********** subv-compact: subv $rm, $rn
4058 sh2a_nofpu_sem_subv_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4059 sh2a_nofpu::write_stacks &buf)
4061 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4062 sem_status status = SEM_STATUS_NORMAL;
4063 sh2a_nofpu_scache* abuf = sem;
4064 unsigned long long written = 0;
4065 PCADDR pc = abuf->addr;
4066 PCADDR npc = pc + 2;
4070 tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
4072 SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4073 if (UNLIKELY(current_cpu->trace_result_p))
4074 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4075 current_cpu->h_grc_set (FLD (f_rn), opval);
4078 BI opval = ((tmp_t) ? (1) : (0));
4079 if (UNLIKELY(current_cpu->trace_result_p))
4080 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4081 current_cpu->h_tbit_set (opval);
4085 current_cpu->done_insn (npc, status);
4089 // ********** swapb-compact: swap.b $rm, $rn
4092 sh2a_nofpu_sem_swapb_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4093 sh2a_nofpu::write_stacks &buf)
4095 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4096 sem_status status = SEM_STATUS_NORMAL;
4097 sh2a_nofpu_scache* abuf = sem;
4098 unsigned long long written = 0;
4099 PCADDR pc = abuf->addr;
4100 PCADDR npc = pc + 2;
4106 tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
4107 tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
4108 tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
4110 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
4111 if (UNLIKELY(current_cpu->trace_result_p))
4112 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4113 current_cpu->h_grc_set (FLD (f_rn), opval);
4117 current_cpu->done_insn (npc, status);
4121 // ********** swapw-compact: swap.w $rm, $rn
4124 sh2a_nofpu_sem_swapw_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4125 sh2a_nofpu::write_stacks &buf)
4127 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4128 sem_status status = SEM_STATUS_NORMAL;
4129 sh2a_nofpu_scache* abuf = sem;
4130 unsigned long long written = 0;
4131 PCADDR pc = abuf->addr;
4132 PCADDR npc = pc + 2;
4135 SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
4136 if (UNLIKELY(current_cpu->trace_result_p))
4137 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4138 current_cpu->h_grc_set (FLD (f_rn), opval);
4141 current_cpu->done_insn (npc, status);
4145 // ********** tasb-compact: tas.b @$rn
4148 sh2a_nofpu_sem_tasb_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4149 sh2a_nofpu::write_stacks &buf)
4151 #define FLD(f) abuf->fields.sfmt_divu_compact.f
4152 sem_status status = SEM_STATUS_NORMAL;
4153 sh2a_nofpu_scache* abuf = sem;
4154 unsigned long long written = 0;
4155 PCADDR pc = abuf->addr;
4156 PCADDR npc = pc + 2;
4160 tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
4162 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
4163 if (UNLIKELY(current_cpu->trace_result_p))
4164 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4165 current_cpu->h_tbit_set (opval);
4167 tmp_byte = ORQI (tmp_byte, 128);
4169 UQI opval = tmp_byte;
4170 if (UNLIKELY(current_cpu->trace_result_p))
4171 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4172 current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
4176 current_cpu->done_insn (npc, status);
4180 // ********** trapa-compact: trapa #$uimm8
4183 sh2a_nofpu_sem_trapa_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4184 sh2a_nofpu::write_stacks &buf)
4186 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4187 sem_status status = SEM_STATUS_NORMAL;
4188 sh2a_nofpu_scache* abuf = sem;
4189 unsigned long long written = 0;
4190 PCADDR pc = abuf->addr;
4191 PCADDR npc = pc + 2;
4193 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4195 current_cpu->done_insn (npc, status);
4199 // ********** tst-compact: tst $rm, $rn
4202 sh2a_nofpu_sem_tst_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4203 sh2a_nofpu::write_stacks &buf)
4205 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4206 sem_status status = SEM_STATUS_NORMAL;
4207 sh2a_nofpu_scache* abuf = sem;
4208 unsigned long long written = 0;
4209 PCADDR pc = abuf->addr;
4210 PCADDR npc = pc + 2;
4213 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
4214 if (UNLIKELY(current_cpu->trace_result_p))
4215 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4216 current_cpu->h_tbit_set (opval);
4219 current_cpu->done_insn (npc, status);
4223 // ********** tsti-compact: tst #$uimm8, r0
4226 sh2a_nofpu_sem_tsti_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4227 sh2a_nofpu::write_stacks &buf)
4229 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4230 sem_status status = SEM_STATUS_NORMAL;
4231 sh2a_nofpu_scache* abuf = sem;
4232 unsigned long long written = 0;
4233 PCADDR pc = abuf->addr;
4234 PCADDR npc = pc + 2;
4237 BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
4238 if (UNLIKELY(current_cpu->trace_result_p))
4239 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4240 current_cpu->h_tbit_set (opval);
4243 current_cpu->done_insn (npc, status);
4247 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
4250 sh2a_nofpu_sem_tstb_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4251 sh2a_nofpu::write_stacks &buf)
4253 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4254 sem_status status = SEM_STATUS_NORMAL;
4255 sh2a_nofpu_scache* abuf = sem;
4256 unsigned long long written = 0;
4257 PCADDR pc = abuf->addr;
4258 PCADDR npc = pc + 2;
4262 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4264 BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
4265 if (UNLIKELY(current_cpu->trace_result_p))
4266 current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << " ";
4267 current_cpu->h_tbit_set (opval);
4271 current_cpu->done_insn (npc, status);
4275 // ********** xor-compact: xor $rm64, $rn64
4278 sh2a_nofpu_sem_xor_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4279 sh2a_nofpu::write_stacks &buf)
4281 #define FLD(f) abuf->fields.sfmt_and_compact.f
4282 sem_status status = SEM_STATUS_NORMAL;
4283 sh2a_nofpu_scache* abuf = sem;
4284 unsigned long long written = 0;
4285 PCADDR pc = abuf->addr;
4286 PCADDR npc = pc + 2;
4289 DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
4290 if (UNLIKELY(current_cpu->trace_result_p))
4291 current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4292 current_cpu->h_gr_set (FLD (f_rn), opval);
4295 current_cpu->done_insn (npc, status);
4299 // ********** xori-compact: xor #$uimm8, r0
4302 sh2a_nofpu_sem_xori_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4303 sh2a_nofpu::write_stacks &buf)
4305 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4306 sem_status status = SEM_STATUS_NORMAL;
4307 sh2a_nofpu_scache* abuf = sem;
4308 unsigned long long written = 0;
4309 PCADDR pc = abuf->addr;
4310 PCADDR npc = pc + 2;
4313 SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4314 if (UNLIKELY(current_cpu->trace_result_p))
4315 current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << " ";
4316 current_cpu->h_grc_set (((UINT) 0), opval);
4319 current_cpu->done_insn (npc, status);
4323 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
4326 sh2a_nofpu_sem_xorb_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4327 sh2a_nofpu::write_stacks &buf)
4329 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4330 sem_status status = SEM_STATUS_NORMAL;
4331 sh2a_nofpu_scache* abuf = sem;
4332 unsigned long long written = 0;
4333 PCADDR pc = abuf->addr;
4334 PCADDR npc = pc + 2;
4339 tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4340 tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4342 UQI opval = tmp_data;
4343 if (UNLIKELY(current_cpu->trace_result_p))
4344 current_cpu->trace_stream << "memory" << '[' << "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << " ";
4345 current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4349 current_cpu->done_insn (npc, status);
4353 // ********** xtrct-compact: xtrct $rm, $rn
4356 sh2a_nofpu_sem_xtrct_compact (sh2a_nofpu_cpu* current_cpu, sh2a_nofpu_scache* sem, const int tick,
4357 sh2a_nofpu::write_stacks &buf)
4359 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4360 sem_status status = SEM_STATUS_NORMAL;
4361 sh2a_nofpu_scache* abuf = sem;
4362 unsigned long long written = 0;
4363 PCADDR pc = abuf->addr;
4364 PCADDR npc = pc + 2;
4367 SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
4368 if (UNLIKELY(current_cpu->trace_result_p))
4369 current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << " ";
4370 current_cpu->h_grc_set (FLD (f_rn), opval);
4373 current_cpu->done_insn (npc, status);