OSDN Git Service

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