OSDN Git Service

* cgen-cpu.h: Update for new location of cgen/bitset.h.
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / cgen-cpu / sh / sh3-sem.cxx
1 /* Simulator instruction semantics for sh3.
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 "sh3.h"
17
18 using namespace sh3; // FIXME: namespace organization still wip
19 using namespace sh3; // FIXME: namespace organization still wip
20 #define GET_ATTR(name) GET_ATTR_##name ()
21
22
23 // ********** x-invalid: --invalid--
24
25 void
26 sh3_sem_x_invalid (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
27         sh3::write_stacks &buf)
28 {
29 #define FLD(f) abuf->fields.fmt_empty.f
30   sem_status status = SEM_STATUS_NORMAL;
31   sh3_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 sh3_sem_add_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
50         sh3::write_stacks &buf)
51 {
52 #define FLD(f) abuf->fields.sfmt_macl_compact.f
53   sem_status status = SEM_STATUS_NORMAL;
54   sh3_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 sh3_sem_addi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
74         sh3::write_stacks &buf)
75 {
76 #define FLD(f) abuf->fields.sfmt_addi_compact.f
77   sem_status status = SEM_STATUS_NORMAL;
78   sh3_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 sh3_sem_addc_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
98         sh3::write_stacks &buf)
99 {
100 #define FLD(f) abuf->fields.sfmt_macl_compact.f
101   sem_status status = SEM_STATUS_NORMAL;
102   sh3_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 sh3_sem_addv_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
132         sh3::write_stacks &buf)
133 {
134 #define FLD(f) abuf->fields.sfmt_macl_compact.f
135   sem_status status = SEM_STATUS_NORMAL;
136   sh3_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 sh3_sem_and_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
166         sh3::write_stacks &buf)
167 {
168 #define FLD(f) abuf->fields.sfmt_and_compact.f
169   sem_status status = SEM_STATUS_NORMAL;
170   sh3_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 sh3_sem_andi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
190         sh3::write_stacks &buf)
191 {
192 #define FLD(f) abuf->fields.sfmt_andi_compact.f
193   sem_status status = SEM_STATUS_NORMAL;
194   sh3_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 sh3_sem_andb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
214         sh3::write_stacks &buf)
215 {
216 #define FLD(f) abuf->fields.sfmt_andi_compact.f
217   sem_status status = SEM_STATUS_NORMAL;
218   sh3_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 sh3_sem_bf_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
244         sh3::write_stacks &buf)
245 {
246 #define FLD(f) abuf->fields.sfmt_bf_compact.f
247   sem_status status = SEM_STATUS_NORMAL;
248   sh3_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 sh3_sem_bfs_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
272         sh3::write_stacks &buf)
273 {
274 #define FLD(f) abuf->fields.sfmt_bf_compact.f
275   sem_status status = SEM_STATUS_NORMAL;
276   sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bra_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
309         sh3::write_stacks &buf)
310 {
311 #define FLD(f) abuf->fields.sfmt_bra_compact.f
312   sem_status status = SEM_STATUS_NORMAL;
313   sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_braf_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
342         sh3::write_stacks &buf)
343 {
344 #define FLD(f) abuf->fields.sfmt_addi_compact.f
345   sem_status status = SEM_STATUS_NORMAL;
346   sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bsr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
375         sh3::write_stacks &buf)
376 {
377 #define FLD(f) abuf->fields.sfmt_bra_compact.f
378   sem_status status = SEM_STATUS_NORMAL;
379   sh3_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) % sh3::pipe_sz].push (sh3::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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bsrf_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
414         sh3::write_stacks &buf)
415 {
416 #define FLD(f) abuf->fields.sfmt_addi_compact.f
417   sem_status status = SEM_STATUS_NORMAL;
418   sh3_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) % sh3::pipe_sz].push (sh3::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) % sh3::pipe_sz].push (sh3::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 sh3_sem_bt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
453         sh3::write_stacks &buf)
454 {
455 #define FLD(f) abuf->fields.sfmt_bf_compact.f
456   sem_status status = SEM_STATUS_NORMAL;
457   sh3_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 sh3_sem_bts_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
481         sh3::write_stacks &buf)
482 {
483 #define FLD(f) abuf->fields.sfmt_bf_compact.f
484   sem_status status = SEM_STATUS_NORMAL;
485   sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_clrmac_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
518         sh3::write_stacks &buf)
519 {
520 #define FLD(f) abuf->fields.fmt_empty.f
521   sem_status status = SEM_STATUS_NORMAL;
522   sh3_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 sh3_sem_clrs_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
550         sh3::write_stacks &buf)
551 {
552 #define FLD(f) abuf->fields.fmt_empty.f
553   sem_status status = SEM_STATUS_NORMAL;
554   sh3_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 sh3_sem_clrt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
574         sh3::write_stacks &buf)
575 {
576 #define FLD(f) abuf->fields.fmt_empty.f
577   sem_status status = SEM_STATUS_NORMAL;
578   sh3_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 sh3_sem_cmpeq_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
598         sh3::write_stacks &buf)
599 {
600 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
601   sem_status status = SEM_STATUS_NORMAL;
602   sh3_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 sh3_sem_cmpeqi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
622         sh3::write_stacks &buf)
623 {
624 #define FLD(f) abuf->fields.sfmt_andi_compact.f
625   sem_status status = SEM_STATUS_NORMAL;
626   sh3_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 sh3_sem_cmpge_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
646         sh3::write_stacks &buf)
647 {
648 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
649   sem_status status = SEM_STATUS_NORMAL;
650   sh3_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 sh3_sem_cmpgt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
670         sh3::write_stacks &buf)
671 {
672 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
673   sem_status status = SEM_STATUS_NORMAL;
674   sh3_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 sh3_sem_cmphi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
694         sh3::write_stacks &buf)
695 {
696 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
697   sem_status status = SEM_STATUS_NORMAL;
698   sh3_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 sh3_sem_cmphs_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
718         sh3::write_stacks &buf)
719 {
720 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
721   sem_status status = SEM_STATUS_NORMAL;
722   sh3_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 sh3_sem_cmppl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
742         sh3::write_stacks &buf)
743 {
744 #define FLD(f) abuf->fields.sfmt_addi_compact.f
745   sem_status status = SEM_STATUS_NORMAL;
746   sh3_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 sh3_sem_cmppz_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
766         sh3::write_stacks &buf)
767 {
768 #define FLD(f) abuf->fields.sfmt_addi_compact.f
769   sem_status status = SEM_STATUS_NORMAL;
770   sh3_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 sh3_sem_cmpstr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
790         sh3::write_stacks &buf)
791 {
792 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
793   sem_status status = SEM_STATUS_NORMAL;
794   sh3_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 sh3_sem_div0s_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
823         sh3::write_stacks &buf)
824 {
825 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
826   sem_status status = SEM_STATUS_NORMAL;
827   sh3_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 sh3_sem_div0u_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
861         sh3::write_stacks &buf)
862 {
863 #define FLD(f) abuf->fields.fmt_empty.f
864   sem_status status = SEM_STATUS_NORMAL;
865   sh3_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 sh3_sem_div1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
899         sh3::write_stacks &buf)
900 {
901 #define FLD(f) abuf->fields.sfmt_macl_compact.f
902   sem_status status = SEM_STATUS_NORMAL;
903   sh3_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 sh3_sem_dmulsl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1050         sh3::write_stacks &buf)
1051 {
1052 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1053   sem_status status = SEM_STATUS_NORMAL;
1054   sh3_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 sh3_sem_dmulul_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1084         sh3::write_stacks &buf)
1085 {
1086 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1087   sem_status status = SEM_STATUS_NORMAL;
1088   sh3_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 sh3_sem_dt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1118         sh3::write_stacks &buf)
1119 {
1120 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1121   sem_status status = SEM_STATUS_NORMAL;
1122   sh3_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 sh3_sem_extsb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1150         sh3::write_stacks &buf)
1151 {
1152 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1153   sem_status status = SEM_STATUS_NORMAL;
1154   sh3_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 sh3_sem_extsw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1174         sh3::write_stacks &buf)
1175 {
1176 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1177   sem_status status = SEM_STATUS_NORMAL;
1178   sh3_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 sh3_sem_extub_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1198         sh3::write_stacks &buf)
1199 {
1200 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1201   sem_status status = SEM_STATUS_NORMAL;
1202   sh3_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 sh3_sem_extuw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1222         sh3::write_stacks &buf)
1223 {
1224 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
1225   sem_status status = SEM_STATUS_NORMAL;
1226   sh3_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 sh3_sem_frchg_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1246         sh3::write_stacks &buf)
1247 {
1248 #define FLD(f) abuf->fields.fmt_empty.f
1249   sem_status status = SEM_STATUS_NORMAL;
1250   sh3_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 sh3_sem_fschg_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1270         sh3::write_stacks &buf)
1271 {
1272 #define FLD(f) abuf->fields.fmt_empty.f
1273   sem_status status = SEM_STATUS_NORMAL;
1274   sh3_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 sh3_sem_jmp_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1294         sh3::write_stacks &buf)
1295 {
1296 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1297   sem_status status = SEM_STATUS_NORMAL;
1298   sh3_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) % sh3::pipe_sz].push (sh3::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 sh3_sem_jsr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1328         sh3::write_stacks &buf)
1329 {
1330 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1331   sem_status status = SEM_STATUS_NORMAL;
1332   sh3_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) % sh3::pipe_sz].push (sh3::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) % sh3::pipe_sz].push (sh3::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 sh3_sem_ldc_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1368         sh3::write_stacks &buf)
1369 {
1370 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1371   sem_status status = SEM_STATUS_NORMAL;
1372   sh3_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 sh3_sem_ldc_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1392         sh3::write_stacks &buf)
1393 {
1394 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1395   sem_status status = SEM_STATUS_NORMAL;
1396   sh3_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 sh3_sem_ldc_sr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1416         sh3::write_stacks &buf)
1417 {
1418 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1419   sem_status status = SEM_STATUS_NORMAL;
1420   sh3_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 sh3_sem_ldcl_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1440         sh3::write_stacks &buf)
1441 {
1442 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1443   sem_status status = SEM_STATUS_NORMAL;
1444   sh3_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 sh3_sem_ldcl_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1472         sh3::write_stacks &buf)
1473 {
1474 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1475   sem_status status = SEM_STATUS_NORMAL;
1476   sh3_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 sh3_sem_lds_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1504         sh3::write_stacks &buf)
1505 {
1506 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1507   sem_status status = SEM_STATUS_NORMAL;
1508   sh3_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 sh3_sem_ldsl_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1528         sh3::write_stacks &buf)
1529 {
1530 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1531   sem_status status = SEM_STATUS_NORMAL;
1532   sh3_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 sh3_sem_lds_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1560         sh3::write_stacks &buf)
1561 {
1562 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1563   sem_status status = SEM_STATUS_NORMAL;
1564   sh3_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 sh3_sem_ldsl_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1584         sh3::write_stacks &buf)
1585 {
1586 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1587   sem_status status = SEM_STATUS_NORMAL;
1588   sh3_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 sh3_sem_lds_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1616         sh3::write_stacks &buf)
1617 {
1618 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1619   sem_status status = SEM_STATUS_NORMAL;
1620   sh3_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 sh3_sem_ldsl_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1640         sh3::write_stacks &buf)
1641 {
1642 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1643   sem_status status = SEM_STATUS_NORMAL;
1644   sh3_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 sh3_sem_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1672         sh3::write_stacks &buf)
1673 {
1674 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1675   sem_status status = SEM_STATUS_NORMAL;
1676   sh3_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 sh3_sem_macw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1762         sh3::write_stacks &buf)
1763 {
1764 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1765   sem_status status = SEM_STATUS_NORMAL;
1766   sh3_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 sh3_sem_mov_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1860         sh3::write_stacks &buf)
1861 {
1862 #define FLD(f) abuf->fields.sfmt_and_compact.f
1863   sem_status status = SEM_STATUS_NORMAL;
1864   sh3_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 sh3_sem_movi_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1884         sh3::write_stacks &buf)
1885 {
1886 #define FLD(f) abuf->fields.sfmt_addi_compact.f
1887   sem_status status = SEM_STATUS_NORMAL;
1888   sh3_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 sh3_sem_movb1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1908         sh3::write_stacks &buf)
1909 {
1910 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
1911   sem_status status = SEM_STATUS_NORMAL;
1912   sh3_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 sh3_sem_movb2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1932         sh3::write_stacks &buf)
1933 {
1934 #define FLD(f) abuf->fields.sfmt_macl_compact.f
1935   sem_status status = SEM_STATUS_NORMAL;
1936   sh3_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 sh3_sem_movb3_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1966         sh3::write_stacks &buf)
1967 {
1968 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
1969   sem_status status = SEM_STATUS_NORMAL;
1970   sh3_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 sh3_sem_movb4_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
1990         sh3::write_stacks &buf)
1991 {
1992 #define FLD(f) abuf->fields.sfmt_andi_compact.f
1993   sem_status status = SEM_STATUS_NORMAL;
1994   sh3_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 sh3_sem_movb5_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2018         sh3::write_stacks &buf)
2019 {
2020 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2021   sem_status status = SEM_STATUS_NORMAL;
2022   sh3_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 sh3_sem_movb6_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2046         sh3::write_stacks &buf)
2047 {
2048 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2049   sem_status status = SEM_STATUS_NORMAL;
2050   sh3_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 sh3_sem_movb7_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2070         sh3::write_stacks &buf)
2071 {
2072 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2073   sem_status status = SEM_STATUS_NORMAL;
2074   sh3_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 sh3_sem_movb8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2116         sh3::write_stacks &buf)
2117 {
2118 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2119   sem_status status = SEM_STATUS_NORMAL;
2120   sh3_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 sh3_sem_movb9_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2140         sh3::write_stacks &buf)
2141 {
2142 #define FLD(f) abuf->fields.sfmt_andi_compact.f
2143   sem_status status = SEM_STATUS_NORMAL;
2144   sh3_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 sh3_sem_movb10_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2164         sh3::write_stacks &buf)
2165 {
2166 #define FLD(f) abuf->fields.sfmt_movb10_compact.f
2167   sem_status status = SEM_STATUS_NORMAL;
2168   sh3_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 sh3_sem_movl1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2188         sh3::write_stacks &buf)
2189 {
2190 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2191   sem_status status = SEM_STATUS_NORMAL;
2192   sh3_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 sh3_sem_movl2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2212         sh3::write_stacks &buf)
2213 {
2214 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2215   sem_status status = SEM_STATUS_NORMAL;
2216   sh3_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 sh3_sem_movl3_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2246         sh3::write_stacks &buf)
2247 {
2248 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2249   sem_status status = SEM_STATUS_NORMAL;
2250   sh3_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 sh3_sem_movl4_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2270         sh3::write_stacks &buf)
2271 {
2272 #define FLD(f) abuf->fields.sfmt_movl4_compact.f
2273   sem_status status = SEM_STATUS_NORMAL;
2274   sh3_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 sh3_sem_movl5_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2294         sh3::write_stacks &buf)
2295 {
2296 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2297   sem_status status = SEM_STATUS_NORMAL;
2298   sh3_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 sh3_sem_movl6_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2318         sh3::write_stacks &buf)
2319 {
2320 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2321   sem_status status = SEM_STATUS_NORMAL;
2322   sh3_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 sh3_sem_movl7_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2342         sh3::write_stacks &buf)
2343 {
2344 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2345   sem_status status = SEM_STATUS_NORMAL;
2346   sh3_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 sh3_sem_movl8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2386         sh3::write_stacks &buf)
2387 {
2388 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2389   sem_status status = SEM_STATUS_NORMAL;
2390   sh3_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 sh3_sem_movl9_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2410         sh3::write_stacks &buf)
2411 {
2412 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2413   sem_status status = SEM_STATUS_NORMAL;
2414   sh3_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 sh3_sem_movl10_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2434         sh3::write_stacks &buf)
2435 {
2436 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
2437   sem_status status = SEM_STATUS_NORMAL;
2438   sh3_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 sh3_sem_movl11_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2458         sh3::write_stacks &buf)
2459 {
2460 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2461   sem_status status = SEM_STATUS_NORMAL;
2462   sh3_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 sh3_sem_movw1_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2482         sh3::write_stacks &buf)
2483 {
2484 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2485   sem_status status = SEM_STATUS_NORMAL;
2486   sh3_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 sh3_sem_movw2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2506         sh3::write_stacks &buf)
2507 {
2508 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2509   sem_status status = SEM_STATUS_NORMAL;
2510   sh3_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 sh3_sem_movw3_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2540         sh3::write_stacks &buf)
2541 {
2542 #define FLD(f) abuf->fields.sfmt_movb3_compact.f
2543   sem_status status = SEM_STATUS_NORMAL;
2544   sh3_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 sh3_sem_movw4_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2564         sh3::write_stacks &buf)
2565 {
2566 #define FLD(f) abuf->fields.sfmt_movw4_compact.f
2567   sem_status status = SEM_STATUS_NORMAL;
2568   sh3_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 sh3_sem_movw5_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2588         sh3::write_stacks &buf)
2589 {
2590 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
2591   sem_status status = SEM_STATUS_NORMAL;
2592   sh3_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 sh3_sem_movw6_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2612         sh3::write_stacks &buf)
2613 {
2614 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2615   sem_status status = SEM_STATUS_NORMAL;
2616   sh3_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 sh3_sem_movw7_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2636         sh3::write_stacks &buf)
2637 {
2638 #define FLD(f) abuf->fields.sfmt_macl_compact.f
2639   sem_status status = SEM_STATUS_NORMAL;
2640   sh3_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 sh3_sem_movw8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2682         sh3::write_stacks &buf)
2683 {
2684 #define FLD(f) abuf->fields.sfmt_movb8_compact.f
2685   sem_status status = SEM_STATUS_NORMAL;
2686   sh3_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 sh3_sem_movw9_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2706         sh3::write_stacks &buf)
2707 {
2708 #define FLD(f) abuf->fields.sfmt_movw9_compact.f
2709   sem_status status = SEM_STATUS_NORMAL;
2710   sh3_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 sh3_sem_movw10_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2730         sh3::write_stacks &buf)
2731 {
2732 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2733   sem_status status = SEM_STATUS_NORMAL;
2734   sh3_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 sh3_sem_movw11_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2754         sh3::write_stacks &buf)
2755 {
2756 #define FLD(f) abuf->fields.sfmt_movw11_compact.f
2757   sem_status status = SEM_STATUS_NORMAL;
2758   sh3_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 sh3_sem_mova_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2778         sh3::write_stacks &buf)
2779 {
2780 #define FLD(f) abuf->fields.sfmt_movl9_compact.f
2781   sem_status status = SEM_STATUS_NORMAL;
2782   sh3_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 // ********** movt-compact: movt $rn
2799
2800 void
2801 sh3_sem_movt_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2802         sh3::write_stacks &buf)
2803 {
2804 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2805   sem_status status = SEM_STATUS_NORMAL;
2806   sh3_scache* abuf = sem;
2807   unsigned long long written = 0;
2808   PCADDR pc = abuf->addr;
2809   PCADDR npc = pc + 2;
2810
2811   {
2812     SI opval = ZEXTBISI (current_cpu->h_tbit_get ());
2813     if (UNLIKELY(current_cpu->trace_result_p))
2814       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2815     current_cpu->h_grc_set (FLD (f_rn), opval);
2816   }
2817
2818   current_cpu->done_insn (npc, status);
2819 #undef FLD
2820 }
2821
2822 // ********** mull-compact: mul.l $rm, $rn
2823
2824 void
2825 sh3_sem_mull_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2826         sh3::write_stacks &buf)
2827 {
2828 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2829   sem_status status = SEM_STATUS_NORMAL;
2830   sh3_scache* abuf = sem;
2831   unsigned long long written = 0;
2832   PCADDR pc = abuf->addr;
2833   PCADDR npc = pc + 2;
2834
2835   {
2836     SI opval = MULSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn)));
2837     if (UNLIKELY(current_cpu->trace_result_p))
2838       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2839     current_cpu->h_macl_set (opval);
2840   }
2841
2842   current_cpu->done_insn (npc, status);
2843 #undef FLD
2844 }
2845
2846 // ********** mulsw-compact: muls.w $rm, $rn
2847
2848 void
2849 sh3_sem_mulsw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2850         sh3::write_stacks &buf)
2851 {
2852 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2853   sem_status status = SEM_STATUS_NORMAL;
2854   sh3_scache* abuf = sem;
2855   unsigned long long written = 0;
2856   PCADDR pc = abuf->addr;
2857   PCADDR npc = pc + 2;
2858
2859   {
2860     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)));
2861     if (UNLIKELY(current_cpu->trace_result_p))
2862       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2863     current_cpu->h_macl_set (opval);
2864   }
2865
2866   current_cpu->done_insn (npc, status);
2867 #undef FLD
2868 }
2869
2870 // ********** muluw-compact: mulu.w $rm, $rn
2871
2872 void
2873 sh3_sem_muluw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2874         sh3::write_stacks &buf)
2875 {
2876 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
2877   sem_status status = SEM_STATUS_NORMAL;
2878   sh3_scache* abuf = sem;
2879   unsigned long long written = 0;
2880   PCADDR pc = abuf->addr;
2881   PCADDR npc = pc + 2;
2882
2883   {
2884     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)));
2885     if (UNLIKELY(current_cpu->trace_result_p))
2886       current_cpu->trace_stream << "macl" << ":=0x" << hex << opval << dec << "  ";
2887     current_cpu->h_macl_set (opval);
2888   }
2889
2890   current_cpu->done_insn (npc, status);
2891 #undef FLD
2892 }
2893
2894 // ********** neg-compact: neg $rm, $rn
2895
2896 void
2897 sh3_sem_neg_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2898         sh3::write_stacks &buf)
2899 {
2900 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2901   sem_status status = SEM_STATUS_NORMAL;
2902   sh3_scache* abuf = sem;
2903   unsigned long long written = 0;
2904   PCADDR pc = abuf->addr;
2905   PCADDR npc = pc + 2;
2906
2907   {
2908     SI opval = NEGSI (current_cpu->h_grc_get (FLD (f_rm)));
2909     if (UNLIKELY(current_cpu->trace_result_p))
2910       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2911     current_cpu->h_grc_set (FLD (f_rn), opval);
2912   }
2913
2914   current_cpu->done_insn (npc, status);
2915 #undef FLD
2916 }
2917
2918 // ********** negc-compact: negc $rm, $rn
2919
2920 void
2921 sh3_sem_negc_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2922         sh3::write_stacks &buf)
2923 {
2924 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
2925   sem_status status = SEM_STATUS_NORMAL;
2926   sh3_scache* abuf = sem;
2927   unsigned long long written = 0;
2928   PCADDR pc = abuf->addr;
2929   PCADDR npc = pc + 2;
2930
2931 {
2932   BI tmp_flag;
2933   tmp_flag = SUBCFSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
2934   {
2935     SI opval = SUBCSI (0, current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
2936     if (UNLIKELY(current_cpu->trace_result_p))
2937       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2938     current_cpu->h_grc_set (FLD (f_rn), opval);
2939   }
2940   {
2941     BI opval = tmp_flag;
2942     if (UNLIKELY(current_cpu->trace_result_p))
2943       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
2944     current_cpu->h_tbit_set (opval);
2945   }
2946 }
2947
2948   current_cpu->done_insn (npc, status);
2949 #undef FLD
2950 }
2951
2952 // ********** nop-compact: nop
2953
2954 void
2955 sh3_sem_nop_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2956         sh3::write_stacks &buf)
2957 {
2958 #define FLD(f) abuf->fields.fmt_empty.f
2959   sem_status status = SEM_STATUS_NORMAL;
2960   sh3_scache* abuf = sem;
2961   unsigned long long written = 0;
2962   PCADDR pc = abuf->addr;
2963   PCADDR npc = pc + 2;
2964
2965 ((void) 0); /*nop*/
2966
2967   current_cpu->done_insn (npc, status);
2968 #undef FLD
2969 }
2970
2971 // ********** not-compact: not $rm64, $rn64
2972
2973 void
2974 sh3_sem_not_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2975         sh3::write_stacks &buf)
2976 {
2977 #define FLD(f) abuf->fields.sfmt_and_compact.f
2978   sem_status status = SEM_STATUS_NORMAL;
2979   sh3_scache* abuf = sem;
2980   unsigned long long written = 0;
2981   PCADDR pc = abuf->addr;
2982   PCADDR npc = pc + 2;
2983
2984   {
2985     DI opval = INVDI (current_cpu->h_gr_get (FLD (f_rm)));
2986     if (UNLIKELY(current_cpu->trace_result_p))
2987       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
2988     current_cpu->h_gr_set (FLD (f_rn), opval);
2989   }
2990
2991   current_cpu->done_insn (npc, status);
2992 #undef FLD
2993 }
2994
2995 // ********** or-compact: or $rm64, $rn64
2996
2997 void
2998 sh3_sem_or_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
2999         sh3::write_stacks &buf)
3000 {
3001 #define FLD(f) abuf->fields.sfmt_and_compact.f
3002   sem_status status = SEM_STATUS_NORMAL;
3003   sh3_scache* abuf = sem;
3004   unsigned long long written = 0;
3005   PCADDR pc = abuf->addr;
3006   PCADDR npc = pc + 2;
3007
3008   {
3009     DI opval = ORDI (current_cpu->h_gr_get (FLD (f_rm)), current_cpu->h_gr_get (FLD (f_rn)));
3010     if (UNLIKELY(current_cpu->trace_result_p))
3011       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3012     current_cpu->h_gr_set (FLD (f_rn), opval);
3013   }
3014
3015   current_cpu->done_insn (npc, status);
3016 #undef FLD
3017 }
3018
3019 // ********** ori-compact: or #$uimm8, r0
3020
3021 void
3022 sh3_sem_ori_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3023         sh3::write_stacks &buf)
3024 {
3025 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3026   sem_status status = SEM_STATUS_NORMAL;
3027   sh3_scache* abuf = sem;
3028   unsigned long long written = 0;
3029   PCADDR pc = abuf->addr;
3030   PCADDR npc = pc + 2;
3031
3032   {
3033     SI opval = ORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
3034     if (UNLIKELY(current_cpu->trace_result_p))
3035       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
3036     current_cpu->h_grc_set (((UINT) 0), opval);
3037   }
3038
3039   current_cpu->done_insn (npc, status);
3040 #undef FLD
3041 }
3042
3043 // ********** orb-compact: or.b #$imm8, @(r0, gbr)
3044
3045 void
3046 sh3_sem_orb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3047         sh3::write_stacks &buf)
3048 {
3049 #define FLD(f) abuf->fields.sfmt_andi_compact.f
3050   sem_status status = SEM_STATUS_NORMAL;
3051   sh3_scache* abuf = sem;
3052   unsigned long long written = 0;
3053   PCADDR pc = abuf->addr;
3054   PCADDR npc = pc + 2;
3055
3056 {
3057   DI tmp_addr;
3058   UQI tmp_data;
3059   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
3060   tmp_data = ORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
3061   {
3062     UQI opval = tmp_data;
3063     if (UNLIKELY(current_cpu->trace_result_p))
3064       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
3065     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
3066   }
3067 }
3068
3069   current_cpu->done_insn (npc, status);
3070 #undef FLD
3071 }
3072
3073 // ********** pref-compact: pref @$rn
3074
3075 void
3076 sh3_sem_pref_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3077         sh3::write_stacks &buf)
3078 {
3079 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3080   sem_status status = SEM_STATUS_NORMAL;
3081   sh3_scache* abuf = sem;
3082   unsigned long long written = 0;
3083   PCADDR pc = abuf->addr;
3084   PCADDR npc = pc + 2;
3085
3086 current_cpu->sh64_pref (current_cpu->h_grc_get (FLD (f_rn)));
3087
3088   current_cpu->done_insn (npc, status);
3089 #undef FLD
3090 }
3091
3092 // ********** rotcl-compact: rotcl $rn
3093
3094 void
3095 sh3_sem_rotcl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3096         sh3::write_stacks &buf)
3097 {
3098 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3099   sem_status status = SEM_STATUS_NORMAL;
3100   sh3_scache* abuf = sem;
3101   unsigned long long written = 0;
3102   PCADDR pc = abuf->addr;
3103   PCADDR npc = pc + 2;
3104
3105 {
3106   BI tmp_temp;
3107   tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3108   {
3109     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), current_cpu->h_tbit_get ());
3110     if (UNLIKELY(current_cpu->trace_result_p))
3111       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3112     current_cpu->h_grc_set (FLD (f_rn), opval);
3113   }
3114   {
3115     BI opval = ((tmp_temp) ? (1) : (0));
3116     if (UNLIKELY(current_cpu->trace_result_p))
3117       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3118     current_cpu->h_tbit_set (opval);
3119   }
3120 }
3121
3122   current_cpu->done_insn (npc, status);
3123 #undef FLD
3124 }
3125
3126 // ********** rotcr-compact: rotcr $rn
3127
3128 void
3129 sh3_sem_rotcr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3130         sh3::write_stacks &buf)
3131 {
3132 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3133   sem_status status = SEM_STATUS_NORMAL;
3134   sh3_scache* abuf = sem;
3135   unsigned long long written = 0;
3136   PCADDR pc = abuf->addr;
3137   PCADDR npc = pc + 2;
3138
3139 {
3140   BI tmp_lsbit;
3141   SI tmp_temp;
3142   tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3143   tmp_temp = current_cpu->h_tbit_get ();
3144   {
3145     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3146     if (UNLIKELY(current_cpu->trace_result_p))
3147       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3148     current_cpu->h_grc_set (FLD (f_rn), opval);
3149   }
3150   {
3151     BI opval = ((tmp_lsbit) ? (1) : (0));
3152     if (UNLIKELY(current_cpu->trace_result_p))
3153       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3154     current_cpu->h_tbit_set (opval);
3155   }
3156 }
3157
3158   current_cpu->done_insn (npc, status);
3159 #undef FLD
3160 }
3161
3162 // ********** rotl-compact: rotl $rn
3163
3164 void
3165 sh3_sem_rotl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3166         sh3::write_stacks &buf)
3167 {
3168 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3169   sem_status status = SEM_STATUS_NORMAL;
3170   sh3_scache* abuf = sem;
3171   unsigned long long written = 0;
3172   PCADDR pc = abuf->addr;
3173   PCADDR npc = pc + 2;
3174
3175 {
3176   BI tmp_temp;
3177   tmp_temp = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3178   {
3179     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), tmp_temp);
3180     if (UNLIKELY(current_cpu->trace_result_p))
3181       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3182     current_cpu->h_grc_set (FLD (f_rn), opval);
3183   }
3184   {
3185     BI opval = ((tmp_temp) ? (1) : (0));
3186     if (UNLIKELY(current_cpu->trace_result_p))
3187       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3188     current_cpu->h_tbit_set (opval);
3189   }
3190 }
3191
3192   current_cpu->done_insn (npc, status);
3193 #undef FLD
3194 }
3195
3196 // ********** rotr-compact: rotr $rn
3197
3198 void
3199 sh3_sem_rotr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3200         sh3::write_stacks &buf)
3201 {
3202 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3203   sem_status status = SEM_STATUS_NORMAL;
3204   sh3_scache* abuf = sem;
3205   unsigned long long written = 0;
3206   PCADDR pc = abuf->addr;
3207   PCADDR npc = pc + 2;
3208
3209 {
3210   BI tmp_lsbit;
3211   SI tmp_temp;
3212   tmp_lsbit = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1), 0)) ? (0) : (1));
3213   tmp_temp = tmp_lsbit;
3214   {
3215     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
3216     if (UNLIKELY(current_cpu->trace_result_p))
3217       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3218     current_cpu->h_grc_set (FLD (f_rn), opval);
3219   }
3220   {
3221     BI opval = ((tmp_lsbit) ? (1) : (0));
3222     if (UNLIKELY(current_cpu->trace_result_p))
3223       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3224     current_cpu->h_tbit_set (opval);
3225   }
3226 }
3227
3228   current_cpu->done_insn (npc, status);
3229 #undef FLD
3230 }
3231
3232 // ********** rts-compact: rts
3233
3234 void
3235 sh3_sem_rts_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3236         sh3::write_stacks &buf)
3237 {
3238 #define FLD(f) abuf->fields.fmt_empty.f
3239   sem_status status = SEM_STATUS_NORMAL;
3240   sh3_scache* abuf = sem;
3241   unsigned long long written = 0;
3242   PCADDR pc = abuf->addr;
3243   PCADDR npc = pc + 2;
3244
3245 {
3246   {
3247     UDI opval = ADDDI (pc, 2);
3248     if (UNLIKELY(current_cpu->trace_result_p))
3249       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3250     current_cpu->branch (opval, npc, status);
3251   }
3252 current_cpu->save_delayed_pc (current_cpu->h_pr_get ());
3253   {
3254     UDI opval = current_cpu->h_pr_get ();
3255     buf.h_pc_writes [(tick + 1) % sh3::pipe_sz].push (sh3::write<UDI>(pc, opval));
3256     if (UNLIKELY(current_cpu->trace_result_p))
3257       current_cpu->trace_stream << "pc" << ":=0x" << hex << opval << dec << "  ";
3258   }
3259 current_cpu->notify_ret (current_cpu->h_pr_get ());
3260 }
3261
3262   current_cpu->done_cti_insn (npc, status);
3263 #undef FLD
3264 }
3265
3266 // ********** sets-compact: sets
3267
3268 void
3269 sh3_sem_sets_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3270         sh3::write_stacks &buf)
3271 {
3272 #define FLD(f) abuf->fields.fmt_empty.f
3273   sem_status status = SEM_STATUS_NORMAL;
3274   sh3_scache* abuf = sem;
3275   unsigned long long written = 0;
3276   PCADDR pc = abuf->addr;
3277   PCADDR npc = pc + 2;
3278
3279   {
3280     BI opval = 1;
3281     if (UNLIKELY(current_cpu->trace_result_p))
3282       current_cpu->trace_stream << "sbit" << ":=0x" << hex << opval << dec << "  ";
3283     current_cpu->h_sbit_set (opval);
3284   }
3285
3286   current_cpu->done_insn (npc, status);
3287 #undef FLD
3288 }
3289
3290 // ********** sett-compact: sett
3291
3292 void
3293 sh3_sem_sett_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3294         sh3::write_stacks &buf)
3295 {
3296 #define FLD(f) abuf->fields.fmt_empty.f
3297   sem_status status = SEM_STATUS_NORMAL;
3298   sh3_scache* abuf = sem;
3299   unsigned long long written = 0;
3300   PCADDR pc = abuf->addr;
3301   PCADDR npc = pc + 2;
3302
3303   {
3304     BI opval = 1;
3305     if (UNLIKELY(current_cpu->trace_result_p))
3306       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3307     current_cpu->h_tbit_set (opval);
3308   }
3309
3310   current_cpu->done_insn (npc, status);
3311 #undef FLD
3312 }
3313
3314 // ********** shad-compact: shad $rm, $rn
3315
3316 void
3317 sh3_sem_shad_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3318         sh3::write_stacks &buf)
3319 {
3320 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3321   sem_status status = SEM_STATUS_NORMAL;
3322   sh3_scache* abuf = sem;
3323   unsigned long long written = 0;
3324   PCADDR pc = abuf->addr;
3325   PCADDR npc = pc + 2;
3326
3327 {
3328   SI tmp_shamt;
3329   tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3330 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3331   {
3332     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3333     written |= (1ULL << 2);
3334     if (UNLIKELY(current_cpu->trace_result_p))
3335       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3336     current_cpu->h_grc_set (FLD (f_rn), opval);
3337   }
3338 } else {
3339 if (NESI (tmp_shamt, 0)) {
3340   {
3341     SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3342     written |= (1ULL << 2);
3343     if (UNLIKELY(current_cpu->trace_result_p))
3344       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3345     current_cpu->h_grc_set (FLD (f_rn), opval);
3346   }
3347 } else {
3348 if (LTSI (current_cpu->h_grc_get (FLD (f_rn)), 0)) {
3349   {
3350     SI opval = NEGSI (1);
3351     written |= (1ULL << 2);
3352     if (UNLIKELY(current_cpu->trace_result_p))
3353       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3354     current_cpu->h_grc_set (FLD (f_rn), opval);
3355   }
3356 } else {
3357   {
3358     SI opval = 0;
3359     written |= (1ULL << 2);
3360     if (UNLIKELY(current_cpu->trace_result_p))
3361       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3362     current_cpu->h_grc_set (FLD (f_rn), opval);
3363   }
3364 }
3365 }
3366 }
3367 }
3368
3369   abuf->written = written;
3370   current_cpu->done_insn (npc, status);
3371 #undef FLD
3372 }
3373
3374 // ********** shal-compact: shal $rn
3375
3376 void
3377 sh3_sem_shal_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3378         sh3::write_stacks &buf)
3379 {
3380 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3381   sem_status status = SEM_STATUS_NORMAL;
3382   sh3_scache* abuf = sem;
3383   unsigned long long written = 0;
3384   PCADDR pc = abuf->addr;
3385   PCADDR npc = pc + 2;
3386
3387 {
3388   BI tmp_t;
3389   tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3390   {
3391     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3392     if (UNLIKELY(current_cpu->trace_result_p))
3393       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3394     current_cpu->h_grc_set (FLD (f_rn), opval);
3395   }
3396   {
3397     BI opval = ((tmp_t) ? (1) : (0));
3398     if (UNLIKELY(current_cpu->trace_result_p))
3399       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3400     current_cpu->h_tbit_set (opval);
3401   }
3402 }
3403
3404   current_cpu->done_insn (npc, status);
3405 #undef FLD
3406 }
3407
3408 // ********** shar-compact: shar $rn
3409
3410 void
3411 sh3_sem_shar_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3412         sh3::write_stacks &buf)
3413 {
3414 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3415   sem_status status = SEM_STATUS_NORMAL;
3416   sh3_scache* abuf = sem;
3417   unsigned long long written = 0;
3418   PCADDR pc = abuf->addr;
3419   PCADDR npc = pc + 2;
3420
3421 {
3422   BI tmp_t;
3423   tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3424   {
3425     SI opval = SRASI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3426     if (UNLIKELY(current_cpu->trace_result_p))
3427       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3428     current_cpu->h_grc_set (FLD (f_rn), opval);
3429   }
3430   {
3431     BI opval = ((tmp_t) ? (1) : (0));
3432     if (UNLIKELY(current_cpu->trace_result_p))
3433       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3434     current_cpu->h_tbit_set (opval);
3435   }
3436 }
3437
3438   current_cpu->done_insn (npc, status);
3439 #undef FLD
3440 }
3441
3442 // ********** shld-compact: shld $rm, $rn
3443
3444 void
3445 sh3_sem_shld_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3446         sh3::write_stacks &buf)
3447 {
3448 #define FLD(f) abuf->fields.sfmt_macl_compact.f
3449   sem_status status = SEM_STATUS_NORMAL;
3450   sh3_scache* abuf = sem;
3451   unsigned long long written = 0;
3452   PCADDR pc = abuf->addr;
3453   PCADDR npc = pc + 2;
3454
3455 {
3456   SI tmp_shamt;
3457   tmp_shamt = ANDSI (current_cpu->h_grc_get (FLD (f_rm)), 31);
3458 if (GESI (current_cpu->h_grc_get (FLD (f_rm)), 0)) {
3459   {
3460     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), tmp_shamt);
3461     written |= (1ULL << 2);
3462     if (UNLIKELY(current_cpu->trace_result_p))
3463       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3464     current_cpu->h_grc_set (FLD (f_rn), opval);
3465   }
3466 } else {
3467 if (NESI (tmp_shamt, 0)) {
3468   {
3469     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), SUBSI (32, tmp_shamt));
3470     written |= (1ULL << 2);
3471     if (UNLIKELY(current_cpu->trace_result_p))
3472       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3473     current_cpu->h_grc_set (FLD (f_rn), opval);
3474   }
3475 } else {
3476   {
3477     SI opval = 0;
3478     written |= (1ULL << 2);
3479     if (UNLIKELY(current_cpu->trace_result_p))
3480       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3481     current_cpu->h_grc_set (FLD (f_rn), opval);
3482   }
3483 }
3484 }
3485 }
3486
3487   abuf->written = written;
3488   current_cpu->done_insn (npc, status);
3489 #undef FLD
3490 }
3491
3492 // ********** shll-compact: shll $rn
3493
3494 void
3495 sh3_sem_shll_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3496         sh3::write_stacks &buf)
3497 {
3498 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3499   sem_status status = SEM_STATUS_NORMAL;
3500   sh3_scache* abuf = sem;
3501   unsigned long long written = 0;
3502   PCADDR pc = abuf->addr;
3503   PCADDR npc = pc + 2;
3504
3505 {
3506   BI tmp_t;
3507   tmp_t = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 31);
3508   {
3509     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3510     if (UNLIKELY(current_cpu->trace_result_p))
3511       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3512     current_cpu->h_grc_set (FLD (f_rn), opval);
3513   }
3514   {
3515     BI opval = ((tmp_t) ? (1) : (0));
3516     if (UNLIKELY(current_cpu->trace_result_p))
3517       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3518     current_cpu->h_tbit_set (opval);
3519   }
3520 }
3521
3522   current_cpu->done_insn (npc, status);
3523 #undef FLD
3524 }
3525
3526 // ********** shll2-compact: shll2 $rn
3527
3528 void
3529 sh3_sem_shll2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3530         sh3::write_stacks &buf)
3531 {
3532 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3533   sem_status status = SEM_STATUS_NORMAL;
3534   sh3_scache* abuf = sem;
3535   unsigned long long written = 0;
3536   PCADDR pc = abuf->addr;
3537   PCADDR npc = pc + 2;
3538
3539   {
3540     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 2);
3541     if (UNLIKELY(current_cpu->trace_result_p))
3542       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3543     current_cpu->h_grc_set (FLD (f_rn), opval);
3544   }
3545
3546   current_cpu->done_insn (npc, status);
3547 #undef FLD
3548 }
3549
3550 // ********** shll8-compact: shll8 $rn
3551
3552 void
3553 sh3_sem_shll8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3554         sh3::write_stacks &buf)
3555 {
3556 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3557   sem_status status = SEM_STATUS_NORMAL;
3558   sh3_scache* abuf = sem;
3559   unsigned long long written = 0;
3560   PCADDR pc = abuf->addr;
3561   PCADDR npc = pc + 2;
3562
3563   {
3564     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3565     if (UNLIKELY(current_cpu->trace_result_p))
3566       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3567     current_cpu->h_grc_set (FLD (f_rn), opval);
3568   }
3569
3570   current_cpu->done_insn (npc, status);
3571 #undef FLD
3572 }
3573
3574 // ********** shll16-compact: shll16 $rn
3575
3576 void
3577 sh3_sem_shll16_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3578         sh3::write_stacks &buf)
3579 {
3580 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3581   sem_status status = SEM_STATUS_NORMAL;
3582   sh3_scache* abuf = sem;
3583   unsigned long long written = 0;
3584   PCADDR pc = abuf->addr;
3585   PCADDR npc = pc + 2;
3586
3587   {
3588     SI opval = SLLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
3589     if (UNLIKELY(current_cpu->trace_result_p))
3590       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3591     current_cpu->h_grc_set (FLD (f_rn), opval);
3592   }
3593
3594   current_cpu->done_insn (npc, status);
3595 #undef FLD
3596 }
3597
3598 // ********** shlr-compact: shlr $rn
3599
3600 void
3601 sh3_sem_shlr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3602         sh3::write_stacks &buf)
3603 {
3604 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3605   sem_status status = SEM_STATUS_NORMAL;
3606   sh3_scache* abuf = sem;
3607   unsigned long long written = 0;
3608   PCADDR pc = abuf->addr;
3609   PCADDR npc = pc + 2;
3610
3611 {
3612   BI tmp_t;
3613   tmp_t = ANDSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3614   {
3615     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 1);
3616     if (UNLIKELY(current_cpu->trace_result_p))
3617       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3618     current_cpu->h_grc_set (FLD (f_rn), opval);
3619   }
3620   {
3621     BI opval = ((tmp_t) ? (1) : (0));
3622     if (UNLIKELY(current_cpu->trace_result_p))
3623       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
3624     current_cpu->h_tbit_set (opval);
3625   }
3626 }
3627
3628   current_cpu->done_insn (npc, status);
3629 #undef FLD
3630 }
3631
3632 // ********** shlr2-compact: shlr2 $rn
3633
3634 void
3635 sh3_sem_shlr2_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3636         sh3::write_stacks &buf)
3637 {
3638 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3639   sem_status status = SEM_STATUS_NORMAL;
3640   sh3_scache* abuf = sem;
3641   unsigned long long written = 0;
3642   PCADDR pc = abuf->addr;
3643   PCADDR npc = pc + 2;
3644
3645   {
3646     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 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
3652   current_cpu->done_insn (npc, status);
3653 #undef FLD
3654 }
3655
3656 // ********** shlr8-compact: shlr8 $rn
3657
3658 void
3659 sh3_sem_shlr8_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3660         sh3::write_stacks &buf)
3661 {
3662 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3663   sem_status status = SEM_STATUS_NORMAL;
3664   sh3_scache* abuf = sem;
3665   unsigned long long written = 0;
3666   PCADDR pc = abuf->addr;
3667   PCADDR npc = pc + 2;
3668
3669   {
3670     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 8);
3671     if (UNLIKELY(current_cpu->trace_result_p))
3672       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3673     current_cpu->h_grc_set (FLD (f_rn), opval);
3674   }
3675
3676   current_cpu->done_insn (npc, status);
3677 #undef FLD
3678 }
3679
3680 // ********** shlr16-compact: shlr16 $rn
3681
3682 void
3683 sh3_sem_shlr16_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3684         sh3::write_stacks &buf)
3685 {
3686 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3687   sem_status status = SEM_STATUS_NORMAL;
3688   sh3_scache* abuf = sem;
3689   unsigned long long written = 0;
3690   PCADDR pc = abuf->addr;
3691   PCADDR npc = pc + 2;
3692
3693   {
3694     SI opval = SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16);
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   current_cpu->done_insn (npc, status);
3701 #undef FLD
3702 }
3703
3704 // ********** stc-gbr-compact: stc gbr, $rn
3705
3706 void
3707 sh3_sem_stc_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3708         sh3::write_stacks &buf)
3709 {
3710 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3711   sem_status status = SEM_STATUS_NORMAL;
3712   sh3_scache* abuf = sem;
3713   unsigned long long written = 0;
3714   PCADDR pc = abuf->addr;
3715   PCADDR npc = pc + 2;
3716
3717   {
3718     SI opval = current_cpu->h_gbr_get ();
3719     if (UNLIKELY(current_cpu->trace_result_p))
3720       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3721     current_cpu->h_grc_set (FLD (f_rn), opval);
3722   }
3723
3724   current_cpu->done_insn (npc, status);
3725 #undef FLD
3726 }
3727
3728 // ********** stc-vbr-compact: stc vbr, $rn
3729
3730 void
3731 sh3_sem_stc_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3732         sh3::write_stacks &buf)
3733 {
3734 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3735   sem_status status = SEM_STATUS_NORMAL;
3736   sh3_scache* abuf = sem;
3737   unsigned long long written = 0;
3738   PCADDR pc = abuf->addr;
3739   PCADDR npc = pc + 2;
3740
3741   {
3742     SI opval = current_cpu->h_vbr_get ();
3743     if (UNLIKELY(current_cpu->trace_result_p))
3744       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3745     current_cpu->h_grc_set (FLD (f_rn), opval);
3746   }
3747
3748   current_cpu->done_insn (npc, status);
3749 #undef FLD
3750 }
3751
3752 // ********** stcl-gbr-compact: stc.l gbr, @-$rn
3753
3754 void
3755 sh3_sem_stcl_gbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3756         sh3::write_stacks &buf)
3757 {
3758 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3759   sem_status status = SEM_STATUS_NORMAL;
3760   sh3_scache* abuf = sem;
3761   unsigned long long written = 0;
3762   PCADDR pc = abuf->addr;
3763   PCADDR npc = pc + 2;
3764
3765 {
3766   DI tmp_addr;
3767   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3768   {
3769     SI opval = current_cpu->h_gbr_get ();
3770     if (UNLIKELY(current_cpu->trace_result_p))
3771       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3772     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3773   }
3774   {
3775     SI opval = tmp_addr;
3776     if (UNLIKELY(current_cpu->trace_result_p))
3777       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3778     current_cpu->h_grc_set (FLD (f_rn), opval);
3779   }
3780 }
3781
3782   current_cpu->done_insn (npc, status);
3783 #undef FLD
3784 }
3785
3786 // ********** stcl-vbr-compact: stc.l vbr, @-$rn
3787
3788 void
3789 sh3_sem_stcl_vbr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3790         sh3::write_stacks &buf)
3791 {
3792 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3793   sem_status status = SEM_STATUS_NORMAL;
3794   sh3_scache* abuf = sem;
3795   unsigned long long written = 0;
3796   PCADDR pc = abuf->addr;
3797   PCADDR npc = pc + 2;
3798
3799 {
3800   DI tmp_addr;
3801   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3802   {
3803     SI opval = current_cpu->h_vbr_get ();
3804     if (UNLIKELY(current_cpu->trace_result_p))
3805       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3806     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3807   }
3808   {
3809     SI opval = tmp_addr;
3810     if (UNLIKELY(current_cpu->trace_result_p))
3811       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3812     current_cpu->h_grc_set (FLD (f_rn), opval);
3813   }
3814 }
3815
3816   current_cpu->done_insn (npc, status);
3817 #undef FLD
3818 }
3819
3820 // ********** sts-mach-compact: sts mach, $rn
3821
3822 void
3823 sh3_sem_sts_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3824         sh3::write_stacks &buf)
3825 {
3826 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3827   sem_status status = SEM_STATUS_NORMAL;
3828   sh3_scache* abuf = sem;
3829   unsigned long long written = 0;
3830   PCADDR pc = abuf->addr;
3831   PCADDR npc = pc + 2;
3832
3833   {
3834     SI opval = current_cpu->h_mach_get ();
3835     if (UNLIKELY(current_cpu->trace_result_p))
3836       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3837     current_cpu->h_grc_set (FLD (f_rn), opval);
3838   }
3839
3840   current_cpu->done_insn (npc, status);
3841 #undef FLD
3842 }
3843
3844 // ********** stsl-mach-compact: sts.l mach, @-$rn
3845
3846 void
3847 sh3_sem_stsl_mach_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3848         sh3::write_stacks &buf)
3849 {
3850 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3851   sem_status status = SEM_STATUS_NORMAL;
3852   sh3_scache* abuf = sem;
3853   unsigned long long written = 0;
3854   PCADDR pc = abuf->addr;
3855   PCADDR npc = pc + 2;
3856
3857 {
3858   DI tmp_addr;
3859   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3860   {
3861     SI opval = current_cpu->h_mach_get ();
3862     if (UNLIKELY(current_cpu->trace_result_p))
3863       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3864     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3865   }
3866   {
3867     SI opval = tmp_addr;
3868     if (UNLIKELY(current_cpu->trace_result_p))
3869       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3870     current_cpu->h_grc_set (FLD (f_rn), opval);
3871   }
3872 }
3873
3874   current_cpu->done_insn (npc, status);
3875 #undef FLD
3876 }
3877
3878 // ********** sts-macl-compact: sts macl, $rn
3879
3880 void
3881 sh3_sem_sts_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3882         sh3::write_stacks &buf)
3883 {
3884 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3885   sem_status status = SEM_STATUS_NORMAL;
3886   sh3_scache* abuf = sem;
3887   unsigned long long written = 0;
3888   PCADDR pc = abuf->addr;
3889   PCADDR npc = pc + 2;
3890
3891   {
3892     SI opval = current_cpu->h_macl_get ();
3893     if (UNLIKELY(current_cpu->trace_result_p))
3894       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3895     current_cpu->h_grc_set (FLD (f_rn), opval);
3896   }
3897
3898   current_cpu->done_insn (npc, status);
3899 #undef FLD
3900 }
3901
3902 // ********** stsl-macl-compact: sts.l macl, @-$rn
3903
3904 void
3905 sh3_sem_stsl_macl_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3906         sh3::write_stacks &buf)
3907 {
3908 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3909   sem_status status = SEM_STATUS_NORMAL;
3910   sh3_scache* abuf = sem;
3911   unsigned long long written = 0;
3912   PCADDR pc = abuf->addr;
3913   PCADDR npc = pc + 2;
3914
3915 {
3916   DI tmp_addr;
3917   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3918   {
3919     SI opval = current_cpu->h_macl_get ();
3920     if (UNLIKELY(current_cpu->trace_result_p))
3921       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3922     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3923   }
3924   {
3925     SI opval = tmp_addr;
3926     if (UNLIKELY(current_cpu->trace_result_p))
3927       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3928     current_cpu->h_grc_set (FLD (f_rn), opval);
3929   }
3930 }
3931
3932   current_cpu->done_insn (npc, status);
3933 #undef FLD
3934 }
3935
3936 // ********** sts-pr-compact: sts pr, $rn
3937
3938 void
3939 sh3_sem_sts_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3940         sh3::write_stacks &buf)
3941 {
3942 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3943   sem_status status = SEM_STATUS_NORMAL;
3944   sh3_scache* abuf = sem;
3945   unsigned long long written = 0;
3946   PCADDR pc = abuf->addr;
3947   PCADDR npc = pc + 2;
3948
3949   {
3950     SI opval = current_cpu->h_pr_get ();
3951     if (UNLIKELY(current_cpu->trace_result_p))
3952       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3953     current_cpu->h_grc_set (FLD (f_rn), opval);
3954   }
3955
3956   current_cpu->done_insn (npc, status);
3957 #undef FLD
3958 }
3959
3960 // ********** stsl-pr-compact: sts.l pr, @-$rn
3961
3962 void
3963 sh3_sem_stsl_pr_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3964         sh3::write_stacks &buf)
3965 {
3966 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3967   sem_status status = SEM_STATUS_NORMAL;
3968   sh3_scache* abuf = sem;
3969   unsigned long long written = 0;
3970   PCADDR pc = abuf->addr;
3971   PCADDR npc = pc + 2;
3972
3973 {
3974   DI tmp_addr;
3975   tmp_addr = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), 4);
3976   {
3977     SI opval = current_cpu->h_pr_get ();
3978     if (UNLIKELY(current_cpu->trace_result_p))
3979       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << opval << dec << "  ";
3980     current_cpu->SETMEMSI (pc, tmp_addr, opval);
3981   }
3982   {
3983     SI opval = tmp_addr;
3984     if (UNLIKELY(current_cpu->trace_result_p))
3985       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
3986     current_cpu->h_grc_set (FLD (f_rn), opval);
3987   }
3988 }
3989
3990   current_cpu->done_insn (npc, status);
3991 #undef FLD
3992 }
3993
3994 // ********** sub-compact: sub $rm, $rn
3995
3996 void
3997 sh3_sem_sub_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
3998         sh3::write_stacks &buf)
3999 {
4000 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4001   sem_status status = SEM_STATUS_NORMAL;
4002   sh3_scache* abuf = sem;
4003   unsigned long long written = 0;
4004   PCADDR pc = abuf->addr;
4005   PCADDR npc = pc + 2;
4006
4007   {
4008     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4009     if (UNLIKELY(current_cpu->trace_result_p))
4010       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4011     current_cpu->h_grc_set (FLD (f_rn), opval);
4012   }
4013
4014   current_cpu->done_insn (npc, status);
4015 #undef FLD
4016 }
4017
4018 // ********** subc-compact: subc $rm, $rn
4019
4020 void
4021 sh3_sem_subc_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4022         sh3::write_stacks &buf)
4023 {
4024 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4025   sem_status status = SEM_STATUS_NORMAL;
4026   sh3_scache* abuf = sem;
4027   unsigned long long written = 0;
4028   PCADDR pc = abuf->addr;
4029   PCADDR npc = pc + 2;
4030
4031 {
4032   BI tmp_flag;
4033   tmp_flag = SUBCFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4034   {
4035     SI opval = SUBCSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_tbit_get ());
4036     if (UNLIKELY(current_cpu->trace_result_p))
4037       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4038     current_cpu->h_grc_set (FLD (f_rn), opval);
4039   }
4040   {
4041     BI opval = tmp_flag;
4042     if (UNLIKELY(current_cpu->trace_result_p))
4043       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4044     current_cpu->h_tbit_set (opval);
4045   }
4046 }
4047
4048   current_cpu->done_insn (npc, status);
4049 #undef FLD
4050 }
4051
4052 // ********** subv-compact: subv $rm, $rn
4053
4054 void
4055 sh3_sem_subv_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4056         sh3::write_stacks &buf)
4057 {
4058 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4059   sem_status status = SEM_STATUS_NORMAL;
4060   sh3_scache* abuf = sem;
4061   unsigned long long written = 0;
4062   PCADDR pc = abuf->addr;
4063   PCADDR npc = pc + 2;
4064
4065 {
4066   BI tmp_t;
4067   tmp_t = SUBOFSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)), 0);
4068   {
4069     SI opval = SUBSI (current_cpu->h_grc_get (FLD (f_rn)), current_cpu->h_grc_get (FLD (f_rm)));
4070     if (UNLIKELY(current_cpu->trace_result_p))
4071       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4072     current_cpu->h_grc_set (FLD (f_rn), opval);
4073   }
4074   {
4075     BI opval = ((tmp_t) ? (1) : (0));
4076     if (UNLIKELY(current_cpu->trace_result_p))
4077       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4078     current_cpu->h_tbit_set (opval);
4079   }
4080 }
4081
4082   current_cpu->done_insn (npc, status);
4083 #undef FLD
4084 }
4085
4086 // ********** swapb-compact: swap.b $rm, $rn
4087
4088 void
4089 sh3_sem_swapb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4090         sh3::write_stacks &buf)
4091 {
4092 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4093   sem_status status = SEM_STATUS_NORMAL;
4094   sh3_scache* abuf = sem;
4095   unsigned long long written = 0;
4096   PCADDR pc = abuf->addr;
4097   PCADDR npc = pc + 2;
4098
4099 {
4100   UHI tmp_top_half;
4101   UQI tmp_byte1;
4102   UQI tmp_byte0;
4103   tmp_top_half = SUBWORDSIHI (current_cpu->h_grc_get (FLD (f_rm)), 0);
4104   tmp_byte1 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 2);
4105   tmp_byte0 = SUBWORDSIQI (current_cpu->h_grc_get (FLD (f_rm)), 3);
4106   {
4107     SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
4108     if (UNLIKELY(current_cpu->trace_result_p))
4109       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4110     current_cpu->h_grc_set (FLD (f_rn), opval);
4111   }
4112 }
4113
4114   current_cpu->done_insn (npc, status);
4115 #undef FLD
4116 }
4117
4118 // ********** swapw-compact: swap.w $rm, $rn
4119
4120 void
4121 sh3_sem_swapw_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4122         sh3::write_stacks &buf)
4123 {
4124 #define FLD(f) abuf->fields.sfmt_movl11_compact.f
4125   sem_status status = SEM_STATUS_NORMAL;
4126   sh3_scache* abuf = sem;
4127   unsigned long long written = 0;
4128   PCADDR pc = abuf->addr;
4129   PCADDR npc = pc + 2;
4130
4131   {
4132     SI opval = ORSI (SRLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16));
4133     if (UNLIKELY(current_cpu->trace_result_p))
4134       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4135     current_cpu->h_grc_set (FLD (f_rn), opval);
4136   }
4137
4138   current_cpu->done_insn (npc, status);
4139 #undef FLD
4140 }
4141
4142 // ********** tasb-compact: tas.b @$rn
4143
4144 void
4145 sh3_sem_tasb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4146         sh3::write_stacks &buf)
4147 {
4148 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4149   sem_status status = SEM_STATUS_NORMAL;
4150   sh3_scache* abuf = sem;
4151   unsigned long long written = 0;
4152   PCADDR pc = abuf->addr;
4153   PCADDR npc = pc + 2;
4154
4155 {
4156   UQI tmp_byte;
4157   tmp_byte = current_cpu->GETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)));
4158   {
4159     BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
4160     if (UNLIKELY(current_cpu->trace_result_p))
4161       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4162     current_cpu->h_tbit_set (opval);
4163   }
4164   tmp_byte = ORQI (tmp_byte, 128);
4165   {
4166     UQI opval = tmp_byte;
4167     if (UNLIKELY(current_cpu->trace_result_p))
4168       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) current_cpu->h_grc_get (FLD (f_rn)) << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
4169     current_cpu->SETMEMUQI (pc, current_cpu->h_grc_get (FLD (f_rn)), opval);
4170   }
4171 }
4172
4173   current_cpu->done_insn (npc, status);
4174 #undef FLD
4175 }
4176
4177 // ********** trapa-compact: trapa #$uimm8
4178
4179 void
4180 sh3_sem_trapa_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4181         sh3::write_stacks &buf)
4182 {
4183 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4184   sem_status status = SEM_STATUS_NORMAL;
4185   sh3_scache* abuf = sem;
4186   unsigned long long written = 0;
4187   PCADDR pc = abuf->addr;
4188   PCADDR npc = pc + 2;
4189
4190 current_cpu->sh64_compact_trapa (FLD (f_imm8), pc);
4191
4192   current_cpu->done_insn (npc, status);
4193 #undef FLD
4194 }
4195
4196 // ********** tst-compact: tst $rm, $rn
4197
4198 void
4199 sh3_sem_tst_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4200         sh3::write_stacks &buf)
4201 {
4202 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
4203   sem_status status = SEM_STATUS_NORMAL;
4204   sh3_scache* abuf = sem;
4205   unsigned long long written = 0;
4206   PCADDR pc = abuf->addr;
4207   PCADDR npc = pc + 2;
4208
4209   {
4210     BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (FLD (f_rm)), current_cpu->h_grc_get (FLD (f_rn))), 0)) ? (1) : (0));
4211     if (UNLIKELY(current_cpu->trace_result_p))
4212       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4213     current_cpu->h_tbit_set (opval);
4214   }
4215
4216   current_cpu->done_insn (npc, status);
4217 #undef FLD
4218 }
4219
4220 // ********** tsti-compact: tst #$uimm8, r0
4221
4222 void
4223 sh3_sem_tsti_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4224         sh3::write_stacks &buf)
4225 {
4226 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4227   sem_status status = SEM_STATUS_NORMAL;
4228   sh3_scache* abuf = sem;
4229   unsigned long long written = 0;
4230   PCADDR pc = abuf->addr;
4231   PCADDR npc = pc + 2;
4232
4233   {
4234     BI opval = ((EQSI (ANDSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
4235     if (UNLIKELY(current_cpu->trace_result_p))
4236       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4237     current_cpu->h_tbit_set (opval);
4238   }
4239
4240   current_cpu->done_insn (npc, status);
4241 #undef FLD
4242 }
4243
4244 // ********** tstb-compact: tst.b #$imm8, @(r0, gbr)
4245
4246 void
4247 sh3_sem_tstb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4248         sh3::write_stacks &buf)
4249 {
4250 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4251   sem_status status = SEM_STATUS_NORMAL;
4252   sh3_scache* abuf = sem;
4253   unsigned long long written = 0;
4254   PCADDR pc = abuf->addr;
4255   PCADDR npc = pc + 2;
4256
4257 {
4258   DI tmp_addr;
4259   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4260   {
4261     BI opval = ((EQQI (ANDQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
4262     if (UNLIKELY(current_cpu->trace_result_p))
4263       current_cpu->trace_stream << "tbit" << ":=0x" << hex << opval << dec << "  ";
4264     current_cpu->h_tbit_set (opval);
4265   }
4266 }
4267
4268   current_cpu->done_insn (npc, status);
4269 #undef FLD
4270 }
4271
4272 // ********** xor-compact: xor $rm64, $rn64
4273
4274 void
4275 sh3_sem_xor_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4276         sh3::write_stacks &buf)
4277 {
4278 #define FLD(f) abuf->fields.sfmt_and_compact.f
4279   sem_status status = SEM_STATUS_NORMAL;
4280   sh3_scache* abuf = sem;
4281   unsigned long long written = 0;
4282   PCADDR pc = abuf->addr;
4283   PCADDR npc = pc + 2;
4284
4285   {
4286     DI opval = XORDI (current_cpu->h_gr_get (FLD (f_rn)), current_cpu->h_gr_get (FLD (f_rm)));
4287     if (UNLIKELY(current_cpu->trace_result_p))
4288       current_cpu->trace_stream << "gr" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4289     current_cpu->h_gr_set (FLD (f_rn), opval);
4290   }
4291
4292   current_cpu->done_insn (npc, status);
4293 #undef FLD
4294 }
4295
4296 // ********** xori-compact: xor #$uimm8, r0
4297
4298 void
4299 sh3_sem_xori_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4300         sh3::write_stacks &buf)
4301 {
4302 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4303   sem_status status = SEM_STATUS_NORMAL;
4304   sh3_scache* abuf = sem;
4305   unsigned long long written = 0;
4306   PCADDR pc = abuf->addr;
4307   PCADDR npc = pc + 2;
4308
4309   {
4310     SI opval = XORSI (current_cpu->h_grc_get (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4311     if (UNLIKELY(current_cpu->trace_result_p))
4312       current_cpu->trace_stream << "grc" << '[' << ((UINT) 0) << ']' << ":=0x" << hex << opval << dec << "  ";
4313     current_cpu->h_grc_set (((UINT) 0), opval);
4314   }
4315
4316   current_cpu->done_insn (npc, status);
4317 #undef FLD
4318 }
4319
4320 // ********** xorb-compact: xor.b #$imm8, @(r0, gbr)
4321
4322 void
4323 sh3_sem_xorb_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4324         sh3::write_stacks &buf)
4325 {
4326 #define FLD(f) abuf->fields.sfmt_andi_compact.f
4327   sem_status status = SEM_STATUS_NORMAL;
4328   sh3_scache* abuf = sem;
4329   unsigned long long written = 0;
4330   PCADDR pc = abuf->addr;
4331   PCADDR npc = pc + 2;
4332
4333 {
4334   DI tmp_addr;
4335   UQI tmp_data;
4336   tmp_addr = ADDSI (current_cpu->h_grc_get (((UINT) 0)), current_cpu->h_gbr_get ());
4337   tmp_data = XORQI (current_cpu->GETMEMUQI (pc, tmp_addr), FLD (f_imm8));
4338   {
4339     UQI opval = tmp_data;
4340     if (UNLIKELY(current_cpu->trace_result_p))
4341       current_cpu->trace_stream << "memory" << '[' <<  "0x" << hex << (UDI) tmp_addr << dec << ']' << ":=0x" << hex << (USI) opval << dec << "  ";
4342     current_cpu->SETMEMUQI (pc, tmp_addr, opval);
4343   }
4344 }
4345
4346   current_cpu->done_insn (npc, status);
4347 #undef FLD
4348 }
4349
4350 // ********** xtrct-compact: xtrct $rm, $rn
4351
4352 void
4353 sh3_sem_xtrct_compact (sh3_cpu* current_cpu, sh3_scache* sem, const int tick, 
4354         sh3::write_stacks &buf)
4355 {
4356 #define FLD(f) abuf->fields.sfmt_macl_compact.f
4357   sem_status status = SEM_STATUS_NORMAL;
4358   sh3_scache* abuf = sem;
4359   unsigned long long written = 0;
4360   PCADDR pc = abuf->addr;
4361   PCADDR npc = pc + 2;
4362
4363   {
4364     SI opval = ORSI (SLLSI (current_cpu->h_grc_get (FLD (f_rm)), 16), SRLSI (current_cpu->h_grc_get (FLD (f_rn)), 16));
4365     if (UNLIKELY(current_cpu->trace_result_p))
4366       current_cpu->trace_stream << "grc" << '[' << FLD (f_rn) << ']' << ":=0x" << hex << opval << dec << "  ";
4367     current_cpu->h_grc_set (FLD (f_rn), opval);
4368   }
4369
4370   current_cpu->done_insn (npc, status);
4371 #undef FLD
4372 }
4373