OSDN Git Service

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