OSDN Git Service

ab1df0299860dd5949c5efa129b7b110298ad259
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / cgen-cpu / sh / sh4al-sem.cxx
1 /* Simulator instruction semantics for sh4al.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright (C) 2000-2009 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 "sh4al.h"
17
18 using namespace sh4al; // FIXME: namespace organization still wip
19 using namespace sh4al; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
21
22
23 // ********** x-invalid: --invalid--
24
25 void
26 sh4al_sem_x_invalid (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
27         sh4al::write_stacks &buf)
28 {
29 #define FLD(f) abuf->fields.fmt_empty.f
30   sem_status status = SEM_STATUS_NORMAL;
31   sh4al_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 sh4al_sem_add_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
50         sh4al::write_stacks &buf)
51 {
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53   sem_status status = SEM_STATUS_NORMAL;
54   sh4al_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 sh4al_sem_addi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
74         sh4al::write_stacks &buf)
75 {
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77   sem_status status = SEM_STATUS_NORMAL;
78   sh4al_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 sh4al_sem_addc_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
98         sh4al::write_stacks &buf)
99 {
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101   sem_status status = SEM_STATUS_NORMAL;
102   sh4al_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 sh4al_sem_addv_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
132         sh4al::write_stacks &buf)
133 {
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135   sem_status status = SEM_STATUS_NORMAL;
136   sh4al_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 sh4al_sem_and_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
166         sh4al::write_stacks &buf)
167 {
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169   sem_status status = SEM_STATUS_NORMAL;
170   sh4al_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 sh4al_sem_andi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
190         sh4al::write_stacks &buf)
191 {
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193   sem_status status = SEM_STATUS_NORMAL;
194   sh4al_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 sh4al_sem_andb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
214         sh4al::write_stacks &buf)
215 {
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217   sem_status status = SEM_STATUS_NORMAL;
218   sh4al_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 sh4al_sem_bf_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
244         sh4al::write_stacks &buf)
245 {
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247   sem_status status = SEM_STATUS_NORMAL;
248   sh4al_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 sh4al_sem_bfs_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
272         sh4al::write_stacks &buf)
273 {
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275   sem_status status = SEM_STATUS_NORMAL;
276   sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bra_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
309         sh4al::write_stacks &buf)
310 {
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312   sem_status status = SEM_STATUS_NORMAL;
313   sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_braf_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
342         sh4al::write_stacks &buf)
343 {
344 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
345   sem_status status = SEM_STATUS_NORMAL;
346   sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bsr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
375         sh4al::write_stacks &buf)
376 {
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378   sem_status status = SEM_STATUS_NORMAL;
379   sh4al_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) % sh4al::pipe_sz].push (sh4al::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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bsrf_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
414         sh4al::write_stacks &buf)
415 {
416 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
417   sem_status status = SEM_STATUS_NORMAL;
418   sh4al_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) % sh4al::pipe_sz].push (sh4al::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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_bt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
453         sh4al::write_stacks &buf)
454 {
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456   sem_status status = SEM_STATUS_NORMAL;
457   sh4al_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 sh4al_sem_bts_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
481         sh4al::write_stacks &buf)
482 {
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484   sem_status status = SEM_STATUS_NORMAL;
485   sh4al_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) % sh4al::pipe_sz].push (sh4al::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 sh4al_sem_clrmac_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
518         sh4al::write_stacks &buf)
519 {
520 #define FLD(f) abuf->fields.fmt_empty.f
521   sem_status status = SEM_STATUS_NORMAL;
522   sh4al_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 sh4al_sem_clrs_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
550         sh4al::write_stacks &buf)
551 {
552 #define FLD(f) abuf->fields.fmt_empty.f
553   sem_status status = SEM_STATUS_NORMAL;
554   sh4al_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 sh4al_sem_clrt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
574         sh4al::write_stacks &buf)
575 {
576 #define FLD(f) abuf->fields.fmt_empty.f
577   sem_status status = SEM_STATUS_NORMAL;
578   sh4al_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 sh4al_sem_cmpeq_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
598         sh4al::write_stacks &buf)
599 {
600 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
601   sem_status status = SEM_STATUS_NORMAL;
602   sh4al_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 sh4al_sem_cmpeqi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
622         sh4al::write_stacks &buf)
623 {
624 #define FLD(f) abuf->fields.sfmt_andi_compact.f
625   sem_status status = SEM_STATUS_NORMAL;
626   sh4al_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 sh4al_sem_cmpge_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
646         sh4al::write_stacks &buf)
647 {
648 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
649   sem_status status = SEM_STATUS_NORMAL;
650   sh4al_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 sh4al_sem_cmpgt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
670         sh4al::write_stacks &buf)
671 {
672 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
673   sem_status status = SEM_STATUS_NORMAL;
674   sh4al_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 sh4al_sem_cmphi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
694         sh4al::write_stacks &buf)
695 {
696 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
697   sem_status status = SEM_STATUS_NORMAL;
698   sh4al_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 sh4al_sem_cmphs_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
718         sh4al::write_stacks &buf)
719 {
720 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
721   sem_status status = SEM_STATUS_NORMAL;
722   sh4al_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 sh4al_sem_cmppl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
742         sh4al::write_stacks &buf)
743 {
744 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
745   sem_status status = SEM_STATUS_NORMAL;
746   sh4al_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 sh4al_sem_cmppz_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
766         sh4al::write_stacks &buf)
767 {
768 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
769   sem_status status = SEM_STATUS_NORMAL;
770   sh4al_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 sh4al_sem_cmpstr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
790         sh4al::write_stacks &buf)
791 {
792 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
793   sem_status status = SEM_STATUS_NORMAL;
794   sh4al_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 sh4al_sem_div0s_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
823         sh4al::write_stacks &buf)
824 {
825 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
826   sem_status status = SEM_STATUS_NORMAL;
827   sh4al_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 sh4al_sem_div0u_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
861         sh4al::write_stacks &buf)
862 {
863 #define FLD(f) abuf->fields.fmt_empty.f
864   sem_status status = SEM_STATUS_NORMAL;
865   sh4al_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 sh4al_sem_div1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
899         sh4al::write_stacks &buf)
900 {
901 #define FLD(f) abuf->fields.sfmt_macl_compact.f
902   sem_status status = SEM_STATUS_NORMAL;
903   sh4al_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 sh4al_sem_dmulsl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1050         sh4al::write_stacks &buf)
1051 {
1052 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1053   sem_status status = SEM_STATUS_NORMAL;
1054   sh4al_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 sh4al_sem_dmulul_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1084         sh4al::write_stacks &buf)
1085 {
1086 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1087   sem_status status = SEM_STATUS_NORMAL;
1088   sh4al_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 sh4al_sem_dt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1118         sh4al::write_stacks &buf)
1119 {
1120 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1121   sem_status status = SEM_STATUS_NORMAL;
1122   sh4al_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 sh4al_sem_extsb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1150         sh4al::write_stacks &buf)
1151 {
1152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1153   sem_status status = SEM_STATUS_NORMAL;
1154   sh4al_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 sh4al_sem_extsw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1174         sh4al::write_stacks &buf)
1175 {
1176 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1177   sem_status status = SEM_STATUS_NORMAL;
1178   sh4al_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 sh4al_sem_extub_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1198         sh4al::write_stacks &buf)
1199 {
1200 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1201   sem_status status = SEM_STATUS_NORMAL;
1202   sh4al_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 sh4al_sem_extuw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1222         sh4al::write_stacks &buf)
1223 {
1224 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1225   sem_status status = SEM_STATUS_NORMAL;
1226   sh4al_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 // ********** frchg-compact: frchg
1243
1244 void
1245 sh4al_sem_frchg_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1246         sh4al::write_stacks &buf)
1247 {
1248 #define FLD(f) abuf->fields.fmt_empty.f
1249   sem_status status = SEM_STATUS_NORMAL;
1250   sh4al_scache* abuf = sem;
1251   unsigned long long written = 0;
1252   PCADDR pc = abuf->addr;
1253   PCADDR npc = pc + 2;
1254
1255   {
1256     BI opval = NOTBI (current_cpu->h_frbit_get ());
1257     if (UNLIKELY(current_cpu->trace_result_p))
1258       current_cpu->trace_stream << "frbit" << ":=0x" << hex << opval << dec << "  ";
1259     current_cpu->h_frbit_set (opval);
1260   }
1261
1262   current_cpu->done_insn (npc, status);
1263 #undef FLD
1264 }
1265
1266 // ********** fschg-compact: fschg
1267
1268 void
1269 sh4al_sem_fschg_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1270         sh4al::write_stacks &buf)
1271 {
1272 #define FLD(f) abuf->fields.fmt_empty.f
1273   sem_status status = SEM_STATUS_NORMAL;
1274   sh4al_scache* abuf = sem;
1275   unsigned long long written = 0;
1276   PCADDR pc = abuf->addr;
1277   PCADDR npc = pc + 2;
1278
1279   {
1280     BI opval = NOTBI (current_cpu->h_szbit_get ());
1281     if (UNLIKELY(current_cpu->trace_result_p))
1282       current_cpu->trace_stream << "szbit" << ":=0x" << hex << opval << dec << "  ";
1283     current_cpu->h_szbit_set (opval);
1284   }
1285
1286   current_cpu->done_insn (npc, status);
1287 #undef FLD
1288 }
1289
1290 // ********** jmp-compact: jmp @$rn
1291
1292 void
1293 sh4al_sem_jmp_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1294         sh4al::write_stacks &buf)
1295 {
1296 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1297   sem_status status = SEM_STATUS_NORMAL;
1298   sh4al_scache* abuf = sem;
1299   unsigned long long written = 0;
1300   PCADDR pc = abuf->addr;
1301   PCADDR npc = pc + 2;
1302
1303 {
1304   {
1305     UDI opval = ADDDI (pc, 2);
1306     if (UNLIKELY(current_cpu->trace_result_p))
1307       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1308     current_cpu->branch (opval, npc, status);
1309   }
1310 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1311   {
1312     UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1313     buf.h_pc_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<UDI>(pc, opval));
1314     if (UNLIKELY(current_cpu->trace_result_p))
1315       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1316   }
1317 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1318 }
1319
1320   current_cpu->done_cti_insn (npc, status);
1321 #undef FLD
1322 }
1323
1324 // ********** jsr-compact: jsr @$rn
1325
1326 void
1327 sh4al_sem_jsr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1328         sh4al::write_stacks &buf)
1329 {
1330 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1331   sem_status status = SEM_STATUS_NORMAL;
1332   sh4al_scache* abuf = sem;
1333   unsigned long long written = 0;
1334   PCADDR pc = abuf->addr;
1335   PCADDR npc = pc + 2;
1336
1337 {
1338   {
1339     SI opval = ADDDI (pc, 4);
1340     buf.h_pr_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<SI>(pc, opval));
1341     if (UNLIKELY(current_cpu->trace_result_p))
1342       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
1343   }
1344   {
1345     UDI opval = ADDDI (pc, 2);
1346     if (UNLIKELY(current_cpu->trace_result_p))
1347       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1348     current_cpu->branch (opval, npc, status);
1349   }
1350 current_cpu->save_delayed_pc (current_cpu->h_grc_get (FLD (f_rn)));
1351   {
1352     UDI opval = current_cpu->h_grc_get (FLD (f_rn));
1353     buf.h_pc_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<UDI>(pc, opval));
1354     if (UNLIKELY(current_cpu->trace_result_p))
1355       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
1356   }
1357 current_cpu->cg_profile (pc, current_cpu->h_grc_get (FLD (f_rn)));
1358 }
1359
1360   current_cpu->done_cti_insn (npc, status);
1361 #undef FLD
1362 }
1363
1364 // ********** ldc-gbr-compact: ldc $rn, gbr
1365
1366 void
1367 sh4al_sem_ldc_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1368         sh4al::write_stacks &buf)
1369 {
1370 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1371   sem_status status = SEM_STATUS_NORMAL;
1372   sh4al_scache* abuf = sem;
1373   unsigned long long written = 0;
1374   PCADDR pc = abuf->addr;
1375   PCADDR npc = pc + 2;
1376
1377   {
1378     SI opval = current_cpu->h_grc_get (FLD (f_rn));
1379     if (UNLIKELY(current_cpu->trace_result_p))
1380       current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << "  ";
1381     current_cpu->h_gbr_set (opval);
1382   }
1383
1384   current_cpu->done_insn (npc, status);
1385 #undef FLD
1386 }
1387
1388 // ********** ldc-vbr-compact: ldc $rn, vbr
1389
1390 void
1391 sh4al_sem_ldc_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1392         sh4al::write_stacks &buf)
1393 {
1394 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1395   sem_status status = SEM_STATUS_NORMAL;
1396   sh4al_scache* abuf = sem;
1397   unsigned long long written = 0;
1398   PCADDR pc = abuf->addr;
1399   PCADDR npc = pc + 2;
1400
1401   {
1402     SI opval = current_cpu->h_grc_get (FLD (f_rn));
1403     if (UNLIKELY(current_cpu->trace_result_p))
1404       current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << "  ";
1405     current_cpu->h_vbr_set (opval);
1406   }
1407
1408   current_cpu->done_insn (npc, status);
1409 #undef FLD
1410 }
1411
1412 // ********** ldc-sr-compact: ldc $rn, sr
1413
1414 void
1415 sh4al_sem_ldc_sr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1416         sh4al::write_stacks &buf)
1417 {
1418 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1419   sem_status status = SEM_STATUS_NORMAL;
1420   sh4al_scache* abuf = sem;
1421   unsigned long long written = 0;
1422   PCADDR pc = abuf->addr;
1423   PCADDR npc = pc + 2;
1424
1425   {
1426     SI opval = current_cpu->h_grc_get (FLD (f_rn));
1427     if (UNLIKELY(current_cpu->trace_result_p))
1428       current_cpu->trace_stream << "sr" << ":=0x" << hex << opval << dec << "  ";
1429     current_cpu->hardware.h_sr = opval;
1430   }
1431
1432   current_cpu->done_insn (npc, status);
1433 #undef FLD
1434 }
1435
1436 // ********** ldcl-gbr-compact: ldc.l @${rn}+, gbr
1437
1438 void
1439 sh4al_sem_ldcl_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1440         sh4al::write_stacks &buf)
1441 {
1442 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1443   sem_status status = SEM_STATUS_NORMAL;
1444   sh4al_scache* abuf = sem;
1445   unsigned long long written = 0;
1446   PCADDR pc = abuf->addr;
1447   PCADDR npc = pc + 2;
1448
1449 {
1450   {
1451     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1452     if (UNLIKELY(current_cpu->trace_result_p))
1453       current_cpu->trace_stream << "gbr" << ":=0x" << hex << opval << dec << "  ";
1454     current_cpu->h_gbr_set (opval);
1455   }
1456   {
1457     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1458     if (UNLIKELY(current_cpu->trace_result_p))
1459       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1460     current_cpu->h_grc_set (FLD (f_rn), opval);
1461   }
1462 }
1463
1464   current_cpu->done_insn (npc, status);
1465 #undef FLD
1466 }
1467
1468 // ********** ldcl-vbr-compact: ldc.l @${rn}+, vbr
1469
1470 void
1471 sh4al_sem_ldcl_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1472         sh4al::write_stacks &buf)
1473 {
1474 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1475   sem_status status = SEM_STATUS_NORMAL;
1476   sh4al_scache* abuf = sem;
1477   unsigned long long written = 0;
1478   PCADDR pc = abuf->addr;
1479   PCADDR npc = pc + 2;
1480
1481 {
1482   {
1483     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1484     if (UNLIKELY(current_cpu->trace_result_p))
1485       current_cpu->trace_stream << "vbr" << ":=0x" << hex << opval << dec << "  ";
1486     current_cpu->h_vbr_set (opval);
1487   }
1488   {
1489     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1490     if (UNLIKELY(current_cpu->trace_result_p))
1491       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1492     current_cpu->h_grc_set (FLD (f_rn), opval);
1493   }
1494 }
1495
1496   current_cpu->done_insn (npc, status);
1497 #undef FLD
1498 }
1499
1500 // ********** lds-mach-compact: lds $rn, mach
1501
1502 void
1503 sh4al_sem_lds_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1504         sh4al::write_stacks &buf)
1505 {
1506 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1507   sem_status status = SEM_STATUS_NORMAL;
1508   sh4al_scache* abuf = sem;
1509   unsigned long long written = 0;
1510   PCADDR pc = abuf->addr;
1511   PCADDR npc = pc + 2;
1512
1513   {
1514     SI opval = current_cpu->h_grc_get (FLD (f_rn));
1515     if (UNLIKELY(current_cpu->trace_result_p))
1516       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
1517     current_cpu->h_mach_set (opval);
1518   }
1519
1520   current_cpu->done_insn (npc, status);
1521 #undef FLD
1522 }
1523
1524 // ********** ldsl-mach-compact: lds.l @${rn}+, mach
1525
1526 void
1527 sh4al_sem_ldsl_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1528         sh4al::write_stacks &buf)
1529 {
1530 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1531   sem_status status = SEM_STATUS_NORMAL;
1532   sh4al_scache* abuf = sem;
1533   unsigned long long written = 0;
1534   PCADDR pc = abuf->addr;
1535   PCADDR npc = pc + 2;
1536
1537 {
1538   {
1539     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1540     if (UNLIKELY(current_cpu->trace_result_p))
1541       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
1542     current_cpu->h_mach_set (opval);
1543   }
1544   {
1545     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1546     if (UNLIKELY(current_cpu->trace_result_p))
1547       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1548     current_cpu->h_grc_set (FLD (f_rn), opval);
1549   }
1550 }
1551
1552   current_cpu->done_insn (npc, status);
1553 #undef FLD
1554 }
1555
1556 // ********** lds-macl-compact: lds $rn, macl
1557
1558 void
1559 sh4al_sem_lds_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1560         sh4al::write_stacks &buf)
1561 {
1562 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1563   sem_status status = SEM_STATUS_NORMAL;
1564   sh4al_scache* abuf = sem;
1565   unsigned long long written = 0;
1566   PCADDR pc = abuf->addr;
1567   PCADDR npc = pc + 2;
1568
1569   {
1570     SI opval = current_cpu->h_grc_get (FLD (f_rn));
1571     if (UNLIKELY(current_cpu->trace_result_p))
1572       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
1573     current_cpu->h_macl_set (opval);
1574   }
1575
1576   current_cpu->done_insn (npc, status);
1577 #undef FLD
1578 }
1579
1580 // ********** ldsl-macl-compact: lds.l @${rn}+, macl
1581
1582 void
1583 sh4al_sem_ldsl_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1584         sh4al::write_stacks &buf)
1585 {
1586 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1587   sem_status status = SEM_STATUS_NORMAL;
1588   sh4al_scache* abuf = sem;
1589   unsigned long long written = 0;
1590   PCADDR pc = abuf->addr;
1591   PCADDR npc = pc + 2;
1592
1593 {
1594   {
1595     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1596     if (UNLIKELY(current_cpu->trace_result_p))
1597       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
1598     current_cpu->h_macl_set (opval);
1599   }
1600   {
1601     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1602     if (UNLIKELY(current_cpu->trace_result_p))
1603       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1604     current_cpu->h_grc_set (FLD (f_rn), opval);
1605   }
1606 }
1607
1608   current_cpu->done_insn (npc, status);
1609 #undef FLD
1610 }
1611
1612 // ********** lds-pr-compact: lds $rn, pr
1613
1614 void
1615 sh4al_sem_lds_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1616         sh4al::write_stacks &buf)
1617 {
1618 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1619   sem_status status = SEM_STATUS_NORMAL;
1620   sh4al_scache* abuf = sem;
1621   unsigned long long written = 0;
1622   PCADDR pc = abuf->addr;
1623   PCADDR npc = pc + 2;
1624
1625   {
1626     SI opval = current_cpu->h_grc_get (FLD (f_rn));
1627     if (UNLIKELY(current_cpu->trace_result_p))
1628       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
1629     current_cpu->h_pr_set (opval);
1630   }
1631
1632   current_cpu->done_insn (npc, status);
1633 #undef FLD
1634 }
1635
1636 // ********** ldsl-pr-compact: lds.l @${rn}+, pr
1637
1638 void
1639 sh4al_sem_ldsl_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1640         sh4al::write_stacks &buf)
1641 {
1642 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
1643   sem_status status = SEM_STATUS_NORMAL;
1644   sh4al_scache* abuf = sem;
1645   unsigned long long written = 0;
1646   PCADDR pc = abuf->addr;
1647   PCADDR npc = pc + 2;
1648
1649 {
1650   {
1651     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1652     if (UNLIKELY(current_cpu->trace_result_p))
1653       current_cpu->trace_stream << "pr" << ":=0x" << hex << opval << dec << "  ";
1654     current_cpu->h_pr_set (opval);
1655   }
1656   {
1657     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1658     if (UNLIKELY(current_cpu->trace_result_p))
1659       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1660     current_cpu->h_grc_set (FLD (f_rn), opval);
1661   }
1662 }
1663
1664   current_cpu->done_insn (npc, status);
1665 #undef FLD
1666 }
1667
1668 // ********** macl-compact: mac.l @${rm}+, @${rn}+
1669
1670 void
1671 sh4al_sem_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1672         sh4al::write_stacks &buf)
1673 {
1674 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1675   sem_status status = SEM_STATUS_NORMAL;
1676   sh4al_scache* abuf = sem;
1677   unsigned long long written = 0;
1678   PCADDR pc = abuf->addr;
1679   PCADDR npc = pc + 2;
1680
1681 {
1682   DI tmp_tmpry;
1683   DI tmp_mac;
1684   DI tmp_result;
1685   SI tmp_x;
1686   SI tmp_y;
1687   tmp_x = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1688   {
1689     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1690     if (UNLIKELY(current_cpu->trace_result_p))
1691       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1692     current_cpu->h_grc_set (FLD (f_rn), opval);
1693   }
1694 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1695 {
1696   {
1697     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
1698     if (UNLIKELY(current_cpu->trace_result_p))
1699       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1700     current_cpu->h_grc_set (FLD (f_rn), opval);
1701   }
1702   {
1703     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1704     written |= (1ULL << 11);
1705     if (UNLIKELY(current_cpu->trace_result_p))
1706       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
1707     current_cpu->h_grc_set (FLD (f_rm), opval);
1708   }
1709 }
1710 }
1711   tmp_y = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1712   {
1713     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
1714     written |= (1ULL << 11);
1715     if (UNLIKELY(current_cpu->trace_result_p))
1716       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
1717     current_cpu->h_grc_set (FLD (f_rm), opval);
1718   }
1719   tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
1720   tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1721   tmp_result = ADDDI (tmp_mac, tmp_tmpry);
1722 {
1723 if (current_cpu->h_sbit_get ()) {
1724 {
1725   SI tmp_min;
1726   SI tmp_max;
1727   tmp_max = SRLDI (INVDI (0), 16);
1728   tmp_min = SRLDI (INVDI (0), 15);
1729 if (GTDI (tmp_result, tmp_max)) {
1730   tmp_result = tmp_max;
1731 } else {
1732 if (LTDI (tmp_result, tmp_min)) {
1733   tmp_result = tmp_min;
1734 }
1735 }
1736 }
1737 }
1738   {
1739     SI opval = SUBWORDDISI (tmp_result, 0);
1740     if (UNLIKELY(current_cpu->trace_result_p))
1741       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
1742     current_cpu->h_mach_set (opval);
1743   }
1744   {
1745     SI opval = SUBWORDDISI (tmp_result, 1);
1746     if (UNLIKELY(current_cpu->trace_result_p))
1747       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
1748     current_cpu->h_macl_set (opval);
1749   }
1750 }
1751 }
1752
1753   abuf->written = written;
1754   current_cpu->done_insn (npc, status);
1755 #undef FLD
1756 }
1757
1758 // ********** macw-compact: mac.w @${rm}+, @${rn}+
1759
1760 void
1761 sh4al_sem_macw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1762         sh4al::write_stacks &buf)
1763 {
1764 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1765   sem_status status = SEM_STATUS_NORMAL;
1766   sh4al_scache* abuf = sem;
1767   unsigned long long written = 0;
1768   PCADDR pc = abuf->addr;
1769   PCADDR npc = pc + 2;
1770
1771 {
1772   SI tmp_tmpry;
1773   DI tmp_mac;
1774   DI tmp_result;
1775   HI tmp_x;
1776   HI tmp_y;
1777   tmp_x = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)));
1778   {
1779     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1780     if (UNLIKELY(current_cpu->trace_result_p))
1781       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1782     current_cpu->h_grc_set (FLD (f_rn), opval);
1783   }
1784 if (EQSI (FLD (f_rn), FLD (f_rm))) {
1785 {
1786   {
1787     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
1788     if (UNLIKELY(current_cpu->trace_result_p))
1789       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1790     current_cpu->h_grc_set (FLD (f_rn), opval);
1791   }
1792   {
1793     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1794     written |= (1ULL << 11);
1795     if (UNLIKELY(current_cpu->trace_result_p))
1796       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
1797     current_cpu->h_grc_set (FLD (f_rm), opval);
1798   }
1799 }
1800 }
1801   tmp_y = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
1802   {
1803     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
1804     written |= (1ULL << 11);
1805     if (UNLIKELY(current_cpu->trace_result_p))
1806       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
1807     current_cpu->h_grc_set (FLD (f_rm), opval);
1808   }
1809   tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
1810 if (current_cpu->h_sbit_get ()) {
1811 {
1812 if (ADDOFSI (tmp_tmpry, current_cpu->h_macl_get (), 0)) {
1813   {
1814     SI opval = 1;
1815     written |= (1ULL << 9);
1816     if (UNLIKELY(current_cpu->trace_result_p))
1817       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
1818     current_cpu->h_mach_set (opval);
1819   }
1820 }
1821   {
1822     SI opval = ADDSI (tmp_tmpry, current_cpu->h_macl_get ());
1823     written |= (1ULL << 10);
1824     if (UNLIKELY(current_cpu->trace_result_p))
1825       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
1826     current_cpu->h_macl_set (opval);
1827   }
1828 }
1829 } else {
1830 {
1831   tmp_mac = ORDI (SLLDI (ZEXTSIDI (current_cpu->h_mach_get ()), 32), ZEXTSIDI (current_cpu->h_macl_get ()));
1832   tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
1833   {
1834     SI opval = SUBWORDDISI (tmp_result, 0);
1835     written |= (1ULL << 9);
1836     if (UNLIKELY(current_cpu->trace_result_p))
1837       current_cpu->trace_stream << "mach" << ":=0x" << hex << opval << dec << "  ";
1838     current_cpu->h_mach_set (opval);
1839   }
1840   {
1841     SI opval = SUBWORDDISI (tmp_result, 1);
1842     written |= (1ULL << 10);
1843     if (UNLIKELY(current_cpu->trace_result_p))
1844       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
1845     current_cpu->h_macl_set (opval);
1846   }
1847 }
1848 }
1849 }
1850
1851   abuf->written = written;
1852   current_cpu->done_insn (npc, status);
1853 #undef FLD
1854 }
1855
1856 // ********** mov-compact: mov $rm64, $rn64
1857
1858 void
1859 sh4al_sem_mov_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1860         sh4al::write_stacks &buf)
1861 {
1862 #define FLD(f) abuf->fields.sfmt_and_compact.f
1863   sem_status status = SEM_STATUS_NORMAL;
1864   sh4al_scache* abuf = sem;
1865   unsigned long long written = 0;
1866   PCADDR pc = abuf->addr;
1867   PCADDR npc = pc + 2;
1868
1869   {
1870     DI opval = current_cpu->h_gr_get (FLD (f_rm));
1871     if (UNLIKELY(current_cpu->trace_result_p))
1872       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1873     current_cpu->h_gr_set (FLD (f_rn), opval);
1874   }
1875
1876   current_cpu->done_insn (npc, status);
1877 #undef FLD
1878 }
1879
1880 // ********** movi-compact: mov #$imm8, $rn
1881
1882 void
1883 sh4al_sem_movi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1884         sh4al::write_stacks &buf)
1885 {
1886 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1887   sem_status status = SEM_STATUS_NORMAL;
1888   sh4al_scache* abuf = sem;
1889   unsigned long long written = 0;
1890   PCADDR pc = abuf->addr;
1891   PCADDR npc = pc + 2;
1892
1893   {
1894     SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
1895     if (UNLIKELY(current_cpu->trace_result_p))
1896       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1897     current_cpu->h_grc_set (FLD (f_rn), opval);
1898   }
1899
1900   current_cpu->done_insn (npc, status);
1901 #undef FLD
1902 }
1903
1904 // ********** movb1-compact: mov.b $rm, @$rn
1905
1906 void
1907 sh4al_sem_movb1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1908         sh4al::write_stacks &buf)
1909 {
1910 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1911   sem_status status = SEM_STATUS_NORMAL;
1912   sh4al_scache* abuf = sem;
1913   unsigned long long written = 0;
1914   PCADDR pc = abuf->addr;
1915   PCADDR npc = pc + 2;
1916
1917   {
1918     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1919     if (UNLIKELY(current_cpu->trace_result_p))
1920       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
1921     current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
1922   }
1923
1924   current_cpu->done_insn (npc, status);
1925 #undef FLD
1926 }
1927
1928 // ********** movb2-compact: mov.b $rm, @-$rn
1929
1930 void
1931 sh4al_sem_movb2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1932         sh4al::write_stacks &buf)
1933 {
1934 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1935   sem_status status = SEM_STATUS_NORMAL;
1936   sh4al_scache* abuf = sem;
1937   unsigned long long written = 0;
1938   PCADDR pc = abuf->addr;
1939   PCADDR npc = pc + 2;
1940
1941 {
1942   DI tmp_addr;
1943   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
1944   {
1945     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1946     if (UNLIKELY(current_cpu->trace_result_p))
1947       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
1948     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
1949   }
1950   {
1951     SI opval = tmp_addr;
1952     if (UNLIKELY(current_cpu->trace_result_p))
1953       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
1954     current_cpu->h_grc_set (FLD (f_rn), opval);
1955   }
1956 }
1957
1958   current_cpu->done_insn (npc, status);
1959 #undef FLD
1960 }
1961
1962 // ********** movb3-compact: mov.b $rm, @(r0,$rn)
1963
1964 void
1965 sh4al_sem_movb3_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1966         sh4al::write_stacks &buf)
1967 {
1968 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
1969   sem_status status = SEM_STATUS_NORMAL;
1970   sh4al_scache* abuf = sem;
1971   unsigned long long written = 0;
1972   PCADDR pc = abuf->addr;
1973   PCADDR npc = pc + 2;
1974
1975   {
1976     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
1977     if (UNLIKELY(current_cpu->trace_result_p))
1978       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 << "  ";
1979     current_cpu->SETMEMUQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
1980   }
1981
1982   current_cpu->done_insn (npc, status);
1983 #undef FLD
1984 }
1985
1986 // ********** movb4-compact: mov.b r0, @($imm8, gbr)
1987
1988 void
1989 sh4al_sem_movb4_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
1990         sh4al::write_stacks &buf)
1991 {
1992 #define FLD(f) abuf->fields.sfmt_andi_compact.f
1993   sem_status status = SEM_STATUS_NORMAL;
1994   sh4al_scache* abuf = sem;
1995   unsigned long long written = 0;
1996   PCADDR pc = abuf->addr;
1997   PCADDR npc = pc + 2;
1998
1999 {
2000   DI tmp_addr;
2001   tmp_addr = ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8));
2002   {
2003     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2004     if (UNLIKELY(current_cpu->trace_result_p))
2005       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
2006     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2007   }
2008 }
2009
2010   current_cpu->done_insn (npc, status);
2011 #undef FLD
2012 }
2013
2014 // ********** movb5-compact: mov.b r0, @($imm4, $rm)
2015
2016 void
2017 sh4al_sem_movb5_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2018         sh4al::write_stacks &buf)
2019 {
2020 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2021   sem_status status = SEM_STATUS_NORMAL;
2022   sh4al_scache* abuf = sem;
2023   unsigned long long written = 0;
2024   PCADDR pc = abuf->addr;
2025   PCADDR npc = pc + 2;
2026
2027 {
2028   DI tmp_addr;
2029   tmp_addr = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4));
2030   {
2031     UQI opval = SUBWORDSIUQI (current_cpu->h_grc_get (((UINT) 0)), 3);
2032     if (UNLIKELY(current_cpu->trace_result_p))
2033       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
2034     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
2035   }
2036 }
2037
2038   current_cpu->done_insn (npc, status);
2039 #undef FLD
2040 }
2041
2042 // ********** movb6-compact: mov.b @$rm, $rn
2043
2044 void
2045 sh4al_sem_movb6_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2046         sh4al::write_stacks &buf)
2047 {
2048 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2049   sem_status status = SEM_STATUS_NORMAL;
2050   sh4al_scache* abuf = sem;
2051   unsigned long long written = 0;
2052   PCADDR pc = abuf->addr;
2053   PCADDR npc = pc + 2;
2054
2055   {
2056     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2057     if (UNLIKELY(current_cpu->trace_result_p))
2058       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2059     current_cpu->h_grc_set (FLD (f_rn), opval);
2060   }
2061
2062   current_cpu->done_insn (npc, status);
2063 #undef FLD
2064 }
2065
2066 // ********** movb7-compact: mov.b @${rm}+, $rn
2067
2068 void
2069 sh4al_sem_movb7_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2070         sh4al::write_stacks &buf)
2071 {
2072 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2073   sem_status status = SEM_STATUS_NORMAL;
2074   sh4al_scache* abuf = sem;
2075   unsigned long long written = 0;
2076   PCADDR pc = abuf->addr;
2077   PCADDR npc = pc + 2;
2078
2079 {
2080   QI tmp_data;
2081   tmp_data = current_cpu->GETMEMQI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2082 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2083   {
2084     SI opval = EXTQISI (tmp_data);
2085     written |= (1ULL << 4);
2086     if (UNLIKELY(current_cpu->trace_result_p))
2087       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2088     current_cpu->h_grc_set (FLD (f_rm), opval);
2089   }
2090 } else {
2091   {
2092     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2093     written |= (1ULL << 4);
2094     if (UNLIKELY(current_cpu->trace_result_p))
2095       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2096     current_cpu->h_grc_set (FLD (f_rm), opval);
2097   }
2098 }
2099   {
2100     SI opval = EXTQISI (tmp_data);
2101     if (UNLIKELY(current_cpu->trace_result_p))
2102       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2103     current_cpu->h_grc_set (FLD (f_rn), opval);
2104   }
2105 }
2106
2107   abuf->written = written;
2108   current_cpu->done_insn (npc, status);
2109 #undef FLD
2110 }
2111
2112 // ********** movb8-compact: mov.b @(r0, $rm), $rn
2113
2114 void
2115 sh4al_sem_movb8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2116         sh4al::write_stacks &buf)
2117 {
2118 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2119   sem_status status = SEM_STATUS_NORMAL;
2120   sh4al_scache* abuf = sem;
2121   unsigned long long written = 0;
2122   PCADDR pc = abuf->addr;
2123   PCADDR npc = pc + 2;
2124
2125   {
2126     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2127     if (UNLIKELY(current_cpu->trace_result_p))
2128       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2129     current_cpu->h_grc_set (FLD (f_rn), opval);
2130   }
2131
2132   current_cpu->done_insn (npc, status);
2133 #undef FLD
2134 }
2135
2136 // ********** movb9-compact: mov.b @($imm8, gbr), r0
2137
2138 void
2139 sh4al_sem_movb9_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2140         sh4al::write_stacks &buf)
2141 {
2142 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2143   sem_status status = SEM_STATUS_NORMAL;
2144   sh4al_scache* abuf = sem;
2145   unsigned long long written = 0;
2146   PCADDR pc = abuf->addr;
2147   PCADDR npc = pc + 2;
2148
2149   {
2150     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8))));
2151     if (UNLIKELY(current_cpu->trace_result_p))
2152       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2153     current_cpu->h_grc_set (((UINT) 0), opval);
2154   }
2155
2156   current_cpu->done_insn (npc, status);
2157 #undef FLD
2158 }
2159
2160 // ********** movb10-compact: mov.b @($imm4, $rm), r0
2161
2162 void
2163 sh4al_sem_movb10_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2164         sh4al::write_stacks &buf)
2165 {
2166 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2167   sem_status status = SEM_STATUS_NORMAL;
2168   sh4al_scache* abuf = sem;
2169   unsigned long long written = 0;
2170   PCADDR pc = abuf->addr;
2171   PCADDR npc = pc + 2;
2172
2173   {
2174     SI opval = EXTQISI (current_cpu->GETMEMQI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4))));
2175     if (UNLIKELY(current_cpu->trace_result_p))
2176       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2177     current_cpu->h_grc_set (((UINT) 0), opval);
2178   }
2179
2180   current_cpu->done_insn (npc, status);
2181 #undef FLD
2182 }
2183
2184 // ********** movl1-compact: mov.l $rm, @$rn
2185
2186 void
2187 sh4al_sem_movl1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2188         sh4al::write_stacks &buf)
2189 {
2190 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2191   sem_status status = SEM_STATUS_NORMAL;
2192   sh4al_scache* abuf = sem;
2193   unsigned long long written = 0;
2194   PCADDR pc = abuf->addr;
2195   PCADDR npc = pc + 2;
2196
2197   {
2198     SI opval = current_cpu->h_grc_get (FLD (f_rm));
2199     if (UNLIKELY(current_cpu->trace_result_p))
2200       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2201     current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2202   }
2203
2204   current_cpu->done_insn (npc, status);
2205 #undef FLD
2206 }
2207
2208 // ********** movl2-compact: mov.l $rm, @-$rn
2209
2210 void
2211 sh4al_sem_movl2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2212         sh4al::write_stacks &buf)
2213 {
2214 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2215   sem_status status = SEM_STATUS_NORMAL;
2216   sh4al_scache* abuf = sem;
2217   unsigned long long written = 0;
2218   PCADDR pc = abuf->addr;
2219   PCADDR npc = pc + 2;
2220
2221 {
2222   SI tmp_addr;
2223   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2224   {
2225     SI opval = current_cpu->h_grc_get (FLD (f_rm));
2226     if (UNLIKELY(current_cpu->trace_result_p))
2227       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2228     current_cpu->SETMEMSI (pc, tmp_addr, opval);
2229   }
2230   {
2231     SI opval = tmp_addr;
2232     if (UNLIKELY(current_cpu->trace_result_p))
2233       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2234     current_cpu->h_grc_set (FLD (f_rn), opval);
2235   }
2236 }
2237
2238   current_cpu->done_insn (npc, status);
2239 #undef FLD
2240 }
2241
2242 // ********** movl3-compact: mov.l $rm, @(r0, $rn)
2243
2244 void
2245 sh4al_sem_movl3_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2246         sh4al::write_stacks &buf)
2247 {
2248 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2249   sem_status status = SEM_STATUS_NORMAL;
2250   sh4al_scache* abuf = sem;
2251   unsigned long long written = 0;
2252   PCADDR pc = abuf->addr;
2253   PCADDR npc = pc + 2;
2254
2255   {
2256     SI opval = current_cpu->h_grc_get (FLD (f_rm));
2257     if (UNLIKELY(current_cpu->trace_result_p))
2258       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 << "  ";
2259     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2260   }
2261
2262   current_cpu->done_insn (npc, status);
2263 #undef FLD
2264 }
2265
2266 // ********** movl4-compact: mov.l r0, @($imm8x4, gbr)
2267
2268 void
2269 sh4al_sem_movl4_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2270         sh4al::write_stacks &buf)
2271 {
2272 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
2273   sem_status status = SEM_STATUS_NORMAL;
2274   sh4al_scache* abuf = sem;
2275   unsigned long long written = 0;
2276   PCADDR pc = abuf->addr;
2277   PCADDR npc = pc + 2;
2278
2279   {
2280     SI opval = current_cpu->h_grc_get (((UINT) 0));
2281     if (UNLIKELY(current_cpu->trace_result_p))
2282       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2283     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)), opval);
2284   }
2285
2286   current_cpu->done_insn (npc, status);
2287 #undef FLD
2288 }
2289
2290 // ********** movl5-compact: mov.l $rm, @($imm4x4, $rn)
2291
2292 void
2293 sh4al_sem_movl5_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2294         sh4al::write_stacks &buf)
2295 {
2296 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2297   sem_status status = SEM_STATUS_NORMAL;
2298   sh4al_scache* abuf = sem;
2299   unsigned long long written = 0;
2300   PCADDR pc = abuf->addr;
2301   PCADDR npc = pc + 2;
2302
2303   {
2304     SI opval = current_cpu->h_grc_get (FLD (f_rm));
2305     if (UNLIKELY(current_cpu->trace_result_p))
2306       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2307     current_cpu->SETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rn)), FLD (f_imm4x4)), opval);
2308   }
2309
2310   current_cpu->done_insn (npc, status);
2311 #undef FLD
2312 }
2313
2314 // ********** movl6-compact: mov.l @$rm, $rn
2315
2316 void
2317 sh4al_sem_movl6_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2318         sh4al::write_stacks &buf)
2319 {
2320 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2321   sem_status status = SEM_STATUS_NORMAL;
2322   sh4al_scache* abuf = sem;
2323   unsigned long long written = 0;
2324   PCADDR pc = abuf->addr;
2325   PCADDR npc = pc + 2;
2326
2327   {
2328     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2329     if (UNLIKELY(current_cpu->trace_result_p))
2330       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2331     current_cpu->h_grc_set (FLD (f_rn), opval);
2332   }
2333
2334   current_cpu->done_insn (npc, status);
2335 #undef FLD
2336 }
2337
2338 // ********** movl7-compact: mov.l @${rm}+, $rn
2339
2340 void
2341 sh4al_sem_movl7_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2342         sh4al::write_stacks &buf)
2343 {
2344 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2345   sem_status status = SEM_STATUS_NORMAL;
2346   sh4al_scache* abuf = sem;
2347   unsigned long long written = 0;
2348   PCADDR pc = abuf->addr;
2349   PCADDR npc = pc + 2;
2350
2351 {
2352   {
2353     SI opval = current_cpu->GETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2354     if (UNLIKELY(current_cpu->trace_result_p))
2355       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2356     current_cpu->h_grc_set (FLD (f_rn), opval);
2357   }
2358 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2359   {
2360     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2361     written |= (1ULL << 5);
2362     if (UNLIKELY(current_cpu->trace_result_p))
2363       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2364     current_cpu->h_grc_set (FLD (f_rm), opval);
2365   }
2366 } else {
2367   {
2368     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 4);
2369     written |= (1ULL << 5);
2370     if (UNLIKELY(current_cpu->trace_result_p))
2371       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2372     current_cpu->h_grc_set (FLD (f_rm), opval);
2373   }
2374 }
2375 }
2376
2377   abuf->written = written;
2378   current_cpu->done_insn (npc, status);
2379 #undef FLD
2380 }
2381
2382 // ********** movl8-compact: mov.l @(r0, $rm), $rn
2383
2384 void
2385 sh4al_sem_movl8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2386         sh4al::write_stacks &buf)
2387 {
2388 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2389   sem_status status = SEM_STATUS_NORMAL;
2390   sh4al_scache* abuf = sem;
2391   unsigned long long written = 0;
2392   PCADDR pc = abuf->addr;
2393   PCADDR npc = pc + 2;
2394
2395   {
2396     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm))));
2397     if (UNLIKELY(current_cpu->trace_result_p))
2398       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2399     current_cpu->h_grc_set (FLD (f_rn), opval);
2400   }
2401
2402   current_cpu->done_insn (npc, status);
2403 #undef FLD
2404 }
2405
2406 // ********** movl9-compact: mov.l @($imm8x4, gbr), r0
2407
2408 void
2409 sh4al_sem_movl9_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2410         sh4al::write_stacks &buf)
2411 {
2412 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2413   sem_status status = SEM_STATUS_NORMAL;
2414   sh4al_scache* abuf = sem;
2415   unsigned long long written = 0;
2416   PCADDR pc = abuf->addr;
2417   PCADDR npc = pc + 2;
2418
2419   {
2420     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x4)));
2421     if (UNLIKELY(current_cpu->trace_result_p))
2422       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2423     current_cpu->h_grc_set (((UINT) 0), opval);
2424   }
2425
2426   current_cpu->done_insn (npc, status);
2427 #undef FLD
2428 }
2429
2430 // ********** movl10-compact: mov.l @($imm8x4, pc), $rn
2431
2432 void
2433 sh4al_sem_movl10_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2434         sh4al::write_stacks &buf)
2435 {
2436 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
2437   sem_status status = SEM_STATUS_NORMAL;
2438   sh4al_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->GETMEMSI (pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
2445     if (UNLIKELY(current_cpu->trace_result_p))
2446       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2447     current_cpu->h_grc_set (FLD (f_rn), opval);
2448   }
2449
2450   current_cpu->done_insn (npc, status);
2451 #undef FLD
2452 }
2453
2454 // ********** movl11-compact: mov.l @($imm4x4, $rm), $rn
2455
2456 void
2457 sh4al_sem_movl11_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2458         sh4al::write_stacks &buf)
2459 {
2460 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2461   sem_status status = SEM_STATUS_NORMAL;
2462   sh4al_scache* abuf = sem;
2463   unsigned long long written = 0;
2464   PCADDR pc = abuf->addr;
2465   PCADDR npc = pc + 2;
2466
2467   {
2468     SI opval = current_cpu->GETMEMSI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x4)));
2469     if (UNLIKELY(current_cpu->trace_result_p))
2470       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2471     current_cpu->h_grc_set (FLD (f_rn), opval);
2472   }
2473
2474   current_cpu->done_insn (npc, status);
2475 #undef FLD
2476 }
2477
2478 // ********** movw1-compact: mov.w $rm, @$rn
2479
2480 void
2481 sh4al_sem_movw1_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2482         sh4al::write_stacks &buf)
2483 {
2484 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2485   sem_status status = SEM_STATUS_NORMAL;
2486   sh4al_scache* abuf = sem;
2487   unsigned long long written = 0;
2488   PCADDR pc = abuf->addr;
2489   PCADDR npc = pc + 2;
2490
2491   {
2492     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2493     if (UNLIKELY(current_cpu->trace_result_p))
2494       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2495     current_cpu->SETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2496   }
2497
2498   current_cpu->done_insn (npc, status);
2499 #undef FLD
2500 }
2501
2502 // ********** movw2-compact: mov.w $rm, @-$rn
2503
2504 void
2505 sh4al_sem_movw2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2506         sh4al::write_stacks &buf)
2507 {
2508 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2509   sem_status status = SEM_STATUS_NORMAL;
2510   sh4al_scache* abuf = sem;
2511   unsigned long long written = 0;
2512   PCADDR pc = abuf->addr;
2513   PCADDR npc = pc + 2;
2514
2515 {
2516   DI tmp_addr;
2517   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
2518   {
2519     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2520     if (UNLIKELY(current_cpu->trace_result_p))
2521       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2522     current_cpu->SETMEMHI (pc, tmp_addr, opval);
2523   }
2524   {
2525     SI opval = tmp_addr;
2526     if (UNLIKELY(current_cpu->trace_result_p))
2527       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2528     current_cpu->h_grc_set (FLD (f_rn), opval);
2529   }
2530 }
2531
2532   current_cpu->done_insn (npc, status);
2533 #undef FLD
2534 }
2535
2536 // ********** movw3-compact: mov.w $rm, @(r0, $rn)
2537
2538 void
2539 sh4al_sem_movw3_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2540         sh4al::write_stacks &buf)
2541 {
2542 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2543   sem_status status = SEM_STATUS_NORMAL;
2544   sh4al_scache* abuf = sem;
2545   unsigned long long written = 0;
2546   PCADDR pc = abuf->addr;
2547   PCADDR npc = pc + 2;
2548
2549   {
2550     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 1);
2551     if (UNLIKELY(current_cpu->trace_result_p))
2552       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 << "  ";
2553     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rn))), opval);
2554   }
2555
2556   current_cpu->done_insn (npc, status);
2557 #undef FLD
2558 }
2559
2560 // ********** movw4-compact: mov.w r0, @($imm8x2, gbr)
2561
2562 void
2563 sh4al_sem_movw4_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2564         sh4al::write_stacks &buf)
2565 {
2566 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
2567   sem_status status = SEM_STATUS_NORMAL;
2568   sh4al_scache* abuf = sem;
2569   unsigned long long written = 0;
2570   PCADDR pc = abuf->addr;
2571   PCADDR npc = pc + 2;
2572
2573   {
2574     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2575     if (UNLIKELY(current_cpu->trace_result_p))
2576       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2577     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2)), opval);
2578   }
2579
2580   current_cpu->done_insn (npc, status);
2581 #undef FLD
2582 }
2583
2584 // ********** movw5-compact: mov.w r0, @($imm4x2, $rm)
2585
2586 void
2587 sh4al_sem_movw5_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2588         sh4al::write_stacks &buf)
2589 {
2590 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
2591   sem_status status = SEM_STATUS_NORMAL;
2592   sh4al_scache* abuf = sem;
2593   unsigned long long written = 0;
2594   PCADDR pc = abuf->addr;
2595   PCADDR npc = pc + 2;
2596
2597   {
2598     HI opval = SUBWORDSIHI (current_cpu->h_grc_get (((UINT) 0)), 1);
2599     if (UNLIKELY(current_cpu->trace_result_p))
2600       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 << "  ";
2601     current_cpu->SETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2)), opval);
2602   }
2603
2604   current_cpu->done_insn (npc, status);
2605 #undef FLD
2606 }
2607
2608 // ********** movw6-compact: mov.w @$rm, $rn
2609
2610 void
2611 sh4al_sem_movw6_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2612         sh4al::write_stacks &buf)
2613 {
2614 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2615   sem_status status = SEM_STATUS_NORMAL;
2616   sh4al_scache* abuf = sem;
2617   unsigned long long written = 0;
2618   PCADDR pc = abuf->addr;
2619   PCADDR npc = pc + 2;
2620
2621   {
2622     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm))));
2623     if (UNLIKELY(current_cpu->trace_result_p))
2624       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2625     current_cpu->h_grc_set (FLD (f_rn), opval);
2626   }
2627
2628   current_cpu->done_insn (npc, status);
2629 #undef FLD
2630 }
2631
2632 // ********** movw7-compact: mov.w @${rm}+, $rn
2633
2634 void
2635 sh4al_sem_movw7_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2636         sh4al::write_stacks &buf)
2637 {
2638 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2639   sem_status status = SEM_STATUS_NORMAL;
2640   sh4al_scache* abuf = sem;
2641   unsigned long long written = 0;
2642   PCADDR pc = abuf->addr;
2643   PCADDR npc = pc + 2;
2644
2645 {
2646   HI tmp_data;
2647   tmp_data = current_cpu->GETMEMHI (pc, current_cpu->h_grc_get (FLD (f_rm)));
2648 if (EQSI (FLD (f_rm), FLD (f_rn))) {
2649   {
2650     SI opval = EXTHISI (tmp_data);
2651     written |= (1ULL << 4);
2652     if (UNLIKELY(current_cpu->trace_result_p))
2653       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2654     current_cpu->h_grc_set (FLD (f_rm), opval);
2655   }
2656 } else {
2657   {
2658     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rm)), 2);
2659     written |= (1ULL << 4);
2660     if (UNLIKELY(current_cpu->trace_result_p))
2661       current_cpu->trace_stream << "grc" << '[' << FLD (f_rm) << ']' << ":=0x" << hex << opval << dec << "  ";
2662     current_cpu->h_grc_set (FLD (f_rm), opval);
2663   }
2664 }
2665   {
2666     SI opval = EXTHISI (tmp_data);
2667     if (UNLIKELY(current_cpu->trace_result_p))
2668       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2669     current_cpu->h_grc_set (FLD (f_rn), opval);
2670   }
2671 }
2672
2673   abuf->written = written;
2674   current_cpu->done_insn (npc, status);
2675 #undef FLD
2676 }
2677
2678 // ********** movw8-compact: mov.w @(r0, $rm), $rn
2679
2680 void
2681 sh4al_sem_movw8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2682         sh4al::write_stacks &buf)
2683 {
2684 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2685   sem_status status = SEM_STATUS_NORMAL;
2686   sh4al_scache* abuf = sem;
2687   unsigned long long written = 0;
2688   PCADDR pc = abuf->addr;
2689   PCADDR npc = pc + 2;
2690
2691   {
2692     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_grc_get (FLD (f_rm)))));
2693     if (UNLIKELY(current_cpu->trace_result_p))
2694       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2695     current_cpu->h_grc_set (FLD (f_rn), opval);
2696   }
2697
2698   current_cpu->done_insn (npc, status);
2699 #undef FLD
2700 }
2701
2702 // ********** movw9-compact: mov.w @($imm8x2, gbr), r0
2703
2704 void
2705 sh4al_sem_movw9_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2706         sh4al::write_stacks &buf)
2707 {
2708 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
2709   sem_status status = SEM_STATUS_NORMAL;
2710   sh4al_scache* abuf = sem;
2711   unsigned long long written = 0;
2712   PCADDR pc = abuf->addr;
2713   PCADDR npc = pc + 2;
2714
2715   {
2716     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_gbr_get (), FLD (f_imm8x2))));
2717     if (UNLIKELY(current_cpu->trace_result_p))
2718       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2719     current_cpu->h_grc_set (((UINT) 0), opval);
2720   }
2721
2722   current_cpu->done_insn (npc, status);
2723 #undef FLD
2724 }
2725
2726 // ********** movw10-compact: mov.w @($imm8x2, pc), $rn
2727
2728 void
2729 sh4al_sem_movw10_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2730         sh4al::write_stacks &buf)
2731 {
2732 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2733   sem_status status = SEM_STATUS_NORMAL;
2734   sh4al_scache* abuf = sem;
2735   unsigned long long written = 0;
2736   PCADDR pc = abuf->addr;
2737   PCADDR npc = pc + 2;
2738
2739   {
2740     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
2741     if (UNLIKELY(current_cpu->trace_result_p))
2742       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2743     current_cpu->h_grc_set (FLD (f_rn), opval);
2744   }
2745
2746   current_cpu->done_insn (npc, status);
2747 #undef FLD
2748 }
2749
2750 // ********** movw11-compact: mov.w @($imm4x2, $rm), r0
2751
2752 void
2753 sh4al_sem_movw11_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2754         sh4al::write_stacks &buf)
2755 {
2756 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
2757   sem_status status = SEM_STATUS_NORMAL;
2758   sh4al_scache* abuf = sem;
2759   unsigned long long written = 0;
2760   PCADDR pc = abuf->addr;
2761   PCADDR npc = pc + 2;
2762
2763   {
2764     SI opval = EXTHISI (current_cpu->GETMEMHI (pc, ADDSI (current_cpu->h_grc_get (FLD (f_rm)), FLD (f_imm4x2))));
2765     if (UNLIKELY(current_cpu->trace_result_p))
2766       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2767     current_cpu->h_grc_set (((UINT) 0), opval);
2768   }
2769
2770   current_cpu->done_insn (npc, status);
2771 #undef FLD
2772 }
2773
2774 // ********** mova-compact: mova @($imm8x4, pc), r0
2775
2776 void
2777 sh4al_sem_mova_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2778         sh4al::write_stacks &buf)
2779 {
2780 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2781   sem_status status = SEM_STATUS_NORMAL;
2782   sh4al_scache* abuf = sem;
2783   unsigned long long written = 0;
2784   PCADDR pc = abuf->addr;
2785   PCADDR npc = pc + 2;
2786
2787   {
2788     SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
2789     if (UNLIKELY(current_cpu->trace_result_p))
2790       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2791     current_cpu->h_grc_set (((UINT) 0), opval);
2792   }
2793
2794   current_cpu->done_insn (npc, status);
2795 #undef FLD
2796 }
2797
2798 // ********** movcal-compact: movca.l r0, @$rn
2799
2800 void
2801 sh4al_sem_movcal_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2802         sh4al::write_stacks &buf)
2803 {
2804 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2805   sem_status status = SEM_STATUS_NORMAL;
2806   sh4al_scache* abuf = sem;
2807   unsigned long long written = 0;
2808   PCADDR pc = abuf->addr;
2809   PCADDR npc = pc + 2;
2810
2811   {
2812     SI opval = current_cpu->h_grc_get (((UINT) 0));
2813     if (UNLIKELY(current_cpu->trace_result_p))
2814       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << opval << dec << "  ";
2815     current_cpu->SETMEMSI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
2816   }
2817
2818   current_cpu->done_insn (npc, status);
2819 #undef FLD
2820 }
2821
2822 // ********** movcol-compact: movco.l r0, @$rn
2823
2824 void
2825 sh4al_sem_movcol_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2826         sh4al::write_stacks &buf)
2827 {
2828 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
2829   sem_status status = SEM_STATUS_NORMAL;
2830   sh4al_scache* abuf = sem;
2831   unsigned long long written = 0;
2832   PCADDR pc = abuf->addr;
2833   PCADDR npc = pc + 2;
2834
2835   {
2836     SI opval = current_cpu->h_grc_get (FLD (f_rn));
2837     if (UNLIKELY(current_cpu->trace_result_p))
2838       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2839     current_cpu->h_grc_set (FLD (f_rn), opval);
2840   }
2841
2842   current_cpu->done_insn (npc, status);
2843 #undef FLD
2844 }
2845
2846 // ********** movt-compact: movt $rn
2847
2848 void
2849 sh4al_sem_movt_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2850         sh4al::write_stacks &buf)
2851 {
2852 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2853   sem_status status = SEM_STATUS_NORMAL;
2854   sh4al_scache* abuf = sem;
2855   unsigned long long written = 0;
2856   PCADDR pc = abuf->addr;
2857   PCADDR npc = pc + 2;
2858
2859   {
2860     SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
2861     if (UNLIKELY(current_cpu->trace_result_p))
2862       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2863     current_cpu->h_grc_set (FLD (f_rn), opval);
2864   }
2865
2866   current_cpu->done_insn (npc, status);
2867 #undef FLD
2868 }
2869
2870 // ********** movual-compact: movua.l @$rn, r0
2871
2872 void
2873 sh4al_sem_movual_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2874         sh4al::write_stacks &buf)
2875 {
2876 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
2877   sem_status status = SEM_STATUS_NORMAL;
2878   sh4al_scache* abuf = sem;
2879   unsigned long long written = 0;
2880   PCADDR pc = abuf->addr;
2881   PCADDR npc = pc + 2;
2882
2883   {
2884     SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
2885     if (UNLIKELY(current_cpu->trace_result_p))
2886       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2887     current_cpu->h_grc_set (((UINT) 0), opval);
2888   }
2889
2890   current_cpu->done_insn (npc, status);
2891 #undef FLD
2892 }
2893
2894 // ********** movual2-compact: movua.l @$rn+, r0
2895
2896 void
2897 sh4al_sem_movual2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2898         sh4al::write_stacks &buf)
2899 {
2900 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
2901   sem_status status = SEM_STATUS_NORMAL;
2902   sh4al_scache* abuf = sem;
2903   unsigned long long written = 0;
2904   PCADDR pc = abuf->addr;
2905   PCADDR npc = pc + 2;
2906
2907 {
2908   {
2909     SI opval = current_cpu->sh64_movua (pc, current_cpu->h_grc_get (FLD (f_rn)));
2910     if (UNLIKELY(current_cpu->trace_result_p))
2911       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
2912     current_cpu->h_grc_set (((UINT) 0), opval);
2913   }
2914   {
2915     SI opval = ADDSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
2916     if (UNLIKELY(current_cpu->trace_result_p))
2917       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2918     current_cpu->h_grc_set (FLD (f_rn), opval);
2919   }
2920 }
2921
2922   current_cpu->done_insn (npc, status);
2923 #undef FLD
2924 }
2925
2926 // ********** mull-compact: mul.l $rm, $rn
2927
2928 void
2929 sh4al_sem_mull_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2930         sh4al::write_stacks &buf)
2931 {
2932 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2933   sem_status status = SEM_STATUS_NORMAL;
2934   sh4al_scache* abuf = sem;
2935   unsigned long long written = 0;
2936   PCADDR pc = abuf->addr;
2937   PCADDR npc = pc + 2;
2938
2939   {
2940     SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
2941     if (UNLIKELY(current_cpu->trace_result_p))
2942       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2943     current_cpu->h_macl_set (opval);
2944   }
2945
2946   current_cpu->done_insn (npc, status);
2947 #undef FLD
2948 }
2949
2950 // ********** mulsw-compact: muls.w $rm, $rn
2951
2952 void
2953 sh4al_sem_mulsw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2954         sh4al::write_stacks &buf)
2955 {
2956 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2957   sem_status status = SEM_STATUS_NORMAL;
2958   sh4al_scache* abuf = sem;
2959   unsigned long long written = 0;
2960   PCADDR pc = abuf->addr;
2961   PCADDR npc = pc + 2;
2962
2963   {
2964     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)));
2965     if (UNLIKELY(current_cpu->trace_result_p))
2966       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2967     current_cpu->h_macl_set (opval);
2968   }
2969
2970   current_cpu->done_insn (npc, status);
2971 #undef FLD
2972 }
2973
2974 // ********** muluw-compact: mulu.w $rm, $rn
2975
2976 void
2977 sh4al_sem_muluw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
2978         sh4al::write_stacks &buf)
2979 {
2980 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2981   sem_status status = SEM_STATUS_NORMAL;
2982   sh4al_scache* abuf = sem;
2983   unsigned long long written = 0;
2984   PCADDR pc = abuf->addr;
2985   PCADDR npc = pc + 2;
2986
2987   {
2988     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)));
2989     if (UNLIKELY(current_cpu->trace_result_p))
2990       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2991     current_cpu->h_macl_set (opval);
2992   }
2993
2994   current_cpu->done_insn (npc, status);
2995 #undef FLD
2996 }
2997
2998 // ********** neg-compact: neg $rm, $rn
2999
3000 void
3001 sh4al_sem_neg_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3002         sh4al::write_stacks &buf)
3003 {
3004 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3005   sem_status status = SEM_STATUS_NORMAL;
3006   sh4al_scache* abuf = sem;
3007   unsigned long long written = 0;
3008   PCADDR pc = abuf->addr;
3009   PCADDR npc = pc + 2;
3010
3011   {
3012     SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
3013     if (UNLIKELY(current_cpu->trace_result_p))
3014       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3015     current_cpu->h_grc_set (FLD (f_rn), opval);
3016   }
3017
3018   current_cpu->done_insn (npc, status);
3019 #undef FLD
3020 }
3021
3022 // ********** negc-compact: negc $rm, $rn
3023
3024 void
3025 sh4al_sem_negc_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3026         sh4al::write_stacks &buf)
3027 {
3028 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
3029   sem_status status = SEM_STATUS_NORMAL;
3030   sh4al_scache* abuf = sem;
3031   unsigned long long written = 0;
3032   PCADDR pc = abuf->addr;
3033   PCADDR npc = pc + 2;
3034
3035 {
3036   BI tmp_flag;
3037   tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3038   {
3039     SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
3040     if (UNLIKELY(current_cpu->trace_result_p))
3041       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3042     current_cpu->h_grc_set (FLD (f_rn), opval);
3043   }
3044   {
3045     BI opval = tmp_flag;
3046     if (UNLIKELY(current_cpu->trace_result_p))
3047       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3048     current_cpu->h_tbit_set (opval);
3049   }
3050 }
3051
3052   current_cpu->done_insn (npc, status);
3053 #undef FLD
3054 }
3055
3056 // ********** nop-compact: nop
3057
3058 void
3059 sh4al_sem_nop_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3060         sh4al::write_stacks &buf)
3061 {
3062 #define FLD(f) abuf->fields.fmt_empty.f
3063   sem_status status = SEM_STATUS_NORMAL;
3064   sh4al_scache* abuf = sem;
3065   unsigned long long written = 0;
3066   PCADDR pc = abuf->addr;
3067   PCADDR npc = pc + 2;
3068
3069 ((void) 0); /*nop*/
3070
3071   current_cpu->done_insn (npc, status);
3072 #undef FLD
3073 }
3074
3075 // ********** not-compact: not $rm64, $rn64
3076
3077 void
3078 sh4al_sem_not_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3079         sh4al::write_stacks &buf)
3080 {
3081 #define FLD(f) abuf->fields.sfmt_and_compact.f
3082   sem_status status = SEM_STATUS_NORMAL;
3083   sh4al_scache* abuf = sem;
3084   unsigned long long written = 0;
3085   PCADDR pc = abuf->addr;
3086   PCADDR npc = pc + 2;
3087
3088   {
3089     DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
3090     if (UNLIKELY(current_cpu->trace_result_p))
3091       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3092     current_cpu->h_gr_set (FLD (f_rn), opval);
3093   }
3094
3095   current_cpu->done_insn (npc, status);
3096 #undef FLD
3097 }
3098
3099 // ********** ocbi-compact: ocbi @$rn
3100
3101 void
3102 sh4al_sem_ocbi_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3103         sh4al::write_stacks &buf)
3104 {
3105 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3106   sem_status status = SEM_STATUS_NORMAL;
3107   sh4al_scache* abuf = sem;
3108   unsigned long long written = 0;
3109   PCADDR pc = abuf->addr;
3110   PCADDR npc = pc + 2;
3111
3112 {
3113   {
3114     SI opval = current_cpu->h_grc_get (FLD (f_rn));
3115     if (UNLIKELY(current_cpu->trace_result_p))
3116       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3117     current_cpu->h_grc_set (FLD (f_rn), opval);
3118   }
3119 ((void) 0); /*nop*/
3120 }
3121
3122   current_cpu->done_insn (npc, status);
3123 #undef FLD
3124 }
3125
3126 // ********** ocbp-compact: ocbp @$rn
3127
3128 void
3129 sh4al_sem_ocbp_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3130         sh4al::write_stacks &buf)
3131 {
3132 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3133   sem_status status = SEM_STATUS_NORMAL;
3134   sh4al_scache* abuf = sem;
3135   unsigned long long written = 0;
3136   PCADDR pc = abuf->addr;
3137   PCADDR npc = pc + 2;
3138
3139 {
3140   {
3141     SI opval = current_cpu->h_grc_get (FLD (f_rn));
3142     if (UNLIKELY(current_cpu->trace_result_p))
3143       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3144     current_cpu->h_grc_set (FLD (f_rn), opval);
3145   }
3146 ((void) 0); /*nop*/
3147 }
3148
3149   current_cpu->done_insn (npc, status);
3150 #undef FLD
3151 }
3152
3153 // ********** ocbwb-compact: ocbwb @$rn
3154
3155 void
3156 sh4al_sem_ocbwb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3157         sh4al::write_stacks &buf)
3158 {
3159 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3160   sem_status status = SEM_STATUS_NORMAL;
3161   sh4al_scache* abuf = sem;
3162   unsigned long long written = 0;
3163   PCADDR pc = abuf->addr;
3164   PCADDR npc = pc + 2;
3165
3166 {
3167   {
3168     SI opval = current_cpu->h_grc_get (FLD (f_rn));
3169     if (UNLIKELY(current_cpu->trace_result_p))
3170       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3171     current_cpu->h_grc_set (FLD (f_rn), opval);
3172   }
3173 ((void) 0); /*nop*/
3174 }
3175
3176   current_cpu->done_insn (npc, status);
3177 #undef FLD
3178 }
3179
3180 // ********** or-compact: or $rm64, $rn64
3181
3182 void
3183 sh4al_sem_or_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3184         sh4al::write_stacks &buf)
3185 {
3186 #define FLD(f) abuf->fields.sfmt_and_compact.f
3187   sem_status status = SEM_STATUS_NORMAL;
3188   sh4al_scache* abuf = sem;
3189   unsigned long long written = 0;
3190   PCADDR pc = abuf->addr;
3191   PCADDR npc = pc + 2;
3192
3193   {
3194     DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
3195     if (UNLIKELY(current_cpu->trace_result_p))
3196       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3197     current_cpu->h_gr_set (FLD (f_rn), opval);
3198   }
3199
3200   current_cpu->done_insn (npc, status);
3201 #undef FLD
3202 }
3203
3204 // ********** ori-compact: or #$uimm8, r0
3205
3206 void
3207 sh4al_sem_ori_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3208         sh4al::write_stacks &buf)
3209 {
3210 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3211   sem_status status = SEM_STATUS_NORMAL;
3212   sh4al_scache* abuf = sem;
3213   unsigned long long written = 0;
3214   PCADDR pc = abuf->addr;
3215   PCADDR npc = pc + 2;
3216
3217   {
3218     SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3219     if (UNLIKELY(current_cpu->trace_result_p))
3220       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3221     current_cpu->h_grc_set (((UINT) 0), opval);
3222   }
3223
3224   current_cpu->done_insn (npc, status);
3225 #undef FLD
3226 }
3227
3228 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3229
3230 void
3231 sh4al_sem_orb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3232         sh4al::write_stacks &buf)
3233 {
3234 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3235   sem_status status = SEM_STATUS_NORMAL;
3236   sh4al_scache* abuf = sem;
3237   unsigned long long written = 0;
3238   PCADDR pc = abuf->addr;
3239   PCADDR npc = pc + 2;
3240
3241 {
3242   DI tmp_addr;
3243   UQI tmp_data;
3244   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3245   tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3246   {
3247     UQI opval = tmp_data;
3248     if (UNLIKELY(current_cpu->trace_result_p))
3249       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
3250     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3251   }
3252 }
3253
3254   current_cpu->done_insn (npc, status);
3255 #undef FLD
3256 }
3257
3258 // ********** pref-compact: pref @$rn
3259
3260 void
3261 sh4al_sem_pref_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3262         sh4al::write_stacks &buf)
3263 {
3264 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3265   sem_status status = SEM_STATUS_NORMAL;
3266   sh4al_scache* abuf = sem;
3267   unsigned long long written = 0;
3268   PCADDR pc = abuf->addr;
3269   PCADDR npc = pc + 2;
3270
3271 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
3272
3273   current_cpu->done_insn (npc, status);
3274 #undef FLD
3275 }
3276
3277 // ********** rotcl-compact: rotcl $rn
3278
3279 void
3280 sh4al_sem_rotcl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3281         sh4al::write_stacks &buf)
3282 {
3283 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3284   sem_status status = SEM_STATUS_NORMAL;
3285   sh4al_scache* abuf = sem;
3286   unsigned long long written = 0;
3287   PCADDR pc = abuf->addr;
3288   PCADDR npc = pc + 2;
3289
3290 {
3291   BI tmp_temp;
3292   tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3293   {
3294     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3295     if (UNLIKELY(current_cpu->trace_result_p))
3296       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3297     current_cpu->h_grc_set (FLD (f_rn), opval);
3298   }
3299   {
3300     BI opval = ((tmp_temp) ? (1) : (0));
3301     if (UNLIKELY(current_cpu->trace_result_p))
3302       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3303     current_cpu->h_tbit_set (opval);
3304   }
3305 }
3306
3307   current_cpu->done_insn (npc, status);
3308 #undef FLD
3309 }
3310
3311 // ********** rotcr-compact: rotcr $rn
3312
3313 void
3314 sh4al_sem_rotcr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3315         sh4al::write_stacks &buf)
3316 {
3317 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3318   sem_status status = SEM_STATUS_NORMAL;
3319   sh4al_scache* abuf = sem;
3320   unsigned long long written = 0;
3321   PCADDR pc = abuf->addr;
3322   PCADDR npc = pc + 2;
3323
3324 {
3325   BI tmp_lsbit;
3326   SI tmp_temp;
3327   tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3328   tmp_temp = current_cpu->h_tbit_get ();
3329   {
3330     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3331     if (UNLIKELY(current_cpu->trace_result_p))
3332       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3333     current_cpu->h_grc_set (FLD (f_rn), opval);
3334   }
3335   {
3336     BI opval = ((tmp_lsbit) ? (1) : (0));
3337     if (UNLIKELY(current_cpu->trace_result_p))
3338       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3339     current_cpu->h_tbit_set (opval);
3340   }
3341 }
3342
3343   current_cpu->done_insn (npc, status);
3344 #undef FLD
3345 }
3346
3347 // ********** rotl-compact: rotl $rn
3348
3349 void
3350 sh4al_sem_rotl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3351         sh4al::write_stacks &buf)
3352 {
3353 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3354   sem_status status = SEM_STATUS_NORMAL;
3355   sh4al_scache* abuf = sem;
3356   unsigned long long written = 0;
3357   PCADDR pc = abuf->addr;
3358   PCADDR npc = pc + 2;
3359
3360 {
3361   BI tmp_temp;
3362   tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3363   {
3364     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3365     if (UNLIKELY(current_cpu->trace_result_p))
3366       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3367     current_cpu->h_grc_set (FLD (f_rn), opval);
3368   }
3369   {
3370     BI opval = ((tmp_temp) ? (1) : (0));
3371     if (UNLIKELY(current_cpu->trace_result_p))
3372       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3373     current_cpu->h_tbit_set (opval);
3374   }
3375 }
3376
3377   current_cpu->done_insn (npc, status);
3378 #undef FLD
3379 }
3380
3381 // ********** rotr-compact: rotr $rn
3382
3383 void
3384 sh4al_sem_rotr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3385         sh4al::write_stacks &buf)
3386 {
3387 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3388   sem_status status = SEM_STATUS_NORMAL;
3389   sh4al_scache* abuf = sem;
3390   unsigned long long written = 0;
3391   PCADDR pc = abuf->addr;
3392   PCADDR npc = pc + 2;
3393
3394 {
3395   BI tmp_lsbit;
3396   SI tmp_temp;
3397   tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3398   tmp_temp = tmp_lsbit;
3399   {
3400     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3401     if (UNLIKELY(current_cpu->trace_result_p))
3402       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3403     current_cpu->h_grc_set (FLD (f_rn), opval);
3404   }
3405   {
3406     BI opval = ((tmp_lsbit) ? (1) : (0));
3407     if (UNLIKELY(current_cpu->trace_result_p))
3408       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3409     current_cpu->h_tbit_set (opval);
3410   }
3411 }
3412
3413   current_cpu->done_insn (npc, status);
3414 #undef FLD
3415 }
3416
3417 // ********** rts-compact: rts
3418
3419 void
3420 sh4al_sem_rts_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3421         sh4al::write_stacks &buf)
3422 {
3423 #define FLD(f) abuf->fields.fmt_empty.f
3424   sem_status status = SEM_STATUS_NORMAL;
3425   sh4al_scache* abuf = sem;
3426   unsigned long long written = 0;
3427   PCADDR pc = abuf->addr;
3428   PCADDR npc = pc + 2;
3429
3430 {
3431   {
3432     UDI opval = ADDDI (pc, 2);
3433     if (UNLIKELY(current_cpu->trace_result_p))
3434       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3435     current_cpu->branch (opval, npc, status);
3436   }
3437 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
3438   {
3439     UDI opval = current_cpu->h_pr_get ();
3440     buf.h_pc_writes [(tick + 1) % sh4al::pipe_sz].push (sh4al::write<UDI>(pc, opval));
3441     if (UNLIKELY(current_cpu->trace_result_p))
3442       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3443   }
3444 current_cpu->notify_ret (current_cpu->h_pr_get ());
3445 }
3446
3447   current_cpu->done_cti_insn (npc, status);
3448 #undef FLD
3449 }
3450
3451 // ********** sets-compact: sets
3452
3453 void
3454 sh4al_sem_sets_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3455         sh4al::write_stacks &buf)
3456 {
3457 #define FLD(f) abuf->fields.fmt_empty.f
3458   sem_status status = SEM_STATUS_NORMAL;
3459   sh4al_scache* abuf = sem;
3460   unsigned long long written = 0;
3461   PCADDR pc = abuf->addr;
3462   PCADDR npc = pc + 2;
3463
3464   {
3465     BI opval = 1;
3466     if (UNLIKELY(current_cpu->trace_result_p))
3467       current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << "  ";
3468     current_cpu->h_sbit_set (opval);
3469   }
3470
3471   current_cpu->done_insn (npc, status);
3472 #undef FLD
3473 }
3474
3475 // ********** sett-compact: sett
3476
3477 void
3478 sh4al_sem_sett_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3479         sh4al::write_stacks &buf)
3480 {
3481 #define FLD(f) abuf->fields.fmt_empty.f
3482   sem_status status = SEM_STATUS_NORMAL;
3483   sh4al_scache* abuf = sem;
3484   unsigned long long written = 0;
3485   PCADDR pc = abuf->addr;
3486   PCADDR npc = pc + 2;
3487
3488   {
3489     BI opval = 1;
3490     if (UNLIKELY(current_cpu->trace_result_p))
3491       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3492     current_cpu->h_tbit_set (opval);
3493   }
3494
3495   current_cpu->done_insn (npc, status);
3496 #undef FLD
3497 }
3498
3499 // ********** shad-compact: shad $rm, $rn
3500
3501 void
3502 sh4al_sem_shad_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3503         sh4al::write_stacks &buf)
3504 {
3505 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3506   sem_status status = SEM_STATUS_NORMAL;
3507   sh4al_scache* abuf = sem;
3508   unsigned long long written = 0;
3509   PCADDR pc = abuf->addr;
3510   PCADDR npc = pc + 2;
3511
3512 {
3513   SI tmp_shamt;
3514   tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3515 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3516   {
3517     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3518     written |= (1ULL << 2);
3519     if (UNLIKELY(current_cpu->trace_result_p))
3520       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3521     current_cpu->h_grc_set (FLD (f_rn), opval);
3522   }
3523 } else {
3524 if (NESI (tmp_shamt, 0)) {
3525   {
3526     SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3527     written |= (1ULL << 2);
3528     if (UNLIKELY(current_cpu->trace_result_p))
3529       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3530     current_cpu->h_grc_set (FLD (f_rn), opval);
3531   }
3532 } else {
3533 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
3534   {
3535     SI opval = NEGSI (1);
3536     written |= (1ULL << 2);
3537     if (UNLIKELY(current_cpu->trace_result_p))
3538       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3539     current_cpu->h_grc_set (FLD (f_rn), opval);
3540   }
3541 } else {
3542   {
3543     SI opval = 0;
3544     written |= (1ULL << 2);
3545     if (UNLIKELY(current_cpu->trace_result_p))
3546       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3547     current_cpu->h_grc_set (FLD (f_rn), opval);
3548   }
3549 }
3550 }
3551 }
3552 }
3553
3554   abuf->written = written;
3555   current_cpu->done_insn (npc, status);
3556 #undef FLD
3557 }
3558
3559 // ********** shal-compact: shal $rn
3560
3561 void
3562 sh4al_sem_shal_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3563         sh4al::write_stacks &buf)
3564 {
3565 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3566   sem_status status = SEM_STATUS_NORMAL;
3567   sh4al_scache* abuf = sem;
3568   unsigned long long written = 0;
3569   PCADDR pc = abuf->addr;
3570   PCADDR npc = pc + 2;
3571
3572 {
3573   BI tmp_t;
3574   tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3575   {
3576     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3577     if (UNLIKELY(current_cpu->trace_result_p))
3578       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3579     current_cpu->h_grc_set (FLD (f_rn), opval);
3580   }
3581   {
3582     BI opval = ((tmp_t) ? (1) : (0));
3583     if (UNLIKELY(current_cpu->trace_result_p))
3584       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3585     current_cpu->h_tbit_set (opval);
3586   }
3587 }
3588
3589   current_cpu->done_insn (npc, status);
3590 #undef FLD
3591 }
3592
3593 // ********** shar-compact: shar $rn
3594
3595 void
3596 sh4al_sem_shar_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3597         sh4al::write_stacks &buf)
3598 {
3599 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3600   sem_status status = SEM_STATUS_NORMAL;
3601   sh4al_scache* abuf = sem;
3602   unsigned long long written = 0;
3603   PCADDR pc = abuf->addr;
3604   PCADDR npc = pc + 2;
3605
3606 {
3607   BI tmp_t;
3608   tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3609   {
3610     SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3611     if (UNLIKELY(current_cpu->trace_result_p))
3612       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3613     current_cpu->h_grc_set (FLD (f_rn), opval);
3614   }
3615   {
3616     BI opval = ((tmp_t) ? (1) : (0));
3617     if (UNLIKELY(current_cpu->trace_result_p))
3618       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3619     current_cpu->h_tbit_set (opval);
3620   }
3621 }
3622
3623   current_cpu->done_insn (npc, status);
3624 #undef FLD
3625 }
3626
3627 // ********** shld-compact: shld $rm, $rn
3628
3629 void
3630 sh4al_sem_shld_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3631         sh4al::write_stacks &buf)
3632 {
3633 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3634   sem_status status = SEM_STATUS_NORMAL;
3635   sh4al_scache* abuf = sem;
3636   unsigned long long written = 0;
3637   PCADDR pc = abuf->addr;
3638   PCADDR npc = pc + 2;
3639
3640 {
3641   SI tmp_shamt;
3642   tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3643 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3644   {
3645     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3646     written |= (1ULL << 2);
3647     if (UNLIKELY(current_cpu->trace_result_p))
3648       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3649     current_cpu->h_grc_set (FLD (f_rn), opval);
3650   }
3651 } else {
3652 if (NESI (tmp_shamt, 0)) {
3653   {
3654     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3655     written |= (1ULL << 2);
3656     if (UNLIKELY(current_cpu->trace_result_p))
3657       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3658     current_cpu->h_grc_set (FLD (f_rn), opval);
3659   }
3660 } else {
3661   {
3662     SI opval = 0;
3663     written |= (1ULL << 2);
3664     if (UNLIKELY(current_cpu->trace_result_p))
3665       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3666     current_cpu->h_grc_set (FLD (f_rn), opval);
3667   }
3668 }
3669 }
3670 }
3671
3672   abuf->written = written;
3673   current_cpu->done_insn (npc, status);
3674 #undef FLD
3675 }
3676
3677 // ********** shll-compact: shll $rn
3678
3679 void
3680 sh4al_sem_shll_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3681         sh4al::write_stacks &buf)
3682 {
3683 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3684   sem_status status = SEM_STATUS_NORMAL;
3685   sh4al_scache* abuf = sem;
3686   unsigned long long written = 0;
3687   PCADDR pc = abuf->addr;
3688   PCADDR npc = pc + 2;
3689
3690 {
3691   BI tmp_t;
3692   tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3693   {
3694     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3695     if (UNLIKELY(current_cpu->trace_result_p))
3696       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3697     current_cpu->h_grc_set (FLD (f_rn), opval);
3698   }
3699   {
3700     BI opval = ((tmp_t) ? (1) : (0));
3701     if (UNLIKELY(current_cpu->trace_result_p))
3702       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3703     current_cpu->h_tbit_set (opval);
3704   }
3705 }
3706
3707   current_cpu->done_insn (npc, status);
3708 #undef FLD
3709 }
3710
3711 // ********** shll2-compact: shll2 $rn
3712
3713 void
3714 sh4al_sem_shll2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3715         sh4al::write_stacks &buf)
3716 {
3717 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3718   sem_status status = SEM_STATUS_NORMAL;
3719   sh4al_scache* abuf = sem;
3720   unsigned long long written = 0;
3721   PCADDR pc = abuf->addr;
3722   PCADDR npc = pc + 2;
3723
3724   {
3725     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3726     if (UNLIKELY(current_cpu->trace_result_p))
3727       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3728     current_cpu->h_grc_set (FLD (f_rn), opval);
3729   }
3730
3731   current_cpu->done_insn (npc, status);
3732 #undef FLD
3733 }
3734
3735 // ********** shll8-compact: shll8 $rn
3736
3737 void
3738 sh4al_sem_shll8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3739         sh4al::write_stacks &buf)
3740 {
3741 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3742   sem_status status = SEM_STATUS_NORMAL;
3743   sh4al_scache* abuf = sem;
3744   unsigned long long written = 0;
3745   PCADDR pc = abuf->addr;
3746   PCADDR npc = pc + 2;
3747
3748   {
3749     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3750     if (UNLIKELY(current_cpu->trace_result_p))
3751       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3752     current_cpu->h_grc_set (FLD (f_rn), opval);
3753   }
3754
3755   current_cpu->done_insn (npc, status);
3756 #undef FLD
3757 }
3758
3759 // ********** shll16-compact: shll16 $rn
3760
3761 void
3762 sh4al_sem_shll16_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3763         sh4al::write_stacks &buf)
3764 {
3765 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3766   sem_status status = SEM_STATUS_NORMAL;
3767   sh4al_scache* abuf = sem;
3768   unsigned long long written = 0;
3769   PCADDR pc = abuf->addr;
3770   PCADDR npc = pc + 2;
3771
3772   {
3773     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3774     if (UNLIKELY(current_cpu->trace_result_p))
3775       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3776     current_cpu->h_grc_set (FLD (f_rn), opval);
3777   }
3778
3779   current_cpu->done_insn (npc, status);
3780 #undef FLD
3781 }
3782
3783 // ********** shlr-compact: shlr $rn
3784
3785 void
3786 sh4al_sem_shlr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3787         sh4al::write_stacks &buf)
3788 {
3789 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3790   sem_status status = SEM_STATUS_NORMAL;
3791   sh4al_scache* abuf = sem;
3792   unsigned long long written = 0;
3793   PCADDR pc = abuf->addr;
3794   PCADDR npc = pc + 2;
3795
3796 {
3797   BI tmp_t;
3798   tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3799   {
3800     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3801     if (UNLIKELY(current_cpu->trace_result_p))
3802       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3803     current_cpu->h_grc_set (FLD (f_rn), opval);
3804   }
3805   {
3806     BI opval = ((tmp_t) ? (1) : (0));
3807     if (UNLIKELY(current_cpu->trace_result_p))
3808       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3809     current_cpu->h_tbit_set (opval);
3810   }
3811 }
3812
3813   current_cpu->done_insn (npc, status);
3814 #undef FLD
3815 }
3816
3817 // ********** shlr2-compact: shlr2 $rn
3818
3819 void
3820 sh4al_sem_shlr2_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3821         sh4al::write_stacks &buf)
3822 {
3823 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3824   sem_status status = SEM_STATUS_NORMAL;
3825   sh4al_scache* abuf = sem;
3826   unsigned long long written = 0;
3827   PCADDR pc = abuf->addr;
3828   PCADDR npc = pc + 2;
3829
3830   {
3831     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3832     if (UNLIKELY(current_cpu->trace_result_p))
3833       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3834     current_cpu->h_grc_set (FLD (f_rn), opval);
3835   }
3836
3837   current_cpu->done_insn (npc, status);
3838 #undef FLD
3839 }
3840
3841 // ********** shlr8-compact: shlr8 $rn
3842
3843 void
3844 sh4al_sem_shlr8_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3845         sh4al::write_stacks &buf)
3846 {
3847 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3848   sem_status status = SEM_STATUS_NORMAL;
3849   sh4al_scache* abuf = sem;
3850   unsigned long long written = 0;
3851   PCADDR pc = abuf->addr;
3852   PCADDR npc = pc + 2;
3853
3854   {
3855     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3856     if (UNLIKELY(current_cpu->trace_result_p))
3857       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3858     current_cpu->h_grc_set (FLD (f_rn), opval);
3859   }
3860
3861   current_cpu->done_insn (npc, status);
3862 #undef FLD
3863 }
3864
3865 // ********** shlr16-compact: shlr16 $rn
3866
3867 void
3868 sh4al_sem_shlr16_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3869         sh4al::write_stacks &buf)
3870 {
3871 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3872   sem_status status = SEM_STATUS_NORMAL;
3873   sh4al_scache* abuf = sem;
3874   unsigned long long written = 0;
3875   PCADDR pc = abuf->addr;
3876   PCADDR npc = pc + 2;
3877
3878   {
3879     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3880     if (UNLIKELY(current_cpu->trace_result_p))
3881       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3882     current_cpu->h_grc_set (FLD (f_rn), opval);
3883   }
3884
3885   current_cpu->done_insn (npc, status);
3886 #undef FLD
3887 }
3888
3889 // ********** stc-gbr-compact: stc gbr, $rn
3890
3891 void
3892 sh4al_sem_stc_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3893         sh4al::write_stacks &buf)
3894 {
3895 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3896   sem_status status = SEM_STATUS_NORMAL;
3897   sh4al_scache* abuf = sem;
3898   unsigned long long written = 0;
3899   PCADDR pc = abuf->addr;
3900   PCADDR npc = pc + 2;
3901
3902   {
3903     SI opval = current_cpu->h_gbr_get ();
3904     if (UNLIKELY(current_cpu->trace_result_p))
3905       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3906     current_cpu->h_grc_set (FLD (f_rn), opval);
3907   }
3908
3909   current_cpu->done_insn (npc, status);
3910 #undef FLD
3911 }
3912
3913 // ********** stc-vbr-compact: stc vbr, $rn
3914
3915 void
3916 sh4al_sem_stc_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3917         sh4al::write_stacks &buf)
3918 {
3919 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3920   sem_status status = SEM_STATUS_NORMAL;
3921   sh4al_scache* abuf = sem;
3922   unsigned long long written = 0;
3923   PCADDR pc = abuf->addr;
3924   PCADDR npc = pc + 2;
3925
3926   {
3927     SI opval = current_cpu->h_vbr_get ();
3928     if (UNLIKELY(current_cpu->trace_result_p))
3929       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3930     current_cpu->h_grc_set (FLD (f_rn), opval);
3931   }
3932
3933   current_cpu->done_insn (npc, status);
3934 #undef FLD
3935 }
3936
3937 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
3938
3939 void
3940 sh4al_sem_stcl_gbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3941         sh4al::write_stacks &buf)
3942 {
3943 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3944   sem_status status = SEM_STATUS_NORMAL;
3945   sh4al_scache* abuf = sem;
3946   unsigned long long written = 0;
3947   PCADDR pc = abuf->addr;
3948   PCADDR npc = pc + 2;
3949
3950 {
3951   DI tmp_addr;
3952   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3953   {
3954     SI opval = current_cpu->h_gbr_get ();
3955     if (UNLIKELY(current_cpu->trace_result_p))
3956       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3957     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3958   }
3959   {
3960     SI opval = tmp_addr;
3961     if (UNLIKELY(current_cpu->trace_result_p))
3962       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3963     current_cpu->h_grc_set (FLD (f_rn), opval);
3964   }
3965 }
3966
3967   current_cpu->done_insn (npc, status);
3968 #undef FLD
3969 }
3970
3971 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
3972
3973 void
3974 sh4al_sem_stcl_vbr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
3975         sh4al::write_stacks &buf)
3976 {
3977 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
3978   sem_status status = SEM_STATUS_NORMAL;
3979   sh4al_scache* abuf = sem;
3980   unsigned long long written = 0;
3981   PCADDR pc = abuf->addr;
3982   PCADDR npc = pc + 2;
3983
3984 {
3985   DI tmp_addr;
3986   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3987   {
3988     SI opval = current_cpu->h_vbr_get ();
3989     if (UNLIKELY(current_cpu->trace_result_p))
3990       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3991     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3992   }
3993   {
3994     SI opval = tmp_addr;
3995     if (UNLIKELY(current_cpu->trace_result_p))
3996       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3997     current_cpu->h_grc_set (FLD (f_rn), opval);
3998   }
3999 }
4000
4001   current_cpu->done_insn (npc, status);
4002 #undef FLD
4003 }
4004
4005 // ********** sts-mach-compact: sts mach, $rn
4006
4007 void
4008 sh4al_sem_sts_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4009         sh4al::write_stacks &buf)
4010 {
4011 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4012   sem_status status = SEM_STATUS_NORMAL;
4013   sh4al_scache* abuf = sem;
4014   unsigned long long written = 0;
4015   PCADDR pc = abuf->addr;
4016   PCADDR npc = pc + 2;
4017
4018   {
4019     SI opval = current_cpu->h_mach_get ();
4020     if (UNLIKELY(current_cpu->trace_result_p))
4021       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4022     current_cpu->h_grc_set (FLD (f_rn), opval);
4023   }
4024
4025   current_cpu->done_insn (npc, status);
4026 #undef FLD
4027 }
4028
4029 // ********** stsl-mach-compact: sts.l mach, @-$rn
4030
4031 void
4032 sh4al_sem_stsl_mach_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4033         sh4al::write_stacks &buf)
4034 {
4035 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4036   sem_status status = SEM_STATUS_NORMAL;
4037   sh4al_scache* abuf = sem;
4038   unsigned long long written = 0;
4039   PCADDR pc = abuf->addr;
4040   PCADDR npc = pc + 2;
4041
4042 {
4043   DI tmp_addr;
4044   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4045   {
4046     SI opval = current_cpu->h_mach_get ();
4047     if (UNLIKELY(current_cpu->trace_result_p))
4048       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
4049     current_cpu->SETMEMSI (pc, tmp_addr, opval);
4050   }
4051   {
4052     SI opval = tmp_addr;
4053     if (UNLIKELY(current_cpu->trace_result_p))
4054       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4055     current_cpu->h_grc_set (FLD (f_rn), opval);
4056   }
4057 }
4058
4059   current_cpu->done_insn (npc, status);
4060 #undef FLD
4061 }
4062
4063 // ********** sts-macl-compact: sts macl, $rn
4064
4065 void
4066 sh4al_sem_sts_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4067         sh4al::write_stacks &buf)
4068 {
4069 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4070   sem_status status = SEM_STATUS_NORMAL;
4071   sh4al_scache* abuf = sem;
4072   unsigned long long written = 0;
4073   PCADDR pc = abuf->addr;
4074   PCADDR npc = pc + 2;
4075
4076   {
4077     SI opval = current_cpu->h_macl_get ();
4078     if (UNLIKELY(current_cpu->trace_result_p))
4079       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4080     current_cpu->h_grc_set (FLD (f_rn), opval);
4081   }
4082
4083   current_cpu->done_insn (npc, status);
4084 #undef FLD
4085 }
4086
4087 // ********** stsl-macl-compact: sts.l macl, @-$rn
4088
4089 void
4090 sh4al_sem_stsl_macl_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4091         sh4al::write_stacks &buf)
4092 {
4093 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4094   sem_status status = SEM_STATUS_NORMAL;
4095   sh4al_scache* abuf = sem;
4096   unsigned long long written = 0;
4097   PCADDR pc = abuf->addr;
4098   PCADDR npc = pc + 2;
4099
4100 {
4101   DI tmp_addr;
4102   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4103   {
4104     SI opval = current_cpu->h_macl_get ();
4105     if (UNLIKELY(current_cpu->trace_result_p))
4106       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
4107     current_cpu->SETMEMSI (pc, tmp_addr, opval);
4108   }
4109   {
4110     SI opval = tmp_addr;
4111     if (UNLIKELY(current_cpu->trace_result_p))
4112       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4113     current_cpu->h_grc_set (FLD (f_rn), opval);
4114   }
4115 }
4116
4117   current_cpu->done_insn (npc, status);
4118 #undef FLD
4119 }
4120
4121 // ********** sts-pr-compact: sts pr, $rn
4122
4123 void
4124 sh4al_sem_sts_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4125         sh4al::write_stacks &buf)
4126 {
4127 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4128   sem_status status = SEM_STATUS_NORMAL;
4129   sh4al_scache* abuf = sem;
4130   unsigned long long written = 0;
4131   PCADDR pc = abuf->addr;
4132   PCADDR npc = pc + 2;
4133
4134   {
4135     SI opval = current_cpu->h_pr_get ();
4136     if (UNLIKELY(current_cpu->trace_result_p))
4137       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4138     current_cpu->h_grc_set (FLD (f_rn), opval);
4139   }
4140
4141   current_cpu->done_insn (npc, status);
4142 #undef FLD
4143 }
4144
4145 // ********** stsl-pr-compact: sts.l pr, @-$rn
4146
4147 void
4148 sh4al_sem_stsl_pr_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4149         sh4al::write_stacks &buf)
4150 {
4151 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4152   sem_status status = SEM_STATUS_NORMAL;
4153   sh4al_scache* abuf = sem;
4154   unsigned long long written = 0;
4155   PCADDR pc = abuf->addr;
4156   PCADDR npc = pc + 2;
4157
4158 {
4159   DI tmp_addr;
4160   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
4161   {
4162     SI opval = current_cpu->h_pr_get ();
4163     if (UNLIKELY(current_cpu->trace_result_p))
4164       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
4165     current_cpu->SETMEMSI (pc, tmp_addr, opval);
4166   }
4167   {
4168     SI opval = tmp_addr;
4169     if (UNLIKELY(current_cpu->trace_result_p))
4170       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4171     current_cpu->h_grc_set (FLD (f_rn), opval);
4172   }
4173 }
4174
4175   current_cpu->done_insn (npc, status);
4176 #undef FLD
4177 }
4178
4179 // ********** sub-compact: sub $rm, $rn
4180
4181 void
4182 sh4al_sem_sub_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4183         sh4al::write_stacks &buf)
4184 {
4185 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4186   sem_status status = SEM_STATUS_NORMAL;
4187   sh4al_scache* abuf = sem;
4188   unsigned long long written = 0;
4189   PCADDR pc = abuf->addr;
4190   PCADDR npc = pc + 2;
4191
4192   {
4193     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4194     if (UNLIKELY(current_cpu->trace_result_p))
4195       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4196     current_cpu->h_grc_set (FLD (f_rn), opval);
4197   }
4198
4199   current_cpu->done_insn (npc, status);
4200 #undef FLD
4201 }
4202
4203 // ********** subc-compact: subc $rm, $rn
4204
4205 void
4206 sh4al_sem_subc_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4207         sh4al::write_stacks &buf)
4208 {
4209 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4210   sem_status status = SEM_STATUS_NORMAL;
4211   sh4al_scache* abuf = sem;
4212   unsigned long long written = 0;
4213   PCADDR pc = abuf->addr;
4214   PCADDR npc = pc + 2;
4215
4216 {
4217   BI tmp_flag;
4218   tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4219   {
4220     SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4221     if (UNLIKELY(current_cpu->trace_result_p))
4222       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4223     current_cpu->h_grc_set (FLD (f_rn), opval);
4224   }
4225   {
4226     BI opval = tmp_flag;
4227     if (UNLIKELY(current_cpu->trace_result_p))
4228       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4229     current_cpu->h_tbit_set (opval);
4230   }
4231 }
4232
4233   current_cpu->done_insn (npc, status);
4234 #undef FLD
4235 }
4236
4237 // ********** subv-compact: subv $rm, $rn
4238
4239 void
4240 sh4al_sem_subv_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4241         sh4al::write_stacks &buf)
4242 {
4243 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4244   sem_status status = SEM_STATUS_NORMAL;
4245   sh4al_scache* abuf = sem;
4246   unsigned long long written = 0;
4247   PCADDR pc = abuf->addr;
4248   PCADDR npc = pc + 2;
4249
4250 {
4251   BI tmp_t;
4252   tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
4253   {
4254     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4255     if (UNLIKELY(current_cpu->trace_result_p))
4256       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4257     current_cpu->h_grc_set (FLD (f_rn), opval);
4258   }
4259   {
4260     BI opval = ((tmp_t) ? (1) : (0));
4261     if (UNLIKELY(current_cpu->trace_result_p))
4262       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4263     current_cpu->h_tbit_set (opval);
4264   }
4265 }
4266
4267   current_cpu->done_insn (npc, status);
4268 #undef FLD
4269 }
4270
4271 // ********** swapb-compact: swap.b $rm, $rn
4272
4273 void
4274 sh4al_sem_swapb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4275         sh4al::write_stacks &buf)
4276 {
4277 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4278   sem_status status = SEM_STATUS_NORMAL;
4279   sh4al_scache* abuf = sem;
4280   unsigned long long written = 0;
4281   PCADDR pc = abuf->addr;
4282   PCADDR npc = pc + 2;
4283
4284 {
4285   UHI tmp_top_half;
4286   UQI tmp_byte1;
4287   UQI tmp_byte0;
4288   tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
4289   tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
4290   tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
4291   {
4292     SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
4293     if (UNLIKELY(current_cpu->trace_result_p))
4294       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4295     current_cpu->h_grc_set (FLD (f_rn), opval);
4296   }
4297 }
4298
4299   current_cpu->done_insn (npc, status);
4300 #undef FLD
4301 }
4302
4303 // ********** swapw-compact: swap.w $rm, $rn
4304
4305 void
4306 sh4al_sem_swapw_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4307         sh4al::write_stacks &buf)
4308 {
4309 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4310   sem_status status = SEM_STATUS_NORMAL;
4311   sh4al_scache* abuf = sem;
4312   unsigned long long written = 0;
4313   PCADDR pc = abuf->addr;
4314   PCADDR npc = pc + 2;
4315
4316   {
4317     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
4318     if (UNLIKELY(current_cpu->trace_result_p))
4319       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4320     current_cpu->h_grc_set (FLD (f_rn), opval);
4321   }
4322
4323   current_cpu->done_insn (npc, status);
4324 #undef FLD
4325 }
4326
4327 // ********** tasb-compact: tas.b @$rn
4328
4329 void
4330 sh4al_sem_tasb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4331         sh4al::write_stacks &buf)
4332 {
4333 #define FLD(f) abuf->fields.sfmt_movual2_compact.f
4334   sem_status status = SEM_STATUS_NORMAL;
4335   sh4al_scache* abuf = sem;
4336   unsigned long long written = 0;
4337   PCADDR pc = abuf->addr;
4338   PCADDR npc = pc + 2;
4339
4340 {
4341   UQI tmp_byte;
4342   tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
4343   {
4344     BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
4345     if (UNLIKELY(current_cpu->trace_result_p))
4346       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4347     current_cpu->h_tbit_set (opval);
4348   }
4349   tmp_byte = ORQI (tmp_byte, 128);
4350   {
4351     UQI opval = tmp_byte;
4352     if (UNLIKELY(current_cpu->trace_result_p))
4353       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
4354     current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
4355   }
4356 }
4357
4358   current_cpu->done_insn (npc, status);
4359 #undef FLD
4360 }
4361
4362 // ********** trapa-compact: trapa #$uimm8
4363
4364 void
4365 sh4al_sem_trapa_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4366         sh4al::write_stacks &buf)
4367 {
4368 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4369   sem_status status = SEM_STATUS_NORMAL;
4370   sh4al_scache* abuf = sem;
4371   unsigned long long written = 0;
4372   PCADDR pc = abuf->addr;
4373   PCADDR npc = pc + 2;
4374
4375 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4376
4377   current_cpu->done_insn (npc, status);
4378 #undef FLD
4379 }
4380
4381 // ********** tst-compact: tst $rm, $rn
4382
4383 void
4384 sh4al_sem_tst_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4385         sh4al::write_stacks &buf)
4386 {
4387 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
4388   sem_status status = SEM_STATUS_NORMAL;
4389   sh4al_scache* abuf = sem;
4390   unsigned long long written = 0;
4391   PCADDR pc = abuf->addr;
4392   PCADDR npc = pc + 2;
4393
4394   {
4395     BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
4396     if (UNLIKELY(current_cpu->trace_result_p))
4397       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4398     current_cpu->h_tbit_set (opval);
4399   }
4400
4401   current_cpu->done_insn (npc, status);
4402 #undef FLD
4403 }
4404
4405 // ********** tsti-compact: tst #$uimm8, r0
4406
4407 void
4408 sh4al_sem_tsti_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4409         sh4al::write_stacks &buf)
4410 {
4411 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4412   sem_status status = SEM_STATUS_NORMAL;
4413   sh4al_scache* abuf = sem;
4414   unsigned long long written = 0;
4415   PCADDR pc = abuf->addr;
4416   PCADDR npc = pc + 2;
4417
4418   {
4419     BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
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 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
4430
4431 void
4432 sh4al_sem_tstb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4433         sh4al::write_stacks &buf)
4434 {
4435 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4436   sem_status status = SEM_STATUS_NORMAL;
4437   sh4al_scache* abuf = sem;
4438   unsigned long long written = 0;
4439   PCADDR pc = abuf->addr;
4440   PCADDR npc = pc + 2;
4441
4442 {
4443   DI tmp_addr;
4444   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4445   {
4446     BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
4447     if (UNLIKELY(current_cpu->trace_result_p))
4448       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4449     current_cpu->h_tbit_set (opval);
4450   }
4451 }
4452
4453   current_cpu->done_insn (npc, status);
4454 #undef FLD
4455 }
4456
4457 // ********** xor-compact: xor $rm64, $rn64
4458
4459 void
4460 sh4al_sem_xor_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4461         sh4al::write_stacks &buf)
4462 {
4463 #define FLD(f) abuf->fields.sfmt_and_compact.f
4464   sem_status status = SEM_STATUS_NORMAL;
4465   sh4al_scache* abuf = sem;
4466   unsigned long long written = 0;
4467   PCADDR pc = abuf->addr;
4468   PCADDR npc = pc + 2;
4469
4470   {
4471     DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
4472     if (UNLIKELY(current_cpu->trace_result_p))
4473       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4474     current_cpu->h_gr_set (FLD (f_rn), opval);
4475   }
4476
4477   current_cpu->done_insn (npc, status);
4478 #undef FLD
4479 }
4480
4481 // ********** xori-compact: xor #$uimm8, r0
4482
4483 void
4484 sh4al_sem_xori_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4485         sh4al::write_stacks &buf)
4486 {
4487 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4488   sem_status status = SEM_STATUS_NORMAL;
4489   sh4al_scache* abuf = sem;
4490   unsigned long long written = 0;
4491   PCADDR pc = abuf->addr;
4492   PCADDR npc = pc + 2;
4493
4494   {
4495     SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4496     if (UNLIKELY(current_cpu->trace_result_p))
4497       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
4498     current_cpu->h_grc_set (((UINT) 0), opval);
4499   }
4500
4501   current_cpu->done_insn (npc, status);
4502 #undef FLD
4503 }
4504
4505 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
4506
4507 void
4508 sh4al_sem_xorb_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4509         sh4al::write_stacks &buf)
4510 {
4511 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4512   sem_status status = SEM_STATUS_NORMAL;
4513   sh4al_scache* abuf = sem;
4514   unsigned long long written = 0;
4515   PCADDR pc = abuf->addr;
4516   PCADDR npc = pc + 2;
4517
4518 {
4519   DI tmp_addr;
4520   UQI tmp_data;
4521   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4522   tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4523   {
4524     UQI opval = tmp_data;
4525     if (UNLIKELY(current_cpu->trace_result_p))
4526       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
4527     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4528   }
4529 }
4530
4531   current_cpu->done_insn (npc, status);
4532 #undef FLD
4533 }
4534
4535 // ********** xtrct-compact: xtrct $rm, $rn
4536
4537 void
4538 sh4al_sem_xtrct_compact (sh4al_cpu* current_cpu, sh4al_scache* sem, const int tick, 
4539         sh4al::write_stacks &buf)
4540 {
4541 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4542   sem_status status = SEM_STATUS_NORMAL;
4543   sh4al_scache* abuf = sem;
4544   unsigned long long written = 0;
4545   PCADDR pc = abuf->addr;
4546   PCADDR npc = pc + 2;
4547
4548   {
4549     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
4550     if (UNLIKELY(current_cpu->trace_result_p))
4551       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4552     current_cpu->h_grc_set (FLD (f_rn), opval);
4553   }
4554
4555   current_cpu->done_insn (npc, status);
4556 #undef FLD
4557 }
4558