This commit was manufactured by cvs2svn to create branch 'gdb_7_0-branch'.
[external/binutils.git] / sim / sh64 / sem-compact.c
1 /* Simulator instruction semantics for sh64.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright 1996-2005 Free Software Foundation, Inc.
6
7 This file is part of the GNU simulators.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 */
23
24 #define WANT_CPU sh64
25 #define WANT_CPU_SH64
26
27 #include "sim-main.h"
28 #include "cgen-mem.h"
29 #include "cgen-ops.h"
30
31 #undef GET_ATTR
32 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
33 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34 #else
35 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_/**/attr)
36 #endif
37
38 /* This is used so that we can compile two copies of the semantic code,
39    one with full feature support and one without that runs fast(er).
40    FAST_P, when desired, is defined on the command line, -DFAST_P=1.  */
41 #if FAST_P
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
43 #undef TRACE_RESULT
44 #define TRACE_RESULT(cpu, abuf, name, type, val)
45 #else
46 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
47 #endif
48
49 /* x-invalid: --invalid-- */
50
51 static SEM_PC
52 SEM_FN_NAME (sh64_compact,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
53 {
54 #define FLD(f) abuf->fields.fmt_empty.f
55   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
56   int UNUSED written = 0;
57   IADDR UNUSED pc = abuf->addr;
58   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
59
60   {
61     /* Update the recorded pc in the cpu state struct.
62        Only necessary for WITH_SCACHE case, but to avoid the
63        conditional compilation ....  */
64     SET_H_PC (pc);
65     /* Virtual insns have zero size.  Overwrite vpc with address of next insn
66        using the default-insn-bitsize spec.  When executing insns in parallel
67        we may want to queue the fault and continue execution.  */
68     vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
69     vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
70   }
71
72   return vpc;
73 #undef FLD
74 }
75
76 /* x-after: --after-- */
77
78 static SEM_PC
79 SEM_FN_NAME (sh64_compact,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
80 {
81 #define FLD(f) abuf->fields.fmt_empty.f
82   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
83   int UNUSED written = 0;
84   IADDR UNUSED pc = abuf->addr;
85   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
86
87   {
88 #if WITH_SCACHE_PBB_SH64_COMPACT
89     sh64_compact_pbb_after (current_cpu, sem_arg);
90 #endif
91   }
92
93   return vpc;
94 #undef FLD
95 }
96
97 /* x-before: --before-- */
98
99 static SEM_PC
100 SEM_FN_NAME (sh64_compact,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
101 {
102 #define FLD(f) abuf->fields.fmt_empty.f
103   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
104   int UNUSED written = 0;
105   IADDR UNUSED pc = abuf->addr;
106   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
107
108   {
109 #if WITH_SCACHE_PBB_SH64_COMPACT
110     sh64_compact_pbb_before (current_cpu, sem_arg);
111 #endif
112   }
113
114   return vpc;
115 #undef FLD
116 }
117
118 /* x-cti-chain: --cti-chain-- */
119
120 static SEM_PC
121 SEM_FN_NAME (sh64_compact,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
122 {
123 #define FLD(f) abuf->fields.fmt_empty.f
124   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
125   int UNUSED written = 0;
126   IADDR UNUSED pc = abuf->addr;
127   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
128
129   {
130 #if WITH_SCACHE_PBB_SH64_COMPACT
131 #ifdef DEFINE_SWITCH
132     vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg,
133                                pbb_br_type, pbb_br_npc);
134     BREAK (sem);
135 #else
136     /* FIXME: Allow provision of explicit ifmt spec in insn spec.  */
137     vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg,
138                                CPU_PBB_BR_TYPE (current_cpu),
139                                CPU_PBB_BR_NPC (current_cpu));
140 #endif
141 #endif
142   }
143
144   return vpc;
145 #undef FLD
146 }
147
148 /* x-chain: --chain-- */
149
150 static SEM_PC
151 SEM_FN_NAME (sh64_compact,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
152 {
153 #define FLD(f) abuf->fields.fmt_empty.f
154   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
155   int UNUSED written = 0;
156   IADDR UNUSED pc = abuf->addr;
157   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
158
159   {
160 #if WITH_SCACHE_PBB_SH64_COMPACT
161     vpc = sh64_compact_pbb_chain (current_cpu, sem_arg);
162 #ifdef DEFINE_SWITCH
163     BREAK (sem);
164 #endif
165 #endif
166   }
167
168   return vpc;
169 #undef FLD
170 }
171
172 /* x-begin: --begin-- */
173
174 static SEM_PC
175 SEM_FN_NAME (sh64_compact,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
176 {
177 #define FLD(f) abuf->fields.fmt_empty.f
178   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
179   int UNUSED written = 0;
180   IADDR UNUSED pc = abuf->addr;
181   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
182
183   {
184 #if WITH_SCACHE_PBB_SH64_COMPACT
185 #if defined DEFINE_SWITCH || defined FAST_P
186     /* In the switch case FAST_P is a constant, allowing several optimizations
187        in any called inline functions.  */
188     vpc = sh64_compact_pbb_begin (current_cpu, FAST_P);
189 #else
190 #if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
191     vpc = sh64_compact_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
192 #else
193     vpc = sh64_compact_pbb_begin (current_cpu, 0);
194 #endif
195 #endif
196 #endif
197   }
198
199   return vpc;
200 #undef FLD
201 }
202
203 /* add-compact: add $rm, $rn */
204
205 static SEM_PC
206 SEM_FN_NAME (sh64_compact,add_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
207 {
208 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
209   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
210   int UNUSED written = 0;
211   IADDR UNUSED pc = abuf->addr;
212   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
213
214   {
215     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
216     SET_H_GRC (FLD (f_rn), opval);
217     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
218   }
219
220   return vpc;
221 #undef FLD
222 }
223
224 /* addi-compact: add #$imm8, $rn */
225
226 static SEM_PC
227 SEM_FN_NAME (sh64_compact,addi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
228 {
229 #define FLD(f) abuf->fields.sfmt_addi_compact.f
230   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
231   int UNUSED written = 0;
232   IADDR UNUSED pc = abuf->addr;
233   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
234
235   {
236     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
237     SET_H_GRC (FLD (f_rn), opval);
238     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
239   }
240
241   return vpc;
242 #undef FLD
243 }
244
245 /* addc-compact: addc $rm, $rn */
246
247 static SEM_PC
248 SEM_FN_NAME (sh64_compact,addc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
249 {
250 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
251   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
252   int UNUSED written = 0;
253   IADDR UNUSED pc = abuf->addr;
254   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
255
256 {
257   BI tmp_flag;
258   tmp_flag = ADDCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
259   {
260     SI opval = ADDCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
261     SET_H_GRC (FLD (f_rn), opval);
262     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
263   }
264   {
265     BI opval = tmp_flag;
266     SET_H_TBIT (opval);
267     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
268   }
269 }
270
271   return vpc;
272 #undef FLD
273 }
274
275 /* addv-compact: addv $rm, $rn */
276
277 static SEM_PC
278 SEM_FN_NAME (sh64_compact,addv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
279 {
280 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
281   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
282   int UNUSED written = 0;
283   IADDR UNUSED pc = abuf->addr;
284   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
285
286 {
287   BI tmp_t;
288   tmp_t = ADDOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0);
289   {
290     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
291     SET_H_GRC (FLD (f_rn), opval);
292     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
293   }
294   {
295     BI opval = tmp_t;
296     SET_H_TBIT (opval);
297     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
298   }
299 }
300
301   return vpc;
302 #undef FLD
303 }
304
305 /* and-compact: and $rm64, $rn64 */
306
307 static SEM_PC
308 SEM_FN_NAME (sh64_compact,and_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
309 {
310 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
311   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
312   int UNUSED written = 0;
313   IADDR UNUSED pc = abuf->addr;
314   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
315
316   {
317     DI opval = ANDDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn)));
318     SET_H_GR (FLD (f_rn), opval);
319     TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
320   }
321
322   return vpc;
323 #undef FLD
324 }
325
326 /* andi-compact: and #$uimm8, r0 */
327
328 static SEM_PC
329 SEM_FN_NAME (sh64_compact,andi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
330 {
331 #define FLD(f) abuf->fields.sfmt_addi_compact.f
332   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
333   int UNUSED written = 0;
334   IADDR UNUSED pc = abuf->addr;
335   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
336
337   {
338     SI opval = ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
339     SET_H_GRC (((UINT) 0), opval);
340     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
341   }
342
343   return vpc;
344 #undef FLD
345 }
346
347 /* andb-compact: and.b #$imm8, @(r0, gbr) */
348
349 static SEM_PC
350 SEM_FN_NAME (sh64_compact,andb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
351 {
352 #define FLD(f) abuf->fields.sfmt_addi_compact.f
353   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
354   int UNUSED written = 0;
355   IADDR UNUSED pc = abuf->addr;
356   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
357
358 {
359   DI tmp_addr;
360   UQI tmp_data;
361   tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
362   tmp_data = ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
363   {
364     UQI opval = tmp_data;
365     SETMEMUQI (current_cpu, pc, tmp_addr, opval);
366     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
367   }
368 }
369
370   return vpc;
371 #undef FLD
372 }
373
374 /* bf-compact: bf $disp8 */
375
376 static SEM_PC
377 SEM_FN_NAME (sh64_compact,bf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
378 {
379 #define FLD(f) abuf->fields.sfmt_bf_compact.f
380   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
381   int UNUSED written = 0;
382   IADDR UNUSED pc = abuf->addr;
383   SEM_BRANCH_INIT
384   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
385
386 if (NOTBI (GET_H_TBIT ())) {
387   {
388     UDI opval = FLD (i_disp8);
389     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
390     written |= (1 << 2);
391     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
392   }
393 }
394
395   abuf->written = written;
396   SEM_BRANCH_FINI (vpc);
397   return vpc;
398 #undef FLD
399 }
400
401 /* bfs-compact: bf/s $disp8 */
402
403 static SEM_PC
404 SEM_FN_NAME (sh64_compact,bfs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
405 {
406 #define FLD(f) abuf->fields.sfmt_bf_compact.f
407   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
408   int UNUSED written = 0;
409   IADDR UNUSED pc = abuf->addr;
410   SEM_BRANCH_INIT
411   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
412
413 if (NOTBI (GET_H_TBIT ())) {
414 {
415   {
416     UDI opval = ADDDI (pc, 2);
417     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
418     written |= (1 << 3);
419     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
420   }
421 ((void) 0); /*nop*/
422 {
423   {
424     UDI opval = FLD (i_disp8);
425     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
426     written |= (1 << 3);
427     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
428   }
429 }
430 }
431 }
432
433   abuf->written = written;
434   SEM_BRANCH_FINI (vpc);
435   return vpc;
436 #undef FLD
437 }
438
439 /* bra-compact: bra $disp12 */
440
441 static SEM_PC
442 SEM_FN_NAME (sh64_compact,bra_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
443 {
444 #define FLD(f) abuf->fields.sfmt_bra_compact.f
445   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
446   int UNUSED written = 0;
447   IADDR UNUSED pc = abuf->addr;
448   SEM_BRANCH_INIT
449   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
450
451 {
452   {
453     UDI opval = ADDDI (pc, 2);
454     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
455     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
456   }
457 ((void) 0); /*nop*/
458 {
459   {
460     UDI opval = FLD (i_disp12);
461     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
462     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
463   }
464 }
465 }
466
467   SEM_BRANCH_FINI (vpc);
468   return vpc;
469 #undef FLD
470 }
471
472 /* braf-compact: braf $rn */
473
474 static SEM_PC
475 SEM_FN_NAME (sh64_compact,braf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
476 {
477 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
478   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
479   int UNUSED written = 0;
480   IADDR UNUSED pc = abuf->addr;
481   SEM_BRANCH_INIT
482   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
483
484 {
485   {
486     UDI opval = ADDDI (pc, 2);
487     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
488     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
489   }
490 ((void) 0); /*nop*/
491 {
492   {
493     UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4));
494     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
495     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
496   }
497 }
498 }
499
500   SEM_BRANCH_FINI (vpc);
501   return vpc;
502 #undef FLD
503 }
504
505 /* brk-compact: brk */
506
507 static SEM_PC
508 SEM_FN_NAME (sh64_compact,brk_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
509 {
510 #define FLD(f) abuf->fields.fmt_empty.f
511   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
512   int UNUSED written = 0;
513   IADDR UNUSED pc = abuf->addr;
514   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
515
516 sh64_break (current_cpu, pc);
517
518   return vpc;
519 #undef FLD
520 }
521
522 /* bsr-compact: bsr $disp12 */
523
524 static SEM_PC
525 SEM_FN_NAME (sh64_compact,bsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
526 {
527 #define FLD(f) abuf->fields.sfmt_bra_compact.f
528   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
529   int UNUSED written = 0;
530   IADDR UNUSED pc = abuf->addr;
531   SEM_BRANCH_INIT
532   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
533
534 {
535 {
536   {
537     SI opval = ADDDI (pc, 4);
538     SET_H_PR (opval);
539     TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
540   }
541 }
542   {
543     UDI opval = ADDDI (pc, 2);
544     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
545     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
546   }
547 ((void) 0); /*nop*/
548 {
549   {
550     UDI opval = FLD (i_disp12);
551     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
552     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
553   }
554 }
555 }
556
557   SEM_BRANCH_FINI (vpc);
558   return vpc;
559 #undef FLD
560 }
561
562 /* bsrf-compact: bsrf $rn */
563
564 static SEM_PC
565 SEM_FN_NAME (sh64_compact,bsrf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
566 {
567 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
568   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
569   int UNUSED written = 0;
570   IADDR UNUSED pc = abuf->addr;
571   SEM_BRANCH_INIT
572   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
573
574 {
575 {
576   {
577     SI opval = ADDDI (pc, 4);
578     SET_H_PR (opval);
579     TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
580   }
581 }
582   {
583     UDI opval = ADDDI (pc, 2);
584     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
585     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
586   }
587 ((void) 0); /*nop*/
588 {
589   {
590     UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4));
591     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
592     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
593   }
594 }
595 }
596
597   SEM_BRANCH_FINI (vpc);
598   return vpc;
599 #undef FLD
600 }
601
602 /* bt-compact: bt $disp8 */
603
604 static SEM_PC
605 SEM_FN_NAME (sh64_compact,bt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
606 {
607 #define FLD(f) abuf->fields.sfmt_bf_compact.f
608   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
609   int UNUSED written = 0;
610   IADDR UNUSED pc = abuf->addr;
611   SEM_BRANCH_INIT
612   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
613
614 if (GET_H_TBIT ()) {
615   {
616     UDI opval = FLD (i_disp8);
617     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
618     written |= (1 << 2);
619     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
620   }
621 }
622
623   abuf->written = written;
624   SEM_BRANCH_FINI (vpc);
625   return vpc;
626 #undef FLD
627 }
628
629 /* bts-compact: bt/s $disp8 */
630
631 static SEM_PC
632 SEM_FN_NAME (sh64_compact,bts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
633 {
634 #define FLD(f) abuf->fields.sfmt_bf_compact.f
635   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
636   int UNUSED written = 0;
637   IADDR UNUSED pc = abuf->addr;
638   SEM_BRANCH_INIT
639   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
640
641 if (GET_H_TBIT ()) {
642 {
643   {
644     UDI opval = ADDDI (pc, 2);
645     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
646     written |= (1 << 3);
647     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
648   }
649 ((void) 0); /*nop*/
650 {
651   {
652     UDI opval = FLD (i_disp8);
653     SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
654     written |= (1 << 3);
655     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
656   }
657 }
658 }
659 }
660
661   abuf->written = written;
662   SEM_BRANCH_FINI (vpc);
663   return vpc;
664 #undef FLD
665 }
666
667 /* clrmac-compact: clrmac */
668
669 static SEM_PC
670 SEM_FN_NAME (sh64_compact,clrmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
671 {
672 #define FLD(f) abuf->fields.fmt_empty.f
673   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
674   int UNUSED written = 0;
675   IADDR UNUSED pc = abuf->addr;
676   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
677
678 {
679   {
680     SI opval = 0;
681     SET_H_MACL (opval);
682     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
683   }
684   {
685     SI opval = 0;
686     SET_H_MACH (opval);
687     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
688   }
689 }
690
691   return vpc;
692 #undef FLD
693 }
694
695 /* clrs-compact: clrs */
696
697 static SEM_PC
698 SEM_FN_NAME (sh64_compact,clrs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
699 {
700 #define FLD(f) abuf->fields.fmt_empty.f
701   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
702   int UNUSED written = 0;
703   IADDR UNUSED pc = abuf->addr;
704   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
705
706   {
707     BI opval = 0;
708     SET_H_SBIT (opval);
709     TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval);
710   }
711
712   return vpc;
713 #undef FLD
714 }
715
716 /* clrt-compact: clrt */
717
718 static SEM_PC
719 SEM_FN_NAME (sh64_compact,clrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
720 {
721 #define FLD(f) abuf->fields.fmt_empty.f
722   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
723   int UNUSED written = 0;
724   IADDR UNUSED pc = abuf->addr;
725   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
726
727   {
728     BI opval = 0;
729     SET_H_TBIT (opval);
730     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
731   }
732
733   return vpc;
734 #undef FLD
735 }
736
737 /* cmpeq-compact: cmp/eq $rm, $rn */
738
739 static SEM_PC
740 SEM_FN_NAME (sh64_compact,cmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
741 {
742 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
743   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
744   int UNUSED written = 0;
745   IADDR UNUSED pc = abuf->addr;
746   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
747
748   {
749     BI opval = EQSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
750     SET_H_TBIT (opval);
751     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
752   }
753
754   return vpc;
755 #undef FLD
756 }
757
758 /* cmpeqi-compact: cmp/eq #$imm8, r0 */
759
760 static SEM_PC
761 SEM_FN_NAME (sh64_compact,cmpeqi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
762 {
763 #define FLD(f) abuf->fields.sfmt_addi_compact.f
764   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
765   int UNUSED written = 0;
766   IADDR UNUSED pc = abuf->addr;
767   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
768
769   {
770     BI opval = EQSI (GET_H_GRC (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
771     SET_H_TBIT (opval);
772     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
773   }
774
775   return vpc;
776 #undef FLD
777 }
778
779 /* cmpge-compact: cmp/ge $rm, $rn */
780
781 static SEM_PC
782 SEM_FN_NAME (sh64_compact,cmpge_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
783 {
784 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
785   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
786   int UNUSED written = 0;
787   IADDR UNUSED pc = abuf->addr;
788   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
789
790   {
791     BI opval = GESI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
792     SET_H_TBIT (opval);
793     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
794   }
795
796   return vpc;
797 #undef FLD
798 }
799
800 /* cmpgt-compact: cmp/gt $rm, $rn */
801
802 static SEM_PC
803 SEM_FN_NAME (sh64_compact,cmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
804 {
805 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
806   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
807   int UNUSED written = 0;
808   IADDR UNUSED pc = abuf->addr;
809   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
810
811   {
812     BI opval = GTSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
813     SET_H_TBIT (opval);
814     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
815   }
816
817   return vpc;
818 #undef FLD
819 }
820
821 /* cmphi-compact: cmp/hi $rm, $rn */
822
823 static SEM_PC
824 SEM_FN_NAME (sh64_compact,cmphi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
825 {
826 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
827   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
828   int UNUSED written = 0;
829   IADDR UNUSED pc = abuf->addr;
830   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
831
832   {
833     BI opval = GTUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
834     SET_H_TBIT (opval);
835     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
836   }
837
838   return vpc;
839 #undef FLD
840 }
841
842 /* cmphs-compact: cmp/hs $rm, $rn */
843
844 static SEM_PC
845 SEM_FN_NAME (sh64_compact,cmphs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
846 {
847 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
848   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
849   int UNUSED written = 0;
850   IADDR UNUSED pc = abuf->addr;
851   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
852
853   {
854     BI opval = GEUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
855     SET_H_TBIT (opval);
856     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
857   }
858
859   return vpc;
860 #undef FLD
861 }
862
863 /* cmppl-compact: cmp/pl $rn */
864
865 static SEM_PC
866 SEM_FN_NAME (sh64_compact,cmppl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
867 {
868 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
869   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
870   int UNUSED written = 0;
871   IADDR UNUSED pc = abuf->addr;
872   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
873
874   {
875     BI opval = GTSI (GET_H_GRC (FLD (f_rn)), 0);
876     SET_H_TBIT (opval);
877     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
878   }
879
880   return vpc;
881 #undef FLD
882 }
883
884 /* cmppz-compact: cmp/pz $rn */
885
886 static SEM_PC
887 SEM_FN_NAME (sh64_compact,cmppz_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
888 {
889 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
890   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
891   int UNUSED written = 0;
892   IADDR UNUSED pc = abuf->addr;
893   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
894
895   {
896     BI opval = GESI (GET_H_GRC (FLD (f_rn)), 0);
897     SET_H_TBIT (opval);
898     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
899   }
900
901   return vpc;
902 #undef FLD
903 }
904
905 /* cmpstr-compact: cmp/str $rm, $rn */
906
907 static SEM_PC
908 SEM_FN_NAME (sh64_compact,cmpstr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
909 {
910 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
911   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
912   int UNUSED written = 0;
913   IADDR UNUSED pc = abuf->addr;
914   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
915
916 {
917   BI tmp_t;
918   SI tmp_temp;
919   tmp_temp = XORSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
920   tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
921   tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
922   tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
923   tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
924   {
925     BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
926     SET_H_TBIT (opval);
927     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
928   }
929 }
930
931   return vpc;
932 #undef FLD
933 }
934
935 /* div0s-compact: div0s $rm, $rn */
936
937 static SEM_PC
938 SEM_FN_NAME (sh64_compact,div0s_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
939 {
940 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
941   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
942   int UNUSED written = 0;
943   IADDR UNUSED pc = abuf->addr;
944   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
945
946 {
947   {
948     BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
949     SET_H_QBIT (opval);
950     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
951   }
952   {
953     BI opval = SRLSI (GET_H_GRC (FLD (f_rm)), 31);
954     SET_H_MBIT (opval);
955     TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval);
956   }
957   {
958     BI opval = ((EQSI (SRLSI (GET_H_GRC (FLD (f_rm)), 31), SRLSI (GET_H_GRC (FLD (f_rn)), 31))) ? (0) : (1));
959     SET_H_TBIT (opval);
960     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
961   }
962 }
963
964   return vpc;
965 #undef FLD
966 }
967
968 /* div0u-compact: div0u */
969
970 static SEM_PC
971 SEM_FN_NAME (sh64_compact,div0u_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
972 {
973 #define FLD(f) abuf->fields.fmt_empty.f
974   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
975   int UNUSED written = 0;
976   IADDR UNUSED pc = abuf->addr;
977   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
978
979 {
980   {
981     BI opval = 0;
982     SET_H_TBIT (opval);
983     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
984   }
985   {
986     BI opval = 0;
987     SET_H_QBIT (opval);
988     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
989   }
990   {
991     BI opval = 0;
992     SET_H_MBIT (opval);
993     TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval);
994   }
995 }
996
997   return vpc;
998 #undef FLD
999 }
1000
1001 /* div1-compact: div1 $rm, $rn */
1002
1003 static SEM_PC
1004 SEM_FN_NAME (sh64_compact,div1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1005 {
1006 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1007   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1008   int UNUSED written = 0;
1009   IADDR UNUSED pc = abuf->addr;
1010   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1011
1012 {
1013   BI tmp_oldq;
1014   SI tmp_tmp0;
1015   UQI tmp_tmp1;
1016   tmp_oldq = GET_H_QBIT ();
1017   {
1018     BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
1019     SET_H_QBIT (opval);
1020     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1021   }
1022   {
1023     SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), ZEXTBISI (GET_H_TBIT ()));
1024     SET_H_GRC (FLD (f_rn), opval);
1025     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1026   }
1027 if (NOTBI (tmp_oldq)) {
1028 if (NOTBI (GET_H_MBIT ())) {
1029 {
1030   tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1031   {
1032     SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1033     SET_H_GRC (FLD (f_rn), opval);
1034     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1035   }
1036   tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1037 if (NOTBI (GET_H_QBIT ())) {
1038   {
1039     BI opval = ((tmp_tmp1) ? (1) : (0));
1040     SET_H_QBIT (opval);
1041     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1042   }
1043 } else {
1044   {
1045     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1046     SET_H_QBIT (opval);
1047     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1048   }
1049 }
1050 }
1051 } else {
1052 {
1053   tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1054   {
1055     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1056     SET_H_GRC (FLD (f_rn), opval);
1057     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1058   }
1059   tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1060 if (NOTBI (GET_H_QBIT ())) {
1061   {
1062     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1063     SET_H_QBIT (opval);
1064     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1065   }
1066 } else {
1067   {
1068     BI opval = ((tmp_tmp1) ? (1) : (0));
1069     SET_H_QBIT (opval);
1070     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1071   }
1072 }
1073 }
1074 }
1075 } else {
1076 if (NOTBI (GET_H_MBIT ())) {
1077 {
1078   tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1079   {
1080     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
1081     SET_H_GRC (FLD (f_rn), opval);
1082     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1083   }
1084   tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1085 if (NOTBI (GET_H_QBIT ())) {
1086   {
1087     BI opval = ((tmp_tmp1) ? (1) : (0));
1088     SET_H_QBIT (opval);
1089     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1090   }
1091 } else {
1092   {
1093     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1094     SET_H_QBIT (opval);
1095     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1096   }
1097 }
1098 }
1099 } else {
1100 {
1101   tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1102   {
1103     SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1104     SET_H_GRC (FLD (f_rn), opval);
1105     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1106   }
1107   tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1108 if (NOTBI (GET_H_QBIT ())) {
1109   {
1110     BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1111     SET_H_QBIT (opval);
1112     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1113   }
1114 } else {
1115   {
1116     BI opval = ((tmp_tmp1) ? (1) : (0));
1117     SET_H_QBIT (opval);
1118     TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1119   }
1120 }
1121 }
1122 }
1123 }
1124   {
1125     BI opval = ((EQBI (GET_H_QBIT (), GET_H_MBIT ())) ? (1) : (0));
1126     SET_H_TBIT (opval);
1127     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1128   }
1129 }
1130
1131   return vpc;
1132 #undef FLD
1133 }
1134
1135 /* divu-compact: divu r0, $rn */
1136
1137 static SEM_PC
1138 SEM_FN_NAME (sh64_compact,divu_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1139 {
1140 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1141   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1142   int UNUSED written = 0;
1143   IADDR UNUSED pc = abuf->addr;
1144   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1145
1146   {
1147     SI opval = UDIVSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0)));
1148     SET_H_GRC (FLD (f_rn), opval);
1149     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1150   }
1151
1152   return vpc;
1153 #undef FLD
1154 }
1155
1156 /* mulr-compact: mulr r0, $rn */
1157
1158 static SEM_PC
1159 SEM_FN_NAME (sh64_compact,mulr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1160 {
1161 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1162   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1163   int UNUSED written = 0;
1164   IADDR UNUSED pc = abuf->addr;
1165   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1166
1167   {
1168     SI opval = MULSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0)));
1169     SET_H_GRC (FLD (f_rn), opval);
1170     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1171   }
1172
1173   return vpc;
1174 #undef FLD
1175 }
1176
1177 /* dmulsl-compact: dmuls.l $rm, $rn */
1178
1179 static SEM_PC
1180 SEM_FN_NAME (sh64_compact,dmulsl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1181 {
1182 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1183   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1184   int UNUSED written = 0;
1185   IADDR UNUSED pc = abuf->addr;
1186   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1187
1188 {
1189   DI tmp_result;
1190   tmp_result = MULDI (EXTSIDI (GET_H_GRC (FLD (f_rm))), EXTSIDI (GET_H_GRC (FLD (f_rn))));
1191   {
1192     SI opval = SUBWORDDISI (tmp_result, 0);
1193     SET_H_MACH (opval);
1194     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
1195   }
1196   {
1197     SI opval = SUBWORDDISI (tmp_result, 1);
1198     SET_H_MACL (opval);
1199     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
1200   }
1201 }
1202
1203   return vpc;
1204 #undef FLD
1205 }
1206
1207 /* dmulul-compact: dmulu.l $rm, $rn */
1208
1209 static SEM_PC
1210 SEM_FN_NAME (sh64_compact,dmulul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1211 {
1212 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1213   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1214   int UNUSED written = 0;
1215   IADDR UNUSED pc = abuf->addr;
1216   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1217
1218 {
1219   DI tmp_result;
1220   tmp_result = MULDI (ZEXTSIDI (GET_H_GRC (FLD (f_rm))), ZEXTSIDI (GET_H_GRC (FLD (f_rn))));
1221   {
1222     SI opval = SUBWORDDISI (tmp_result, 0);
1223     SET_H_MACH (opval);
1224     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
1225   }
1226   {
1227     SI opval = SUBWORDDISI (tmp_result, 1);
1228     SET_H_MACL (opval);
1229     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
1230   }
1231 }
1232
1233   return vpc;
1234 #undef FLD
1235 }
1236
1237 /* dt-compact: dt $rn */
1238
1239 static SEM_PC
1240 SEM_FN_NAME (sh64_compact,dt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1241 {
1242 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1243   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1244   int UNUSED written = 0;
1245   IADDR UNUSED pc = abuf->addr;
1246   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1247
1248 {
1249   {
1250     SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 1);
1251     SET_H_GRC (FLD (f_rn), opval);
1252     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1253   }
1254   {
1255     BI opval = EQSI (GET_H_GRC (FLD (f_rn)), 0);
1256     SET_H_TBIT (opval);
1257     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1258   }
1259 }
1260
1261   return vpc;
1262 #undef FLD
1263 }
1264
1265 /* extsb-compact: exts.b $rm, $rn */
1266
1267 static SEM_PC
1268 SEM_FN_NAME (sh64_compact,extsb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1269 {
1270 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1271   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1272   int UNUSED written = 0;
1273   IADDR UNUSED pc = abuf->addr;
1274   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1275
1276   {
1277     SI opval = EXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3));
1278     SET_H_GRC (FLD (f_rn), opval);
1279     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1280   }
1281
1282   return vpc;
1283 #undef FLD
1284 }
1285
1286 /* extsw-compact: exts.w $rm, $rn */
1287
1288 static SEM_PC
1289 SEM_FN_NAME (sh64_compact,extsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1290 {
1291 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1292   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1293   int UNUSED written = 0;
1294   IADDR UNUSED pc = abuf->addr;
1295   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1296
1297   {
1298     SI opval = EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1));
1299     SET_H_GRC (FLD (f_rn), opval);
1300     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1301   }
1302
1303   return vpc;
1304 #undef FLD
1305 }
1306
1307 /* extub-compact: extu.b $rm, $rn */
1308
1309 static SEM_PC
1310 SEM_FN_NAME (sh64_compact,extub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1311 {
1312 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1313   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1314   int UNUSED written = 0;
1315   IADDR UNUSED pc = abuf->addr;
1316   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1317
1318   {
1319     SI opval = ZEXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3));
1320     SET_H_GRC (FLD (f_rn), opval);
1321     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1322   }
1323
1324   return vpc;
1325 #undef FLD
1326 }
1327
1328 /* extuw-compact: extu.w $rm, $rn */
1329
1330 static SEM_PC
1331 SEM_FN_NAME (sh64_compact,extuw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1332 {
1333 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1334   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1335   int UNUSED written = 0;
1336   IADDR UNUSED pc = abuf->addr;
1337   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1338
1339   {
1340     SI opval = ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1));
1341     SET_H_GRC (FLD (f_rn), opval);
1342     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1343   }
1344
1345   return vpc;
1346 #undef FLD
1347 }
1348
1349 /* fabs-compact: fabs $fsdn */
1350
1351 static SEM_PC
1352 SEM_FN_NAME (sh64_compact,fabs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1353 {
1354 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1355   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1356   int UNUSED written = 0;
1357   IADDR UNUSED pc = abuf->addr;
1358   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1359
1360 if (GET_H_PRBIT ()) {
1361   {
1362     DF opval = sh64_fabsd (current_cpu, GET_H_FSD (FLD (f_rn)));
1363     SET_H_FSD (FLD (f_rn), opval);
1364     written |= (1 << 2);
1365     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1366   }
1367 } else {
1368   {
1369     DF opval = sh64_fabss (current_cpu, GET_H_FSD (FLD (f_rn)));
1370     SET_H_FSD (FLD (f_rn), opval);
1371     written |= (1 << 2);
1372     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1373   }
1374 }
1375
1376   abuf->written = written;
1377   return vpc;
1378 #undef FLD
1379 }
1380
1381 /* fadd-compact: fadd $fsdm, $fsdn */
1382
1383 static SEM_PC
1384 SEM_FN_NAME (sh64_compact,fadd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1385 {
1386 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1387   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1388   int UNUSED written = 0;
1389   IADDR UNUSED pc = abuf->addr;
1390   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1391
1392 if (GET_H_PRBIT ()) {
1393   {
1394     DF opval = sh64_faddd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1395     SET_H_FSD (FLD (f_rn), opval);
1396     written |= (1 << 3);
1397     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1398   }
1399 } else {
1400   {
1401     DF opval = sh64_fadds (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1402     SET_H_FSD (FLD (f_rn), opval);
1403     written |= (1 << 3);
1404     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1405   }
1406 }
1407
1408   abuf->written = written;
1409   return vpc;
1410 #undef FLD
1411 }
1412
1413 /* fcmpeq-compact: fcmp/eq $fsdm, $fsdn */
1414
1415 static SEM_PC
1416 SEM_FN_NAME (sh64_compact,fcmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1417 {
1418 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1419   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1420   int UNUSED written = 0;
1421   IADDR UNUSED pc = abuf->addr;
1422   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1423
1424 if (GET_H_PRBIT ()) {
1425   {
1426     BI opval = sh64_fcmpeqd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1427     SET_H_TBIT (opval);
1428     written |= (1 << 3);
1429     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1430   }
1431 } else {
1432   {
1433     BI opval = sh64_fcmpeqs (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1434     SET_H_TBIT (opval);
1435     written |= (1 << 3);
1436     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1437   }
1438 }
1439
1440   abuf->written = written;
1441   return vpc;
1442 #undef FLD
1443 }
1444
1445 /* fcmpgt-compact: fcmp/gt $fsdm, $fsdn */
1446
1447 static SEM_PC
1448 SEM_FN_NAME (sh64_compact,fcmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1449 {
1450 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1451   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1452   int UNUSED written = 0;
1453   IADDR UNUSED pc = abuf->addr;
1454   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1455
1456 if (GET_H_PRBIT ()) {
1457   {
1458     BI opval = sh64_fcmpgtd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1459     SET_H_TBIT (opval);
1460     written |= (1 << 3);
1461     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1462   }
1463 } else {
1464   {
1465     BI opval = sh64_fcmpgts (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1466     SET_H_TBIT (opval);
1467     written |= (1 << 3);
1468     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1469   }
1470 }
1471
1472   abuf->written = written;
1473   return vpc;
1474 #undef FLD
1475 }
1476
1477 /* fcnvds-compact: fcnvds $drn, fpul */
1478
1479 static SEM_PC
1480 SEM_FN_NAME (sh64_compact,fcnvds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1481 {
1482 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1483   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1484   int UNUSED written = 0;
1485   IADDR UNUSED pc = abuf->addr;
1486   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1487
1488   {
1489     SF opval = sh64_fcnvds (current_cpu, GET_H_DRC (FLD (f_dn)));
1490     CPU (h_fr[((UINT) 32)]) = opval;
1491     TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1492   }
1493
1494   return vpc;
1495 #undef FLD
1496 }
1497
1498 /* fcnvsd-compact: fcnvsd fpul, $drn */
1499
1500 static SEM_PC
1501 SEM_FN_NAME (sh64_compact,fcnvsd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1502 {
1503 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1504   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1505   int UNUSED written = 0;
1506   IADDR UNUSED pc = abuf->addr;
1507   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1508
1509   {
1510     DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[((UINT) 32)]));
1511     SET_H_DRC (FLD (f_dn), opval);
1512     TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval);
1513   }
1514
1515   return vpc;
1516 #undef FLD
1517 }
1518
1519 /* fdiv-compact: fdiv $fsdm, $fsdn */
1520
1521 static SEM_PC
1522 SEM_FN_NAME (sh64_compact,fdiv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1523 {
1524 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1525   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1526   int UNUSED written = 0;
1527   IADDR UNUSED pc = abuf->addr;
1528   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1529
1530 if (GET_H_PRBIT ()) {
1531   {
1532     DF opval = sh64_fdivd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1533     SET_H_FSD (FLD (f_rn), opval);
1534     written |= (1 << 3);
1535     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1536   }
1537 } else {
1538   {
1539     DF opval = sh64_fdivs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1540     SET_H_FSD (FLD (f_rn), opval);
1541     written |= (1 << 3);
1542     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1543   }
1544 }
1545
1546   abuf->written = written;
1547   return vpc;
1548 #undef FLD
1549 }
1550
1551 /* fipr-compact: fipr $fvm, $fvn */
1552
1553 static SEM_PC
1554 SEM_FN_NAME (sh64_compact,fipr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1555 {
1556 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
1557   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1558   int UNUSED written = 0;
1559   IADDR UNUSED pc = abuf->addr;
1560   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1561
1562 sh64_fipr (current_cpu, FLD (f_vm), FLD (f_vn));
1563
1564   return vpc;
1565 #undef FLD
1566 }
1567
1568 /* flds-compact: flds $frn, fpul */
1569
1570 static SEM_PC
1571 SEM_FN_NAME (sh64_compact,flds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1572 {
1573 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1574   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1575   int UNUSED written = 0;
1576   IADDR UNUSED pc = abuf->addr;
1577   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1578
1579   {
1580     SF opval = GET_H_FRC (FLD (f_rn));
1581     CPU (h_fr[((UINT) 32)]) = opval;
1582     TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1583   }
1584
1585   return vpc;
1586 #undef FLD
1587 }
1588
1589 /* fldi0-compact: fldi0 $frn */
1590
1591 static SEM_PC
1592 SEM_FN_NAME (sh64_compact,fldi0_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1593 {
1594 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1595   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1596   int UNUSED written = 0;
1597   IADDR UNUSED pc = abuf->addr;
1598   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1599
1600   {
1601     SF opval = sh64_fldi0 (current_cpu);
1602     SET_H_FRC (FLD (f_rn), opval);
1603     TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1604   }
1605
1606   return vpc;
1607 #undef FLD
1608 }
1609
1610 /* fldi1-compact: fldi1 $frn */
1611
1612 static SEM_PC
1613 SEM_FN_NAME (sh64_compact,fldi1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1614 {
1615 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1616   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1617   int UNUSED written = 0;
1618   IADDR UNUSED pc = abuf->addr;
1619   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1620
1621   {
1622     SF opval = sh64_fldi1 (current_cpu);
1623     SET_H_FRC (FLD (f_rn), opval);
1624     TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1625   }
1626
1627   return vpc;
1628 #undef FLD
1629 }
1630
1631 /* float-compact: float fpul, $fsdn */
1632
1633 static SEM_PC
1634 SEM_FN_NAME (sh64_compact,float_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1635 {
1636 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1637   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1638   int UNUSED written = 0;
1639   IADDR UNUSED pc = abuf->addr;
1640   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1641
1642 if (GET_H_PRBIT ()) {
1643   {
1644     DF opval = sh64_floatld (current_cpu, CPU (h_fr[((UINT) 32)]));
1645     SET_H_FSD (FLD (f_rn), opval);
1646     written |= (1 << 2);
1647     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1648   }
1649 } else {
1650   {
1651     DF opval = sh64_floatls (current_cpu, CPU (h_fr[((UINT) 32)]));
1652     SET_H_FSD (FLD (f_rn), opval);
1653     written |= (1 << 2);
1654     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1655   }
1656 }
1657
1658   abuf->written = written;
1659   return vpc;
1660 #undef FLD
1661 }
1662
1663 /* fmac-compact: fmac fr0, $frm, $frn */
1664
1665 static SEM_PC
1666 SEM_FN_NAME (sh64_compact,fmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1667 {
1668 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1669   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1670   int UNUSED written = 0;
1671   IADDR UNUSED pc = abuf->addr;
1672   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1673
1674   {
1675     SF opval = sh64_fmacs (current_cpu, GET_H_FRC (((UINT) 0)), GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn)));
1676     SET_H_FRC (FLD (f_rn), opval);
1677     TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1678   }
1679
1680   return vpc;
1681 #undef FLD
1682 }
1683
1684 /* fmov1-compact: fmov $fmovm, $fmovn */
1685
1686 static SEM_PC
1687 SEM_FN_NAME (sh64_compact,fmov1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1688 {
1689 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1690   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1691   int UNUSED written = 0;
1692   IADDR UNUSED pc = abuf->addr;
1693   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1694
1695   {
1696     DF opval = GET_H_FMOV (FLD (f_rm));
1697     SET_H_FMOV (FLD (f_rn), opval);
1698     TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1699   }
1700
1701   return vpc;
1702 #undef FLD
1703 }
1704
1705 /* fmov2-compact: fmov @$rm, $fmovn */
1706
1707 static SEM_PC
1708 SEM_FN_NAME (sh64_compact,fmov2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1709 {
1710 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1711   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1712   int UNUSED written = 0;
1713   IADDR UNUSED pc = abuf->addr;
1714   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1715
1716 if (NOTBI (GET_H_SZBIT ())) {
1717   {
1718     DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1719     SET_H_FMOV (FLD (f_rn), opval);
1720     written |= (1 << 4);
1721     TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1722   }
1723 } else {
1724   {
1725     DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1726     SET_H_FMOV (FLD (f_rn), opval);
1727     written |= (1 << 4);
1728     TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1729   }
1730 }
1731
1732   abuf->written = written;
1733   return vpc;
1734 #undef FLD
1735 }
1736
1737 /* fmov3-compact: fmov @${rm}+, fmovn */
1738
1739 static SEM_PC
1740 SEM_FN_NAME (sh64_compact,fmov3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1741 {
1742 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1743   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1744   int UNUSED written = 0;
1745   IADDR UNUSED pc = abuf->addr;
1746   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1747
1748 if (NOTBI (GET_H_SZBIT ())) {
1749 {
1750   {
1751     DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1752     SET_H_FMOV (FLD (f_rn), opval);
1753     written |= (1 << 4);
1754     TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1755   }
1756   {
1757     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
1758     SET_H_GRC (FLD (f_rm), opval);
1759     written |= (1 << 5);
1760     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1761   }
1762 }
1763 } else {
1764 {
1765   {
1766     DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1767     SET_H_FMOV (FLD (f_rn), opval);
1768     written |= (1 << 4);
1769     TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1770   }
1771   {
1772     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 8);
1773     SET_H_GRC (FLD (f_rm), opval);
1774     written |= (1 << 5);
1775     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1776   }
1777 }
1778 }
1779
1780   abuf->written = written;
1781   return vpc;
1782 #undef FLD
1783 }
1784
1785 /* fmov4-compact: fmov @(r0, $rm), $fmovn */
1786
1787 static SEM_PC
1788 SEM_FN_NAME (sh64_compact,fmov4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1789 {
1790 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1791   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1792   int UNUSED written = 0;
1793   IADDR UNUSED pc = abuf->addr;
1794   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1795
1796 if (NOTBI (GET_H_SZBIT ())) {
1797   {
1798     DF opval = GETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
1799     SET_H_FMOV (FLD (f_rn), opval);
1800     written |= (1 << 5);
1801     TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1802   }
1803 } else {
1804   {
1805     DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
1806     SET_H_FMOV (FLD (f_rn), opval);
1807     written |= (1 << 5);
1808     TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1809   }
1810 }
1811
1812   abuf->written = written;
1813   return vpc;
1814 #undef FLD
1815 }
1816
1817 /* fmov5-compact: fmov $fmovm, @$rn */
1818
1819 static SEM_PC
1820 SEM_FN_NAME (sh64_compact,fmov5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1821 {
1822 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1823   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1824   int UNUSED written = 0;
1825   IADDR UNUSED pc = abuf->addr;
1826   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1827
1828 if (NOTBI (GET_H_SZBIT ())) {
1829   {
1830     SF opval = GET_H_FMOV (FLD (f_rm));
1831     SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1832     written |= (1 << 4);
1833     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1834   }
1835 } else {
1836   {
1837     DF opval = GET_H_FMOV (FLD (f_rm));
1838     SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1839     written |= (1 << 3);
1840     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1841   }
1842 }
1843
1844   abuf->written = written;
1845   return vpc;
1846 #undef FLD
1847 }
1848
1849 /* fmov6-compact: fmov $fmovm, @-$rn */
1850
1851 static SEM_PC
1852 SEM_FN_NAME (sh64_compact,fmov6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1853 {
1854 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1855   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1856   int UNUSED written = 0;
1857   IADDR UNUSED pc = abuf->addr;
1858   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1859
1860 if (NOTBI (GET_H_SZBIT ())) {
1861 {
1862   {
1863     SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
1864     SET_H_GRC (FLD (f_rn), opval);
1865     written |= (1 << 5);
1866     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1867   }
1868   {
1869     SF opval = GET_H_FMOV (FLD (f_rm));
1870     SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1871     written |= (1 << 4);
1872     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1873   }
1874 }
1875 } else {
1876 {
1877   {
1878     SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 8);
1879     SET_H_GRC (FLD (f_rn), opval);
1880     written |= (1 << 5);
1881     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1882   }
1883   {
1884     DF opval = GET_H_FMOV (FLD (f_rm));
1885     SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1886     written |= (1 << 3);
1887     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1888   }
1889 }
1890 }
1891
1892   abuf->written = written;
1893   return vpc;
1894 #undef FLD
1895 }
1896
1897 /* fmov7-compact: fmov $fmovm, @(r0, $rn) */
1898
1899 static SEM_PC
1900 SEM_FN_NAME (sh64_compact,fmov7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1901 {
1902 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1903   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1904   int UNUSED written = 0;
1905   IADDR UNUSED pc = abuf->addr;
1906   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1907
1908 if (NOTBI (GET_H_SZBIT ())) {
1909   {
1910     SF opval = GET_H_FMOV (FLD (f_rm));
1911     SETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
1912     written |= (1 << 5);
1913     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1914   }
1915 } else {
1916   {
1917     DF opval = GET_H_FMOV (FLD (f_rm));
1918     SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
1919     written |= (1 << 4);
1920     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1921   }
1922 }
1923
1924   abuf->written = written;
1925   return vpc;
1926 #undef FLD
1927 }
1928
1929 /* fmov8-compact: fmov.d @($imm12x8, $rm), $drn */
1930
1931 static SEM_PC
1932 SEM_FN_NAME (sh64_compact,fmov8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1933 {
1934 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1935   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1936   int UNUSED written = 0;
1937   IADDR UNUSED pc = abuf->addr;
1938   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1939
1940   {
1941     DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x8)));
1942     SET_H_DRC (FLD (f_dn), opval);
1943     TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval);
1944   }
1945
1946   return vpc;
1947 #undef FLD
1948 }
1949
1950 /* fmov9-compact: mov.l $drm, @($imm12x8, $rn) */
1951
1952 static SEM_PC
1953 SEM_FN_NAME (sh64_compact,fmov9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1954 {
1955 #define FLD(f) abuf->fields.sfmt_fmov9_compact.f
1956   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1957   int UNUSED written = 0;
1958   IADDR UNUSED pc = abuf->addr;
1959   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1960
1961   {
1962     DF opval = GET_H_DRC (FLD (f_dm));
1963     SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x8)), opval);
1964     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1965   }
1966
1967   return vpc;
1968 #undef FLD
1969 }
1970
1971 /* fmul-compact: fmul $fsdm, $fsdn */
1972
1973 static SEM_PC
1974 SEM_FN_NAME (sh64_compact,fmul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1975 {
1976 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1977   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1978   int UNUSED written = 0;
1979   IADDR UNUSED pc = abuf->addr;
1980   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1981
1982 if (GET_H_PRBIT ()) {
1983   {
1984     DF opval = sh64_fmuld (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1985     SET_H_FSD (FLD (f_rn), opval);
1986     written |= (1 << 3);
1987     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1988   }
1989 } else {
1990   {
1991     DF opval = sh64_fmuls (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1992     SET_H_FSD (FLD (f_rn), opval);
1993     written |= (1 << 3);
1994     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1995   }
1996 }
1997
1998   abuf->written = written;
1999   return vpc;
2000 #undef FLD
2001 }
2002
2003 /* fneg-compact: fneg $fsdn */
2004
2005 static SEM_PC
2006 SEM_FN_NAME (sh64_compact,fneg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2007 {
2008 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2009   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2010   int UNUSED written = 0;
2011   IADDR UNUSED pc = abuf->addr;
2012   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2013
2014 if (GET_H_PRBIT ()) {
2015   {
2016     DF opval = sh64_fnegd (current_cpu, GET_H_FSD (FLD (f_rn)));
2017     SET_H_FSD (FLD (f_rn), opval);
2018     written |= (1 << 2);
2019     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2020   }
2021 } else {
2022   {
2023     DF opval = sh64_fnegs (current_cpu, GET_H_FSD (FLD (f_rn)));
2024     SET_H_FSD (FLD (f_rn), opval);
2025     written |= (1 << 2);
2026     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2027   }
2028 }
2029
2030   abuf->written = written;
2031   return vpc;
2032 #undef FLD
2033 }
2034
2035 /* frchg-compact: frchg */
2036
2037 static SEM_PC
2038 SEM_FN_NAME (sh64_compact,frchg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2039 {
2040 #define FLD(f) abuf->fields.fmt_empty.f
2041   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2042   int UNUSED written = 0;
2043   IADDR UNUSED pc = abuf->addr;
2044   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2045
2046   {
2047     BI opval = NOTBI (GET_H_FRBIT ());
2048     SET_H_FRBIT (opval);
2049     TRACE_RESULT (current_cpu, abuf, "frbit", 'x', opval);
2050   }
2051
2052   return vpc;
2053 #undef FLD
2054 }
2055
2056 /* fschg-compact: fschg */
2057
2058 static SEM_PC
2059 SEM_FN_NAME (sh64_compact,fschg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2060 {
2061 #define FLD(f) abuf->fields.fmt_empty.f
2062   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2063   int UNUSED written = 0;
2064   IADDR UNUSED pc = abuf->addr;
2065   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2066
2067   {
2068     BI opval = NOTBI (GET_H_SZBIT ());
2069     SET_H_SZBIT (opval);
2070     TRACE_RESULT (current_cpu, abuf, "szbit", 'x', opval);
2071   }
2072
2073   return vpc;
2074 #undef FLD
2075 }
2076
2077 /* fsqrt-compact: fsqrt $fsdn */
2078
2079 static SEM_PC
2080 SEM_FN_NAME (sh64_compact,fsqrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2081 {
2082 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2083   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2084   int UNUSED written = 0;
2085   IADDR UNUSED pc = abuf->addr;
2086   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2087
2088 if (GET_H_PRBIT ()) {
2089   {
2090     DF opval = sh64_fsqrtd (current_cpu, GET_H_FSD (FLD (f_rn)));
2091     SET_H_FSD (FLD (f_rn), opval);
2092     written |= (1 << 2);
2093     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2094   }
2095 } else {
2096   {
2097     DF opval = sh64_fsqrts (current_cpu, GET_H_FSD (FLD (f_rn)));
2098     SET_H_FSD (FLD (f_rn), opval);
2099     written |= (1 << 2);
2100     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2101   }
2102 }
2103
2104   abuf->written = written;
2105   return vpc;
2106 #undef FLD
2107 }
2108
2109 /* fsts-compact: fsts fpul, $frn */
2110
2111 static SEM_PC
2112 SEM_FN_NAME (sh64_compact,fsts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2113 {
2114 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2115   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2116   int UNUSED written = 0;
2117   IADDR UNUSED pc = abuf->addr;
2118   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2119
2120   {
2121     SF opval = CPU (h_fr[((UINT) 32)]);
2122     SET_H_FRC (FLD (f_rn), opval);
2123     TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
2124   }
2125
2126   return vpc;
2127 #undef FLD
2128 }
2129
2130 /* fsub-compact: fsub $fsdm, $fsdn */
2131
2132 static SEM_PC
2133 SEM_FN_NAME (sh64_compact,fsub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2134 {
2135 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2136   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2137   int UNUSED written = 0;
2138   IADDR UNUSED pc = abuf->addr;
2139   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2140
2141 if (GET_H_PRBIT ()) {
2142   {
2143     DF opval = sh64_fsubd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
2144     SET_H_FSD (FLD (f_rn), opval);
2145     written |= (1 << 3);
2146     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2147   }
2148 } else {
2149   {
2150     DF opval = sh64_fsubs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
2151     SET_H_FSD (FLD (f_rn), opval);
2152     written |= (1 << 3);
2153     TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2154   }
2155 }
2156
2157   abuf->written = written;
2158   return vpc;
2159 #undef FLD
2160 }
2161
2162 /* ftrc-compact: ftrc $fsdn, fpul */
2163
2164 static SEM_PC
2165 SEM_FN_NAME (sh64_compact,ftrc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2166 {
2167 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2168   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2169   int UNUSED written = 0;
2170   IADDR UNUSED pc = abuf->addr;
2171   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2172
2173   {
2174     SF opval = ((GET_H_PRBIT ()) ? (sh64_ftrcdl (current_cpu, GET_H_FSD (FLD (f_rn)))) : (sh64_ftrcsl (current_cpu, GET_H_FSD (FLD (f_rn)))));
2175     CPU (h_fr[((UINT) 32)]) = opval;
2176     TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2177   }
2178
2179   return vpc;
2180 #undef FLD
2181 }
2182
2183 /* ftrv-compact: ftrv xmtrx, $fvn */
2184
2185 static SEM_PC
2186 SEM_FN_NAME (sh64_compact,ftrv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2187 {
2188 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
2189   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2190   int UNUSED written = 0;
2191   IADDR UNUSED pc = abuf->addr;
2192   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2193
2194 sh64_ftrv (current_cpu, FLD (f_vn));
2195
2196   return vpc;
2197 #undef FLD
2198 }
2199
2200 /* jmp-compact: jmp @$rn */
2201
2202 static SEM_PC
2203 SEM_FN_NAME (sh64_compact,jmp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2204 {
2205 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2206   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2207   int UNUSED written = 0;
2208   IADDR UNUSED pc = abuf->addr;
2209   SEM_BRANCH_INIT
2210   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2211
2212 {
2213   {
2214     UDI opval = ADDDI (pc, 2);
2215     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2216     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2217   }
2218 ((void) 0); /*nop*/
2219 {
2220   {
2221     UDI opval = GET_H_GRC (FLD (f_rn));
2222     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2223     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2224   }
2225 }
2226 ((void) 0); /*nop*/
2227 }
2228
2229   SEM_BRANCH_FINI (vpc);
2230   return vpc;
2231 #undef FLD
2232 }
2233
2234 /* jsr-compact: jsr @$rn */
2235
2236 static SEM_PC
2237 SEM_FN_NAME (sh64_compact,jsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2238 {
2239 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2240   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2241   int UNUSED written = 0;
2242   IADDR UNUSED pc = abuf->addr;
2243   SEM_BRANCH_INIT
2244   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2245
2246 {
2247 {
2248   {
2249     SI opval = ADDDI (pc, 4);
2250     SET_H_PR (opval);
2251     TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2252   }
2253 }
2254   {
2255     UDI opval = ADDDI (pc, 2);
2256     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2257     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2258   }
2259 ((void) 0); /*nop*/
2260 {
2261   {
2262     UDI opval = GET_H_GRC (FLD (f_rn));
2263     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2264     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2265   }
2266 }
2267 ((void) 0); /*nop*/
2268 }
2269
2270   SEM_BRANCH_FINI (vpc);
2271   return vpc;
2272 #undef FLD
2273 }
2274
2275 /* ldc-gbr-compact: ldc $rn, gbr */
2276
2277 static SEM_PC
2278 SEM_FN_NAME (sh64_compact,ldc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2279 {
2280 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2281   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2282   int UNUSED written = 0;
2283   IADDR UNUSED pc = abuf->addr;
2284   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2285
2286   {
2287     SI opval = GET_H_GRC (FLD (f_rn));
2288     SET_H_GBR (opval);
2289     TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval);
2290   }
2291
2292   return vpc;
2293 #undef FLD
2294 }
2295
2296 /* ldc-vbr-compact: ldc $rn, vbr */
2297
2298 static SEM_PC
2299 SEM_FN_NAME (sh64_compact,ldc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2300 {
2301 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2302   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2303   int UNUSED written = 0;
2304   IADDR UNUSED pc = abuf->addr;
2305   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2306
2307   {
2308     SI opval = GET_H_GRC (FLD (f_rn));
2309     SET_H_VBR (opval);
2310     TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval);
2311   }
2312
2313   return vpc;
2314 #undef FLD
2315 }
2316
2317 /* ldc-sr-compact: ldc $rn, sr */
2318
2319 static SEM_PC
2320 SEM_FN_NAME (sh64_compact,ldc_sr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2321 {
2322 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2323   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2324   int UNUSED written = 0;
2325   IADDR UNUSED pc = abuf->addr;
2326   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2327
2328   {
2329     SI opval = GET_H_GRC (FLD (f_rn));
2330     CPU (h_sr) = opval;
2331     TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval);
2332   }
2333
2334   return vpc;
2335 #undef FLD
2336 }
2337
2338 /* ldcl-gbr-compact: ldc.l @${rn}+, gbr */
2339
2340 static SEM_PC
2341 SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2342 {
2343 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2344   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2345   int UNUSED written = 0;
2346   IADDR UNUSED pc = abuf->addr;
2347   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2348
2349 {
2350   {
2351     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2352     SET_H_GBR (opval);
2353     TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval);
2354   }
2355   {
2356     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2357     SET_H_GRC (FLD (f_rn), opval);
2358     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2359   }
2360 }
2361
2362   return vpc;
2363 #undef FLD
2364 }
2365
2366 /* ldcl-vbr-compact: ldc.l @${rn}+, vbr */
2367
2368 static SEM_PC
2369 SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2370 {
2371 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2372   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2373   int UNUSED written = 0;
2374   IADDR UNUSED pc = abuf->addr;
2375   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2376
2377 {
2378   {
2379     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2380     SET_H_VBR (opval);
2381     TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval);
2382   }
2383   {
2384     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2385     SET_H_GRC (FLD (f_rn), opval);
2386     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2387   }
2388 }
2389
2390   return vpc;
2391 #undef FLD
2392 }
2393
2394 /* lds-fpscr-compact: lds $rn, fpscr */
2395
2396 static SEM_PC
2397 SEM_FN_NAME (sh64_compact,lds_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2398 {
2399 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2400   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2401   int UNUSED written = 0;
2402   IADDR UNUSED pc = abuf->addr;
2403   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2404
2405   {
2406     SI opval = GET_H_GRC (FLD (f_rn));
2407     CPU (h_fpscr) = opval;
2408     TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
2409   }
2410
2411   return vpc;
2412 #undef FLD
2413 }
2414
2415 /* ldsl-fpscr-compact: lds.l @${rn}+, fpscr */
2416
2417 static SEM_PC
2418 SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2419 {
2420 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2421   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2422   int UNUSED written = 0;
2423   IADDR UNUSED pc = abuf->addr;
2424   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2425
2426 {
2427   {
2428     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2429     CPU (h_fpscr) = opval;
2430     TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
2431   }
2432   {
2433     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2434     SET_H_GRC (FLD (f_rn), opval);
2435     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2436   }
2437 }
2438
2439   return vpc;
2440 #undef FLD
2441 }
2442
2443 /* lds-fpul-compact: lds $rn, fpul */
2444
2445 static SEM_PC
2446 SEM_FN_NAME (sh64_compact,lds_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2447 {
2448 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2449   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2450   int UNUSED written = 0;
2451   IADDR UNUSED pc = abuf->addr;
2452   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2453
2454   {
2455     SF opval = SUBWORDSISF (GET_H_GRC (FLD (f_rn)));
2456     CPU (h_fr[((UINT) 32)]) = opval;
2457     TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2458   }
2459
2460   return vpc;
2461 #undef FLD
2462 }
2463
2464 /* ldsl-fpul-compact: lds.l @${rn}+, fpul */
2465
2466 static SEM_PC
2467 SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2468 {
2469 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2470   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2471   int UNUSED written = 0;
2472   IADDR UNUSED pc = abuf->addr;
2473   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2474
2475 {
2476   {
2477     SF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2478     CPU (h_fr[((UINT) 32)]) = opval;
2479     TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2480   }
2481   {
2482     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2483     SET_H_GRC (FLD (f_rn), opval);
2484     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2485   }
2486 }
2487
2488   return vpc;
2489 #undef FLD
2490 }
2491
2492 /* lds-mach-compact: lds $rn, mach */
2493
2494 static SEM_PC
2495 SEM_FN_NAME (sh64_compact,lds_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2496 {
2497 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2498   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2499   int UNUSED written = 0;
2500   IADDR UNUSED pc = abuf->addr;
2501   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2502
2503   {
2504     SI opval = GET_H_GRC (FLD (f_rn));
2505     SET_H_MACH (opval);
2506     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2507   }
2508
2509   return vpc;
2510 #undef FLD
2511 }
2512
2513 /* ldsl-mach-compact: lds.l @${rn}+, mach */
2514
2515 static SEM_PC
2516 SEM_FN_NAME (sh64_compact,ldsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2517 {
2518 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2519   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2520   int UNUSED written = 0;
2521   IADDR UNUSED pc = abuf->addr;
2522   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2523
2524 {
2525   {
2526     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2527     SET_H_MACH (opval);
2528     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2529   }
2530   {
2531     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2532     SET_H_GRC (FLD (f_rn), opval);
2533     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2534   }
2535 }
2536
2537   return vpc;
2538 #undef FLD
2539 }
2540
2541 /* lds-macl-compact: lds $rn, macl */
2542
2543 static SEM_PC
2544 SEM_FN_NAME (sh64_compact,lds_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2545 {
2546 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2547   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2548   int UNUSED written = 0;
2549   IADDR UNUSED pc = abuf->addr;
2550   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2551
2552   {
2553     SI opval = GET_H_GRC (FLD (f_rn));
2554     SET_H_MACL (opval);
2555     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2556   }
2557
2558   return vpc;
2559 #undef FLD
2560 }
2561
2562 /* ldsl-macl-compact: lds.l @${rn}+, macl */
2563
2564 static SEM_PC
2565 SEM_FN_NAME (sh64_compact,ldsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2566 {
2567 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2568   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2569   int UNUSED written = 0;
2570   IADDR UNUSED pc = abuf->addr;
2571   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2572
2573 {
2574   {
2575     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2576     SET_H_MACL (opval);
2577     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2578   }
2579   {
2580     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2581     SET_H_GRC (FLD (f_rn), opval);
2582     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2583   }
2584 }
2585
2586   return vpc;
2587 #undef FLD
2588 }
2589
2590 /* lds-pr-compact: lds $rn, pr */
2591
2592 static SEM_PC
2593 SEM_FN_NAME (sh64_compact,lds_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2594 {
2595 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2596   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2597   int UNUSED written = 0;
2598   IADDR UNUSED pc = abuf->addr;
2599   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2600
2601   {
2602     SI opval = GET_H_GRC (FLD (f_rn));
2603     SET_H_PR (opval);
2604     TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2605   }
2606
2607   return vpc;
2608 #undef FLD
2609 }
2610
2611 /* ldsl-pr-compact: lds.l @${rn}+, pr */
2612
2613 static SEM_PC
2614 SEM_FN_NAME (sh64_compact,ldsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2615 {
2616 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2617   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2618   int UNUSED written = 0;
2619   IADDR UNUSED pc = abuf->addr;
2620   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2621
2622 {
2623   {
2624     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2625     SET_H_PR (opval);
2626     TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2627   }
2628   {
2629     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2630     SET_H_GRC (FLD (f_rn), opval);
2631     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2632   }
2633 }
2634
2635   return vpc;
2636 #undef FLD
2637 }
2638
2639 /* macl-compact: mac.l @${rm}+, @${rn}+ */
2640
2641 static SEM_PC
2642 SEM_FN_NAME (sh64_compact,macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2643 {
2644 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2645   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2646   int UNUSED written = 0;
2647   IADDR UNUSED pc = abuf->addr;
2648   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2649
2650 {
2651   DI tmp_tmpry;
2652   DI tmp_mac;
2653   DI tmp_result;
2654   SI tmp_x;
2655   SI tmp_y;
2656   tmp_x = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2657   {
2658     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2659     SET_H_GRC (FLD (f_rn), opval);
2660     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2661   }
2662 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2663 {
2664   {
2665     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2666     SET_H_GRC (FLD (f_rn), opval);
2667     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2668   }
2669   {
2670     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
2671     SET_H_GRC (FLD (f_rm), opval);
2672     written |= (1 << 11);
2673     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2674   }
2675 }
2676 }
2677   tmp_y = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
2678   {
2679     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
2680     SET_H_GRC (FLD (f_rm), opval);
2681     written |= (1 << 11);
2682     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2683   }
2684   tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2685   tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ()));
2686   tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2687 {
2688 if (GET_H_SBIT ()) {
2689 {
2690   SI tmp_min;
2691   SI tmp_max;
2692   tmp_max = SRLDI (INVDI (0), 16);
2693   tmp_min = SRLDI (INVDI (0), 15);
2694 if (GTDI (tmp_result, tmp_max)) {
2695   tmp_result = tmp_max;
2696 } else {
2697 if (LTDI (tmp_result, tmp_min)) {
2698   tmp_result = tmp_min;
2699 }
2700 }
2701 }
2702 }
2703   {
2704     SI opval = SUBWORDDISI (tmp_result, 0);
2705     SET_H_MACH (opval);
2706     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2707   }
2708   {
2709     SI opval = SUBWORDDISI (tmp_result, 1);
2710     SET_H_MACL (opval);
2711     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2712   }
2713 }
2714 }
2715
2716   abuf->written = written;
2717   return vpc;
2718 #undef FLD
2719 }
2720
2721 /* macw-compact: mac.w @${rm}+, @${rn}+ */
2722
2723 static SEM_PC
2724 SEM_FN_NAME (sh64_compact,macw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2725 {
2726 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2727   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2728   int UNUSED written = 0;
2729   IADDR UNUSED pc = abuf->addr;
2730   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2731
2732 {
2733   SI tmp_tmpry;
2734   DI tmp_mac;
2735   DI tmp_result;
2736   HI tmp_x;
2737   HI tmp_y;
2738   tmp_x = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2739   {
2740     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2);
2741     SET_H_GRC (FLD (f_rn), opval);
2742     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2743   }
2744 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2745 {
2746   {
2747     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2);
2748     SET_H_GRC (FLD (f_rn), opval);
2749     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2750   }
2751   {
2752     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
2753     SET_H_GRC (FLD (f_rm), opval);
2754     written |= (1 << 11);
2755     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2756   }
2757 }
2758 }
2759   tmp_y = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
2760   {
2761     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
2762     SET_H_GRC (FLD (f_rm), opval);
2763     written |= (1 << 11);
2764     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2765   }
2766   tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2767 if (GET_H_SBIT ()) {
2768 {
2769 if (ADDOFSI (tmp_tmpry, GET_H_MACL (), 0)) {
2770   {
2771     SI opval = 1;
2772     SET_H_MACH (opval);
2773     written |= (1 << 9);
2774     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2775   }
2776 }
2777   {
2778     SI opval = ADDSI (tmp_tmpry, GET_H_MACL ());
2779     SET_H_MACL (opval);
2780     written |= (1 << 10);
2781     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2782   }
2783 }
2784 } else {
2785 {
2786   tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ()));
2787   tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2788   {
2789     SI opval = SUBWORDDISI (tmp_result, 0);
2790     SET_H_MACH (opval);
2791     written |= (1 << 9);
2792     TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2793   }
2794   {
2795     SI opval = SUBWORDDISI (tmp_result, 1);
2796     SET_H_MACL (opval);
2797     written |= (1 << 10);
2798     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2799   }
2800 }
2801 }
2802 }
2803
2804   abuf->written = written;
2805   return vpc;
2806 #undef FLD
2807 }
2808
2809 /* mov-compact: mov $rm64, $rn64 */
2810
2811 static SEM_PC
2812 SEM_FN_NAME (sh64_compact,mov_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2813 {
2814 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2815   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2816   int UNUSED written = 0;
2817   IADDR UNUSED pc = abuf->addr;
2818   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2819
2820   {
2821     DI opval = GET_H_GR (FLD (f_rm));
2822     SET_H_GR (FLD (f_rn), opval);
2823     TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2824   }
2825
2826   return vpc;
2827 #undef FLD
2828 }
2829
2830 /* movi-compact: mov #$imm8, $rn */
2831
2832 static SEM_PC
2833 SEM_FN_NAME (sh64_compact,movi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2834 {
2835 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2836   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2837   int UNUSED written = 0;
2838   IADDR UNUSED pc = abuf->addr;
2839   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2840
2841   {
2842     SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2843     SET_H_GRC (FLD (f_rn), opval);
2844     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2845   }
2846
2847   return vpc;
2848 #undef FLD
2849 }
2850
2851 /* movi20-compact: movi20 #$imm20, $rn */
2852
2853 static SEM_PC
2854 SEM_FN_NAME (sh64_compact,movi20_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2855 {
2856 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
2857   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2858   int UNUSED written = 0;
2859   IADDR UNUSED pc = abuf->addr;
2860   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2861
2862   {
2863     SI opval = FLD (f_imm20);
2864     SET_H_GRC (FLD (f_rn), opval);
2865     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2866   }
2867
2868   return vpc;
2869 #undef FLD
2870 }
2871
2872 /* movb1-compact: mov.b $rm, @$rn */
2873
2874 static SEM_PC
2875 SEM_FN_NAME (sh64_compact,movb1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2876 {
2877 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2878   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2879   int UNUSED written = 0;
2880   IADDR UNUSED pc = abuf->addr;
2881   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2882
2883   {
2884     UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2885     SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
2886     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2887   }
2888
2889   return vpc;
2890 #undef FLD
2891 }
2892
2893 /* movb2-compact: mov.b $rm, @-$rn */
2894
2895 static SEM_PC
2896 SEM_FN_NAME (sh64_compact,movb2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2897 {
2898 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2899   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2900   int UNUSED written = 0;
2901   IADDR UNUSED pc = abuf->addr;
2902   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2903
2904 {
2905   DI tmp_addr;
2906   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 1);
2907   {
2908     UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2909     SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2910     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2911   }
2912   {
2913     SI opval = tmp_addr;
2914     SET_H_GRC (FLD (f_rn), opval);
2915     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2916   }
2917 }
2918
2919   return vpc;
2920 #undef FLD
2921 }
2922
2923 /* movb3-compact: mov.b $rm, @(r0,$rn) */
2924
2925 static SEM_PC
2926 SEM_FN_NAME (sh64_compact,movb3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2927 {
2928 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2929   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2930   int UNUSED written = 0;
2931   IADDR UNUSED pc = abuf->addr;
2932   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2933
2934   {
2935     UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2936     SETMEMUQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
2937     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2938   }
2939
2940   return vpc;
2941 #undef FLD
2942 }
2943
2944 /* movb4-compact: mov.b r0, @($imm8, gbr) */
2945
2946 static SEM_PC
2947 SEM_FN_NAME (sh64_compact,movb4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2948 {
2949 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2950   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2951   int UNUSED written = 0;
2952   IADDR UNUSED pc = abuf->addr;
2953   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2954
2955 {
2956   DI tmp_addr;
2957   tmp_addr = ADDSI (GET_H_GBR (), FLD (f_imm8));
2958   {
2959     UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3);
2960     SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2961     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2962   }
2963 }
2964
2965   return vpc;
2966 #undef FLD
2967 }
2968
2969 /* movb5-compact: mov.b r0, @($imm4, $rm) */
2970
2971 static SEM_PC
2972 SEM_FN_NAME (sh64_compact,movb5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2973 {
2974 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2975   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2976   int UNUSED written = 0;
2977   IADDR UNUSED pc = abuf->addr;
2978   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2979
2980 {
2981   DI tmp_addr;
2982   tmp_addr = ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4));
2983   {
2984     UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3);
2985     SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2986     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2987   }
2988 }
2989
2990   return vpc;
2991 #undef FLD
2992 }
2993
2994 /* movb6-compact: mov.b @$rm, $rn */
2995
2996 static SEM_PC
2997 SEM_FN_NAME (sh64_compact,movb6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2998 {
2999 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3000   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3001   int UNUSED written = 0;
3002   IADDR UNUSED pc = abuf->addr;
3003   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3004
3005   {
3006     SI opval = EXTQISI (GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm))));
3007     SET_H_GRC (FLD (f_rn), opval);
3008     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3009   }
3010
3011   return vpc;
3012 #undef FLD
3013 }
3014
3015 /* movb7-compact: mov.b @${rm}+, $rn */
3016
3017 static SEM_PC
3018 SEM_FN_NAME (sh64_compact,movb7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3019 {
3020 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3021   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3022   int UNUSED written = 0;
3023   IADDR UNUSED pc = abuf->addr;
3024   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3025
3026 {
3027   QI tmp_data;
3028   tmp_data = GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3029 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3030   {
3031     SI opval = EXTQISI (tmp_data);
3032     SET_H_GRC (FLD (f_rm), opval);
3033     written |= (1 << 4);
3034     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3035   }
3036 } else {
3037   {
3038     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 1);
3039     SET_H_GRC (FLD (f_rm), opval);
3040     written |= (1 << 4);
3041     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3042   }
3043 }
3044   {
3045     SI opval = EXTQISI (tmp_data);
3046     SET_H_GRC (FLD (f_rn), opval);
3047     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3048   }
3049 }
3050
3051   abuf->written = written;
3052   return vpc;
3053 #undef FLD
3054 }
3055
3056 /* movb8-compact: mov.b @(r0, $rm), $rn */
3057
3058 static SEM_PC
3059 SEM_FN_NAME (sh64_compact,movb8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3060 {
3061 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3062   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3063   int UNUSED written = 0;
3064   IADDR UNUSED pc = abuf->addr;
3065   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3066
3067   {
3068     SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))));
3069     SET_H_GRC (FLD (f_rn), opval);
3070     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3071   }
3072
3073   return vpc;
3074 #undef FLD
3075 }
3076
3077 /* movb9-compact: mov.b @($imm8, gbr), r0 */
3078
3079 static SEM_PC
3080 SEM_FN_NAME (sh64_compact,movb9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3081 {
3082 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3083   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3084   int UNUSED written = 0;
3085   IADDR UNUSED pc = abuf->addr;
3086   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3087
3088   {
3089     SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8))));
3090     SET_H_GRC (((UINT) 0), opval);
3091     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3092   }
3093
3094   return vpc;
3095 #undef FLD
3096 }
3097
3098 /* movb10-compact: mov.b @($imm4, $rm), r0 */
3099
3100 static SEM_PC
3101 SEM_FN_NAME (sh64_compact,movb10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3102 {
3103 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
3104   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3105   int UNUSED written = 0;
3106   IADDR UNUSED pc = abuf->addr;
3107   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3108
3109   {
3110     SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4))));
3111     SET_H_GRC (((UINT) 0), opval);
3112     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3113   }
3114
3115   return vpc;
3116 #undef FLD
3117 }
3118
3119 /* movl1-compact: mov.l $rm, @$rn */
3120
3121 static SEM_PC
3122 SEM_FN_NAME (sh64_compact,movl1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3123 {
3124 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3125   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3126   int UNUSED written = 0;
3127   IADDR UNUSED pc = abuf->addr;
3128   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3129
3130   {
3131     SI opval = GET_H_GRC (FLD (f_rm));
3132     SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3133     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3134   }
3135
3136   return vpc;
3137 #undef FLD
3138 }
3139
3140 /* movl2-compact: mov.l $rm, @-$rn */
3141
3142 static SEM_PC
3143 SEM_FN_NAME (sh64_compact,movl2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3144 {
3145 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3146   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3147   int UNUSED written = 0;
3148   IADDR UNUSED pc = abuf->addr;
3149   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3150
3151 {
3152   SI tmp_addr;
3153   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
3154   {
3155     SI opval = GET_H_GRC (FLD (f_rm));
3156     SETMEMSI (current_cpu, pc, tmp_addr, opval);
3157     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3158   }
3159   {
3160     SI opval = tmp_addr;
3161     SET_H_GRC (FLD (f_rn), opval);
3162     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3163   }
3164 }
3165
3166   return vpc;
3167 #undef FLD
3168 }
3169
3170 /* movl3-compact: mov.l $rm, @(r0, $rn) */
3171
3172 static SEM_PC
3173 SEM_FN_NAME (sh64_compact,movl3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3174 {
3175 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3176   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3177   int UNUSED written = 0;
3178   IADDR UNUSED pc = abuf->addr;
3179   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3180
3181   {
3182     SI opval = GET_H_GRC (FLD (f_rm));
3183     SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
3184     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3185   }
3186
3187   return vpc;
3188 #undef FLD
3189 }
3190
3191 /* movl4-compact: mov.l r0, @($imm8x4, gbr) */
3192
3193 static SEM_PC
3194 SEM_FN_NAME (sh64_compact,movl4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3195 {
3196 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3197   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3198   int UNUSED written = 0;
3199   IADDR UNUSED pc = abuf->addr;
3200   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3201
3202   {
3203     SI opval = GET_H_GRC (((UINT) 0));
3204     SETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)), opval);
3205     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3206   }
3207
3208   return vpc;
3209 #undef FLD
3210 }
3211
3212 /* movl5-compact: mov.l $rm, @($imm4x4, $rn) */
3213
3214 static SEM_PC
3215 SEM_FN_NAME (sh64_compact,movl5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3216 {
3217 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3218   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3219   int UNUSED written = 0;
3220   IADDR UNUSED pc = abuf->addr;
3221   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3222
3223   {
3224     SI opval = GET_H_GRC (FLD (f_rm));
3225     SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm4x4)), opval);
3226     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3227   }
3228
3229   return vpc;
3230 #undef FLD
3231 }
3232
3233 /* movl6-compact: mov.l @$rm, $rn */
3234
3235 static SEM_PC
3236 SEM_FN_NAME (sh64_compact,movl6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3237 {
3238 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3239   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3240   int UNUSED written = 0;
3241   IADDR UNUSED pc = abuf->addr;
3242   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3243
3244   {
3245     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3246     SET_H_GRC (FLD (f_rn), opval);
3247     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3248   }
3249
3250   return vpc;
3251 #undef FLD
3252 }
3253
3254 /* movl7-compact: mov.l @${rm}+, $rn */
3255
3256 static SEM_PC
3257 SEM_FN_NAME (sh64_compact,movl7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3258 {
3259 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3260   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3261   int UNUSED written = 0;
3262   IADDR UNUSED pc = abuf->addr;
3263   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3264
3265 {
3266   {
3267     SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3268     SET_H_GRC (FLD (f_rn), opval);
3269     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3270   }
3271 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3272   {
3273     SI opval = GET_H_GRC (FLD (f_rn));
3274     SET_H_GRC (FLD (f_rm), opval);
3275     written |= (1 << 5);
3276     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3277   }
3278 } else {
3279   {
3280     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
3281     SET_H_GRC (FLD (f_rm), opval);
3282     written |= (1 << 5);
3283     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3284   }
3285 }
3286 }
3287
3288   abuf->written = written;
3289   return vpc;
3290 #undef FLD
3291 }
3292
3293 /* movl8-compact: mov.l @(r0, $rm), $rn */
3294
3295 static SEM_PC
3296 SEM_FN_NAME (sh64_compact,movl8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3297 {
3298 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3299   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3300   int UNUSED written = 0;
3301   IADDR UNUSED pc = abuf->addr;
3302   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3303
3304   {
3305     SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
3306     SET_H_GRC (FLD (f_rn), opval);
3307     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3308   }
3309
3310   return vpc;
3311 #undef FLD
3312 }
3313
3314 /* movl9-compact: mov.l @($imm8x4, gbr), r0 */
3315
3316 static SEM_PC
3317 SEM_FN_NAME (sh64_compact,movl9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3318 {
3319 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3320   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3321   int UNUSED written = 0;
3322   IADDR UNUSED pc = abuf->addr;
3323   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3324
3325   {
3326     SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)));
3327     SET_H_GRC (((UINT) 0), opval);
3328     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3329   }
3330
3331   return vpc;
3332 #undef FLD
3333 }
3334
3335 /* movl10-compact: mov.l @($imm8x4, pc), $rn */
3336
3337 static SEM_PC
3338 SEM_FN_NAME (sh64_compact,movl10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3339 {
3340 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3341   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3342   int UNUSED written = 0;
3343   IADDR UNUSED pc = abuf->addr;
3344   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3345
3346   {
3347     SI opval = GETMEMSI (current_cpu, pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3348     SET_H_GRC (FLD (f_rn), opval);
3349     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3350   }
3351
3352   return vpc;
3353 #undef FLD
3354 }
3355
3356 /* movl11-compact: mov.l @($imm4x4, $rm), $rn */
3357
3358 static SEM_PC
3359 SEM_FN_NAME (sh64_compact,movl11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3360 {
3361 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3362   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3363   int UNUSED written = 0;
3364   IADDR UNUSED pc = abuf->addr;
3365   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3366
3367   {
3368     SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x4)));
3369     SET_H_GRC (FLD (f_rn), opval);
3370     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3371   }
3372
3373   return vpc;
3374 #undef FLD
3375 }
3376
3377 /* movl12-compact: mov.l @($imm12x4, $rm), $rn */
3378
3379 static SEM_PC
3380 SEM_FN_NAME (sh64_compact,movl12_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3381 {
3382 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3383   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3384   int UNUSED written = 0;
3385   IADDR UNUSED pc = abuf->addr;
3386   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3387
3388   {
3389     SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x4)));
3390     SET_H_GRC (FLD (f_rn), opval);
3391     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3392   }
3393
3394   return vpc;
3395 #undef FLD
3396 }
3397
3398 /* movl13-compact: mov.l $rm, @($imm12x4, $rn) */
3399
3400 static SEM_PC
3401 SEM_FN_NAME (sh64_compact,movl13_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3402 {
3403 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3404   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3405   int UNUSED written = 0;
3406   IADDR UNUSED pc = abuf->addr;
3407   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3408
3409   {
3410     SI opval = GET_H_GRC (FLD (f_rm));
3411     SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x4)), opval);
3412     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3413   }
3414
3415   return vpc;
3416 #undef FLD
3417 }
3418
3419 /* movw1-compact: mov.w $rm, @$rn */
3420
3421 static SEM_PC
3422 SEM_FN_NAME (sh64_compact,movw1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3423 {
3424 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3425   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3426   int UNUSED written = 0;
3427   IADDR UNUSED pc = abuf->addr;
3428   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3429
3430   {
3431     HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3432     SETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3433     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3434   }
3435
3436   return vpc;
3437 #undef FLD
3438 }
3439
3440 /* movw2-compact: mov.w $rm, @-$rn */
3441
3442 static SEM_PC
3443 SEM_FN_NAME (sh64_compact,movw2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3444 {
3445 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3446   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3447   int UNUSED written = 0;
3448   IADDR UNUSED pc = abuf->addr;
3449   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3450
3451 {
3452   DI tmp_addr;
3453   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 2);
3454   {
3455     HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3456     SETMEMHI (current_cpu, pc, tmp_addr, opval);
3457     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3458   }
3459   {
3460     SI opval = tmp_addr;
3461     SET_H_GRC (FLD (f_rn), opval);
3462     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3463   }
3464 }
3465
3466   return vpc;
3467 #undef FLD
3468 }
3469
3470 /* movw3-compact: mov.w $rm, @(r0, $rn) */
3471
3472 static SEM_PC
3473 SEM_FN_NAME (sh64_compact,movw3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3474 {
3475 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3476   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3477   int UNUSED written = 0;
3478   IADDR UNUSED pc = abuf->addr;
3479   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3480
3481   {
3482     HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3483     SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
3484     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3485   }
3486
3487   return vpc;
3488 #undef FLD
3489 }
3490
3491 /* movw4-compact: mov.w r0, @($imm8x2, gbr) */
3492
3493 static SEM_PC
3494 SEM_FN_NAME (sh64_compact,movw4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3495 {
3496 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3497   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3498   int UNUSED written = 0;
3499   IADDR UNUSED pc = abuf->addr;
3500   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3501
3502   {
3503     HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1);
3504     SETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2)), opval);
3505     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3506   }
3507
3508   return vpc;
3509 #undef FLD
3510 }
3511
3512 /* movw5-compact: mov.w r0, @($imm4x2, $rm) */
3513
3514 static SEM_PC
3515 SEM_FN_NAME (sh64_compact,movw5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3516 {
3517 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3518   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3519   int UNUSED written = 0;
3520   IADDR UNUSED pc = abuf->addr;
3521   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3522
3523   {
3524     HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1);
3525     SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2)), opval);
3526     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3527   }
3528
3529   return vpc;
3530 #undef FLD
3531 }
3532
3533 /* movw6-compact: mov.w @$rm, $rn */
3534
3535 static SEM_PC
3536 SEM_FN_NAME (sh64_compact,movw6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3537 {
3538 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3539   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3540   int UNUSED written = 0;
3541   IADDR UNUSED pc = abuf->addr;
3542   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3543
3544   {
3545     SI opval = EXTHISI (GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm))));
3546     SET_H_GRC (FLD (f_rn), opval);
3547     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3548   }
3549
3550   return vpc;
3551 #undef FLD
3552 }
3553
3554 /* movw7-compact: mov.w @${rm}+, $rn */
3555
3556 static SEM_PC
3557 SEM_FN_NAME (sh64_compact,movw7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3558 {
3559 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3560   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3561   int UNUSED written = 0;
3562   IADDR UNUSED pc = abuf->addr;
3563   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3564
3565 {
3566   HI tmp_data;
3567   tmp_data = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3568 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3569   {
3570     SI opval = EXTHISI (tmp_data);
3571     SET_H_GRC (FLD (f_rm), opval);
3572     written |= (1 << 4);
3573     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3574   }
3575 } else {
3576   {
3577     SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
3578     SET_H_GRC (FLD (f_rm), opval);
3579     written |= (1 << 4);
3580     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3581   }
3582 }
3583   {
3584     SI opval = EXTHISI (tmp_data);
3585     SET_H_GRC (FLD (f_rn), opval);
3586     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3587   }
3588 }
3589
3590   abuf->written = written;
3591   return vpc;
3592 #undef FLD
3593 }
3594
3595 /* movw8-compact: mov.w @(r0, $rm), $rn */
3596
3597 static SEM_PC
3598 SEM_FN_NAME (sh64_compact,movw8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3599 {
3600 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3601   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3602   int UNUSED written = 0;
3603   IADDR UNUSED pc = abuf->addr;
3604   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3605
3606   {
3607     SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))));
3608     SET_H_GRC (FLD (f_rn), opval);
3609     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3610   }
3611
3612   return vpc;
3613 #undef FLD
3614 }
3615
3616 /* movw9-compact: mov.w @($imm8x2, gbr), r0 */
3617
3618 static SEM_PC
3619 SEM_FN_NAME (sh64_compact,movw9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3620 {
3621 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3622   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3623   int UNUSED written = 0;
3624   IADDR UNUSED pc = abuf->addr;
3625   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3626
3627   {
3628     SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2))));
3629     SET_H_GRC (((UINT) 0), opval);
3630     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3631   }
3632
3633   return vpc;
3634 #undef FLD
3635 }
3636
3637 /* movw10-compact: mov.w @($imm8x2, pc), $rn */
3638
3639 static SEM_PC
3640 SEM_FN_NAME (sh64_compact,movw10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3641 {
3642 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3643   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3644   int UNUSED written = 0;
3645   IADDR UNUSED pc = abuf->addr;
3646   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3647
3648   {
3649     SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
3650     SET_H_GRC (FLD (f_rn), opval);
3651     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3652   }
3653
3654   return vpc;
3655 #undef FLD
3656 }
3657
3658 /* movw11-compact: mov.w @($imm4x2, $rm), r0 */
3659
3660 static SEM_PC
3661 SEM_FN_NAME (sh64_compact,movw11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3662 {
3663 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3664   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3665   int UNUSED written = 0;
3666   IADDR UNUSED pc = abuf->addr;
3667   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3668
3669   {
3670     SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2))));
3671     SET_H_GRC (((UINT) 0), opval);
3672     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3673   }
3674
3675   return vpc;
3676 #undef FLD
3677 }
3678
3679 /* mova-compact: mova @($imm8x4, pc), r0 */
3680
3681 static SEM_PC
3682 SEM_FN_NAME (sh64_compact,mova_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3683 {
3684 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3685   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3686   int UNUSED written = 0;
3687   IADDR UNUSED pc = abuf->addr;
3688   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3689
3690   {
3691     SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3692     SET_H_GRC (((UINT) 0), opval);
3693     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3694   }
3695
3696   return vpc;
3697 #undef FLD
3698 }
3699
3700 /* movcal-compact: movca.l r0, @$rn */
3701
3702 static SEM_PC
3703 SEM_FN_NAME (sh64_compact,movcal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3704 {
3705 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3706   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3707   int UNUSED written = 0;
3708   IADDR UNUSED pc = abuf->addr;
3709   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3710
3711   {
3712     SI opval = GET_H_GRC (((UINT) 0));
3713     SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3714     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3715   }
3716
3717   return vpc;
3718 #undef FLD
3719 }
3720
3721 /* movcol-compact: movco.l r0, @$rn */
3722
3723 static SEM_PC
3724 SEM_FN_NAME (sh64_compact,movcol_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3725 {
3726 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3727   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3728   int UNUSED written = 0;
3729   IADDR UNUSED pc = abuf->addr;
3730   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3731
3732   {
3733     SI opval = GET_H_GRC (FLD (f_rn));
3734     SET_H_GRC (FLD (f_rn), opval);
3735     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3736   }
3737
3738   return vpc;
3739 #undef FLD
3740 }
3741
3742 /* movt-compact: movt $rn */
3743
3744 static SEM_PC
3745 SEM_FN_NAME (sh64_compact,movt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3746 {
3747 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3748   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3749   int UNUSED written = 0;
3750   IADDR UNUSED pc = abuf->addr;
3751   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3752
3753   {
3754     SI opval = ZEXTBISI (GET_H_TBIT ());
3755     SET_H_GRC (FLD (f_rn), opval);
3756     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3757   }
3758
3759   return vpc;
3760 #undef FLD
3761 }
3762
3763 /* movual-compact: movua.l @$rn, r0 */
3764
3765 static SEM_PC
3766 SEM_FN_NAME (sh64_compact,movual_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3767 {
3768 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3769   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3770   int UNUSED written = 0;
3771   IADDR UNUSED pc = abuf->addr;
3772   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3773
3774   {
3775     SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
3776     SET_H_GRC (((UINT) 0), opval);
3777     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3778   }
3779
3780   return vpc;
3781 #undef FLD
3782 }
3783
3784 /* movual2-compact: movua.l @$rn+, r0 */
3785
3786 static SEM_PC
3787 SEM_FN_NAME (sh64_compact,movual2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3788 {
3789 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3790   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3791   int UNUSED written = 0;
3792   IADDR UNUSED pc = abuf->addr;
3793   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3794
3795 {
3796   {
3797     SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
3798     SET_H_GRC (((UINT) 0), opval);
3799     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3800   }
3801   {
3802     SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
3803     SET_H_GRC (FLD (f_rn), opval);
3804     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3805   }
3806 }
3807
3808   return vpc;
3809 #undef FLD
3810 }
3811
3812 /* mull-compact: mul.l $rm, $rn */
3813
3814 static SEM_PC
3815 SEM_FN_NAME (sh64_compact,mull_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3816 {
3817 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3818   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3819   int UNUSED written = 0;
3820   IADDR UNUSED pc = abuf->addr;
3821   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3822
3823   {
3824     SI opval = MULSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
3825     SET_H_MACL (opval);
3826     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3827   }
3828
3829   return vpc;
3830 #undef FLD
3831 }
3832
3833 /* mulsw-compact: muls.w $rm, $rn */
3834
3835 static SEM_PC
3836 SEM_FN_NAME (sh64_compact,mulsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3837 {
3838 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3839   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3840   int UNUSED written = 0;
3841   IADDR UNUSED pc = abuf->addr;
3842   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3843
3844   {
3845     SI opval = MULSI (EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1)));
3846     SET_H_MACL (opval);
3847     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3848   }
3849
3850   return vpc;
3851 #undef FLD
3852 }
3853
3854 /* muluw-compact: mulu.w $rm, $rn */
3855
3856 static SEM_PC
3857 SEM_FN_NAME (sh64_compact,muluw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3858 {
3859 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3860   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3861   int UNUSED written = 0;
3862   IADDR UNUSED pc = abuf->addr;
3863   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3864
3865   {
3866     SI opval = MULSI (ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1)));
3867     SET_H_MACL (opval);
3868     TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3869   }
3870
3871   return vpc;
3872 #undef FLD
3873 }
3874
3875 /* neg-compact: neg $rm, $rn */
3876
3877 static SEM_PC
3878 SEM_FN_NAME (sh64_compact,neg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3879 {
3880 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3881   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3882   int UNUSED written = 0;
3883   IADDR UNUSED pc = abuf->addr;
3884   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3885
3886   {
3887     SI opval = NEGSI (GET_H_GRC (FLD (f_rm)));
3888     SET_H_GRC (FLD (f_rn), opval);
3889     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3890   }
3891
3892   return vpc;
3893 #undef FLD
3894 }
3895
3896 /* negc-compact: negc $rm, $rn */
3897
3898 static SEM_PC
3899 SEM_FN_NAME (sh64_compact,negc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3900 {
3901 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3902   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3903   int UNUSED written = 0;
3904   IADDR UNUSED pc = abuf->addr;
3905   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3906
3907 {
3908   BI tmp_flag;
3909   tmp_flag = SUBCFSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
3910   {
3911     SI opval = SUBCSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
3912     SET_H_GRC (FLD (f_rn), opval);
3913     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3914   }
3915   {
3916     BI opval = tmp_flag;
3917     SET_H_TBIT (opval);
3918     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
3919   }
3920 }
3921
3922   return vpc;
3923 #undef FLD
3924 }
3925
3926 /* nop-compact: nop */
3927
3928 static SEM_PC
3929 SEM_FN_NAME (sh64_compact,nop_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3930 {
3931 #define FLD(f) abuf->fields.fmt_empty.f
3932   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3933   int UNUSED written = 0;
3934   IADDR UNUSED pc = abuf->addr;
3935   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3936
3937 ((void) 0); /*nop*/
3938
3939   return vpc;
3940 #undef FLD
3941 }
3942
3943 /* not-compact: not $rm64, $rn64 */
3944
3945 static SEM_PC
3946 SEM_FN_NAME (sh64_compact,not_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3947 {
3948 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3949   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3950   int UNUSED written = 0;
3951   IADDR UNUSED pc = abuf->addr;
3952   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3953
3954   {
3955     DI opval = INVDI (GET_H_GR (FLD (f_rm)));
3956     SET_H_GR (FLD (f_rn), opval);
3957     TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3958   }
3959
3960   return vpc;
3961 #undef FLD
3962 }
3963
3964 /* ocbi-compact: ocbi @$rn */
3965
3966 static SEM_PC
3967 SEM_FN_NAME (sh64_compact,ocbi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3968 {
3969 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3970   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3971   int UNUSED written = 0;
3972   IADDR UNUSED pc = abuf->addr;
3973   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3974
3975 {
3976   {
3977     SI opval = GET_H_GRC (FLD (f_rn));
3978     SET_H_GRC (FLD (f_rn), opval);
3979     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3980   }
3981 ((void) 0); /*nop*/
3982 }
3983
3984   return vpc;
3985 #undef FLD
3986 }
3987
3988 /* ocbp-compact: ocbp @$rn */
3989
3990 static SEM_PC
3991 SEM_FN_NAME (sh64_compact,ocbp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3992 {
3993 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3994   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3995   int UNUSED written = 0;
3996   IADDR UNUSED pc = abuf->addr;
3997   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3998
3999 {
4000   {
4001     SI opval = GET_H_GRC (FLD (f_rn));
4002     SET_H_GRC (FLD (f_rn), opval);
4003     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4004   }
4005 ((void) 0); /*nop*/
4006 }
4007
4008   return vpc;
4009 #undef FLD
4010 }
4011
4012 /* ocbwb-compact: ocbwb @$rn */
4013
4014 static SEM_PC
4015 SEM_FN_NAME (sh64_compact,ocbwb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4016 {
4017 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4018   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4019   int UNUSED written = 0;
4020   IADDR UNUSED pc = abuf->addr;
4021   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4022
4023 {
4024   {
4025     SI opval = GET_H_GRC (FLD (f_rn));
4026     SET_H_GRC (FLD (f_rn), opval);
4027     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4028   }
4029 ((void) 0); /*nop*/
4030 }
4031
4032   return vpc;
4033 #undef FLD
4034 }
4035
4036 /* or-compact: or $rm64, $rn64 */
4037
4038 static SEM_PC
4039 SEM_FN_NAME (sh64_compact,or_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4040 {
4041 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4042   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4043   int UNUSED written = 0;
4044   IADDR UNUSED pc = abuf->addr;
4045   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4046
4047   {
4048     DI opval = ORDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn)));
4049     SET_H_GR (FLD (f_rn), opval);
4050     TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4051   }
4052
4053   return vpc;
4054 #undef FLD
4055 }
4056
4057 /* ori-compact: or #$uimm8, r0 */
4058
4059 static SEM_PC
4060 SEM_FN_NAME (sh64_compact,ori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4061 {
4062 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4063   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4064   int UNUSED written = 0;
4065   IADDR UNUSED pc = abuf->addr;
4066   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4067
4068   {
4069     SI opval = ORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4070     SET_H_GRC (((UINT) 0), opval);
4071     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4072   }
4073
4074   return vpc;
4075 #undef FLD
4076 }
4077
4078 /* orb-compact: or.b #$imm8, @(r0, gbr) */
4079
4080 static SEM_PC
4081 SEM_FN_NAME (sh64_compact,orb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4082 {
4083 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4084   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4085   int UNUSED written = 0;
4086   IADDR UNUSED pc = abuf->addr;
4087   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4088
4089 {
4090   DI tmp_addr;
4091   UQI tmp_data;
4092   tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
4093   tmp_data = ORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
4094   {
4095     UQI opval = tmp_data;
4096     SETMEMUQI (current_cpu, pc, tmp_addr, opval);
4097     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4098   }
4099 }
4100
4101   return vpc;
4102 #undef FLD
4103 }
4104
4105 /* pref-compact: pref @$rn */
4106
4107 static SEM_PC
4108 SEM_FN_NAME (sh64_compact,pref_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4109 {
4110 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4111   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4112   int UNUSED written = 0;
4113   IADDR UNUSED pc = abuf->addr;
4114   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4115
4116 sh64_pref (current_cpu, GET_H_GRC (FLD (f_rn)));
4117
4118   return vpc;
4119 #undef FLD
4120 }
4121
4122 /* rotcl-compact: rotcl $rn */
4123
4124 static SEM_PC
4125 SEM_FN_NAME (sh64_compact,rotcl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4126 {
4127 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4128   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4129   int UNUSED written = 0;
4130   IADDR UNUSED pc = abuf->addr;
4131   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4132
4133 {
4134   BI tmp_temp;
4135   tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4136   {
4137     SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), GET_H_TBIT ());
4138     SET_H_GRC (FLD (f_rn), opval);
4139     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4140   }
4141   {
4142     BI opval = ((tmp_temp) ? (1) : (0));
4143     SET_H_TBIT (opval);
4144     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4145   }
4146 }
4147
4148   return vpc;
4149 #undef FLD
4150 }
4151
4152 /* rotcr-compact: rotcr $rn */
4153
4154 static SEM_PC
4155 SEM_FN_NAME (sh64_compact,rotcr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4156 {
4157 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4158   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4159   int UNUSED written = 0;
4160   IADDR UNUSED pc = abuf->addr;
4161   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4162
4163 {
4164   BI tmp_lsbit;
4165   SI tmp_temp;
4166   tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1));
4167   tmp_temp = GET_H_TBIT ();
4168   {
4169     SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4170     SET_H_GRC (FLD (f_rn), opval);
4171     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4172   }
4173   {
4174     BI opval = ((tmp_lsbit) ? (1) : (0));
4175     SET_H_TBIT (opval);
4176     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4177   }
4178 }
4179
4180   return vpc;
4181 #undef FLD
4182 }
4183
4184 /* rotl-compact: rotl $rn */
4185
4186 static SEM_PC
4187 SEM_FN_NAME (sh64_compact,rotl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4188 {
4189 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4190   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4191   int UNUSED written = 0;
4192   IADDR UNUSED pc = abuf->addr;
4193   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4194
4195 {
4196   BI tmp_temp;
4197   tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4198   {
4199     SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), tmp_temp);
4200     SET_H_GRC (FLD (f_rn), opval);
4201     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4202   }
4203   {
4204     BI opval = ((tmp_temp) ? (1) : (0));
4205     SET_H_TBIT (opval);
4206     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4207   }
4208 }
4209
4210   return vpc;
4211 #undef FLD
4212 }
4213
4214 /* rotr-compact: rotr $rn */
4215
4216 static SEM_PC
4217 SEM_FN_NAME (sh64_compact,rotr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4218 {
4219 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4220   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4221   int UNUSED written = 0;
4222   IADDR UNUSED pc = abuf->addr;
4223   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4224
4225 {
4226   BI tmp_lsbit;
4227   SI tmp_temp;
4228   tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1));
4229   tmp_temp = tmp_lsbit;
4230   {
4231     SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4232     SET_H_GRC (FLD (f_rn), opval);
4233     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4234   }
4235   {
4236     BI opval = ((tmp_lsbit) ? (1) : (0));
4237     SET_H_TBIT (opval);
4238     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4239   }
4240 }
4241
4242   return vpc;
4243 #undef FLD
4244 }
4245
4246 /* rts-compact: rts */
4247
4248 static SEM_PC
4249 SEM_FN_NAME (sh64_compact,rts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4250 {
4251 #define FLD(f) abuf->fields.fmt_empty.f
4252   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4253   int UNUSED written = 0;
4254   IADDR UNUSED pc = abuf->addr;
4255   SEM_BRANCH_INIT
4256   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4257
4258 {
4259   {
4260     UDI opval = ADDDI (pc, 2);
4261     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
4262     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
4263   }
4264 ((void) 0); /*nop*/
4265 {
4266   {
4267     UDI opval = GET_H_PR ();
4268     SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
4269     TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
4270   }
4271 }
4272 ((void) 0); /*nop*/
4273 }
4274
4275   SEM_BRANCH_FINI (vpc);
4276   return vpc;
4277 #undef FLD
4278 }
4279
4280 /* sets-compact: sets */
4281
4282 static SEM_PC
4283 SEM_FN_NAME (sh64_compact,sets_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4284 {
4285 #define FLD(f) abuf->fields.fmt_empty.f
4286   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4287   int UNUSED written = 0;
4288   IADDR UNUSED pc = abuf->addr;
4289   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4290
4291   {
4292     BI opval = 1;
4293     SET_H_SBIT (opval);
4294     TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval);
4295   }
4296
4297   return vpc;
4298 #undef FLD
4299 }
4300
4301 /* sett-compact: sett */
4302
4303 static SEM_PC
4304 SEM_FN_NAME (sh64_compact,sett_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4305 {
4306 #define FLD(f) abuf->fields.fmt_empty.f
4307   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4308   int UNUSED written = 0;
4309   IADDR UNUSED pc = abuf->addr;
4310   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4311
4312   {
4313     BI opval = 1;
4314     SET_H_TBIT (opval);
4315     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4316   }
4317
4318   return vpc;
4319 #undef FLD
4320 }
4321
4322 /* shad-compact: shad $rm, $rn */
4323
4324 static SEM_PC
4325 SEM_FN_NAME (sh64_compact,shad_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4326 {
4327 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4328   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4329   int UNUSED written = 0;
4330   IADDR UNUSED pc = abuf->addr;
4331   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4332
4333 {
4334   SI tmp_shamt;
4335   tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31);
4336 if (GESI (GET_H_GRC (FLD (f_rm)), 0)) {
4337   {
4338     SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt);
4339     SET_H_GRC (FLD (f_rn), opval);
4340     written |= (1 << 2);
4341     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4342   }
4343 } else {
4344 if (NESI (tmp_shamt, 0)) {
4345   {
4346     SI opval = SRASI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt));
4347     SET_H_GRC (FLD (f_rn), opval);
4348     written |= (1 << 2);
4349     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4350   }
4351 } else {
4352 if (LTSI (GET_H_GRC (FLD (f_rn)), 0)) {
4353   {
4354     SI opval = NEGSI (1);
4355     SET_H_GRC (FLD (f_rn), opval);
4356     written |= (1 << 2);
4357     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4358   }
4359 } else {
4360   {
4361     SI opval = 0;
4362     SET_H_GRC (FLD (f_rn), opval);
4363     written |= (1 << 2);
4364     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4365   }
4366 }
4367 }
4368 }
4369 }
4370
4371   abuf->written = written;
4372   return vpc;
4373 #undef FLD
4374 }
4375
4376 /* shal-compact: shal $rn */
4377
4378 static SEM_PC
4379 SEM_FN_NAME (sh64_compact,shal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4380 {
4381 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4382   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4383   int UNUSED written = 0;
4384   IADDR UNUSED pc = abuf->addr;
4385   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4386
4387 {
4388   BI tmp_t;
4389   tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4390   {
4391     SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1);
4392     SET_H_GRC (FLD (f_rn), opval);
4393     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4394   }
4395   {
4396     BI opval = ((tmp_t) ? (1) : (0));
4397     SET_H_TBIT (opval);
4398     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4399   }
4400 }
4401
4402   return vpc;
4403 #undef FLD
4404 }
4405
4406 /* shar-compact: shar $rn */
4407
4408 static SEM_PC
4409 SEM_FN_NAME (sh64_compact,shar_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4410 {
4411 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4412   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4413   int UNUSED written = 0;
4414   IADDR UNUSED pc = abuf->addr;
4415   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4416
4417 {
4418   BI tmp_t;
4419   tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1);
4420   {
4421     SI opval = SRASI (GET_H_GRC (FLD (f_rn)), 1);
4422     SET_H_GRC (FLD (f_rn), opval);
4423     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4424   }
4425   {
4426     BI opval = ((tmp_t) ? (1) : (0));
4427     SET_H_TBIT (opval);
4428     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4429   }
4430 }
4431
4432   return vpc;
4433 #undef FLD
4434 }
4435
4436 /* shld-compact: shld $rm, $rn */
4437
4438 static SEM_PC
4439 SEM_FN_NAME (sh64_compact,shld_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4440 {
4441 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4442   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4443   int UNUSED written = 0;
4444   IADDR UNUSED pc = abuf->addr;
4445   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4446
4447 {
4448   SI tmp_shamt;
4449   tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31);
4450 if (GESI (GET_H_GRC (FLD (f_rm)), 0)) {
4451   {
4452     SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt);
4453     SET_H_GRC (FLD (f_rn), opval);
4454     written |= (1 << 2);
4455     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4456   }
4457 } else {
4458 if (NESI (tmp_shamt, 0)) {
4459   {
4460     SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt));
4461     SET_H_GRC (FLD (f_rn), opval);
4462     written |= (1 << 2);
4463     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4464   }
4465 } else {
4466   {
4467     SI opval = 0;
4468     SET_H_GRC (FLD (f_rn), opval);
4469     written |= (1 << 2);
4470     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4471   }
4472 }
4473 }
4474 }
4475
4476   abuf->written = written;
4477   return vpc;
4478 #undef FLD
4479 }
4480
4481 /* shll-compact: shll $rn */
4482
4483 static SEM_PC
4484 SEM_FN_NAME (sh64_compact,shll_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4485 {
4486 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4487   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4488   int UNUSED written = 0;
4489   IADDR UNUSED pc = abuf->addr;
4490   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4491
4492 {
4493   BI tmp_t;
4494   tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4495   {
4496     SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1);
4497     SET_H_GRC (FLD (f_rn), opval);
4498     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4499   }
4500   {
4501     BI opval = ((tmp_t) ? (1) : (0));
4502     SET_H_TBIT (opval);
4503     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4504   }
4505 }
4506
4507   return vpc;
4508 #undef FLD
4509 }
4510
4511 /* shll2-compact: shll2 $rn */
4512
4513 static SEM_PC
4514 SEM_FN_NAME (sh64_compact,shll2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4515 {
4516 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4517   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4518   int UNUSED written = 0;
4519   IADDR UNUSED pc = abuf->addr;
4520   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4521
4522   {
4523     SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 2);
4524     SET_H_GRC (FLD (f_rn), opval);
4525     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4526   }
4527
4528   return vpc;
4529 #undef FLD
4530 }
4531
4532 /* shll8-compact: shll8 $rn */
4533
4534 static SEM_PC
4535 SEM_FN_NAME (sh64_compact,shll8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4536 {
4537 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4538   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4539   int UNUSED written = 0;
4540   IADDR UNUSED pc = abuf->addr;
4541   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4542
4543   {
4544     SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 8);
4545     SET_H_GRC (FLD (f_rn), opval);
4546     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4547   }
4548
4549   return vpc;
4550 #undef FLD
4551 }
4552
4553 /* shll16-compact: shll16 $rn */
4554
4555 static SEM_PC
4556 SEM_FN_NAME (sh64_compact,shll16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4557 {
4558 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4559   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4560   int UNUSED written = 0;
4561   IADDR UNUSED pc = abuf->addr;
4562   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4563
4564   {
4565     SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 16);
4566     SET_H_GRC (FLD (f_rn), opval);
4567     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4568   }
4569
4570   return vpc;
4571 #undef FLD
4572 }
4573
4574 /* shlr-compact: shlr $rn */
4575
4576 static SEM_PC
4577 SEM_FN_NAME (sh64_compact,shlr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4578 {
4579 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4580   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4581   int UNUSED written = 0;
4582   IADDR UNUSED pc = abuf->addr;
4583   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4584
4585 {
4586   BI tmp_t;
4587   tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1);
4588   {
4589     SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 1);
4590     SET_H_GRC (FLD (f_rn), opval);
4591     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4592   }
4593   {
4594     BI opval = ((tmp_t) ? (1) : (0));
4595     SET_H_TBIT (opval);
4596     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4597   }
4598 }
4599
4600   return vpc;
4601 #undef FLD
4602 }
4603
4604 /* shlr2-compact: shlr2 $rn */
4605
4606 static SEM_PC
4607 SEM_FN_NAME (sh64_compact,shlr2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4608 {
4609 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4610   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4611   int UNUSED written = 0;
4612   IADDR UNUSED pc = abuf->addr;
4613   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4614
4615   {
4616     SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 2);
4617     SET_H_GRC (FLD (f_rn), opval);
4618     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4619   }
4620
4621   return vpc;
4622 #undef FLD
4623 }
4624
4625 /* shlr8-compact: shlr8 $rn */
4626
4627 static SEM_PC
4628 SEM_FN_NAME (sh64_compact,shlr8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4629 {
4630 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4631   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4632   int UNUSED written = 0;
4633   IADDR UNUSED pc = abuf->addr;
4634   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4635
4636   {
4637     SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 8);
4638     SET_H_GRC (FLD (f_rn), opval);
4639     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4640   }
4641
4642   return vpc;
4643 #undef FLD
4644 }
4645
4646 /* shlr16-compact: shlr16 $rn */
4647
4648 static SEM_PC
4649 SEM_FN_NAME (sh64_compact,shlr16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4650 {
4651 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4652   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4653   int UNUSED written = 0;
4654   IADDR UNUSED pc = abuf->addr;
4655   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4656
4657   {
4658     SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 16);
4659     SET_H_GRC (FLD (f_rn), opval);
4660     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4661   }
4662
4663   return vpc;
4664 #undef FLD
4665 }
4666
4667 /* stc-gbr-compact: stc gbr, $rn */
4668
4669 static SEM_PC
4670 SEM_FN_NAME (sh64_compact,stc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4671 {
4672 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4673   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4674   int UNUSED written = 0;
4675   IADDR UNUSED pc = abuf->addr;
4676   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4677
4678   {
4679     SI opval = GET_H_GBR ();
4680     SET_H_GRC (FLD (f_rn), opval);
4681     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4682   }
4683
4684   return vpc;
4685 #undef FLD
4686 }
4687
4688 /* stc-vbr-compact: stc vbr, $rn */
4689
4690 static SEM_PC
4691 SEM_FN_NAME (sh64_compact,stc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4692 {
4693 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4694   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4695   int UNUSED written = 0;
4696   IADDR UNUSED pc = abuf->addr;
4697   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4698
4699   {
4700     SI opval = GET_H_VBR ();
4701     SET_H_GRC (FLD (f_rn), opval);
4702     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4703   }
4704
4705   return vpc;
4706 #undef FLD
4707 }
4708
4709 /* stcl-gbr-compact: stc.l gbr, @-$rn */
4710
4711 static SEM_PC
4712 SEM_FN_NAME (sh64_compact,stcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4713 {
4714 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4715   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4716   int UNUSED written = 0;
4717   IADDR UNUSED pc = abuf->addr;
4718   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4719
4720 {
4721   DI tmp_addr;
4722   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4723   {
4724     SI opval = GET_H_GBR ();
4725     SETMEMSI (current_cpu, pc, tmp_addr, opval);
4726     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4727   }
4728   {
4729     SI opval = tmp_addr;
4730     SET_H_GRC (FLD (f_rn), opval);
4731     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4732   }
4733 }
4734
4735   return vpc;
4736 #undef FLD
4737 }
4738
4739 /* stcl-vbr-compact: stc.l vbr, @-$rn */
4740
4741 static SEM_PC
4742 SEM_FN_NAME (sh64_compact,stcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4743 {
4744 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4745   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4746   int UNUSED written = 0;
4747   IADDR UNUSED pc = abuf->addr;
4748   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4749
4750 {
4751   DI tmp_addr;
4752   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4753   {
4754     SI opval = GET_H_VBR ();
4755     SETMEMSI (current_cpu, pc, tmp_addr, opval);
4756     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4757   }
4758   {
4759     SI opval = tmp_addr;
4760     SET_H_GRC (FLD (f_rn), opval);
4761     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4762   }
4763 }
4764
4765   return vpc;
4766 #undef FLD
4767 }
4768
4769 /* sts-fpscr-compact: sts fpscr, $rn */
4770
4771 static SEM_PC
4772 SEM_FN_NAME (sh64_compact,sts_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4773 {
4774 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4775   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4776   int UNUSED written = 0;
4777   IADDR UNUSED pc = abuf->addr;
4778   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4779
4780   {
4781     SI opval = CPU (h_fpscr);
4782     SET_H_GRC (FLD (f_rn), opval);
4783     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4784   }
4785
4786   return vpc;
4787 #undef FLD
4788 }
4789
4790 /* stsl-fpscr-compact: sts.l fpscr, @-$rn */
4791
4792 static SEM_PC
4793 SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4794 {
4795 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4796   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4797   int UNUSED written = 0;
4798   IADDR UNUSED pc = abuf->addr;
4799   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4800
4801 {
4802   DI tmp_addr;
4803   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4804   {
4805     SI opval = CPU (h_fpscr);
4806     SETMEMSI (current_cpu, pc, tmp_addr, opval);
4807     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4808   }
4809   {
4810     SI opval = tmp_addr;
4811     SET_H_GRC (FLD (f_rn), opval);
4812     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4813   }
4814 }
4815
4816   return vpc;
4817 #undef FLD
4818 }
4819
4820 /* sts-fpul-compact: sts fpul, $rn */
4821
4822 static SEM_PC
4823 SEM_FN_NAME (sh64_compact,sts_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4824 {
4825 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4826   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4827   int UNUSED written = 0;
4828   IADDR UNUSED pc = abuf->addr;
4829   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4830
4831   {
4832     SI opval = SUBWORDSFSI (CPU (h_fr[((UINT) 32)]));
4833     SET_H_GRC (FLD (f_rn), opval);
4834     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4835   }
4836
4837   return vpc;
4838 #undef FLD
4839 }
4840
4841 /* stsl-fpul-compact: sts.l fpul, @-$rn */
4842
4843 static SEM_PC
4844 SEM_FN_NAME (sh64_compact,stsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4845 {
4846 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4847   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4848   int UNUSED written = 0;
4849   IADDR UNUSED pc = abuf->addr;
4850   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4851
4852 {
4853   DI tmp_addr;
4854   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4855   {
4856     SF opval = CPU (h_fr[((UINT) 32)]);
4857     SETMEMSF (current_cpu, pc, tmp_addr, opval);
4858     TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
4859   }
4860   {
4861     SI opval = tmp_addr;
4862     SET_H_GRC (FLD (f_rn), opval);
4863     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4864   }
4865 }
4866
4867   return vpc;
4868 #undef FLD
4869 }
4870
4871 /* sts-mach-compact: sts mach, $rn */
4872
4873 static SEM_PC
4874 SEM_FN_NAME (sh64_compact,sts_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4875 {
4876 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4877   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4878   int UNUSED written = 0;
4879   IADDR UNUSED pc = abuf->addr;
4880   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4881
4882   {
4883     SI opval = GET_H_MACH ();
4884     SET_H_GRC (FLD (f_rn), opval);
4885     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4886   }
4887
4888   return vpc;
4889 #undef FLD
4890 }
4891
4892 /* stsl-mach-compact: sts.l mach, @-$rn */
4893
4894 static SEM_PC
4895 SEM_FN_NAME (sh64_compact,stsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4896 {
4897 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4898   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4899   int UNUSED written = 0;
4900   IADDR UNUSED pc = abuf->addr;
4901   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4902
4903 {
4904   DI tmp_addr;
4905   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4906   {
4907     SI opval = GET_H_MACH ();
4908     SETMEMSI (current_cpu, pc, tmp_addr, opval);
4909     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4910   }
4911   {
4912     SI opval = tmp_addr;
4913     SET_H_GRC (FLD (f_rn), opval);
4914     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4915   }
4916 }
4917
4918   return vpc;
4919 #undef FLD
4920 }
4921
4922 /* sts-macl-compact: sts macl, $rn */
4923
4924 static SEM_PC
4925 SEM_FN_NAME (sh64_compact,sts_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4926 {
4927 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4928   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4929   int UNUSED written = 0;
4930   IADDR UNUSED pc = abuf->addr;
4931   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4932
4933   {
4934     SI opval = GET_H_MACL ();
4935     SET_H_GRC (FLD (f_rn), opval);
4936     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4937   }
4938
4939   return vpc;
4940 #undef FLD
4941 }
4942
4943 /* stsl-macl-compact: sts.l macl, @-$rn */
4944
4945 static SEM_PC
4946 SEM_FN_NAME (sh64_compact,stsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4947 {
4948 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4949   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4950   int UNUSED written = 0;
4951   IADDR UNUSED pc = abuf->addr;
4952   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4953
4954 {
4955   DI tmp_addr;
4956   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4957   {
4958     SI opval = GET_H_MACL ();
4959     SETMEMSI (current_cpu, pc, tmp_addr, opval);
4960     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4961   }
4962   {
4963     SI opval = tmp_addr;
4964     SET_H_GRC (FLD (f_rn), opval);
4965     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4966   }
4967 }
4968
4969   return vpc;
4970 #undef FLD
4971 }
4972
4973 /* sts-pr-compact: sts pr, $rn */
4974
4975 static SEM_PC
4976 SEM_FN_NAME (sh64_compact,sts_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4977 {
4978 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4979   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4980   int UNUSED written = 0;
4981   IADDR UNUSED pc = abuf->addr;
4982   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4983
4984   {
4985     SI opval = GET_H_PR ();
4986     SET_H_GRC (FLD (f_rn), opval);
4987     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4988   }
4989
4990   return vpc;
4991 #undef FLD
4992 }
4993
4994 /* stsl-pr-compact: sts.l pr, @-$rn */
4995
4996 static SEM_PC
4997 SEM_FN_NAME (sh64_compact,stsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4998 {
4999 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5000   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5001   int UNUSED written = 0;
5002   IADDR UNUSED pc = abuf->addr;
5003   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5004
5005 {
5006   DI tmp_addr;
5007   tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
5008   {
5009     SI opval = GET_H_PR ();
5010     SETMEMSI (current_cpu, pc, tmp_addr, opval);
5011     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5012   }
5013   {
5014     SI opval = tmp_addr;
5015     SET_H_GRC (FLD (f_rn), opval);
5016     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5017   }
5018 }
5019
5020   return vpc;
5021 #undef FLD
5022 }
5023
5024 /* sub-compact: sub $rm, $rn */
5025
5026 static SEM_PC
5027 SEM_FN_NAME (sh64_compact,sub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5028 {
5029 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5030   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5031   int UNUSED written = 0;
5032   IADDR UNUSED pc = abuf->addr;
5033   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5034
5035   {
5036     SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
5037     SET_H_GRC (FLD (f_rn), opval);
5038     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5039   }
5040
5041   return vpc;
5042 #undef FLD
5043 }
5044
5045 /* subc-compact: subc $rm, $rn */
5046
5047 static SEM_PC
5048 SEM_FN_NAME (sh64_compact,subc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5049 {
5050 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5051   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5052   int UNUSED written = 0;
5053   IADDR UNUSED pc = abuf->addr;
5054   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5055
5056 {
5057   BI tmp_flag;
5058   tmp_flag = SUBCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
5059   {
5060     SI opval = SUBCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
5061     SET_H_GRC (FLD (f_rn), opval);
5062     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5063   }
5064   {
5065     BI opval = tmp_flag;
5066     SET_H_TBIT (opval);
5067     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5068   }
5069 }
5070
5071   return vpc;
5072 #undef FLD
5073 }
5074
5075 /* subv-compact: subv $rm, $rn */
5076
5077 static SEM_PC
5078 SEM_FN_NAME (sh64_compact,subv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5079 {
5080 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5081   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5082   int UNUSED written = 0;
5083   IADDR UNUSED pc = abuf->addr;
5084   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5085
5086 {
5087   BI tmp_t;
5088   tmp_t = SUBOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0);
5089   {
5090     SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
5091     SET_H_GRC (FLD (f_rn), opval);
5092     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5093   }
5094   {
5095     BI opval = ((tmp_t) ? (1) : (0));
5096     SET_H_TBIT (opval);
5097     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5098   }
5099 }
5100
5101   return vpc;
5102 #undef FLD
5103 }
5104
5105 /* swapb-compact: swap.b $rm, $rn */
5106
5107 static SEM_PC
5108 SEM_FN_NAME (sh64_compact,swapb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5109 {
5110 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5111   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5112   int UNUSED written = 0;
5113   IADDR UNUSED pc = abuf->addr;
5114   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5115
5116 {
5117   UHI tmp_top_half;
5118   UQI tmp_byte1;
5119   UQI tmp_byte0;
5120   tmp_top_half = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 0);
5121   tmp_byte1 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 2);
5122   tmp_byte0 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3);
5123   {
5124     SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
5125     SET_H_GRC (FLD (f_rn), opval);
5126     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5127   }
5128 }
5129
5130   return vpc;
5131 #undef FLD
5132 }
5133
5134 /* swapw-compact: swap.w $rm, $rn */
5135
5136 static SEM_PC
5137 SEM_FN_NAME (sh64_compact,swapw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5138 {
5139 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5140   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5141   int UNUSED written = 0;
5142   IADDR UNUSED pc = abuf->addr;
5143   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5144
5145   {
5146     SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rm)), 16), SLLSI (GET_H_GRC (FLD (f_rm)), 16));
5147     SET_H_GRC (FLD (f_rn), opval);
5148     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5149   }
5150
5151   return vpc;
5152 #undef FLD
5153 }
5154
5155 /* tasb-compact: tas.b @$rn */
5156
5157 static SEM_PC
5158 SEM_FN_NAME (sh64_compact,tasb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5159 {
5160 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5161   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5162   int UNUSED written = 0;
5163   IADDR UNUSED pc = abuf->addr;
5164   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5165
5166 {
5167   UQI tmp_byte;
5168   tmp_byte = GETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
5169   {
5170     BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
5171     SET_H_TBIT (opval);
5172     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5173   }
5174   tmp_byte = ORQI (tmp_byte, 128);
5175   {
5176     UQI opval = tmp_byte;
5177     SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
5178     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5179   }
5180 }
5181
5182   return vpc;
5183 #undef FLD
5184 }
5185
5186 /* trapa-compact: trapa #$uimm8 */
5187
5188 static SEM_PC
5189 SEM_FN_NAME (sh64_compact,trapa_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5190 {
5191 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5192   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5193   int UNUSED written = 0;
5194   IADDR UNUSED pc = abuf->addr;
5195   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5196
5197 sh64_compact_trapa (current_cpu, FLD (f_imm8), pc);
5198
5199   return vpc;
5200 #undef FLD
5201 }
5202
5203 /* tst-compact: tst $rm, $rn */
5204
5205 static SEM_PC
5206 SEM_FN_NAME (sh64_compact,tst_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5207 {
5208 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5209   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5210   int UNUSED written = 0;
5211   IADDR UNUSED pc = abuf->addr;
5212   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5213
5214   {
5215     BI opval = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))), 0)) ? (1) : (0));
5216     SET_H_TBIT (opval);
5217     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5218   }
5219
5220   return vpc;
5221 #undef FLD
5222 }
5223
5224 /* tsti-compact: tst #$uimm8, r0 */
5225
5226 static SEM_PC
5227 SEM_FN_NAME (sh64_compact,tsti_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5228 {
5229 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5230   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5231   int UNUSED written = 0;
5232   IADDR UNUSED pc = abuf->addr;
5233   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5234
5235   {
5236     BI opval = ((EQSI (ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5237     SET_H_TBIT (opval);
5238     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5239   }
5240
5241   return vpc;
5242 #undef FLD
5243 }
5244
5245 /* tstb-compact: tst.b #$imm8, @(r0, gbr) */
5246
5247 static SEM_PC
5248 SEM_FN_NAME (sh64_compact,tstb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5249 {
5250 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5251   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5252   int UNUSED written = 0;
5253   IADDR UNUSED pc = abuf->addr;
5254   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5255
5256 {
5257   DI tmp_addr;
5258   tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
5259   {
5260     BI opval = ((EQQI (ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5261     SET_H_TBIT (opval);
5262     TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5263   }
5264 }
5265
5266   return vpc;
5267 #undef FLD
5268 }
5269
5270 /* xor-compact: xor $rm64, $rn64 */
5271
5272 static SEM_PC
5273 SEM_FN_NAME (sh64_compact,xor_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5274 {
5275 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5276   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5277   int UNUSED written = 0;
5278   IADDR UNUSED pc = abuf->addr;
5279   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5280
5281   {
5282     DI opval = XORDI (GET_H_GR (FLD (f_rn)), GET_H_GR (FLD (f_rm)));
5283     SET_H_GR (FLD (f_rn), opval);
5284     TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5285   }
5286
5287   return vpc;
5288 #undef FLD
5289 }
5290
5291 /* xori-compact: xor #$uimm8, r0 */
5292
5293 static SEM_PC
5294 SEM_FN_NAME (sh64_compact,xori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5295 {
5296 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5297   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5298   int UNUSED written = 0;
5299   IADDR UNUSED pc = abuf->addr;
5300   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5301
5302   {
5303     SI opval = XORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5304     SET_H_GRC (((UINT) 0), opval);
5305     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5306   }
5307
5308   return vpc;
5309 #undef FLD
5310 }
5311
5312 /* xorb-compact: xor.b #$imm8, @(r0, gbr) */
5313
5314 static SEM_PC
5315 SEM_FN_NAME (sh64_compact,xorb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5316 {
5317 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5318   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5319   int UNUSED written = 0;
5320   IADDR UNUSED pc = abuf->addr;
5321   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5322
5323 {
5324   DI tmp_addr;
5325   UQI tmp_data;
5326   tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
5327   tmp_data = XORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
5328   {
5329     UQI opval = tmp_data;
5330     SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5331     TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5332   }
5333 }
5334
5335   return vpc;
5336 #undef FLD
5337 }
5338
5339 /* xtrct-compact: xtrct $rm, $rn */
5340
5341 static SEM_PC
5342 SEM_FN_NAME (sh64_compact,xtrct_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5343 {
5344 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5345   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5346   int UNUSED written = 0;
5347   IADDR UNUSED pc = abuf->addr;
5348   SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5349
5350   {
5351     SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rm)), 16), SRLSI (GET_H_GRC (FLD (f_rn)), 16));
5352     SET_H_GRC (FLD (f_rn), opval);
5353     TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5354   }
5355
5356   return vpc;
5357 #undef FLD
5358 }
5359
5360 /* Table of all semantic fns.  */
5361
5362 static const struct sem_fn_desc sem_fns[] = {
5363   { SH64_COMPACT_INSN_X_INVALID, SEM_FN_NAME (sh64_compact,x_invalid) },
5364   { SH64_COMPACT_INSN_X_AFTER, SEM_FN_NAME (sh64_compact,x_after) },
5365   { SH64_COMPACT_INSN_X_BEFORE, SEM_FN_NAME (sh64_compact,x_before) },
5366   { SH64_COMPACT_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_compact,x_cti_chain) },
5367   { SH64_COMPACT_INSN_X_CHAIN, SEM_FN_NAME (sh64_compact,x_chain) },
5368   { SH64_COMPACT_INSN_X_BEGIN, SEM_FN_NAME (sh64_compact,x_begin) },
5369   { SH64_COMPACT_INSN_ADD_COMPACT, SEM_FN_NAME (sh64_compact,add_compact) },
5370   { SH64_COMPACT_INSN_ADDI_COMPACT, SEM_FN_NAME (sh64_compact,addi_compact) },
5371   { SH64_COMPACT_INSN_ADDC_COMPACT, SEM_FN_NAME (sh64_compact,addc_compact) },
5372   { SH64_COMPACT_INSN_ADDV_COMPACT, SEM_FN_NAME (sh64_compact,addv_compact) },
5373   { SH64_COMPACT_INSN_AND_COMPACT, SEM_FN_NAME (sh64_compact,and_compact) },
5374   { SH64_COMPACT_INSN_ANDI_COMPACT, SEM_FN_NAME (sh64_compact,andi_compact) },
5375   { SH64_COMPACT_INSN_ANDB_COMPACT, SEM_FN_NAME (sh64_compact,andb_compact) },
5376   { SH64_COMPACT_INSN_BF_COMPACT, SEM_FN_NAME (sh64_compact,bf_compact) },
5377   { SH64_COMPACT_INSN_BFS_COMPACT, SEM_FN_NAME (sh64_compact,bfs_compact) },
5378   { SH64_COMPACT_INSN_BRA_COMPACT, SEM_FN_NAME (sh64_compact,bra_compact) },
5379   { SH64_COMPACT_INSN_BRAF_COMPACT, SEM_FN_NAME (sh64_compact,braf_compact) },
5380   { SH64_COMPACT_INSN_BRK_COMPACT, SEM_FN_NAME (sh64_compact,brk_compact) },
5381   { SH64_COMPACT_INSN_BSR_COMPACT, SEM_FN_NAME (sh64_compact,bsr_compact) },
5382   { SH64_COMPACT_INSN_BSRF_COMPACT, SEM_FN_NAME (sh64_compact,bsrf_compact) },
5383   { SH64_COMPACT_INSN_BT_COMPACT, SEM_FN_NAME (sh64_compact,bt_compact) },
5384   { SH64_COMPACT_INSN_BTS_COMPACT, SEM_FN_NAME (sh64_compact,bts_compact) },
5385   { SH64_COMPACT_INSN_CLRMAC_COMPACT, SEM_FN_NAME (sh64_compact,clrmac_compact) },
5386   { SH64_COMPACT_INSN_CLRS_COMPACT, SEM_FN_NAME (sh64_compact,clrs_compact) },
5387   { SH64_COMPACT_INSN_CLRT_COMPACT, SEM_FN_NAME (sh64_compact,clrt_compact) },
5388   { SH64_COMPACT_INSN_CMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,cmpeq_compact) },
5389   { SH64_COMPACT_INSN_CMPEQI_COMPACT, SEM_FN_NAME (sh64_compact,cmpeqi_compact) },
5390   { SH64_COMPACT_INSN_CMPGE_COMPACT, SEM_FN_NAME (sh64_compact,cmpge_compact) },
5391   { SH64_COMPACT_INSN_CMPGT_COMPACT, SEM_FN_NAME (sh64_compact,cmpgt_compact) },
5392   { SH64_COMPACT_INSN_CMPHI_COMPACT, SEM_FN_NAME (sh64_compact,cmphi_compact) },
5393   { SH64_COMPACT_INSN_CMPHS_COMPACT, SEM_FN_NAME (sh64_compact,cmphs_compact) },
5394   { SH64_COMPACT_INSN_CMPPL_COMPACT, SEM_FN_NAME (sh64_compact,cmppl_compact) },
5395   { SH64_COMPACT_INSN_CMPPZ_COMPACT, SEM_FN_NAME (sh64_compact,cmppz_compact) },
5396   { SH64_COMPACT_INSN_CMPSTR_COMPACT, SEM_FN_NAME (sh64_compact,cmpstr_compact) },
5397   { SH64_COMPACT_INSN_DIV0S_COMPACT, SEM_FN_NAME (sh64_compact,div0s_compact) },
5398   { SH64_COMPACT_INSN_DIV0U_COMPACT, SEM_FN_NAME (sh64_compact,div0u_compact) },
5399   { SH64_COMPACT_INSN_DIV1_COMPACT, SEM_FN_NAME (sh64_compact,div1_compact) },
5400   { SH64_COMPACT_INSN_DIVU_COMPACT, SEM_FN_NAME (sh64_compact,divu_compact) },
5401   { SH64_COMPACT_INSN_MULR_COMPACT, SEM_FN_NAME (sh64_compact,mulr_compact) },
5402   { SH64_COMPACT_INSN_DMULSL_COMPACT, SEM_FN_NAME (sh64_compact,dmulsl_compact) },
5403   { SH64_COMPACT_INSN_DMULUL_COMPACT, SEM_FN_NAME (sh64_compact,dmulul_compact) },
5404   { SH64_COMPACT_INSN_DT_COMPACT, SEM_FN_NAME (sh64_compact,dt_compact) },
5405   { SH64_COMPACT_INSN_EXTSB_COMPACT, SEM_FN_NAME (sh64_compact,extsb_compact) },
5406   { SH64_COMPACT_INSN_EXTSW_COMPACT, SEM_FN_NAME (sh64_compact,extsw_compact) },
5407   { SH64_COMPACT_INSN_EXTUB_COMPACT, SEM_FN_NAME (sh64_compact,extub_compact) },
5408   { SH64_COMPACT_INSN_EXTUW_COMPACT, SEM_FN_NAME (sh64_compact,extuw_compact) },
5409   { SH64_COMPACT_INSN_FABS_COMPACT, SEM_FN_NAME (sh64_compact,fabs_compact) },
5410   { SH64_COMPACT_INSN_FADD_COMPACT, SEM_FN_NAME (sh64_compact,fadd_compact) },
5411   { SH64_COMPACT_INSN_FCMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,fcmpeq_compact) },
5412   { SH64_COMPACT_INSN_FCMPGT_COMPACT, SEM_FN_NAME (sh64_compact,fcmpgt_compact) },
5413   { SH64_COMPACT_INSN_FCNVDS_COMPACT, SEM_FN_NAME (sh64_compact,fcnvds_compact) },
5414   { SH64_COMPACT_INSN_FCNVSD_COMPACT, SEM_FN_NAME (sh64_compact,fcnvsd_compact) },
5415   { SH64_COMPACT_INSN_FDIV_COMPACT, SEM_FN_NAME (sh64_compact,fdiv_compact) },
5416   { SH64_COMPACT_INSN_FIPR_COMPACT, SEM_FN_NAME (sh64_compact,fipr_compact) },
5417   { SH64_COMPACT_INSN_FLDS_COMPACT, SEM_FN_NAME (sh64_compact,flds_compact) },
5418   { SH64_COMPACT_INSN_FLDI0_COMPACT, SEM_FN_NAME (sh64_compact,fldi0_compact) },
5419   { SH64_COMPACT_INSN_FLDI1_COMPACT, SEM_FN_NAME (sh64_compact,fldi1_compact) },
5420   { SH64_COMPACT_INSN_FLOAT_COMPACT, SEM_FN_NAME (sh64_compact,float_compact) },
5421   { SH64_COMPACT_INSN_FMAC_COMPACT, SEM_FN_NAME (sh64_compact,fmac_compact) },
5422   { SH64_COMPACT_INSN_FMOV1_COMPACT, SEM_FN_NAME (sh64_compact,fmov1_compact) },
5423   { SH64_COMPACT_INSN_FMOV2_COMPACT, SEM_FN_NAME (sh64_compact,fmov2_compact) },
5424   { SH64_COMPACT_INSN_FMOV3_COMPACT, SEM_FN_NAME (sh64_compact,fmov3_compact) },
5425   { SH64_COMPACT_INSN_FMOV4_COMPACT, SEM_FN_NAME (sh64_compact,fmov4_compact) },
5426   { SH64_COMPACT_INSN_FMOV5_COMPACT, SEM_FN_NAME (sh64_compact,fmov5_compact) },
5427   { SH64_COMPACT_INSN_FMOV6_COMPACT, SEM_FN_NAME (sh64_compact,fmov6_compact) },
5428   { SH64_COMPACT_INSN_FMOV7_COMPACT, SEM_FN_NAME (sh64_compact,fmov7_compact) },
5429   { SH64_COMPACT_INSN_FMOV8_COMPACT, SEM_FN_NAME (sh64_compact,fmov8_compact) },
5430   { SH64_COMPACT_INSN_FMOV9_COMPACT, SEM_FN_NAME (sh64_compact,fmov9_compact) },
5431   { SH64_COMPACT_INSN_FMUL_COMPACT, SEM_FN_NAME (sh64_compact,fmul_compact) },
5432   { SH64_COMPACT_INSN_FNEG_COMPACT, SEM_FN_NAME (sh64_compact,fneg_compact) },
5433   { SH64_COMPACT_INSN_FRCHG_COMPACT, SEM_FN_NAME (sh64_compact,frchg_compact) },
5434   { SH64_COMPACT_INSN_FSCHG_COMPACT, SEM_FN_NAME (sh64_compact,fschg_compact) },
5435   { SH64_COMPACT_INSN_FSQRT_COMPACT, SEM_FN_NAME (sh64_compact,fsqrt_compact) },
5436   { SH64_COMPACT_INSN_FSTS_COMPACT, SEM_FN_NAME (sh64_compact,fsts_compact) },
5437   { SH64_COMPACT_INSN_FSUB_COMPACT, SEM_FN_NAME (sh64_compact,fsub_compact) },
5438   { SH64_COMPACT_INSN_FTRC_COMPACT, SEM_FN_NAME (sh64_compact,ftrc_compact) },
5439   { SH64_COMPACT_INSN_FTRV_COMPACT, SEM_FN_NAME (sh64_compact,ftrv_compact) },
5440   { SH64_COMPACT_INSN_JMP_COMPACT, SEM_FN_NAME (sh64_compact,jmp_compact) },
5441   { SH64_COMPACT_INSN_JSR_COMPACT, SEM_FN_NAME (sh64_compact,jsr_compact) },
5442   { SH64_COMPACT_INSN_LDC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_gbr_compact) },
5443   { SH64_COMPACT_INSN_LDC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_vbr_compact) },
5444   { SH64_COMPACT_INSN_LDC_SR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_sr_compact) },
5445   { SH64_COMPACT_INSN_LDCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) },
5446   { SH64_COMPACT_INSN_LDCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) },
5447   { SH64_COMPACT_INSN_LDS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpscr_compact) },
5448   { SH64_COMPACT_INSN_LDSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) },
5449   { SH64_COMPACT_INSN_LDS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpul_compact) },
5450   { SH64_COMPACT_INSN_LDSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) },
5451   { SH64_COMPACT_INSN_LDS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,lds_mach_compact) },
5452   { SH64_COMPACT_INSN_LDSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_mach_compact) },
5453   { SH64_COMPACT_INSN_LDS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,lds_macl_compact) },
5454   { SH64_COMPACT_INSN_LDSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_macl_compact) },
5455   { SH64_COMPACT_INSN_LDS_PR_COMPACT, SEM_FN_NAME (sh64_compact,lds_pr_compact) },
5456   { SH64_COMPACT_INSN_LDSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_pr_compact) },
5457   { SH64_COMPACT_INSN_MACL_COMPACT, SEM_FN_NAME (sh64_compact,macl_compact) },
5458   { SH64_COMPACT_INSN_MACW_COMPACT, SEM_FN_NAME (sh64_compact,macw_compact) },
5459   { SH64_COMPACT_INSN_MOV_COMPACT, SEM_FN_NAME (sh64_compact,mov_compact) },
5460   { SH64_COMPACT_INSN_MOVI_COMPACT, SEM_FN_NAME (sh64_compact,movi_compact) },
5461   { SH64_COMPACT_INSN_MOVI20_COMPACT, SEM_FN_NAME (sh64_compact,movi20_compact) },
5462   { SH64_COMPACT_INSN_MOVB1_COMPACT, SEM_FN_NAME (sh64_compact,movb1_compact) },
5463   { SH64_COMPACT_INSN_MOVB2_COMPACT, SEM_FN_NAME (sh64_compact,movb2_compact) },
5464   { SH64_COMPACT_INSN_MOVB3_COMPACT, SEM_FN_NAME (sh64_compact,movb3_compact) },
5465   { SH64_COMPACT_INSN_MOVB4_COMPACT, SEM_FN_NAME (sh64_compact,movb4_compact) },
5466   { SH64_COMPACT_INSN_MOVB5_COMPACT, SEM_FN_NAME (sh64_compact,movb5_compact) },
5467   { SH64_COMPACT_INSN_MOVB6_COMPACT, SEM_FN_NAME (sh64_compact,movb6_compact) },
5468   { SH64_COMPACT_INSN_MOVB7_COMPACT, SEM_FN_NAME (sh64_compact,movb7_compact) },
5469   { SH64_COMPACT_INSN_MOVB8_COMPACT, SEM_FN_NAME (sh64_compact,movb8_compact) },
5470   { SH64_COMPACT_INSN_MOVB9_COMPACT, SEM_FN_NAME (sh64_compact,movb9_compact) },
5471   { SH64_COMPACT_INSN_MOVB10_COMPACT, SEM_FN_NAME (sh64_compact,movb10_compact) },
5472   { SH64_COMPACT_INSN_MOVL1_COMPACT, SEM_FN_NAME (sh64_compact,movl1_compact) },
5473   { SH64_COMPACT_INSN_MOVL2_COMPACT, SEM_FN_NAME (sh64_compact,movl2_compact) },
5474   { SH64_COMPACT_INSN_MOVL3_COMPACT, SEM_FN_NAME (sh64_compact,movl3_compact) },
5475   { SH64_COMPACT_INSN_MOVL4_COMPACT, SEM_FN_NAME (sh64_compact,movl4_compact) },
5476   { SH64_COMPACT_INSN_MOVL5_COMPACT, SEM_FN_NAME (sh64_compact,movl5_compact) },
5477   { SH64_COMPACT_INSN_MOVL6_COMPACT, SEM_FN_NAME (sh64_compact,movl6_compact) },
5478   { SH64_COMPACT_INSN_MOVL7_COMPACT, SEM_FN_NAME (sh64_compact,movl7_compact) },
5479   { SH64_COMPACT_INSN_MOVL8_COMPACT, SEM_FN_NAME (sh64_compact,movl8_compact) },
5480   { SH64_COMPACT_INSN_MOVL9_COMPACT, SEM_FN_NAME (sh64_compact,movl9_compact) },
5481   { SH64_COMPACT_INSN_MOVL10_COMPACT, SEM_FN_NAME (sh64_compact,movl10_compact) },
5482   { SH64_COMPACT_INSN_MOVL11_COMPACT, SEM_FN_NAME (sh64_compact,movl11_compact) },
5483   { SH64_COMPACT_INSN_MOVL12_COMPACT, SEM_FN_NAME (sh64_compact,movl12_compact) },
5484   { SH64_COMPACT_INSN_MOVL13_COMPACT, SEM_FN_NAME (sh64_compact,movl13_compact) },
5485   { SH64_COMPACT_INSN_MOVW1_COMPACT, SEM_FN_NAME (sh64_compact,movw1_compact) },
5486   { SH64_COMPACT_INSN_MOVW2_COMPACT, SEM_FN_NAME (sh64_compact,movw2_compact) },
5487   { SH64_COMPACT_INSN_MOVW3_COMPACT, SEM_FN_NAME (sh64_compact,movw3_compact) },
5488   { SH64_COMPACT_INSN_MOVW4_COMPACT, SEM_FN_NAME (sh64_compact,movw4_compact) },
5489   { SH64_COMPACT_INSN_MOVW5_COMPACT, SEM_FN_NAME (sh64_compact,movw5_compact) },
5490   { SH64_COMPACT_INSN_MOVW6_COMPACT, SEM_FN_NAME (sh64_compact,movw6_compact) },
5491   { SH64_COMPACT_INSN_MOVW7_COMPACT, SEM_FN_NAME (sh64_compact,movw7_compact) },
5492   { SH64_COMPACT_INSN_MOVW8_COMPACT, SEM_FN_NAME (sh64_compact,movw8_compact) },
5493   { SH64_COMPACT_INSN_MOVW9_COMPACT, SEM_FN_NAME (sh64_compact,movw9_compact) },
5494   { SH64_COMPACT_INSN_MOVW10_COMPACT, SEM_FN_NAME (sh64_compact,movw10_compact) },
5495   { SH64_COMPACT_INSN_MOVW11_COMPACT, SEM_FN_NAME (sh64_compact,movw11_compact) },
5496   { SH64_COMPACT_INSN_MOVA_COMPACT, SEM_FN_NAME (sh64_compact,mova_compact) },
5497   { SH64_COMPACT_INSN_MOVCAL_COMPACT, SEM_FN_NAME (sh64_compact,movcal_compact) },
5498   { SH64_COMPACT_INSN_MOVCOL_COMPACT, SEM_FN_NAME (sh64_compact,movcol_compact) },
5499   { SH64_COMPACT_INSN_MOVT_COMPACT, SEM_FN_NAME (sh64_compact,movt_compact) },
5500   { SH64_COMPACT_INSN_MOVUAL_COMPACT, SEM_FN_NAME (sh64_compact,movual_compact) },
5501   { SH64_COMPACT_INSN_MOVUAL2_COMPACT, SEM_FN_NAME (sh64_compact,movual2_compact) },
5502   { SH64_COMPACT_INSN_MULL_COMPACT, SEM_FN_NAME (sh64_compact,mull_compact) },
5503   { SH64_COMPACT_INSN_MULSW_COMPACT, SEM_FN_NAME (sh64_compact,mulsw_compact) },
5504   { SH64_COMPACT_INSN_MULUW_COMPACT, SEM_FN_NAME (sh64_compact,muluw_compact) },
5505   { SH64_COMPACT_INSN_NEG_COMPACT, SEM_FN_NAME (sh64_compact,neg_compact) },
5506   { SH64_COMPACT_INSN_NEGC_COMPACT, SEM_FN_NAME (sh64_compact,negc_compact) },
5507   { SH64_COMPACT_INSN_NOP_COMPACT, SEM_FN_NAME (sh64_compact,nop_compact) },
5508   { SH64_COMPACT_INSN_NOT_COMPACT, SEM_FN_NAME (sh64_compact,not_compact) },
5509   { SH64_COMPACT_INSN_OCBI_COMPACT, SEM_FN_NAME (sh64_compact,ocbi_compact) },
5510   { SH64_COMPACT_INSN_OCBP_COMPACT, SEM_FN_NAME (sh64_compact,ocbp_compact) },
5511   { SH64_COMPACT_INSN_OCBWB_COMPACT, SEM_FN_NAME (sh64_compact,ocbwb_compact) },
5512   { SH64_COMPACT_INSN_OR_COMPACT, SEM_FN_NAME (sh64_compact,or_compact) },
5513   { SH64_COMPACT_INSN_ORI_COMPACT, SEM_FN_NAME (sh64_compact,ori_compact) },
5514   { SH64_COMPACT_INSN_ORB_COMPACT, SEM_FN_NAME (sh64_compact,orb_compact) },
5515   { SH64_COMPACT_INSN_PREF_COMPACT, SEM_FN_NAME (sh64_compact,pref_compact) },
5516   { SH64_COMPACT_INSN_ROTCL_COMPACT, SEM_FN_NAME (sh64_compact,rotcl_compact) },
5517   { SH64_COMPACT_INSN_ROTCR_COMPACT, SEM_FN_NAME (sh64_compact,rotcr_compact) },
5518   { SH64_COMPACT_INSN_ROTL_COMPACT, SEM_FN_NAME (sh64_compact,rotl_compact) },
5519   { SH64_COMPACT_INSN_ROTR_COMPACT, SEM_FN_NAME (sh64_compact,rotr_compact) },
5520   { SH64_COMPACT_INSN_RTS_COMPACT, SEM_FN_NAME (sh64_compact,rts_compact) },
5521   { SH64_COMPACT_INSN_SETS_COMPACT, SEM_FN_NAME (sh64_compact,sets_compact) },
5522   { SH64_COMPACT_INSN_SETT_COMPACT, SEM_FN_NAME (sh64_compact,sett_compact) },
5523   { SH64_COMPACT_INSN_SHAD_COMPACT, SEM_FN_NAME (sh64_compact,shad_compact) },
5524   { SH64_COMPACT_INSN_SHAL_COMPACT, SEM_FN_NAME (sh64_compact,shal_compact) },
5525   { SH64_COMPACT_INSN_SHAR_COMPACT, SEM_FN_NAME (sh64_compact,shar_compact) },
5526   { SH64_COMPACT_INSN_SHLD_COMPACT, SEM_FN_NAME (sh64_compact,shld_compact) },
5527   { SH64_COMPACT_INSN_SHLL_COMPACT, SEM_FN_NAME (sh64_compact,shll_compact) },
5528   { SH64_COMPACT_INSN_SHLL2_COMPACT, SEM_FN_NAME (sh64_compact,shll2_compact) },
5529   { SH64_COMPACT_INSN_SHLL8_COMPACT, SEM_FN_NAME (sh64_compact,shll8_compact) },
5530   { SH64_COMPACT_INSN_SHLL16_COMPACT, SEM_FN_NAME (sh64_compact,shll16_compact) },
5531   { SH64_COMPACT_INSN_SHLR_COMPACT, SEM_FN_NAME (sh64_compact,shlr_compact) },
5532   { SH64_COMPACT_INSN_SHLR2_COMPACT, SEM_FN_NAME (sh64_compact,shlr2_compact) },
5533   { SH64_COMPACT_INSN_SHLR8_COMPACT, SEM_FN_NAME (sh64_compact,shlr8_compact) },
5534   { SH64_COMPACT_INSN_SHLR16_COMPACT, SEM_FN_NAME (sh64_compact,shlr16_compact) },
5535   { SH64_COMPACT_INSN_STC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_gbr_compact) },
5536   { SH64_COMPACT_INSN_STC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_vbr_compact) },
5537   { SH64_COMPACT_INSN_STCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_gbr_compact) },
5538   { SH64_COMPACT_INSN_STCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_vbr_compact) },
5539   { SH64_COMPACT_INSN_STS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpscr_compact) },
5540   { SH64_COMPACT_INSN_STSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) },
5541   { SH64_COMPACT_INSN_STS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpul_compact) },
5542   { SH64_COMPACT_INSN_STSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpul_compact) },
5543   { SH64_COMPACT_INSN_STS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,sts_mach_compact) },
5544   { SH64_COMPACT_INSN_STSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,stsl_mach_compact) },
5545   { SH64_COMPACT_INSN_STS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,sts_macl_compact) },
5546   { SH64_COMPACT_INSN_STSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_macl_compact) },
5547   { SH64_COMPACT_INSN_STS_PR_COMPACT, SEM_FN_NAME (sh64_compact,sts_pr_compact) },
5548   { SH64_COMPACT_INSN_STSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_pr_compact) },
5549   { SH64_COMPACT_INSN_SUB_COMPACT, SEM_FN_NAME (sh64_compact,sub_compact) },
5550   { SH64_COMPACT_INSN_SUBC_COMPACT, SEM_FN_NAME (sh64_compact,subc_compact) },
5551   { SH64_COMPACT_INSN_SUBV_COMPACT, SEM_FN_NAME (sh64_compact,subv_compact) },
5552   { SH64_COMPACT_INSN_SWAPB_COMPACT, SEM_FN_NAME (sh64_compact,swapb_compact) },
5553   { SH64_COMPACT_INSN_SWAPW_COMPACT, SEM_FN_NAME (sh64_compact,swapw_compact) },
5554   { SH64_COMPACT_INSN_TASB_COMPACT, SEM_FN_NAME (sh64_compact,tasb_compact) },
5555   { SH64_COMPACT_INSN_TRAPA_COMPACT, SEM_FN_NAME (sh64_compact,trapa_compact) },
5556   { SH64_COMPACT_INSN_TST_COMPACT, SEM_FN_NAME (sh64_compact,tst_compact) },
5557   { SH64_COMPACT_INSN_TSTI_COMPACT, SEM_FN_NAME (sh64_compact,tsti_compact) },
5558   { SH64_COMPACT_INSN_TSTB_COMPACT, SEM_FN_NAME (sh64_compact,tstb_compact) },
5559   { SH64_COMPACT_INSN_XOR_COMPACT, SEM_FN_NAME (sh64_compact,xor_compact) },
5560   { SH64_COMPACT_INSN_XORI_COMPACT, SEM_FN_NAME (sh64_compact,xori_compact) },
5561   { SH64_COMPACT_INSN_XORB_COMPACT, SEM_FN_NAME (sh64_compact,xorb_compact) },
5562   { SH64_COMPACT_INSN_XTRCT_COMPACT, SEM_FN_NAME (sh64_compact,xtrct_compact) },
5563   { 0, 0 }
5564 };
5565
5566 /* Add the semantic fns to IDESC_TABLE.  */
5567
5568 void
5569 SEM_FN_NAME (sh64_compact,init_idesc_table) (SIM_CPU *current_cpu)
5570 {
5571   IDESC *idesc_table = CPU_IDESC (current_cpu);
5572   const struct sem_fn_desc *sf;
5573   int mach_num = MACH_NUM (CPU_MACH (current_cpu));
5574
5575   for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
5576     {
5577       const CGEN_INSN *insn = idesc_table[sf->index].idata;
5578       int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
5579                      || CGEN_INSN_MACH_HAS_P (insn, mach_num));
5580 #if FAST_P
5581       if (valid_p)
5582         idesc_table[sf->index].sem_fast = sf->fn;
5583       else
5584         idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_compact,x_invalid);
5585 #else
5586       if (valid_p)
5587         idesc_table[sf->index].sem_full = sf->fn;
5588       else
5589         idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_compact,x_invalid);
5590 #endif
5591     }
5592 }
5593