OSDN Git Service

Regenerate cgen files, update copyright year.
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / cgen-cpu / sh / sh5-compact-sem.cxx
1 /* Simulator instruction semantics for sh5_compact.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright (C) 2000-2010 Red Hat, Inc.
6
7 This file is part of the Red Hat simulators.
8
9
10 */
11
12
13 #if HAVE_CONFIG_H
14 #include "config.h"
15 #endif
16 #include "sh5.h"
17
18 using namespace sh5; // FIXME: namespace organization still wip
19 using namespace sh5_compact; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
21
22
23 // ********** x-invalid: --invalid--
24
25 void
26 sh5_compact_sem_x_invalid (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
27         sh5_compact::write_stacks &buf)
28 {
29 #define FLD(f) abuf->fields.fmt_empty.f
30   sem_status status = SEM_STATUS_NORMAL;
31   sh5_compact_scache* abuf = sem;
32   unsigned long long written = 0;
33   PCADDR pc = abuf->addr;
34   PCADDR npc = pc + 0;
35
36   {
37     current_cpu->invalid_insn (pc);
38     assert (0);
39     /* NOTREACHED */
40   }
41
42   current_cpu->done_insn (npc, status);
43 #undef FLD
44 }
45
46 // ********** add-compact: add $rm, $rn
47
48 void
49 sh5_compact_sem_add_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
50         sh5_compact::write_stacks &buf)
51 {
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53   sem_status status = SEM_STATUS_NORMAL;
54   sh5_compact_scache* abuf = sem;
55   unsigned long long written = 0;
56   PCADDR pc = abuf->addr;
57   PCADDR npc = pc + 2;
58
59   {
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);
64   }
65
66   current_cpu->done_insn (npc, status);
67 #undef FLD
68 }
69
70 // ********** addi-compact: add #$imm8, $rn
71
72 void
73 sh5_compact_sem_addi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
74         sh5_compact::write_stacks &buf)
75 {
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77   sem_status status = SEM_STATUS_NORMAL;
78   sh5_compact_scache* abuf = sem;
79   unsigned long long written = 0;
80   PCADDR pc = abuf->addr;
81   PCADDR npc = pc + 2;
82
83   {
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);
88   }
89
90   current_cpu->done_insn (npc, status);
91 #undef FLD
92 }
93
94 // ********** addc-compact: addc $rm, $rn
95
96 void
97 sh5_compact_sem_addc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
98         sh5_compact::write_stacks &buf)
99 {
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101   sem_status status = SEM_STATUS_NORMAL;
102   sh5_compact_scache* abuf = sem;
103   unsigned long long written = 0;
104   PCADDR pc = abuf->addr;
105   PCADDR npc = pc + 2;
106
107 {
108   BI tmp_flag;
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 ());
110   {
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);
115   }
116   {
117     BI opval = tmp_flag;
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);
121   }
122 }
123
124   current_cpu->done_insn (npc, status);
125 #undef FLD
126 }
127
128 // ********** addv-compact: addv $rm, $rn
129
130 void
131 sh5_compact_sem_addv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
132         sh5_compact::write_stacks &buf)
133 {
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135   sem_status status = SEM_STATUS_NORMAL;
136   sh5_compact_scache* abuf = sem;
137   unsigned long long written = 0;
138   PCADDR pc = abuf->addr;
139   PCADDR npc = pc + 2;
140
141 {
142   BI tmp_t;
143   tmp_t = ADDOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
144   {
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);
149   }
150   {
151     BI opval = tmp_t;
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);
155   }
156 }
157
158   current_cpu->done_insn (npc, status);
159 #undef FLD
160 }
161
162 // ********** and-compact: and $rm64, $rn64
163
164 void
165 sh5_compact_sem_and_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
166         sh5_compact::write_stacks &buf)
167 {
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169   sem_status status = SEM_STATUS_NORMAL;
170   sh5_compact_scache* abuf = sem;
171   unsigned long long written = 0;
172   PCADDR pc = abuf->addr;
173   PCADDR npc = pc + 2;
174
175   {
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);
180   }
181
182   current_cpu->done_insn (npc, status);
183 #undef FLD
184 }
185
186 // ********** andi-compact: and #$uimm8, r0
187
188 void
189 sh5_compact_sem_andi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
190         sh5_compact::write_stacks &buf)
191 {
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193   sem_status status = SEM_STATUS_NORMAL;
194   sh5_compact_scache* abuf = sem;
195   unsigned long long written = 0;
196   PCADDR pc = abuf->addr;
197   PCADDR npc = pc + 2;
198
199   {
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);
204   }
205
206   current_cpu->done_insn (npc, status);
207 #undef FLD
208 }
209
210 // ********** andb-compact: and.b #$imm8, @(r0, gbr)
211
212 void
213 sh5_compact_sem_andb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
214         sh5_compact::write_stacks &buf)
215 {
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217   sem_status status = SEM_STATUS_NORMAL;
218   sh5_compact_scache* abuf = sem;
219   unsigned long long written = 0;
220   PCADDR pc = abuf->addr;
221   PCADDR npc = pc + 2;
222
223 {
224   DI tmp_addr;
225   UQI tmp_data;
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));
228   {
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);
233   }
234 }
235
236   current_cpu->done_insn (npc, status);
237 #undef FLD
238 }
239
240 // ********** bf-compact: bf $disp8
241
242 void
243 sh5_compact_sem_bf_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
244         sh5_compact::write_stacks &buf)
245 {
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247   sem_status status = SEM_STATUS_NORMAL;
248   sh5_compact_scache* abuf = sem;
249   unsigned long long written = 0;
250   PCADDR pc = abuf->addr;
251   PCADDR npc = pc + 2;
252
253 if (NOTBI (current_cpu->h_tbit_get ())) {
254   {
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);
260   }
261 }
262
263   abuf->written = written;
264   current_cpu->done_cti_insn (npc, status);
265 #undef FLD
266 }
267
268 // ********** bfs-compact: bf/s $disp8
269
270 void
271 sh5_compact_sem_bfs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
272         sh5_compact::write_stacks &buf)
273 {
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275   sem_status status = SEM_STATUS_NORMAL;
276   sh5_compact_scache* abuf = sem;
277   unsigned long long written = 0;
278   PCADDR pc = abuf->addr;
279   PCADDR npc = pc + 2;
280
281 if (NOTBI (current_cpu->h_tbit_get ())) {
282 {
283   {
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);
289   }
290 current_cpu->save_delayed_pc (FLD (i_disp8));
291   {
292     UDI opval = FLD (i_disp8);
293     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
294     if (UNLIKELY(current_cpu->trace_result_p))
295       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
296   }
297 }
298 }
299
300   abuf->written = written;
301   current_cpu->done_cti_insn (npc, status);
302 #undef FLD
303 }
304
305 // ********** bra-compact: bra $disp12
306
307 void
308 sh5_compact_sem_bra_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
309         sh5_compact::write_stacks &buf)
310 {
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312   sem_status status = SEM_STATUS_NORMAL;
313   sh5_compact_scache* abuf = sem;
314   unsigned long long written = 0;
315   PCADDR pc = abuf->addr;
316   PCADDR npc = pc + 2;
317
318 {
319   {
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);
324   }
325 current_cpu->save_delayed_pc (FLD (i_disp12));
326   {
327     UDI opval = FLD (i_disp12);
328     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
329     if (UNLIKELY(current_cpu->trace_result_p))
330       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
331   }
332 }
333
334   current_cpu->done_cti_insn (npc, status);
335 #undef FLD
336 }
337
338 // ********** braf-compact: braf $rn
339
340 void
341 sh5_compact_sem_braf_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
342         sh5_compact::write_stacks &buf)
343 {
344 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
345   sem_status status = SEM_STATUS_NORMAL;
346   sh5_compact_scache* abuf = sem;
347   unsigned long long written = 0;
348   PCADDR pc = abuf->addr;
349   PCADDR npc = pc + 2;
350
351 {
352   {
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);
357   }
358 current_cpu->save_delayed_pc (ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4)));
359   {
360     UDI opval = ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4));
361     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
362     if (UNLIKELY(current_cpu->trace_result_p))
363       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
364   }
365 }
366
367   current_cpu->done_cti_insn (npc, status);
368 #undef FLD
369 }
370
371 // ********** brk-compact: brk
372
373 void
374 sh5_compact_sem_brk_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
375         sh5_compact::write_stacks &buf)
376 {
377 #define FLD(f) abuf->fields.fmt_empty.f
378   sem_status status = SEM_STATUS_NORMAL;
379   sh5_compact_scache* abuf = sem;
380   unsigned long long written = 0;
381   PCADDR pc = abuf->addr;
382   PCADDR npc = pc + 2;
383
384 current_cpu->sh64_break (pc);
385
386   current_cpu->done_insn (npc, status);
387 #undef FLD
388 }
389
390 // ********** bsr-compact: bsr $disp12
391
392 void
393 sh5_compact_sem_bsr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
394         sh5_compact::write_stacks &buf)
395 {
396 #define FLD(f) abuf->fields.sfmt_bra_compact.f
397   sem_status status = SEM_STATUS_NORMAL;
398   sh5_compact_scache* abuf = sem;
399   unsigned long long written = 0;
400   PCADDR pc = abuf->addr;
401   PCADDR npc = pc + 2;
402
403 {
404   {
405     SI opval = ADDDI (pc, 4);
406     buf.h_pr_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<SI>(pc, opval));
407     if (UNLIKELY(current_cpu->trace_result_p))
408       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
409   }
410   {
411     UDI opval = ADDDI (pc, 2);
412     if (UNLIKELY(current_cpu->trace_result_p))
413       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
414     current_cpu->branch (opval, npc, status);
415   }
416 current_cpu->save_delayed_pc (FLD (i_disp12));
417   {
418     UDI opval = FLD (i_disp12);
419     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
420     if (UNLIKELY(current_cpu->trace_result_p))
421       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
422   }
423 }
424
425   current_cpu->done_cti_insn (npc, status);
426 #undef FLD
427 }
428
429 // ********** bsrf-compact: bsrf $rn
430
431 void
432 sh5_compact_sem_bsrf_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
433         sh5_compact::write_stacks &buf)
434 {
435 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
436   sem_status status = SEM_STATUS_NORMAL;
437   sh5_compact_scache* abuf = sem;
438   unsigned long long written = 0;
439   PCADDR pc = abuf->addr;
440   PCADDR npc = pc + 2;
441
442 {
443   {
444     SI opval = ADDDI (pc, 4);
445     buf.h_pr_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<SI>(pc, opval));
446     if (UNLIKELY(current_cpu->trace_result_p))
447       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
448   }
449   {
450     UDI opval = ADDDI (pc, 2);
451     if (UNLIKELY(current_cpu->trace_result_p))
452       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
453     current_cpu->branch (opval, npc, status);
454   }
455 current_cpu->save_delayed_pc (ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4)));
456   {
457     UDI opval = ADDDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))), ADDDI (pc, 4));
458     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
459     if (UNLIKELY(current_cpu->trace_result_p))
460       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
461   }
462 }
463
464   current_cpu->done_cti_insn (npc, status);
465 #undef FLD
466 }
467
468 // ********** bt-compact: bt $disp8
469
470 void
471 sh5_compact_sem_bt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
472         sh5_compact::write_stacks &buf)
473 {
474 #define FLD(f) abuf->fields.sfmt_bf_compact.f
475   sem_status status = SEM_STATUS_NORMAL;
476   sh5_compact_scache* abuf = sem;
477   unsigned long long written = 0;
478   PCADDR pc = abuf->addr;
479   PCADDR npc = pc + 2;
480
481 if (current_cpu->h_tbit_get ()) {
482   {
483     UDI opval = FLD (i_disp8);
484     written |= (1ULL << 2);
485     if (UNLIKELY(current_cpu->trace_result_p))
486       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
487     current_cpu->branch (opval, npc, status);
488   }
489 }
490
491   abuf->written = written;
492   current_cpu->done_cti_insn (npc, status);
493 #undef FLD
494 }
495
496 // ********** bts-compact: bt/s $disp8
497
498 void
499 sh5_compact_sem_bts_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
500         sh5_compact::write_stacks &buf)
501 {
502 #define FLD(f) abuf->fields.sfmt_bf_compact.f
503   sem_status status = SEM_STATUS_NORMAL;
504   sh5_compact_scache* abuf = sem;
505   unsigned long long written = 0;
506   PCADDR pc = abuf->addr;
507   PCADDR npc = pc + 2;
508
509 if (current_cpu->h_tbit_get ()) {
510 {
511   {
512     UDI opval = ADDDI (pc, 2);
513     written |= (1ULL << 3);
514     if (UNLIKELY(current_cpu->trace_result_p))
515       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
516     current_cpu->branch (opval, npc, status);
517   }
518 current_cpu->save_delayed_pc (FLD (i_disp8));
519   {
520     UDI opval = FLD (i_disp8);
521     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
522     if (UNLIKELY(current_cpu->trace_result_p))
523       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
524   }
525 }
526 }
527
528   abuf->written = written;
529   current_cpu->done_cti_insn (npc, status);
530 #undef FLD
531 }
532
533 // ********** clrmac-compact: clrmac
534
535 void
536 sh5_compact_sem_clrmac_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
537         sh5_compact::write_stacks &buf)
538 {
539 #define FLD(f) abuf->fields.fmt_empty.f
540   sem_status status = SEM_STATUS_NORMAL;
541   sh5_compact_scache* abuf = sem;
542   unsigned long long written = 0;
543   PCADDR pc = abuf->addr;
544   PCADDR npc = pc + 2;
545
546 {
547   {
548     SI opval = 0;
549     if (UNLIKELY(current_cpu->trace_result_p))
550       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
551     current_cpu->h_macl_set (opval);
552   }
553   {
554     SI opval = 0;
555     if (UNLIKELY(current_cpu->trace_result_p))
556       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
557     current_cpu->h_mach_set (opval);
558   }
559 }
560
561   current_cpu->done_insn (npc, status);
562 #undef FLD
563 }
564
565 // ********** clrs-compact: clrs
566
567 void
568 sh5_compact_sem_clrs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
569         sh5_compact::write_stacks &buf)
570 {
571 #define FLD(f) abuf->fields.fmt_empty.f
572   sem_status status = SEM_STATUS_NORMAL;
573   sh5_compact_scache* abuf = sem;
574   unsigned long long written = 0;
575   PCADDR pc = abuf->addr;
576   PCADDR npc = pc + 2;
577
578   {
579     BI opval = 0;
580     if (UNLIKELY(current_cpu->trace_result_p))
581       current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << "  ";
582     current_cpu->h_sbit_set (opval);
583   }
584
585   current_cpu->done_insn (npc, status);
586 #undef FLD
587 }
588
589 // ********** clrt-compact: clrt
590
591 void
592 sh5_compact_sem_clrt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
593         sh5_compact::write_stacks &buf)
594 {
595 #define FLD(f) abuf->fields.fmt_empty.f
596   sem_status status = SEM_STATUS_NORMAL;
597   sh5_compact_scache* abuf = sem;
598   unsigned long long written = 0;
599   PCADDR pc = abuf->addr;
600   PCADDR npc = pc + 2;
601
602   {
603     BI opval = 0;
604     if (UNLIKELY(current_cpu->trace_result_p))
605       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
606     current_cpu->h_tbit_set (opval);
607   }
608
609   current_cpu->done_insn (npc, status);
610 #undef FLD
611 }
612
613 // ********** cmpeq-compact: cmp/eq $rm, $rn
614
615 void
616 sh5_compact_sem_cmpeq_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
617         sh5_compact::write_stacks &buf)
618 {
619 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
620   sem_status status = SEM_STATUS_NORMAL;
621   sh5_compact_scache* abuf = sem;
622   unsigned long long written = 0;
623   PCADDR pc = abuf->addr;
624   PCADDR npc = pc + 2;
625
626   {
627     BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
628     if (UNLIKELY(current_cpu->trace_result_p))
629       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
630     current_cpu->h_tbit_set (opval);
631   }
632
633   current_cpu->done_insn (npc, status);
634 #undef FLD
635 }
636
637 // ********** cmpeqi-compact: cmp/eq #$imm8, r0
638
639 void
640 sh5_compact_sem_cmpeqi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
641         sh5_compact::write_stacks &buf)
642 {
643 #define FLD(f) abuf->fields.sfmt_andi_compact.f
644   sem_status status = SEM_STATUS_NORMAL;
645   sh5_compact_scache* abuf = sem;
646   unsigned long long written = 0;
647   PCADDR pc = abuf->addr;
648   PCADDR npc = pc + 2;
649
650   {
651     BI opval = EQSI (current_cpu->h_grc_get (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
652     if (UNLIKELY(current_cpu->trace_result_p))
653       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
654     current_cpu->h_tbit_set (opval);
655   }
656
657   current_cpu->done_insn (npc, status);
658 #undef FLD
659 }
660
661 // ********** cmpge-compact: cmp/ge $rm, $rn
662
663 void
664 sh5_compact_sem_cmpge_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
665         sh5_compact::write_stacks &buf)
666 {
667 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
668   sem_status status = SEM_STATUS_NORMAL;
669   sh5_compact_scache* abuf = sem;
670   unsigned long long written = 0;
671   PCADDR pc = abuf->addr;
672   PCADDR npc = pc + 2;
673
674   {
675     BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
676     if (UNLIKELY(current_cpu->trace_result_p))
677       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
678     current_cpu->h_tbit_set (opval);
679   }
680
681   current_cpu->done_insn (npc, status);
682 #undef FLD
683 }
684
685 // ********** cmpgt-compact: cmp/gt $rm, $rn
686
687 void
688 sh5_compact_sem_cmpgt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
689         sh5_compact::write_stacks &buf)
690 {
691 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
692   sem_status status = SEM_STATUS_NORMAL;
693   sh5_compact_scache* abuf = sem;
694   unsigned long long written = 0;
695   PCADDR pc = abuf->addr;
696   PCADDR npc = pc + 2;
697
698   {
699     BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
700     if (UNLIKELY(current_cpu->trace_result_p))
701       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
702     current_cpu->h_tbit_set (opval);
703   }
704
705   current_cpu->done_insn (npc, status);
706 #undef FLD
707 }
708
709 // ********** cmphi-compact: cmp/hi $rm, $rn
710
711 void
712 sh5_compact_sem_cmphi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
713         sh5_compact::write_stacks &buf)
714 {
715 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
716   sem_status status = SEM_STATUS_NORMAL;
717   sh5_compact_scache* abuf = sem;
718   unsigned long long written = 0;
719   PCADDR pc = abuf->addr;
720   PCADDR npc = pc + 2;
721
722   {
723     BI opval = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
724     if (UNLIKELY(current_cpu->trace_result_p))
725       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
726     current_cpu->h_tbit_set (opval);
727   }
728
729   current_cpu->done_insn (npc, status);
730 #undef FLD
731 }
732
733 // ********** cmphs-compact: cmp/hs $rm, $rn
734
735 void
736 sh5_compact_sem_cmphs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
737         sh5_compact::write_stacks &buf)
738 {
739 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
740   sem_status status = SEM_STATUS_NORMAL;
741   sh5_compact_scache* abuf = sem;
742   unsigned long long written = 0;
743   PCADDR pc = abuf->addr;
744   PCADDR npc = pc + 2;
745
746   {
747     BI opval = GEUSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
748     if (UNLIKELY(current_cpu->trace_result_p))
749       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
750     current_cpu->h_tbit_set (opval);
751   }
752
753   current_cpu->done_insn (npc, status);
754 #undef FLD
755 }
756
757 // ********** cmppl-compact: cmp/pl $rn
758
759 void
760 sh5_compact_sem_cmppl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
761         sh5_compact::write_stacks &buf)
762 {
763 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
764   sem_status status = SEM_STATUS_NORMAL;
765   sh5_compact_scache* abuf = sem;
766   unsigned long long written = 0;
767   PCADDR pc = abuf->addr;
768   PCADDR npc = pc + 2;
769
770   {
771     BI opval = GTSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
772     if (UNLIKELY(current_cpu->trace_result_p))
773       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
774     current_cpu->h_tbit_set (opval);
775   }
776
777   current_cpu->done_insn (npc, status);
778 #undef FLD
779 }
780
781 // ********** cmppz-compact: cmp/pz $rn
782
783 void
784 sh5_compact_sem_cmppz_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
785         sh5_compact::write_stacks &buf)
786 {
787 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
788   sem_status status = SEM_STATUS_NORMAL;
789   sh5_compact_scache* abuf = sem;
790   unsigned long long written = 0;
791   PCADDR pc = abuf->addr;
792   PCADDR npc = pc + 2;
793
794   {
795     BI opval = GESI (current_cpu->h_grc_get (FLD (f_rn)), 0);
796     if (UNLIKELY(current_cpu->trace_result_p))
797       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
798     current_cpu->h_tbit_set (opval);
799   }
800
801   current_cpu->done_insn (npc, status);
802 #undef FLD
803 }
804
805 // ********** cmpstr-compact: cmp/str $rm, $rn
806
807 void
808 sh5_compact_sem_cmpstr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
809         sh5_compact::write_stacks &buf)
810 {
811 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
812   sem_status status = SEM_STATUS_NORMAL;
813   sh5_compact_scache* abuf = sem;
814   unsigned long long written = 0;
815   PCADDR pc = abuf->addr;
816   PCADDR npc = pc + 2;
817
818 {
819   BI tmp_t;
820   SI tmp_temp;
821   tmp_temp = XORSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
822   tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
823   tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
824   tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
825   tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
826   {
827     BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
828     if (UNLIKELY(current_cpu->trace_result_p))
829       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
830     current_cpu->h_tbit_set (opval);
831   }
832 }
833
834   current_cpu->done_insn (npc, status);
835 #undef FLD
836 }
837
838 // ********** div0s-compact: div0s $rm, $rn
839
840 void
841 sh5_compact_sem_div0s_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
842         sh5_compact::write_stacks &buf)
843 {
844 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
845   sem_status status = SEM_STATUS_NORMAL;
846   sh5_compact_scache* abuf = sem;
847   unsigned long long written = 0;
848   PCADDR pc = abuf->addr;
849   PCADDR npc = pc + 2;
850
851 {
852   {
853     BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
854     if (UNLIKELY(current_cpu->trace_result_p))
855       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
856     current_cpu->h_qbit_set (opval);
857   }
858   {
859     BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
860     if (UNLIKELY(current_cpu->trace_result_p))
861       current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << "  ";
862     current_cpu->h_mbit_set (opval);
863   }
864   {
865     BI opval = ((EQSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 31), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31))) ? (0) : (1));
866     if (UNLIKELY(current_cpu->trace_result_p))
867       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
868     current_cpu->h_tbit_set (opval);
869   }
870 }
871
872   current_cpu->done_insn (npc, status);
873 #undef FLD
874 }
875
876 // ********** div0u-compact: div0u
877
878 void
879 sh5_compact_sem_div0u_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
880         sh5_compact::write_stacks &buf)
881 {
882 #define FLD(f) abuf->fields.fmt_empty.f
883   sem_status status = SEM_STATUS_NORMAL;
884   sh5_compact_scache* abuf = sem;
885   unsigned long long written = 0;
886   PCADDR pc = abuf->addr;
887   PCADDR npc = pc + 2;
888
889 {
890   {
891     BI opval = 0;
892     if (UNLIKELY(current_cpu->trace_result_p))
893       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
894     current_cpu->h_tbit_set (opval);
895   }
896   {
897     BI opval = 0;
898     if (UNLIKELY(current_cpu->trace_result_p))
899       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
900     current_cpu->h_qbit_set (opval);
901   }
902   {
903     BI opval = 0;
904     if (UNLIKELY(current_cpu->trace_result_p))
905       current_cpu->trace_stream << "mbit" << ":=0x" << hex << opval << dec << "  ";
906     current_cpu->h_mbit_set (opval);
907   }
908 }
909
910   current_cpu->done_insn (npc, status);
911 #undef FLD
912 }
913
914 // ********** div1-compact: div1 $rm, $rn
915
916 void
917 sh5_compact_sem_div1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
918         sh5_compact::write_stacks &buf)
919 {
920 #define FLD(f) abuf->fields.sfmt_macl_compact.f
921   sem_status status = SEM_STATUS_NORMAL;
922   sh5_compact_scache* abuf = sem;
923   unsigned long long written = 0;
924   PCADDR pc = abuf->addr;
925   PCADDR npc = pc + 2;
926
927 {
928   BI tmp_oldq;
929   SI tmp_tmp0;
930   UQI tmp_tmp1;
931   tmp_oldq = current_cpu->h_qbit_get ();
932   {
933     BI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
934     if (UNLIKELY(current_cpu->trace_result_p))
935       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
936     current_cpu->h_qbit_set (opval);
937   }
938   {
939     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), ZEXTBISI (current_cpu->h_tbit_get ()));
940     if (UNLIKELY(current_cpu->trace_result_p))
941       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
942     current_cpu->h_grc_set (FLD (f_rn), opval);
943   }
944 if (NOTBI (tmp_oldq)) {
945 if (NOTBI (current_cpu->h_mbit_get ())) {
946 {
947   tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
948   {
949     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
950     if (UNLIKELY(current_cpu->trace_result_p))
951       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
952     current_cpu->h_grc_set (FLD (f_rn), opval);
953   }
954   tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
955 if (NOTBI (current_cpu->h_qbit_get ())) {
956   {
957     BI opval = ((tmp_tmp1) ? (1) : (0));
958     if (UNLIKELY(current_cpu->trace_result_p))
959       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
960     current_cpu->h_qbit_set (opval);
961   }
962 } else {
963   {
964     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
965     if (UNLIKELY(current_cpu->trace_result_p))
966       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
967     current_cpu->h_qbit_set (opval);
968   }
969 }
970 }
971 } else {
972 {
973   tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
974   {
975     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
976     if (UNLIKELY(current_cpu->trace_result_p))
977       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
978     current_cpu->h_grc_set (FLD (f_rn), opval);
979   }
980   tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
981 if (NOTBI (current_cpu->h_qbit_get ())) {
982   {
983     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
984     if (UNLIKELY(current_cpu->trace_result_p))
985       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
986     current_cpu->h_qbit_set (opval);
987   }
988 } else {
989   {
990     BI opval = ((tmp_tmp1) ? (1) : (0));
991     if (UNLIKELY(current_cpu->trace_result_p))
992       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
993     current_cpu->h_qbit_set (opval);
994   }
995 }
996 }
997 }
998 } else {
999 if (NOTBI (current_cpu->h_mbit_get ())) {
1000 {
1001   tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
1002   {
1003     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
1004     if (UNLIKELY(current_cpu->trace_result_p))
1005       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1006     current_cpu->h_grc_set (FLD (f_rn), opval);
1007   }
1008   tmp_tmp1 = LTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
1009 if (NOTBI (current_cpu->h_qbit_get ())) {
1010   {
1011     BI opval = ((tmp_tmp1) ? (1) : (0));
1012     if (UNLIKELY(current_cpu->trace_result_p))
1013       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
1014     current_cpu->h_qbit_set (opval);
1015   }
1016 } else {
1017   {
1018     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1019     if (UNLIKELY(current_cpu->trace_result_p))
1020       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
1021     current_cpu->h_qbit_set (opval);
1022   }
1023 }
1024 }
1025 } else {
1026 {
1027   tmp_tmp0 = current_cpu->h_grc_get (FLD (f_rn));
1028   {
1029     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
1030     if (UNLIKELY(current_cpu->trace_result_p))
1031       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1032     current_cpu->h_grc_set (FLD (f_rn), opval);
1033   }
1034   tmp_tmp1 = GTUSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_tmp0);
1035 if (NOTBI (current_cpu->h_qbit_get ())) {
1036   {
1037     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1038     if (UNLIKELY(current_cpu->trace_result_p))
1039       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
1040     current_cpu->h_qbit_set (opval);
1041   }
1042 } else {
1043   {
1044     BI opval = ((tmp_tmp1) ? (1) : (0));
1045     if (UNLIKELY(current_cpu->trace_result_p))
1046       current_cpu->trace_stream << "qbit" << ":=0x" << hex << opval << dec << "  ";
1047     current_cpu->h_qbit_set (opval);
1048   }
1049 }
1050 }
1051 }
1052 }
1053   {
1054     BI opval = ((EQBI (current_cpu->h_qbit_get (), current_cpu->h_mbit_get ())) ? (1) : (0));
1055     if (UNLIKELY(current_cpu->trace_result_p))
1056       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1057     current_cpu->h_tbit_set (opval);
1058   }
1059 }
1060
1061   current_cpu->done_insn (npc, status);
1062 #undef FLD
1063 }
1064
1065 // ********** divu-compact: divu r0, $rn
1066
1067 void
1068 sh5_compact_sem_divu_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1069         sh5_compact::write_stacks &buf)
1070 {
1071 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1072   sem_status status = SEM_STATUS_NORMAL;
1073   sh5_compact_scache* abuf = sem;
1074   unsigned long long written = 0;
1075   PCADDR pc = abuf->addr;
1076   PCADDR npc = pc + 2;
1077
1078   {
1079     SI opval = UDIVSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1080     if (UNLIKELY(current_cpu->trace_result_p))
1081       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1082     current_cpu->h_grc_set (FLD (f_rn), opval);
1083   }
1084
1085   current_cpu->done_insn (npc, status);
1086 #undef FLD
1087 }
1088
1089 // ********** mulr-compact: mulr r0, $rn
1090
1091 void
1092 sh5_compact_sem_mulr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1093         sh5_compact::write_stacks &buf)
1094 {
1095 #define FLD(f) abuf->fields.sfmt_divu_compact.f
1096   sem_status status = SEM_STATUS_NORMAL;
1097   sh5_compact_scache* abuf = sem;
1098   unsigned long long written = 0;
1099   PCADDR pc = abuf->addr;
1100   PCADDR npc = pc + 2;
1101
1102   {
1103     SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (((UINT) 0)));
1104     if (UNLIKELY(current_cpu->trace_result_p))
1105       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1106     current_cpu->h_grc_set (FLD (f_rn), opval);
1107   }
1108
1109   current_cpu->done_insn (npc, status);
1110 #undef FLD
1111 }
1112
1113 // ********** dmulsl-compact: dmuls.l $rm, $rn
1114
1115 void
1116 sh5_compact_sem_dmulsl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1117         sh5_compact::write_stacks &buf)
1118 {
1119 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1120   sem_status status = SEM_STATUS_NORMAL;
1121   sh5_compact_scache* abuf = sem;
1122   unsigned long long written = 0;
1123   PCADDR pc = abuf->addr;
1124   PCADDR npc = pc + 2;
1125
1126 {
1127   DI tmp_result;
1128   tmp_result = MULDI (EXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), EXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1129   {
1130     SI opval = SUBWORDDISI (tmp_result, 0);
1131     if (UNLIKELY(current_cpu->trace_result_p))
1132       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
1133     current_cpu->h_mach_set (opval);
1134   }
1135   {
1136     SI opval = SUBWORDDISI (tmp_result, 1);
1137     if (UNLIKELY(current_cpu->trace_result_p))
1138       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
1139     current_cpu->h_macl_set (opval);
1140   }
1141 }
1142
1143   current_cpu->done_insn (npc, status);
1144 #undef FLD
1145 }
1146
1147 // ********** dmulul-compact: dmulu.l $rm, $rn
1148
1149 void
1150 sh5_compact_sem_dmulul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1151         sh5_compact::write_stacks &buf)
1152 {
1153 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
1154   sem_status status = SEM_STATUS_NORMAL;
1155   sh5_compact_scache* abuf = sem;
1156   unsigned long long written = 0;
1157   PCADDR pc = abuf->addr;
1158   PCADDR npc = pc + 2;
1159
1160 {
1161   DI tmp_result;
1162   tmp_result = MULDI (ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rm))), ZEXTSIDI (current_cpu->h_grc_get (FLD (f_rn))));
1163   {
1164     SI opval = SUBWORDDISI (tmp_result, 0);
1165     if (UNLIKELY(current_cpu->trace_result_p))
1166       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
1167     current_cpu->h_mach_set (opval);
1168   }
1169   {
1170     SI opval = SUBWORDDISI (tmp_result, 1);
1171     if (UNLIKELY(current_cpu->trace_result_p))
1172       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
1173     current_cpu->h_macl_set (opval);
1174   }
1175 }
1176
1177   current_cpu->done_insn (npc, status);
1178 #undef FLD
1179 }
1180
1181 // ********** dt-compact: dt $rn
1182
1183 void
1184 sh5_compact_sem_dt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1185         sh5_compact::write_stacks &buf)
1186 {
1187 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
1188   sem_status status = SEM_STATUS_NORMAL;
1189   sh5_compact_scache* abuf = sem;
1190   unsigned long long written = 0;
1191   PCADDR pc = abuf->addr;
1192   PCADDR npc = pc + 2;
1193
1194 {
1195   {
1196     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1197     if (UNLIKELY(current_cpu->trace_result_p))
1198       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1199     current_cpu->h_grc_set (FLD (f_rn), opval);
1200   }
1201   {
1202     BI opval = EQSI (current_cpu->h_grc_get (FLD (f_rn)), 0);
1203     if (UNLIKELY(current_cpu->trace_result_p))
1204       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1205     current_cpu->h_tbit_set (opval);
1206   }
1207 }
1208
1209   current_cpu->done_insn (npc, status);
1210 #undef FLD
1211 }
1212
1213 // ********** extsb-compact: exts.b $rm, $rn
1214
1215 void
1216 sh5_compact_sem_extsb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1217         sh5_compact::write_stacks &buf)
1218 {
1219 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1220   sem_status status = SEM_STATUS_NORMAL;
1221   sh5_compact_scache* abuf = sem;
1222   unsigned long long written = 0;
1223   PCADDR pc = abuf->addr;
1224   PCADDR npc = pc + 2;
1225
1226   {
1227     SI opval = EXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1228     if (UNLIKELY(current_cpu->trace_result_p))
1229       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1230     current_cpu->h_grc_set (FLD (f_rn), opval);
1231   }
1232
1233   current_cpu->done_insn (npc, status);
1234 #undef FLD
1235 }
1236
1237 // ********** extsw-compact: exts.w $rm, $rn
1238
1239 void
1240 sh5_compact_sem_extsw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1241         sh5_compact::write_stacks &buf)
1242 {
1243 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1244   sem_status status = SEM_STATUS_NORMAL;
1245   sh5_compact_scache* abuf = sem;
1246   unsigned long long written = 0;
1247   PCADDR pc = abuf->addr;
1248   PCADDR npc = pc + 2;
1249
1250   {
1251     SI opval = EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1252     if (UNLIKELY(current_cpu->trace_result_p))
1253       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1254     current_cpu->h_grc_set (FLD (f_rn), opval);
1255   }
1256
1257   current_cpu->done_insn (npc, status);
1258 #undef FLD
1259 }
1260
1261 // ********** extub-compact: extu.b $rm, $rn
1262
1263 void
1264 sh5_compact_sem_extub_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1265         sh5_compact::write_stacks &buf)
1266 {
1267 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1268   sem_status status = SEM_STATUS_NORMAL;
1269   sh5_compact_scache* abuf = sem;
1270   unsigned long long written = 0;
1271   PCADDR pc = abuf->addr;
1272   PCADDR npc = pc + 2;
1273
1274   {
1275     SI opval = ZEXTQISI (SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3));
1276     if (UNLIKELY(current_cpu->trace_result_p))
1277       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1278     current_cpu->h_grc_set (FLD (f_rn), opval);
1279   }
1280
1281   current_cpu->done_insn (npc, status);
1282 #undef FLD
1283 }
1284
1285 // ********** extuw-compact: extu.w $rm, $rn
1286
1287 void
1288 sh5_compact_sem_extuw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1289         sh5_compact::write_stacks &buf)
1290 {
1291 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1292   sem_status status = SEM_STATUS_NORMAL;
1293   sh5_compact_scache* abuf = sem;
1294   unsigned long long written = 0;
1295   PCADDR pc = abuf->addr;
1296   PCADDR npc = pc + 2;
1297
1298   {
1299     SI opval = ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1));
1300     if (UNLIKELY(current_cpu->trace_result_p))
1301       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1302     current_cpu->h_grc_set (FLD (f_rn), opval);
1303   }
1304
1305   current_cpu->done_insn (npc, status);
1306 #undef FLD
1307 }
1308
1309 // ********** fabs-compact: fabs $fsdn
1310
1311 void
1312 sh5_compact_sem_fabs_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1313         sh5_compact::write_stacks &buf)
1314 {
1315 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1316   sem_status status = SEM_STATUS_NORMAL;
1317   sh5_compact_scache* abuf = sem;
1318   unsigned long long written = 0;
1319   PCADDR pc = abuf->addr;
1320   PCADDR npc = pc + 2;
1321
1322 if (current_cpu->h_prbit_get ()) {
1323   {
1324     DF opval = current_cpu->sh64_fabsd (current_cpu->h_fsd_get (FLD (f_rn)));
1325     written |= (1ULL << 2);
1326     if (UNLIKELY(current_cpu->trace_result_p))
1327       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1328     current_cpu->h_fsd_set (FLD (f_rn), opval);
1329   }
1330 } else {
1331   {
1332     DF opval = current_cpu->sh64_fabss (current_cpu->h_fsd_get (FLD (f_rn)));
1333     written |= (1ULL << 2);
1334     if (UNLIKELY(current_cpu->trace_result_p))
1335       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1336     current_cpu->h_fsd_set (FLD (f_rn), opval);
1337   }
1338 }
1339
1340   abuf->written = written;
1341   current_cpu->done_insn (npc, status);
1342 #undef FLD
1343 }
1344
1345 // ********** fadd-compact: fadd $fsdm, $fsdn
1346
1347 void
1348 sh5_compact_sem_fadd_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1349         sh5_compact::write_stacks &buf)
1350 {
1351 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1352   sem_status status = SEM_STATUS_NORMAL;
1353   sh5_compact_scache* abuf = sem;
1354   unsigned long long written = 0;
1355   PCADDR pc = abuf->addr;
1356   PCADDR npc = pc + 2;
1357
1358 if (current_cpu->h_prbit_get ()) {
1359   {
1360     DF opval = current_cpu->sh64_faddd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1361     written |= (1ULL << 3);
1362     if (UNLIKELY(current_cpu->trace_result_p))
1363       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1364     current_cpu->h_fsd_set (FLD (f_rn), opval);
1365   }
1366 } else {
1367   {
1368     DF opval = current_cpu->sh64_fadds (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1369     written |= (1ULL << 3);
1370     if (UNLIKELY(current_cpu->trace_result_p))
1371       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1372     current_cpu->h_fsd_set (FLD (f_rn), opval);
1373   }
1374 }
1375
1376   abuf->written = written;
1377   current_cpu->done_insn (npc, status);
1378 #undef FLD
1379 }
1380
1381 // ********** fcmpeq-compact: fcmp/eq $fsdm, $fsdn
1382
1383 void
1384 sh5_compact_sem_fcmpeq_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1385         sh5_compact::write_stacks &buf)
1386 {
1387 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1388   sem_status status = SEM_STATUS_NORMAL;
1389   sh5_compact_scache* abuf = sem;
1390   unsigned long long written = 0;
1391   PCADDR pc = abuf->addr;
1392   PCADDR npc = pc + 2;
1393
1394 if (current_cpu->h_prbit_get ()) {
1395   {
1396     BI opval = current_cpu->sh64_fcmpeqd (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1397     written |= (1ULL << 3);
1398     if (UNLIKELY(current_cpu->trace_result_p))
1399       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1400     current_cpu->h_tbit_set (opval);
1401   }
1402 } else {
1403   {
1404     BI opval = current_cpu->sh64_fcmpeqs (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
1405     written |= (1ULL << 3);
1406     if (UNLIKELY(current_cpu->trace_result_p))
1407       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1408     current_cpu->h_tbit_set (opval);
1409   }
1410 }
1411
1412   abuf->written = written;
1413   current_cpu->done_insn (npc, status);
1414 #undef FLD
1415 }
1416
1417 // ********** fcmpgt-compact: fcmp/gt $fsdm, $fsdn
1418
1419 void
1420 sh5_compact_sem_fcmpgt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1421         sh5_compact::write_stacks &buf)
1422 {
1423 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1424   sem_status status = SEM_STATUS_NORMAL;
1425   sh5_compact_scache* abuf = sem;
1426   unsigned long long written = 0;
1427   PCADDR pc = abuf->addr;
1428   PCADDR npc = pc + 2;
1429
1430 if (current_cpu->h_prbit_get ()) {
1431   {
1432     BI opval = current_cpu->sh64_fcmpgtd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1433     written |= (1ULL << 3);
1434     if (UNLIKELY(current_cpu->trace_result_p))
1435       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1436     current_cpu->h_tbit_set (opval);
1437   }
1438 } else {
1439   {
1440     BI opval = current_cpu->sh64_fcmpgts (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1441     written |= (1ULL << 3);
1442     if (UNLIKELY(current_cpu->trace_result_p))
1443       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
1444     current_cpu->h_tbit_set (opval);
1445   }
1446 }
1447
1448   abuf->written = written;
1449   current_cpu->done_insn (npc, status);
1450 #undef FLD
1451 }
1452
1453 // ********** fcnvds-compact: fcnvds $drn, fpul
1454
1455 void
1456 sh5_compact_sem_fcnvds_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1457         sh5_compact::write_stacks &buf)
1458 {
1459 #define FLD(f) abuf->fields.sfmt_fcnvds_compact.f
1460   sem_status status = SEM_STATUS_NORMAL;
1461   sh5_compact_scache* abuf = sem;
1462   unsigned long long written = 0;
1463   PCADDR pc = abuf->addr;
1464   PCADDR npc = pc + 2;
1465
1466   {
1467     SF opval = current_cpu->sh64_fcnvds (current_cpu->h_drc_get (FLD (f_dn)));
1468     if (UNLIKELY(current_cpu->trace_result_p))
1469       current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << "  ";
1470     current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1471   }
1472
1473   current_cpu->done_insn (npc, status);
1474 #undef FLD
1475 }
1476
1477 // ********** fcnvsd-compact: fcnvsd fpul, $drn
1478
1479 void
1480 sh5_compact_sem_fcnvsd_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1481         sh5_compact::write_stacks &buf)
1482 {
1483 #define FLD(f) abuf->fields.sfmt_fcnvsd_compact.f
1484   sem_status status = SEM_STATUS_NORMAL;
1485   sh5_compact_scache* abuf = sem;
1486   unsigned long long written = 0;
1487   PCADDR pc = abuf->addr;
1488   PCADDR npc = pc + 2;
1489
1490   {
1491     DF opval = current_cpu->sh64_fcnvsd (current_cpu->hardware.h_fr[((UINT) 32)]);
1492     if (UNLIKELY(current_cpu->trace_result_p))
1493       current_cpu->trace_stream << "drc" << '[' << FLD (f_dn) << ']' << ":=0x" << hex << opval << dec << "  ";
1494     current_cpu->h_drc_set (FLD (f_dn), opval);
1495   }
1496
1497   current_cpu->done_insn (npc, status);
1498 #undef FLD
1499 }
1500
1501 // ********** fdiv-compact: fdiv $fsdm, $fsdn
1502
1503 void
1504 sh5_compact_sem_fdiv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1505         sh5_compact::write_stacks &buf)
1506 {
1507 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
1508   sem_status status = SEM_STATUS_NORMAL;
1509   sh5_compact_scache* abuf = sem;
1510   unsigned long long written = 0;
1511   PCADDR pc = abuf->addr;
1512   PCADDR npc = pc + 2;
1513
1514 if (current_cpu->h_prbit_get ()) {
1515   {
1516     DF opval = current_cpu->sh64_fdivd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1517     written |= (1ULL << 3);
1518     if (UNLIKELY(current_cpu->trace_result_p))
1519       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1520     current_cpu->h_fsd_set (FLD (f_rn), opval);
1521   }
1522 } else {
1523   {
1524     DF opval = current_cpu->sh64_fdivs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
1525     written |= (1ULL << 3);
1526     if (UNLIKELY(current_cpu->trace_result_p))
1527       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1528     current_cpu->h_fsd_set (FLD (f_rn), opval);
1529   }
1530 }
1531
1532   abuf->written = written;
1533   current_cpu->done_insn (npc, status);
1534 #undef FLD
1535 }
1536
1537 // ********** fipr-compact: fipr $fvm, $fvn
1538
1539 void
1540 sh5_compact_sem_fipr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1541         sh5_compact::write_stacks &buf)
1542 {
1543 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
1544   sem_status status = SEM_STATUS_NORMAL;
1545   sh5_compact_scache* abuf = sem;
1546   unsigned long long written = 0;
1547   PCADDR pc = abuf->addr;
1548   PCADDR npc = pc + 2;
1549
1550 current_cpu->sh64_fipr (FLD (f_vm), FLD (f_vn));
1551
1552   current_cpu->done_insn (npc, status);
1553 #undef FLD
1554 }
1555
1556 // ********** flds-compact: flds $frn, fpul
1557
1558 void
1559 sh5_compact_sem_flds_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1560         sh5_compact::write_stacks &buf)
1561 {
1562 #define FLD(f) abuf->fields.sfmt_flds_compact.f
1563   sem_status status = SEM_STATUS_NORMAL;
1564   sh5_compact_scache* abuf = sem;
1565   unsigned long long written = 0;
1566   PCADDR pc = abuf->addr;
1567   PCADDR npc = pc + 2;
1568
1569   {
1570     SF opval = current_cpu->h_frc_get (FLD (f_rn));
1571     if (UNLIKELY(current_cpu->trace_result_p))
1572       current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << "  ";
1573     current_cpu->hardware.h_fr[((UINT) 32)] = opval;
1574   }
1575
1576   current_cpu->done_insn (npc, status);
1577 #undef FLD
1578 }
1579
1580 // ********** fldi0-compact: fldi0 $frn
1581
1582 void
1583 sh5_compact_sem_fldi0_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1584         sh5_compact::write_stacks &buf)
1585 {
1586 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1587   sem_status status = SEM_STATUS_NORMAL;
1588   sh5_compact_scache* abuf = sem;
1589   unsigned long long written = 0;
1590   PCADDR pc = abuf->addr;
1591   PCADDR npc = pc + 2;
1592
1593   {
1594     SF opval = current_cpu->sh64_fldi0 ();
1595     if (UNLIKELY(current_cpu->trace_result_p))
1596       current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1597     current_cpu->h_frc_set (FLD (f_rn), opval);
1598   }
1599
1600   current_cpu->done_insn (npc, status);
1601 #undef FLD
1602 }
1603
1604 // ********** fldi1-compact: fldi1 $frn
1605
1606 void
1607 sh5_compact_sem_fldi1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1608         sh5_compact::write_stacks &buf)
1609 {
1610 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
1611   sem_status status = SEM_STATUS_NORMAL;
1612   sh5_compact_scache* abuf = sem;
1613   unsigned long long written = 0;
1614   PCADDR pc = abuf->addr;
1615   PCADDR npc = pc + 2;
1616
1617   {
1618     SF opval = current_cpu->sh64_fldi1 ();
1619     if (UNLIKELY(current_cpu->trace_result_p))
1620       current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1621     current_cpu->h_frc_set (FLD (f_rn), opval);
1622   }
1623
1624   current_cpu->done_insn (npc, status);
1625 #undef FLD
1626 }
1627
1628 // ********** float-compact: float fpul, $fsdn
1629
1630 void
1631 sh5_compact_sem_float_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1632         sh5_compact::write_stacks &buf)
1633 {
1634 #define FLD(f) abuf->fields.sfmt_float_compact.f
1635   sem_status status = SEM_STATUS_NORMAL;
1636   sh5_compact_scache* abuf = sem;
1637   unsigned long long written = 0;
1638   PCADDR pc = abuf->addr;
1639   PCADDR npc = pc + 2;
1640
1641 if (current_cpu->h_prbit_get ()) {
1642   {
1643     DF opval = current_cpu->sh64_floatld (current_cpu->hardware.h_fr[((UINT) 32)]);
1644     written |= (1ULL << 2);
1645     if (UNLIKELY(current_cpu->trace_result_p))
1646       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1647     current_cpu->h_fsd_set (FLD (f_rn), opval);
1648   }
1649 } else {
1650   {
1651     DF opval = current_cpu->sh64_floatls (current_cpu->hardware.h_fr[((UINT) 32)]);
1652     written |= (1ULL << 2);
1653     if (UNLIKELY(current_cpu->trace_result_p))
1654       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1655     current_cpu->h_fsd_set (FLD (f_rn), opval);
1656   }
1657 }
1658
1659   abuf->written = written;
1660   current_cpu->done_insn (npc, status);
1661 #undef FLD
1662 }
1663
1664 // ********** fmac-compact: fmac fr0, $frm, $frn
1665
1666 void
1667 sh5_compact_sem_fmac_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1668         sh5_compact::write_stacks &buf)
1669 {
1670 #define FLD(f) abuf->fields.sfmt_fmac_compact.f
1671   sem_status status = SEM_STATUS_NORMAL;
1672   sh5_compact_scache* abuf = sem;
1673   unsigned long long written = 0;
1674   PCADDR pc = abuf->addr;
1675   PCADDR npc = pc + 2;
1676
1677   {
1678     SF opval = current_cpu->sh64_fmacs (current_cpu->h_frc_get (((UINT) 0)), current_cpu->h_frc_get (FLD (f_rm)), current_cpu->h_frc_get (FLD (f_rn)));
1679     if (UNLIKELY(current_cpu->trace_result_p))
1680       current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1681     current_cpu->h_frc_set (FLD (f_rn), opval);
1682   }
1683
1684   current_cpu->done_insn (npc, status);
1685 #undef FLD
1686 }
1687
1688 // ********** fmov1-compact: fmov $fmovm, $fmovn
1689
1690 void
1691 sh5_compact_sem_fmov1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1692         sh5_compact::write_stacks &buf)
1693 {
1694 #define FLD(f) abuf->fields.sfmt_fmov1_compact.f
1695   sem_status status = SEM_STATUS_NORMAL;
1696   sh5_compact_scache* abuf = sem;
1697   unsigned long long written = 0;
1698   PCADDR pc = abuf->addr;
1699   PCADDR npc = pc + 2;
1700
1701   {
1702     DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1703     if (UNLIKELY(current_cpu->trace_result_p))
1704       current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1705     current_cpu->h_fmov_set (FLD (f_rn), opval);
1706   }
1707
1708   current_cpu->done_insn (npc, status);
1709 #undef FLD
1710 }
1711
1712 // ********** fmov2-compact: fmov @$rm, $fmovn
1713
1714 void
1715 sh5_compact_sem_fmov2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1716         sh5_compact::write_stacks &buf)
1717 {
1718 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1719   sem_status status = SEM_STATUS_NORMAL;
1720   sh5_compact_scache* abuf = sem;
1721   unsigned long long written = 0;
1722   PCADDR pc = abuf->addr;
1723   PCADDR npc = pc + 2;
1724
1725 if (NOTBI (current_cpu->h_szbit_get ())) {
1726   {
1727     DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1728     written |= (1ULL << 4);
1729     if (UNLIKELY(current_cpu->trace_result_p))
1730       current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1731     current_cpu->h_fmov_set (FLD (f_rn), opval);
1732   }
1733 } else {
1734   {
1735     DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1736     written |= (1ULL << 4);
1737     if (UNLIKELY(current_cpu->trace_result_p))
1738       current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1739     current_cpu->h_fmov_set (FLD (f_rn), opval);
1740   }
1741 }
1742
1743   abuf->written = written;
1744   current_cpu->done_insn (npc, status);
1745 #undef FLD
1746 }
1747
1748 // ********** fmov3-compact: fmov @${rm}+, fmovn
1749
1750 void
1751 sh5_compact_sem_fmov3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1752         sh5_compact::write_stacks &buf)
1753 {
1754 #define FLD(f) abuf->fields.sfmt_fmov3_compact.f
1755   sem_status status = SEM_STATUS_NORMAL;
1756   sh5_compact_scache* abuf = sem;
1757   unsigned long long written = 0;
1758   PCADDR pc = abuf->addr;
1759   PCADDR npc = pc + 2;
1760
1761 if (NOTBI (current_cpu->h_szbit_get ())) {
1762 {
1763   {
1764     DF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1765     written |= (1ULL << 4);
1766     if (UNLIKELY(current_cpu->trace_result_p))
1767       current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1768     current_cpu->h_fmov_set (FLD (f_rn), opval);
1769   }
1770   {
1771     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1772     written |= (1ULL << 5);
1773     if (UNLIKELY(current_cpu->trace_result_p))
1774       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
1775     current_cpu->h_grc_set (FLD (f_rm), opval);
1776   }
1777 }
1778 } else {
1779 {
1780   {
1781     DF opval = current_cpu->GETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rm)));
1782     written |= (1ULL << 4);
1783     if (UNLIKELY(current_cpu->trace_result_p))
1784       current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1785     current_cpu->h_fmov_set (FLD (f_rn), opval);
1786   }
1787   {
1788     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 8);
1789     written |= (1ULL << 5);
1790     if (UNLIKELY(current_cpu->trace_result_p))
1791       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
1792     current_cpu->h_grc_set (FLD (f_rm), opval);
1793   }
1794 }
1795 }
1796
1797   abuf->written = written;
1798   current_cpu->done_insn (npc, status);
1799 #undef FLD
1800 }
1801
1802 // ********** fmov4-compact: fmov @(r0, $rm), $fmovn
1803
1804 void
1805 sh5_compact_sem_fmov4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1806         sh5_compact::write_stacks &buf)
1807 {
1808 #define FLD(f) abuf->fields.sfmt_fmov4_compact.f
1809   sem_status status = SEM_STATUS_NORMAL;
1810   sh5_compact_scache* abuf = sem;
1811   unsigned long long written = 0;
1812   PCADDR pc = abuf->addr;
1813   PCADDR npc = pc + 2;
1814
1815 if (NOTBI (current_cpu->h_szbit_get ())) {
1816   {
1817     DF opval = current_cpu->GETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1818     written |= (1ULL << 5);
1819     if (UNLIKELY(current_cpu->trace_result_p))
1820       current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1821     current_cpu->h_fmov_set (FLD (f_rn), opval);
1822   }
1823 } else {
1824   {
1825     DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
1826     written |= (1ULL << 5);
1827     if (UNLIKELY(current_cpu->trace_result_p))
1828       current_cpu->trace_stream << "fmov" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1829     current_cpu->h_fmov_set (FLD (f_rn), opval);
1830   }
1831 }
1832
1833   abuf->written = written;
1834   current_cpu->done_insn (npc, status);
1835 #undef FLD
1836 }
1837
1838 // ********** fmov5-compact: fmov $fmovm, @$rn
1839
1840 void
1841 sh5_compact_sem_fmov5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1842         sh5_compact::write_stacks &buf)
1843 {
1844 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1845   sem_status status = SEM_STATUS_NORMAL;
1846   sh5_compact_scache* abuf = sem;
1847   unsigned long long written = 0;
1848   PCADDR pc = abuf->addr;
1849   PCADDR npc = pc + 2;
1850
1851 if (NOTBI (current_cpu->h_szbit_get ())) {
1852   {
1853     SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1854     written |= (1ULL << 4);
1855     if (UNLIKELY(current_cpu->trace_result_p))
1856       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1857     current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1858   }
1859 } else {
1860   {
1861     DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1862     written |= (1ULL << 3);
1863     if (UNLIKELY(current_cpu->trace_result_p))
1864       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1865     current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1866   }
1867 }
1868
1869   abuf->written = written;
1870   current_cpu->done_insn (npc, status);
1871 #undef FLD
1872 }
1873
1874 // ********** fmov6-compact: fmov $fmovm, @-$rn
1875
1876 void
1877 sh5_compact_sem_fmov6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1878         sh5_compact::write_stacks &buf)
1879 {
1880 #define FLD(f) abuf->fields.sfmt_fmov6_compact.f
1881   sem_status status = SEM_STATUS_NORMAL;
1882   sh5_compact_scache* abuf = sem;
1883   unsigned long long written = 0;
1884   PCADDR pc = abuf->addr;
1885   PCADDR npc = pc + 2;
1886
1887 if (NOTBI (current_cpu->h_szbit_get ())) {
1888 {
1889   {
1890     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1891     written |= (1ULL << 5);
1892     if (UNLIKELY(current_cpu->trace_result_p))
1893       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1894     current_cpu->h_grc_set (FLD (f_rn), opval);
1895   }
1896   {
1897     SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1898     written |= (1ULL << 4);
1899     if (UNLIKELY(current_cpu->trace_result_p))
1900       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1901     current_cpu->SETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1902   }
1903 }
1904 } else {
1905 {
1906   {
1907     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
1908     written |= (1ULL << 5);
1909     if (UNLIKELY(current_cpu->trace_result_p))
1910       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1911     current_cpu->h_grc_set (FLD (f_rn), opval);
1912   }
1913   {
1914     DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1915     written |= (1ULL << 3);
1916     if (UNLIKELY(current_cpu->trace_result_p))
1917       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1918     current_cpu->SETMEMDF (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1919   }
1920 }
1921 }
1922
1923   abuf->written = written;
1924   current_cpu->done_insn (npc, status);
1925 #undef FLD
1926 }
1927
1928 // ********** fmov7-compact: fmov $fmovm, @(r0, $rn)
1929
1930 void
1931 sh5_compact_sem_fmov7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1932         sh5_compact::write_stacks &buf)
1933 {
1934 #define FLD(f) abuf->fields.sfmt_fmov7_compact.f
1935   sem_status status = SEM_STATUS_NORMAL;
1936   sh5_compact_scache* abuf = sem;
1937   unsigned long long written = 0;
1938   PCADDR pc = abuf->addr;
1939   PCADDR npc = pc + 2;
1940
1941 if (NOTBI (current_cpu->h_szbit_get ())) {
1942   {
1943     SF opval = current_cpu->h_fmov_get (FLD (f_rm));
1944     written |= (1ULL << 5);
1945     if (UNLIKELY(current_cpu->trace_result_p))
1946       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1947     current_cpu->SETMEMSF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1948   }
1949 } else {
1950   {
1951     DF opval = current_cpu->h_fmov_get (FLD (f_rm));
1952     written |= (1ULL << 4);
1953     if (UNLIKELY(current_cpu->trace_result_p))
1954       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
1955     current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1956   }
1957 }
1958
1959   abuf->written = written;
1960   current_cpu->done_insn (npc, status);
1961 #undef FLD
1962 }
1963
1964 // ********** fmov8-compact: fmov.d @($imm12x8, $rm), $drn
1965
1966 void
1967 sh5_compact_sem_fmov8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1968         sh5_compact::write_stacks &buf)
1969 {
1970 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1971   sem_status status = SEM_STATUS_NORMAL;
1972   sh5_compact_scache* abuf = sem;
1973   unsigned long long written = 0;
1974   PCADDR pc = abuf->addr;
1975   PCADDR npc = pc + 4;
1976
1977   {
1978     DF opval = current_cpu->GETMEMDF (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x8)));
1979     if (UNLIKELY(current_cpu->trace_result_p))
1980       current_cpu->trace_stream << "drc" << '[' << FLD (f_dn) << ']' << ":=0x" << hex << opval << dec << "  ";
1981     current_cpu->h_drc_set (FLD (f_dn), opval);
1982   }
1983
1984   current_cpu->done_insn (npc, status);
1985 #undef FLD
1986 }
1987
1988 // ********** fmov9-compact: mov.l $drm, @($imm12x8, $rn)
1989
1990 void
1991 sh5_compact_sem_fmov9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
1992         sh5_compact::write_stacks &buf)
1993 {
1994 #define FLD(f) abuf->fields.sfmt_fmov9_compact.f
1995   sem_status status = SEM_STATUS_NORMAL;
1996   sh5_compact_scache* abuf = sem;
1997   unsigned long long written = 0;
1998   PCADDR pc = abuf->addr;
1999   PCADDR npc = pc + 4;
2000
2001   {
2002     DF opval = current_cpu->h_drc_get (FLD (f_dm));
2003     if (UNLIKELY(current_cpu->trace_result_p))
2004       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x8)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2005     current_cpu->SETMEMDF (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x8)), opval);
2006   }
2007
2008   current_cpu->done_insn (npc, status);
2009 #undef FLD
2010 }
2011
2012 // ********** fmul-compact: fmul $fsdm, $fsdn
2013
2014 void
2015 sh5_compact_sem_fmul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2016         sh5_compact::write_stacks &buf)
2017 {
2018 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2019   sem_status status = SEM_STATUS_NORMAL;
2020   sh5_compact_scache* abuf = sem;
2021   unsigned long long written = 0;
2022   PCADDR pc = abuf->addr;
2023   PCADDR npc = pc + 2;
2024
2025 if (current_cpu->h_prbit_get ()) {
2026   {
2027     DF opval = current_cpu->sh64_fmuld (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
2028     written |= (1ULL << 3);
2029     if (UNLIKELY(current_cpu->trace_result_p))
2030       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2031     current_cpu->h_fsd_set (FLD (f_rn), opval);
2032   }
2033 } else {
2034   {
2035     DF opval = current_cpu->sh64_fmuls (current_cpu->h_fsd_get (FLD (f_rm)), current_cpu->h_fsd_get (FLD (f_rn)));
2036     written |= (1ULL << 3);
2037     if (UNLIKELY(current_cpu->trace_result_p))
2038       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2039     current_cpu->h_fsd_set (FLD (f_rn), opval);
2040   }
2041 }
2042
2043   abuf->written = written;
2044   current_cpu->done_insn (npc, status);
2045 #undef FLD
2046 }
2047
2048 // ********** fneg-compact: fneg $fsdn
2049
2050 void
2051 sh5_compact_sem_fneg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2052         sh5_compact::write_stacks &buf)
2053 {
2054 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2055   sem_status status = SEM_STATUS_NORMAL;
2056   sh5_compact_scache* abuf = sem;
2057   unsigned long long written = 0;
2058   PCADDR pc = abuf->addr;
2059   PCADDR npc = pc + 2;
2060
2061 if (current_cpu->h_prbit_get ()) {
2062   {
2063     DF opval = current_cpu->sh64_fnegd (current_cpu->h_fsd_get (FLD (f_rn)));
2064     written |= (1ULL << 2);
2065     if (UNLIKELY(current_cpu->trace_result_p))
2066       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2067     current_cpu->h_fsd_set (FLD (f_rn), opval);
2068   }
2069 } else {
2070   {
2071     DF opval = current_cpu->sh64_fnegs (current_cpu->h_fsd_get (FLD (f_rn)));
2072     written |= (1ULL << 2);
2073     if (UNLIKELY(current_cpu->trace_result_p))
2074       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2075     current_cpu->h_fsd_set (FLD (f_rn), opval);
2076   }
2077 }
2078
2079   abuf->written = written;
2080   current_cpu->done_insn (npc, status);
2081 #undef FLD
2082 }
2083
2084 // ********** frchg-compact: frchg
2085
2086 void
2087 sh5_compact_sem_frchg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2088         sh5_compact::write_stacks &buf)
2089 {
2090 #define FLD(f) abuf->fields.fmt_empty.f
2091   sem_status status = SEM_STATUS_NORMAL;
2092   sh5_compact_scache* abuf = sem;
2093   unsigned long long written = 0;
2094   PCADDR pc = abuf->addr;
2095   PCADDR npc = pc + 2;
2096
2097   {
2098     BI opval = NOTBI (current_cpu->h_frbit_get ());
2099     if (UNLIKELY(current_cpu->trace_result_p))
2100       current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << "  ";
2101     current_cpu->h_frbit_set (opval);
2102   }
2103
2104   current_cpu->done_insn (npc, status);
2105 #undef FLD
2106 }
2107
2108 // ********** fschg-compact: fschg
2109
2110 void
2111 sh5_compact_sem_fschg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2112         sh5_compact::write_stacks &buf)
2113 {
2114 #define FLD(f) abuf->fields.fmt_empty.f
2115   sem_status status = SEM_STATUS_NORMAL;
2116   sh5_compact_scache* abuf = sem;
2117   unsigned long long written = 0;
2118   PCADDR pc = abuf->addr;
2119   PCADDR npc = pc + 2;
2120
2121   {
2122     BI opval = NOTBI (current_cpu->h_szbit_get ());
2123     if (UNLIKELY(current_cpu->trace_result_p))
2124       current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << "  ";
2125     current_cpu->h_szbit_set (opval);
2126   }
2127
2128   current_cpu->done_insn (npc, status);
2129 #undef FLD
2130 }
2131
2132 // ********** fsqrt-compact: fsqrt $fsdn
2133
2134 void
2135 sh5_compact_sem_fsqrt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2136         sh5_compact::write_stacks &buf)
2137 {
2138 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2139   sem_status status = SEM_STATUS_NORMAL;
2140   sh5_compact_scache* abuf = sem;
2141   unsigned long long written = 0;
2142   PCADDR pc = abuf->addr;
2143   PCADDR npc = pc + 2;
2144
2145 if (current_cpu->h_prbit_get ()) {
2146   {
2147     DF opval = current_cpu->sh64_fsqrtd (current_cpu->h_fsd_get (FLD (f_rn)));
2148     written |= (1ULL << 2);
2149     if (UNLIKELY(current_cpu->trace_result_p))
2150       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2151     current_cpu->h_fsd_set (FLD (f_rn), opval);
2152   }
2153 } else {
2154   {
2155     DF opval = current_cpu->sh64_fsqrts (current_cpu->h_fsd_get (FLD (f_rn)));
2156     written |= (1ULL << 2);
2157     if (UNLIKELY(current_cpu->trace_result_p))
2158       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2159     current_cpu->h_fsd_set (FLD (f_rn), opval);
2160   }
2161 }
2162
2163   abuf->written = written;
2164   current_cpu->done_insn (npc, status);
2165 #undef FLD
2166 }
2167
2168 // ********** fsts-compact: fsts fpul, $frn
2169
2170 void
2171 sh5_compact_sem_fsts_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2172         sh5_compact::write_stacks &buf)
2173 {
2174 #define FLD(f) abuf->fields.sfmt_fsts_compact.f
2175   sem_status status = SEM_STATUS_NORMAL;
2176   sh5_compact_scache* abuf = sem;
2177   unsigned long long written = 0;
2178   PCADDR pc = abuf->addr;
2179   PCADDR npc = pc + 2;
2180
2181   {
2182     SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
2183     if (UNLIKELY(current_cpu->trace_result_p))
2184       current_cpu->trace_stream << "frc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2185     current_cpu->h_frc_set (FLD (f_rn), opval);
2186   }
2187
2188   current_cpu->done_insn (npc, status);
2189 #undef FLD
2190 }
2191
2192 // ********** fsub-compact: fsub $fsdm, $fsdn
2193
2194 void
2195 sh5_compact_sem_fsub_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2196         sh5_compact::write_stacks &buf)
2197 {
2198 #define FLD(f) abuf->fields.sfmt_fadd_compact.f
2199   sem_status status = SEM_STATUS_NORMAL;
2200   sh5_compact_scache* abuf = sem;
2201   unsigned long long written = 0;
2202   PCADDR pc = abuf->addr;
2203   PCADDR npc = pc + 2;
2204
2205 if (current_cpu->h_prbit_get ()) {
2206   {
2207     DF opval = current_cpu->sh64_fsubd (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2208     written |= (1ULL << 3);
2209     if (UNLIKELY(current_cpu->trace_result_p))
2210       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2211     current_cpu->h_fsd_set (FLD (f_rn), opval);
2212   }
2213 } else {
2214   {
2215     DF opval = current_cpu->sh64_fsubs (current_cpu->h_fsd_get (FLD (f_rn)), current_cpu->h_fsd_get (FLD (f_rm)));
2216     written |= (1ULL << 3);
2217     if (UNLIKELY(current_cpu->trace_result_p))
2218       current_cpu->trace_stream << "fsd" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2219     current_cpu->h_fsd_set (FLD (f_rn), opval);
2220   }
2221 }
2222
2223   abuf->written = written;
2224   current_cpu->done_insn (npc, status);
2225 #undef FLD
2226 }
2227
2228 // ********** ftrc-compact: ftrc $fsdn, fpul
2229
2230 void
2231 sh5_compact_sem_ftrc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2232         sh5_compact::write_stacks &buf)
2233 {
2234 #define FLD(f) abuf->fields.sfmt_ftrc_compact.f
2235   sem_status status = SEM_STATUS_NORMAL;
2236   sh5_compact_scache* abuf = sem;
2237   unsigned long long written = 0;
2238   PCADDR pc = abuf->addr;
2239   PCADDR npc = pc + 2;
2240
2241   {
2242     SF opval = ((current_cpu->h_prbit_get ()) ? (current_cpu->sh64_ftrcdl (current_cpu->h_fsd_get (FLD (f_rn)))) : (current_cpu->sh64_ftrcsl (current_cpu->h_fsd_get (FLD (f_rn)))));
2243     if (UNLIKELY(current_cpu->trace_result_p))
2244       current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << "  ";
2245     current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2246   }
2247
2248   current_cpu->done_insn (npc, status);
2249 #undef FLD
2250 }
2251
2252 // ********** ftrv-compact: ftrv xmtrx, $fvn
2253
2254 void
2255 sh5_compact_sem_ftrv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2256         sh5_compact::write_stacks &buf)
2257 {
2258 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
2259   sem_status status = SEM_STATUS_NORMAL;
2260   sh5_compact_scache* abuf = sem;
2261   unsigned long long written = 0;
2262   PCADDR pc = abuf->addr;
2263   PCADDR npc = pc + 2;
2264
2265 current_cpu->sh64_ftrv (FLD (f_vn));
2266
2267   current_cpu->done_insn (npc, status);
2268 #undef FLD
2269 }
2270
2271 // ********** jmp-compact: jmp @$rn
2272
2273 void
2274 sh5_compact_sem_jmp_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2275         sh5_compact::write_stacks &buf)
2276 {
2277 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2278   sem_status status = SEM_STATUS_NORMAL;
2279   sh5_compact_scache* abuf = sem;
2280   unsigned long long written = 0;
2281   PCADDR pc = abuf->addr;
2282   PCADDR npc = pc + 2;
2283
2284 {
2285   {
2286     UDI opval = ADDDI (pc, 2);
2287     if (UNLIKELY(current_cpu->trace_result_p))
2288       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
2289     current_cpu->branch (opval, npc, status);
2290   }
2291 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2292   {
2293     UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2294     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
2295     if (UNLIKELY(current_cpu->trace_result_p))
2296       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
2297   }
2298 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2299 }
2300
2301   current_cpu->done_cti_insn (npc, status);
2302 #undef FLD
2303 }
2304
2305 // ********** jsr-compact: jsr @$rn
2306
2307 void
2308 sh5_compact_sem_jsr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2309         sh5_compact::write_stacks &buf)
2310 {
2311 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2312   sem_status status = SEM_STATUS_NORMAL;
2313   sh5_compact_scache* abuf = sem;
2314   unsigned long long written = 0;
2315   PCADDR pc = abuf->addr;
2316   PCADDR npc = pc + 2;
2317
2318 {
2319   {
2320     SI opval = ADDDI (pc, 4);
2321     buf.h_pr_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<SI>(pc, opval));
2322     if (UNLIKELY(current_cpu->trace_result_p))
2323       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
2324   }
2325   {
2326     UDI opval = ADDDI (pc, 2);
2327     if (UNLIKELY(current_cpu->trace_result_p))
2328       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
2329     current_cpu->branch (opval, npc, status);
2330   }
2331 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
2332   {
2333     UDI opval = current_cpu->h_grc_get (FLD (f_rn));
2334     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
2335     if (UNLIKELY(current_cpu->trace_result_p))
2336       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
2337   }
2338 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
2339 }
2340
2341   current_cpu->done_cti_insn (npc, status);
2342 #undef FLD
2343 }
2344
2345 // ********** ldc-gbr-compact: ldc $rn, gbr
2346
2347 void
2348 sh5_compact_sem_ldc_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2349         sh5_compact::write_stacks &buf)
2350 {
2351 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2352   sem_status status = SEM_STATUS_NORMAL;
2353   sh5_compact_scache* abuf = sem;
2354   unsigned long long written = 0;
2355   PCADDR pc = abuf->addr;
2356   PCADDR npc = pc + 2;
2357
2358   {
2359     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2360     if (UNLIKELY(current_cpu->trace_result_p))
2361       current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << "  ";
2362     current_cpu->h_gbr_set (opval);
2363   }
2364
2365   current_cpu->done_insn (npc, status);
2366 #undef FLD
2367 }
2368
2369 // ********** ldc-vbr-compact: ldc $rn, vbr
2370
2371 void
2372 sh5_compact_sem_ldc_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2373         sh5_compact::write_stacks &buf)
2374 {
2375 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2376   sem_status status = SEM_STATUS_NORMAL;
2377   sh5_compact_scache* abuf = sem;
2378   unsigned long long written = 0;
2379   PCADDR pc = abuf->addr;
2380   PCADDR npc = pc + 2;
2381
2382   {
2383     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2384     if (UNLIKELY(current_cpu->trace_result_p))
2385       current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << "  ";
2386     current_cpu->h_vbr_set (opval);
2387   }
2388
2389   current_cpu->done_insn (npc, status);
2390 #undef FLD
2391 }
2392
2393 // ********** ldc-sr-compact: ldc $rn, sr
2394
2395 void
2396 sh5_compact_sem_ldc_sr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2397         sh5_compact::write_stacks &buf)
2398 {
2399 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2400   sem_status status = SEM_STATUS_NORMAL;
2401   sh5_compact_scache* abuf = sem;
2402   unsigned long long written = 0;
2403   PCADDR pc = abuf->addr;
2404   PCADDR npc = pc + 2;
2405
2406   {
2407     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2408     if (UNLIKELY(current_cpu->trace_result_p))
2409       current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << "  ";
2410     current_cpu->hardware.h_sr = opval;
2411   }
2412
2413   current_cpu->done_insn (npc, status);
2414 #undef FLD
2415 }
2416
2417 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
2418
2419 void
2420 sh5_compact_sem_ldcl_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2421         sh5_compact::write_stacks &buf)
2422 {
2423 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2424   sem_status status = SEM_STATUS_NORMAL;
2425   sh5_compact_scache* abuf = sem;
2426   unsigned long long written = 0;
2427   PCADDR pc = abuf->addr;
2428   PCADDR npc = pc + 2;
2429
2430 {
2431   {
2432     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2433     if (UNLIKELY(current_cpu->trace_result_p))
2434       current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << "  ";
2435     current_cpu->h_gbr_set (opval);
2436   }
2437   {
2438     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2439     if (UNLIKELY(current_cpu->trace_result_p))
2440       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2441     current_cpu->h_grc_set (FLD (f_rn), opval);
2442   }
2443 }
2444
2445   current_cpu->done_insn (npc, status);
2446 #undef FLD
2447 }
2448
2449 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
2450
2451 void
2452 sh5_compact_sem_ldcl_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2453         sh5_compact::write_stacks &buf)
2454 {
2455 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2456   sem_status status = SEM_STATUS_NORMAL;
2457   sh5_compact_scache* abuf = sem;
2458   unsigned long long written = 0;
2459   PCADDR pc = abuf->addr;
2460   PCADDR npc = pc + 2;
2461
2462 {
2463   {
2464     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2465     if (UNLIKELY(current_cpu->trace_result_p))
2466       current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << "  ";
2467     current_cpu->h_vbr_set (opval);
2468   }
2469   {
2470     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2471     if (UNLIKELY(current_cpu->trace_result_p))
2472       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2473     current_cpu->h_grc_set (FLD (f_rn), opval);
2474   }
2475 }
2476
2477   current_cpu->done_insn (npc, status);
2478 #undef FLD
2479 }
2480
2481 // ********** lds-fpscr-compact: lds $rn, fpscr
2482
2483 void
2484 sh5_compact_sem_lds_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2485         sh5_compact::write_stacks &buf)
2486 {
2487 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2488   sem_status status = SEM_STATUS_NORMAL;
2489   sh5_compact_scache* abuf = sem;
2490   unsigned long long written = 0;
2491   PCADDR pc = abuf->addr;
2492   PCADDR npc = pc + 2;
2493
2494   {
2495     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2496     if (UNLIKELY(current_cpu->trace_result_p))
2497       current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << "  ";
2498     current_cpu->hardware.h_fpscr = opval;
2499   }
2500
2501   current_cpu->done_insn (npc, status);
2502 #undef FLD
2503 }
2504
2505 // ********** ldsl-fpscr-compact: lds.l @${rn}+, fpscr
2506
2507 void
2508 sh5_compact_sem_ldsl_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2509         sh5_compact::write_stacks &buf)
2510 {
2511 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2512   sem_status status = SEM_STATUS_NORMAL;
2513   sh5_compact_scache* abuf = sem;
2514   unsigned long long written = 0;
2515   PCADDR pc = abuf->addr;
2516   PCADDR npc = pc + 2;
2517
2518 {
2519   {
2520     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2521     if (UNLIKELY(current_cpu->trace_result_p))
2522       current_cpu->trace_stream << "fpscr" << ":=0x" << hex << opval << dec << "  ";
2523     current_cpu->hardware.h_fpscr = opval;
2524   }
2525   {
2526     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2527     if (UNLIKELY(current_cpu->trace_result_p))
2528       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2529     current_cpu->h_grc_set (FLD (f_rn), opval);
2530   }
2531 }
2532
2533   current_cpu->done_insn (npc, status);
2534 #undef FLD
2535 }
2536
2537 // ********** lds-fpul-compact: lds $rn, fpul
2538
2539 void
2540 sh5_compact_sem_lds_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2541         sh5_compact::write_stacks &buf)
2542 {
2543 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2544   sem_status status = SEM_STATUS_NORMAL;
2545   sh5_compact_scache* abuf = sem;
2546   unsigned long long written = 0;
2547   PCADDR pc = abuf->addr;
2548   PCADDR npc = pc + 2;
2549
2550   {
2551     SF opval = SUBWORDSISF (current_cpu->h_grc_get (FLD (f_rn)));
2552     if (UNLIKELY(current_cpu->trace_result_p))
2553       current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << "  ";
2554     current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2555   }
2556
2557   current_cpu->done_insn (npc, status);
2558 #undef FLD
2559 }
2560
2561 // ********** ldsl-fpul-compact: lds.l @${rn}+, fpul
2562
2563 void
2564 sh5_compact_sem_ldsl_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2565         sh5_compact::write_stacks &buf)
2566 {
2567 #define FLD(f) abuf->fields.sfmt_ldsl_fpul_compact.f
2568   sem_status status = SEM_STATUS_NORMAL;
2569   sh5_compact_scache* abuf = sem;
2570   unsigned long long written = 0;
2571   PCADDR pc = abuf->addr;
2572   PCADDR npc = pc + 2;
2573
2574 {
2575   {
2576     SF opval = current_cpu->GETMEMSF (pc, current_cpu->h_grc_get (FLD (f_rn)));
2577     if (UNLIKELY(current_cpu->trace_result_p))
2578       current_cpu->trace_stream << "fr" << '[' << ((UINT) 32) << ']' << ":=0x" << hex << opval << dec << "  ";
2579     current_cpu->hardware.h_fr[((UINT) 32)] = opval;
2580   }
2581   {
2582     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2583     if (UNLIKELY(current_cpu->trace_result_p))
2584       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2585     current_cpu->h_grc_set (FLD (f_rn), opval);
2586   }
2587 }
2588
2589   current_cpu->done_insn (npc, status);
2590 #undef FLD
2591 }
2592
2593 // ********** lds-mach-compact: lds $rn, mach
2594
2595 void
2596 sh5_compact_sem_lds_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2597         sh5_compact::write_stacks &buf)
2598 {
2599 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2600   sem_status status = SEM_STATUS_NORMAL;
2601   sh5_compact_scache* abuf = sem;
2602   unsigned long long written = 0;
2603   PCADDR pc = abuf->addr;
2604   PCADDR npc = pc + 2;
2605
2606   {
2607     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2608     if (UNLIKELY(current_cpu->trace_result_p))
2609       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
2610     current_cpu->h_mach_set (opval);
2611   }
2612
2613   current_cpu->done_insn (npc, status);
2614 #undef FLD
2615 }
2616
2617 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
2618
2619 void
2620 sh5_compact_sem_ldsl_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2621         sh5_compact::write_stacks &buf)
2622 {
2623 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2624   sem_status status = SEM_STATUS_NORMAL;
2625   sh5_compact_scache* abuf = sem;
2626   unsigned long long written = 0;
2627   PCADDR pc = abuf->addr;
2628   PCADDR npc = pc + 2;
2629
2630 {
2631   {
2632     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2633     if (UNLIKELY(current_cpu->trace_result_p))
2634       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
2635     current_cpu->h_mach_set (opval);
2636   }
2637   {
2638     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2639     if (UNLIKELY(current_cpu->trace_result_p))
2640       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2641     current_cpu->h_grc_set (FLD (f_rn), opval);
2642   }
2643 }
2644
2645   current_cpu->done_insn (npc, status);
2646 #undef FLD
2647 }
2648
2649 // ********** lds-macl-compact: lds $rn, macl
2650
2651 void
2652 sh5_compact_sem_lds_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2653         sh5_compact::write_stacks &buf)
2654 {
2655 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2656   sem_status status = SEM_STATUS_NORMAL;
2657   sh5_compact_scache* abuf = sem;
2658   unsigned long long written = 0;
2659   PCADDR pc = abuf->addr;
2660   PCADDR npc = pc + 2;
2661
2662   {
2663     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2664     if (UNLIKELY(current_cpu->trace_result_p))
2665       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2666     current_cpu->h_macl_set (opval);
2667   }
2668
2669   current_cpu->done_insn (npc, status);
2670 #undef FLD
2671 }
2672
2673 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
2674
2675 void
2676 sh5_compact_sem_ldsl_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2677         sh5_compact::write_stacks &buf)
2678 {
2679 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2680   sem_status status = SEM_STATUS_NORMAL;
2681   sh5_compact_scache* abuf = sem;
2682   unsigned long long written = 0;
2683   PCADDR pc = abuf->addr;
2684   PCADDR npc = pc + 2;
2685
2686 {
2687   {
2688     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2689     if (UNLIKELY(current_cpu->trace_result_p))
2690       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2691     current_cpu->h_macl_set (opval);
2692   }
2693   {
2694     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2695     if (UNLIKELY(current_cpu->trace_result_p))
2696       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2697     current_cpu->h_grc_set (FLD (f_rn), opval);
2698   }
2699 }
2700
2701   current_cpu->done_insn (npc, status);
2702 #undef FLD
2703 }
2704
2705 // ********** lds-pr-compact: lds $rn, pr
2706
2707 void
2708 sh5_compact_sem_lds_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2709         sh5_compact::write_stacks &buf)
2710 {
2711 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2712   sem_status status = SEM_STATUS_NORMAL;
2713   sh5_compact_scache* abuf = sem;
2714   unsigned long long written = 0;
2715   PCADDR pc = abuf->addr;
2716   PCADDR npc = pc + 2;
2717
2718   {
2719     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2720     if (UNLIKELY(current_cpu->trace_result_p))
2721       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
2722     current_cpu->h_pr_set (opval);
2723   }
2724
2725   current_cpu->done_insn (npc, status);
2726 #undef FLD
2727 }
2728
2729 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
2730
2731 void
2732 sh5_compact_sem_ldsl_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2733         sh5_compact::write_stacks &buf)
2734 {
2735 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
2736   sem_status status = SEM_STATUS_NORMAL;
2737   sh5_compact_scache* abuf = sem;
2738   unsigned long long written = 0;
2739   PCADDR pc = abuf->addr;
2740   PCADDR npc = pc + 2;
2741
2742 {
2743   {
2744     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2745     if (UNLIKELY(current_cpu->trace_result_p))
2746       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
2747     current_cpu->h_pr_set (opval);
2748   }
2749   {
2750     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2751     if (UNLIKELY(current_cpu->trace_result_p))
2752       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2753     current_cpu->h_grc_set (FLD (f_rn), opval);
2754   }
2755 }
2756
2757   current_cpu->done_insn (npc, status);
2758 #undef FLD
2759 }
2760
2761 // ********** macl-compact: mac.l @${rm}+, @${rn}+
2762
2763 void
2764 sh5_compact_sem_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2765         sh5_compact::write_stacks &buf)
2766 {
2767 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2768   sem_status status = SEM_STATUS_NORMAL;
2769   sh5_compact_scache* abuf = sem;
2770   unsigned long long written = 0;
2771   PCADDR pc = abuf->addr;
2772   PCADDR npc = pc + 2;
2773
2774 {
2775   DI tmp_tmpry;
2776   DI tmp_mac;
2777   DI tmp_result;
2778   SI tmp_x;
2779   SI tmp_y;
2780   tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2781   {
2782     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2783     if (UNLIKELY(current_cpu->trace_result_p))
2784       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2785     current_cpu->h_grc_set (FLD (f_rn), opval);
2786   }
2787 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2788 {
2789   {
2790     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2791     if (UNLIKELY(current_cpu->trace_result_p))
2792       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2793     current_cpu->h_grc_set (FLD (f_rn), opval);
2794   }
2795   {
2796     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2797     written |= (1ULL << 11);
2798     if (UNLIKELY(current_cpu->trace_result_p))
2799       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2800     current_cpu->h_grc_set (FLD (f_rm), opval);
2801   }
2802 }
2803 }
2804   tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2805   {
2806     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2807     written |= (1ULL << 11);
2808     if (UNLIKELY(current_cpu->trace_result_p))
2809       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2810     current_cpu->h_grc_set (FLD (f_rm), opval);
2811   }
2812   tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2813   tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2814   tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2815 {
2816 if (current_cpu->h_sbit_get ()) {
2817 {
2818   SI tmp_min;
2819   SI tmp_max;
2820   tmp_max = SRLDI (INVDI (0), 16);
2821   tmp_min = SRLDI (INVDI (0), 15);
2822 if (GTDI (tmp_result, tmp_max)) {
2823   tmp_result = tmp_max;
2824 } else {
2825 if (LTDI (tmp_result, tmp_min)) {
2826   tmp_result = tmp_min;
2827 }
2828 }
2829 }
2830 }
2831   {
2832     SI opval = SUBWORDDISI (tmp_result, 0);
2833     if (UNLIKELY(current_cpu->trace_result_p))
2834       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
2835     current_cpu->h_mach_set (opval);
2836   }
2837   {
2838     SI opval = SUBWORDDISI (tmp_result, 1);
2839     if (UNLIKELY(current_cpu->trace_result_p))
2840       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2841     current_cpu->h_macl_set (opval);
2842   }
2843 }
2844 }
2845
2846   abuf->written = written;
2847   current_cpu->done_insn (npc, status);
2848 #undef FLD
2849 }
2850
2851 // ********** macw-compact: mac.w @${rm}+, @${rn}+
2852
2853 void
2854 sh5_compact_sem_macw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2855         sh5_compact::write_stacks &buf)
2856 {
2857 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2858   sem_status status = SEM_STATUS_NORMAL;
2859   sh5_compact_scache* abuf = sem;
2860   unsigned long long written = 0;
2861   PCADDR pc = abuf->addr;
2862   PCADDR npc = pc + 2;
2863
2864 {
2865   SI tmp_tmpry;
2866   DI tmp_mac;
2867   DI tmp_result;
2868   HI tmp_x;
2869   HI tmp_y;
2870   tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
2871   {
2872     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2873     if (UNLIKELY(current_cpu->trace_result_p))
2874       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2875     current_cpu->h_grc_set (FLD (f_rn), opval);
2876   }
2877 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2878 {
2879   {
2880     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2881     if (UNLIKELY(current_cpu->trace_result_p))
2882       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2883     current_cpu->h_grc_set (FLD (f_rn), opval);
2884   }
2885   {
2886     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2887     written |= (1ULL << 11);
2888     if (UNLIKELY(current_cpu->trace_result_p))
2889       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2890     current_cpu->h_grc_set (FLD (f_rm), opval);
2891   }
2892 }
2893 }
2894   tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2895   {
2896     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2897     written |= (1ULL << 11);
2898     if (UNLIKELY(current_cpu->trace_result_p))
2899       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2900     current_cpu->h_grc_set (FLD (f_rm), opval);
2901   }
2902   tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2903 if (current_cpu->h_sbit_get ()) {
2904 {
2905 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
2906   {
2907     SI opval = 1;
2908     written |= (1ULL << 9);
2909     if (UNLIKELY(current_cpu->trace_result_p))
2910       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
2911     current_cpu->h_mach_set (opval);
2912   }
2913 }
2914   {
2915     SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
2916     written |= (1ULL << 10);
2917     if (UNLIKELY(current_cpu->trace_result_p))
2918       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2919     current_cpu->h_macl_set (opval);
2920   }
2921 }
2922 } else {
2923 {
2924   tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
2925   tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2926   {
2927     SI opval = SUBWORDDISI (tmp_result, 0);
2928     written |= (1ULL << 9);
2929     if (UNLIKELY(current_cpu->trace_result_p))
2930       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
2931     current_cpu->h_mach_set (opval);
2932   }
2933   {
2934     SI opval = SUBWORDDISI (tmp_result, 1);
2935     written |= (1ULL << 10);
2936     if (UNLIKELY(current_cpu->trace_result_p))
2937       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2938     current_cpu->h_macl_set (opval);
2939   }
2940 }
2941 }
2942 }
2943
2944   abuf->written = written;
2945   current_cpu->done_insn (npc, status);
2946 #undef FLD
2947 }
2948
2949 // ********** mov-compact: mov $rm64, $rn64
2950
2951 void
2952 sh5_compact_sem_mov_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2953         sh5_compact::write_stacks &buf)
2954 {
2955 #define FLD(f) abuf->fields.sfmt_and_compact.f
2956   sem_status status = SEM_STATUS_NORMAL;
2957   sh5_compact_scache* abuf = sem;
2958   unsigned long long written = 0;
2959   PCADDR pc = abuf->addr;
2960   PCADDR npc = pc + 2;
2961
2962   {
2963     DI opval = current_cpu->h_gr_get (FLD (f_rm));
2964     if (UNLIKELY(current_cpu->trace_result_p))
2965       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2966     current_cpu->h_gr_set (FLD (f_rn), opval);
2967   }
2968
2969   current_cpu->done_insn (npc, status);
2970 #undef FLD
2971 }
2972
2973 // ********** movi-compact: mov #$imm8, $rn
2974
2975 void
2976 sh5_compact_sem_movi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
2977         sh5_compact::write_stacks &buf)
2978 {
2979 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2980   sem_status status = SEM_STATUS_NORMAL;
2981   sh5_compact_scache* abuf = sem;
2982   unsigned long long written = 0;
2983   PCADDR pc = abuf->addr;
2984   PCADDR npc = pc + 2;
2985
2986   {
2987     SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2988     if (UNLIKELY(current_cpu->trace_result_p))
2989       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2990     current_cpu->h_grc_set (FLD (f_rn), opval);
2991   }
2992
2993   current_cpu->done_insn (npc, status);
2994 #undef FLD
2995 }
2996
2997 // ********** movi20-compact: movi20 #$imm20, $rn
2998
2999 void
3000 sh5_compact_sem_movi20_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3001         sh5_compact::write_stacks &buf)
3002 {
3003 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
3004   sem_status status = SEM_STATUS_NORMAL;
3005   sh5_compact_scache* abuf = sem;
3006   unsigned long long written = 0;
3007   PCADDR pc = abuf->addr;
3008   PCADDR npc = pc + 4;
3009
3010   {
3011     SI opval = FLD (f_imm20);
3012     if (UNLIKELY(current_cpu->trace_result_p))
3013       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3014     current_cpu->h_grc_set (FLD (f_rn), opval);
3015   }
3016
3017   current_cpu->done_insn (npc, status);
3018 #undef FLD
3019 }
3020
3021 // ********** movb1-compact: mov.b $rm, @$rn
3022
3023 void
3024 sh5_compact_sem_movb1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3025         sh5_compact::write_stacks &buf)
3026 {
3027 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3028   sem_status status = SEM_STATUS_NORMAL;
3029   sh5_compact_scache* abuf = sem;
3030   unsigned long long written = 0;
3031   PCADDR pc = abuf->addr;
3032   PCADDR npc = pc + 2;
3033
3034   {
3035     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3036     if (UNLIKELY(current_cpu->trace_result_p))
3037       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
3038     current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3039   }
3040
3041   current_cpu->done_insn (npc, status);
3042 #undef FLD
3043 }
3044
3045 // ********** movb2-compact: mov.b $rm, @-$rn
3046
3047 void
3048 sh5_compact_sem_movb2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3049         sh5_compact::write_stacks &buf)
3050 {
3051 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3052   sem_status status = SEM_STATUS_NORMAL;
3053   sh5_compact_scache* abuf = sem;
3054   unsigned long long written = 0;
3055   PCADDR pc = abuf->addr;
3056   PCADDR npc = pc + 2;
3057
3058 {
3059   DI tmp_addr;
3060   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3061   {
3062     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3063     if (UNLIKELY(current_cpu->trace_result_p))
3064       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
3065     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3066   }
3067   {
3068     SI opval = tmp_addr;
3069     if (UNLIKELY(current_cpu->trace_result_p))
3070       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3071     current_cpu->h_grc_set (FLD (f_rn), opval);
3072   }
3073 }
3074
3075   current_cpu->done_insn (npc, status);
3076 #undef FLD
3077 }
3078
3079 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
3080
3081 void
3082 sh5_compact_sem_movb3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3083         sh5_compact::write_stacks &buf)
3084 {
3085 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3086   sem_status status = SEM_STATUS_NORMAL;
3087   sh5_compact_scache* abuf = sem;
3088   unsigned long long written = 0;
3089   PCADDR pc = abuf->addr;
3090   PCADDR npc = pc + 2;
3091
3092   {
3093     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
3094     if (UNLIKELY(current_cpu->trace_result_p))
3095       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
3096     current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3097   }
3098
3099   current_cpu->done_insn (npc, status);
3100 #undef FLD
3101 }
3102
3103 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
3104
3105 void
3106 sh5_compact_sem_movb4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3107         sh5_compact::write_stacks &buf)
3108 {
3109 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3110   sem_status status = SEM_STATUS_NORMAL;
3111   sh5_compact_scache* abuf = sem;
3112   unsigned long long written = 0;
3113   PCADDR pc = abuf->addr;
3114   PCADDR npc = pc + 2;
3115
3116 {
3117   DI tmp_addr;
3118   tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
3119   {
3120     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
3121     if (UNLIKELY(current_cpu->trace_result_p))
3122       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
3123     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3124   }
3125 }
3126
3127   current_cpu->done_insn (npc, status);
3128 #undef FLD
3129 }
3130
3131 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
3132
3133 void
3134 sh5_compact_sem_movb5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3135         sh5_compact::write_stacks &buf)
3136 {
3137 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
3138   sem_status status = SEM_STATUS_NORMAL;
3139   sh5_compact_scache* abuf = sem;
3140   unsigned long long written = 0;
3141   PCADDR pc = abuf->addr;
3142   PCADDR npc = pc + 2;
3143
3144 {
3145   DI tmp_addr;
3146   tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
3147   {
3148     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
3149     if (UNLIKELY(current_cpu->trace_result_p))
3150       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
3151     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3152   }
3153 }
3154
3155   current_cpu->done_insn (npc, status);
3156 #undef FLD
3157 }
3158
3159 // ********** movb6-compact: mov.b @$rm, $rn
3160
3161 void
3162 sh5_compact_sem_movb6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3163         sh5_compact::write_stacks &buf)
3164 {
3165 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3166   sem_status status = SEM_STATUS_NORMAL;
3167   sh5_compact_scache* abuf = sem;
3168   unsigned long long written = 0;
3169   PCADDR pc = abuf->addr;
3170   PCADDR npc = pc + 2;
3171
3172   {
3173     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3174     if (UNLIKELY(current_cpu->trace_result_p))
3175       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3176     current_cpu->h_grc_set (FLD (f_rn), opval);
3177   }
3178
3179   current_cpu->done_insn (npc, status);
3180 #undef FLD
3181 }
3182
3183 // ********** movb7-compact: mov.b @${rm}+, $rn
3184
3185 void
3186 sh5_compact_sem_movb7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3187         sh5_compact::write_stacks &buf)
3188 {
3189 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3190   sem_status status = SEM_STATUS_NORMAL;
3191   sh5_compact_scache* abuf = sem;
3192   unsigned long long written = 0;
3193   PCADDR pc = abuf->addr;
3194   PCADDR npc = pc + 2;
3195
3196 {
3197   QI tmp_data;
3198   tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3199 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3200   {
3201     SI opval = EXTQISI (tmp_data);
3202     written |= (1ULL << 4);
3203     if (UNLIKELY(current_cpu->trace_result_p))
3204       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
3205     current_cpu->h_grc_set (FLD (f_rm), opval);
3206   }
3207 } else {
3208   {
3209     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3210     written |= (1ULL << 4);
3211     if (UNLIKELY(current_cpu->trace_result_p))
3212       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
3213     current_cpu->h_grc_set (FLD (f_rm), opval);
3214   }
3215 }
3216   {
3217     SI opval = EXTQISI (tmp_data);
3218     if (UNLIKELY(current_cpu->trace_result_p))
3219       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3220     current_cpu->h_grc_set (FLD (f_rn), opval);
3221   }
3222 }
3223
3224   abuf->written = written;
3225   current_cpu->done_insn (npc, status);
3226 #undef FLD
3227 }
3228
3229 // ********** movb8-compact: mov.b @(r0, $rm), $rn
3230
3231 void
3232 sh5_compact_sem_movb8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3233         sh5_compact::write_stacks &buf)
3234 {
3235 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3236   sem_status status = SEM_STATUS_NORMAL;
3237   sh5_compact_scache* abuf = sem;
3238   unsigned long long written = 0;
3239   PCADDR pc = abuf->addr;
3240   PCADDR npc = pc + 2;
3241
3242   {
3243     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3244     if (UNLIKELY(current_cpu->trace_result_p))
3245       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3246     current_cpu->h_grc_set (FLD (f_rn), opval);
3247   }
3248
3249   current_cpu->done_insn (npc, status);
3250 #undef FLD
3251 }
3252
3253 // ********** movb9-compact: mov.b @($imm8, gbr), r0
3254
3255 void
3256 sh5_compact_sem_movb9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3257         sh5_compact::write_stacks &buf)
3258 {
3259 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3260   sem_status status = SEM_STATUS_NORMAL;
3261   sh5_compact_scache* abuf = sem;
3262   unsigned long long written = 0;
3263   PCADDR pc = abuf->addr;
3264   PCADDR npc = pc + 2;
3265
3266   {
3267     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
3268     if (UNLIKELY(current_cpu->trace_result_p))
3269       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3270     current_cpu->h_grc_set (((UINT) 0), opval);
3271   }
3272
3273   current_cpu->done_insn (npc, status);
3274 #undef FLD
3275 }
3276
3277 // ********** movb10-compact: mov.b @($imm4, $rm), r0
3278
3279 void
3280 sh5_compact_sem_movb10_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3281         sh5_compact::write_stacks &buf)
3282 {
3283 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
3284   sem_status status = SEM_STATUS_NORMAL;
3285   sh5_compact_scache* abuf = sem;
3286   unsigned long long written = 0;
3287   PCADDR pc = abuf->addr;
3288   PCADDR npc = pc + 2;
3289
3290   {
3291     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
3292     if (UNLIKELY(current_cpu->trace_result_p))
3293       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3294     current_cpu->h_grc_set (((UINT) 0), opval);
3295   }
3296
3297   current_cpu->done_insn (npc, status);
3298 #undef FLD
3299 }
3300
3301 // ********** movl1-compact: mov.l $rm, @$rn
3302
3303 void
3304 sh5_compact_sem_movl1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3305         sh5_compact::write_stacks &buf)
3306 {
3307 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3308   sem_status status = SEM_STATUS_NORMAL;
3309   sh5_compact_scache* abuf = sem;
3310   unsigned long long written = 0;
3311   PCADDR pc = abuf->addr;
3312   PCADDR npc = pc + 2;
3313
3314   {
3315     SI opval = current_cpu->h_grc_get (FLD (f_rm));
3316     if (UNLIKELY(current_cpu->trace_result_p))
3317       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3318     current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3319   }
3320
3321   current_cpu->done_insn (npc, status);
3322 #undef FLD
3323 }
3324
3325 // ********** movl2-compact: mov.l $rm, @-$rn
3326
3327 void
3328 sh5_compact_sem_movl2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3329         sh5_compact::write_stacks &buf)
3330 {
3331 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3332   sem_status status = SEM_STATUS_NORMAL;
3333   sh5_compact_scache* abuf = sem;
3334   unsigned long long written = 0;
3335   PCADDR pc = abuf->addr;
3336   PCADDR npc = pc + 2;
3337
3338 {
3339   SI tmp_addr;
3340   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3341   {
3342     SI opval = current_cpu->h_grc_get (FLD (f_rm));
3343     if (UNLIKELY(current_cpu->trace_result_p))
3344       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3345     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3346   }
3347   {
3348     SI opval = tmp_addr;
3349     if (UNLIKELY(current_cpu->trace_result_p))
3350       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3351     current_cpu->h_grc_set (FLD (f_rn), opval);
3352   }
3353 }
3354
3355   current_cpu->done_insn (npc, status);
3356 #undef FLD
3357 }
3358
3359 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
3360
3361 void
3362 sh5_compact_sem_movl3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3363         sh5_compact::write_stacks &buf)
3364 {
3365 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3366   sem_status status = SEM_STATUS_NORMAL;
3367   sh5_compact_scache* abuf = sem;
3368   unsigned long long written = 0;
3369   PCADDR pc = abuf->addr;
3370   PCADDR npc = pc + 2;
3371
3372   {
3373     SI opval = current_cpu->h_grc_get (FLD (f_rm));
3374     if (UNLIKELY(current_cpu->trace_result_p))
3375       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3376     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3377   }
3378
3379   current_cpu->done_insn (npc, status);
3380 #undef FLD
3381 }
3382
3383 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
3384
3385 void
3386 sh5_compact_sem_movl4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3387         sh5_compact::write_stacks &buf)
3388 {
3389 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
3390   sem_status status = SEM_STATUS_NORMAL;
3391   sh5_compact_scache* abuf = sem;
3392   unsigned long long written = 0;
3393   PCADDR pc = abuf->addr;
3394   PCADDR npc = pc + 2;
3395
3396   {
3397     SI opval = current_cpu->h_grc_get (((UINT) 0));
3398     if (UNLIKELY(current_cpu->trace_result_p))
3399       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3400     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
3401   }
3402
3403   current_cpu->done_insn (npc, status);
3404 #undef FLD
3405 }
3406
3407 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
3408
3409 void
3410 sh5_compact_sem_movl5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3411         sh5_compact::write_stacks &buf)
3412 {
3413 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3414   sem_status status = SEM_STATUS_NORMAL;
3415   sh5_compact_scache* abuf = sem;
3416   unsigned long long written = 0;
3417   PCADDR pc = abuf->addr;
3418   PCADDR npc = pc + 2;
3419
3420   {
3421     SI opval = current_cpu->h_grc_get (FLD (f_rm));
3422     if (UNLIKELY(current_cpu->trace_result_p))
3423       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3424     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
3425   }
3426
3427   current_cpu->done_insn (npc, status);
3428 #undef FLD
3429 }
3430
3431 // ********** movl6-compact: mov.l @$rm, $rn
3432
3433 void
3434 sh5_compact_sem_movl6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3435         sh5_compact::write_stacks &buf)
3436 {
3437 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3438   sem_status status = SEM_STATUS_NORMAL;
3439   sh5_compact_scache* abuf = sem;
3440   unsigned long long written = 0;
3441   PCADDR pc = abuf->addr;
3442   PCADDR npc = pc + 2;
3443
3444   {
3445     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3446     if (UNLIKELY(current_cpu->trace_result_p))
3447       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3448     current_cpu->h_grc_set (FLD (f_rn), opval);
3449   }
3450
3451   current_cpu->done_insn (npc, status);
3452 #undef FLD
3453 }
3454
3455 // ********** movl7-compact: mov.l @${rm}+, $rn
3456
3457 void
3458 sh5_compact_sem_movl7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3459         sh5_compact::write_stacks &buf)
3460 {
3461 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3462   sem_status status = SEM_STATUS_NORMAL;
3463   sh5_compact_scache* abuf = sem;
3464   unsigned long long written = 0;
3465   PCADDR pc = abuf->addr;
3466   PCADDR npc = pc + 2;
3467
3468 {
3469   {
3470     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3471     if (UNLIKELY(current_cpu->trace_result_p))
3472       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3473     current_cpu->h_grc_set (FLD (f_rn), opval);
3474   }
3475 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3476   {
3477     SI opval = current_cpu->h_grc_get (FLD (f_rn));
3478     written |= (1ULL << 5);
3479     if (UNLIKELY(current_cpu->trace_result_p))
3480       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
3481     current_cpu->h_grc_set (FLD (f_rm), opval);
3482   }
3483 } else {
3484   {
3485     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
3486     written |= (1ULL << 5);
3487     if (UNLIKELY(current_cpu->trace_result_p))
3488       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
3489     current_cpu->h_grc_set (FLD (f_rm), opval);
3490   }
3491 }
3492 }
3493
3494   abuf->written = written;
3495   current_cpu->done_insn (npc, status);
3496 #undef FLD
3497 }
3498
3499 // ********** movl8-compact: mov.l @(r0, $rm), $rn
3500
3501 void
3502 sh5_compact_sem_movl8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3503         sh5_compact::write_stacks &buf)
3504 {
3505 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3506   sem_status status = SEM_STATUS_NORMAL;
3507   sh5_compact_scache* abuf = sem;
3508   unsigned long long written = 0;
3509   PCADDR pc = abuf->addr;
3510   PCADDR npc = pc + 2;
3511
3512   {
3513     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
3514     if (UNLIKELY(current_cpu->trace_result_p))
3515       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3516     current_cpu->h_grc_set (FLD (f_rn), opval);
3517   }
3518
3519   current_cpu->done_insn (npc, status);
3520 #undef FLD
3521 }
3522
3523 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
3524
3525 void
3526 sh5_compact_sem_movl9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3527         sh5_compact::write_stacks &buf)
3528 {
3529 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3530   sem_status status = SEM_STATUS_NORMAL;
3531   sh5_compact_scache* abuf = sem;
3532   unsigned long long written = 0;
3533   PCADDR pc = abuf->addr;
3534   PCADDR npc = pc + 2;
3535
3536   {
3537     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
3538     if (UNLIKELY(current_cpu->trace_result_p))
3539       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3540     current_cpu->h_grc_set (((UINT) 0), opval);
3541   }
3542
3543   current_cpu->done_insn (npc, status);
3544 #undef FLD
3545 }
3546
3547 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
3548
3549 void
3550 sh5_compact_sem_movl10_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3551         sh5_compact::write_stacks &buf)
3552 {
3553 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3554   sem_status status = SEM_STATUS_NORMAL;
3555   sh5_compact_scache* abuf = sem;
3556   unsigned long long written = 0;
3557   PCADDR pc = abuf->addr;
3558   PCADDR npc = pc + 2;
3559
3560   {
3561     SI opval = current_cpu->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3562     if (UNLIKELY(current_cpu->trace_result_p))
3563       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3564     current_cpu->h_grc_set (FLD (f_rn), opval);
3565   }
3566
3567   current_cpu->done_insn (npc, status);
3568 #undef FLD
3569 }
3570
3571 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
3572
3573 void
3574 sh5_compact_sem_movl11_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3575         sh5_compact::write_stacks &buf)
3576 {
3577 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3578   sem_status status = SEM_STATUS_NORMAL;
3579   sh5_compact_scache* abuf = sem;
3580   unsigned long long written = 0;
3581   PCADDR pc = abuf->addr;
3582   PCADDR npc = pc + 2;
3583
3584   {
3585     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
3586     if (UNLIKELY(current_cpu->trace_result_p))
3587       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3588     current_cpu->h_grc_set (FLD (f_rn), opval);
3589   }
3590
3591   current_cpu->done_insn (npc, status);
3592 #undef FLD
3593 }
3594
3595 // ********** movl12-compact: mov.l @($imm12x4, $rm), $rn
3596
3597 void
3598 sh5_compact_sem_movl12_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3599         sh5_compact::write_stacks &buf)
3600 {
3601 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3602   sem_status status = SEM_STATUS_NORMAL;
3603   sh5_compact_scache* abuf = sem;
3604   unsigned long long written = 0;
3605   PCADDR pc = abuf->addr;
3606   PCADDR npc = pc + 4;
3607
3608   {
3609     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm12x4)));
3610     if (UNLIKELY(current_cpu->trace_result_p))
3611       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3612     current_cpu->h_grc_set (FLD (f_rn), opval);
3613   }
3614
3615   current_cpu->done_insn (npc, status);
3616 #undef FLD
3617 }
3618
3619 // ********** movl13-compact: mov.l $rm, @($imm12x4, $rn)
3620
3621 void
3622 sh5_compact_sem_movl13_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3623         sh5_compact::write_stacks &buf)
3624 {
3625 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3626   sem_status status = SEM_STATUS_NORMAL;
3627   sh5_compact_scache* abuf = sem;
3628   unsigned long long written = 0;
3629   PCADDR pc = abuf->addr;
3630   PCADDR npc = pc + 4;
3631
3632   {
3633     SI opval = current_cpu->h_grc_get (FLD (f_rm));
3634     if (UNLIKELY(current_cpu->trace_result_p))
3635       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3636     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm12x4)), opval);
3637   }
3638
3639   current_cpu->done_insn (npc, status);
3640 #undef FLD
3641 }
3642
3643 // ********** movw1-compact: mov.w $rm, @$rn
3644
3645 void
3646 sh5_compact_sem_movw1_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3647         sh5_compact::write_stacks &buf)
3648 {
3649 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
3650   sem_status status = SEM_STATUS_NORMAL;
3651   sh5_compact_scache* abuf = sem;
3652   unsigned long long written = 0;
3653   PCADDR pc = abuf->addr;
3654   PCADDR npc = pc + 2;
3655
3656   {
3657     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3658     if (UNLIKELY(current_cpu->trace_result_p))
3659       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3660     current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3661   }
3662
3663   current_cpu->done_insn (npc, status);
3664 #undef FLD
3665 }
3666
3667 // ********** movw2-compact: mov.w $rm, @-$rn
3668
3669 void
3670 sh5_compact_sem_movw2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3671         sh5_compact::write_stacks &buf)
3672 {
3673 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3674   sem_status status = SEM_STATUS_NORMAL;
3675   sh5_compact_scache* abuf = sem;
3676   unsigned long long written = 0;
3677   PCADDR pc = abuf->addr;
3678   PCADDR npc = pc + 2;
3679
3680 {
3681   DI tmp_addr;
3682   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3683   {
3684     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3685     if (UNLIKELY(current_cpu->trace_result_p))
3686       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3687     current_cpu->SETMEMHI (pc, tmp_addr, opval);
3688   }
3689   {
3690     SI opval = tmp_addr;
3691     if (UNLIKELY(current_cpu->trace_result_p))
3692       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3693     current_cpu->h_grc_set (FLD (f_rn), opval);
3694   }
3695 }
3696
3697   current_cpu->done_insn (npc, status);
3698 #undef FLD
3699 }
3700
3701 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
3702
3703 void
3704 sh5_compact_sem_movw3_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3705         sh5_compact::write_stacks &buf)
3706 {
3707 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
3708   sem_status status = SEM_STATUS_NORMAL;
3709   sh5_compact_scache* abuf = sem;
3710   unsigned long long written = 0;
3711   PCADDR pc = abuf->addr;
3712   PCADDR npc = pc + 2;
3713
3714   {
3715     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
3716     if (UNLIKELY(current_cpu->trace_result_p))
3717       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3718     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
3719   }
3720
3721   current_cpu->done_insn (npc, status);
3722 #undef FLD
3723 }
3724
3725 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
3726
3727 void
3728 sh5_compact_sem_movw4_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3729         sh5_compact::write_stacks &buf)
3730 {
3731 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
3732   sem_status status = SEM_STATUS_NORMAL;
3733   sh5_compact_scache* abuf = sem;
3734   unsigned long long written = 0;
3735   PCADDR pc = abuf->addr;
3736   PCADDR npc = pc + 2;
3737
3738   {
3739     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3740     if (UNLIKELY(current_cpu->trace_result_p))
3741       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3742     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
3743   }
3744
3745   current_cpu->done_insn (npc, status);
3746 #undef FLD
3747 }
3748
3749 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
3750
3751 void
3752 sh5_compact_sem_movw5_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3753         sh5_compact::write_stacks &buf)
3754 {
3755 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3756   sem_status status = SEM_STATUS_NORMAL;
3757   sh5_compact_scache* abuf = sem;
3758   unsigned long long written = 0;
3759   PCADDR pc = abuf->addr;
3760   PCADDR npc = pc + 2;
3761
3762   {
3763     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
3764     if (UNLIKELY(current_cpu->trace_result_p))
3765       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3766     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
3767   }
3768
3769   current_cpu->done_insn (npc, status);
3770 #undef FLD
3771 }
3772
3773 // ********** movw6-compact: mov.w @$rm, $rn
3774
3775 void
3776 sh5_compact_sem_movw6_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3777         sh5_compact::write_stacks &buf)
3778 {
3779 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3780   sem_status status = SEM_STATUS_NORMAL;
3781   sh5_compact_scache* abuf = sem;
3782   unsigned long long written = 0;
3783   PCADDR pc = abuf->addr;
3784   PCADDR npc = pc + 2;
3785
3786   {
3787     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
3788     if (UNLIKELY(current_cpu->trace_result_p))
3789       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3790     current_cpu->h_grc_set (FLD (f_rn), opval);
3791   }
3792
3793   current_cpu->done_insn (npc, status);
3794 #undef FLD
3795 }
3796
3797 // ********** movw7-compact: mov.w @${rm}+, $rn
3798
3799 void
3800 sh5_compact_sem_movw7_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3801         sh5_compact::write_stacks &buf)
3802 {
3803 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3804   sem_status status = SEM_STATUS_NORMAL;
3805   sh5_compact_scache* abuf = sem;
3806   unsigned long long written = 0;
3807   PCADDR pc = abuf->addr;
3808   PCADDR npc = pc + 2;
3809
3810 {
3811   HI tmp_data;
3812   tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
3813 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3814   {
3815     SI opval = EXTHISI (tmp_data);
3816     written |= (1ULL << 4);
3817     if (UNLIKELY(current_cpu->trace_result_p))
3818       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
3819     current_cpu->h_grc_set (FLD (f_rm), opval);
3820   }
3821 } else {
3822   {
3823     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
3824     written |= (1ULL << 4);
3825     if (UNLIKELY(current_cpu->trace_result_p))
3826       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
3827     current_cpu->h_grc_set (FLD (f_rm), opval);
3828   }
3829 }
3830   {
3831     SI opval = EXTHISI (tmp_data);
3832     if (UNLIKELY(current_cpu->trace_result_p))
3833       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3834     current_cpu->h_grc_set (FLD (f_rn), opval);
3835   }
3836 }
3837
3838   abuf->written = written;
3839   current_cpu->done_insn (npc, status);
3840 #undef FLD
3841 }
3842
3843 // ********** movw8-compact: mov.w @(r0, $rm), $rn
3844
3845 void
3846 sh5_compact_sem_movw8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3847         sh5_compact::write_stacks &buf)
3848 {
3849 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
3850   sem_status status = SEM_STATUS_NORMAL;
3851   sh5_compact_scache* abuf = sem;
3852   unsigned long long written = 0;
3853   PCADDR pc = abuf->addr;
3854   PCADDR npc = pc + 2;
3855
3856   {
3857     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
3858     if (UNLIKELY(current_cpu->trace_result_p))
3859       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3860     current_cpu->h_grc_set (FLD (f_rn), opval);
3861   }
3862
3863   current_cpu->done_insn (npc, status);
3864 #undef FLD
3865 }
3866
3867 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
3868
3869 void
3870 sh5_compact_sem_movw9_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3871         sh5_compact::write_stacks &buf)
3872 {
3873 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
3874   sem_status status = SEM_STATUS_NORMAL;
3875   sh5_compact_scache* abuf = sem;
3876   unsigned long long written = 0;
3877   PCADDR pc = abuf->addr;
3878   PCADDR npc = pc + 2;
3879
3880   {
3881     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
3882     if (UNLIKELY(current_cpu->trace_result_p))
3883       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3884     current_cpu->h_grc_set (((UINT) 0), opval);
3885   }
3886
3887   current_cpu->done_insn (npc, status);
3888 #undef FLD
3889 }
3890
3891 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
3892
3893 void
3894 sh5_compact_sem_movw10_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3895         sh5_compact::write_stacks &buf)
3896 {
3897 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3898   sem_status status = SEM_STATUS_NORMAL;
3899   sh5_compact_scache* abuf = sem;
3900   unsigned long long written = 0;
3901   PCADDR pc = abuf->addr;
3902   PCADDR npc = pc + 2;
3903
3904   {
3905     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
3906     if (UNLIKELY(current_cpu->trace_result_p))
3907       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3908     current_cpu->h_grc_set (FLD (f_rn), opval);
3909   }
3910
3911   current_cpu->done_insn (npc, status);
3912 #undef FLD
3913 }
3914
3915 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
3916
3917 void
3918 sh5_compact_sem_movw11_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3919         sh5_compact::write_stacks &buf)
3920 {
3921 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
3922   sem_status status = SEM_STATUS_NORMAL;
3923   sh5_compact_scache* abuf = sem;
3924   unsigned long long written = 0;
3925   PCADDR pc = abuf->addr;
3926   PCADDR npc = pc + 2;
3927
3928   {
3929     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
3930     if (UNLIKELY(current_cpu->trace_result_p))
3931       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3932     current_cpu->h_grc_set (((UINT) 0), opval);
3933   }
3934
3935   current_cpu->done_insn (npc, status);
3936 #undef FLD
3937 }
3938
3939 // ********** mova-compact: mova @($imm8x4, pc), r0
3940
3941 void
3942 sh5_compact_sem_mova_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3943         sh5_compact::write_stacks &buf)
3944 {
3945 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
3946   sem_status status = SEM_STATUS_NORMAL;
3947   sh5_compact_scache* abuf = sem;
3948   unsigned long long written = 0;
3949   PCADDR pc = abuf->addr;
3950   PCADDR npc = pc + 2;
3951
3952   {
3953     SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3954     if (UNLIKELY(current_cpu->trace_result_p))
3955       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3956     current_cpu->h_grc_set (((UINT) 0), opval);
3957   }
3958
3959   current_cpu->done_insn (npc, status);
3960 #undef FLD
3961 }
3962
3963 // ********** movcal-compact: movca.l r0, @$rn
3964
3965 void
3966 sh5_compact_sem_movcal_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3967         sh5_compact::write_stacks &buf)
3968 {
3969 #define FLD(f) abuf->fields.sfmt_divu_compact.f
3970   sem_status status = SEM_STATUS_NORMAL;
3971   sh5_compact_scache* abuf = sem;
3972   unsigned long long written = 0;
3973   PCADDR pc = abuf->addr;
3974   PCADDR npc = pc + 2;
3975
3976   {
3977     SI opval = current_cpu->h_grc_get (((UINT) 0));
3978     if (UNLIKELY(current_cpu->trace_result_p))
3979       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3980     current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
3981   }
3982
3983   current_cpu->done_insn (npc, status);
3984 #undef FLD
3985 }
3986
3987 // ********** movcol-compact: movco.l r0, @$rn
3988
3989 void
3990 sh5_compact_sem_movcol_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
3991         sh5_compact::write_stacks &buf)
3992 {
3993 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
3994   sem_status status = SEM_STATUS_NORMAL;
3995   sh5_compact_scache* abuf = sem;
3996   unsigned long long written = 0;
3997   PCADDR pc = abuf->addr;
3998   PCADDR npc = pc + 2;
3999
4000   {
4001     SI opval = current_cpu->h_grc_get (FLD (f_rn));
4002     if (UNLIKELY(current_cpu->trace_result_p))
4003       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4004     current_cpu->h_grc_set (FLD (f_rn), opval);
4005   }
4006
4007   current_cpu->done_insn (npc, status);
4008 #undef FLD
4009 }
4010
4011 // ********** movt-compact: movt $rn
4012
4013 void
4014 sh5_compact_sem_movt_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4015         sh5_compact::write_stacks &buf)
4016 {
4017 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4018   sem_status status = SEM_STATUS_NORMAL;
4019   sh5_compact_scache* abuf = sem;
4020   unsigned long long written = 0;
4021   PCADDR pc = abuf->addr;
4022   PCADDR npc = pc + 2;
4023
4024   {
4025     SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
4026     if (UNLIKELY(current_cpu->trace_result_p))
4027       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4028     current_cpu->h_grc_set (FLD (f_rn), opval);
4029   }
4030
4031   current_cpu->done_insn (npc, status);
4032 #undef FLD
4033 }
4034
4035 // ********** movual-compact: movua.l @$rn, r0
4036
4037 void
4038 sh5_compact_sem_movual_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4039         sh5_compact::write_stacks &buf)
4040 {
4041 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4042   sem_status status = SEM_STATUS_NORMAL;
4043   sh5_compact_scache* abuf = sem;
4044   unsigned long long written = 0;
4045   PCADDR pc = abuf->addr;
4046   PCADDR npc = pc + 2;
4047
4048   {
4049     SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
4050     if (UNLIKELY(current_cpu->trace_result_p))
4051       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
4052     current_cpu->h_grc_set (((UINT) 0), opval);
4053   }
4054
4055   current_cpu->done_insn (npc, status);
4056 #undef FLD
4057 }
4058
4059 // ********** movual2-compact: movua.l @$rn+, r0
4060
4061 void
4062 sh5_compact_sem_movual2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4063         sh5_compact::write_stacks &buf)
4064 {
4065 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4066   sem_status status = SEM_STATUS_NORMAL;
4067   sh5_compact_scache* abuf = sem;
4068   unsigned long long written = 0;
4069   PCADDR pc = abuf->addr;
4070   PCADDR npc = pc + 2;
4071
4072 {
4073   {
4074     SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
4075     if (UNLIKELY(current_cpu->trace_result_p))
4076       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
4077     current_cpu->h_grc_set (((UINT) 0), opval);
4078   }
4079   {
4080     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4081     if (UNLIKELY(current_cpu->trace_result_p))
4082       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4083     current_cpu->h_grc_set (FLD (f_rn), opval);
4084   }
4085 }
4086
4087   current_cpu->done_insn (npc, status);
4088 #undef FLD
4089 }
4090
4091 // ********** mull-compact: mul.l $rm, $rn
4092
4093 void
4094 sh5_compact_sem_mull_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4095         sh5_compact::write_stacks &buf)
4096 {
4097 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4098   sem_status status = SEM_STATUS_NORMAL;
4099   sh5_compact_scache* abuf = sem;
4100   unsigned long long written = 0;
4101   PCADDR pc = abuf->addr;
4102   PCADDR npc = pc + 2;
4103
4104   {
4105     SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
4106     if (UNLIKELY(current_cpu->trace_result_p))
4107       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
4108     current_cpu->h_macl_set (opval);
4109   }
4110
4111   current_cpu->done_insn (npc, status);
4112 #undef FLD
4113 }
4114
4115 // ********** mulsw-compact: muls.w $rm, $rn
4116
4117 void
4118 sh5_compact_sem_mulsw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4119         sh5_compact::write_stacks &buf)
4120 {
4121 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4122   sem_status status = SEM_STATUS_NORMAL;
4123   sh5_compact_scache* abuf = sem;
4124   unsigned long long written = 0;
4125   PCADDR pc = abuf->addr;
4126   PCADDR npc = pc + 2;
4127
4128   {
4129     SI opval = MULSI (EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1)), EXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rn)), 1)));
4130     if (UNLIKELY(current_cpu->trace_result_p))
4131       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
4132     current_cpu->h_macl_set (opval);
4133   }
4134
4135   current_cpu->done_insn (npc, status);
4136 #undef FLD
4137 }
4138
4139 // ********** muluw-compact: mulu.w $rm, $rn
4140
4141 void
4142 sh5_compact_sem_muluw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4143         sh5_compact::write_stacks &buf)
4144 {
4145 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
4146   sem_status status = SEM_STATUS_NORMAL;
4147   sh5_compact_scache* abuf = sem;
4148   unsigned long long written = 0;
4149   PCADDR pc = abuf->addr;
4150   PCADDR npc = pc + 2;
4151
4152   {
4153     SI opval = MULSI (ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1)), ZEXTHISI (SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rn)), 1)));
4154     if (UNLIKELY(current_cpu->trace_result_p))
4155       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
4156     current_cpu->h_macl_set (opval);
4157   }
4158
4159   current_cpu->done_insn (npc, status);
4160 #undef FLD
4161 }
4162
4163 // ********** neg-compact: neg $rm, $rn
4164
4165 void
4166 sh5_compact_sem_neg_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4167         sh5_compact::write_stacks &buf)
4168 {
4169 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4170   sem_status status = SEM_STATUS_NORMAL;
4171   sh5_compact_scache* abuf = sem;
4172   unsigned long long written = 0;
4173   PCADDR pc = abuf->addr;
4174   PCADDR npc = pc + 2;
4175
4176   {
4177     SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
4178     if (UNLIKELY(current_cpu->trace_result_p))
4179       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4180     current_cpu->h_grc_set (FLD (f_rn), opval);
4181   }
4182
4183   current_cpu->done_insn (npc, status);
4184 #undef FLD
4185 }
4186
4187 // ********** negc-compact: negc $rm, $rn
4188
4189 void
4190 sh5_compact_sem_negc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4191         sh5_compact::write_stacks &buf)
4192 {
4193 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4194   sem_status status = SEM_STATUS_NORMAL;
4195   sh5_compact_scache* abuf = sem;
4196   unsigned long long written = 0;
4197   PCADDR pc = abuf->addr;
4198   PCADDR npc = pc + 2;
4199
4200 {
4201   BI tmp_flag;
4202   tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4203   {
4204     SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4205     if (UNLIKELY(current_cpu->trace_result_p))
4206       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4207     current_cpu->h_grc_set (FLD (f_rn), opval);
4208   }
4209   {
4210     BI opval = tmp_flag;
4211     if (UNLIKELY(current_cpu->trace_result_p))
4212       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4213     current_cpu->h_tbit_set (opval);
4214   }
4215 }
4216
4217   current_cpu->done_insn (npc, status);
4218 #undef FLD
4219 }
4220
4221 // ********** nop-compact: nop
4222
4223 void
4224 sh5_compact_sem_nop_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4225         sh5_compact::write_stacks &buf)
4226 {
4227 #define FLD(f) abuf->fields.fmt_empty.f
4228   sem_status status = SEM_STATUS_NORMAL;
4229   sh5_compact_scache* abuf = sem;
4230   unsigned long long written = 0;
4231   PCADDR pc = abuf->addr;
4232   PCADDR npc = pc + 2;
4233
4234 ((void) 0); /*nop*/
4235
4236   current_cpu->done_insn (npc, status);
4237 #undef FLD
4238 }
4239
4240 // ********** not-compact: not $rm64, $rn64
4241
4242 void
4243 sh5_compact_sem_not_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4244         sh5_compact::write_stacks &buf)
4245 {
4246 #define FLD(f) abuf->fields.sfmt_and_compact.f
4247   sem_status status = SEM_STATUS_NORMAL;
4248   sh5_compact_scache* abuf = sem;
4249   unsigned long long written = 0;
4250   PCADDR pc = abuf->addr;
4251   PCADDR npc = pc + 2;
4252
4253   {
4254     DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
4255     if (UNLIKELY(current_cpu->trace_result_p))
4256       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4257     current_cpu->h_gr_set (FLD (f_rn), opval);
4258   }
4259
4260   current_cpu->done_insn (npc, status);
4261 #undef FLD
4262 }
4263
4264 // ********** ocbi-compact: ocbi @$rn
4265
4266 void
4267 sh5_compact_sem_ocbi_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4268         sh5_compact::write_stacks &buf)
4269 {
4270 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4271   sem_status status = SEM_STATUS_NORMAL;
4272   sh5_compact_scache* abuf = sem;
4273   unsigned long long written = 0;
4274   PCADDR pc = abuf->addr;
4275   PCADDR npc = pc + 2;
4276
4277 {
4278   {
4279     SI opval = current_cpu->h_grc_get (FLD (f_rn));
4280     if (UNLIKELY(current_cpu->trace_result_p))
4281       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4282     current_cpu->h_grc_set (FLD (f_rn), opval);
4283   }
4284 ((void) 0); /*nop*/
4285 }
4286
4287   current_cpu->done_insn (npc, status);
4288 #undef FLD
4289 }
4290
4291 // ********** ocbp-compact: ocbp @$rn
4292
4293 void
4294 sh5_compact_sem_ocbp_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4295         sh5_compact::write_stacks &buf)
4296 {
4297 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4298   sem_status status = SEM_STATUS_NORMAL;
4299   sh5_compact_scache* abuf = sem;
4300   unsigned long long written = 0;
4301   PCADDR pc = abuf->addr;
4302   PCADDR npc = pc + 2;
4303
4304 {
4305   {
4306     SI opval = current_cpu->h_grc_get (FLD (f_rn));
4307     if (UNLIKELY(current_cpu->trace_result_p))
4308       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4309     current_cpu->h_grc_set (FLD (f_rn), opval);
4310   }
4311 ((void) 0); /*nop*/
4312 }
4313
4314   current_cpu->done_insn (npc, status);
4315 #undef FLD
4316 }
4317
4318 // ********** ocbwb-compact: ocbwb @$rn
4319
4320 void
4321 sh5_compact_sem_ocbwb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4322         sh5_compact::write_stacks &buf)
4323 {
4324 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4325   sem_status status = SEM_STATUS_NORMAL;
4326   sh5_compact_scache* abuf = sem;
4327   unsigned long long written = 0;
4328   PCADDR pc = abuf->addr;
4329   PCADDR npc = pc + 2;
4330
4331 {
4332   {
4333     SI opval = current_cpu->h_grc_get (FLD (f_rn));
4334     if (UNLIKELY(current_cpu->trace_result_p))
4335       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4336     current_cpu->h_grc_set (FLD (f_rn), opval);
4337   }
4338 ((void) 0); /*nop*/
4339 }
4340
4341   current_cpu->done_insn (npc, status);
4342 #undef FLD
4343 }
4344
4345 // ********** or-compact: or $rm64, $rn64
4346
4347 void
4348 sh5_compact_sem_or_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4349         sh5_compact::write_stacks &buf)
4350 {
4351 #define FLD(f) abuf->fields.sfmt_and_compact.f
4352   sem_status status = SEM_STATUS_NORMAL;
4353   sh5_compact_scache* abuf = sem;
4354   unsigned long long written = 0;
4355   PCADDR pc = abuf->addr;
4356   PCADDR npc = pc + 2;
4357
4358   {
4359     DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
4360     if (UNLIKELY(current_cpu->trace_result_p))
4361       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4362     current_cpu->h_gr_set (FLD (f_rn), opval);
4363   }
4364
4365   current_cpu->done_insn (npc, status);
4366 #undef FLD
4367 }
4368
4369 // ********** ori-compact: or #$uimm8, r0
4370
4371 void
4372 sh5_compact_sem_ori_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4373         sh5_compact::write_stacks &buf)
4374 {
4375 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4376   sem_status status = SEM_STATUS_NORMAL;
4377   sh5_compact_scache* abuf = sem;
4378   unsigned long long written = 0;
4379   PCADDR pc = abuf->addr;
4380   PCADDR npc = pc + 2;
4381
4382   {
4383     SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4384     if (UNLIKELY(current_cpu->trace_result_p))
4385       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
4386     current_cpu->h_grc_set (((UINT) 0), opval);
4387   }
4388
4389   current_cpu->done_insn (npc, status);
4390 #undef FLD
4391 }
4392
4393 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
4394
4395 void
4396 sh5_compact_sem_orb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4397         sh5_compact::write_stacks &buf)
4398 {
4399 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4400   sem_status status = SEM_STATUS_NORMAL;
4401   sh5_compact_scache* abuf = sem;
4402   unsigned long long written = 0;
4403   PCADDR pc = abuf->addr;
4404   PCADDR npc = pc + 2;
4405
4406 {
4407   DI tmp_addr;
4408   UQI tmp_data;
4409   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4410   tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4411   {
4412     UQI opval = tmp_data;
4413     if (UNLIKELY(current_cpu->trace_result_p))
4414       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
4415     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4416   }
4417 }
4418
4419   current_cpu->done_insn (npc, status);
4420 #undef FLD
4421 }
4422
4423 // ********** pref-compact: pref @$rn
4424
4425 void
4426 sh5_compact_sem_pref_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4427         sh5_compact::write_stacks &buf)
4428 {
4429 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4430   sem_status status = SEM_STATUS_NORMAL;
4431   sh5_compact_scache* abuf = sem;
4432   unsigned long long written = 0;
4433   PCADDR pc = abuf->addr;
4434   PCADDR npc = pc + 2;
4435
4436 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
4437
4438   current_cpu->done_insn (npc, status);
4439 #undef FLD
4440 }
4441
4442 // ********** rotcl-compact: rotcl $rn
4443
4444 void
4445 sh5_compact_sem_rotcl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4446         sh5_compact::write_stacks &buf)
4447 {
4448 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4449   sem_status status = SEM_STATUS_NORMAL;
4450   sh5_compact_scache* abuf = sem;
4451   unsigned long long written = 0;
4452   PCADDR pc = abuf->addr;
4453   PCADDR npc = pc + 2;
4454
4455 {
4456   BI tmp_temp;
4457   tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4458   {
4459     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
4460     if (UNLIKELY(current_cpu->trace_result_p))
4461       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4462     current_cpu->h_grc_set (FLD (f_rn), opval);
4463   }
4464   {
4465     BI opval = ((tmp_temp) ? (1) : (0));
4466     if (UNLIKELY(current_cpu->trace_result_p))
4467       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4468     current_cpu->h_tbit_set (opval);
4469   }
4470 }
4471
4472   current_cpu->done_insn (npc, status);
4473 #undef FLD
4474 }
4475
4476 // ********** rotcr-compact: rotcr $rn
4477
4478 void
4479 sh5_compact_sem_rotcr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4480         sh5_compact::write_stacks &buf)
4481 {
4482 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4483   sem_status status = SEM_STATUS_NORMAL;
4484   sh5_compact_scache* abuf = sem;
4485   unsigned long long written = 0;
4486   PCADDR pc = abuf->addr;
4487   PCADDR npc = pc + 2;
4488
4489 {
4490   BI tmp_lsbit;
4491   SI tmp_temp;
4492   tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4493   tmp_temp = current_cpu->h_tbit_get ();
4494   {
4495     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4496     if (UNLIKELY(current_cpu->trace_result_p))
4497       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4498     current_cpu->h_grc_set (FLD (f_rn), opval);
4499   }
4500   {
4501     BI opval = ((tmp_lsbit) ? (1) : (0));
4502     if (UNLIKELY(current_cpu->trace_result_p))
4503       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4504     current_cpu->h_tbit_set (opval);
4505   }
4506 }
4507
4508   current_cpu->done_insn (npc, status);
4509 #undef FLD
4510 }
4511
4512 // ********** rotl-compact: rotl $rn
4513
4514 void
4515 sh5_compact_sem_rotl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4516         sh5_compact::write_stacks &buf)
4517 {
4518 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4519   sem_status status = SEM_STATUS_NORMAL;
4520   sh5_compact_scache* abuf = sem;
4521   unsigned long long written = 0;
4522   PCADDR pc = abuf->addr;
4523   PCADDR npc = pc + 2;
4524
4525 {
4526   BI tmp_temp;
4527   tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4528   {
4529     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
4530     if (UNLIKELY(current_cpu->trace_result_p))
4531       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4532     current_cpu->h_grc_set (FLD (f_rn), opval);
4533   }
4534   {
4535     BI opval = ((tmp_temp) ? (1) : (0));
4536     if (UNLIKELY(current_cpu->trace_result_p))
4537       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4538     current_cpu->h_tbit_set (opval);
4539   }
4540 }
4541
4542   current_cpu->done_insn (npc, status);
4543 #undef FLD
4544 }
4545
4546 // ********** rotr-compact: rotr $rn
4547
4548 void
4549 sh5_compact_sem_rotr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4550         sh5_compact::write_stacks &buf)
4551 {
4552 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4553   sem_status status = SEM_STATUS_NORMAL;
4554   sh5_compact_scache* abuf = sem;
4555   unsigned long long written = 0;
4556   PCADDR pc = abuf->addr;
4557   PCADDR npc = pc + 2;
4558
4559 {
4560   BI tmp_lsbit;
4561   SI tmp_temp;
4562   tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
4563   tmp_temp = tmp_lsbit;
4564   {
4565     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4566     if (UNLIKELY(current_cpu->trace_result_p))
4567       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4568     current_cpu->h_grc_set (FLD (f_rn), opval);
4569   }
4570   {
4571     BI opval = ((tmp_lsbit) ? (1) : (0));
4572     if (UNLIKELY(current_cpu->trace_result_p))
4573       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4574     current_cpu->h_tbit_set (opval);
4575   }
4576 }
4577
4578   current_cpu->done_insn (npc, status);
4579 #undef FLD
4580 }
4581
4582 // ********** rts-compact: rts
4583
4584 void
4585 sh5_compact_sem_rts_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4586         sh5_compact::write_stacks &buf)
4587 {
4588 #define FLD(f) abuf->fields.fmt_empty.f
4589   sem_status status = SEM_STATUS_NORMAL;
4590   sh5_compact_scache* abuf = sem;
4591   unsigned long long written = 0;
4592   PCADDR pc = abuf->addr;
4593   PCADDR npc = pc + 2;
4594
4595 {
4596   {
4597     UDI opval = ADDDI (pc, 2);
4598     if (UNLIKELY(current_cpu->trace_result_p))
4599       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
4600     current_cpu->branch (opval, npc, status);
4601   }
4602 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
4603   {
4604     UDI opval = current_cpu->h_pr_get ();
4605     buf.h_pc_writes [(tick + 1) % sh5_compact::pipe_sz].push (sh5_compact::write<UDI>(pc, opval));
4606     if (UNLIKELY(current_cpu->trace_result_p))
4607       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
4608   }
4609 current_cpu->notify_ret (current_cpu->h_pr_get ());
4610 }
4611
4612   current_cpu->done_cti_insn (npc, status);
4613 #undef FLD
4614 }
4615
4616 // ********** sets-compact: sets
4617
4618 void
4619 sh5_compact_sem_sets_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4620         sh5_compact::write_stacks &buf)
4621 {
4622 #define FLD(f) abuf->fields.fmt_empty.f
4623   sem_status status = SEM_STATUS_NORMAL;
4624   sh5_compact_scache* abuf = sem;
4625   unsigned long long written = 0;
4626   PCADDR pc = abuf->addr;
4627   PCADDR npc = pc + 2;
4628
4629   {
4630     BI opval = 1;
4631     if (UNLIKELY(current_cpu->trace_result_p))
4632       current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << "  ";
4633     current_cpu->h_sbit_set (opval);
4634   }
4635
4636   current_cpu->done_insn (npc, status);
4637 #undef FLD
4638 }
4639
4640 // ********** sett-compact: sett
4641
4642 void
4643 sh5_compact_sem_sett_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4644         sh5_compact::write_stacks &buf)
4645 {
4646 #define FLD(f) abuf->fields.fmt_empty.f
4647   sem_status status = SEM_STATUS_NORMAL;
4648   sh5_compact_scache* abuf = sem;
4649   unsigned long long written = 0;
4650   PCADDR pc = abuf->addr;
4651   PCADDR npc = pc + 2;
4652
4653   {
4654     BI opval = 1;
4655     if (UNLIKELY(current_cpu->trace_result_p))
4656       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4657     current_cpu->h_tbit_set (opval);
4658   }
4659
4660   current_cpu->done_insn (npc, status);
4661 #undef FLD
4662 }
4663
4664 // ********** shad-compact: shad $rm, $rn
4665
4666 void
4667 sh5_compact_sem_shad_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4668         sh5_compact::write_stacks &buf)
4669 {
4670 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4671   sem_status status = SEM_STATUS_NORMAL;
4672   sh5_compact_scache* abuf = sem;
4673   unsigned long long written = 0;
4674   PCADDR pc = abuf->addr;
4675   PCADDR npc = pc + 2;
4676
4677 {
4678   SI tmp_shamt;
4679   tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4680 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4681   {
4682     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4683     written |= (1ULL << 2);
4684     if (UNLIKELY(current_cpu->trace_result_p))
4685       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4686     current_cpu->h_grc_set (FLD (f_rn), opval);
4687   }
4688 } else {
4689 if (NESI (tmp_shamt, 0)) {
4690   {
4691     SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4692     written |= (1ULL << 2);
4693     if (UNLIKELY(current_cpu->trace_result_p))
4694       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4695     current_cpu->h_grc_set (FLD (f_rn), opval);
4696   }
4697 } else {
4698 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
4699   {
4700     SI opval = NEGSI (1);
4701     written |= (1ULL << 2);
4702     if (UNLIKELY(current_cpu->trace_result_p))
4703       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4704     current_cpu->h_grc_set (FLD (f_rn), opval);
4705   }
4706 } else {
4707   {
4708     SI opval = 0;
4709     written |= (1ULL << 2);
4710     if (UNLIKELY(current_cpu->trace_result_p))
4711       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4712     current_cpu->h_grc_set (FLD (f_rn), opval);
4713   }
4714 }
4715 }
4716 }
4717 }
4718
4719   abuf->written = written;
4720   current_cpu->done_insn (npc, status);
4721 #undef FLD
4722 }
4723
4724 // ********** shal-compact: shal $rn
4725
4726 void
4727 sh5_compact_sem_shal_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4728         sh5_compact::write_stacks &buf)
4729 {
4730 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4731   sem_status status = SEM_STATUS_NORMAL;
4732   sh5_compact_scache* abuf = sem;
4733   unsigned long long written = 0;
4734   PCADDR pc = abuf->addr;
4735   PCADDR npc = pc + 2;
4736
4737 {
4738   BI tmp_t;
4739   tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4740   {
4741     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4742     if (UNLIKELY(current_cpu->trace_result_p))
4743       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4744     current_cpu->h_grc_set (FLD (f_rn), opval);
4745   }
4746   {
4747     BI opval = ((tmp_t) ? (1) : (0));
4748     if (UNLIKELY(current_cpu->trace_result_p))
4749       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4750     current_cpu->h_tbit_set (opval);
4751   }
4752 }
4753
4754   current_cpu->done_insn (npc, status);
4755 #undef FLD
4756 }
4757
4758 // ********** shar-compact: shar $rn
4759
4760 void
4761 sh5_compact_sem_shar_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4762         sh5_compact::write_stacks &buf)
4763 {
4764 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4765   sem_status status = SEM_STATUS_NORMAL;
4766   sh5_compact_scache* abuf = sem;
4767   unsigned long long written = 0;
4768   PCADDR pc = abuf->addr;
4769   PCADDR npc = pc + 2;
4770
4771 {
4772   BI tmp_t;
4773   tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4774   {
4775     SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4776     if (UNLIKELY(current_cpu->trace_result_p))
4777       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4778     current_cpu->h_grc_set (FLD (f_rn), opval);
4779   }
4780   {
4781     BI opval = ((tmp_t) ? (1) : (0));
4782     if (UNLIKELY(current_cpu->trace_result_p))
4783       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4784     current_cpu->h_tbit_set (opval);
4785   }
4786 }
4787
4788   current_cpu->done_insn (npc, status);
4789 #undef FLD
4790 }
4791
4792 // ********** shld-compact: shld $rm, $rn
4793
4794 void
4795 sh5_compact_sem_shld_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4796         sh5_compact::write_stacks &buf)
4797 {
4798 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4799   sem_status status = SEM_STATUS_NORMAL;
4800   sh5_compact_scache* abuf = sem;
4801   unsigned long long written = 0;
4802   PCADDR pc = abuf->addr;
4803   PCADDR npc = pc + 2;
4804
4805 {
4806   SI tmp_shamt;
4807   tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
4808 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
4809   {
4810     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
4811     written |= (1ULL << 2);
4812     if (UNLIKELY(current_cpu->trace_result_p))
4813       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4814     current_cpu->h_grc_set (FLD (f_rn), opval);
4815   }
4816 } else {
4817 if (NESI (tmp_shamt, 0)) {
4818   {
4819     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
4820     written |= (1ULL << 2);
4821     if (UNLIKELY(current_cpu->trace_result_p))
4822       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4823     current_cpu->h_grc_set (FLD (f_rn), opval);
4824   }
4825 } else {
4826   {
4827     SI opval = 0;
4828     written |= (1ULL << 2);
4829     if (UNLIKELY(current_cpu->trace_result_p))
4830       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4831     current_cpu->h_grc_set (FLD (f_rn), opval);
4832   }
4833 }
4834 }
4835 }
4836
4837   abuf->written = written;
4838   current_cpu->done_insn (npc, status);
4839 #undef FLD
4840 }
4841
4842 // ********** shll-compact: shll $rn
4843
4844 void
4845 sh5_compact_sem_shll_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4846         sh5_compact::write_stacks &buf)
4847 {
4848 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4849   sem_status status = SEM_STATUS_NORMAL;
4850   sh5_compact_scache* abuf = sem;
4851   unsigned long long written = 0;
4852   PCADDR pc = abuf->addr;
4853   PCADDR npc = pc + 2;
4854
4855 {
4856   BI tmp_t;
4857   tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
4858   {
4859     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4860     if (UNLIKELY(current_cpu->trace_result_p))
4861       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4862     current_cpu->h_grc_set (FLD (f_rn), opval);
4863   }
4864   {
4865     BI opval = ((tmp_t) ? (1) : (0));
4866     if (UNLIKELY(current_cpu->trace_result_p))
4867       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4868     current_cpu->h_tbit_set (opval);
4869   }
4870 }
4871
4872   current_cpu->done_insn (npc, status);
4873 #undef FLD
4874 }
4875
4876 // ********** shll2-compact: shll2 $rn
4877
4878 void
4879 sh5_compact_sem_shll2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4880         sh5_compact::write_stacks &buf)
4881 {
4882 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4883   sem_status status = SEM_STATUS_NORMAL;
4884   sh5_compact_scache* abuf = sem;
4885   unsigned long long written = 0;
4886   PCADDR pc = abuf->addr;
4887   PCADDR npc = pc + 2;
4888
4889   {
4890     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4891     if (UNLIKELY(current_cpu->trace_result_p))
4892       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4893     current_cpu->h_grc_set (FLD (f_rn), opval);
4894   }
4895
4896   current_cpu->done_insn (npc, status);
4897 #undef FLD
4898 }
4899
4900 // ********** shll8-compact: shll8 $rn
4901
4902 void
4903 sh5_compact_sem_shll8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4904         sh5_compact::write_stacks &buf)
4905 {
4906 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4907   sem_status status = SEM_STATUS_NORMAL;
4908   sh5_compact_scache* abuf = sem;
4909   unsigned long long written = 0;
4910   PCADDR pc = abuf->addr;
4911   PCADDR npc = pc + 2;
4912
4913   {
4914     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
4915     if (UNLIKELY(current_cpu->trace_result_p))
4916       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4917     current_cpu->h_grc_set (FLD (f_rn), opval);
4918   }
4919
4920   current_cpu->done_insn (npc, status);
4921 #undef FLD
4922 }
4923
4924 // ********** shll16-compact: shll16 $rn
4925
4926 void
4927 sh5_compact_sem_shll16_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4928         sh5_compact::write_stacks &buf)
4929 {
4930 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4931   sem_status status = SEM_STATUS_NORMAL;
4932   sh5_compact_scache* abuf = sem;
4933   unsigned long long written = 0;
4934   PCADDR pc = abuf->addr;
4935   PCADDR npc = pc + 2;
4936
4937   {
4938     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
4939     if (UNLIKELY(current_cpu->trace_result_p))
4940       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4941     current_cpu->h_grc_set (FLD (f_rn), opval);
4942   }
4943
4944   current_cpu->done_insn (npc, status);
4945 #undef FLD
4946 }
4947
4948 // ********** shlr-compact: shlr $rn
4949
4950 void
4951 sh5_compact_sem_shlr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4952         sh5_compact::write_stacks &buf)
4953 {
4954 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4955   sem_status status = SEM_STATUS_NORMAL;
4956   sh5_compact_scache* abuf = sem;
4957   unsigned long long written = 0;
4958   PCADDR pc = abuf->addr;
4959   PCADDR npc = pc + 2;
4960
4961 {
4962   BI tmp_t;
4963   tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4964   {
4965     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
4966     if (UNLIKELY(current_cpu->trace_result_p))
4967       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4968     current_cpu->h_grc_set (FLD (f_rn), opval);
4969   }
4970   {
4971     BI opval = ((tmp_t) ? (1) : (0));
4972     if (UNLIKELY(current_cpu->trace_result_p))
4973       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4974     current_cpu->h_tbit_set (opval);
4975   }
4976 }
4977
4978   current_cpu->done_insn (npc, status);
4979 #undef FLD
4980 }
4981
4982 // ********** shlr2-compact: shlr2 $rn
4983
4984 void
4985 sh5_compact_sem_shlr2_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
4986         sh5_compact::write_stacks &buf)
4987 {
4988 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
4989   sem_status status = SEM_STATUS_NORMAL;
4990   sh5_compact_scache* abuf = sem;
4991   unsigned long long written = 0;
4992   PCADDR pc = abuf->addr;
4993   PCADDR npc = pc + 2;
4994
4995   {
4996     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
4997     if (UNLIKELY(current_cpu->trace_result_p))
4998       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4999     current_cpu->h_grc_set (FLD (f_rn), opval);
5000   }
5001
5002   current_cpu->done_insn (npc, status);
5003 #undef FLD
5004 }
5005
5006 // ********** shlr8-compact: shlr8 $rn
5007
5008 void
5009 sh5_compact_sem_shlr8_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5010         sh5_compact::write_stacks &buf)
5011 {
5012 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5013   sem_status status = SEM_STATUS_NORMAL;
5014   sh5_compact_scache* abuf = sem;
5015   unsigned long long written = 0;
5016   PCADDR pc = abuf->addr;
5017   PCADDR npc = pc + 2;
5018
5019   {
5020     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
5021     if (UNLIKELY(current_cpu->trace_result_p))
5022       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5023     current_cpu->h_grc_set (FLD (f_rn), opval);
5024   }
5025
5026   current_cpu->done_insn (npc, status);
5027 #undef FLD
5028 }
5029
5030 // ********** shlr16-compact: shlr16 $rn
5031
5032 void
5033 sh5_compact_sem_shlr16_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5034         sh5_compact::write_stacks &buf)
5035 {
5036 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5037   sem_status status = SEM_STATUS_NORMAL;
5038   sh5_compact_scache* abuf = sem;
5039   unsigned long long written = 0;
5040   PCADDR pc = abuf->addr;
5041   PCADDR npc = pc + 2;
5042
5043   {
5044     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
5045     if (UNLIKELY(current_cpu->trace_result_p))
5046       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5047     current_cpu->h_grc_set (FLD (f_rn), opval);
5048   }
5049
5050   current_cpu->done_insn (npc, status);
5051 #undef FLD
5052 }
5053
5054 // ********** stc-gbr-compact: stc gbr, $rn
5055
5056 void
5057 sh5_compact_sem_stc_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5058         sh5_compact::write_stacks &buf)
5059 {
5060 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5061   sem_status status = SEM_STATUS_NORMAL;
5062   sh5_compact_scache* abuf = sem;
5063   unsigned long long written = 0;
5064   PCADDR pc = abuf->addr;
5065   PCADDR npc = pc + 2;
5066
5067   {
5068     SI opval = current_cpu->h_gbr_get ();
5069     if (UNLIKELY(current_cpu->trace_result_p))
5070       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5071     current_cpu->h_grc_set (FLD (f_rn), opval);
5072   }
5073
5074   current_cpu->done_insn (npc, status);
5075 #undef FLD
5076 }
5077
5078 // ********** stc-vbr-compact: stc vbr, $rn
5079
5080 void
5081 sh5_compact_sem_stc_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5082         sh5_compact::write_stacks &buf)
5083 {
5084 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5085   sem_status status = SEM_STATUS_NORMAL;
5086   sh5_compact_scache* abuf = sem;
5087   unsigned long long written = 0;
5088   PCADDR pc = abuf->addr;
5089   PCADDR npc = pc + 2;
5090
5091   {
5092     SI opval = current_cpu->h_vbr_get ();
5093     if (UNLIKELY(current_cpu->trace_result_p))
5094       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5095     current_cpu->h_grc_set (FLD (f_rn), opval);
5096   }
5097
5098   current_cpu->done_insn (npc, status);
5099 #undef FLD
5100 }
5101
5102 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
5103
5104 void
5105 sh5_compact_sem_stcl_gbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5106         sh5_compact::write_stacks &buf)
5107 {
5108 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5109   sem_status status = SEM_STATUS_NORMAL;
5110   sh5_compact_scache* abuf = sem;
5111   unsigned long long written = 0;
5112   PCADDR pc = abuf->addr;
5113   PCADDR npc = pc + 2;
5114
5115 {
5116   DI tmp_addr;
5117   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5118   {
5119     SI opval = current_cpu->h_gbr_get ();
5120     if (UNLIKELY(current_cpu->trace_result_p))
5121       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
5122     current_cpu->SETMEMSI (pc, tmp_addr, opval);
5123   }
5124   {
5125     SI opval = tmp_addr;
5126     if (UNLIKELY(current_cpu->trace_result_p))
5127       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5128     current_cpu->h_grc_set (FLD (f_rn), opval);
5129   }
5130 }
5131
5132   current_cpu->done_insn (npc, status);
5133 #undef FLD
5134 }
5135
5136 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
5137
5138 void
5139 sh5_compact_sem_stcl_vbr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5140         sh5_compact::write_stacks &buf)
5141 {
5142 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5143   sem_status status = SEM_STATUS_NORMAL;
5144   sh5_compact_scache* abuf = sem;
5145   unsigned long long written = 0;
5146   PCADDR pc = abuf->addr;
5147   PCADDR npc = pc + 2;
5148
5149 {
5150   DI tmp_addr;
5151   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5152   {
5153     SI opval = current_cpu->h_vbr_get ();
5154     if (UNLIKELY(current_cpu->trace_result_p))
5155       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
5156     current_cpu->SETMEMSI (pc, tmp_addr, opval);
5157   }
5158   {
5159     SI opval = tmp_addr;
5160     if (UNLIKELY(current_cpu->trace_result_p))
5161       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5162     current_cpu->h_grc_set (FLD (f_rn), opval);
5163   }
5164 }
5165
5166   current_cpu->done_insn (npc, status);
5167 #undef FLD
5168 }
5169
5170 // ********** sts-fpscr-compact: sts fpscr, $rn
5171
5172 void
5173 sh5_compact_sem_sts_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5174         sh5_compact::write_stacks &buf)
5175 {
5176 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5177   sem_status status = SEM_STATUS_NORMAL;
5178   sh5_compact_scache* abuf = sem;
5179   unsigned long long written = 0;
5180   PCADDR pc = abuf->addr;
5181   PCADDR npc = pc + 2;
5182
5183   {
5184     SI opval = current_cpu->hardware.h_fpscr;
5185     if (UNLIKELY(current_cpu->trace_result_p))
5186       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5187     current_cpu->h_grc_set (FLD (f_rn), opval);
5188   }
5189
5190   current_cpu->done_insn (npc, status);
5191 #undef FLD
5192 }
5193
5194 // ********** stsl-fpscr-compact: sts.l fpscr, @-$rn
5195
5196 void
5197 sh5_compact_sem_stsl_fpscr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5198         sh5_compact::write_stacks &buf)
5199 {
5200 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5201   sem_status status = SEM_STATUS_NORMAL;
5202   sh5_compact_scache* abuf = sem;
5203   unsigned long long written = 0;
5204   PCADDR pc = abuf->addr;
5205   PCADDR npc = pc + 2;
5206
5207 {
5208   DI tmp_addr;
5209   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5210   {
5211     SI opval = current_cpu->hardware.h_fpscr;
5212     if (UNLIKELY(current_cpu->trace_result_p))
5213       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
5214     current_cpu->SETMEMSI (pc, tmp_addr, opval);
5215   }
5216   {
5217     SI opval = tmp_addr;
5218     if (UNLIKELY(current_cpu->trace_result_p))
5219       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5220     current_cpu->h_grc_set (FLD (f_rn), opval);
5221   }
5222 }
5223
5224   current_cpu->done_insn (npc, status);
5225 #undef FLD
5226 }
5227
5228 // ********** sts-fpul-compact: sts fpul, $rn
5229
5230 void
5231 sh5_compact_sem_sts_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5232         sh5_compact::write_stacks &buf)
5233 {
5234 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5235   sem_status status = SEM_STATUS_NORMAL;
5236   sh5_compact_scache* abuf = sem;
5237   unsigned long long written = 0;
5238   PCADDR pc = abuf->addr;
5239   PCADDR npc = pc + 2;
5240
5241   {
5242     SI opval = SUBWORDSFSI (current_cpu->hardware.h_fr[((UINT) 32)]);
5243     if (UNLIKELY(current_cpu->trace_result_p))
5244       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5245     current_cpu->h_grc_set (FLD (f_rn), opval);
5246   }
5247
5248   current_cpu->done_insn (npc, status);
5249 #undef FLD
5250 }
5251
5252 // ********** stsl-fpul-compact: sts.l fpul, @-$rn
5253
5254 void
5255 sh5_compact_sem_stsl_fpul_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5256         sh5_compact::write_stacks &buf)
5257 {
5258 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5259   sem_status status = SEM_STATUS_NORMAL;
5260   sh5_compact_scache* abuf = sem;
5261   unsigned long long written = 0;
5262   PCADDR pc = abuf->addr;
5263   PCADDR npc = pc + 2;
5264
5265 {
5266   DI tmp_addr;
5267   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5268   {
5269     SF opval = current_cpu->hardware.h_fr[((UINT) 32)];
5270     if (UNLIKELY(current_cpu->trace_result_p))
5271       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
5272     current_cpu->SETMEMSF (pc, tmp_addr, opval);
5273   }
5274   {
5275     SI opval = tmp_addr;
5276     if (UNLIKELY(current_cpu->trace_result_p))
5277       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5278     current_cpu->h_grc_set (FLD (f_rn), opval);
5279   }
5280 }
5281
5282   current_cpu->done_insn (npc, status);
5283 #undef FLD
5284 }
5285
5286 // ********** sts-mach-compact: sts mach, $rn
5287
5288 void
5289 sh5_compact_sem_sts_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5290         sh5_compact::write_stacks &buf)
5291 {
5292 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5293   sem_status status = SEM_STATUS_NORMAL;
5294   sh5_compact_scache* abuf = sem;
5295   unsigned long long written = 0;
5296   PCADDR pc = abuf->addr;
5297   PCADDR npc = pc + 2;
5298
5299   {
5300     SI opval = current_cpu->h_mach_get ();
5301     if (UNLIKELY(current_cpu->trace_result_p))
5302       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5303     current_cpu->h_grc_set (FLD (f_rn), opval);
5304   }
5305
5306   current_cpu->done_insn (npc, status);
5307 #undef FLD
5308 }
5309
5310 // ********** stsl-mach-compact: sts.l mach, @-$rn
5311
5312 void
5313 sh5_compact_sem_stsl_mach_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5314         sh5_compact::write_stacks &buf)
5315 {
5316 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5317   sem_status status = SEM_STATUS_NORMAL;
5318   sh5_compact_scache* abuf = sem;
5319   unsigned long long written = 0;
5320   PCADDR pc = abuf->addr;
5321   PCADDR npc = pc + 2;
5322
5323 {
5324   DI tmp_addr;
5325   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5326   {
5327     SI opval = current_cpu->h_mach_get ();
5328     if (UNLIKELY(current_cpu->trace_result_p))
5329       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
5330     current_cpu->SETMEMSI (pc, tmp_addr, opval);
5331   }
5332   {
5333     SI opval = tmp_addr;
5334     if (UNLIKELY(current_cpu->trace_result_p))
5335       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5336     current_cpu->h_grc_set (FLD (f_rn), opval);
5337   }
5338 }
5339
5340   current_cpu->done_insn (npc, status);
5341 #undef FLD
5342 }
5343
5344 // ********** sts-macl-compact: sts macl, $rn
5345
5346 void
5347 sh5_compact_sem_sts_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5348         sh5_compact::write_stacks &buf)
5349 {
5350 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5351   sem_status status = SEM_STATUS_NORMAL;
5352   sh5_compact_scache* abuf = sem;
5353   unsigned long long written = 0;
5354   PCADDR pc = abuf->addr;
5355   PCADDR npc = pc + 2;
5356
5357   {
5358     SI opval = current_cpu->h_macl_get ();
5359     if (UNLIKELY(current_cpu->trace_result_p))
5360       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5361     current_cpu->h_grc_set (FLD (f_rn), opval);
5362   }
5363
5364   current_cpu->done_insn (npc, status);
5365 #undef FLD
5366 }
5367
5368 // ********** stsl-macl-compact: sts.l macl, @-$rn
5369
5370 void
5371 sh5_compact_sem_stsl_macl_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5372         sh5_compact::write_stacks &buf)
5373 {
5374 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5375   sem_status status = SEM_STATUS_NORMAL;
5376   sh5_compact_scache* abuf = sem;
5377   unsigned long long written = 0;
5378   PCADDR pc = abuf->addr;
5379   PCADDR npc = pc + 2;
5380
5381 {
5382   DI tmp_addr;
5383   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5384   {
5385     SI opval = current_cpu->h_macl_get ();
5386     if (UNLIKELY(current_cpu->trace_result_p))
5387       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
5388     current_cpu->SETMEMSI (pc, tmp_addr, opval);
5389   }
5390   {
5391     SI opval = tmp_addr;
5392     if (UNLIKELY(current_cpu->trace_result_p))
5393       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5394     current_cpu->h_grc_set (FLD (f_rn), opval);
5395   }
5396 }
5397
5398   current_cpu->done_insn (npc, status);
5399 #undef FLD
5400 }
5401
5402 // ********** sts-pr-compact: sts pr, $rn
5403
5404 void
5405 sh5_compact_sem_sts_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5406         sh5_compact::write_stacks &buf)
5407 {
5408 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5409   sem_status status = SEM_STATUS_NORMAL;
5410   sh5_compact_scache* abuf = sem;
5411   unsigned long long written = 0;
5412   PCADDR pc = abuf->addr;
5413   PCADDR npc = pc + 2;
5414
5415   {
5416     SI opval = current_cpu->h_pr_get ();
5417     if (UNLIKELY(current_cpu->trace_result_p))
5418       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5419     current_cpu->h_grc_set (FLD (f_rn), opval);
5420   }
5421
5422   current_cpu->done_insn (npc, status);
5423 #undef FLD
5424 }
5425
5426 // ********** stsl-pr-compact: sts.l pr, @-$rn
5427
5428 void
5429 sh5_compact_sem_stsl_pr_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5430         sh5_compact::write_stacks &buf)
5431 {
5432 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5433   sem_status status = SEM_STATUS_NORMAL;
5434   sh5_compact_scache* abuf = sem;
5435   unsigned long long written = 0;
5436   PCADDR pc = abuf->addr;
5437   PCADDR npc = pc + 2;
5438
5439 {
5440   DI tmp_addr;
5441   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
5442   {
5443     SI opval = current_cpu->h_pr_get ();
5444     if (UNLIKELY(current_cpu->trace_result_p))
5445       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
5446     current_cpu->SETMEMSI (pc, tmp_addr, opval);
5447   }
5448   {
5449     SI opval = tmp_addr;
5450     if (UNLIKELY(current_cpu->trace_result_p))
5451       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5452     current_cpu->h_grc_set (FLD (f_rn), opval);
5453   }
5454 }
5455
5456   current_cpu->done_insn (npc, status);
5457 #undef FLD
5458 }
5459
5460 // ********** sub-compact: sub $rm, $rn
5461
5462 void
5463 sh5_compact_sem_sub_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5464         sh5_compact::write_stacks &buf)
5465 {
5466 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5467   sem_status status = SEM_STATUS_NORMAL;
5468   sh5_compact_scache* abuf = sem;
5469   unsigned long long written = 0;
5470   PCADDR pc = abuf->addr;
5471   PCADDR npc = pc + 2;
5472
5473   {
5474     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5475     if (UNLIKELY(current_cpu->trace_result_p))
5476       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5477     current_cpu->h_grc_set (FLD (f_rn), opval);
5478   }
5479
5480   current_cpu->done_insn (npc, status);
5481 #undef FLD
5482 }
5483
5484 // ********** subc-compact: subc $rm, $rn
5485
5486 void
5487 sh5_compact_sem_subc_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5488         sh5_compact::write_stacks &buf)
5489 {
5490 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5491   sem_status status = SEM_STATUS_NORMAL;
5492   sh5_compact_scache* abuf = sem;
5493   unsigned long long written = 0;
5494   PCADDR pc = abuf->addr;
5495   PCADDR npc = pc + 2;
5496
5497 {
5498   BI tmp_flag;
5499   tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5500   {
5501     SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
5502     if (UNLIKELY(current_cpu->trace_result_p))
5503       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5504     current_cpu->h_grc_set (FLD (f_rn), opval);
5505   }
5506   {
5507     BI opval = tmp_flag;
5508     if (UNLIKELY(current_cpu->trace_result_p))
5509       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
5510     current_cpu->h_tbit_set (opval);
5511   }
5512 }
5513
5514   current_cpu->done_insn (npc, status);
5515 #undef FLD
5516 }
5517
5518 // ********** subv-compact: subv $rm, $rn
5519
5520 void
5521 sh5_compact_sem_subv_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5522         sh5_compact::write_stacks &buf)
5523 {
5524 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5525   sem_status status = SEM_STATUS_NORMAL;
5526   sh5_compact_scache* abuf = sem;
5527   unsigned long long written = 0;
5528   PCADDR pc = abuf->addr;
5529   PCADDR npc = pc + 2;
5530
5531 {
5532   BI tmp_t;
5533   tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
5534   {
5535     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
5536     if (UNLIKELY(current_cpu->trace_result_p))
5537       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5538     current_cpu->h_grc_set (FLD (f_rn), opval);
5539   }
5540   {
5541     BI opval = ((tmp_t) ? (1) : (0));
5542     if (UNLIKELY(current_cpu->trace_result_p))
5543       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
5544     current_cpu->h_tbit_set (opval);
5545   }
5546 }
5547
5548   current_cpu->done_insn (npc, status);
5549 #undef FLD
5550 }
5551
5552 // ********** swapb-compact: swap.b $rm, $rn
5553
5554 void
5555 sh5_compact_sem_swapb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5556         sh5_compact::write_stacks &buf)
5557 {
5558 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5559   sem_status status = SEM_STATUS_NORMAL;
5560   sh5_compact_scache* abuf = sem;
5561   unsigned long long written = 0;
5562   PCADDR pc = abuf->addr;
5563   PCADDR npc = pc + 2;
5564
5565 {
5566   UHI tmp_top_half;
5567   UQI tmp_byte1;
5568   UQI tmp_byte0;
5569   tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
5570   tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
5571   tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
5572   {
5573     SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
5574     if (UNLIKELY(current_cpu->trace_result_p))
5575       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5576     current_cpu->h_grc_set (FLD (f_rn), opval);
5577   }
5578 }
5579
5580   current_cpu->done_insn (npc, status);
5581 #undef FLD
5582 }
5583
5584 // ********** swapw-compact: swap.w $rm, $rn
5585
5586 void
5587 sh5_compact_sem_swapw_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5588         sh5_compact::write_stacks &buf)
5589 {
5590 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5591   sem_status status = SEM_STATUS_NORMAL;
5592   sh5_compact_scache* abuf = sem;
5593   unsigned long long written = 0;
5594   PCADDR pc = abuf->addr;
5595   PCADDR npc = pc + 2;
5596
5597   {
5598     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
5599     if (UNLIKELY(current_cpu->trace_result_p))
5600       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5601     current_cpu->h_grc_set (FLD (f_rn), opval);
5602   }
5603
5604   current_cpu->done_insn (npc, status);
5605 #undef FLD
5606 }
5607
5608 // ********** tasb-compact: tas.b @$rn
5609
5610 void
5611 sh5_compact_sem_tasb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5612         sh5_compact::write_stacks &buf)
5613 {
5614 #define FLD(f) abuf->fields.sfmt_stsl_fpul_compact.f
5615   sem_status status = SEM_STATUS_NORMAL;
5616   sh5_compact_scache* abuf = sem;
5617   unsigned long long written = 0;
5618   PCADDR pc = abuf->addr;
5619   PCADDR npc = pc + 2;
5620
5621 {
5622   UQI tmp_byte;
5623   tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
5624   {
5625     BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
5626     if (UNLIKELY(current_cpu->trace_result_p))
5627       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
5628     current_cpu->h_tbit_set (opval);
5629   }
5630   tmp_byte = ORQI (tmp_byte, 128);
5631   {
5632     UQI opval = tmp_byte;
5633     if (UNLIKELY(current_cpu->trace_result_p))
5634       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
5635     current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
5636   }
5637 }
5638
5639   current_cpu->done_insn (npc, status);
5640 #undef FLD
5641 }
5642
5643 // ********** trapa-compact: trapa #$uimm8
5644
5645 void
5646 sh5_compact_sem_trapa_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5647         sh5_compact::write_stacks &buf)
5648 {
5649 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5650   sem_status status = SEM_STATUS_NORMAL;
5651   sh5_compact_scache* abuf = sem;
5652   unsigned long long written = 0;
5653   PCADDR pc = abuf->addr;
5654   PCADDR npc = pc + 2;
5655
5656 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
5657
5658   current_cpu->done_insn (npc, status);
5659 #undef FLD
5660 }
5661
5662 // ********** tst-compact: tst $rm, $rn
5663
5664 void
5665 sh5_compact_sem_tst_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5666         sh5_compact::write_stacks &buf)
5667 {
5668 #define FLD(f) abuf->fields.sfmt_movl13_compact.f
5669   sem_status status = SEM_STATUS_NORMAL;
5670   sh5_compact_scache* abuf = sem;
5671   unsigned long long written = 0;
5672   PCADDR pc = abuf->addr;
5673   PCADDR npc = pc + 2;
5674
5675   {
5676     BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
5677     if (UNLIKELY(current_cpu->trace_result_p))
5678       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
5679     current_cpu->h_tbit_set (opval);
5680   }
5681
5682   current_cpu->done_insn (npc, status);
5683 #undef FLD
5684 }
5685
5686 // ********** tsti-compact: tst #$uimm8, r0
5687
5688 void
5689 sh5_compact_sem_tsti_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5690         sh5_compact::write_stacks &buf)
5691 {
5692 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5693   sem_status status = SEM_STATUS_NORMAL;
5694   sh5_compact_scache* abuf = sem;
5695   unsigned long long written = 0;
5696   PCADDR pc = abuf->addr;
5697   PCADDR npc = pc + 2;
5698
5699   {
5700     BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5701     if (UNLIKELY(current_cpu->trace_result_p))
5702       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
5703     current_cpu->h_tbit_set (opval);
5704   }
5705
5706   current_cpu->done_insn (npc, status);
5707 #undef FLD
5708 }
5709
5710 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
5711
5712 void
5713 sh5_compact_sem_tstb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5714         sh5_compact::write_stacks &buf)
5715 {
5716 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5717   sem_status status = SEM_STATUS_NORMAL;
5718   sh5_compact_scache* abuf = sem;
5719   unsigned long long written = 0;
5720   PCADDR pc = abuf->addr;
5721   PCADDR npc = pc + 2;
5722
5723 {
5724   DI tmp_addr;
5725   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5726   {
5727     BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5728     if (UNLIKELY(current_cpu->trace_result_p))
5729       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
5730     current_cpu->h_tbit_set (opval);
5731   }
5732 }
5733
5734   current_cpu->done_insn (npc, status);
5735 #undef FLD
5736 }
5737
5738 // ********** xor-compact: xor $rm64, $rn64
5739
5740 void
5741 sh5_compact_sem_xor_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5742         sh5_compact::write_stacks &buf)
5743 {
5744 #define FLD(f) abuf->fields.sfmt_and_compact.f
5745   sem_status status = SEM_STATUS_NORMAL;
5746   sh5_compact_scache* abuf = sem;
5747   unsigned long long written = 0;
5748   PCADDR pc = abuf->addr;
5749   PCADDR npc = pc + 2;
5750
5751   {
5752     DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
5753     if (UNLIKELY(current_cpu->trace_result_p))
5754       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5755     current_cpu->h_gr_set (FLD (f_rn), opval);
5756   }
5757
5758   current_cpu->done_insn (npc, status);
5759 #undef FLD
5760 }
5761
5762 // ********** xori-compact: xor #$uimm8, r0
5763
5764 void
5765 sh5_compact_sem_xori_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5766         sh5_compact::write_stacks &buf)
5767 {
5768 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5769   sem_status status = SEM_STATUS_NORMAL;
5770   sh5_compact_scache* abuf = sem;
5771   unsigned long long written = 0;
5772   PCADDR pc = abuf->addr;
5773   PCADDR npc = pc + 2;
5774
5775   {
5776     SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5777     if (UNLIKELY(current_cpu->trace_result_p))
5778       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
5779     current_cpu->h_grc_set (((UINT) 0), opval);
5780   }
5781
5782   current_cpu->done_insn (npc, status);
5783 #undef FLD
5784 }
5785
5786 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
5787
5788 void
5789 sh5_compact_sem_xorb_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5790         sh5_compact::write_stacks &buf)
5791 {
5792 #define FLD(f) abuf->fields.sfmt_andi_compact.f
5793   sem_status status = SEM_STATUS_NORMAL;
5794   sh5_compact_scache* abuf = sem;
5795   unsigned long long written = 0;
5796   PCADDR pc = abuf->addr;
5797   PCADDR npc = pc + 2;
5798
5799 {
5800   DI tmp_addr;
5801   UQI tmp_data;
5802   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
5803   tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
5804   {
5805     UQI opval = tmp_data;
5806     if (UNLIKELY(current_cpu->trace_result_p))
5807       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
5808     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
5809   }
5810 }
5811
5812   current_cpu->done_insn (npc, status);
5813 #undef FLD
5814 }
5815
5816 // ********** xtrct-compact: xtrct $rm, $rn
5817
5818 void
5819 sh5_compact_sem_xtrct_compact (sh5_cpu* current_cpu, sh5_compact_scache* sem, const int tick, 
5820         sh5_compact::write_stacks &buf)
5821 {
5822 #define FLD(f) abuf->fields.sfmt_macl_compact.f
5823   sem_status status = SEM_STATUS_NORMAL;
5824   sh5_compact_scache* abuf = sem;
5825   unsigned long long written = 0;
5826   PCADDR pc = abuf->addr;
5827   PCADDR npc = pc + 2;
5828
5829   {
5830     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
5831     if (UNLIKELY(current_cpu->trace_result_p))
5832       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
5833     current_cpu->h_grc_set (FLD (f_rn), opval);
5834   }
5835
5836   current_cpu->done_insn (npc, status);
5837 #undef FLD
5838 }
5839