OSDN Git Service

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