sim: cgen: namespace custom trace functions
[binutils-gdb.git] / sim / sh64 / sem-compact.c
blobd5629aff01a6e387ab9c4dc3d191c4b32e6910f9
1 /* Simulator instruction semantics for sh64.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2015 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
9 This file 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, or (at your option)
12 any later version.
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, see <http://www.gnu.org/licenses/>.
24 #define WANT_CPU sh64
25 #define WANT_CPU_SH64
27 #include "sim-main.h"
28 #include "cgen-mem.h"
29 #include "cgen-ops.h"
31 #undef GET_ATTR
32 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34 /* This is used so that we can compile two copies of the semantic code,
35 one with full feature support and one without that runs fast(er).
36 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
37 #if FAST_P
38 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
39 #undef CGEN_TRACE_RESULT
40 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
41 #else
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
43 #endif
45 /* x-invalid: --invalid-- */
47 static SEM_PC
48 SEM_FN_NAME (sh64_compact,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
50 #define FLD(f) abuf->fields.sfmt_empty.f
51 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
52 int UNUSED written = 0;
53 IADDR UNUSED pc = abuf->addr;
54 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
57 /* Update the recorded pc in the cpu state struct.
58 Only necessary for WITH_SCACHE case, but to avoid the
59 conditional compilation .... */
60 SET_H_PC (pc);
61 /* Virtual insns have zero size. Overwrite vpc with address of next insn
62 using the default-insn-bitsize spec. When executing insns in parallel
63 we may want to queue the fault and continue execution. */
64 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
65 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
68 return vpc;
69 #undef FLD
72 /* x-after: --after-- */
74 static SEM_PC
75 SEM_FN_NAME (sh64_compact,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
77 #define FLD(f) abuf->fields.sfmt_empty.f
78 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
79 int UNUSED written = 0;
80 IADDR UNUSED pc = abuf->addr;
81 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
84 #if WITH_SCACHE_PBB_SH64_COMPACT
85 sh64_compact_pbb_after (current_cpu, sem_arg);
86 #endif
89 return vpc;
90 #undef FLD
93 /* x-before: --before-- */
95 static SEM_PC
96 SEM_FN_NAME (sh64_compact,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
98 #define FLD(f) abuf->fields.sfmt_empty.f
99 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
100 int UNUSED written = 0;
101 IADDR UNUSED pc = abuf->addr;
102 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
105 #if WITH_SCACHE_PBB_SH64_COMPACT
106 sh64_compact_pbb_before (current_cpu, sem_arg);
107 #endif
110 return vpc;
111 #undef FLD
114 /* x-cti-chain: --cti-chain-- */
116 static SEM_PC
117 SEM_FN_NAME (sh64_compact,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
119 #define FLD(f) abuf->fields.sfmt_empty.f
120 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
121 int UNUSED written = 0;
122 IADDR UNUSED pc = abuf->addr;
123 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
126 #if WITH_SCACHE_PBB_SH64_COMPACT
127 #ifdef DEFINE_SWITCH
128 vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg,
129 pbb_br_type, pbb_br_npc);
130 BREAK (sem);
131 #else
132 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
133 vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg,
134 CPU_PBB_BR_TYPE (current_cpu),
135 CPU_PBB_BR_NPC (current_cpu));
136 #endif
137 #endif
140 return vpc;
141 #undef FLD
144 /* x-chain: --chain-- */
146 static SEM_PC
147 SEM_FN_NAME (sh64_compact,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
149 #define FLD(f) abuf->fields.sfmt_empty.f
150 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
151 int UNUSED written = 0;
152 IADDR UNUSED pc = abuf->addr;
153 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
156 #if WITH_SCACHE_PBB_SH64_COMPACT
157 vpc = sh64_compact_pbb_chain (current_cpu, sem_arg);
158 #ifdef DEFINE_SWITCH
159 BREAK (sem);
160 #endif
161 #endif
164 return vpc;
165 #undef FLD
168 /* x-begin: --begin-- */
170 static SEM_PC
171 SEM_FN_NAME (sh64_compact,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
173 #define FLD(f) abuf->fields.sfmt_empty.f
174 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
175 int UNUSED written = 0;
176 IADDR UNUSED pc = abuf->addr;
177 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
180 #if WITH_SCACHE_PBB_SH64_COMPACT
181 #if defined DEFINE_SWITCH || defined FAST_P
182 /* In the switch case FAST_P is a constant, allowing several optimizations
183 in any called inline functions. */
184 vpc = sh64_compact_pbb_begin (current_cpu, FAST_P);
185 #else
186 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
187 vpc = sh64_compact_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
188 #else
189 vpc = sh64_compact_pbb_begin (current_cpu, 0);
190 #endif
191 #endif
192 #endif
195 return vpc;
196 #undef FLD
199 /* add-compact: add $rm, $rn */
201 static SEM_PC
202 SEM_FN_NAME (sh64_compact,add_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
204 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
205 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
206 int UNUSED written = 0;
207 IADDR UNUSED pc = abuf->addr;
208 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
211 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
212 SET_H_GRC (FLD (f_rn), opval);
213 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
216 return vpc;
217 #undef FLD
220 /* addi-compact: add #$imm8, $rn */
222 static SEM_PC
223 SEM_FN_NAME (sh64_compact,addi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
225 #define FLD(f) abuf->fields.sfmt_addi_compact.f
226 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
227 int UNUSED written = 0;
228 IADDR UNUSED pc = abuf->addr;
229 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
232 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
233 SET_H_GRC (FLD (f_rn), opval);
234 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
237 return vpc;
238 #undef FLD
241 /* addc-compact: addc $rm, $rn */
243 static SEM_PC
244 SEM_FN_NAME (sh64_compact,addc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
246 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
247 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
248 int UNUSED written = 0;
249 IADDR UNUSED pc = abuf->addr;
250 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
253 BI tmp_flag;
254 tmp_flag = ADDCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
256 SI opval = ADDCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
257 SET_H_GRC (FLD (f_rn), opval);
258 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
261 BI opval = tmp_flag;
262 SET_H_TBIT (opval);
263 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
267 return vpc;
268 #undef FLD
271 /* addv-compact: addv $rm, $rn */
273 static SEM_PC
274 SEM_FN_NAME (sh64_compact,addv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
276 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
277 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
278 int UNUSED written = 0;
279 IADDR UNUSED pc = abuf->addr;
280 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
283 BI tmp_t;
284 tmp_t = ADDOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0);
286 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
287 SET_H_GRC (FLD (f_rn), opval);
288 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
291 BI opval = tmp_t;
292 SET_H_TBIT (opval);
293 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
297 return vpc;
298 #undef FLD
301 /* and-compact: and $rm64, $rn64 */
303 static SEM_PC
304 SEM_FN_NAME (sh64_compact,and_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
306 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
307 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
308 int UNUSED written = 0;
309 IADDR UNUSED pc = abuf->addr;
310 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
313 DI opval = ANDDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn)));
314 SET_H_GR (FLD (f_rn), opval);
315 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
318 return vpc;
319 #undef FLD
322 /* andi-compact: and #$uimm8, r0 */
324 static SEM_PC
325 SEM_FN_NAME (sh64_compact,andi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
327 #define FLD(f) abuf->fields.sfmt_addi_compact.f
328 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
329 int UNUSED written = 0;
330 IADDR UNUSED pc = abuf->addr;
331 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
334 SI opval = ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
335 SET_H_GRC (((UINT) 0), opval);
336 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
339 return vpc;
340 #undef FLD
343 /* andb-compact: and.b #$imm8, @(r0, gbr) */
345 static SEM_PC
346 SEM_FN_NAME (sh64_compact,andb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
348 #define FLD(f) abuf->fields.sfmt_addi_compact.f
349 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
350 int UNUSED written = 0;
351 IADDR UNUSED pc = abuf->addr;
352 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
355 DI tmp_addr;
356 UQI tmp_data;
357 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
358 tmp_data = ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
360 UQI opval = tmp_data;
361 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
362 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
366 return vpc;
367 #undef FLD
370 /* bf-compact: bf $disp8 */
372 static SEM_PC
373 SEM_FN_NAME (sh64_compact,bf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
375 #define FLD(f) abuf->fields.sfmt_bf_compact.f
376 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
377 int UNUSED written = 0;
378 IADDR UNUSED pc = abuf->addr;
379 SEM_BRANCH_INIT
380 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
382 if (NOTBI (GET_H_TBIT ())) {
384 UDI opval = FLD (i_disp8);
385 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
386 written |= (1 << 2);
387 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
391 abuf->written = written;
392 SEM_BRANCH_FINI (vpc);
393 return vpc;
394 #undef FLD
397 /* bfs-compact: bf/s $disp8 */
399 static SEM_PC
400 SEM_FN_NAME (sh64_compact,bfs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
402 #define FLD(f) abuf->fields.sfmt_bf_compact.f
403 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
404 int UNUSED written = 0;
405 IADDR UNUSED pc = abuf->addr;
406 SEM_BRANCH_INIT
407 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
409 if (NOTBI (GET_H_TBIT ())) {
412 UDI opval = ADDDI (pc, 2);
413 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
414 written |= (1 << 3);
415 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
417 ((void) 0); /*nop*/
420 UDI opval = FLD (i_disp8);
421 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
422 written |= (1 << 3);
423 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
429 abuf->written = written;
430 SEM_BRANCH_FINI (vpc);
431 return vpc;
432 #undef FLD
435 /* bra-compact: bra $disp12 */
437 static SEM_PC
438 SEM_FN_NAME (sh64_compact,bra_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
440 #define FLD(f) abuf->fields.sfmt_bra_compact.f
441 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
442 int UNUSED written = 0;
443 IADDR UNUSED pc = abuf->addr;
444 SEM_BRANCH_INIT
445 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
449 UDI opval = ADDDI (pc, 2);
450 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
451 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
453 ((void) 0); /*nop*/
456 UDI opval = FLD (i_disp12);
457 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
458 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
463 SEM_BRANCH_FINI (vpc);
464 return vpc;
465 #undef FLD
468 /* braf-compact: braf $rn */
470 static SEM_PC
471 SEM_FN_NAME (sh64_compact,braf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
473 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
474 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
475 int UNUSED written = 0;
476 IADDR UNUSED pc = abuf->addr;
477 SEM_BRANCH_INIT
478 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
482 UDI opval = ADDDI (pc, 2);
483 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
484 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
486 ((void) 0); /*nop*/
489 UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4));
490 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
491 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
496 SEM_BRANCH_FINI (vpc);
497 return vpc;
498 #undef FLD
501 /* brk-compact: brk */
503 static SEM_PC
504 SEM_FN_NAME (sh64_compact,brk_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
506 #define FLD(f) abuf->fields.sfmt_empty.f
507 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
508 int UNUSED written = 0;
509 IADDR UNUSED pc = abuf->addr;
510 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
512 sh64_break (current_cpu, pc);
514 return vpc;
515 #undef FLD
518 /* bsr-compact: bsr $disp12 */
520 static SEM_PC
521 SEM_FN_NAME (sh64_compact,bsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
523 #define FLD(f) abuf->fields.sfmt_bra_compact.f
524 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
525 int UNUSED written = 0;
526 IADDR UNUSED pc = abuf->addr;
527 SEM_BRANCH_INIT
528 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
533 SI opval = ADDDI (pc, 4);
534 SET_H_PR (opval);
535 CGEN_TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
539 UDI opval = ADDDI (pc, 2);
540 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
541 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
543 ((void) 0); /*nop*/
546 UDI opval = FLD (i_disp12);
547 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
548 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
553 SEM_BRANCH_FINI (vpc);
554 return vpc;
555 #undef FLD
558 /* bsrf-compact: bsrf $rn */
560 static SEM_PC
561 SEM_FN_NAME (sh64_compact,bsrf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
563 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
564 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
565 int UNUSED written = 0;
566 IADDR UNUSED pc = abuf->addr;
567 SEM_BRANCH_INIT
568 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
573 SI opval = ADDDI (pc, 4);
574 SET_H_PR (opval);
575 CGEN_TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
579 UDI opval = ADDDI (pc, 2);
580 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
581 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
583 ((void) 0); /*nop*/
586 UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4));
587 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
588 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
593 SEM_BRANCH_FINI (vpc);
594 return vpc;
595 #undef FLD
598 /* bt-compact: bt $disp8 */
600 static SEM_PC
601 SEM_FN_NAME (sh64_compact,bt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
603 #define FLD(f) abuf->fields.sfmt_bf_compact.f
604 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
605 int UNUSED written = 0;
606 IADDR UNUSED pc = abuf->addr;
607 SEM_BRANCH_INIT
608 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
610 if (GET_H_TBIT ()) {
612 UDI opval = FLD (i_disp8);
613 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
614 written |= (1 << 2);
615 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
619 abuf->written = written;
620 SEM_BRANCH_FINI (vpc);
621 return vpc;
622 #undef FLD
625 /* bts-compact: bt/s $disp8 */
627 static SEM_PC
628 SEM_FN_NAME (sh64_compact,bts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
630 #define FLD(f) abuf->fields.sfmt_bf_compact.f
631 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
632 int UNUSED written = 0;
633 IADDR UNUSED pc = abuf->addr;
634 SEM_BRANCH_INIT
635 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
637 if (GET_H_TBIT ()) {
640 UDI opval = ADDDI (pc, 2);
641 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
642 written |= (1 << 3);
643 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
645 ((void) 0); /*nop*/
648 UDI opval = FLD (i_disp8);
649 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
650 written |= (1 << 3);
651 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
657 abuf->written = written;
658 SEM_BRANCH_FINI (vpc);
659 return vpc;
660 #undef FLD
663 /* clrmac-compact: clrmac */
665 static SEM_PC
666 SEM_FN_NAME (sh64_compact,clrmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
668 #define FLD(f) abuf->fields.sfmt_empty.f
669 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
670 int UNUSED written = 0;
671 IADDR UNUSED pc = abuf->addr;
672 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
676 SI opval = 0;
677 SET_H_MACL (opval);
678 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
681 SI opval = 0;
682 SET_H_MACH (opval);
683 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
687 return vpc;
688 #undef FLD
691 /* clrs-compact: clrs */
693 static SEM_PC
694 SEM_FN_NAME (sh64_compact,clrs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
696 #define FLD(f) abuf->fields.sfmt_empty.f
697 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
698 int UNUSED written = 0;
699 IADDR UNUSED pc = abuf->addr;
700 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
703 BI opval = 0;
704 SET_H_SBIT (opval);
705 CGEN_TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval);
708 return vpc;
709 #undef FLD
712 /* clrt-compact: clrt */
714 static SEM_PC
715 SEM_FN_NAME (sh64_compact,clrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
717 #define FLD(f) abuf->fields.sfmt_empty.f
718 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
719 int UNUSED written = 0;
720 IADDR UNUSED pc = abuf->addr;
721 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
724 BI opval = 0;
725 SET_H_TBIT (opval);
726 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
729 return vpc;
730 #undef FLD
733 /* cmpeq-compact: cmp/eq $rm, $rn */
735 static SEM_PC
736 SEM_FN_NAME (sh64_compact,cmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
738 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
739 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
740 int UNUSED written = 0;
741 IADDR UNUSED pc = abuf->addr;
742 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
745 BI opval = EQSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
746 SET_H_TBIT (opval);
747 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
750 return vpc;
751 #undef FLD
754 /* cmpeqi-compact: cmp/eq #$imm8, r0 */
756 static SEM_PC
757 SEM_FN_NAME (sh64_compact,cmpeqi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
759 #define FLD(f) abuf->fields.sfmt_addi_compact.f
760 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
761 int UNUSED written = 0;
762 IADDR UNUSED pc = abuf->addr;
763 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
766 BI opval = EQSI (GET_H_GRC (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
767 SET_H_TBIT (opval);
768 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
771 return vpc;
772 #undef FLD
775 /* cmpge-compact: cmp/ge $rm, $rn */
777 static SEM_PC
778 SEM_FN_NAME (sh64_compact,cmpge_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
780 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
781 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
782 int UNUSED written = 0;
783 IADDR UNUSED pc = abuf->addr;
784 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
787 BI opval = GESI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
788 SET_H_TBIT (opval);
789 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
792 return vpc;
793 #undef FLD
796 /* cmpgt-compact: cmp/gt $rm, $rn */
798 static SEM_PC
799 SEM_FN_NAME (sh64_compact,cmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
801 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
802 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
803 int UNUSED written = 0;
804 IADDR UNUSED pc = abuf->addr;
805 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
808 BI opval = GTSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
809 SET_H_TBIT (opval);
810 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
813 return vpc;
814 #undef FLD
817 /* cmphi-compact: cmp/hi $rm, $rn */
819 static SEM_PC
820 SEM_FN_NAME (sh64_compact,cmphi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
822 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
823 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
824 int UNUSED written = 0;
825 IADDR UNUSED pc = abuf->addr;
826 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
829 BI opval = GTUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
830 SET_H_TBIT (opval);
831 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
834 return vpc;
835 #undef FLD
838 /* cmphs-compact: cmp/hs $rm, $rn */
840 static SEM_PC
841 SEM_FN_NAME (sh64_compact,cmphs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
843 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
844 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
845 int UNUSED written = 0;
846 IADDR UNUSED pc = abuf->addr;
847 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
850 BI opval = GEUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
851 SET_H_TBIT (opval);
852 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
855 return vpc;
856 #undef FLD
859 /* cmppl-compact: cmp/pl $rn */
861 static SEM_PC
862 SEM_FN_NAME (sh64_compact,cmppl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
864 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
865 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
866 int UNUSED written = 0;
867 IADDR UNUSED pc = abuf->addr;
868 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
871 BI opval = GTSI (GET_H_GRC (FLD (f_rn)), 0);
872 SET_H_TBIT (opval);
873 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
876 return vpc;
877 #undef FLD
880 /* cmppz-compact: cmp/pz $rn */
882 static SEM_PC
883 SEM_FN_NAME (sh64_compact,cmppz_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
885 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
886 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
887 int UNUSED written = 0;
888 IADDR UNUSED pc = abuf->addr;
889 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
892 BI opval = GESI (GET_H_GRC (FLD (f_rn)), 0);
893 SET_H_TBIT (opval);
894 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
897 return vpc;
898 #undef FLD
901 /* cmpstr-compact: cmp/str $rm, $rn */
903 static SEM_PC
904 SEM_FN_NAME (sh64_compact,cmpstr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
906 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
907 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
908 int UNUSED written = 0;
909 IADDR UNUSED pc = abuf->addr;
910 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
913 BI tmp_t;
914 SI tmp_temp;
915 tmp_temp = XORSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
916 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
917 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
918 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
919 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
921 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
922 SET_H_TBIT (opval);
923 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
927 return vpc;
928 #undef FLD
931 /* div0s-compact: div0s $rm, $rn */
933 static SEM_PC
934 SEM_FN_NAME (sh64_compact,div0s_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
936 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
937 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
938 int UNUSED written = 0;
939 IADDR UNUSED pc = abuf->addr;
940 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
944 BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
945 SET_H_QBIT (opval);
946 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
949 BI opval = SRLSI (GET_H_GRC (FLD (f_rm)), 31);
950 SET_H_MBIT (opval);
951 CGEN_TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval);
954 BI opval = ((EQSI (SRLSI (GET_H_GRC (FLD (f_rm)), 31), SRLSI (GET_H_GRC (FLD (f_rn)), 31))) ? (0) : (1));
955 SET_H_TBIT (opval);
956 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
960 return vpc;
961 #undef FLD
964 /* div0u-compact: div0u */
966 static SEM_PC
967 SEM_FN_NAME (sh64_compact,div0u_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
969 #define FLD(f) abuf->fields.sfmt_empty.f
970 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
971 int UNUSED written = 0;
972 IADDR UNUSED pc = abuf->addr;
973 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
977 BI opval = 0;
978 SET_H_TBIT (opval);
979 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
982 BI opval = 0;
983 SET_H_QBIT (opval);
984 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
987 BI opval = 0;
988 SET_H_MBIT (opval);
989 CGEN_TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval);
993 return vpc;
994 #undef FLD
997 /* div1-compact: div1 $rm, $rn */
999 static SEM_PC
1000 SEM_FN_NAME (sh64_compact,div1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1002 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1003 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1004 int UNUSED written = 0;
1005 IADDR UNUSED pc = abuf->addr;
1006 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1009 BI tmp_oldq;
1010 SI tmp_tmp0;
1011 UQI tmp_tmp1;
1012 tmp_oldq = GET_H_QBIT ();
1014 BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
1015 SET_H_QBIT (opval);
1016 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1019 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), ZEXTBISI (GET_H_TBIT ()));
1020 SET_H_GRC (FLD (f_rn), opval);
1021 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1023 if (NOTBI (tmp_oldq)) {
1024 if (NOTBI (GET_H_MBIT ())) {
1026 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1028 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1029 SET_H_GRC (FLD (f_rn), opval);
1030 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1032 tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1033 if (NOTBI (GET_H_QBIT ())) {
1035 BI opval = ((tmp_tmp1) ? (1) : (0));
1036 SET_H_QBIT (opval);
1037 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1039 } else {
1041 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1042 SET_H_QBIT (opval);
1043 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1047 } else {
1049 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1051 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1052 SET_H_GRC (FLD (f_rn), opval);
1053 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1055 tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1056 if (NOTBI (GET_H_QBIT ())) {
1058 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1059 SET_H_QBIT (opval);
1060 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1062 } else {
1064 BI opval = ((tmp_tmp1) ? (1) : (0));
1065 SET_H_QBIT (opval);
1066 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1071 } else {
1072 if (NOTBI (GET_H_MBIT ())) {
1074 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1076 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
1077 SET_H_GRC (FLD (f_rn), opval);
1078 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1080 tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1081 if (NOTBI (GET_H_QBIT ())) {
1083 BI opval = ((tmp_tmp1) ? (1) : (0));
1084 SET_H_QBIT (opval);
1085 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1087 } else {
1089 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1090 SET_H_QBIT (opval);
1091 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1095 } else {
1097 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1099 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1100 SET_H_GRC (FLD (f_rn), opval);
1101 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1103 tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1104 if (NOTBI (GET_H_QBIT ())) {
1106 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1107 SET_H_QBIT (opval);
1108 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1110 } else {
1112 BI opval = ((tmp_tmp1) ? (1) : (0));
1113 SET_H_QBIT (opval);
1114 CGEN_TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1121 BI opval = ((EQBI (GET_H_QBIT (), GET_H_MBIT ())) ? (1) : (0));
1122 SET_H_TBIT (opval);
1123 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1127 return vpc;
1128 #undef FLD
1131 /* divu-compact: divu r0, $rn */
1133 static SEM_PC
1134 SEM_FN_NAME (sh64_compact,divu_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1136 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1137 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1138 int UNUSED written = 0;
1139 IADDR UNUSED pc = abuf->addr;
1140 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1143 SI opval = UDIVSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0)));
1144 SET_H_GRC (FLD (f_rn), opval);
1145 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1148 return vpc;
1149 #undef FLD
1152 /* mulr-compact: mulr r0, $rn */
1154 static SEM_PC
1155 SEM_FN_NAME (sh64_compact,mulr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1157 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1158 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1159 int UNUSED written = 0;
1160 IADDR UNUSED pc = abuf->addr;
1161 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1164 SI opval = MULSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0)));
1165 SET_H_GRC (FLD (f_rn), opval);
1166 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1169 return vpc;
1170 #undef FLD
1173 /* dmulsl-compact: dmuls.l $rm, $rn */
1175 static SEM_PC
1176 SEM_FN_NAME (sh64_compact,dmulsl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1178 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1179 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1180 int UNUSED written = 0;
1181 IADDR UNUSED pc = abuf->addr;
1182 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1185 DI tmp_result;
1186 tmp_result = MULDI (EXTSIDI (GET_H_GRC (FLD (f_rm))), EXTSIDI (GET_H_GRC (FLD (f_rn))));
1188 SI opval = SUBWORDDISI (tmp_result, 0);
1189 SET_H_MACH (opval);
1190 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
1193 SI opval = SUBWORDDISI (tmp_result, 1);
1194 SET_H_MACL (opval);
1195 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
1199 return vpc;
1200 #undef FLD
1203 /* dmulul-compact: dmulu.l $rm, $rn */
1205 static SEM_PC
1206 SEM_FN_NAME (sh64_compact,dmulul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1208 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1209 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1210 int UNUSED written = 0;
1211 IADDR UNUSED pc = abuf->addr;
1212 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1215 DI tmp_result;
1216 tmp_result = MULDI (ZEXTSIDI (GET_H_GRC (FLD (f_rm))), ZEXTSIDI (GET_H_GRC (FLD (f_rn))));
1218 SI opval = SUBWORDDISI (tmp_result, 0);
1219 SET_H_MACH (opval);
1220 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
1223 SI opval = SUBWORDDISI (tmp_result, 1);
1224 SET_H_MACL (opval);
1225 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
1229 return vpc;
1230 #undef FLD
1233 /* dt-compact: dt $rn */
1235 static SEM_PC
1236 SEM_FN_NAME (sh64_compact,dt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1238 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1239 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1240 int UNUSED written = 0;
1241 IADDR UNUSED pc = abuf->addr;
1242 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1246 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 1);
1247 SET_H_GRC (FLD (f_rn), opval);
1248 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1251 BI opval = EQSI (GET_H_GRC (FLD (f_rn)), 0);
1252 SET_H_TBIT (opval);
1253 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1257 return vpc;
1258 #undef FLD
1261 /* extsb-compact: exts.b $rm, $rn */
1263 static SEM_PC
1264 SEM_FN_NAME (sh64_compact,extsb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1266 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1267 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1268 int UNUSED written = 0;
1269 IADDR UNUSED pc = abuf->addr;
1270 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1273 SI opval = EXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3));
1274 SET_H_GRC (FLD (f_rn), opval);
1275 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1278 return vpc;
1279 #undef FLD
1282 /* extsw-compact: exts.w $rm, $rn */
1284 static SEM_PC
1285 SEM_FN_NAME (sh64_compact,extsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1287 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1288 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1289 int UNUSED written = 0;
1290 IADDR UNUSED pc = abuf->addr;
1291 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1294 SI opval = EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1));
1295 SET_H_GRC (FLD (f_rn), opval);
1296 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1299 return vpc;
1300 #undef FLD
1303 /* extub-compact: extu.b $rm, $rn */
1305 static SEM_PC
1306 SEM_FN_NAME (sh64_compact,extub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1308 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1309 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1310 int UNUSED written = 0;
1311 IADDR UNUSED pc = abuf->addr;
1312 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1315 SI opval = ZEXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3));
1316 SET_H_GRC (FLD (f_rn), opval);
1317 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1320 return vpc;
1321 #undef FLD
1324 /* extuw-compact: extu.w $rm, $rn */
1326 static SEM_PC
1327 SEM_FN_NAME (sh64_compact,extuw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1329 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1330 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1331 int UNUSED written = 0;
1332 IADDR UNUSED pc = abuf->addr;
1333 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1336 SI opval = ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1));
1337 SET_H_GRC (FLD (f_rn), opval);
1338 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1341 return vpc;
1342 #undef FLD
1345 /* fabs-compact: fabs $fsdn */
1347 static SEM_PC
1348 SEM_FN_NAME (sh64_compact,fabs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1350 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1351 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1352 int UNUSED written = 0;
1353 IADDR UNUSED pc = abuf->addr;
1354 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1356 if (GET_H_PRBIT ()) {
1358 DF opval = sh64_fabsd (current_cpu, GET_H_FSD (FLD (f_rn)));
1359 SET_H_FSD (FLD (f_rn), opval);
1360 written |= (1 << 2);
1361 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1363 } else {
1365 DF opval = sh64_fabss (current_cpu, GET_H_FSD (FLD (f_rn)));
1366 SET_H_FSD (FLD (f_rn), opval);
1367 written |= (1 << 2);
1368 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1372 abuf->written = written;
1373 return vpc;
1374 #undef FLD
1377 /* fadd-compact: fadd $fsdm, $fsdn */
1379 static SEM_PC
1380 SEM_FN_NAME (sh64_compact,fadd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1382 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1383 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1384 int UNUSED written = 0;
1385 IADDR UNUSED pc = abuf->addr;
1386 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1388 if (GET_H_PRBIT ()) {
1390 DF opval = sh64_faddd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1391 SET_H_FSD (FLD (f_rn), opval);
1392 written |= (1 << 3);
1393 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1395 } else {
1397 DF opval = sh64_fadds (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1398 SET_H_FSD (FLD (f_rn), opval);
1399 written |= (1 << 3);
1400 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1404 abuf->written = written;
1405 return vpc;
1406 #undef FLD
1409 /* fcmpeq-compact: fcmp/eq $fsdm, $fsdn */
1411 static SEM_PC
1412 SEM_FN_NAME (sh64_compact,fcmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1414 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1415 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1416 int UNUSED written = 0;
1417 IADDR UNUSED pc = abuf->addr;
1418 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1420 if (GET_H_PRBIT ()) {
1422 BI opval = sh64_fcmpeqd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1423 SET_H_TBIT (opval);
1424 written |= (1 << 3);
1425 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1427 } else {
1429 BI opval = sh64_fcmpeqs (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1430 SET_H_TBIT (opval);
1431 written |= (1 << 3);
1432 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1436 abuf->written = written;
1437 return vpc;
1438 #undef FLD
1441 /* fcmpgt-compact: fcmp/gt $fsdm, $fsdn */
1443 static SEM_PC
1444 SEM_FN_NAME (sh64_compact,fcmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1446 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1447 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1448 int UNUSED written = 0;
1449 IADDR UNUSED pc = abuf->addr;
1450 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1452 if (GET_H_PRBIT ()) {
1454 BI opval = sh64_fcmpgtd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1455 SET_H_TBIT (opval);
1456 written |= (1 << 3);
1457 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1459 } else {
1461 BI opval = sh64_fcmpgts (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1462 SET_H_TBIT (opval);
1463 written |= (1 << 3);
1464 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1468 abuf->written = written;
1469 return vpc;
1470 #undef FLD
1473 /* fcnvds-compact: fcnvds $drn, fpul */
1475 static SEM_PC
1476 SEM_FN_NAME (sh64_compact,fcnvds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1478 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1479 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1480 int UNUSED written = 0;
1481 IADDR UNUSED pc = abuf->addr;
1482 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1485 SF opval = sh64_fcnvds (current_cpu, GET_H_DRC (FLD (f_dn)));
1486 CPU (h_fr[((UINT) 32)]) = opval;
1487 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1490 return vpc;
1491 #undef FLD
1494 /* fcnvsd-compact: fcnvsd fpul, $drn */
1496 static SEM_PC
1497 SEM_FN_NAME (sh64_compact,fcnvsd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1499 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1500 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1501 int UNUSED written = 0;
1502 IADDR UNUSED pc = abuf->addr;
1503 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1506 DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[((UINT) 32)]));
1507 SET_H_DRC (FLD (f_dn), opval);
1508 CGEN_TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval);
1511 return vpc;
1512 #undef FLD
1515 /* fdiv-compact: fdiv $fsdm, $fsdn */
1517 static SEM_PC
1518 SEM_FN_NAME (sh64_compact,fdiv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1520 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1521 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1522 int UNUSED written = 0;
1523 IADDR UNUSED pc = abuf->addr;
1524 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1526 if (GET_H_PRBIT ()) {
1528 DF opval = sh64_fdivd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1529 SET_H_FSD (FLD (f_rn), opval);
1530 written |= (1 << 3);
1531 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1533 } else {
1535 DF opval = sh64_fdivs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1536 SET_H_FSD (FLD (f_rn), opval);
1537 written |= (1 << 3);
1538 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1542 abuf->written = written;
1543 return vpc;
1544 #undef FLD
1547 /* fipr-compact: fipr $fvm, $fvn */
1549 static SEM_PC
1550 SEM_FN_NAME (sh64_compact,fipr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1552 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
1553 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1554 int UNUSED written = 0;
1555 IADDR UNUSED pc = abuf->addr;
1556 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1558 sh64_fipr (current_cpu, FLD (f_vm), FLD (f_vn));
1560 return vpc;
1561 #undef FLD
1564 /* flds-compact: flds $frn, fpul */
1566 static SEM_PC
1567 SEM_FN_NAME (sh64_compact,flds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1569 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1570 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1571 int UNUSED written = 0;
1572 IADDR UNUSED pc = abuf->addr;
1573 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1576 SF opval = GET_H_FRC (FLD (f_rn));
1577 CPU (h_fr[((UINT) 32)]) = opval;
1578 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1581 return vpc;
1582 #undef FLD
1585 /* fldi0-compact: fldi0 $frn */
1587 static SEM_PC
1588 SEM_FN_NAME (sh64_compact,fldi0_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1590 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1591 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1592 int UNUSED written = 0;
1593 IADDR UNUSED pc = abuf->addr;
1594 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1597 SF opval = sh64_fldi0 (current_cpu);
1598 SET_H_FRC (FLD (f_rn), opval);
1599 CGEN_TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1602 return vpc;
1603 #undef FLD
1606 /* fldi1-compact: fldi1 $frn */
1608 static SEM_PC
1609 SEM_FN_NAME (sh64_compact,fldi1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1611 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1612 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1613 int UNUSED written = 0;
1614 IADDR UNUSED pc = abuf->addr;
1615 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1618 SF opval = sh64_fldi1 (current_cpu);
1619 SET_H_FRC (FLD (f_rn), opval);
1620 CGEN_TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1623 return vpc;
1624 #undef FLD
1627 /* float-compact: float fpul, $fsdn */
1629 static SEM_PC
1630 SEM_FN_NAME (sh64_compact,float_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1632 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1633 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1634 int UNUSED written = 0;
1635 IADDR UNUSED pc = abuf->addr;
1636 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1638 if (GET_H_PRBIT ()) {
1640 DF opval = sh64_floatld (current_cpu, CPU (h_fr[((UINT) 32)]));
1641 SET_H_FSD (FLD (f_rn), opval);
1642 written |= (1 << 2);
1643 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1645 } else {
1647 DF opval = sh64_floatls (current_cpu, CPU (h_fr[((UINT) 32)]));
1648 SET_H_FSD (FLD (f_rn), opval);
1649 written |= (1 << 2);
1650 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1654 abuf->written = written;
1655 return vpc;
1656 #undef FLD
1659 /* fmac-compact: fmac fr0, $frm, $frn */
1661 static SEM_PC
1662 SEM_FN_NAME (sh64_compact,fmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1664 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1665 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1666 int UNUSED written = 0;
1667 IADDR UNUSED pc = abuf->addr;
1668 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1671 SF opval = sh64_fmacs (current_cpu, GET_H_FRC (((UINT) 0)), GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn)));
1672 SET_H_FRC (FLD (f_rn), opval);
1673 CGEN_TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1676 return vpc;
1677 #undef FLD
1680 /* fmov1-compact: fmov $fmovm, $fmovn */
1682 static SEM_PC
1683 SEM_FN_NAME (sh64_compact,fmov1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1685 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1686 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1687 int UNUSED written = 0;
1688 IADDR UNUSED pc = abuf->addr;
1689 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1692 DF opval = GET_H_FMOV (FLD (f_rm));
1693 SET_H_FMOV (FLD (f_rn), opval);
1694 CGEN_TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1697 return vpc;
1698 #undef FLD
1701 /* fmov2-compact: fmov @$rm, $fmovn */
1703 static SEM_PC
1704 SEM_FN_NAME (sh64_compact,fmov2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1706 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1707 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1708 int UNUSED written = 0;
1709 IADDR UNUSED pc = abuf->addr;
1710 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1712 if (NOTBI (GET_H_SZBIT ())) {
1714 DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1715 SET_H_FMOV (FLD (f_rn), opval);
1716 written |= (1 << 4);
1717 CGEN_TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1719 } else {
1721 DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1722 SET_H_FMOV (FLD (f_rn), opval);
1723 written |= (1 << 4);
1724 CGEN_TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1728 abuf->written = written;
1729 return vpc;
1730 #undef FLD
1733 /* fmov3-compact: fmov @${rm}+, fmovn */
1735 static SEM_PC
1736 SEM_FN_NAME (sh64_compact,fmov3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1738 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1739 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1740 int UNUSED written = 0;
1741 IADDR UNUSED pc = abuf->addr;
1742 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1744 if (NOTBI (GET_H_SZBIT ())) {
1747 DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1748 SET_H_FMOV (FLD (f_rn), opval);
1749 written |= (1 << 4);
1750 CGEN_TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1753 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
1754 SET_H_GRC (FLD (f_rm), opval);
1755 written |= (1 << 5);
1756 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1759 } else {
1762 DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1763 SET_H_FMOV (FLD (f_rn), opval);
1764 written |= (1 << 4);
1765 CGEN_TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1768 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 8);
1769 SET_H_GRC (FLD (f_rm), opval);
1770 written |= (1 << 5);
1771 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1776 abuf->written = written;
1777 return vpc;
1778 #undef FLD
1781 /* fmov4-compact: fmov @(r0, $rm), $fmovn */
1783 static SEM_PC
1784 SEM_FN_NAME (sh64_compact,fmov4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1786 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1787 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1788 int UNUSED written = 0;
1789 IADDR UNUSED pc = abuf->addr;
1790 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1792 if (NOTBI (GET_H_SZBIT ())) {
1794 DF opval = GETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
1795 SET_H_FMOV (FLD (f_rn), opval);
1796 written |= (1 << 5);
1797 CGEN_TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1799 } else {
1801 DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
1802 SET_H_FMOV (FLD (f_rn), opval);
1803 written |= (1 << 5);
1804 CGEN_TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1808 abuf->written = written;
1809 return vpc;
1810 #undef FLD
1813 /* fmov5-compact: fmov $fmovm, @$rn */
1815 static SEM_PC
1816 SEM_FN_NAME (sh64_compact,fmov5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1818 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1819 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1820 int UNUSED written = 0;
1821 IADDR UNUSED pc = abuf->addr;
1822 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1824 if (NOTBI (GET_H_SZBIT ())) {
1826 SF opval = GET_H_FMOV (FLD (f_rm));
1827 SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1828 written |= (1 << 4);
1829 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1831 } else {
1833 DF opval = GET_H_FMOV (FLD (f_rm));
1834 SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1835 written |= (1 << 3);
1836 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1840 abuf->written = written;
1841 return vpc;
1842 #undef FLD
1845 /* fmov6-compact: fmov $fmovm, @-$rn */
1847 static SEM_PC
1848 SEM_FN_NAME (sh64_compact,fmov6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1850 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1851 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1852 int UNUSED written = 0;
1853 IADDR UNUSED pc = abuf->addr;
1854 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1856 if (NOTBI (GET_H_SZBIT ())) {
1859 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
1860 SET_H_GRC (FLD (f_rn), opval);
1861 written |= (1 << 5);
1862 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1865 SF opval = GET_H_FMOV (FLD (f_rm));
1866 SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1867 written |= (1 << 4);
1868 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1871 } else {
1874 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 8);
1875 SET_H_GRC (FLD (f_rn), opval);
1876 written |= (1 << 5);
1877 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1880 DF opval = GET_H_FMOV (FLD (f_rm));
1881 SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1882 written |= (1 << 3);
1883 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1888 abuf->written = written;
1889 return vpc;
1890 #undef FLD
1893 /* fmov7-compact: fmov $fmovm, @(r0, $rn) */
1895 static SEM_PC
1896 SEM_FN_NAME (sh64_compact,fmov7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1898 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1899 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1900 int UNUSED written = 0;
1901 IADDR UNUSED pc = abuf->addr;
1902 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1904 if (NOTBI (GET_H_SZBIT ())) {
1906 SF opval = GET_H_FMOV (FLD (f_rm));
1907 SETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
1908 written |= (1 << 5);
1909 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1911 } else {
1913 DF opval = GET_H_FMOV (FLD (f_rm));
1914 SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
1915 written |= (1 << 4);
1916 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1920 abuf->written = written;
1921 return vpc;
1922 #undef FLD
1925 /* fmov8-compact: fmov.d @($imm12x8, $rm), $drn */
1927 static SEM_PC
1928 SEM_FN_NAME (sh64_compact,fmov8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1930 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1931 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1932 int UNUSED written = 0;
1933 IADDR UNUSED pc = abuf->addr;
1934 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1937 DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x8)));
1938 SET_H_DRC (FLD (f_dn), opval);
1939 CGEN_TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval);
1942 return vpc;
1943 #undef FLD
1946 /* fmov9-compact: mov.l $drm, @($imm12x8, $rn) */
1948 static SEM_PC
1949 SEM_FN_NAME (sh64_compact,fmov9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1951 #define FLD(f) abuf->fields.sfmt_fmov9_compact.f
1952 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1953 int UNUSED written = 0;
1954 IADDR UNUSED pc = abuf->addr;
1955 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1958 DF opval = GET_H_DRC (FLD (f_dm));
1959 SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x8)), opval);
1960 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1963 return vpc;
1964 #undef FLD
1967 /* fmul-compact: fmul $fsdm, $fsdn */
1969 static SEM_PC
1970 SEM_FN_NAME (sh64_compact,fmul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1972 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1973 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1974 int UNUSED written = 0;
1975 IADDR UNUSED pc = abuf->addr;
1976 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1978 if (GET_H_PRBIT ()) {
1980 DF opval = sh64_fmuld (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1981 SET_H_FSD (FLD (f_rn), opval);
1982 written |= (1 << 3);
1983 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1985 } else {
1987 DF opval = sh64_fmuls (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1988 SET_H_FSD (FLD (f_rn), opval);
1989 written |= (1 << 3);
1990 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1994 abuf->written = written;
1995 return vpc;
1996 #undef FLD
1999 /* fneg-compact: fneg $fsdn */
2001 static SEM_PC
2002 SEM_FN_NAME (sh64_compact,fneg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2004 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2005 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2006 int UNUSED written = 0;
2007 IADDR UNUSED pc = abuf->addr;
2008 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2010 if (GET_H_PRBIT ()) {
2012 DF opval = sh64_fnegd (current_cpu, GET_H_FSD (FLD (f_rn)));
2013 SET_H_FSD (FLD (f_rn), opval);
2014 written |= (1 << 2);
2015 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2017 } else {
2019 DF opval = sh64_fnegs (current_cpu, GET_H_FSD (FLD (f_rn)));
2020 SET_H_FSD (FLD (f_rn), opval);
2021 written |= (1 << 2);
2022 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2026 abuf->written = written;
2027 return vpc;
2028 #undef FLD
2031 /* frchg-compact: frchg */
2033 static SEM_PC
2034 SEM_FN_NAME (sh64_compact,frchg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2036 #define FLD(f) abuf->fields.sfmt_empty.f
2037 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2038 int UNUSED written = 0;
2039 IADDR UNUSED pc = abuf->addr;
2040 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2043 BI opval = NOTBI (GET_H_FRBIT ());
2044 SET_H_FRBIT (opval);
2045 CGEN_TRACE_RESULT (current_cpu, abuf, "frbit", 'x', opval);
2048 return vpc;
2049 #undef FLD
2052 /* fschg-compact: fschg */
2054 static SEM_PC
2055 SEM_FN_NAME (sh64_compact,fschg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2057 #define FLD(f) abuf->fields.sfmt_empty.f
2058 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2059 int UNUSED written = 0;
2060 IADDR UNUSED pc = abuf->addr;
2061 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2064 BI opval = NOTBI (GET_H_SZBIT ());
2065 SET_H_SZBIT (opval);
2066 CGEN_TRACE_RESULT (current_cpu, abuf, "szbit", 'x', opval);
2069 return vpc;
2070 #undef FLD
2073 /* fsqrt-compact: fsqrt $fsdn */
2075 static SEM_PC
2076 SEM_FN_NAME (sh64_compact,fsqrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2078 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2079 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2080 int UNUSED written = 0;
2081 IADDR UNUSED pc = abuf->addr;
2082 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2084 if (GET_H_PRBIT ()) {
2086 DF opval = sh64_fsqrtd (current_cpu, GET_H_FSD (FLD (f_rn)));
2087 SET_H_FSD (FLD (f_rn), opval);
2088 written |= (1 << 2);
2089 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2091 } else {
2093 DF opval = sh64_fsqrts (current_cpu, GET_H_FSD (FLD (f_rn)));
2094 SET_H_FSD (FLD (f_rn), opval);
2095 written |= (1 << 2);
2096 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2100 abuf->written = written;
2101 return vpc;
2102 #undef FLD
2105 /* fsts-compact: fsts fpul, $frn */
2107 static SEM_PC
2108 SEM_FN_NAME (sh64_compact,fsts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2110 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2111 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2112 int UNUSED written = 0;
2113 IADDR UNUSED pc = abuf->addr;
2114 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2117 SF opval = CPU (h_fr[((UINT) 32)]);
2118 SET_H_FRC (FLD (f_rn), opval);
2119 CGEN_TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
2122 return vpc;
2123 #undef FLD
2126 /* fsub-compact: fsub $fsdm, $fsdn */
2128 static SEM_PC
2129 SEM_FN_NAME (sh64_compact,fsub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2131 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2132 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2133 int UNUSED written = 0;
2134 IADDR UNUSED pc = abuf->addr;
2135 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2137 if (GET_H_PRBIT ()) {
2139 DF opval = sh64_fsubd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
2140 SET_H_FSD (FLD (f_rn), opval);
2141 written |= (1 << 3);
2142 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2144 } else {
2146 DF opval = sh64_fsubs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
2147 SET_H_FSD (FLD (f_rn), opval);
2148 written |= (1 << 3);
2149 CGEN_TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2153 abuf->written = written;
2154 return vpc;
2155 #undef FLD
2158 /* ftrc-compact: ftrc $fsdn, fpul */
2160 static SEM_PC
2161 SEM_FN_NAME (sh64_compact,ftrc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2163 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2164 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2165 int UNUSED written = 0;
2166 IADDR UNUSED pc = abuf->addr;
2167 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2170 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)))));
2171 CPU (h_fr[((UINT) 32)]) = opval;
2172 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2175 return vpc;
2176 #undef FLD
2179 /* ftrv-compact: ftrv xmtrx, $fvn */
2181 static SEM_PC
2182 SEM_FN_NAME (sh64_compact,ftrv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2184 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
2185 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2186 int UNUSED written = 0;
2187 IADDR UNUSED pc = abuf->addr;
2188 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2190 sh64_ftrv (current_cpu, FLD (f_vn));
2192 return vpc;
2193 #undef FLD
2196 /* jmp-compact: jmp @$rn */
2198 static SEM_PC
2199 SEM_FN_NAME (sh64_compact,jmp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2201 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2202 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2203 int UNUSED written = 0;
2204 IADDR UNUSED pc = abuf->addr;
2205 SEM_BRANCH_INIT
2206 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2210 UDI opval = ADDDI (pc, 2);
2211 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2212 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2214 ((void) 0); /*nop*/
2217 UDI opval = GET_H_GRC (FLD (f_rn));
2218 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2219 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2222 ((void) 0); /*nop*/
2225 SEM_BRANCH_FINI (vpc);
2226 return vpc;
2227 #undef FLD
2230 /* jsr-compact: jsr @$rn */
2232 static SEM_PC
2233 SEM_FN_NAME (sh64_compact,jsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2235 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2236 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2237 int UNUSED written = 0;
2238 IADDR UNUSED pc = abuf->addr;
2239 SEM_BRANCH_INIT
2240 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2245 SI opval = ADDDI (pc, 4);
2246 SET_H_PR (opval);
2247 CGEN_TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2251 UDI opval = ADDDI (pc, 2);
2252 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2253 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2255 ((void) 0); /*nop*/
2258 UDI opval = GET_H_GRC (FLD (f_rn));
2259 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2260 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2263 ((void) 0); /*nop*/
2266 SEM_BRANCH_FINI (vpc);
2267 return vpc;
2268 #undef FLD
2271 /* ldc-gbr-compact: ldc $rn, gbr */
2273 static SEM_PC
2274 SEM_FN_NAME (sh64_compact,ldc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2276 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2277 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2278 int UNUSED written = 0;
2279 IADDR UNUSED pc = abuf->addr;
2280 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2283 SI opval = GET_H_GRC (FLD (f_rn));
2284 SET_H_GBR (opval);
2285 CGEN_TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval);
2288 return vpc;
2289 #undef FLD
2292 /* ldc-vbr-compact: ldc $rn, vbr */
2294 static SEM_PC
2295 SEM_FN_NAME (sh64_compact,ldc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2297 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2298 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2299 int UNUSED written = 0;
2300 IADDR UNUSED pc = abuf->addr;
2301 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2304 SI opval = GET_H_GRC (FLD (f_rn));
2305 SET_H_VBR (opval);
2306 CGEN_TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval);
2309 return vpc;
2310 #undef FLD
2313 /* ldc-sr-compact: ldc $rn, sr */
2315 static SEM_PC
2316 SEM_FN_NAME (sh64_compact,ldc_sr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2318 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2319 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2320 int UNUSED written = 0;
2321 IADDR UNUSED pc = abuf->addr;
2322 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2325 SI opval = GET_H_GRC (FLD (f_rn));
2326 CPU (h_sr) = opval;
2327 CGEN_TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval);
2330 return vpc;
2331 #undef FLD
2334 /* ldcl-gbr-compact: ldc.l @${rn}+, gbr */
2336 static SEM_PC
2337 SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2339 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2340 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2341 int UNUSED written = 0;
2342 IADDR UNUSED pc = abuf->addr;
2343 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2347 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2348 SET_H_GBR (opval);
2349 CGEN_TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval);
2352 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2353 SET_H_GRC (FLD (f_rn), opval);
2354 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2358 return vpc;
2359 #undef FLD
2362 /* ldcl-vbr-compact: ldc.l @${rn}+, vbr */
2364 static SEM_PC
2365 SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2367 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2368 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2369 int UNUSED written = 0;
2370 IADDR UNUSED pc = abuf->addr;
2371 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2375 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2376 SET_H_VBR (opval);
2377 CGEN_TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval);
2380 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2381 SET_H_GRC (FLD (f_rn), opval);
2382 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2386 return vpc;
2387 #undef FLD
2390 /* lds-fpscr-compact: lds $rn, fpscr */
2392 static SEM_PC
2393 SEM_FN_NAME (sh64_compact,lds_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2395 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2396 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2397 int UNUSED written = 0;
2398 IADDR UNUSED pc = abuf->addr;
2399 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2402 SI opval = GET_H_GRC (FLD (f_rn));
2403 CPU (h_fpscr) = opval;
2404 CGEN_TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
2407 return vpc;
2408 #undef FLD
2411 /* ldsl-fpscr-compact: lds.l @${rn}+, fpscr */
2413 static SEM_PC
2414 SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2416 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2417 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2418 int UNUSED written = 0;
2419 IADDR UNUSED pc = abuf->addr;
2420 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2424 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2425 CPU (h_fpscr) = opval;
2426 CGEN_TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
2429 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2430 SET_H_GRC (FLD (f_rn), opval);
2431 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2435 return vpc;
2436 #undef FLD
2439 /* lds-fpul-compact: lds $rn, fpul */
2441 static SEM_PC
2442 SEM_FN_NAME (sh64_compact,lds_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2444 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2445 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2446 int UNUSED written = 0;
2447 IADDR UNUSED pc = abuf->addr;
2448 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2451 SF opval = SUBWORDSISF (GET_H_GRC (FLD (f_rn)));
2452 CPU (h_fr[((UINT) 32)]) = opval;
2453 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2456 return vpc;
2457 #undef FLD
2460 /* ldsl-fpul-compact: lds.l @${rn}+, fpul */
2462 static SEM_PC
2463 SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2465 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2466 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2467 int UNUSED written = 0;
2468 IADDR UNUSED pc = abuf->addr;
2469 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2473 SF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2474 CPU (h_fr[((UINT) 32)]) = opval;
2475 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2478 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2479 SET_H_GRC (FLD (f_rn), opval);
2480 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2484 return vpc;
2485 #undef FLD
2488 /* lds-mach-compact: lds $rn, mach */
2490 static SEM_PC
2491 SEM_FN_NAME (sh64_compact,lds_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2493 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2494 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2495 int UNUSED written = 0;
2496 IADDR UNUSED pc = abuf->addr;
2497 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2500 SI opval = GET_H_GRC (FLD (f_rn));
2501 SET_H_MACH (opval);
2502 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2505 return vpc;
2506 #undef FLD
2509 /* ldsl-mach-compact: lds.l @${rn}+, mach */
2511 static SEM_PC
2512 SEM_FN_NAME (sh64_compact,ldsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2514 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2515 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2516 int UNUSED written = 0;
2517 IADDR UNUSED pc = abuf->addr;
2518 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2522 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2523 SET_H_MACH (opval);
2524 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2527 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2528 SET_H_GRC (FLD (f_rn), opval);
2529 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2533 return vpc;
2534 #undef FLD
2537 /* lds-macl-compact: lds $rn, macl */
2539 static SEM_PC
2540 SEM_FN_NAME (sh64_compact,lds_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2542 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2543 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2544 int UNUSED written = 0;
2545 IADDR UNUSED pc = abuf->addr;
2546 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2549 SI opval = GET_H_GRC (FLD (f_rn));
2550 SET_H_MACL (opval);
2551 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2554 return vpc;
2555 #undef FLD
2558 /* ldsl-macl-compact: lds.l @${rn}+, macl */
2560 static SEM_PC
2561 SEM_FN_NAME (sh64_compact,ldsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2563 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2564 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2565 int UNUSED written = 0;
2566 IADDR UNUSED pc = abuf->addr;
2567 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2571 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2572 SET_H_MACL (opval);
2573 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2576 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2577 SET_H_GRC (FLD (f_rn), opval);
2578 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2582 return vpc;
2583 #undef FLD
2586 /* lds-pr-compact: lds $rn, pr */
2588 static SEM_PC
2589 SEM_FN_NAME (sh64_compact,lds_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2591 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2592 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2593 int UNUSED written = 0;
2594 IADDR UNUSED pc = abuf->addr;
2595 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2598 SI opval = GET_H_GRC (FLD (f_rn));
2599 SET_H_PR (opval);
2600 CGEN_TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2603 return vpc;
2604 #undef FLD
2607 /* ldsl-pr-compact: lds.l @${rn}+, pr */
2609 static SEM_PC
2610 SEM_FN_NAME (sh64_compact,ldsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2612 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2613 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2614 int UNUSED written = 0;
2615 IADDR UNUSED pc = abuf->addr;
2616 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2620 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2621 SET_H_PR (opval);
2622 CGEN_TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2625 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2626 SET_H_GRC (FLD (f_rn), opval);
2627 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2631 return vpc;
2632 #undef FLD
2635 /* macl-compact: mac.l @${rm}+, @${rn}+ */
2637 static SEM_PC
2638 SEM_FN_NAME (sh64_compact,macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2640 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2641 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2642 int UNUSED written = 0;
2643 IADDR UNUSED pc = abuf->addr;
2644 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2647 DI tmp_tmpry;
2648 DI tmp_mac;
2649 DI tmp_result;
2650 SI tmp_x;
2651 SI tmp_y;
2652 tmp_x = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2654 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2655 SET_H_GRC (FLD (f_rn), opval);
2656 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2658 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2661 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2662 SET_H_GRC (FLD (f_rn), opval);
2663 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2666 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
2667 SET_H_GRC (FLD (f_rm), opval);
2668 written |= (1 << 11);
2669 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2673 tmp_y = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
2675 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
2676 SET_H_GRC (FLD (f_rm), opval);
2677 written |= (1 << 11);
2678 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2680 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2681 tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ()));
2682 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2684 if (GET_H_SBIT ()) {
2686 SI tmp_min;
2687 SI tmp_max;
2688 tmp_max = SRLDI (INVDI (0), 16);
2689 tmp_min = SRLDI (INVDI (0), 15);
2690 if (GTDI (tmp_result, tmp_max)) {
2691 tmp_result = tmp_max;
2692 } else {
2693 if (LTDI (tmp_result, tmp_min)) {
2694 tmp_result = tmp_min;
2700 SI opval = SUBWORDDISI (tmp_result, 0);
2701 SET_H_MACH (opval);
2702 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2705 SI opval = SUBWORDDISI (tmp_result, 1);
2706 SET_H_MACL (opval);
2707 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2712 abuf->written = written;
2713 return vpc;
2714 #undef FLD
2717 /* macw-compact: mac.w @${rm}+, @${rn}+ */
2719 static SEM_PC
2720 SEM_FN_NAME (sh64_compact,macw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2722 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2723 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2724 int UNUSED written = 0;
2725 IADDR UNUSED pc = abuf->addr;
2726 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2729 SI tmp_tmpry;
2730 DI tmp_mac;
2731 DI tmp_result;
2732 HI tmp_x;
2733 HI tmp_y;
2734 tmp_x = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2736 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2);
2737 SET_H_GRC (FLD (f_rn), opval);
2738 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2740 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2743 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2);
2744 SET_H_GRC (FLD (f_rn), opval);
2745 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2748 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
2749 SET_H_GRC (FLD (f_rm), opval);
2750 written |= (1 << 11);
2751 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2755 tmp_y = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
2757 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
2758 SET_H_GRC (FLD (f_rm), opval);
2759 written |= (1 << 11);
2760 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2762 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2763 if (GET_H_SBIT ()) {
2765 if (ADDOFSI (tmp_tmpry, GET_H_MACL (), 0)) {
2767 SI opval = 1;
2768 SET_H_MACH (opval);
2769 written |= (1 << 9);
2770 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2774 SI opval = ADDSI (tmp_tmpry, GET_H_MACL ());
2775 SET_H_MACL (opval);
2776 written |= (1 << 10);
2777 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2780 } else {
2782 tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ()));
2783 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2785 SI opval = SUBWORDDISI (tmp_result, 0);
2786 SET_H_MACH (opval);
2787 written |= (1 << 9);
2788 CGEN_TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2791 SI opval = SUBWORDDISI (tmp_result, 1);
2792 SET_H_MACL (opval);
2793 written |= (1 << 10);
2794 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2800 abuf->written = written;
2801 return vpc;
2802 #undef FLD
2805 /* mov-compact: mov $rm64, $rn64 */
2807 static SEM_PC
2808 SEM_FN_NAME (sh64_compact,mov_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2810 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2811 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2812 int UNUSED written = 0;
2813 IADDR UNUSED pc = abuf->addr;
2814 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2817 DI opval = GET_H_GR (FLD (f_rm));
2818 SET_H_GR (FLD (f_rn), opval);
2819 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2822 return vpc;
2823 #undef FLD
2826 /* movi-compact: mov #$imm8, $rn */
2828 static SEM_PC
2829 SEM_FN_NAME (sh64_compact,movi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2831 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2832 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2833 int UNUSED written = 0;
2834 IADDR UNUSED pc = abuf->addr;
2835 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2838 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2839 SET_H_GRC (FLD (f_rn), opval);
2840 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2843 return vpc;
2844 #undef FLD
2847 /* movi20-compact: movi20 #$imm20, $rn */
2849 static SEM_PC
2850 SEM_FN_NAME (sh64_compact,movi20_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2852 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
2853 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2854 int UNUSED written = 0;
2855 IADDR UNUSED pc = abuf->addr;
2856 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2859 SI opval = FLD (f_imm20);
2860 SET_H_GRC (FLD (f_rn), opval);
2861 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2864 return vpc;
2865 #undef FLD
2868 /* movb1-compact: mov.b $rm, @$rn */
2870 static SEM_PC
2871 SEM_FN_NAME (sh64_compact,movb1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2873 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2874 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2875 int UNUSED written = 0;
2876 IADDR UNUSED pc = abuf->addr;
2877 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2880 UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2881 SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
2882 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2885 return vpc;
2886 #undef FLD
2889 /* movb2-compact: mov.b $rm, @-$rn */
2891 static SEM_PC
2892 SEM_FN_NAME (sh64_compact,movb2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2894 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2895 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2896 int UNUSED written = 0;
2897 IADDR UNUSED pc = abuf->addr;
2898 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2901 DI tmp_addr;
2902 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 1);
2904 UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2905 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2906 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2909 SI opval = tmp_addr;
2910 SET_H_GRC (FLD (f_rn), opval);
2911 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2915 return vpc;
2916 #undef FLD
2919 /* movb3-compact: mov.b $rm, @(r0,$rn) */
2921 static SEM_PC
2922 SEM_FN_NAME (sh64_compact,movb3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2924 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2925 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2926 int UNUSED written = 0;
2927 IADDR UNUSED pc = abuf->addr;
2928 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2931 UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2932 SETMEMUQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
2933 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2936 return vpc;
2937 #undef FLD
2940 /* movb4-compact: mov.b r0, @($imm8, gbr) */
2942 static SEM_PC
2943 SEM_FN_NAME (sh64_compact,movb4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2945 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2946 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2947 int UNUSED written = 0;
2948 IADDR UNUSED pc = abuf->addr;
2949 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2952 DI tmp_addr;
2953 tmp_addr = ADDSI (GET_H_GBR (), FLD (f_imm8));
2955 UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3);
2956 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2957 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2961 return vpc;
2962 #undef FLD
2965 /* movb5-compact: mov.b r0, @($imm4, $rm) */
2967 static SEM_PC
2968 SEM_FN_NAME (sh64_compact,movb5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2970 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2971 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2972 int UNUSED written = 0;
2973 IADDR UNUSED pc = abuf->addr;
2974 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2977 DI tmp_addr;
2978 tmp_addr = ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4));
2980 UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3);
2981 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2982 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2986 return vpc;
2987 #undef FLD
2990 /* movb6-compact: mov.b @$rm, $rn */
2992 static SEM_PC
2993 SEM_FN_NAME (sh64_compact,movb6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2995 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2996 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2997 int UNUSED written = 0;
2998 IADDR UNUSED pc = abuf->addr;
2999 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3002 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm))));
3003 SET_H_GRC (FLD (f_rn), opval);
3004 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3007 return vpc;
3008 #undef FLD
3011 /* movb7-compact: mov.b @${rm}+, $rn */
3013 static SEM_PC
3014 SEM_FN_NAME (sh64_compact,movb7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3016 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3017 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3018 int UNUSED written = 0;
3019 IADDR UNUSED pc = abuf->addr;
3020 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3023 QI tmp_data;
3024 tmp_data = GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3025 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3027 SI opval = EXTQISI (tmp_data);
3028 SET_H_GRC (FLD (f_rm), opval);
3029 written |= (1 << 4);
3030 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3032 } else {
3034 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 1);
3035 SET_H_GRC (FLD (f_rm), opval);
3036 written |= (1 << 4);
3037 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3041 SI opval = EXTQISI (tmp_data);
3042 SET_H_GRC (FLD (f_rn), opval);
3043 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3047 abuf->written = written;
3048 return vpc;
3049 #undef FLD
3052 /* movb8-compact: mov.b @(r0, $rm), $rn */
3054 static SEM_PC
3055 SEM_FN_NAME (sh64_compact,movb8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3057 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3058 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3059 int UNUSED written = 0;
3060 IADDR UNUSED pc = abuf->addr;
3061 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3064 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))));
3065 SET_H_GRC (FLD (f_rn), opval);
3066 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3069 return vpc;
3070 #undef FLD
3073 /* movb9-compact: mov.b @($imm8, gbr), r0 */
3075 static SEM_PC
3076 SEM_FN_NAME (sh64_compact,movb9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3078 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3079 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3080 int UNUSED written = 0;
3081 IADDR UNUSED pc = abuf->addr;
3082 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3085 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8))));
3086 SET_H_GRC (((UINT) 0), opval);
3087 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3090 return vpc;
3091 #undef FLD
3094 /* movb10-compact: mov.b @($imm4, $rm), r0 */
3096 static SEM_PC
3097 SEM_FN_NAME (sh64_compact,movb10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3099 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
3100 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3101 int UNUSED written = 0;
3102 IADDR UNUSED pc = abuf->addr;
3103 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3106 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4))));
3107 SET_H_GRC (((UINT) 0), opval);
3108 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3111 return vpc;
3112 #undef FLD
3115 /* movl1-compact: mov.l $rm, @$rn */
3117 static SEM_PC
3118 SEM_FN_NAME (sh64_compact,movl1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3120 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3121 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3122 int UNUSED written = 0;
3123 IADDR UNUSED pc = abuf->addr;
3124 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3127 SI opval = GET_H_GRC (FLD (f_rm));
3128 SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3129 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3132 return vpc;
3133 #undef FLD
3136 /* movl2-compact: mov.l $rm, @-$rn */
3138 static SEM_PC
3139 SEM_FN_NAME (sh64_compact,movl2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3141 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3142 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3143 int UNUSED written = 0;
3144 IADDR UNUSED pc = abuf->addr;
3145 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3148 SI tmp_addr;
3149 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
3151 SI opval = GET_H_GRC (FLD (f_rm));
3152 SETMEMSI (current_cpu, pc, tmp_addr, opval);
3153 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3156 SI opval = tmp_addr;
3157 SET_H_GRC (FLD (f_rn), opval);
3158 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3162 return vpc;
3163 #undef FLD
3166 /* movl3-compact: mov.l $rm, @(r0, $rn) */
3168 static SEM_PC
3169 SEM_FN_NAME (sh64_compact,movl3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3171 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3172 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3173 int UNUSED written = 0;
3174 IADDR UNUSED pc = abuf->addr;
3175 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3178 SI opval = GET_H_GRC (FLD (f_rm));
3179 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
3180 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3183 return vpc;
3184 #undef FLD
3187 /* movl4-compact: mov.l r0, @($imm8x4, gbr) */
3189 static SEM_PC
3190 SEM_FN_NAME (sh64_compact,movl4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3192 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3193 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3194 int UNUSED written = 0;
3195 IADDR UNUSED pc = abuf->addr;
3196 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3199 SI opval = GET_H_GRC (((UINT) 0));
3200 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)), opval);
3201 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3204 return vpc;
3205 #undef FLD
3208 /* movl5-compact: mov.l $rm, @($imm4x4, $rn) */
3210 static SEM_PC
3211 SEM_FN_NAME (sh64_compact,movl5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3213 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3214 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3215 int UNUSED written = 0;
3216 IADDR UNUSED pc = abuf->addr;
3217 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3220 SI opval = GET_H_GRC (FLD (f_rm));
3221 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm4x4)), opval);
3222 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3225 return vpc;
3226 #undef FLD
3229 /* movl6-compact: mov.l @$rm, $rn */
3231 static SEM_PC
3232 SEM_FN_NAME (sh64_compact,movl6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3234 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3235 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3236 int UNUSED written = 0;
3237 IADDR UNUSED pc = abuf->addr;
3238 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3241 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3242 SET_H_GRC (FLD (f_rn), opval);
3243 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3246 return vpc;
3247 #undef FLD
3250 /* movl7-compact: mov.l @${rm}+, $rn */
3252 static SEM_PC
3253 SEM_FN_NAME (sh64_compact,movl7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3255 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3256 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3257 int UNUSED written = 0;
3258 IADDR UNUSED pc = abuf->addr;
3259 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3263 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3264 SET_H_GRC (FLD (f_rn), opval);
3265 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3267 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3269 SI opval = GET_H_GRC (FLD (f_rn));
3270 SET_H_GRC (FLD (f_rm), opval);
3271 written |= (1 << 5);
3272 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3274 } else {
3276 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
3277 SET_H_GRC (FLD (f_rm), opval);
3278 written |= (1 << 5);
3279 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3284 abuf->written = written;
3285 return vpc;
3286 #undef FLD
3289 /* movl8-compact: mov.l @(r0, $rm), $rn */
3291 static SEM_PC
3292 SEM_FN_NAME (sh64_compact,movl8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3294 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3295 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3296 int UNUSED written = 0;
3297 IADDR UNUSED pc = abuf->addr;
3298 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3301 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
3302 SET_H_GRC (FLD (f_rn), opval);
3303 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3306 return vpc;
3307 #undef FLD
3310 /* movl9-compact: mov.l @($imm8x4, gbr), r0 */
3312 static SEM_PC
3313 SEM_FN_NAME (sh64_compact,movl9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3315 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3316 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3317 int UNUSED written = 0;
3318 IADDR UNUSED pc = abuf->addr;
3319 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3322 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)));
3323 SET_H_GRC (((UINT) 0), opval);
3324 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3327 return vpc;
3328 #undef FLD
3331 /* movl10-compact: mov.l @($imm8x4, pc), $rn */
3333 static SEM_PC
3334 SEM_FN_NAME (sh64_compact,movl10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3336 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3337 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3338 int UNUSED written = 0;
3339 IADDR UNUSED pc = abuf->addr;
3340 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3343 SI opval = GETMEMSI (current_cpu, pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3344 SET_H_GRC (FLD (f_rn), opval);
3345 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3348 return vpc;
3349 #undef FLD
3352 /* movl11-compact: mov.l @($imm4x4, $rm), $rn */
3354 static SEM_PC
3355 SEM_FN_NAME (sh64_compact,movl11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3357 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3358 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3359 int UNUSED written = 0;
3360 IADDR UNUSED pc = abuf->addr;
3361 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3364 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x4)));
3365 SET_H_GRC (FLD (f_rn), opval);
3366 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3369 return vpc;
3370 #undef FLD
3373 /* movl12-compact: mov.l @($imm12x4, $rm), $rn */
3375 static SEM_PC
3376 SEM_FN_NAME (sh64_compact,movl12_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3378 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3379 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3380 int UNUSED written = 0;
3381 IADDR UNUSED pc = abuf->addr;
3382 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3385 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x4)));
3386 SET_H_GRC (FLD (f_rn), opval);
3387 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3390 return vpc;
3391 #undef FLD
3394 /* movl13-compact: mov.l $rm, @($imm12x4, $rn) */
3396 static SEM_PC
3397 SEM_FN_NAME (sh64_compact,movl13_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3399 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3401 int UNUSED written = 0;
3402 IADDR UNUSED pc = abuf->addr;
3403 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3406 SI opval = GET_H_GRC (FLD (f_rm));
3407 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x4)), opval);
3408 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3411 return vpc;
3412 #undef FLD
3415 /* movw1-compact: mov.w $rm, @$rn */
3417 static SEM_PC
3418 SEM_FN_NAME (sh64_compact,movw1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3420 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3421 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3422 int UNUSED written = 0;
3423 IADDR UNUSED pc = abuf->addr;
3424 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3427 HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3428 SETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3429 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3432 return vpc;
3433 #undef FLD
3436 /* movw2-compact: mov.w $rm, @-$rn */
3438 static SEM_PC
3439 SEM_FN_NAME (sh64_compact,movw2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3441 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3442 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3443 int UNUSED written = 0;
3444 IADDR UNUSED pc = abuf->addr;
3445 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3448 DI tmp_addr;
3449 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 2);
3451 HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3452 SETMEMHI (current_cpu, pc, tmp_addr, opval);
3453 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3456 SI opval = tmp_addr;
3457 SET_H_GRC (FLD (f_rn), opval);
3458 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3462 return vpc;
3463 #undef FLD
3466 /* movw3-compact: mov.w $rm, @(r0, $rn) */
3468 static SEM_PC
3469 SEM_FN_NAME (sh64_compact,movw3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3471 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3472 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3473 int UNUSED written = 0;
3474 IADDR UNUSED pc = abuf->addr;
3475 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3478 HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3479 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
3480 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3483 return vpc;
3484 #undef FLD
3487 /* movw4-compact: mov.w r0, @($imm8x2, gbr) */
3489 static SEM_PC
3490 SEM_FN_NAME (sh64_compact,movw4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3492 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3493 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3494 int UNUSED written = 0;
3495 IADDR UNUSED pc = abuf->addr;
3496 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3499 HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1);
3500 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2)), opval);
3501 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3504 return vpc;
3505 #undef FLD
3508 /* movw5-compact: mov.w r0, @($imm4x2, $rm) */
3510 static SEM_PC
3511 SEM_FN_NAME (sh64_compact,movw5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3513 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3514 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3515 int UNUSED written = 0;
3516 IADDR UNUSED pc = abuf->addr;
3517 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3520 HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1);
3521 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2)), opval);
3522 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3525 return vpc;
3526 #undef FLD
3529 /* movw6-compact: mov.w @$rm, $rn */
3531 static SEM_PC
3532 SEM_FN_NAME (sh64_compact,movw6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3534 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3535 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3536 int UNUSED written = 0;
3537 IADDR UNUSED pc = abuf->addr;
3538 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3541 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm))));
3542 SET_H_GRC (FLD (f_rn), opval);
3543 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3546 return vpc;
3547 #undef FLD
3550 /* movw7-compact: mov.w @${rm}+, $rn */
3552 static SEM_PC
3553 SEM_FN_NAME (sh64_compact,movw7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3555 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3556 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3557 int UNUSED written = 0;
3558 IADDR UNUSED pc = abuf->addr;
3559 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3562 HI tmp_data;
3563 tmp_data = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3564 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3566 SI opval = EXTHISI (tmp_data);
3567 SET_H_GRC (FLD (f_rm), opval);
3568 written |= (1 << 4);
3569 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3571 } else {
3573 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
3574 SET_H_GRC (FLD (f_rm), opval);
3575 written |= (1 << 4);
3576 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3580 SI opval = EXTHISI (tmp_data);
3581 SET_H_GRC (FLD (f_rn), opval);
3582 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3586 abuf->written = written;
3587 return vpc;
3588 #undef FLD
3591 /* movw8-compact: mov.w @(r0, $rm), $rn */
3593 static SEM_PC
3594 SEM_FN_NAME (sh64_compact,movw8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3596 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3597 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3598 int UNUSED written = 0;
3599 IADDR UNUSED pc = abuf->addr;
3600 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3603 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))));
3604 SET_H_GRC (FLD (f_rn), opval);
3605 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3608 return vpc;
3609 #undef FLD
3612 /* movw9-compact: mov.w @($imm8x2, gbr), r0 */
3614 static SEM_PC
3615 SEM_FN_NAME (sh64_compact,movw9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3617 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3618 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3619 int UNUSED written = 0;
3620 IADDR UNUSED pc = abuf->addr;
3621 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3624 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2))));
3625 SET_H_GRC (((UINT) 0), opval);
3626 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3629 return vpc;
3630 #undef FLD
3633 /* movw10-compact: mov.w @($imm8x2, pc), $rn */
3635 static SEM_PC
3636 SEM_FN_NAME (sh64_compact,movw10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3638 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3639 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3640 int UNUSED written = 0;
3641 IADDR UNUSED pc = abuf->addr;
3642 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3645 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
3646 SET_H_GRC (FLD (f_rn), opval);
3647 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3650 return vpc;
3651 #undef FLD
3654 /* movw11-compact: mov.w @($imm4x2, $rm), r0 */
3656 static SEM_PC
3657 SEM_FN_NAME (sh64_compact,movw11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3659 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3660 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3661 int UNUSED written = 0;
3662 IADDR UNUSED pc = abuf->addr;
3663 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3666 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2))));
3667 SET_H_GRC (((UINT) 0), opval);
3668 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3671 return vpc;
3672 #undef FLD
3675 /* mova-compact: mova @($imm8x4, pc), r0 */
3677 static SEM_PC
3678 SEM_FN_NAME (sh64_compact,mova_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3680 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3681 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3682 int UNUSED written = 0;
3683 IADDR UNUSED pc = abuf->addr;
3684 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3687 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3688 SET_H_GRC (((UINT) 0), opval);
3689 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3692 return vpc;
3693 #undef FLD
3696 /* movcal-compact: movca.l r0, @$rn */
3698 static SEM_PC
3699 SEM_FN_NAME (sh64_compact,movcal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3701 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3702 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3703 int UNUSED written = 0;
3704 IADDR UNUSED pc = abuf->addr;
3705 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3708 SI opval = GET_H_GRC (((UINT) 0));
3709 SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3710 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3713 return vpc;
3714 #undef FLD
3717 /* movcol-compact: movco.l r0, @$rn */
3719 static SEM_PC
3720 SEM_FN_NAME (sh64_compact,movcol_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3722 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3723 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3724 int UNUSED written = 0;
3725 IADDR UNUSED pc = abuf->addr;
3726 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3729 SI opval = GET_H_GRC (FLD (f_rn));
3730 SET_H_GRC (FLD (f_rn), opval);
3731 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3734 return vpc;
3735 #undef FLD
3738 /* movt-compact: movt $rn */
3740 static SEM_PC
3741 SEM_FN_NAME (sh64_compact,movt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3743 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3744 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3745 int UNUSED written = 0;
3746 IADDR UNUSED pc = abuf->addr;
3747 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3750 SI opval = ZEXTBISI (GET_H_TBIT ());
3751 SET_H_GRC (FLD (f_rn), opval);
3752 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3755 return vpc;
3756 #undef FLD
3759 /* movual-compact: movua.l @$rn, r0 */
3761 static SEM_PC
3762 SEM_FN_NAME (sh64_compact,movual_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3764 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3765 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3766 int UNUSED written = 0;
3767 IADDR UNUSED pc = abuf->addr;
3768 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3771 SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
3772 SET_H_GRC (((UINT) 0), opval);
3773 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3776 return vpc;
3777 #undef FLD
3780 /* movual2-compact: movua.l @$rn+, r0 */
3782 static SEM_PC
3783 SEM_FN_NAME (sh64_compact,movual2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3785 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3786 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3787 int UNUSED written = 0;
3788 IADDR UNUSED pc = abuf->addr;
3789 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3793 SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
3794 SET_H_GRC (((UINT) 0), opval);
3795 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3798 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
3799 SET_H_GRC (FLD (f_rn), opval);
3800 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3804 return vpc;
3805 #undef FLD
3808 /* mull-compact: mul.l $rm, $rn */
3810 static SEM_PC
3811 SEM_FN_NAME (sh64_compact,mull_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3813 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3814 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3815 int UNUSED written = 0;
3816 IADDR UNUSED pc = abuf->addr;
3817 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3820 SI opval = MULSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
3821 SET_H_MACL (opval);
3822 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3825 return vpc;
3826 #undef FLD
3829 /* mulsw-compact: muls.w $rm, $rn */
3831 static SEM_PC
3832 SEM_FN_NAME (sh64_compact,mulsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3834 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3835 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3836 int UNUSED written = 0;
3837 IADDR UNUSED pc = abuf->addr;
3838 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3841 SI opval = MULSI (EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1)));
3842 SET_H_MACL (opval);
3843 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3846 return vpc;
3847 #undef FLD
3850 /* muluw-compact: mulu.w $rm, $rn */
3852 static SEM_PC
3853 SEM_FN_NAME (sh64_compact,muluw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3855 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3856 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3857 int UNUSED written = 0;
3858 IADDR UNUSED pc = abuf->addr;
3859 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3862 SI opval = MULSI (ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1)));
3863 SET_H_MACL (opval);
3864 CGEN_TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3867 return vpc;
3868 #undef FLD
3871 /* neg-compact: neg $rm, $rn */
3873 static SEM_PC
3874 SEM_FN_NAME (sh64_compact,neg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3876 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3877 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3878 int UNUSED written = 0;
3879 IADDR UNUSED pc = abuf->addr;
3880 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3883 SI opval = NEGSI (GET_H_GRC (FLD (f_rm)));
3884 SET_H_GRC (FLD (f_rn), opval);
3885 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3888 return vpc;
3889 #undef FLD
3892 /* negc-compact: negc $rm, $rn */
3894 static SEM_PC
3895 SEM_FN_NAME (sh64_compact,negc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3897 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3898 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3899 int UNUSED written = 0;
3900 IADDR UNUSED pc = abuf->addr;
3901 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3904 BI tmp_flag;
3905 tmp_flag = SUBCFSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
3907 SI opval = SUBCSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
3908 SET_H_GRC (FLD (f_rn), opval);
3909 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3912 BI opval = tmp_flag;
3913 SET_H_TBIT (opval);
3914 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
3918 return vpc;
3919 #undef FLD
3922 /* nop-compact: nop */
3924 static SEM_PC
3925 SEM_FN_NAME (sh64_compact,nop_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3927 #define FLD(f) abuf->fields.sfmt_empty.f
3928 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3929 int UNUSED written = 0;
3930 IADDR UNUSED pc = abuf->addr;
3931 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3933 ((void) 0); /*nop*/
3935 return vpc;
3936 #undef FLD
3939 /* not-compact: not $rm64, $rn64 */
3941 static SEM_PC
3942 SEM_FN_NAME (sh64_compact,not_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3944 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3945 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3946 int UNUSED written = 0;
3947 IADDR UNUSED pc = abuf->addr;
3948 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3951 DI opval = INVDI (GET_H_GR (FLD (f_rm)));
3952 SET_H_GR (FLD (f_rn), opval);
3953 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3956 return vpc;
3957 #undef FLD
3960 /* ocbi-compact: ocbi @$rn */
3962 static SEM_PC
3963 SEM_FN_NAME (sh64_compact,ocbi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3965 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3966 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3967 int UNUSED written = 0;
3968 IADDR UNUSED pc = abuf->addr;
3969 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3973 SI opval = GET_H_GRC (FLD (f_rn));
3974 SET_H_GRC (FLD (f_rn), opval);
3975 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3977 ((void) 0); /*nop*/
3980 return vpc;
3981 #undef FLD
3984 /* ocbp-compact: ocbp @$rn */
3986 static SEM_PC
3987 SEM_FN_NAME (sh64_compact,ocbp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3989 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3990 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3991 int UNUSED written = 0;
3992 IADDR UNUSED pc = abuf->addr;
3993 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3997 SI opval = GET_H_GRC (FLD (f_rn));
3998 SET_H_GRC (FLD (f_rn), opval);
3999 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4001 ((void) 0); /*nop*/
4004 return vpc;
4005 #undef FLD
4008 /* ocbwb-compact: ocbwb @$rn */
4010 static SEM_PC
4011 SEM_FN_NAME (sh64_compact,ocbwb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4013 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4014 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4015 int UNUSED written = 0;
4016 IADDR UNUSED pc = abuf->addr;
4017 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4021 SI opval = GET_H_GRC (FLD (f_rn));
4022 SET_H_GRC (FLD (f_rn), opval);
4023 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4025 ((void) 0); /*nop*/
4028 return vpc;
4029 #undef FLD
4032 /* or-compact: or $rm64, $rn64 */
4034 static SEM_PC
4035 SEM_FN_NAME (sh64_compact,or_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4037 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4038 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4039 int UNUSED written = 0;
4040 IADDR UNUSED pc = abuf->addr;
4041 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4044 DI opval = ORDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn)));
4045 SET_H_GR (FLD (f_rn), opval);
4046 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4049 return vpc;
4050 #undef FLD
4053 /* ori-compact: or #$uimm8, r0 */
4055 static SEM_PC
4056 SEM_FN_NAME (sh64_compact,ori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4058 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4059 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4060 int UNUSED written = 0;
4061 IADDR UNUSED pc = abuf->addr;
4062 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4065 SI opval = ORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4066 SET_H_GRC (((UINT) 0), opval);
4067 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4070 return vpc;
4071 #undef FLD
4074 /* orb-compact: or.b #$imm8, @(r0, gbr) */
4076 static SEM_PC
4077 SEM_FN_NAME (sh64_compact,orb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4079 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4080 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4081 int UNUSED written = 0;
4082 IADDR UNUSED pc = abuf->addr;
4083 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4086 DI tmp_addr;
4087 UQI tmp_data;
4088 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
4089 tmp_data = ORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
4091 UQI opval = tmp_data;
4092 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
4093 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4097 return vpc;
4098 #undef FLD
4101 /* pref-compact: pref @$rn */
4103 static SEM_PC
4104 SEM_FN_NAME (sh64_compact,pref_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4106 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4107 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4108 int UNUSED written = 0;
4109 IADDR UNUSED pc = abuf->addr;
4110 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4112 sh64_pref (current_cpu, GET_H_GRC (FLD (f_rn)));
4114 return vpc;
4115 #undef FLD
4118 /* rotcl-compact: rotcl $rn */
4120 static SEM_PC
4121 SEM_FN_NAME (sh64_compact,rotcl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4123 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4124 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4125 int UNUSED written = 0;
4126 IADDR UNUSED pc = abuf->addr;
4127 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4130 BI tmp_temp;
4131 tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4133 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), GET_H_TBIT ());
4134 SET_H_GRC (FLD (f_rn), opval);
4135 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4138 BI opval = ((tmp_temp) ? (1) : (0));
4139 SET_H_TBIT (opval);
4140 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4144 return vpc;
4145 #undef FLD
4148 /* rotcr-compact: rotcr $rn */
4150 static SEM_PC
4151 SEM_FN_NAME (sh64_compact,rotcr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4153 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4154 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4155 int UNUSED written = 0;
4156 IADDR UNUSED pc = abuf->addr;
4157 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4160 BI tmp_lsbit;
4161 SI tmp_temp;
4162 tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1));
4163 tmp_temp = GET_H_TBIT ();
4165 SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4166 SET_H_GRC (FLD (f_rn), opval);
4167 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4170 BI opval = ((tmp_lsbit) ? (1) : (0));
4171 SET_H_TBIT (opval);
4172 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4176 return vpc;
4177 #undef FLD
4180 /* rotl-compact: rotl $rn */
4182 static SEM_PC
4183 SEM_FN_NAME (sh64_compact,rotl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4185 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4186 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4187 int UNUSED written = 0;
4188 IADDR UNUSED pc = abuf->addr;
4189 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4192 BI tmp_temp;
4193 tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4195 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), tmp_temp);
4196 SET_H_GRC (FLD (f_rn), opval);
4197 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4200 BI opval = ((tmp_temp) ? (1) : (0));
4201 SET_H_TBIT (opval);
4202 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4206 return vpc;
4207 #undef FLD
4210 /* rotr-compact: rotr $rn */
4212 static SEM_PC
4213 SEM_FN_NAME (sh64_compact,rotr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4215 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4216 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4217 int UNUSED written = 0;
4218 IADDR UNUSED pc = abuf->addr;
4219 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4222 BI tmp_lsbit;
4223 SI tmp_temp;
4224 tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1));
4225 tmp_temp = tmp_lsbit;
4227 SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4228 SET_H_GRC (FLD (f_rn), opval);
4229 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4232 BI opval = ((tmp_lsbit) ? (1) : (0));
4233 SET_H_TBIT (opval);
4234 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4238 return vpc;
4239 #undef FLD
4242 /* rts-compact: rts */
4244 static SEM_PC
4245 SEM_FN_NAME (sh64_compact,rts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4247 #define FLD(f) abuf->fields.sfmt_empty.f
4248 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4249 int UNUSED written = 0;
4250 IADDR UNUSED pc = abuf->addr;
4251 SEM_BRANCH_INIT
4252 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4256 UDI opval = ADDDI (pc, 2);
4257 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
4258 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
4260 ((void) 0); /*nop*/
4263 UDI opval = GET_H_PR ();
4264 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
4265 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
4268 ((void) 0); /*nop*/
4271 SEM_BRANCH_FINI (vpc);
4272 return vpc;
4273 #undef FLD
4276 /* sets-compact: sets */
4278 static SEM_PC
4279 SEM_FN_NAME (sh64_compact,sets_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4281 #define FLD(f) abuf->fields.sfmt_empty.f
4282 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4283 int UNUSED written = 0;
4284 IADDR UNUSED pc = abuf->addr;
4285 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4288 BI opval = 1;
4289 SET_H_SBIT (opval);
4290 CGEN_TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval);
4293 return vpc;
4294 #undef FLD
4297 /* sett-compact: sett */
4299 static SEM_PC
4300 SEM_FN_NAME (sh64_compact,sett_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4302 #define FLD(f) abuf->fields.sfmt_empty.f
4303 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4304 int UNUSED written = 0;
4305 IADDR UNUSED pc = abuf->addr;
4306 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4309 BI opval = 1;
4310 SET_H_TBIT (opval);
4311 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4314 return vpc;
4315 #undef FLD
4318 /* shad-compact: shad $rm, $rn */
4320 static SEM_PC
4321 SEM_FN_NAME (sh64_compact,shad_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4323 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4324 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4325 int UNUSED written = 0;
4326 IADDR UNUSED pc = abuf->addr;
4327 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4330 SI tmp_shamt;
4331 tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31);
4332 if (GESI (GET_H_GRC (FLD (f_rm)), 0)) {
4334 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt);
4335 SET_H_GRC (FLD (f_rn), opval);
4336 written |= (1 << 2);
4337 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4339 } else {
4340 if (NESI (tmp_shamt, 0)) {
4342 SI opval = SRASI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt));
4343 SET_H_GRC (FLD (f_rn), opval);
4344 written |= (1 << 2);
4345 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4347 } else {
4348 if (LTSI (GET_H_GRC (FLD (f_rn)), 0)) {
4350 SI opval = NEGSI (1);
4351 SET_H_GRC (FLD (f_rn), opval);
4352 written |= (1 << 2);
4353 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4355 } else {
4357 SI opval = 0;
4358 SET_H_GRC (FLD (f_rn), opval);
4359 written |= (1 << 2);
4360 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4367 abuf->written = written;
4368 return vpc;
4369 #undef FLD
4372 /* shal-compact: shal $rn */
4374 static SEM_PC
4375 SEM_FN_NAME (sh64_compact,shal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4377 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4378 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4379 int UNUSED written = 0;
4380 IADDR UNUSED pc = abuf->addr;
4381 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4384 BI tmp_t;
4385 tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4387 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1);
4388 SET_H_GRC (FLD (f_rn), opval);
4389 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4392 BI opval = ((tmp_t) ? (1) : (0));
4393 SET_H_TBIT (opval);
4394 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4398 return vpc;
4399 #undef FLD
4402 /* shar-compact: shar $rn */
4404 static SEM_PC
4405 SEM_FN_NAME (sh64_compact,shar_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4407 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4408 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4409 int UNUSED written = 0;
4410 IADDR UNUSED pc = abuf->addr;
4411 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4414 BI tmp_t;
4415 tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1);
4417 SI opval = SRASI (GET_H_GRC (FLD (f_rn)), 1);
4418 SET_H_GRC (FLD (f_rn), opval);
4419 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4422 BI opval = ((tmp_t) ? (1) : (0));
4423 SET_H_TBIT (opval);
4424 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4428 return vpc;
4429 #undef FLD
4432 /* shld-compact: shld $rm, $rn */
4434 static SEM_PC
4435 SEM_FN_NAME (sh64_compact,shld_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4437 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4438 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4439 int UNUSED written = 0;
4440 IADDR UNUSED pc = abuf->addr;
4441 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4444 SI tmp_shamt;
4445 tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31);
4446 if (GESI (GET_H_GRC (FLD (f_rm)), 0)) {
4448 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt);
4449 SET_H_GRC (FLD (f_rn), opval);
4450 written |= (1 << 2);
4451 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4453 } else {
4454 if (NESI (tmp_shamt, 0)) {
4456 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt));
4457 SET_H_GRC (FLD (f_rn), opval);
4458 written |= (1 << 2);
4459 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4461 } else {
4463 SI opval = 0;
4464 SET_H_GRC (FLD (f_rn), opval);
4465 written |= (1 << 2);
4466 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4472 abuf->written = written;
4473 return vpc;
4474 #undef FLD
4477 /* shll-compact: shll $rn */
4479 static SEM_PC
4480 SEM_FN_NAME (sh64_compact,shll_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4482 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4483 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4484 int UNUSED written = 0;
4485 IADDR UNUSED pc = abuf->addr;
4486 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4489 BI tmp_t;
4490 tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4492 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1);
4493 SET_H_GRC (FLD (f_rn), opval);
4494 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4497 BI opval = ((tmp_t) ? (1) : (0));
4498 SET_H_TBIT (opval);
4499 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4503 return vpc;
4504 #undef FLD
4507 /* shll2-compact: shll2 $rn */
4509 static SEM_PC
4510 SEM_FN_NAME (sh64_compact,shll2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4512 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4513 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4514 int UNUSED written = 0;
4515 IADDR UNUSED pc = abuf->addr;
4516 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4519 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 2);
4520 SET_H_GRC (FLD (f_rn), opval);
4521 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4524 return vpc;
4525 #undef FLD
4528 /* shll8-compact: shll8 $rn */
4530 static SEM_PC
4531 SEM_FN_NAME (sh64_compact,shll8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4533 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4534 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4535 int UNUSED written = 0;
4536 IADDR UNUSED pc = abuf->addr;
4537 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4540 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 8);
4541 SET_H_GRC (FLD (f_rn), opval);
4542 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4545 return vpc;
4546 #undef FLD
4549 /* shll16-compact: shll16 $rn */
4551 static SEM_PC
4552 SEM_FN_NAME (sh64_compact,shll16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4554 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4555 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4556 int UNUSED written = 0;
4557 IADDR UNUSED pc = abuf->addr;
4558 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4561 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 16);
4562 SET_H_GRC (FLD (f_rn), opval);
4563 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4566 return vpc;
4567 #undef FLD
4570 /* shlr-compact: shlr $rn */
4572 static SEM_PC
4573 SEM_FN_NAME (sh64_compact,shlr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4575 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4576 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4577 int UNUSED written = 0;
4578 IADDR UNUSED pc = abuf->addr;
4579 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4582 BI tmp_t;
4583 tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1);
4585 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 1);
4586 SET_H_GRC (FLD (f_rn), opval);
4587 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4590 BI opval = ((tmp_t) ? (1) : (0));
4591 SET_H_TBIT (opval);
4592 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4596 return vpc;
4597 #undef FLD
4600 /* shlr2-compact: shlr2 $rn */
4602 static SEM_PC
4603 SEM_FN_NAME (sh64_compact,shlr2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4605 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4606 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4607 int UNUSED written = 0;
4608 IADDR UNUSED pc = abuf->addr;
4609 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4612 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 2);
4613 SET_H_GRC (FLD (f_rn), opval);
4614 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4617 return vpc;
4618 #undef FLD
4621 /* shlr8-compact: shlr8 $rn */
4623 static SEM_PC
4624 SEM_FN_NAME (sh64_compact,shlr8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4626 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4627 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4628 int UNUSED written = 0;
4629 IADDR UNUSED pc = abuf->addr;
4630 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4633 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 8);
4634 SET_H_GRC (FLD (f_rn), opval);
4635 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4638 return vpc;
4639 #undef FLD
4642 /* shlr16-compact: shlr16 $rn */
4644 static SEM_PC
4645 SEM_FN_NAME (sh64_compact,shlr16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4647 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4648 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4649 int UNUSED written = 0;
4650 IADDR UNUSED pc = abuf->addr;
4651 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4654 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 16);
4655 SET_H_GRC (FLD (f_rn), opval);
4656 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4659 return vpc;
4660 #undef FLD
4663 /* stc-gbr-compact: stc gbr, $rn */
4665 static SEM_PC
4666 SEM_FN_NAME (sh64_compact,stc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4668 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4669 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4670 int UNUSED written = 0;
4671 IADDR UNUSED pc = abuf->addr;
4672 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4675 SI opval = GET_H_GBR ();
4676 SET_H_GRC (FLD (f_rn), opval);
4677 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4680 return vpc;
4681 #undef FLD
4684 /* stc-vbr-compact: stc vbr, $rn */
4686 static SEM_PC
4687 SEM_FN_NAME (sh64_compact,stc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4689 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4690 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4691 int UNUSED written = 0;
4692 IADDR UNUSED pc = abuf->addr;
4693 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4696 SI opval = GET_H_VBR ();
4697 SET_H_GRC (FLD (f_rn), opval);
4698 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4701 return vpc;
4702 #undef FLD
4705 /* stcl-gbr-compact: stc.l gbr, @-$rn */
4707 static SEM_PC
4708 SEM_FN_NAME (sh64_compact,stcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4710 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4711 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4712 int UNUSED written = 0;
4713 IADDR UNUSED pc = abuf->addr;
4714 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4717 DI tmp_addr;
4718 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4720 SI opval = GET_H_GBR ();
4721 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4722 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4725 SI opval = tmp_addr;
4726 SET_H_GRC (FLD (f_rn), opval);
4727 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4731 return vpc;
4732 #undef FLD
4735 /* stcl-vbr-compact: stc.l vbr, @-$rn */
4737 static SEM_PC
4738 SEM_FN_NAME (sh64_compact,stcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4740 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4741 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4742 int UNUSED written = 0;
4743 IADDR UNUSED pc = abuf->addr;
4744 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4747 DI tmp_addr;
4748 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4750 SI opval = GET_H_VBR ();
4751 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4752 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4755 SI opval = tmp_addr;
4756 SET_H_GRC (FLD (f_rn), opval);
4757 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4761 return vpc;
4762 #undef FLD
4765 /* sts-fpscr-compact: sts fpscr, $rn */
4767 static SEM_PC
4768 SEM_FN_NAME (sh64_compact,sts_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4770 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4771 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4772 int UNUSED written = 0;
4773 IADDR UNUSED pc = abuf->addr;
4774 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4777 SI opval = CPU (h_fpscr);
4778 SET_H_GRC (FLD (f_rn), opval);
4779 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4782 return vpc;
4783 #undef FLD
4786 /* stsl-fpscr-compact: sts.l fpscr, @-$rn */
4788 static SEM_PC
4789 SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4791 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4792 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4793 int UNUSED written = 0;
4794 IADDR UNUSED pc = abuf->addr;
4795 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4798 DI tmp_addr;
4799 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4801 SI opval = CPU (h_fpscr);
4802 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4803 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4806 SI opval = tmp_addr;
4807 SET_H_GRC (FLD (f_rn), opval);
4808 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4812 return vpc;
4813 #undef FLD
4816 /* sts-fpul-compact: sts fpul, $rn */
4818 static SEM_PC
4819 SEM_FN_NAME (sh64_compact,sts_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4821 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4822 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4823 int UNUSED written = 0;
4824 IADDR UNUSED pc = abuf->addr;
4825 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4828 SI opval = SUBWORDSFSI (CPU (h_fr[((UINT) 32)]));
4829 SET_H_GRC (FLD (f_rn), opval);
4830 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4833 return vpc;
4834 #undef FLD
4837 /* stsl-fpul-compact: sts.l fpul, @-$rn */
4839 static SEM_PC
4840 SEM_FN_NAME (sh64_compact,stsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4842 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4843 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4844 int UNUSED written = 0;
4845 IADDR UNUSED pc = abuf->addr;
4846 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4849 DI tmp_addr;
4850 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4852 SF opval = CPU (h_fr[((UINT) 32)]);
4853 SETMEMSF (current_cpu, pc, tmp_addr, opval);
4854 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
4857 SI opval = tmp_addr;
4858 SET_H_GRC (FLD (f_rn), opval);
4859 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4863 return vpc;
4864 #undef FLD
4867 /* sts-mach-compact: sts mach, $rn */
4869 static SEM_PC
4870 SEM_FN_NAME (sh64_compact,sts_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4872 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4873 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4874 int UNUSED written = 0;
4875 IADDR UNUSED pc = abuf->addr;
4876 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4879 SI opval = GET_H_MACH ();
4880 SET_H_GRC (FLD (f_rn), opval);
4881 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4884 return vpc;
4885 #undef FLD
4888 /* stsl-mach-compact: sts.l mach, @-$rn */
4890 static SEM_PC
4891 SEM_FN_NAME (sh64_compact,stsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4893 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4894 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4895 int UNUSED written = 0;
4896 IADDR UNUSED pc = abuf->addr;
4897 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4900 DI tmp_addr;
4901 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4903 SI opval = GET_H_MACH ();
4904 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4905 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4908 SI opval = tmp_addr;
4909 SET_H_GRC (FLD (f_rn), opval);
4910 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4914 return vpc;
4915 #undef FLD
4918 /* sts-macl-compact: sts macl, $rn */
4920 static SEM_PC
4921 SEM_FN_NAME (sh64_compact,sts_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4923 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4924 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4925 int UNUSED written = 0;
4926 IADDR UNUSED pc = abuf->addr;
4927 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4930 SI opval = GET_H_MACL ();
4931 SET_H_GRC (FLD (f_rn), opval);
4932 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4935 return vpc;
4936 #undef FLD
4939 /* stsl-macl-compact: sts.l macl, @-$rn */
4941 static SEM_PC
4942 SEM_FN_NAME (sh64_compact,stsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4944 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4945 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4946 int UNUSED written = 0;
4947 IADDR UNUSED pc = abuf->addr;
4948 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4951 DI tmp_addr;
4952 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4954 SI opval = GET_H_MACL ();
4955 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4956 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4959 SI opval = tmp_addr;
4960 SET_H_GRC (FLD (f_rn), opval);
4961 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4965 return vpc;
4966 #undef FLD
4969 /* sts-pr-compact: sts pr, $rn */
4971 static SEM_PC
4972 SEM_FN_NAME (sh64_compact,sts_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4974 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4975 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4976 int UNUSED written = 0;
4977 IADDR UNUSED pc = abuf->addr;
4978 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4981 SI opval = GET_H_PR ();
4982 SET_H_GRC (FLD (f_rn), opval);
4983 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4986 return vpc;
4987 #undef FLD
4990 /* stsl-pr-compact: sts.l pr, @-$rn */
4992 static SEM_PC
4993 SEM_FN_NAME (sh64_compact,stsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4995 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4996 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4997 int UNUSED written = 0;
4998 IADDR UNUSED pc = abuf->addr;
4999 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5002 DI tmp_addr;
5003 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
5005 SI opval = GET_H_PR ();
5006 SETMEMSI (current_cpu, pc, tmp_addr, opval);
5007 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5010 SI opval = tmp_addr;
5011 SET_H_GRC (FLD (f_rn), opval);
5012 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5016 return vpc;
5017 #undef FLD
5020 /* sub-compact: sub $rm, $rn */
5022 static SEM_PC
5023 SEM_FN_NAME (sh64_compact,sub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5025 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5026 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5027 int UNUSED written = 0;
5028 IADDR UNUSED pc = abuf->addr;
5029 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5032 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
5033 SET_H_GRC (FLD (f_rn), opval);
5034 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5037 return vpc;
5038 #undef FLD
5041 /* subc-compact: subc $rm, $rn */
5043 static SEM_PC
5044 SEM_FN_NAME (sh64_compact,subc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5046 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5047 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5048 int UNUSED written = 0;
5049 IADDR UNUSED pc = abuf->addr;
5050 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5053 BI tmp_flag;
5054 tmp_flag = SUBCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
5056 SI opval = SUBCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
5057 SET_H_GRC (FLD (f_rn), opval);
5058 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5061 BI opval = tmp_flag;
5062 SET_H_TBIT (opval);
5063 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5067 return vpc;
5068 #undef FLD
5071 /* subv-compact: subv $rm, $rn */
5073 static SEM_PC
5074 SEM_FN_NAME (sh64_compact,subv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5076 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5077 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5078 int UNUSED written = 0;
5079 IADDR UNUSED pc = abuf->addr;
5080 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5083 BI tmp_t;
5084 tmp_t = SUBOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0);
5086 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
5087 SET_H_GRC (FLD (f_rn), opval);
5088 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5091 BI opval = ((tmp_t) ? (1) : (0));
5092 SET_H_TBIT (opval);
5093 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5097 return vpc;
5098 #undef FLD
5101 /* swapb-compact: swap.b $rm, $rn */
5103 static SEM_PC
5104 SEM_FN_NAME (sh64_compact,swapb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5106 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5107 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5108 int UNUSED written = 0;
5109 IADDR UNUSED pc = abuf->addr;
5110 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5113 UHI tmp_top_half;
5114 UQI tmp_byte1;
5115 UQI tmp_byte0;
5116 tmp_top_half = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 0);
5117 tmp_byte1 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 2);
5118 tmp_byte0 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3);
5120 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
5121 SET_H_GRC (FLD (f_rn), opval);
5122 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5126 return vpc;
5127 #undef FLD
5130 /* swapw-compact: swap.w $rm, $rn */
5132 static SEM_PC
5133 SEM_FN_NAME (sh64_compact,swapw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5135 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5136 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5137 int UNUSED written = 0;
5138 IADDR UNUSED pc = abuf->addr;
5139 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5142 SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rm)), 16), SLLSI (GET_H_GRC (FLD (f_rm)), 16));
5143 SET_H_GRC (FLD (f_rn), opval);
5144 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5147 return vpc;
5148 #undef FLD
5151 /* tasb-compact: tas.b @$rn */
5153 static SEM_PC
5154 SEM_FN_NAME (sh64_compact,tasb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5156 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5157 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5158 int UNUSED written = 0;
5159 IADDR UNUSED pc = abuf->addr;
5160 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5163 UQI tmp_byte;
5164 tmp_byte = GETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
5166 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
5167 SET_H_TBIT (opval);
5168 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5170 tmp_byte = ORQI (tmp_byte, 128);
5172 UQI opval = tmp_byte;
5173 SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
5174 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5178 return vpc;
5179 #undef FLD
5182 /* trapa-compact: trapa #$uimm8 */
5184 static SEM_PC
5185 SEM_FN_NAME (sh64_compact,trapa_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5187 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5188 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5189 int UNUSED written = 0;
5190 IADDR UNUSED pc = abuf->addr;
5191 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5193 sh64_compact_trapa (current_cpu, FLD (f_imm8), pc);
5195 return vpc;
5196 #undef FLD
5199 /* tst-compact: tst $rm, $rn */
5201 static SEM_PC
5202 SEM_FN_NAME (sh64_compact,tst_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5204 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5205 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5206 int UNUSED written = 0;
5207 IADDR UNUSED pc = abuf->addr;
5208 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5211 BI opval = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))), 0)) ? (1) : (0));
5212 SET_H_TBIT (opval);
5213 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5216 return vpc;
5217 #undef FLD
5220 /* tsti-compact: tst #$uimm8, r0 */
5222 static SEM_PC
5223 SEM_FN_NAME (sh64_compact,tsti_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5225 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5226 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5227 int UNUSED written = 0;
5228 IADDR UNUSED pc = abuf->addr;
5229 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5232 BI opval = ((EQSI (ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5233 SET_H_TBIT (opval);
5234 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5237 return vpc;
5238 #undef FLD
5241 /* tstb-compact: tst.b #$imm8, @(r0, gbr) */
5243 static SEM_PC
5244 SEM_FN_NAME (sh64_compact,tstb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5246 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5247 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5248 int UNUSED written = 0;
5249 IADDR UNUSED pc = abuf->addr;
5250 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5253 DI tmp_addr;
5254 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
5256 BI opval = ((EQQI (ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5257 SET_H_TBIT (opval);
5258 CGEN_TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5262 return vpc;
5263 #undef FLD
5266 /* xor-compact: xor $rm64, $rn64 */
5268 static SEM_PC
5269 SEM_FN_NAME (sh64_compact,xor_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5271 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5272 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5273 int UNUSED written = 0;
5274 IADDR UNUSED pc = abuf->addr;
5275 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5278 DI opval = XORDI (GET_H_GR (FLD (f_rn)), GET_H_GR (FLD (f_rm)));
5279 SET_H_GR (FLD (f_rn), opval);
5280 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5283 return vpc;
5284 #undef FLD
5287 /* xori-compact: xor #$uimm8, r0 */
5289 static SEM_PC
5290 SEM_FN_NAME (sh64_compact,xori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5292 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5293 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5294 int UNUSED written = 0;
5295 IADDR UNUSED pc = abuf->addr;
5296 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5299 SI opval = XORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5300 SET_H_GRC (((UINT) 0), opval);
5301 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5304 return vpc;
5305 #undef FLD
5308 /* xorb-compact: xor.b #$imm8, @(r0, gbr) */
5310 static SEM_PC
5311 SEM_FN_NAME (sh64_compact,xorb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5313 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5314 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5315 int UNUSED written = 0;
5316 IADDR UNUSED pc = abuf->addr;
5317 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5320 DI tmp_addr;
5321 UQI tmp_data;
5322 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
5323 tmp_data = XORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
5325 UQI opval = tmp_data;
5326 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5327 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5331 return vpc;
5332 #undef FLD
5335 /* xtrct-compact: xtrct $rm, $rn */
5337 static SEM_PC
5338 SEM_FN_NAME (sh64_compact,xtrct_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5340 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5341 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5342 int UNUSED written = 0;
5343 IADDR UNUSED pc = abuf->addr;
5344 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5347 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rm)), 16), SRLSI (GET_H_GRC (FLD (f_rn)), 16));
5348 SET_H_GRC (FLD (f_rn), opval);
5349 CGEN_TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5352 return vpc;
5353 #undef FLD
5356 /* Table of all semantic fns. */
5358 static const struct sem_fn_desc sem_fns[] = {
5359 { SH64_COMPACT_INSN_X_INVALID, SEM_FN_NAME (sh64_compact,x_invalid) },
5360 { SH64_COMPACT_INSN_X_AFTER, SEM_FN_NAME (sh64_compact,x_after) },
5361 { SH64_COMPACT_INSN_X_BEFORE, SEM_FN_NAME (sh64_compact,x_before) },
5362 { SH64_COMPACT_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_compact,x_cti_chain) },
5363 { SH64_COMPACT_INSN_X_CHAIN, SEM_FN_NAME (sh64_compact,x_chain) },
5364 { SH64_COMPACT_INSN_X_BEGIN, SEM_FN_NAME (sh64_compact,x_begin) },
5365 { SH64_COMPACT_INSN_ADD_COMPACT, SEM_FN_NAME (sh64_compact,add_compact) },
5366 { SH64_COMPACT_INSN_ADDI_COMPACT, SEM_FN_NAME (sh64_compact,addi_compact) },
5367 { SH64_COMPACT_INSN_ADDC_COMPACT, SEM_FN_NAME (sh64_compact,addc_compact) },
5368 { SH64_COMPACT_INSN_ADDV_COMPACT, SEM_FN_NAME (sh64_compact,addv_compact) },
5369 { SH64_COMPACT_INSN_AND_COMPACT, SEM_FN_NAME (sh64_compact,and_compact) },
5370 { SH64_COMPACT_INSN_ANDI_COMPACT, SEM_FN_NAME (sh64_compact,andi_compact) },
5371 { SH64_COMPACT_INSN_ANDB_COMPACT, SEM_FN_NAME (sh64_compact,andb_compact) },
5372 { SH64_COMPACT_INSN_BF_COMPACT, SEM_FN_NAME (sh64_compact,bf_compact) },
5373 { SH64_COMPACT_INSN_BFS_COMPACT, SEM_FN_NAME (sh64_compact,bfs_compact) },
5374 { SH64_COMPACT_INSN_BRA_COMPACT, SEM_FN_NAME (sh64_compact,bra_compact) },
5375 { SH64_COMPACT_INSN_BRAF_COMPACT, SEM_FN_NAME (sh64_compact,braf_compact) },
5376 { SH64_COMPACT_INSN_BRK_COMPACT, SEM_FN_NAME (sh64_compact,brk_compact) },
5377 { SH64_COMPACT_INSN_BSR_COMPACT, SEM_FN_NAME (sh64_compact,bsr_compact) },
5378 { SH64_COMPACT_INSN_BSRF_COMPACT, SEM_FN_NAME (sh64_compact,bsrf_compact) },
5379 { SH64_COMPACT_INSN_BT_COMPACT, SEM_FN_NAME (sh64_compact,bt_compact) },
5380 { SH64_COMPACT_INSN_BTS_COMPACT, SEM_FN_NAME (sh64_compact,bts_compact) },
5381 { SH64_COMPACT_INSN_CLRMAC_COMPACT, SEM_FN_NAME (sh64_compact,clrmac_compact) },
5382 { SH64_COMPACT_INSN_CLRS_COMPACT, SEM_FN_NAME (sh64_compact,clrs_compact) },
5383 { SH64_COMPACT_INSN_CLRT_COMPACT, SEM_FN_NAME (sh64_compact,clrt_compact) },
5384 { SH64_COMPACT_INSN_CMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,cmpeq_compact) },
5385 { SH64_COMPACT_INSN_CMPEQI_COMPACT, SEM_FN_NAME (sh64_compact,cmpeqi_compact) },
5386 { SH64_COMPACT_INSN_CMPGE_COMPACT, SEM_FN_NAME (sh64_compact,cmpge_compact) },
5387 { SH64_COMPACT_INSN_CMPGT_COMPACT, SEM_FN_NAME (sh64_compact,cmpgt_compact) },
5388 { SH64_COMPACT_INSN_CMPHI_COMPACT, SEM_FN_NAME (sh64_compact,cmphi_compact) },
5389 { SH64_COMPACT_INSN_CMPHS_COMPACT, SEM_FN_NAME (sh64_compact,cmphs_compact) },
5390 { SH64_COMPACT_INSN_CMPPL_COMPACT, SEM_FN_NAME (sh64_compact,cmppl_compact) },
5391 { SH64_COMPACT_INSN_CMPPZ_COMPACT, SEM_FN_NAME (sh64_compact,cmppz_compact) },
5392 { SH64_COMPACT_INSN_CMPSTR_COMPACT, SEM_FN_NAME (sh64_compact,cmpstr_compact) },
5393 { SH64_COMPACT_INSN_DIV0S_COMPACT, SEM_FN_NAME (sh64_compact,div0s_compact) },
5394 { SH64_COMPACT_INSN_DIV0U_COMPACT, SEM_FN_NAME (sh64_compact,div0u_compact) },
5395 { SH64_COMPACT_INSN_DIV1_COMPACT, SEM_FN_NAME (sh64_compact,div1_compact) },
5396 { SH64_COMPACT_INSN_DIVU_COMPACT, SEM_FN_NAME (sh64_compact,divu_compact) },
5397 { SH64_COMPACT_INSN_MULR_COMPACT, SEM_FN_NAME (sh64_compact,mulr_compact) },
5398 { SH64_COMPACT_INSN_DMULSL_COMPACT, SEM_FN_NAME (sh64_compact,dmulsl_compact) },
5399 { SH64_COMPACT_INSN_DMULUL_COMPACT, SEM_FN_NAME (sh64_compact,dmulul_compact) },
5400 { SH64_COMPACT_INSN_DT_COMPACT, SEM_FN_NAME (sh64_compact,dt_compact) },
5401 { SH64_COMPACT_INSN_EXTSB_COMPACT, SEM_FN_NAME (sh64_compact,extsb_compact) },
5402 { SH64_COMPACT_INSN_EXTSW_COMPACT, SEM_FN_NAME (sh64_compact,extsw_compact) },
5403 { SH64_COMPACT_INSN_EXTUB_COMPACT, SEM_FN_NAME (sh64_compact,extub_compact) },
5404 { SH64_COMPACT_INSN_EXTUW_COMPACT, SEM_FN_NAME (sh64_compact,extuw_compact) },
5405 { SH64_COMPACT_INSN_FABS_COMPACT, SEM_FN_NAME (sh64_compact,fabs_compact) },
5406 { SH64_COMPACT_INSN_FADD_COMPACT, SEM_FN_NAME (sh64_compact,fadd_compact) },
5407 { SH64_COMPACT_INSN_FCMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,fcmpeq_compact) },
5408 { SH64_COMPACT_INSN_FCMPGT_COMPACT, SEM_FN_NAME (sh64_compact,fcmpgt_compact) },
5409 { SH64_COMPACT_INSN_FCNVDS_COMPACT, SEM_FN_NAME (sh64_compact,fcnvds_compact) },
5410 { SH64_COMPACT_INSN_FCNVSD_COMPACT, SEM_FN_NAME (sh64_compact,fcnvsd_compact) },
5411 { SH64_COMPACT_INSN_FDIV_COMPACT, SEM_FN_NAME (sh64_compact,fdiv_compact) },
5412 { SH64_COMPACT_INSN_FIPR_COMPACT, SEM_FN_NAME (sh64_compact,fipr_compact) },
5413 { SH64_COMPACT_INSN_FLDS_COMPACT, SEM_FN_NAME (sh64_compact,flds_compact) },
5414 { SH64_COMPACT_INSN_FLDI0_COMPACT, SEM_FN_NAME (sh64_compact,fldi0_compact) },
5415 { SH64_COMPACT_INSN_FLDI1_COMPACT, SEM_FN_NAME (sh64_compact,fldi1_compact) },
5416 { SH64_COMPACT_INSN_FLOAT_COMPACT, SEM_FN_NAME (sh64_compact,float_compact) },
5417 { SH64_COMPACT_INSN_FMAC_COMPACT, SEM_FN_NAME (sh64_compact,fmac_compact) },
5418 { SH64_COMPACT_INSN_FMOV1_COMPACT, SEM_FN_NAME (sh64_compact,fmov1_compact) },
5419 { SH64_COMPACT_INSN_FMOV2_COMPACT, SEM_FN_NAME (sh64_compact,fmov2_compact) },
5420 { SH64_COMPACT_INSN_FMOV3_COMPACT, SEM_FN_NAME (sh64_compact,fmov3_compact) },
5421 { SH64_COMPACT_INSN_FMOV4_COMPACT, SEM_FN_NAME (sh64_compact,fmov4_compact) },
5422 { SH64_COMPACT_INSN_FMOV5_COMPACT, SEM_FN_NAME (sh64_compact,fmov5_compact) },
5423 { SH64_COMPACT_INSN_FMOV6_COMPACT, SEM_FN_NAME (sh64_compact,fmov6_compact) },
5424 { SH64_COMPACT_INSN_FMOV7_COMPACT, SEM_FN_NAME (sh64_compact,fmov7_compact) },
5425 { SH64_COMPACT_INSN_FMOV8_COMPACT, SEM_FN_NAME (sh64_compact,fmov8_compact) },
5426 { SH64_COMPACT_INSN_FMOV9_COMPACT, SEM_FN_NAME (sh64_compact,fmov9_compact) },
5427 { SH64_COMPACT_INSN_FMUL_COMPACT, SEM_FN_NAME (sh64_compact,fmul_compact) },
5428 { SH64_COMPACT_INSN_FNEG_COMPACT, SEM_FN_NAME (sh64_compact,fneg_compact) },
5429 { SH64_COMPACT_INSN_FRCHG_COMPACT, SEM_FN_NAME (sh64_compact,frchg_compact) },
5430 { SH64_COMPACT_INSN_FSCHG_COMPACT, SEM_FN_NAME (sh64_compact,fschg_compact) },
5431 { SH64_COMPACT_INSN_FSQRT_COMPACT, SEM_FN_NAME (sh64_compact,fsqrt_compact) },
5432 { SH64_COMPACT_INSN_FSTS_COMPACT, SEM_FN_NAME (sh64_compact,fsts_compact) },
5433 { SH64_COMPACT_INSN_FSUB_COMPACT, SEM_FN_NAME (sh64_compact,fsub_compact) },
5434 { SH64_COMPACT_INSN_FTRC_COMPACT, SEM_FN_NAME (sh64_compact,ftrc_compact) },
5435 { SH64_COMPACT_INSN_FTRV_COMPACT, SEM_FN_NAME (sh64_compact,ftrv_compact) },
5436 { SH64_COMPACT_INSN_JMP_COMPACT, SEM_FN_NAME (sh64_compact,jmp_compact) },
5437 { SH64_COMPACT_INSN_JSR_COMPACT, SEM_FN_NAME (sh64_compact,jsr_compact) },
5438 { SH64_COMPACT_INSN_LDC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_gbr_compact) },
5439 { SH64_COMPACT_INSN_LDC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_vbr_compact) },
5440 { SH64_COMPACT_INSN_LDC_SR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_sr_compact) },
5441 { SH64_COMPACT_INSN_LDCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) },
5442 { SH64_COMPACT_INSN_LDCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) },
5443 { SH64_COMPACT_INSN_LDS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpscr_compact) },
5444 { SH64_COMPACT_INSN_LDSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) },
5445 { SH64_COMPACT_INSN_LDS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpul_compact) },
5446 { SH64_COMPACT_INSN_LDSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) },
5447 { SH64_COMPACT_INSN_LDS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,lds_mach_compact) },
5448 { SH64_COMPACT_INSN_LDSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_mach_compact) },
5449 { SH64_COMPACT_INSN_LDS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,lds_macl_compact) },
5450 { SH64_COMPACT_INSN_LDSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_macl_compact) },
5451 { SH64_COMPACT_INSN_LDS_PR_COMPACT, SEM_FN_NAME (sh64_compact,lds_pr_compact) },
5452 { SH64_COMPACT_INSN_LDSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_pr_compact) },
5453 { SH64_COMPACT_INSN_MACL_COMPACT, SEM_FN_NAME (sh64_compact,macl_compact) },
5454 { SH64_COMPACT_INSN_MACW_COMPACT, SEM_FN_NAME (sh64_compact,macw_compact) },
5455 { SH64_COMPACT_INSN_MOV_COMPACT, SEM_FN_NAME (sh64_compact,mov_compact) },
5456 { SH64_COMPACT_INSN_MOVI_COMPACT, SEM_FN_NAME (sh64_compact,movi_compact) },
5457 { SH64_COMPACT_INSN_MOVI20_COMPACT, SEM_FN_NAME (sh64_compact,movi20_compact) },
5458 { SH64_COMPACT_INSN_MOVB1_COMPACT, SEM_FN_NAME (sh64_compact,movb1_compact) },
5459 { SH64_COMPACT_INSN_MOVB2_COMPACT, SEM_FN_NAME (sh64_compact,movb2_compact) },
5460 { SH64_COMPACT_INSN_MOVB3_COMPACT, SEM_FN_NAME (sh64_compact,movb3_compact) },
5461 { SH64_COMPACT_INSN_MOVB4_COMPACT, SEM_FN_NAME (sh64_compact,movb4_compact) },
5462 { SH64_COMPACT_INSN_MOVB5_COMPACT, SEM_FN_NAME (sh64_compact,movb5_compact) },
5463 { SH64_COMPACT_INSN_MOVB6_COMPACT, SEM_FN_NAME (sh64_compact,movb6_compact) },
5464 { SH64_COMPACT_INSN_MOVB7_COMPACT, SEM_FN_NAME (sh64_compact,movb7_compact) },
5465 { SH64_COMPACT_INSN_MOVB8_COMPACT, SEM_FN_NAME (sh64_compact,movb8_compact) },
5466 { SH64_COMPACT_INSN_MOVB9_COMPACT, SEM_FN_NAME (sh64_compact,movb9_compact) },
5467 { SH64_COMPACT_INSN_MOVB10_COMPACT, SEM_FN_NAME (sh64_compact,movb10_compact) },
5468 { SH64_COMPACT_INSN_MOVL1_COMPACT, SEM_FN_NAME (sh64_compact,movl1_compact) },
5469 { SH64_COMPACT_INSN_MOVL2_COMPACT, SEM_FN_NAME (sh64_compact,movl2_compact) },
5470 { SH64_COMPACT_INSN_MOVL3_COMPACT, SEM_FN_NAME (sh64_compact,movl3_compact) },
5471 { SH64_COMPACT_INSN_MOVL4_COMPACT, SEM_FN_NAME (sh64_compact,movl4_compact) },
5472 { SH64_COMPACT_INSN_MOVL5_COMPACT, SEM_FN_NAME (sh64_compact,movl5_compact) },
5473 { SH64_COMPACT_INSN_MOVL6_COMPACT, SEM_FN_NAME (sh64_compact,movl6_compact) },
5474 { SH64_COMPACT_INSN_MOVL7_COMPACT, SEM_FN_NAME (sh64_compact,movl7_compact) },
5475 { SH64_COMPACT_INSN_MOVL8_COMPACT, SEM_FN_NAME (sh64_compact,movl8_compact) },
5476 { SH64_COMPACT_INSN_MOVL9_COMPACT, SEM_FN_NAME (sh64_compact,movl9_compact) },
5477 { SH64_COMPACT_INSN_MOVL10_COMPACT, SEM_FN_NAME (sh64_compact,movl10_compact) },
5478 { SH64_COMPACT_INSN_MOVL11_COMPACT, SEM_FN_NAME (sh64_compact,movl11_compact) },
5479 { SH64_COMPACT_INSN_MOVL12_COMPACT, SEM_FN_NAME (sh64_compact,movl12_compact) },
5480 { SH64_COMPACT_INSN_MOVL13_COMPACT, SEM_FN_NAME (sh64_compact,movl13_compact) },
5481 { SH64_COMPACT_INSN_MOVW1_COMPACT, SEM_FN_NAME (sh64_compact,movw1_compact) },
5482 { SH64_COMPACT_INSN_MOVW2_COMPACT, SEM_FN_NAME (sh64_compact,movw2_compact) },
5483 { SH64_COMPACT_INSN_MOVW3_COMPACT, SEM_FN_NAME (sh64_compact,movw3_compact) },
5484 { SH64_COMPACT_INSN_MOVW4_COMPACT, SEM_FN_NAME (sh64_compact,movw4_compact) },
5485 { SH64_COMPACT_INSN_MOVW5_COMPACT, SEM_FN_NAME (sh64_compact,movw5_compact) },
5486 { SH64_COMPACT_INSN_MOVW6_COMPACT, SEM_FN_NAME (sh64_compact,movw6_compact) },
5487 { SH64_COMPACT_INSN_MOVW7_COMPACT, SEM_FN_NAME (sh64_compact,movw7_compact) },
5488 { SH64_COMPACT_INSN_MOVW8_COMPACT, SEM_FN_NAME (sh64_compact,movw8_compact) },
5489 { SH64_COMPACT_INSN_MOVW9_COMPACT, SEM_FN_NAME (sh64_compact,movw9_compact) },
5490 { SH64_COMPACT_INSN_MOVW10_COMPACT, SEM_FN_NAME (sh64_compact,movw10_compact) },
5491 { SH64_COMPACT_INSN_MOVW11_COMPACT, SEM_FN_NAME (sh64_compact,movw11_compact) },
5492 { SH64_COMPACT_INSN_MOVA_COMPACT, SEM_FN_NAME (sh64_compact,mova_compact) },
5493 { SH64_COMPACT_INSN_MOVCAL_COMPACT, SEM_FN_NAME (sh64_compact,movcal_compact) },
5494 { SH64_COMPACT_INSN_MOVCOL_COMPACT, SEM_FN_NAME (sh64_compact,movcol_compact) },
5495 { SH64_COMPACT_INSN_MOVT_COMPACT, SEM_FN_NAME (sh64_compact,movt_compact) },
5496 { SH64_COMPACT_INSN_MOVUAL_COMPACT, SEM_FN_NAME (sh64_compact,movual_compact) },
5497 { SH64_COMPACT_INSN_MOVUAL2_COMPACT, SEM_FN_NAME (sh64_compact,movual2_compact) },
5498 { SH64_COMPACT_INSN_MULL_COMPACT, SEM_FN_NAME (sh64_compact,mull_compact) },
5499 { SH64_COMPACT_INSN_MULSW_COMPACT, SEM_FN_NAME (sh64_compact,mulsw_compact) },
5500 { SH64_COMPACT_INSN_MULUW_COMPACT, SEM_FN_NAME (sh64_compact,muluw_compact) },
5501 { SH64_COMPACT_INSN_NEG_COMPACT, SEM_FN_NAME (sh64_compact,neg_compact) },
5502 { SH64_COMPACT_INSN_NEGC_COMPACT, SEM_FN_NAME (sh64_compact,negc_compact) },
5503 { SH64_COMPACT_INSN_NOP_COMPACT, SEM_FN_NAME (sh64_compact,nop_compact) },
5504 { SH64_COMPACT_INSN_NOT_COMPACT, SEM_FN_NAME (sh64_compact,not_compact) },
5505 { SH64_COMPACT_INSN_OCBI_COMPACT, SEM_FN_NAME (sh64_compact,ocbi_compact) },
5506 { SH64_COMPACT_INSN_OCBP_COMPACT, SEM_FN_NAME (sh64_compact,ocbp_compact) },
5507 { SH64_COMPACT_INSN_OCBWB_COMPACT, SEM_FN_NAME (sh64_compact,ocbwb_compact) },
5508 { SH64_COMPACT_INSN_OR_COMPACT, SEM_FN_NAME (sh64_compact,or_compact) },
5509 { SH64_COMPACT_INSN_ORI_COMPACT, SEM_FN_NAME (sh64_compact,ori_compact) },
5510 { SH64_COMPACT_INSN_ORB_COMPACT, SEM_FN_NAME (sh64_compact,orb_compact) },
5511 { SH64_COMPACT_INSN_PREF_COMPACT, SEM_FN_NAME (sh64_compact,pref_compact) },
5512 { SH64_COMPACT_INSN_ROTCL_COMPACT, SEM_FN_NAME (sh64_compact,rotcl_compact) },
5513 { SH64_COMPACT_INSN_ROTCR_COMPACT, SEM_FN_NAME (sh64_compact,rotcr_compact) },
5514 { SH64_COMPACT_INSN_ROTL_COMPACT, SEM_FN_NAME (sh64_compact,rotl_compact) },
5515 { SH64_COMPACT_INSN_ROTR_COMPACT, SEM_FN_NAME (sh64_compact,rotr_compact) },
5516 { SH64_COMPACT_INSN_RTS_COMPACT, SEM_FN_NAME (sh64_compact,rts_compact) },
5517 { SH64_COMPACT_INSN_SETS_COMPACT, SEM_FN_NAME (sh64_compact,sets_compact) },
5518 { SH64_COMPACT_INSN_SETT_COMPACT, SEM_FN_NAME (sh64_compact,sett_compact) },
5519 { SH64_COMPACT_INSN_SHAD_COMPACT, SEM_FN_NAME (sh64_compact,shad_compact) },
5520 { SH64_COMPACT_INSN_SHAL_COMPACT, SEM_FN_NAME (sh64_compact,shal_compact) },
5521 { SH64_COMPACT_INSN_SHAR_COMPACT, SEM_FN_NAME (sh64_compact,shar_compact) },
5522 { SH64_COMPACT_INSN_SHLD_COMPACT, SEM_FN_NAME (sh64_compact,shld_compact) },
5523 { SH64_COMPACT_INSN_SHLL_COMPACT, SEM_FN_NAME (sh64_compact,shll_compact) },
5524 { SH64_COMPACT_INSN_SHLL2_COMPACT, SEM_FN_NAME (sh64_compact,shll2_compact) },
5525 { SH64_COMPACT_INSN_SHLL8_COMPACT, SEM_FN_NAME (sh64_compact,shll8_compact) },
5526 { SH64_COMPACT_INSN_SHLL16_COMPACT, SEM_FN_NAME (sh64_compact,shll16_compact) },
5527 { SH64_COMPACT_INSN_SHLR_COMPACT, SEM_FN_NAME (sh64_compact,shlr_compact) },
5528 { SH64_COMPACT_INSN_SHLR2_COMPACT, SEM_FN_NAME (sh64_compact,shlr2_compact) },
5529 { SH64_COMPACT_INSN_SHLR8_COMPACT, SEM_FN_NAME (sh64_compact,shlr8_compact) },
5530 { SH64_COMPACT_INSN_SHLR16_COMPACT, SEM_FN_NAME (sh64_compact,shlr16_compact) },
5531 { SH64_COMPACT_INSN_STC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_gbr_compact) },
5532 { SH64_COMPACT_INSN_STC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_vbr_compact) },
5533 { SH64_COMPACT_INSN_STCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_gbr_compact) },
5534 { SH64_COMPACT_INSN_STCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_vbr_compact) },
5535 { SH64_COMPACT_INSN_STS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpscr_compact) },
5536 { SH64_COMPACT_INSN_STSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) },
5537 { SH64_COMPACT_INSN_STS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpul_compact) },
5538 { SH64_COMPACT_INSN_STSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpul_compact) },
5539 { SH64_COMPACT_INSN_STS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,sts_mach_compact) },
5540 { SH64_COMPACT_INSN_STSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,stsl_mach_compact) },
5541 { SH64_COMPACT_INSN_STS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,sts_macl_compact) },
5542 { SH64_COMPACT_INSN_STSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_macl_compact) },
5543 { SH64_COMPACT_INSN_STS_PR_COMPACT, SEM_FN_NAME (sh64_compact,sts_pr_compact) },
5544 { SH64_COMPACT_INSN_STSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_pr_compact) },
5545 { SH64_COMPACT_INSN_SUB_COMPACT, SEM_FN_NAME (sh64_compact,sub_compact) },
5546 { SH64_COMPACT_INSN_SUBC_COMPACT, SEM_FN_NAME (sh64_compact,subc_compact) },
5547 { SH64_COMPACT_INSN_SUBV_COMPACT, SEM_FN_NAME (sh64_compact,subv_compact) },
5548 { SH64_COMPACT_INSN_SWAPB_COMPACT, SEM_FN_NAME (sh64_compact,swapb_compact) },
5549 { SH64_COMPACT_INSN_SWAPW_COMPACT, SEM_FN_NAME (sh64_compact,swapw_compact) },
5550 { SH64_COMPACT_INSN_TASB_COMPACT, SEM_FN_NAME (sh64_compact,tasb_compact) },
5551 { SH64_COMPACT_INSN_TRAPA_COMPACT, SEM_FN_NAME (sh64_compact,trapa_compact) },
5552 { SH64_COMPACT_INSN_TST_COMPACT, SEM_FN_NAME (sh64_compact,tst_compact) },
5553 { SH64_COMPACT_INSN_TSTI_COMPACT, SEM_FN_NAME (sh64_compact,tsti_compact) },
5554 { SH64_COMPACT_INSN_TSTB_COMPACT, SEM_FN_NAME (sh64_compact,tstb_compact) },
5555 { SH64_COMPACT_INSN_XOR_COMPACT, SEM_FN_NAME (sh64_compact,xor_compact) },
5556 { SH64_COMPACT_INSN_XORI_COMPACT, SEM_FN_NAME (sh64_compact,xori_compact) },
5557 { SH64_COMPACT_INSN_XORB_COMPACT, SEM_FN_NAME (sh64_compact,xorb_compact) },
5558 { SH64_COMPACT_INSN_XTRCT_COMPACT, SEM_FN_NAME (sh64_compact,xtrct_compact) },
5559 { 0, 0 }
5562 /* Add the semantic fns to IDESC_TABLE. */
5564 void
5565 SEM_FN_NAME (sh64_compact,init_idesc_table) (SIM_CPU *current_cpu)
5567 IDESC *idesc_table = CPU_IDESC (current_cpu);
5568 const struct sem_fn_desc *sf;
5569 int mach_num = MACH_NUM (CPU_MACH (current_cpu));
5571 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
5573 const CGEN_INSN *insn = idesc_table[sf->index].idata;
5574 int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
5575 || CGEN_INSN_MACH_HAS_P (insn, mach_num));
5576 #if FAST_P
5577 if (valid_p)
5578 idesc_table[sf->index].sem_fast = sf->fn;
5579 else
5580 idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_compact,x_invalid);
5581 #else
5582 if (valid_p)
5583 idesc_table[sf->index].sem_full = sf->fn;
5584 else
5585 idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_compact,x_invalid);
5586 #endif