* ppc-linux-nat.c (have_ptrace_getsetregs): New variable.
[gdb/SamB.git] / sim / sh64 / sem-compact.c
blob31b75c350aaf62d6c8a6c528034b65e1479698d3
1 /* Simulator instruction semantics for sh64.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2005 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
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 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
33 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34 #else
35 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_/**/attr)
36 #endif
38 /* This is used so that we can compile two copies of the semantic code,
39 one with full feature support and one without that runs fast(er).
40 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
41 #if FAST_P
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
43 #undef TRACE_RESULT
44 #define TRACE_RESULT(cpu, abuf, name, type, val)
45 #else
46 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
47 #endif
49 /* x-invalid: --invalid-- */
51 static SEM_PC
52 SEM_FN_NAME (sh64_compact,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
54 #define FLD(f) abuf->fields.fmt_empty.f
55 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
56 int UNUSED written = 0;
57 IADDR UNUSED pc = abuf->addr;
58 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
61 /* Update the recorded pc in the cpu state struct.
62 Only necessary for WITH_SCACHE case, but to avoid the
63 conditional compilation .... */
64 SET_H_PC (pc);
65 /* Virtual insns have zero size. Overwrite vpc with address of next insn
66 using the default-insn-bitsize spec. When executing insns in parallel
67 we may want to queue the fault and continue execution. */
68 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
69 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
72 return vpc;
73 #undef FLD
76 /* x-after: --after-- */
78 static SEM_PC
79 SEM_FN_NAME (sh64_compact,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
81 #define FLD(f) abuf->fields.fmt_empty.f
82 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
83 int UNUSED written = 0;
84 IADDR UNUSED pc = abuf->addr;
85 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
88 #if WITH_SCACHE_PBB_SH64_COMPACT
89 sh64_compact_pbb_after (current_cpu, sem_arg);
90 #endif
93 return vpc;
94 #undef FLD
97 /* x-before: --before-- */
99 static SEM_PC
100 SEM_FN_NAME (sh64_compact,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
102 #define FLD(f) abuf->fields.fmt_empty.f
103 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
104 int UNUSED written = 0;
105 IADDR UNUSED pc = abuf->addr;
106 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
109 #if WITH_SCACHE_PBB_SH64_COMPACT
110 sh64_compact_pbb_before (current_cpu, sem_arg);
111 #endif
114 return vpc;
115 #undef FLD
118 /* x-cti-chain: --cti-chain-- */
120 static SEM_PC
121 SEM_FN_NAME (sh64_compact,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
123 #define FLD(f) abuf->fields.fmt_empty.f
124 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
125 int UNUSED written = 0;
126 IADDR UNUSED pc = abuf->addr;
127 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
130 #if WITH_SCACHE_PBB_SH64_COMPACT
131 #ifdef DEFINE_SWITCH
132 vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg,
133 pbb_br_type, pbb_br_npc);
134 BREAK (sem);
135 #else
136 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
137 vpc = sh64_compact_pbb_cti_chain (current_cpu, sem_arg,
138 CPU_PBB_BR_TYPE (current_cpu),
139 CPU_PBB_BR_NPC (current_cpu));
140 #endif
141 #endif
144 return vpc;
145 #undef FLD
148 /* x-chain: --chain-- */
150 static SEM_PC
151 SEM_FN_NAME (sh64_compact,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
153 #define FLD(f) abuf->fields.fmt_empty.f
154 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
155 int UNUSED written = 0;
156 IADDR UNUSED pc = abuf->addr;
157 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
160 #if WITH_SCACHE_PBB_SH64_COMPACT
161 vpc = sh64_compact_pbb_chain (current_cpu, sem_arg);
162 #ifdef DEFINE_SWITCH
163 BREAK (sem);
164 #endif
165 #endif
168 return vpc;
169 #undef FLD
172 /* x-begin: --begin-- */
174 static SEM_PC
175 SEM_FN_NAME (sh64_compact,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
177 #define FLD(f) abuf->fields.fmt_empty.f
178 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
179 int UNUSED written = 0;
180 IADDR UNUSED pc = abuf->addr;
181 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
184 #if WITH_SCACHE_PBB_SH64_COMPACT
185 #if defined DEFINE_SWITCH || defined FAST_P
186 /* In the switch case FAST_P is a constant, allowing several optimizations
187 in any called inline functions. */
188 vpc = sh64_compact_pbb_begin (current_cpu, FAST_P);
189 #else
190 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
191 vpc = sh64_compact_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
192 #else
193 vpc = sh64_compact_pbb_begin (current_cpu, 0);
194 #endif
195 #endif
196 #endif
199 return vpc;
200 #undef FLD
203 /* add-compact: add $rm, $rn */
205 static SEM_PC
206 SEM_FN_NAME (sh64_compact,add_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
208 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
209 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
210 int UNUSED written = 0;
211 IADDR UNUSED pc = abuf->addr;
212 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
215 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
216 SET_H_GRC (FLD (f_rn), opval);
217 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
220 return vpc;
221 #undef FLD
224 /* addi-compact: add #$imm8, $rn */
226 static SEM_PC
227 SEM_FN_NAME (sh64_compact,addi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
229 #define FLD(f) abuf->fields.sfmt_addi_compact.f
230 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
231 int UNUSED written = 0;
232 IADDR UNUSED pc = abuf->addr;
233 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
236 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
237 SET_H_GRC (FLD (f_rn), opval);
238 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
241 return vpc;
242 #undef FLD
245 /* addc-compact: addc $rm, $rn */
247 static SEM_PC
248 SEM_FN_NAME (sh64_compact,addc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
250 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
252 int UNUSED written = 0;
253 IADDR UNUSED pc = abuf->addr;
254 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
257 BI tmp_flag;
258 tmp_flag = ADDCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
260 SI opval = ADDCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
261 SET_H_GRC (FLD (f_rn), opval);
262 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
265 BI opval = tmp_flag;
266 SET_H_TBIT (opval);
267 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
271 return vpc;
272 #undef FLD
275 /* addv-compact: addv $rm, $rn */
277 static SEM_PC
278 SEM_FN_NAME (sh64_compact,addv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
280 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
281 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
282 int UNUSED written = 0;
283 IADDR UNUSED pc = abuf->addr;
284 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
287 BI tmp_t;
288 tmp_t = ADDOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0);
290 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
291 SET_H_GRC (FLD (f_rn), opval);
292 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
295 BI opval = tmp_t;
296 SET_H_TBIT (opval);
297 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
301 return vpc;
302 #undef FLD
305 /* and-compact: and $rm64, $rn64 */
307 static SEM_PC
308 SEM_FN_NAME (sh64_compact,and_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
310 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
311 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
312 int UNUSED written = 0;
313 IADDR UNUSED pc = abuf->addr;
314 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
317 DI opval = ANDDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn)));
318 SET_H_GR (FLD (f_rn), opval);
319 TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
322 return vpc;
323 #undef FLD
326 /* andi-compact: and #$uimm8, r0 */
328 static SEM_PC
329 SEM_FN_NAME (sh64_compact,andi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
331 #define FLD(f) abuf->fields.sfmt_addi_compact.f
332 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
333 int UNUSED written = 0;
334 IADDR UNUSED pc = abuf->addr;
335 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
338 SI opval = ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
339 SET_H_GRC (((UINT) 0), opval);
340 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
343 return vpc;
344 #undef FLD
347 /* andb-compact: and.b #$imm8, @(r0, gbr) */
349 static SEM_PC
350 SEM_FN_NAME (sh64_compact,andb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
352 #define FLD(f) abuf->fields.sfmt_addi_compact.f
353 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
354 int UNUSED written = 0;
355 IADDR UNUSED pc = abuf->addr;
356 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
359 DI tmp_addr;
360 UQI tmp_data;
361 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
362 tmp_data = ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
364 UQI opval = tmp_data;
365 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
366 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
370 return vpc;
371 #undef FLD
374 /* bf-compact: bf $disp8 */
376 static SEM_PC
377 SEM_FN_NAME (sh64_compact,bf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
379 #define FLD(f) abuf->fields.sfmt_bf_compact.f
380 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
381 int UNUSED written = 0;
382 IADDR UNUSED pc = abuf->addr;
383 SEM_BRANCH_INIT
384 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
386 if (NOTBI (GET_H_TBIT ())) {
388 UDI opval = FLD (i_disp8);
389 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
390 written |= (1 << 2);
391 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
395 abuf->written = written;
396 SEM_BRANCH_FINI (vpc);
397 return vpc;
398 #undef FLD
401 /* bfs-compact: bf/s $disp8 */
403 static SEM_PC
404 SEM_FN_NAME (sh64_compact,bfs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
406 #define FLD(f) abuf->fields.sfmt_bf_compact.f
407 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
408 int UNUSED written = 0;
409 IADDR UNUSED pc = abuf->addr;
410 SEM_BRANCH_INIT
411 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
413 if (NOTBI (GET_H_TBIT ())) {
416 UDI opval = ADDDI (pc, 2);
417 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
418 written |= (1 << 3);
419 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
421 ((void) 0); /*nop*/
424 UDI opval = FLD (i_disp8);
425 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
426 written |= (1 << 3);
427 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
433 abuf->written = written;
434 SEM_BRANCH_FINI (vpc);
435 return vpc;
436 #undef FLD
439 /* bra-compact: bra $disp12 */
441 static SEM_PC
442 SEM_FN_NAME (sh64_compact,bra_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
444 #define FLD(f) abuf->fields.sfmt_bra_compact.f
445 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
446 int UNUSED written = 0;
447 IADDR UNUSED pc = abuf->addr;
448 SEM_BRANCH_INIT
449 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
453 UDI opval = ADDDI (pc, 2);
454 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
455 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
457 ((void) 0); /*nop*/
460 UDI opval = FLD (i_disp12);
461 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
462 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
467 SEM_BRANCH_FINI (vpc);
468 return vpc;
469 #undef FLD
472 /* braf-compact: braf $rn */
474 static SEM_PC
475 SEM_FN_NAME (sh64_compact,braf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
477 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
478 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
479 int UNUSED written = 0;
480 IADDR UNUSED pc = abuf->addr;
481 SEM_BRANCH_INIT
482 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
486 UDI opval = ADDDI (pc, 2);
487 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
488 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
490 ((void) 0); /*nop*/
493 UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4));
494 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
495 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
500 SEM_BRANCH_FINI (vpc);
501 return vpc;
502 #undef FLD
505 /* brk-compact: brk */
507 static SEM_PC
508 SEM_FN_NAME (sh64_compact,brk_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
510 #define FLD(f) abuf->fields.fmt_empty.f
511 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
512 int UNUSED written = 0;
513 IADDR UNUSED pc = abuf->addr;
514 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
516 sh64_break (current_cpu, pc);
518 return vpc;
519 #undef FLD
522 /* bsr-compact: bsr $disp12 */
524 static SEM_PC
525 SEM_FN_NAME (sh64_compact,bsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
527 #define FLD(f) abuf->fields.sfmt_bra_compact.f
528 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
529 int UNUSED written = 0;
530 IADDR UNUSED pc = abuf->addr;
531 SEM_BRANCH_INIT
532 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
537 SI opval = ADDDI (pc, 4);
538 SET_H_PR (opval);
539 TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
543 UDI opval = ADDDI (pc, 2);
544 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
545 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
547 ((void) 0); /*nop*/
550 UDI opval = FLD (i_disp12);
551 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
552 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
557 SEM_BRANCH_FINI (vpc);
558 return vpc;
559 #undef FLD
562 /* bsrf-compact: bsrf $rn */
564 static SEM_PC
565 SEM_FN_NAME (sh64_compact,bsrf_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
567 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
568 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
569 int UNUSED written = 0;
570 IADDR UNUSED pc = abuf->addr;
571 SEM_BRANCH_INIT
572 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
577 SI opval = ADDDI (pc, 4);
578 SET_H_PR (opval);
579 TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
583 UDI opval = ADDDI (pc, 2);
584 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
585 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
587 ((void) 0); /*nop*/
590 UDI opval = ADDDI (EXTSIDI (GET_H_GRC (FLD (f_rn))), ADDDI (pc, 4));
591 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
592 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
597 SEM_BRANCH_FINI (vpc);
598 return vpc;
599 #undef FLD
602 /* bt-compact: bt $disp8 */
604 static SEM_PC
605 SEM_FN_NAME (sh64_compact,bt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
607 #define FLD(f) abuf->fields.sfmt_bf_compact.f
608 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
609 int UNUSED written = 0;
610 IADDR UNUSED pc = abuf->addr;
611 SEM_BRANCH_INIT
612 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
614 if (GET_H_TBIT ()) {
616 UDI opval = FLD (i_disp8);
617 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
618 written |= (1 << 2);
619 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
623 abuf->written = written;
624 SEM_BRANCH_FINI (vpc);
625 return vpc;
626 #undef FLD
629 /* bts-compact: bt/s $disp8 */
631 static SEM_PC
632 SEM_FN_NAME (sh64_compact,bts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
634 #define FLD(f) abuf->fields.sfmt_bf_compact.f
635 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
636 int UNUSED written = 0;
637 IADDR UNUSED pc = abuf->addr;
638 SEM_BRANCH_INIT
639 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
641 if (GET_H_TBIT ()) {
644 UDI opval = ADDDI (pc, 2);
645 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
646 written |= (1 << 3);
647 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
649 ((void) 0); /*nop*/
652 UDI opval = FLD (i_disp8);
653 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
654 written |= (1 << 3);
655 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
661 abuf->written = written;
662 SEM_BRANCH_FINI (vpc);
663 return vpc;
664 #undef FLD
667 /* clrmac-compact: clrmac */
669 static SEM_PC
670 SEM_FN_NAME (sh64_compact,clrmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
672 #define FLD(f) abuf->fields.fmt_empty.f
673 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
674 int UNUSED written = 0;
675 IADDR UNUSED pc = abuf->addr;
676 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
680 SI opval = 0;
681 SET_H_MACL (opval);
682 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
685 SI opval = 0;
686 SET_H_MACH (opval);
687 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
691 return vpc;
692 #undef FLD
695 /* clrs-compact: clrs */
697 static SEM_PC
698 SEM_FN_NAME (sh64_compact,clrs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
700 #define FLD(f) abuf->fields.fmt_empty.f
701 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
702 int UNUSED written = 0;
703 IADDR UNUSED pc = abuf->addr;
704 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
707 BI opval = 0;
708 SET_H_SBIT (opval);
709 TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval);
712 return vpc;
713 #undef FLD
716 /* clrt-compact: clrt */
718 static SEM_PC
719 SEM_FN_NAME (sh64_compact,clrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
721 #define FLD(f) abuf->fields.fmt_empty.f
722 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
723 int UNUSED written = 0;
724 IADDR UNUSED pc = abuf->addr;
725 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
728 BI opval = 0;
729 SET_H_TBIT (opval);
730 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
733 return vpc;
734 #undef FLD
737 /* cmpeq-compact: cmp/eq $rm, $rn */
739 static SEM_PC
740 SEM_FN_NAME (sh64_compact,cmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
742 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
743 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
744 int UNUSED written = 0;
745 IADDR UNUSED pc = abuf->addr;
746 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
749 BI opval = EQSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
750 SET_H_TBIT (opval);
751 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
754 return vpc;
755 #undef FLD
758 /* cmpeqi-compact: cmp/eq #$imm8, r0 */
760 static SEM_PC
761 SEM_FN_NAME (sh64_compact,cmpeqi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
763 #define FLD(f) abuf->fields.sfmt_addi_compact.f
764 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
765 int UNUSED written = 0;
766 IADDR UNUSED pc = abuf->addr;
767 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
770 BI opval = EQSI (GET_H_GRC (((UINT) 0)), EXTQISI (ANDQI (FLD (f_imm8), 255)));
771 SET_H_TBIT (opval);
772 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
775 return vpc;
776 #undef FLD
779 /* cmpge-compact: cmp/ge $rm, $rn */
781 static SEM_PC
782 SEM_FN_NAME (sh64_compact,cmpge_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
784 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
785 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
786 int UNUSED written = 0;
787 IADDR UNUSED pc = abuf->addr;
788 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
791 BI opval = GESI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
792 SET_H_TBIT (opval);
793 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
796 return vpc;
797 #undef FLD
800 /* cmpgt-compact: cmp/gt $rm, $rn */
802 static SEM_PC
803 SEM_FN_NAME (sh64_compact,cmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
805 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
806 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
807 int UNUSED written = 0;
808 IADDR UNUSED pc = abuf->addr;
809 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
812 BI opval = GTSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
813 SET_H_TBIT (opval);
814 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
817 return vpc;
818 #undef FLD
821 /* cmphi-compact: cmp/hi $rm, $rn */
823 static SEM_PC
824 SEM_FN_NAME (sh64_compact,cmphi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
826 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
827 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
828 int UNUSED written = 0;
829 IADDR UNUSED pc = abuf->addr;
830 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
833 BI opval = GTUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
834 SET_H_TBIT (opval);
835 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
838 return vpc;
839 #undef FLD
842 /* cmphs-compact: cmp/hs $rm, $rn */
844 static SEM_PC
845 SEM_FN_NAME (sh64_compact,cmphs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
847 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
848 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
849 int UNUSED written = 0;
850 IADDR UNUSED pc = abuf->addr;
851 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
854 BI opval = GEUSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
855 SET_H_TBIT (opval);
856 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
859 return vpc;
860 #undef FLD
863 /* cmppl-compact: cmp/pl $rn */
865 static SEM_PC
866 SEM_FN_NAME (sh64_compact,cmppl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
868 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
869 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
870 int UNUSED written = 0;
871 IADDR UNUSED pc = abuf->addr;
872 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
875 BI opval = GTSI (GET_H_GRC (FLD (f_rn)), 0);
876 SET_H_TBIT (opval);
877 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
880 return vpc;
881 #undef FLD
884 /* cmppz-compact: cmp/pz $rn */
886 static SEM_PC
887 SEM_FN_NAME (sh64_compact,cmppz_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
889 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
890 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
891 int UNUSED written = 0;
892 IADDR UNUSED pc = abuf->addr;
893 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
896 BI opval = GESI (GET_H_GRC (FLD (f_rn)), 0);
897 SET_H_TBIT (opval);
898 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
901 return vpc;
902 #undef FLD
905 /* cmpstr-compact: cmp/str $rm, $rn */
907 static SEM_PC
908 SEM_FN_NAME (sh64_compact,cmpstr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
910 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
911 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
912 int UNUSED written = 0;
913 IADDR UNUSED pc = abuf->addr;
914 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
917 BI tmp_t;
918 SI tmp_temp;
919 tmp_temp = XORSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
920 tmp_t = EQSI (ANDSI (tmp_temp, 0xff000000), 0);
921 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 16711680), 0), tmp_t);
922 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 65280), 0), tmp_t);
923 tmp_t = ORBI (EQSI (ANDSI (tmp_temp, 255), 0), tmp_t);
925 BI opval = ((GTUBI (tmp_t, 0)) ? (1) : (0));
926 SET_H_TBIT (opval);
927 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
931 return vpc;
932 #undef FLD
935 /* div0s-compact: div0s $rm, $rn */
937 static SEM_PC
938 SEM_FN_NAME (sh64_compact,div0s_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
940 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
941 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
942 int UNUSED written = 0;
943 IADDR UNUSED pc = abuf->addr;
944 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
948 BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
949 SET_H_QBIT (opval);
950 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
953 BI opval = SRLSI (GET_H_GRC (FLD (f_rm)), 31);
954 SET_H_MBIT (opval);
955 TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval);
958 BI opval = ((EQSI (SRLSI (GET_H_GRC (FLD (f_rm)), 31), SRLSI (GET_H_GRC (FLD (f_rn)), 31))) ? (0) : (1));
959 SET_H_TBIT (opval);
960 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
964 return vpc;
965 #undef FLD
968 /* div0u-compact: div0u */
970 static SEM_PC
971 SEM_FN_NAME (sh64_compact,div0u_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
973 #define FLD(f) abuf->fields.fmt_empty.f
974 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
975 int UNUSED written = 0;
976 IADDR UNUSED pc = abuf->addr;
977 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
981 BI opval = 0;
982 SET_H_TBIT (opval);
983 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
986 BI opval = 0;
987 SET_H_QBIT (opval);
988 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
991 BI opval = 0;
992 SET_H_MBIT (opval);
993 TRACE_RESULT (current_cpu, abuf, "mbit", 'x', opval);
997 return vpc;
998 #undef FLD
1001 /* div1-compact: div1 $rm, $rn */
1003 static SEM_PC
1004 SEM_FN_NAME (sh64_compact,div1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1006 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1007 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1008 int UNUSED written = 0;
1009 IADDR UNUSED pc = abuf->addr;
1010 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1013 BI tmp_oldq;
1014 SI tmp_tmp0;
1015 UQI tmp_tmp1;
1016 tmp_oldq = GET_H_QBIT ();
1018 BI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
1019 SET_H_QBIT (opval);
1020 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1023 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), ZEXTBISI (GET_H_TBIT ()));
1024 SET_H_GRC (FLD (f_rn), opval);
1025 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1027 if (NOTBI (tmp_oldq)) {
1028 if (NOTBI (GET_H_MBIT ())) {
1030 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1032 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1033 SET_H_GRC (FLD (f_rn), opval);
1034 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1036 tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1037 if (NOTBI (GET_H_QBIT ())) {
1039 BI opval = ((tmp_tmp1) ? (1) : (0));
1040 SET_H_QBIT (opval);
1041 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1043 } else {
1045 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1046 SET_H_QBIT (opval);
1047 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1051 } else {
1053 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1055 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1056 SET_H_GRC (FLD (f_rn), opval);
1057 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1059 tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1060 if (NOTBI (GET_H_QBIT ())) {
1062 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1063 SET_H_QBIT (opval);
1064 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1066 } else {
1068 BI opval = ((tmp_tmp1) ? (1) : (0));
1069 SET_H_QBIT (opval);
1070 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1075 } else {
1076 if (NOTBI (GET_H_MBIT ())) {
1078 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1080 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
1081 SET_H_GRC (FLD (f_rn), opval);
1082 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1084 tmp_tmp1 = LTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1085 if (NOTBI (GET_H_QBIT ())) {
1087 BI opval = ((tmp_tmp1) ? (1) : (0));
1088 SET_H_QBIT (opval);
1089 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1091 } else {
1093 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1094 SET_H_QBIT (opval);
1095 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1099 } else {
1101 tmp_tmp0 = GET_H_GRC (FLD (f_rn));
1103 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
1104 SET_H_GRC (FLD (f_rn), opval);
1105 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1107 tmp_tmp1 = GTUSI (GET_H_GRC (FLD (f_rn)), tmp_tmp0);
1108 if (NOTBI (GET_H_QBIT ())) {
1110 BI opval = ((EQQI (tmp_tmp1, 0)) ? (1) : (0));
1111 SET_H_QBIT (opval);
1112 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1114 } else {
1116 BI opval = ((tmp_tmp1) ? (1) : (0));
1117 SET_H_QBIT (opval);
1118 TRACE_RESULT (current_cpu, abuf, "qbit", 'x', opval);
1125 BI opval = ((EQBI (GET_H_QBIT (), GET_H_MBIT ())) ? (1) : (0));
1126 SET_H_TBIT (opval);
1127 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1131 return vpc;
1132 #undef FLD
1135 /* divu-compact: divu r0, $rn */
1137 static SEM_PC
1138 SEM_FN_NAME (sh64_compact,divu_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1140 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1141 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1142 int UNUSED written = 0;
1143 IADDR UNUSED pc = abuf->addr;
1144 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1147 SI opval = UDIVSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0)));
1148 SET_H_GRC (FLD (f_rn), opval);
1149 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1152 return vpc;
1153 #undef FLD
1156 /* mulr-compact: mulr r0, $rn */
1158 static SEM_PC
1159 SEM_FN_NAME (sh64_compact,mulr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1161 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1162 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1163 int UNUSED written = 0;
1164 IADDR UNUSED pc = abuf->addr;
1165 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1168 SI opval = MULSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (((UINT) 0)));
1169 SET_H_GRC (FLD (f_rn), opval);
1170 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1173 return vpc;
1174 #undef FLD
1177 /* dmulsl-compact: dmuls.l $rm, $rn */
1179 static SEM_PC
1180 SEM_FN_NAME (sh64_compact,dmulsl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1182 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1183 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1184 int UNUSED written = 0;
1185 IADDR UNUSED pc = abuf->addr;
1186 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1189 DI tmp_result;
1190 tmp_result = MULDI (EXTSIDI (GET_H_GRC (FLD (f_rm))), EXTSIDI (GET_H_GRC (FLD (f_rn))));
1192 SI opval = SUBWORDDISI (tmp_result, 0);
1193 SET_H_MACH (opval);
1194 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
1197 SI opval = SUBWORDDISI (tmp_result, 1);
1198 SET_H_MACL (opval);
1199 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
1203 return vpc;
1204 #undef FLD
1207 /* dmulul-compact: dmulu.l $rm, $rn */
1209 static SEM_PC
1210 SEM_FN_NAME (sh64_compact,dmulul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1212 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1213 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1214 int UNUSED written = 0;
1215 IADDR UNUSED pc = abuf->addr;
1216 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1219 DI tmp_result;
1220 tmp_result = MULDI (ZEXTSIDI (GET_H_GRC (FLD (f_rm))), ZEXTSIDI (GET_H_GRC (FLD (f_rn))));
1222 SI opval = SUBWORDDISI (tmp_result, 0);
1223 SET_H_MACH (opval);
1224 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
1227 SI opval = SUBWORDDISI (tmp_result, 1);
1228 SET_H_MACL (opval);
1229 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
1233 return vpc;
1234 #undef FLD
1237 /* dt-compact: dt $rn */
1239 static SEM_PC
1240 SEM_FN_NAME (sh64_compact,dt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1242 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1243 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1244 int UNUSED written = 0;
1245 IADDR UNUSED pc = abuf->addr;
1246 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1250 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 1);
1251 SET_H_GRC (FLD (f_rn), opval);
1252 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1255 BI opval = EQSI (GET_H_GRC (FLD (f_rn)), 0);
1256 SET_H_TBIT (opval);
1257 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1261 return vpc;
1262 #undef FLD
1265 /* extsb-compact: exts.b $rm, $rn */
1267 static SEM_PC
1268 SEM_FN_NAME (sh64_compact,extsb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1270 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1271 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1272 int UNUSED written = 0;
1273 IADDR UNUSED pc = abuf->addr;
1274 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1277 SI opval = EXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3));
1278 SET_H_GRC (FLD (f_rn), opval);
1279 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1282 return vpc;
1283 #undef FLD
1286 /* extsw-compact: exts.w $rm, $rn */
1288 static SEM_PC
1289 SEM_FN_NAME (sh64_compact,extsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1291 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1292 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1293 int UNUSED written = 0;
1294 IADDR UNUSED pc = abuf->addr;
1295 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1298 SI opval = EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1));
1299 SET_H_GRC (FLD (f_rn), opval);
1300 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1303 return vpc;
1304 #undef FLD
1307 /* extub-compact: extu.b $rm, $rn */
1309 static SEM_PC
1310 SEM_FN_NAME (sh64_compact,extub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1312 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1313 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1314 int UNUSED written = 0;
1315 IADDR UNUSED pc = abuf->addr;
1316 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1319 SI opval = ZEXTQISI (SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3));
1320 SET_H_GRC (FLD (f_rn), opval);
1321 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1324 return vpc;
1325 #undef FLD
1328 /* extuw-compact: extu.w $rm, $rn */
1330 static SEM_PC
1331 SEM_FN_NAME (sh64_compact,extuw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1333 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1334 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1335 int UNUSED written = 0;
1336 IADDR UNUSED pc = abuf->addr;
1337 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1340 SI opval = ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1));
1341 SET_H_GRC (FLD (f_rn), opval);
1342 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1345 return vpc;
1346 #undef FLD
1349 /* fabs-compact: fabs $fsdn */
1351 static SEM_PC
1352 SEM_FN_NAME (sh64_compact,fabs_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1354 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1355 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1356 int UNUSED written = 0;
1357 IADDR UNUSED pc = abuf->addr;
1358 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1360 if (GET_H_PRBIT ()) {
1362 DF opval = sh64_fabsd (current_cpu, GET_H_FSD (FLD (f_rn)));
1363 SET_H_FSD (FLD (f_rn), opval);
1364 written |= (1 << 2);
1365 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1367 } else {
1369 DF opval = sh64_fabss (current_cpu, GET_H_FSD (FLD (f_rn)));
1370 SET_H_FSD (FLD (f_rn), opval);
1371 written |= (1 << 2);
1372 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1376 abuf->written = written;
1377 return vpc;
1378 #undef FLD
1381 /* fadd-compact: fadd $fsdm, $fsdn */
1383 static SEM_PC
1384 SEM_FN_NAME (sh64_compact,fadd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1386 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1387 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1388 int UNUSED written = 0;
1389 IADDR UNUSED pc = abuf->addr;
1390 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1392 if (GET_H_PRBIT ()) {
1394 DF opval = sh64_faddd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1395 SET_H_FSD (FLD (f_rn), opval);
1396 written |= (1 << 3);
1397 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1399 } else {
1401 DF opval = sh64_fadds (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1402 SET_H_FSD (FLD (f_rn), opval);
1403 written |= (1 << 3);
1404 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1408 abuf->written = written;
1409 return vpc;
1410 #undef FLD
1413 /* fcmpeq-compact: fcmp/eq $fsdm, $fsdn */
1415 static SEM_PC
1416 SEM_FN_NAME (sh64_compact,fcmpeq_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1418 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1419 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1420 int UNUSED written = 0;
1421 IADDR UNUSED pc = abuf->addr;
1422 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1424 if (GET_H_PRBIT ()) {
1426 BI opval = sh64_fcmpeqd (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1427 SET_H_TBIT (opval);
1428 written |= (1 << 3);
1429 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1431 } else {
1433 BI opval = sh64_fcmpeqs (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1434 SET_H_TBIT (opval);
1435 written |= (1 << 3);
1436 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1440 abuf->written = written;
1441 return vpc;
1442 #undef FLD
1445 /* fcmpgt-compact: fcmp/gt $fsdm, $fsdn */
1447 static SEM_PC
1448 SEM_FN_NAME (sh64_compact,fcmpgt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1450 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1451 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1452 int UNUSED written = 0;
1453 IADDR UNUSED pc = abuf->addr;
1454 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1456 if (GET_H_PRBIT ()) {
1458 BI opval = sh64_fcmpgtd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1459 SET_H_TBIT (opval);
1460 written |= (1 << 3);
1461 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1463 } else {
1465 BI opval = sh64_fcmpgts (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1466 SET_H_TBIT (opval);
1467 written |= (1 << 3);
1468 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
1472 abuf->written = written;
1473 return vpc;
1474 #undef FLD
1477 /* fcnvds-compact: fcnvds $drn, fpul */
1479 static SEM_PC
1480 SEM_FN_NAME (sh64_compact,fcnvds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1482 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1483 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1484 int UNUSED written = 0;
1485 IADDR UNUSED pc = abuf->addr;
1486 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1489 SF opval = sh64_fcnvds (current_cpu, GET_H_DRC (FLD (f_dn)));
1490 CPU (h_fr[((UINT) 32)]) = opval;
1491 TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1494 return vpc;
1495 #undef FLD
1498 /* fcnvsd-compact: fcnvsd fpul, $drn */
1500 static SEM_PC
1501 SEM_FN_NAME (sh64_compact,fcnvsd_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1503 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1504 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1505 int UNUSED written = 0;
1506 IADDR UNUSED pc = abuf->addr;
1507 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1510 DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[((UINT) 32)]));
1511 SET_H_DRC (FLD (f_dn), opval);
1512 TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval);
1515 return vpc;
1516 #undef FLD
1519 /* fdiv-compact: fdiv $fsdm, $fsdn */
1521 static SEM_PC
1522 SEM_FN_NAME (sh64_compact,fdiv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1524 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1525 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1526 int UNUSED written = 0;
1527 IADDR UNUSED pc = abuf->addr;
1528 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1530 if (GET_H_PRBIT ()) {
1532 DF opval = sh64_fdivd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1533 SET_H_FSD (FLD (f_rn), opval);
1534 written |= (1 << 3);
1535 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1537 } else {
1539 DF opval = sh64_fdivs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
1540 SET_H_FSD (FLD (f_rn), opval);
1541 written |= (1 << 3);
1542 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1546 abuf->written = written;
1547 return vpc;
1548 #undef FLD
1551 /* fipr-compact: fipr $fvm, $fvn */
1553 static SEM_PC
1554 SEM_FN_NAME (sh64_compact,fipr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1556 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
1557 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1558 int UNUSED written = 0;
1559 IADDR UNUSED pc = abuf->addr;
1560 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1562 sh64_fipr (current_cpu, FLD (f_vm), FLD (f_vn));
1564 return vpc;
1565 #undef FLD
1568 /* flds-compact: flds $frn, fpul */
1570 static SEM_PC
1571 SEM_FN_NAME (sh64_compact,flds_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1573 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1574 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1575 int UNUSED written = 0;
1576 IADDR UNUSED pc = abuf->addr;
1577 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1580 SF opval = GET_H_FRC (FLD (f_rn));
1581 CPU (h_fr[((UINT) 32)]) = opval;
1582 TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1585 return vpc;
1586 #undef FLD
1589 /* fldi0-compact: fldi0 $frn */
1591 static SEM_PC
1592 SEM_FN_NAME (sh64_compact,fldi0_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1594 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1595 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1596 int UNUSED written = 0;
1597 IADDR UNUSED pc = abuf->addr;
1598 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1601 SF opval = sh64_fldi0 (current_cpu);
1602 SET_H_FRC (FLD (f_rn), opval);
1603 TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1606 return vpc;
1607 #undef FLD
1610 /* fldi1-compact: fldi1 $frn */
1612 static SEM_PC
1613 SEM_FN_NAME (sh64_compact,fldi1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1615 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1616 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1617 int UNUSED written = 0;
1618 IADDR UNUSED pc = abuf->addr;
1619 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1622 SF opval = sh64_fldi1 (current_cpu);
1623 SET_H_FRC (FLD (f_rn), opval);
1624 TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1627 return vpc;
1628 #undef FLD
1631 /* float-compact: float fpul, $fsdn */
1633 static SEM_PC
1634 SEM_FN_NAME (sh64_compact,float_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1636 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
1637 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1638 int UNUSED written = 0;
1639 IADDR UNUSED pc = abuf->addr;
1640 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1642 if (GET_H_PRBIT ()) {
1644 DF opval = sh64_floatld (current_cpu, CPU (h_fr[((UINT) 32)]));
1645 SET_H_FSD (FLD (f_rn), opval);
1646 written |= (1 << 2);
1647 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1649 } else {
1651 DF opval = sh64_floatls (current_cpu, CPU (h_fr[((UINT) 32)]));
1652 SET_H_FSD (FLD (f_rn), opval);
1653 written |= (1 << 2);
1654 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1658 abuf->written = written;
1659 return vpc;
1660 #undef FLD
1663 /* fmac-compact: fmac fr0, $frm, $frn */
1665 static SEM_PC
1666 SEM_FN_NAME (sh64_compact,fmac_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1668 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1669 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1670 int UNUSED written = 0;
1671 IADDR UNUSED pc = abuf->addr;
1672 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1675 SF opval = sh64_fmacs (current_cpu, GET_H_FRC (((UINT) 0)), GET_H_FRC (FLD (f_rm)), GET_H_FRC (FLD (f_rn)));
1676 SET_H_FRC (FLD (f_rn), opval);
1677 TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
1680 return vpc;
1681 #undef FLD
1684 /* fmov1-compact: fmov $fmovm, $fmovn */
1686 static SEM_PC
1687 SEM_FN_NAME (sh64_compact,fmov1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1689 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1690 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1691 int UNUSED written = 0;
1692 IADDR UNUSED pc = abuf->addr;
1693 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1696 DF opval = GET_H_FMOV (FLD (f_rm));
1697 SET_H_FMOV (FLD (f_rn), opval);
1698 TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1701 return vpc;
1702 #undef FLD
1705 /* fmov2-compact: fmov @$rm, $fmovn */
1707 static SEM_PC
1708 SEM_FN_NAME (sh64_compact,fmov2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1710 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1711 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1712 int UNUSED written = 0;
1713 IADDR UNUSED pc = abuf->addr;
1714 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1716 if (NOTBI (GET_H_SZBIT ())) {
1718 DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1719 SET_H_FMOV (FLD (f_rn), opval);
1720 written |= (1 << 4);
1721 TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1723 } else {
1725 DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1726 SET_H_FMOV (FLD (f_rn), opval);
1727 written |= (1 << 4);
1728 TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1732 abuf->written = written;
1733 return vpc;
1734 #undef FLD
1737 /* fmov3-compact: fmov @${rm}+, fmovn */
1739 static SEM_PC
1740 SEM_FN_NAME (sh64_compact,fmov3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1742 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1743 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1744 int UNUSED written = 0;
1745 IADDR UNUSED pc = abuf->addr;
1746 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1748 if (NOTBI (GET_H_SZBIT ())) {
1751 DF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1752 SET_H_FMOV (FLD (f_rn), opval);
1753 written |= (1 << 4);
1754 TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1757 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
1758 SET_H_GRC (FLD (f_rm), opval);
1759 written |= (1 << 5);
1760 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1763 } else {
1766 DF opval = GETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
1767 SET_H_FMOV (FLD (f_rn), opval);
1768 written |= (1 << 4);
1769 TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1772 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 8);
1773 SET_H_GRC (FLD (f_rm), opval);
1774 written |= (1 << 5);
1775 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1780 abuf->written = written;
1781 return vpc;
1782 #undef FLD
1785 /* fmov4-compact: fmov @(r0, $rm), $fmovn */
1787 static SEM_PC
1788 SEM_FN_NAME (sh64_compact,fmov4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1790 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1791 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1792 int UNUSED written = 0;
1793 IADDR UNUSED pc = abuf->addr;
1794 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1796 if (NOTBI (GET_H_SZBIT ())) {
1798 DF opval = GETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
1799 SET_H_FMOV (FLD (f_rn), opval);
1800 written |= (1 << 5);
1801 TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1803 } else {
1805 DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
1806 SET_H_FMOV (FLD (f_rn), opval);
1807 written |= (1 << 5);
1808 TRACE_RESULT (current_cpu, abuf, "fmov", 'f', opval);
1812 abuf->written = written;
1813 return vpc;
1814 #undef FLD
1817 /* fmov5-compact: fmov $fmovm, @$rn */
1819 static SEM_PC
1820 SEM_FN_NAME (sh64_compact,fmov5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1822 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1823 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1824 int UNUSED written = 0;
1825 IADDR UNUSED pc = abuf->addr;
1826 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1828 if (NOTBI (GET_H_SZBIT ())) {
1830 SF opval = GET_H_FMOV (FLD (f_rm));
1831 SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1832 written |= (1 << 4);
1833 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1835 } else {
1837 DF opval = GET_H_FMOV (FLD (f_rm));
1838 SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1839 written |= (1 << 3);
1840 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1844 abuf->written = written;
1845 return vpc;
1846 #undef FLD
1849 /* fmov6-compact: fmov $fmovm, @-$rn */
1851 static SEM_PC
1852 SEM_FN_NAME (sh64_compact,fmov6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1854 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1855 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1856 int UNUSED written = 0;
1857 IADDR UNUSED pc = abuf->addr;
1858 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1860 if (NOTBI (GET_H_SZBIT ())) {
1863 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
1864 SET_H_GRC (FLD (f_rn), opval);
1865 written |= (1 << 5);
1866 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1869 SF opval = GET_H_FMOV (FLD (f_rm));
1870 SETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1871 written |= (1 << 4);
1872 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1875 } else {
1878 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), 8);
1879 SET_H_GRC (FLD (f_rn), opval);
1880 written |= (1 << 5);
1881 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
1884 DF opval = GET_H_FMOV (FLD (f_rm));
1885 SETMEMDF (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
1886 written |= (1 << 3);
1887 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1892 abuf->written = written;
1893 return vpc;
1894 #undef FLD
1897 /* fmov7-compact: fmov $fmovm, @(r0, $rn) */
1899 static SEM_PC
1900 SEM_FN_NAME (sh64_compact,fmov7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1902 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1903 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1904 int UNUSED written = 0;
1905 IADDR UNUSED pc = abuf->addr;
1906 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1908 if (NOTBI (GET_H_SZBIT ())) {
1910 SF opval = GET_H_FMOV (FLD (f_rm));
1911 SETMEMSF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
1912 written |= (1 << 5);
1913 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1915 } else {
1917 DF opval = GET_H_FMOV (FLD (f_rm));
1918 SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
1919 written |= (1 << 4);
1920 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1924 abuf->written = written;
1925 return vpc;
1926 #undef FLD
1929 /* fmov8-compact: fmov.d @($imm12x8, $rm), $drn */
1931 static SEM_PC
1932 SEM_FN_NAME (sh64_compact,fmov8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1934 #define FLD(f) abuf->fields.sfmt_fmov8_compact.f
1935 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1936 int UNUSED written = 0;
1937 IADDR UNUSED pc = abuf->addr;
1938 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1941 DF opval = GETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x8)));
1942 SET_H_DRC (FLD (f_dn), opval);
1943 TRACE_RESULT (current_cpu, abuf, "drc", 'f', opval);
1946 return vpc;
1947 #undef FLD
1950 /* fmov9-compact: mov.l $drm, @($imm12x8, $rn) */
1952 static SEM_PC
1953 SEM_FN_NAME (sh64_compact,fmov9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1955 #define FLD(f) abuf->fields.sfmt_fmov9_compact.f
1956 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1957 int UNUSED written = 0;
1958 IADDR UNUSED pc = abuf->addr;
1959 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1962 DF opval = GET_H_DRC (FLD (f_dm));
1963 SETMEMDF (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x8)), opval);
1964 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1967 return vpc;
1968 #undef FLD
1971 /* fmul-compact: fmul $fsdm, $fsdn */
1973 static SEM_PC
1974 SEM_FN_NAME (sh64_compact,fmul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1976 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
1977 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1978 int UNUSED written = 0;
1979 IADDR UNUSED pc = abuf->addr;
1980 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1982 if (GET_H_PRBIT ()) {
1984 DF opval = sh64_fmuld (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1985 SET_H_FSD (FLD (f_rn), opval);
1986 written |= (1 << 3);
1987 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1989 } else {
1991 DF opval = sh64_fmuls (current_cpu, GET_H_FSD (FLD (f_rm)), GET_H_FSD (FLD (f_rn)));
1992 SET_H_FSD (FLD (f_rn), opval);
1993 written |= (1 << 3);
1994 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
1998 abuf->written = written;
1999 return vpc;
2000 #undef FLD
2003 /* fneg-compact: fneg $fsdn */
2005 static SEM_PC
2006 SEM_FN_NAME (sh64_compact,fneg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2008 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2009 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2010 int UNUSED written = 0;
2011 IADDR UNUSED pc = abuf->addr;
2012 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2014 if (GET_H_PRBIT ()) {
2016 DF opval = sh64_fnegd (current_cpu, GET_H_FSD (FLD (f_rn)));
2017 SET_H_FSD (FLD (f_rn), opval);
2018 written |= (1 << 2);
2019 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2021 } else {
2023 DF opval = sh64_fnegs (current_cpu, GET_H_FSD (FLD (f_rn)));
2024 SET_H_FSD (FLD (f_rn), opval);
2025 written |= (1 << 2);
2026 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2030 abuf->written = written;
2031 return vpc;
2032 #undef FLD
2035 /* frchg-compact: frchg */
2037 static SEM_PC
2038 SEM_FN_NAME (sh64_compact,frchg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2040 #define FLD(f) abuf->fields.fmt_empty.f
2041 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2042 int UNUSED written = 0;
2043 IADDR UNUSED pc = abuf->addr;
2044 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2047 BI opval = NOTBI (GET_H_FRBIT ());
2048 SET_H_FRBIT (opval);
2049 TRACE_RESULT (current_cpu, abuf, "frbit", 'x', opval);
2052 return vpc;
2053 #undef FLD
2056 /* fschg-compact: fschg */
2058 static SEM_PC
2059 SEM_FN_NAME (sh64_compact,fschg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2061 #define FLD(f) abuf->fields.fmt_empty.f
2062 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2063 int UNUSED written = 0;
2064 IADDR UNUSED pc = abuf->addr;
2065 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2068 BI opval = NOTBI (GET_H_SZBIT ());
2069 SET_H_SZBIT (opval);
2070 TRACE_RESULT (current_cpu, abuf, "szbit", 'x', opval);
2073 return vpc;
2074 #undef FLD
2077 /* fsqrt-compact: fsqrt $fsdn */
2079 static SEM_PC
2080 SEM_FN_NAME (sh64_compact,fsqrt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2082 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2083 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2084 int UNUSED written = 0;
2085 IADDR UNUSED pc = abuf->addr;
2086 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2088 if (GET_H_PRBIT ()) {
2090 DF opval = sh64_fsqrtd (current_cpu, GET_H_FSD (FLD (f_rn)));
2091 SET_H_FSD (FLD (f_rn), opval);
2092 written |= (1 << 2);
2093 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2095 } else {
2097 DF opval = sh64_fsqrts (current_cpu, GET_H_FSD (FLD (f_rn)));
2098 SET_H_FSD (FLD (f_rn), opval);
2099 written |= (1 << 2);
2100 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2104 abuf->written = written;
2105 return vpc;
2106 #undef FLD
2109 /* fsts-compact: fsts fpul, $frn */
2111 static SEM_PC
2112 SEM_FN_NAME (sh64_compact,fsts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2114 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2115 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2116 int UNUSED written = 0;
2117 IADDR UNUSED pc = abuf->addr;
2118 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2121 SF opval = CPU (h_fr[((UINT) 32)]);
2122 SET_H_FRC (FLD (f_rn), opval);
2123 TRACE_RESULT (current_cpu, abuf, "frc", 'f', opval);
2126 return vpc;
2127 #undef FLD
2130 /* fsub-compact: fsub $fsdm, $fsdn */
2132 static SEM_PC
2133 SEM_FN_NAME (sh64_compact,fsub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2135 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2136 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2137 int UNUSED written = 0;
2138 IADDR UNUSED pc = abuf->addr;
2139 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2141 if (GET_H_PRBIT ()) {
2143 DF opval = sh64_fsubd (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
2144 SET_H_FSD (FLD (f_rn), opval);
2145 written |= (1 << 3);
2146 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2148 } else {
2150 DF opval = sh64_fsubs (current_cpu, GET_H_FSD (FLD (f_rn)), GET_H_FSD (FLD (f_rm)));
2151 SET_H_FSD (FLD (f_rn), opval);
2152 written |= (1 << 3);
2153 TRACE_RESULT (current_cpu, abuf, "fsd", 'f', opval);
2157 abuf->written = written;
2158 return vpc;
2159 #undef FLD
2162 /* ftrc-compact: ftrc $fsdn, fpul */
2164 static SEM_PC
2165 SEM_FN_NAME (sh64_compact,ftrc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2167 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2168 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2169 int UNUSED written = 0;
2170 IADDR UNUSED pc = abuf->addr;
2171 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2174 SF opval = ((GET_H_PRBIT ()) ? (sh64_ftrcdl (current_cpu, GET_H_FSD (FLD (f_rn)))) : (sh64_ftrcsl (current_cpu, GET_H_FSD (FLD (f_rn)))));
2175 CPU (h_fr[((UINT) 32)]) = opval;
2176 TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2179 return vpc;
2180 #undef FLD
2183 /* ftrv-compact: ftrv xmtrx, $fvn */
2185 static SEM_PC
2186 SEM_FN_NAME (sh64_compact,ftrv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2188 #define FLD(f) abuf->fields.sfmt_fipr_compact.f
2189 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2190 int UNUSED written = 0;
2191 IADDR UNUSED pc = abuf->addr;
2192 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2194 sh64_ftrv (current_cpu, FLD (f_vn));
2196 return vpc;
2197 #undef FLD
2200 /* jmp-compact: jmp @$rn */
2202 static SEM_PC
2203 SEM_FN_NAME (sh64_compact,jmp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2205 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2206 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2207 int UNUSED written = 0;
2208 IADDR UNUSED pc = abuf->addr;
2209 SEM_BRANCH_INIT
2210 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2214 UDI opval = ADDDI (pc, 2);
2215 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2216 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2218 ((void) 0); /*nop*/
2221 UDI opval = GET_H_GRC (FLD (f_rn));
2222 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2223 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2226 ((void) 0); /*nop*/
2229 SEM_BRANCH_FINI (vpc);
2230 return vpc;
2231 #undef FLD
2234 /* jsr-compact: jsr @$rn */
2236 static SEM_PC
2237 SEM_FN_NAME (sh64_compact,jsr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2239 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2240 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2241 int UNUSED written = 0;
2242 IADDR UNUSED pc = abuf->addr;
2243 SEM_BRANCH_INIT
2244 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2249 SI opval = ADDDI (pc, 4);
2250 SET_H_PR (opval);
2251 TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2255 UDI opval = ADDDI (pc, 2);
2256 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2257 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2259 ((void) 0); /*nop*/
2262 UDI opval = GET_H_GRC (FLD (f_rn));
2263 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2264 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
2267 ((void) 0); /*nop*/
2270 SEM_BRANCH_FINI (vpc);
2271 return vpc;
2272 #undef FLD
2275 /* ldc-gbr-compact: ldc $rn, gbr */
2277 static SEM_PC
2278 SEM_FN_NAME (sh64_compact,ldc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2280 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2281 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2282 int UNUSED written = 0;
2283 IADDR UNUSED pc = abuf->addr;
2284 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2287 SI opval = GET_H_GRC (FLD (f_rn));
2288 SET_H_GBR (opval);
2289 TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval);
2292 return vpc;
2293 #undef FLD
2296 /* ldc-vbr-compact: ldc $rn, vbr */
2298 static SEM_PC
2299 SEM_FN_NAME (sh64_compact,ldc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2301 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2302 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2303 int UNUSED written = 0;
2304 IADDR UNUSED pc = abuf->addr;
2305 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2308 SI opval = GET_H_GRC (FLD (f_rn));
2309 SET_H_VBR (opval);
2310 TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval);
2313 return vpc;
2314 #undef FLD
2317 /* ldc-sr-compact: ldc $rn, sr */
2319 static SEM_PC
2320 SEM_FN_NAME (sh64_compact,ldc_sr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2322 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2323 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2324 int UNUSED written = 0;
2325 IADDR UNUSED pc = abuf->addr;
2326 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2329 SI opval = GET_H_GRC (FLD (f_rn));
2330 CPU (h_sr) = opval;
2331 TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval);
2334 return vpc;
2335 #undef FLD
2338 /* ldcl-gbr-compact: ldc.l @${rn}+, gbr */
2340 static SEM_PC
2341 SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2343 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2344 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2345 int UNUSED written = 0;
2346 IADDR UNUSED pc = abuf->addr;
2347 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2351 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2352 SET_H_GBR (opval);
2353 TRACE_RESULT (current_cpu, abuf, "gbr", 'x', opval);
2356 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2357 SET_H_GRC (FLD (f_rn), opval);
2358 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2362 return vpc;
2363 #undef FLD
2366 /* ldcl-vbr-compact: ldc.l @${rn}+, vbr */
2368 static SEM_PC
2369 SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2371 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2372 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2373 int UNUSED written = 0;
2374 IADDR UNUSED pc = abuf->addr;
2375 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2379 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2380 SET_H_VBR (opval);
2381 TRACE_RESULT (current_cpu, abuf, "vbr", 'x', opval);
2384 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2385 SET_H_GRC (FLD (f_rn), opval);
2386 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2390 return vpc;
2391 #undef FLD
2394 /* lds-fpscr-compact: lds $rn, fpscr */
2396 static SEM_PC
2397 SEM_FN_NAME (sh64_compact,lds_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2399 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2400 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2401 int UNUSED written = 0;
2402 IADDR UNUSED pc = abuf->addr;
2403 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2406 SI opval = GET_H_GRC (FLD (f_rn));
2407 CPU (h_fpscr) = opval;
2408 TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
2411 return vpc;
2412 #undef FLD
2415 /* ldsl-fpscr-compact: lds.l @${rn}+, fpscr */
2417 static SEM_PC
2418 SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2420 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2421 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2422 int UNUSED written = 0;
2423 IADDR UNUSED pc = abuf->addr;
2424 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2428 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2429 CPU (h_fpscr) = opval;
2430 TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
2433 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2434 SET_H_GRC (FLD (f_rn), opval);
2435 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2439 return vpc;
2440 #undef FLD
2443 /* lds-fpul-compact: lds $rn, fpul */
2445 static SEM_PC
2446 SEM_FN_NAME (sh64_compact,lds_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2448 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2449 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2450 int UNUSED written = 0;
2451 IADDR UNUSED pc = abuf->addr;
2452 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2455 SF opval = SUBWORDSISF (GET_H_GRC (FLD (f_rn)));
2456 CPU (h_fr[((UINT) 32)]) = opval;
2457 TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2460 return vpc;
2461 #undef FLD
2464 /* ldsl-fpul-compact: lds.l @${rn}+, fpul */
2466 static SEM_PC
2467 SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2469 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2470 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2471 int UNUSED written = 0;
2472 IADDR UNUSED pc = abuf->addr;
2473 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2477 SF opval = GETMEMSF (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2478 CPU (h_fr[((UINT) 32)]) = opval;
2479 TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
2482 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2483 SET_H_GRC (FLD (f_rn), opval);
2484 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2488 return vpc;
2489 #undef FLD
2492 /* lds-mach-compact: lds $rn, mach */
2494 static SEM_PC
2495 SEM_FN_NAME (sh64_compact,lds_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2497 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2498 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2499 int UNUSED written = 0;
2500 IADDR UNUSED pc = abuf->addr;
2501 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2504 SI opval = GET_H_GRC (FLD (f_rn));
2505 SET_H_MACH (opval);
2506 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2509 return vpc;
2510 #undef FLD
2513 /* ldsl-mach-compact: lds.l @${rn}+, mach */
2515 static SEM_PC
2516 SEM_FN_NAME (sh64_compact,ldsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2518 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2519 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2520 int UNUSED written = 0;
2521 IADDR UNUSED pc = abuf->addr;
2522 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2526 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2527 SET_H_MACH (opval);
2528 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2531 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2532 SET_H_GRC (FLD (f_rn), opval);
2533 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2537 return vpc;
2538 #undef FLD
2541 /* lds-macl-compact: lds $rn, macl */
2543 static SEM_PC
2544 SEM_FN_NAME (sh64_compact,lds_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2546 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2547 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2548 int UNUSED written = 0;
2549 IADDR UNUSED pc = abuf->addr;
2550 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2553 SI opval = GET_H_GRC (FLD (f_rn));
2554 SET_H_MACL (opval);
2555 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2558 return vpc;
2559 #undef FLD
2562 /* ldsl-macl-compact: lds.l @${rn}+, macl */
2564 static SEM_PC
2565 SEM_FN_NAME (sh64_compact,ldsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2567 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2568 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2569 int UNUSED written = 0;
2570 IADDR UNUSED pc = abuf->addr;
2571 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2575 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2576 SET_H_MACL (opval);
2577 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2580 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2581 SET_H_GRC (FLD (f_rn), opval);
2582 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2586 return vpc;
2587 #undef FLD
2590 /* lds-pr-compact: lds $rn, pr */
2592 static SEM_PC
2593 SEM_FN_NAME (sh64_compact,lds_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2595 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2596 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2597 int UNUSED written = 0;
2598 IADDR UNUSED pc = abuf->addr;
2599 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2602 SI opval = GET_H_GRC (FLD (f_rn));
2603 SET_H_PR (opval);
2604 TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2607 return vpc;
2608 #undef FLD
2611 /* ldsl-pr-compact: lds.l @${rn}+, pr */
2613 static SEM_PC
2614 SEM_FN_NAME (sh64_compact,ldsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2616 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
2617 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2618 int UNUSED written = 0;
2619 IADDR UNUSED pc = abuf->addr;
2620 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2624 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2625 SET_H_PR (opval);
2626 TRACE_RESULT (current_cpu, abuf, "pr", 'x', opval);
2629 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2630 SET_H_GRC (FLD (f_rn), opval);
2631 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2635 return vpc;
2636 #undef FLD
2639 /* macl-compact: mac.l @${rm}+, @${rn}+ */
2641 static SEM_PC
2642 SEM_FN_NAME (sh64_compact,macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2644 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2645 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2646 int UNUSED written = 0;
2647 IADDR UNUSED pc = abuf->addr;
2648 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2651 DI tmp_tmpry;
2652 DI tmp_mac;
2653 DI tmp_result;
2654 SI tmp_x;
2655 SI tmp_y;
2656 tmp_x = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2658 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2659 SET_H_GRC (FLD (f_rn), opval);
2660 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2662 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2665 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
2666 SET_H_GRC (FLD (f_rn), opval);
2667 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2670 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
2671 SET_H_GRC (FLD (f_rm), opval);
2672 written |= (1 << 11);
2673 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2677 tmp_y = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
2679 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
2680 SET_H_GRC (FLD (f_rm), opval);
2681 written |= (1 << 11);
2682 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2684 tmp_tmpry = MULDI (ZEXTSIDI (tmp_x), ZEXTSIDI (tmp_y));
2685 tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ()));
2686 tmp_result = ADDDI (tmp_mac, tmp_tmpry);
2688 if (GET_H_SBIT ()) {
2690 SI tmp_min;
2691 SI tmp_max;
2692 tmp_max = SRLDI (INVDI (0), 16);
2693 tmp_min = SRLDI (INVDI (0), 15);
2694 if (GTDI (tmp_result, tmp_max)) {
2695 tmp_result = tmp_max;
2696 } else {
2697 if (LTDI (tmp_result, tmp_min)) {
2698 tmp_result = tmp_min;
2704 SI opval = SUBWORDDISI (tmp_result, 0);
2705 SET_H_MACH (opval);
2706 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2709 SI opval = SUBWORDDISI (tmp_result, 1);
2710 SET_H_MACL (opval);
2711 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2716 abuf->written = written;
2717 return vpc;
2718 #undef FLD
2721 /* macw-compact: mac.w @${rm}+, @${rn}+ */
2723 static SEM_PC
2724 SEM_FN_NAME (sh64_compact,macw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2726 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2727 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2728 int UNUSED written = 0;
2729 IADDR UNUSED pc = abuf->addr;
2730 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2733 SI tmp_tmpry;
2734 DI tmp_mac;
2735 DI tmp_result;
2736 HI tmp_x;
2737 HI tmp_y;
2738 tmp_x = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
2740 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2);
2741 SET_H_GRC (FLD (f_rn), opval);
2742 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2744 if (EQSI (FLD (f_rn), FLD (f_rm))) {
2747 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 2);
2748 SET_H_GRC (FLD (f_rn), opval);
2749 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2752 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
2753 SET_H_GRC (FLD (f_rm), opval);
2754 written |= (1 << 11);
2755 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2759 tmp_y = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
2761 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
2762 SET_H_GRC (FLD (f_rm), opval);
2763 written |= (1 << 11);
2764 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2766 tmp_tmpry = MULSI (ZEXTHISI (tmp_x), ZEXTHISI (tmp_y));
2767 if (GET_H_SBIT ()) {
2769 if (ADDOFSI (tmp_tmpry, GET_H_MACL (), 0)) {
2771 SI opval = 1;
2772 SET_H_MACH (opval);
2773 written |= (1 << 9);
2774 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2778 SI opval = ADDSI (tmp_tmpry, GET_H_MACL ());
2779 SET_H_MACL (opval);
2780 written |= (1 << 10);
2781 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2784 } else {
2786 tmp_mac = ORDI (SLLDI (ZEXTSIDI (GET_H_MACH ()), 32), ZEXTSIDI (GET_H_MACL ()));
2787 tmp_result = ADDDI (tmp_mac, EXTSIDI (tmp_tmpry));
2789 SI opval = SUBWORDDISI (tmp_result, 0);
2790 SET_H_MACH (opval);
2791 written |= (1 << 9);
2792 TRACE_RESULT (current_cpu, abuf, "mach", 'x', opval);
2795 SI opval = SUBWORDDISI (tmp_result, 1);
2796 SET_H_MACL (opval);
2797 written |= (1 << 10);
2798 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
2804 abuf->written = written;
2805 return vpc;
2806 #undef FLD
2809 /* mov-compact: mov $rm64, $rn64 */
2811 static SEM_PC
2812 SEM_FN_NAME (sh64_compact,mov_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2814 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2815 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2816 int UNUSED written = 0;
2817 IADDR UNUSED pc = abuf->addr;
2818 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2821 DI opval = GET_H_GR (FLD (f_rm));
2822 SET_H_GR (FLD (f_rn), opval);
2823 TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2826 return vpc;
2827 #undef FLD
2830 /* movi-compact: mov #$imm8, $rn */
2832 static SEM_PC
2833 SEM_FN_NAME (sh64_compact,movi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2835 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2836 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2837 int UNUSED written = 0;
2838 IADDR UNUSED pc = abuf->addr;
2839 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2842 SI opval = EXTQIDI (ANDQI (FLD (f_imm8), 255));
2843 SET_H_GRC (FLD (f_rn), opval);
2844 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2847 return vpc;
2848 #undef FLD
2851 /* movi20-compact: movi20 #$imm20, $rn */
2853 static SEM_PC
2854 SEM_FN_NAME (sh64_compact,movi20_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2856 #define FLD(f) abuf->fields.sfmt_movi20_compact.f
2857 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2858 int UNUSED written = 0;
2859 IADDR UNUSED pc = abuf->addr;
2860 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2863 SI opval = FLD (f_imm20);
2864 SET_H_GRC (FLD (f_rn), opval);
2865 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2868 return vpc;
2869 #undef FLD
2872 /* movb1-compact: mov.b $rm, @$rn */
2874 static SEM_PC
2875 SEM_FN_NAME (sh64_compact,movb1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2877 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2878 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2879 int UNUSED written = 0;
2880 IADDR UNUSED pc = abuf->addr;
2881 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2884 UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2885 SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
2886 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2889 return vpc;
2890 #undef FLD
2893 /* movb2-compact: mov.b $rm, @-$rn */
2895 static SEM_PC
2896 SEM_FN_NAME (sh64_compact,movb2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2898 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2899 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2900 int UNUSED written = 0;
2901 IADDR UNUSED pc = abuf->addr;
2902 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2905 DI tmp_addr;
2906 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 1);
2908 UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2909 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2910 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2913 SI opval = tmp_addr;
2914 SET_H_GRC (FLD (f_rn), opval);
2915 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
2919 return vpc;
2920 #undef FLD
2923 /* movb3-compact: mov.b $rm, @(r0,$rn) */
2925 static SEM_PC
2926 SEM_FN_NAME (sh64_compact,movb3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2928 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
2929 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2930 int UNUSED written = 0;
2931 IADDR UNUSED pc = abuf->addr;
2932 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2935 UQI opval = SUBWORDSIUQI (GET_H_GRC (FLD (f_rm)), 3);
2936 SETMEMUQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
2937 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2940 return vpc;
2941 #undef FLD
2944 /* movb4-compact: mov.b r0, @($imm8, gbr) */
2946 static SEM_PC
2947 SEM_FN_NAME (sh64_compact,movb4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2949 #define FLD(f) abuf->fields.sfmt_addi_compact.f
2950 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2951 int UNUSED written = 0;
2952 IADDR UNUSED pc = abuf->addr;
2953 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2956 DI tmp_addr;
2957 tmp_addr = ADDSI (GET_H_GBR (), FLD (f_imm8));
2959 UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3);
2960 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2961 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2965 return vpc;
2966 #undef FLD
2969 /* movb5-compact: mov.b r0, @($imm4, $rm) */
2971 static SEM_PC
2972 SEM_FN_NAME (sh64_compact,movb5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2974 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
2975 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2976 int UNUSED written = 0;
2977 IADDR UNUSED pc = abuf->addr;
2978 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2981 DI tmp_addr;
2982 tmp_addr = ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4));
2984 UQI opval = SUBWORDSIUQI (GET_H_GRC (((UINT) 0)), 3);
2985 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
2986 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2990 return vpc;
2991 #undef FLD
2994 /* movb6-compact: mov.b @$rm, $rn */
2996 static SEM_PC
2997 SEM_FN_NAME (sh64_compact,movb6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2999 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3000 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3001 int UNUSED written = 0;
3002 IADDR UNUSED pc = abuf->addr;
3003 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3006 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm))));
3007 SET_H_GRC (FLD (f_rn), opval);
3008 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3011 return vpc;
3012 #undef FLD
3015 /* movb7-compact: mov.b @${rm}+, $rn */
3017 static SEM_PC
3018 SEM_FN_NAME (sh64_compact,movb7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3020 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3021 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3022 int UNUSED written = 0;
3023 IADDR UNUSED pc = abuf->addr;
3024 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3027 QI tmp_data;
3028 tmp_data = GETMEMQI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3029 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3031 SI opval = EXTQISI (tmp_data);
3032 SET_H_GRC (FLD (f_rm), opval);
3033 written |= (1 << 4);
3034 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3036 } else {
3038 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 1);
3039 SET_H_GRC (FLD (f_rm), opval);
3040 written |= (1 << 4);
3041 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3045 SI opval = EXTQISI (tmp_data);
3046 SET_H_GRC (FLD (f_rn), opval);
3047 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3051 abuf->written = written;
3052 return vpc;
3053 #undef FLD
3056 /* movb8-compact: mov.b @(r0, $rm), $rn */
3058 static SEM_PC
3059 SEM_FN_NAME (sh64_compact,movb8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3061 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3062 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3063 int UNUSED written = 0;
3064 IADDR UNUSED pc = abuf->addr;
3065 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3068 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))));
3069 SET_H_GRC (FLD (f_rn), opval);
3070 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3073 return vpc;
3074 #undef FLD
3077 /* movb9-compact: mov.b @($imm8, gbr), r0 */
3079 static SEM_PC
3080 SEM_FN_NAME (sh64_compact,movb9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3082 #define FLD(f) abuf->fields.sfmt_addi_compact.f
3083 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3084 int UNUSED written = 0;
3085 IADDR UNUSED pc = abuf->addr;
3086 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3089 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8))));
3090 SET_H_GRC (((UINT) 0), opval);
3091 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3094 return vpc;
3095 #undef FLD
3098 /* movb10-compact: mov.b @($imm4, $rm), r0 */
3100 static SEM_PC
3101 SEM_FN_NAME (sh64_compact,movb10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3103 #define FLD(f) abuf->fields.sfmt_movb5_compact.f
3104 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3105 int UNUSED written = 0;
3106 IADDR UNUSED pc = abuf->addr;
3107 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3110 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4))));
3111 SET_H_GRC (((UINT) 0), opval);
3112 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3115 return vpc;
3116 #undef FLD
3119 /* movl1-compact: mov.l $rm, @$rn */
3121 static SEM_PC
3122 SEM_FN_NAME (sh64_compact,movl1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3124 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3125 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3126 int UNUSED written = 0;
3127 IADDR UNUSED pc = abuf->addr;
3128 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3131 SI opval = GET_H_GRC (FLD (f_rm));
3132 SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3133 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3136 return vpc;
3137 #undef FLD
3140 /* movl2-compact: mov.l $rm, @-$rn */
3142 static SEM_PC
3143 SEM_FN_NAME (sh64_compact,movl2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3145 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3146 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3147 int UNUSED written = 0;
3148 IADDR UNUSED pc = abuf->addr;
3149 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3152 SI tmp_addr;
3153 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
3155 SI opval = GET_H_GRC (FLD (f_rm));
3156 SETMEMSI (current_cpu, pc, tmp_addr, opval);
3157 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3160 SI opval = tmp_addr;
3161 SET_H_GRC (FLD (f_rn), opval);
3162 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3166 return vpc;
3167 #undef FLD
3170 /* movl3-compact: mov.l $rm, @(r0, $rn) */
3172 static SEM_PC
3173 SEM_FN_NAME (sh64_compact,movl3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3175 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3176 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3177 int UNUSED written = 0;
3178 IADDR UNUSED pc = abuf->addr;
3179 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3182 SI opval = GET_H_GRC (FLD (f_rm));
3183 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
3184 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3187 return vpc;
3188 #undef FLD
3191 /* movl4-compact: mov.l r0, @($imm8x4, gbr) */
3193 static SEM_PC
3194 SEM_FN_NAME (sh64_compact,movl4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3196 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3197 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3198 int UNUSED written = 0;
3199 IADDR UNUSED pc = abuf->addr;
3200 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3203 SI opval = GET_H_GRC (((UINT) 0));
3204 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)), opval);
3205 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3208 return vpc;
3209 #undef FLD
3212 /* movl5-compact: mov.l $rm, @($imm4x4, $rn) */
3214 static SEM_PC
3215 SEM_FN_NAME (sh64_compact,movl5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3217 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3218 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3219 int UNUSED written = 0;
3220 IADDR UNUSED pc = abuf->addr;
3221 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3224 SI opval = GET_H_GRC (FLD (f_rm));
3225 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm4x4)), opval);
3226 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3229 return vpc;
3230 #undef FLD
3233 /* movl6-compact: mov.l @$rm, $rn */
3235 static SEM_PC
3236 SEM_FN_NAME (sh64_compact,movl6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3238 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3239 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3240 int UNUSED written = 0;
3241 IADDR UNUSED pc = abuf->addr;
3242 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3245 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3246 SET_H_GRC (FLD (f_rn), opval);
3247 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3250 return vpc;
3251 #undef FLD
3254 /* movl7-compact: mov.l @${rm}+, $rn */
3256 static SEM_PC
3257 SEM_FN_NAME (sh64_compact,movl7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3259 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3260 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3261 int UNUSED written = 0;
3262 IADDR UNUSED pc = abuf->addr;
3263 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3267 SI opval = GETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3268 SET_H_GRC (FLD (f_rn), opval);
3269 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3271 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3273 SI opval = GET_H_GRC (FLD (f_rn));
3274 SET_H_GRC (FLD (f_rm), opval);
3275 written |= (1 << 5);
3276 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3278 } else {
3280 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 4);
3281 SET_H_GRC (FLD (f_rm), opval);
3282 written |= (1 << 5);
3283 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3288 abuf->written = written;
3289 return vpc;
3290 #undef FLD
3293 /* movl8-compact: mov.l @(r0, $rm), $rn */
3295 static SEM_PC
3296 SEM_FN_NAME (sh64_compact,movl8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3298 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3299 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3300 int UNUSED written = 0;
3301 IADDR UNUSED pc = abuf->addr;
3302 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3305 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm))));
3306 SET_H_GRC (FLD (f_rn), opval);
3307 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3310 return vpc;
3311 #undef FLD
3314 /* movl9-compact: mov.l @($imm8x4, gbr), r0 */
3316 static SEM_PC
3317 SEM_FN_NAME (sh64_compact,movl9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3319 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3320 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3321 int UNUSED written = 0;
3322 IADDR UNUSED pc = abuf->addr;
3323 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3326 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x4)));
3327 SET_H_GRC (((UINT) 0), opval);
3328 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3331 return vpc;
3332 #undef FLD
3335 /* movl10-compact: mov.l @($imm8x4, pc), $rn */
3337 static SEM_PC
3338 SEM_FN_NAME (sh64_compact,movl10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3340 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3341 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3342 int UNUSED written = 0;
3343 IADDR UNUSED pc = abuf->addr;
3344 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3347 SI opval = GETMEMSI (current_cpu, pc, ADDSI (FLD (f_imm8x4), ANDDI (ADDDI (pc, 4), INVSI (3))));
3348 SET_H_GRC (FLD (f_rn), opval);
3349 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3352 return vpc;
3353 #undef FLD
3356 /* movl11-compact: mov.l @($imm4x4, $rm), $rn */
3358 static SEM_PC
3359 SEM_FN_NAME (sh64_compact,movl11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3361 #define FLD(f) abuf->fields.sfmt_movl5_compact.f
3362 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3363 int UNUSED written = 0;
3364 IADDR UNUSED pc = abuf->addr;
3365 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3368 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x4)));
3369 SET_H_GRC (FLD (f_rn), opval);
3370 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3373 return vpc;
3374 #undef FLD
3377 /* movl12-compact: mov.l @($imm12x4, $rm), $rn */
3379 static SEM_PC
3380 SEM_FN_NAME (sh64_compact,movl12_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3382 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3383 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3384 int UNUSED written = 0;
3385 IADDR UNUSED pc = abuf->addr;
3386 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3389 SI opval = GETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm12x4)));
3390 SET_H_GRC (FLD (f_rn), opval);
3391 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3394 return vpc;
3395 #undef FLD
3398 /* movl13-compact: mov.l $rm, @($imm12x4, $rn) */
3400 static SEM_PC
3401 SEM_FN_NAME (sh64_compact,movl13_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3403 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3404 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3405 int UNUSED written = 0;
3406 IADDR UNUSED pc = abuf->addr;
3407 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3410 SI opval = GET_H_GRC (FLD (f_rm));
3411 SETMEMSI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rn)), FLD (f_imm12x4)), opval);
3412 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3415 return vpc;
3416 #undef FLD
3419 /* movw1-compact: mov.w $rm, @$rn */
3421 static SEM_PC
3422 SEM_FN_NAME (sh64_compact,movw1_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3424 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3425 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3426 int UNUSED written = 0;
3427 IADDR UNUSED pc = abuf->addr;
3428 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3431 HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3432 SETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3433 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3436 return vpc;
3437 #undef FLD
3440 /* movw2-compact: mov.w $rm, @-$rn */
3442 static SEM_PC
3443 SEM_FN_NAME (sh64_compact,movw2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3445 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3446 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3447 int UNUSED written = 0;
3448 IADDR UNUSED pc = abuf->addr;
3449 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3452 DI tmp_addr;
3453 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 2);
3455 HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3456 SETMEMHI (current_cpu, pc, tmp_addr, opval);
3457 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3460 SI opval = tmp_addr;
3461 SET_H_GRC (FLD (f_rn), opval);
3462 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3466 return vpc;
3467 #undef FLD
3470 /* movw3-compact: mov.w $rm, @(r0, $rn) */
3472 static SEM_PC
3473 SEM_FN_NAME (sh64_compact,movw3_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3475 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3476 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3477 int UNUSED written = 0;
3478 IADDR UNUSED pc = abuf->addr;
3479 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3482 HI opval = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1);
3483 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rn))), opval);
3484 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3487 return vpc;
3488 #undef FLD
3491 /* movw4-compact: mov.w r0, @($imm8x2, gbr) */
3493 static SEM_PC
3494 SEM_FN_NAME (sh64_compact,movw4_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3496 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3497 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3498 int UNUSED written = 0;
3499 IADDR UNUSED pc = abuf->addr;
3500 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3503 HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1);
3504 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2)), opval);
3505 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3508 return vpc;
3509 #undef FLD
3512 /* movw5-compact: mov.w r0, @($imm4x2, $rm) */
3514 static SEM_PC
3515 SEM_FN_NAME (sh64_compact,movw5_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3517 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3518 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3519 int UNUSED written = 0;
3520 IADDR UNUSED pc = abuf->addr;
3521 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3524 HI opval = SUBWORDSIHI (GET_H_GRC (((UINT) 0)), 1);
3525 SETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2)), opval);
3526 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3529 return vpc;
3530 #undef FLD
3533 /* movw6-compact: mov.w @$rm, $rn */
3535 static SEM_PC
3536 SEM_FN_NAME (sh64_compact,movw6_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3538 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3539 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3540 int UNUSED written = 0;
3541 IADDR UNUSED pc = abuf->addr;
3542 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3545 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm))));
3546 SET_H_GRC (FLD (f_rn), opval);
3547 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3550 return vpc;
3551 #undef FLD
3554 /* movw7-compact: mov.w @${rm}+, $rn */
3556 static SEM_PC
3557 SEM_FN_NAME (sh64_compact,movw7_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3559 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3560 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3561 int UNUSED written = 0;
3562 IADDR UNUSED pc = abuf->addr;
3563 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3566 HI tmp_data;
3567 tmp_data = GETMEMHI (current_cpu, pc, GET_H_GRC (FLD (f_rm)));
3568 if (EQSI (FLD (f_rm), FLD (f_rn))) {
3570 SI opval = EXTHISI (tmp_data);
3571 SET_H_GRC (FLD (f_rm), opval);
3572 written |= (1 << 4);
3573 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3575 } else {
3577 SI opval = ADDSI (GET_H_GRC (FLD (f_rm)), 2);
3578 SET_H_GRC (FLD (f_rm), opval);
3579 written |= (1 << 4);
3580 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3584 SI opval = EXTHISI (tmp_data);
3585 SET_H_GRC (FLD (f_rn), opval);
3586 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3590 abuf->written = written;
3591 return vpc;
3592 #undef FLD
3595 /* movw8-compact: mov.w @(r0, $rm), $rn */
3597 static SEM_PC
3598 SEM_FN_NAME (sh64_compact,movw8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3600 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3601 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3602 int UNUSED written = 0;
3603 IADDR UNUSED pc = abuf->addr;
3604 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3607 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GRC (FLD (f_rm)))));
3608 SET_H_GRC (FLD (f_rn), opval);
3609 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3612 return vpc;
3613 #undef FLD
3616 /* movw9-compact: mov.w @($imm8x2, gbr), r0 */
3618 static SEM_PC
3619 SEM_FN_NAME (sh64_compact,movw9_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3621 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3622 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3623 int UNUSED written = 0;
3624 IADDR UNUSED pc = abuf->addr;
3625 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3628 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GBR (), FLD (f_imm8x2))));
3629 SET_H_GRC (((UINT) 0), opval);
3630 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3633 return vpc;
3634 #undef FLD
3637 /* movw10-compact: mov.w @($imm8x2, pc), $rn */
3639 static SEM_PC
3640 SEM_FN_NAME (sh64_compact,movw10_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3642 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3643 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3644 int UNUSED written = 0;
3645 IADDR UNUSED pc = abuf->addr;
3646 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3649 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDDI (ADDDI (pc, 4), FLD (f_imm8x2))));
3650 SET_H_GRC (FLD (f_rn), opval);
3651 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3654 return vpc;
3655 #undef FLD
3658 /* movw11-compact: mov.w @($imm4x2, $rm), r0 */
3660 static SEM_PC
3661 SEM_FN_NAME (sh64_compact,movw11_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3663 #define FLD(f) abuf->fields.sfmt_movw5_compact.f
3664 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3665 int UNUSED written = 0;
3666 IADDR UNUSED pc = abuf->addr;
3667 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3670 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (GET_H_GRC (FLD (f_rm)), FLD (f_imm4x2))));
3671 SET_H_GRC (((UINT) 0), opval);
3672 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3675 return vpc;
3676 #undef FLD
3679 /* mova-compact: mova @($imm8x4, pc), r0 */
3681 static SEM_PC
3682 SEM_FN_NAME (sh64_compact,mova_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3684 #define FLD(f) abuf->fields.sfmt_movl10_compact.f
3685 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3686 int UNUSED written = 0;
3687 IADDR UNUSED pc = abuf->addr;
3688 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3691 SI opval = ADDDI (ANDDI (ADDDI (pc, 4), INVSI (3)), FLD (f_imm8x4));
3692 SET_H_GRC (((UINT) 0), opval);
3693 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3696 return vpc;
3697 #undef FLD
3700 /* movcal-compact: movca.l r0, @$rn */
3702 static SEM_PC
3703 SEM_FN_NAME (sh64_compact,movcal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3705 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3706 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3707 int UNUSED written = 0;
3708 IADDR UNUSED pc = abuf->addr;
3709 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3712 SI opval = GET_H_GRC (((UINT) 0));
3713 SETMEMSI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
3714 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
3717 return vpc;
3718 #undef FLD
3721 /* movcol-compact: movco.l r0, @$rn */
3723 static SEM_PC
3724 SEM_FN_NAME (sh64_compact,movcol_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3726 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3727 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3728 int UNUSED written = 0;
3729 IADDR UNUSED pc = abuf->addr;
3730 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3733 SI opval = GET_H_GRC (FLD (f_rn));
3734 SET_H_GRC (FLD (f_rn), opval);
3735 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3738 return vpc;
3739 #undef FLD
3742 /* movt-compact: movt $rn */
3744 static SEM_PC
3745 SEM_FN_NAME (sh64_compact,movt_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3747 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3748 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3749 int UNUSED written = 0;
3750 IADDR UNUSED pc = abuf->addr;
3751 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3754 SI opval = ZEXTBISI (GET_H_TBIT ());
3755 SET_H_GRC (FLD (f_rn), opval);
3756 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3759 return vpc;
3760 #undef FLD
3763 /* movual-compact: movua.l @$rn, r0 */
3765 static SEM_PC
3766 SEM_FN_NAME (sh64_compact,movual_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3768 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3769 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3770 int UNUSED written = 0;
3771 IADDR UNUSED pc = abuf->addr;
3772 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3775 SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
3776 SET_H_GRC (((UINT) 0), opval);
3777 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3780 return vpc;
3781 #undef FLD
3784 /* movual2-compact: movua.l @$rn+, r0 */
3786 static SEM_PC
3787 SEM_FN_NAME (sh64_compact,movual2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3789 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3790 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3791 int UNUSED written = 0;
3792 IADDR UNUSED pc = abuf->addr;
3793 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3797 SI opval = sh64_movua (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
3798 SET_H_GRC (((UINT) 0), opval);
3799 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3802 SI opval = ADDSI (GET_H_GRC (FLD (f_rn)), 4);
3803 SET_H_GRC (FLD (f_rn), opval);
3804 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3808 return vpc;
3809 #undef FLD
3812 /* mull-compact: mul.l $rm, $rn */
3814 static SEM_PC
3815 SEM_FN_NAME (sh64_compact,mull_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3817 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3818 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3819 int UNUSED written = 0;
3820 IADDR UNUSED pc = abuf->addr;
3821 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3824 SI opval = MULSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn)));
3825 SET_H_MACL (opval);
3826 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3829 return vpc;
3830 #undef FLD
3833 /* mulsw-compact: muls.w $rm, $rn */
3835 static SEM_PC
3836 SEM_FN_NAME (sh64_compact,mulsw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3838 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3839 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3840 int UNUSED written = 0;
3841 IADDR UNUSED pc = abuf->addr;
3842 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3845 SI opval = MULSI (EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), EXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1)));
3846 SET_H_MACL (opval);
3847 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3850 return vpc;
3851 #undef FLD
3854 /* muluw-compact: mulu.w $rm, $rn */
3856 static SEM_PC
3857 SEM_FN_NAME (sh64_compact,muluw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3859 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3860 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3861 int UNUSED written = 0;
3862 IADDR UNUSED pc = abuf->addr;
3863 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3866 SI opval = MULSI (ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 1)), ZEXTHISI (SUBWORDSIHI (GET_H_GRC (FLD (f_rn)), 1)));
3867 SET_H_MACL (opval);
3868 TRACE_RESULT (current_cpu, abuf, "macl", 'x', opval);
3871 return vpc;
3872 #undef FLD
3875 /* neg-compact: neg $rm, $rn */
3877 static SEM_PC
3878 SEM_FN_NAME (sh64_compact,neg_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3880 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3881 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3882 int UNUSED written = 0;
3883 IADDR UNUSED pc = abuf->addr;
3884 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3887 SI opval = NEGSI (GET_H_GRC (FLD (f_rm)));
3888 SET_H_GRC (FLD (f_rn), opval);
3889 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3892 return vpc;
3893 #undef FLD
3896 /* negc-compact: negc $rm, $rn */
3898 static SEM_PC
3899 SEM_FN_NAME (sh64_compact,negc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3901 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3902 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3903 int UNUSED written = 0;
3904 IADDR UNUSED pc = abuf->addr;
3905 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3908 BI tmp_flag;
3909 tmp_flag = SUBCFSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
3911 SI opval = SUBCSI (0, GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
3912 SET_H_GRC (FLD (f_rn), opval);
3913 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3916 BI opval = tmp_flag;
3917 SET_H_TBIT (opval);
3918 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
3922 return vpc;
3923 #undef FLD
3926 /* nop-compact: nop */
3928 static SEM_PC
3929 SEM_FN_NAME (sh64_compact,nop_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3931 #define FLD(f) abuf->fields.fmt_empty.f
3932 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3933 int UNUSED written = 0;
3934 IADDR UNUSED pc = abuf->addr;
3935 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3937 ((void) 0); /*nop*/
3939 return vpc;
3940 #undef FLD
3943 /* not-compact: not $rm64, $rn64 */
3945 static SEM_PC
3946 SEM_FN_NAME (sh64_compact,not_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3948 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
3949 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3950 int UNUSED written = 0;
3951 IADDR UNUSED pc = abuf->addr;
3952 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3955 DI opval = INVDI (GET_H_GR (FLD (f_rm)));
3956 SET_H_GR (FLD (f_rn), opval);
3957 TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3960 return vpc;
3961 #undef FLD
3964 /* ocbi-compact: ocbi @$rn */
3966 static SEM_PC
3967 SEM_FN_NAME (sh64_compact,ocbi_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3969 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3970 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3971 int UNUSED written = 0;
3972 IADDR UNUSED pc = abuf->addr;
3973 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
3977 SI opval = GET_H_GRC (FLD (f_rn));
3978 SET_H_GRC (FLD (f_rn), opval);
3979 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
3981 ((void) 0); /*nop*/
3984 return vpc;
3985 #undef FLD
3988 /* ocbp-compact: ocbp @$rn */
3990 static SEM_PC
3991 SEM_FN_NAME (sh64_compact,ocbp_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3993 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
3994 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3995 int UNUSED written = 0;
3996 IADDR UNUSED pc = abuf->addr;
3997 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4001 SI opval = GET_H_GRC (FLD (f_rn));
4002 SET_H_GRC (FLD (f_rn), opval);
4003 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4005 ((void) 0); /*nop*/
4008 return vpc;
4009 #undef FLD
4012 /* ocbwb-compact: ocbwb @$rn */
4014 static SEM_PC
4015 SEM_FN_NAME (sh64_compact,ocbwb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4017 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4018 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4019 int UNUSED written = 0;
4020 IADDR UNUSED pc = abuf->addr;
4021 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4025 SI opval = GET_H_GRC (FLD (f_rn));
4026 SET_H_GRC (FLD (f_rn), opval);
4027 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4029 ((void) 0); /*nop*/
4032 return vpc;
4033 #undef FLD
4036 /* or-compact: or $rm64, $rn64 */
4038 static SEM_PC
4039 SEM_FN_NAME (sh64_compact,or_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4041 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4042 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4043 int UNUSED written = 0;
4044 IADDR UNUSED pc = abuf->addr;
4045 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4048 DI opval = ORDI (GET_H_GR (FLD (f_rm)), GET_H_GR (FLD (f_rn)));
4049 SET_H_GR (FLD (f_rn), opval);
4050 TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4053 return vpc;
4054 #undef FLD
4057 /* ori-compact: or #$uimm8, r0 */
4059 static SEM_PC
4060 SEM_FN_NAME (sh64_compact,ori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4062 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4063 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4064 int UNUSED written = 0;
4065 IADDR UNUSED pc = abuf->addr;
4066 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4069 SI opval = ORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
4070 SET_H_GRC (((UINT) 0), opval);
4071 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4074 return vpc;
4075 #undef FLD
4078 /* orb-compact: or.b #$imm8, @(r0, gbr) */
4080 static SEM_PC
4081 SEM_FN_NAME (sh64_compact,orb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4083 #define FLD(f) abuf->fields.sfmt_addi_compact.f
4084 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4085 int UNUSED written = 0;
4086 IADDR UNUSED pc = abuf->addr;
4087 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4090 DI tmp_addr;
4091 UQI tmp_data;
4092 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
4093 tmp_data = ORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
4095 UQI opval = tmp_data;
4096 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
4097 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4101 return vpc;
4102 #undef FLD
4105 /* pref-compact: pref @$rn */
4107 static SEM_PC
4108 SEM_FN_NAME (sh64_compact,pref_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4110 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4111 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4112 int UNUSED written = 0;
4113 IADDR UNUSED pc = abuf->addr;
4114 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4116 sh64_pref (current_cpu, GET_H_GRC (FLD (f_rn)));
4118 return vpc;
4119 #undef FLD
4122 /* rotcl-compact: rotcl $rn */
4124 static SEM_PC
4125 SEM_FN_NAME (sh64_compact,rotcl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4127 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4128 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4129 int UNUSED written = 0;
4130 IADDR UNUSED pc = abuf->addr;
4131 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4134 BI tmp_temp;
4135 tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4137 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), GET_H_TBIT ());
4138 SET_H_GRC (FLD (f_rn), opval);
4139 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4142 BI opval = ((tmp_temp) ? (1) : (0));
4143 SET_H_TBIT (opval);
4144 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4148 return vpc;
4149 #undef FLD
4152 /* rotcr-compact: rotcr $rn */
4154 static SEM_PC
4155 SEM_FN_NAME (sh64_compact,rotcr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4157 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4158 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4159 int UNUSED written = 0;
4160 IADDR UNUSED pc = abuf->addr;
4161 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4164 BI tmp_lsbit;
4165 SI tmp_temp;
4166 tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1));
4167 tmp_temp = GET_H_TBIT ();
4169 SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4170 SET_H_GRC (FLD (f_rn), opval);
4171 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4174 BI opval = ((tmp_lsbit) ? (1) : (0));
4175 SET_H_TBIT (opval);
4176 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4180 return vpc;
4181 #undef FLD
4184 /* rotl-compact: rotl $rn */
4186 static SEM_PC
4187 SEM_FN_NAME (sh64_compact,rotl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4189 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4190 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4191 int UNUSED written = 0;
4192 IADDR UNUSED pc = abuf->addr;
4193 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4196 BI tmp_temp;
4197 tmp_temp = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4199 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rn)), 1), tmp_temp);
4200 SET_H_GRC (FLD (f_rn), opval);
4201 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4204 BI opval = ((tmp_temp) ? (1) : (0));
4205 SET_H_TBIT (opval);
4206 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4210 return vpc;
4211 #undef FLD
4214 /* rotr-compact: rotr $rn */
4216 static SEM_PC
4217 SEM_FN_NAME (sh64_compact,rotr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4219 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4220 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4221 int UNUSED written = 0;
4222 IADDR UNUSED pc = abuf->addr;
4223 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4226 BI tmp_lsbit;
4227 SI tmp_temp;
4228 tmp_lsbit = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rn)), 1), 0)) ? (0) : (1));
4229 tmp_temp = tmp_lsbit;
4231 SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rn)), 1), SLLSI (tmp_temp, 31));
4232 SET_H_GRC (FLD (f_rn), opval);
4233 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4236 BI opval = ((tmp_lsbit) ? (1) : (0));
4237 SET_H_TBIT (opval);
4238 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4242 return vpc;
4243 #undef FLD
4246 /* rts-compact: rts */
4248 static SEM_PC
4249 SEM_FN_NAME (sh64_compact,rts_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4251 #define FLD(f) abuf->fields.fmt_empty.f
4252 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4253 int UNUSED written = 0;
4254 IADDR UNUSED pc = abuf->addr;
4255 SEM_BRANCH_INIT
4256 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4260 UDI opval = ADDDI (pc, 2);
4261 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
4262 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
4264 ((void) 0); /*nop*/
4267 UDI opval = GET_H_PR ();
4268 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
4269 TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
4272 ((void) 0); /*nop*/
4275 SEM_BRANCH_FINI (vpc);
4276 return vpc;
4277 #undef FLD
4280 /* sets-compact: sets */
4282 static SEM_PC
4283 SEM_FN_NAME (sh64_compact,sets_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4285 #define FLD(f) abuf->fields.fmt_empty.f
4286 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4287 int UNUSED written = 0;
4288 IADDR UNUSED pc = abuf->addr;
4289 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4292 BI opval = 1;
4293 SET_H_SBIT (opval);
4294 TRACE_RESULT (current_cpu, abuf, "sbit", 'x', opval);
4297 return vpc;
4298 #undef FLD
4301 /* sett-compact: sett */
4303 static SEM_PC
4304 SEM_FN_NAME (sh64_compact,sett_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4306 #define FLD(f) abuf->fields.fmt_empty.f
4307 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4308 int UNUSED written = 0;
4309 IADDR UNUSED pc = abuf->addr;
4310 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4313 BI opval = 1;
4314 SET_H_TBIT (opval);
4315 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4318 return vpc;
4319 #undef FLD
4322 /* shad-compact: shad $rm, $rn */
4324 static SEM_PC
4325 SEM_FN_NAME (sh64_compact,shad_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4327 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4328 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4329 int UNUSED written = 0;
4330 IADDR UNUSED pc = abuf->addr;
4331 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4334 SI tmp_shamt;
4335 tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31);
4336 if (GESI (GET_H_GRC (FLD (f_rm)), 0)) {
4338 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt);
4339 SET_H_GRC (FLD (f_rn), opval);
4340 written |= (1 << 2);
4341 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4343 } else {
4344 if (NESI (tmp_shamt, 0)) {
4346 SI opval = SRASI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt));
4347 SET_H_GRC (FLD (f_rn), opval);
4348 written |= (1 << 2);
4349 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4351 } else {
4352 if (LTSI (GET_H_GRC (FLD (f_rn)), 0)) {
4354 SI opval = NEGSI (1);
4355 SET_H_GRC (FLD (f_rn), opval);
4356 written |= (1 << 2);
4357 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4359 } else {
4361 SI opval = 0;
4362 SET_H_GRC (FLD (f_rn), opval);
4363 written |= (1 << 2);
4364 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4371 abuf->written = written;
4372 return vpc;
4373 #undef FLD
4376 /* shal-compact: shal $rn */
4378 static SEM_PC
4379 SEM_FN_NAME (sh64_compact,shal_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4381 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4382 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4383 int UNUSED written = 0;
4384 IADDR UNUSED pc = abuf->addr;
4385 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4388 BI tmp_t;
4389 tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4391 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1);
4392 SET_H_GRC (FLD (f_rn), opval);
4393 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4396 BI opval = ((tmp_t) ? (1) : (0));
4397 SET_H_TBIT (opval);
4398 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4402 return vpc;
4403 #undef FLD
4406 /* shar-compact: shar $rn */
4408 static SEM_PC
4409 SEM_FN_NAME (sh64_compact,shar_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4411 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4412 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4413 int UNUSED written = 0;
4414 IADDR UNUSED pc = abuf->addr;
4415 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4418 BI tmp_t;
4419 tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1);
4421 SI opval = SRASI (GET_H_GRC (FLD (f_rn)), 1);
4422 SET_H_GRC (FLD (f_rn), opval);
4423 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4426 BI opval = ((tmp_t) ? (1) : (0));
4427 SET_H_TBIT (opval);
4428 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4432 return vpc;
4433 #undef FLD
4436 /* shld-compact: shld $rm, $rn */
4438 static SEM_PC
4439 SEM_FN_NAME (sh64_compact,shld_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4441 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
4442 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4443 int UNUSED written = 0;
4444 IADDR UNUSED pc = abuf->addr;
4445 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4448 SI tmp_shamt;
4449 tmp_shamt = ANDSI (GET_H_GRC (FLD (f_rm)), 31);
4450 if (GESI (GET_H_GRC (FLD (f_rm)), 0)) {
4452 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), tmp_shamt);
4453 SET_H_GRC (FLD (f_rn), opval);
4454 written |= (1 << 2);
4455 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4457 } else {
4458 if (NESI (tmp_shamt, 0)) {
4460 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), SUBSI (32, tmp_shamt));
4461 SET_H_GRC (FLD (f_rn), opval);
4462 written |= (1 << 2);
4463 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4465 } else {
4467 SI opval = 0;
4468 SET_H_GRC (FLD (f_rn), opval);
4469 written |= (1 << 2);
4470 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4476 abuf->written = written;
4477 return vpc;
4478 #undef FLD
4481 /* shll-compact: shll $rn */
4483 static SEM_PC
4484 SEM_FN_NAME (sh64_compact,shll_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4486 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4487 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4488 int UNUSED written = 0;
4489 IADDR UNUSED pc = abuf->addr;
4490 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4493 BI tmp_t;
4494 tmp_t = SRLSI (GET_H_GRC (FLD (f_rn)), 31);
4496 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 1);
4497 SET_H_GRC (FLD (f_rn), opval);
4498 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4501 BI opval = ((tmp_t) ? (1) : (0));
4502 SET_H_TBIT (opval);
4503 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4507 return vpc;
4508 #undef FLD
4511 /* shll2-compact: shll2 $rn */
4513 static SEM_PC
4514 SEM_FN_NAME (sh64_compact,shll2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4516 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4517 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4518 int UNUSED written = 0;
4519 IADDR UNUSED pc = abuf->addr;
4520 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4523 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 2);
4524 SET_H_GRC (FLD (f_rn), opval);
4525 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4528 return vpc;
4529 #undef FLD
4532 /* shll8-compact: shll8 $rn */
4534 static SEM_PC
4535 SEM_FN_NAME (sh64_compact,shll8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4537 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4538 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4539 int UNUSED written = 0;
4540 IADDR UNUSED pc = abuf->addr;
4541 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4544 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 8);
4545 SET_H_GRC (FLD (f_rn), opval);
4546 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4549 return vpc;
4550 #undef FLD
4553 /* shll16-compact: shll16 $rn */
4555 static SEM_PC
4556 SEM_FN_NAME (sh64_compact,shll16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4558 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4559 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4560 int UNUSED written = 0;
4561 IADDR UNUSED pc = abuf->addr;
4562 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4565 SI opval = SLLSI (GET_H_GRC (FLD (f_rn)), 16);
4566 SET_H_GRC (FLD (f_rn), opval);
4567 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4570 return vpc;
4571 #undef FLD
4574 /* shlr-compact: shlr $rn */
4576 static SEM_PC
4577 SEM_FN_NAME (sh64_compact,shlr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4579 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4580 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4581 int UNUSED written = 0;
4582 IADDR UNUSED pc = abuf->addr;
4583 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4586 BI tmp_t;
4587 tmp_t = ANDSI (GET_H_GRC (FLD (f_rn)), 1);
4589 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 1);
4590 SET_H_GRC (FLD (f_rn), opval);
4591 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4594 BI opval = ((tmp_t) ? (1) : (0));
4595 SET_H_TBIT (opval);
4596 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
4600 return vpc;
4601 #undef FLD
4604 /* shlr2-compact: shlr2 $rn */
4606 static SEM_PC
4607 SEM_FN_NAME (sh64_compact,shlr2_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4609 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4610 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4611 int UNUSED written = 0;
4612 IADDR UNUSED pc = abuf->addr;
4613 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4616 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 2);
4617 SET_H_GRC (FLD (f_rn), opval);
4618 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4621 return vpc;
4622 #undef FLD
4625 /* shlr8-compact: shlr8 $rn */
4627 static SEM_PC
4628 SEM_FN_NAME (sh64_compact,shlr8_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4630 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4631 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4632 int UNUSED written = 0;
4633 IADDR UNUSED pc = abuf->addr;
4634 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4637 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 8);
4638 SET_H_GRC (FLD (f_rn), opval);
4639 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4642 return vpc;
4643 #undef FLD
4646 /* shlr16-compact: shlr16 $rn */
4648 static SEM_PC
4649 SEM_FN_NAME (sh64_compact,shlr16_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4651 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4652 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4653 int UNUSED written = 0;
4654 IADDR UNUSED pc = abuf->addr;
4655 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4658 SI opval = SRLSI (GET_H_GRC (FLD (f_rn)), 16);
4659 SET_H_GRC (FLD (f_rn), opval);
4660 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4663 return vpc;
4664 #undef FLD
4667 /* stc-gbr-compact: stc gbr, $rn */
4669 static SEM_PC
4670 SEM_FN_NAME (sh64_compact,stc_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4672 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4673 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4674 int UNUSED written = 0;
4675 IADDR UNUSED pc = abuf->addr;
4676 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4679 SI opval = GET_H_GBR ();
4680 SET_H_GRC (FLD (f_rn), opval);
4681 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4684 return vpc;
4685 #undef FLD
4688 /* stc-vbr-compact: stc vbr, $rn */
4690 static SEM_PC
4691 SEM_FN_NAME (sh64_compact,stc_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4693 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4694 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4695 int UNUSED written = 0;
4696 IADDR UNUSED pc = abuf->addr;
4697 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4700 SI opval = GET_H_VBR ();
4701 SET_H_GRC (FLD (f_rn), opval);
4702 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4705 return vpc;
4706 #undef FLD
4709 /* stcl-gbr-compact: stc.l gbr, @-$rn */
4711 static SEM_PC
4712 SEM_FN_NAME (sh64_compact,stcl_gbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4714 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4715 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4716 int UNUSED written = 0;
4717 IADDR UNUSED pc = abuf->addr;
4718 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4721 DI tmp_addr;
4722 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4724 SI opval = GET_H_GBR ();
4725 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4726 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4729 SI opval = tmp_addr;
4730 SET_H_GRC (FLD (f_rn), opval);
4731 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4735 return vpc;
4736 #undef FLD
4739 /* stcl-vbr-compact: stc.l vbr, @-$rn */
4741 static SEM_PC
4742 SEM_FN_NAME (sh64_compact,stcl_vbr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4744 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4745 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4746 int UNUSED written = 0;
4747 IADDR UNUSED pc = abuf->addr;
4748 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4751 DI tmp_addr;
4752 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4754 SI opval = GET_H_VBR ();
4755 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4756 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4759 SI opval = tmp_addr;
4760 SET_H_GRC (FLD (f_rn), opval);
4761 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4765 return vpc;
4766 #undef FLD
4769 /* sts-fpscr-compact: sts fpscr, $rn */
4771 static SEM_PC
4772 SEM_FN_NAME (sh64_compact,sts_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4774 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4775 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4776 int UNUSED written = 0;
4777 IADDR UNUSED pc = abuf->addr;
4778 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4781 SI opval = CPU (h_fpscr);
4782 SET_H_GRC (FLD (f_rn), opval);
4783 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4786 return vpc;
4787 #undef FLD
4790 /* stsl-fpscr-compact: sts.l fpscr, @-$rn */
4792 static SEM_PC
4793 SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4795 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4796 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4797 int UNUSED written = 0;
4798 IADDR UNUSED pc = abuf->addr;
4799 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4802 DI tmp_addr;
4803 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4805 SI opval = CPU (h_fpscr);
4806 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4807 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4810 SI opval = tmp_addr;
4811 SET_H_GRC (FLD (f_rn), opval);
4812 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4816 return vpc;
4817 #undef FLD
4820 /* sts-fpul-compact: sts fpul, $rn */
4822 static SEM_PC
4823 SEM_FN_NAME (sh64_compact,sts_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4825 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4826 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4827 int UNUSED written = 0;
4828 IADDR UNUSED pc = abuf->addr;
4829 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4832 SI opval = SUBWORDSFSI (CPU (h_fr[((UINT) 32)]));
4833 SET_H_GRC (FLD (f_rn), opval);
4834 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4837 return vpc;
4838 #undef FLD
4841 /* stsl-fpul-compact: sts.l fpul, @-$rn */
4843 static SEM_PC
4844 SEM_FN_NAME (sh64_compact,stsl_fpul_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4846 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4847 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4848 int UNUSED written = 0;
4849 IADDR UNUSED pc = abuf->addr;
4850 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4853 DI tmp_addr;
4854 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4856 SF opval = CPU (h_fr[((UINT) 32)]);
4857 SETMEMSF (current_cpu, pc, tmp_addr, opval);
4858 TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
4861 SI opval = tmp_addr;
4862 SET_H_GRC (FLD (f_rn), opval);
4863 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4867 return vpc;
4868 #undef FLD
4871 /* sts-mach-compact: sts mach, $rn */
4873 static SEM_PC
4874 SEM_FN_NAME (sh64_compact,sts_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4876 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4877 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4878 int UNUSED written = 0;
4879 IADDR UNUSED pc = abuf->addr;
4880 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4883 SI opval = GET_H_MACH ();
4884 SET_H_GRC (FLD (f_rn), opval);
4885 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4888 return vpc;
4889 #undef FLD
4892 /* stsl-mach-compact: sts.l mach, @-$rn */
4894 static SEM_PC
4895 SEM_FN_NAME (sh64_compact,stsl_mach_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4897 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4898 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4899 int UNUSED written = 0;
4900 IADDR UNUSED pc = abuf->addr;
4901 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4904 DI tmp_addr;
4905 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4907 SI opval = GET_H_MACH ();
4908 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4909 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4912 SI opval = tmp_addr;
4913 SET_H_GRC (FLD (f_rn), opval);
4914 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4918 return vpc;
4919 #undef FLD
4922 /* sts-macl-compact: sts macl, $rn */
4924 static SEM_PC
4925 SEM_FN_NAME (sh64_compact,sts_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4927 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4928 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4929 int UNUSED written = 0;
4930 IADDR UNUSED pc = abuf->addr;
4931 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4934 SI opval = GET_H_MACL ();
4935 SET_H_GRC (FLD (f_rn), opval);
4936 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4939 return vpc;
4940 #undef FLD
4943 /* stsl-macl-compact: sts.l macl, @-$rn */
4945 static SEM_PC
4946 SEM_FN_NAME (sh64_compact,stsl_macl_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4948 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4949 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4950 int UNUSED written = 0;
4951 IADDR UNUSED pc = abuf->addr;
4952 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4955 DI tmp_addr;
4956 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
4958 SI opval = GET_H_MACL ();
4959 SETMEMSI (current_cpu, pc, tmp_addr, opval);
4960 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4963 SI opval = tmp_addr;
4964 SET_H_GRC (FLD (f_rn), opval);
4965 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4969 return vpc;
4970 #undef FLD
4973 /* sts-pr-compact: sts pr, $rn */
4975 static SEM_PC
4976 SEM_FN_NAME (sh64_compact,sts_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4978 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
4979 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4980 int UNUSED written = 0;
4981 IADDR UNUSED pc = abuf->addr;
4982 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
4985 SI opval = GET_H_PR ();
4986 SET_H_GRC (FLD (f_rn), opval);
4987 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
4990 return vpc;
4991 #undef FLD
4994 /* stsl-pr-compact: sts.l pr, @-$rn */
4996 static SEM_PC
4997 SEM_FN_NAME (sh64_compact,stsl_pr_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4999 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5000 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5001 int UNUSED written = 0;
5002 IADDR UNUSED pc = abuf->addr;
5003 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5006 DI tmp_addr;
5007 tmp_addr = SUBSI (GET_H_GRC (FLD (f_rn)), 4);
5009 SI opval = GET_H_PR ();
5010 SETMEMSI (current_cpu, pc, tmp_addr, opval);
5011 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5014 SI opval = tmp_addr;
5015 SET_H_GRC (FLD (f_rn), opval);
5016 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5020 return vpc;
5021 #undef FLD
5024 /* sub-compact: sub $rm, $rn */
5026 static SEM_PC
5027 SEM_FN_NAME (sh64_compact,sub_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5029 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5030 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5031 int UNUSED written = 0;
5032 IADDR UNUSED pc = abuf->addr;
5033 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5036 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
5037 SET_H_GRC (FLD (f_rn), opval);
5038 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5041 return vpc;
5042 #undef FLD
5045 /* subc-compact: subc $rm, $rn */
5047 static SEM_PC
5048 SEM_FN_NAME (sh64_compact,subc_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5050 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5051 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5052 int UNUSED written = 0;
5053 IADDR UNUSED pc = abuf->addr;
5054 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5057 BI tmp_flag;
5058 tmp_flag = SUBCFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
5060 SI opval = SUBCSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), GET_H_TBIT ());
5061 SET_H_GRC (FLD (f_rn), opval);
5062 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5065 BI opval = tmp_flag;
5066 SET_H_TBIT (opval);
5067 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5071 return vpc;
5072 #undef FLD
5075 /* subv-compact: subv $rm, $rn */
5077 static SEM_PC
5078 SEM_FN_NAME (sh64_compact,subv_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5080 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5081 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5082 int UNUSED written = 0;
5083 IADDR UNUSED pc = abuf->addr;
5084 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5087 BI tmp_t;
5088 tmp_t = SUBOFSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)), 0);
5090 SI opval = SUBSI (GET_H_GRC (FLD (f_rn)), GET_H_GRC (FLD (f_rm)));
5091 SET_H_GRC (FLD (f_rn), opval);
5092 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5095 BI opval = ((tmp_t) ? (1) : (0));
5096 SET_H_TBIT (opval);
5097 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5101 return vpc;
5102 #undef FLD
5105 /* swapb-compact: swap.b $rm, $rn */
5107 static SEM_PC
5108 SEM_FN_NAME (sh64_compact,swapb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5110 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5111 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5112 int UNUSED written = 0;
5113 IADDR UNUSED pc = abuf->addr;
5114 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5117 UHI tmp_top_half;
5118 UQI tmp_byte1;
5119 UQI tmp_byte0;
5120 tmp_top_half = SUBWORDSIHI (GET_H_GRC (FLD (f_rm)), 0);
5121 tmp_byte1 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 2);
5122 tmp_byte0 = SUBWORDSIQI (GET_H_GRC (FLD (f_rm)), 3);
5124 SI opval = ORSI (SLLSI (tmp_top_half, 16), ORSI (SLLSI (tmp_byte0, 8), tmp_byte1));
5125 SET_H_GRC (FLD (f_rn), opval);
5126 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5130 return vpc;
5131 #undef FLD
5134 /* swapw-compact: swap.w $rm, $rn */
5136 static SEM_PC
5137 SEM_FN_NAME (sh64_compact,swapw_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5139 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5140 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5141 int UNUSED written = 0;
5142 IADDR UNUSED pc = abuf->addr;
5143 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5146 SI opval = ORSI (SRLSI (GET_H_GRC (FLD (f_rm)), 16), SLLSI (GET_H_GRC (FLD (f_rm)), 16));
5147 SET_H_GRC (FLD (f_rn), opval);
5148 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5151 return vpc;
5152 #undef FLD
5155 /* tasb-compact: tas.b @$rn */
5157 static SEM_PC
5158 SEM_FN_NAME (sh64_compact,tasb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5160 #define FLD(f) abuf->fields.sfmt_movw10_compact.f
5161 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5162 int UNUSED written = 0;
5163 IADDR UNUSED pc = abuf->addr;
5164 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5167 UQI tmp_byte;
5168 tmp_byte = GETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)));
5170 BI opval = ((EQQI (tmp_byte, 0)) ? (1) : (0));
5171 SET_H_TBIT (opval);
5172 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5174 tmp_byte = ORQI (tmp_byte, 128);
5176 UQI opval = tmp_byte;
5177 SETMEMUQI (current_cpu, pc, GET_H_GRC (FLD (f_rn)), opval);
5178 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5182 return vpc;
5183 #undef FLD
5186 /* trapa-compact: trapa #$uimm8 */
5188 static SEM_PC
5189 SEM_FN_NAME (sh64_compact,trapa_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5191 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5192 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5193 int UNUSED written = 0;
5194 IADDR UNUSED pc = abuf->addr;
5195 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5197 sh64_compact_trapa (current_cpu, FLD (f_imm8), pc);
5199 return vpc;
5200 #undef FLD
5203 /* tst-compact: tst $rm, $rn */
5205 static SEM_PC
5206 SEM_FN_NAME (sh64_compact,tst_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5208 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5209 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5210 int UNUSED written = 0;
5211 IADDR UNUSED pc = abuf->addr;
5212 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5215 BI opval = ((EQSI (ANDSI (GET_H_GRC (FLD (f_rm)), GET_H_GRC (FLD (f_rn))), 0)) ? (1) : (0));
5216 SET_H_TBIT (opval);
5217 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5220 return vpc;
5221 #undef FLD
5224 /* tsti-compact: tst #$uimm8, r0 */
5226 static SEM_PC
5227 SEM_FN_NAME (sh64_compact,tsti_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5229 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5230 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5231 int UNUSED written = 0;
5232 IADDR UNUSED pc = abuf->addr;
5233 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5236 BI opval = ((EQSI (ANDSI (GET_H_GRC (((UINT) 0)), ZEXTSISI (FLD (f_imm8))), 0)) ? (1) : (0));
5237 SET_H_TBIT (opval);
5238 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5241 return vpc;
5242 #undef FLD
5245 /* tstb-compact: tst.b #$imm8, @(r0, gbr) */
5247 static SEM_PC
5248 SEM_FN_NAME (sh64_compact,tstb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5250 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5252 int UNUSED written = 0;
5253 IADDR UNUSED pc = abuf->addr;
5254 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5257 DI tmp_addr;
5258 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
5260 BI opval = ((EQQI (ANDQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8)), 0)) ? (1) : (0));
5261 SET_H_TBIT (opval);
5262 TRACE_RESULT (current_cpu, abuf, "tbit", 'x', opval);
5266 return vpc;
5267 #undef FLD
5270 /* xor-compact: xor $rm64, $rn64 */
5272 static SEM_PC
5273 SEM_FN_NAME (sh64_compact,xor_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5275 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5276 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5277 int UNUSED written = 0;
5278 IADDR UNUSED pc = abuf->addr;
5279 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5282 DI opval = XORDI (GET_H_GR (FLD (f_rn)), GET_H_GR (FLD (f_rm)));
5283 SET_H_GR (FLD (f_rn), opval);
5284 TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5287 return vpc;
5288 #undef FLD
5291 /* xori-compact: xor #$uimm8, r0 */
5293 static SEM_PC
5294 SEM_FN_NAME (sh64_compact,xori_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5296 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5297 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5298 int UNUSED written = 0;
5299 IADDR UNUSED pc = abuf->addr;
5300 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5303 SI opval = XORSI (GET_H_GRC (((UINT) 0)), ZEXTSIDI (FLD (f_imm8)));
5304 SET_H_GRC (((UINT) 0), opval);
5305 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5308 return vpc;
5309 #undef FLD
5312 /* xorb-compact: xor.b #$imm8, @(r0, gbr) */
5314 static SEM_PC
5315 SEM_FN_NAME (sh64_compact,xorb_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5317 #define FLD(f) abuf->fields.sfmt_addi_compact.f
5318 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5319 int UNUSED written = 0;
5320 IADDR UNUSED pc = abuf->addr;
5321 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5324 DI tmp_addr;
5325 UQI tmp_data;
5326 tmp_addr = ADDSI (GET_H_GRC (((UINT) 0)), GET_H_GBR ());
5327 tmp_data = XORQI (GETMEMUQI (current_cpu, pc, tmp_addr), FLD (f_imm8));
5329 UQI opval = tmp_data;
5330 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5331 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5335 return vpc;
5336 #undef FLD
5339 /* xtrct-compact: xtrct $rm, $rn */
5341 static SEM_PC
5342 SEM_FN_NAME (sh64_compact,xtrct_compact) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5344 #define FLD(f) abuf->fields.sfmt_movl12_compact.f
5345 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5346 int UNUSED written = 0;
5347 IADDR UNUSED pc = abuf->addr;
5348 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
5351 SI opval = ORSI (SLLSI (GET_H_GRC (FLD (f_rm)), 16), SRLSI (GET_H_GRC (FLD (f_rn)), 16));
5352 SET_H_GRC (FLD (f_rn), opval);
5353 TRACE_RESULT (current_cpu, abuf, "grc", 'x', opval);
5356 return vpc;
5357 #undef FLD
5360 /* Table of all semantic fns. */
5362 static const struct sem_fn_desc sem_fns[] = {
5363 { SH64_COMPACT_INSN_X_INVALID, SEM_FN_NAME (sh64_compact,x_invalid) },
5364 { SH64_COMPACT_INSN_X_AFTER, SEM_FN_NAME (sh64_compact,x_after) },
5365 { SH64_COMPACT_INSN_X_BEFORE, SEM_FN_NAME (sh64_compact,x_before) },
5366 { SH64_COMPACT_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_compact,x_cti_chain) },
5367 { SH64_COMPACT_INSN_X_CHAIN, SEM_FN_NAME (sh64_compact,x_chain) },
5368 { SH64_COMPACT_INSN_X_BEGIN, SEM_FN_NAME (sh64_compact,x_begin) },
5369 { SH64_COMPACT_INSN_ADD_COMPACT, SEM_FN_NAME (sh64_compact,add_compact) },
5370 { SH64_COMPACT_INSN_ADDI_COMPACT, SEM_FN_NAME (sh64_compact,addi_compact) },
5371 { SH64_COMPACT_INSN_ADDC_COMPACT, SEM_FN_NAME (sh64_compact,addc_compact) },
5372 { SH64_COMPACT_INSN_ADDV_COMPACT, SEM_FN_NAME (sh64_compact,addv_compact) },
5373 { SH64_COMPACT_INSN_AND_COMPACT, SEM_FN_NAME (sh64_compact,and_compact) },
5374 { SH64_COMPACT_INSN_ANDI_COMPACT, SEM_FN_NAME (sh64_compact,andi_compact) },
5375 { SH64_COMPACT_INSN_ANDB_COMPACT, SEM_FN_NAME (sh64_compact,andb_compact) },
5376 { SH64_COMPACT_INSN_BF_COMPACT, SEM_FN_NAME (sh64_compact,bf_compact) },
5377 { SH64_COMPACT_INSN_BFS_COMPACT, SEM_FN_NAME (sh64_compact,bfs_compact) },
5378 { SH64_COMPACT_INSN_BRA_COMPACT, SEM_FN_NAME (sh64_compact,bra_compact) },
5379 { SH64_COMPACT_INSN_BRAF_COMPACT, SEM_FN_NAME (sh64_compact,braf_compact) },
5380 { SH64_COMPACT_INSN_BRK_COMPACT, SEM_FN_NAME (sh64_compact,brk_compact) },
5381 { SH64_COMPACT_INSN_BSR_COMPACT, SEM_FN_NAME (sh64_compact,bsr_compact) },
5382 { SH64_COMPACT_INSN_BSRF_COMPACT, SEM_FN_NAME (sh64_compact,bsrf_compact) },
5383 { SH64_COMPACT_INSN_BT_COMPACT, SEM_FN_NAME (sh64_compact,bt_compact) },
5384 { SH64_COMPACT_INSN_BTS_COMPACT, SEM_FN_NAME (sh64_compact,bts_compact) },
5385 { SH64_COMPACT_INSN_CLRMAC_COMPACT, SEM_FN_NAME (sh64_compact,clrmac_compact) },
5386 { SH64_COMPACT_INSN_CLRS_COMPACT, SEM_FN_NAME (sh64_compact,clrs_compact) },
5387 { SH64_COMPACT_INSN_CLRT_COMPACT, SEM_FN_NAME (sh64_compact,clrt_compact) },
5388 { SH64_COMPACT_INSN_CMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,cmpeq_compact) },
5389 { SH64_COMPACT_INSN_CMPEQI_COMPACT, SEM_FN_NAME (sh64_compact,cmpeqi_compact) },
5390 { SH64_COMPACT_INSN_CMPGE_COMPACT, SEM_FN_NAME (sh64_compact,cmpge_compact) },
5391 { SH64_COMPACT_INSN_CMPGT_COMPACT, SEM_FN_NAME (sh64_compact,cmpgt_compact) },
5392 { SH64_COMPACT_INSN_CMPHI_COMPACT, SEM_FN_NAME (sh64_compact,cmphi_compact) },
5393 { SH64_COMPACT_INSN_CMPHS_COMPACT, SEM_FN_NAME (sh64_compact,cmphs_compact) },
5394 { SH64_COMPACT_INSN_CMPPL_COMPACT, SEM_FN_NAME (sh64_compact,cmppl_compact) },
5395 { SH64_COMPACT_INSN_CMPPZ_COMPACT, SEM_FN_NAME (sh64_compact,cmppz_compact) },
5396 { SH64_COMPACT_INSN_CMPSTR_COMPACT, SEM_FN_NAME (sh64_compact,cmpstr_compact) },
5397 { SH64_COMPACT_INSN_DIV0S_COMPACT, SEM_FN_NAME (sh64_compact,div0s_compact) },
5398 { SH64_COMPACT_INSN_DIV0U_COMPACT, SEM_FN_NAME (sh64_compact,div0u_compact) },
5399 { SH64_COMPACT_INSN_DIV1_COMPACT, SEM_FN_NAME (sh64_compact,div1_compact) },
5400 { SH64_COMPACT_INSN_DIVU_COMPACT, SEM_FN_NAME (sh64_compact,divu_compact) },
5401 { SH64_COMPACT_INSN_MULR_COMPACT, SEM_FN_NAME (sh64_compact,mulr_compact) },
5402 { SH64_COMPACT_INSN_DMULSL_COMPACT, SEM_FN_NAME (sh64_compact,dmulsl_compact) },
5403 { SH64_COMPACT_INSN_DMULUL_COMPACT, SEM_FN_NAME (sh64_compact,dmulul_compact) },
5404 { SH64_COMPACT_INSN_DT_COMPACT, SEM_FN_NAME (sh64_compact,dt_compact) },
5405 { SH64_COMPACT_INSN_EXTSB_COMPACT, SEM_FN_NAME (sh64_compact,extsb_compact) },
5406 { SH64_COMPACT_INSN_EXTSW_COMPACT, SEM_FN_NAME (sh64_compact,extsw_compact) },
5407 { SH64_COMPACT_INSN_EXTUB_COMPACT, SEM_FN_NAME (sh64_compact,extub_compact) },
5408 { SH64_COMPACT_INSN_EXTUW_COMPACT, SEM_FN_NAME (sh64_compact,extuw_compact) },
5409 { SH64_COMPACT_INSN_FABS_COMPACT, SEM_FN_NAME (sh64_compact,fabs_compact) },
5410 { SH64_COMPACT_INSN_FADD_COMPACT, SEM_FN_NAME (sh64_compact,fadd_compact) },
5411 { SH64_COMPACT_INSN_FCMPEQ_COMPACT, SEM_FN_NAME (sh64_compact,fcmpeq_compact) },
5412 { SH64_COMPACT_INSN_FCMPGT_COMPACT, SEM_FN_NAME (sh64_compact,fcmpgt_compact) },
5413 { SH64_COMPACT_INSN_FCNVDS_COMPACT, SEM_FN_NAME (sh64_compact,fcnvds_compact) },
5414 { SH64_COMPACT_INSN_FCNVSD_COMPACT, SEM_FN_NAME (sh64_compact,fcnvsd_compact) },
5415 { SH64_COMPACT_INSN_FDIV_COMPACT, SEM_FN_NAME (sh64_compact,fdiv_compact) },
5416 { SH64_COMPACT_INSN_FIPR_COMPACT, SEM_FN_NAME (sh64_compact,fipr_compact) },
5417 { SH64_COMPACT_INSN_FLDS_COMPACT, SEM_FN_NAME (sh64_compact,flds_compact) },
5418 { SH64_COMPACT_INSN_FLDI0_COMPACT, SEM_FN_NAME (sh64_compact,fldi0_compact) },
5419 { SH64_COMPACT_INSN_FLDI1_COMPACT, SEM_FN_NAME (sh64_compact,fldi1_compact) },
5420 { SH64_COMPACT_INSN_FLOAT_COMPACT, SEM_FN_NAME (sh64_compact,float_compact) },
5421 { SH64_COMPACT_INSN_FMAC_COMPACT, SEM_FN_NAME (sh64_compact,fmac_compact) },
5422 { SH64_COMPACT_INSN_FMOV1_COMPACT, SEM_FN_NAME (sh64_compact,fmov1_compact) },
5423 { SH64_COMPACT_INSN_FMOV2_COMPACT, SEM_FN_NAME (sh64_compact,fmov2_compact) },
5424 { SH64_COMPACT_INSN_FMOV3_COMPACT, SEM_FN_NAME (sh64_compact,fmov3_compact) },
5425 { SH64_COMPACT_INSN_FMOV4_COMPACT, SEM_FN_NAME (sh64_compact,fmov4_compact) },
5426 { SH64_COMPACT_INSN_FMOV5_COMPACT, SEM_FN_NAME (sh64_compact,fmov5_compact) },
5427 { SH64_COMPACT_INSN_FMOV6_COMPACT, SEM_FN_NAME (sh64_compact,fmov6_compact) },
5428 { SH64_COMPACT_INSN_FMOV7_COMPACT, SEM_FN_NAME (sh64_compact,fmov7_compact) },
5429 { SH64_COMPACT_INSN_FMOV8_COMPACT, SEM_FN_NAME (sh64_compact,fmov8_compact) },
5430 { SH64_COMPACT_INSN_FMOV9_COMPACT, SEM_FN_NAME (sh64_compact,fmov9_compact) },
5431 { SH64_COMPACT_INSN_FMUL_COMPACT, SEM_FN_NAME (sh64_compact,fmul_compact) },
5432 { SH64_COMPACT_INSN_FNEG_COMPACT, SEM_FN_NAME (sh64_compact,fneg_compact) },
5433 { SH64_COMPACT_INSN_FRCHG_COMPACT, SEM_FN_NAME (sh64_compact,frchg_compact) },
5434 { SH64_COMPACT_INSN_FSCHG_COMPACT, SEM_FN_NAME (sh64_compact,fschg_compact) },
5435 { SH64_COMPACT_INSN_FSQRT_COMPACT, SEM_FN_NAME (sh64_compact,fsqrt_compact) },
5436 { SH64_COMPACT_INSN_FSTS_COMPACT, SEM_FN_NAME (sh64_compact,fsts_compact) },
5437 { SH64_COMPACT_INSN_FSUB_COMPACT, SEM_FN_NAME (sh64_compact,fsub_compact) },
5438 { SH64_COMPACT_INSN_FTRC_COMPACT, SEM_FN_NAME (sh64_compact,ftrc_compact) },
5439 { SH64_COMPACT_INSN_FTRV_COMPACT, SEM_FN_NAME (sh64_compact,ftrv_compact) },
5440 { SH64_COMPACT_INSN_JMP_COMPACT, SEM_FN_NAME (sh64_compact,jmp_compact) },
5441 { SH64_COMPACT_INSN_JSR_COMPACT, SEM_FN_NAME (sh64_compact,jsr_compact) },
5442 { SH64_COMPACT_INSN_LDC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_gbr_compact) },
5443 { SH64_COMPACT_INSN_LDC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_vbr_compact) },
5444 { SH64_COMPACT_INSN_LDC_SR_COMPACT, SEM_FN_NAME (sh64_compact,ldc_sr_compact) },
5445 { SH64_COMPACT_INSN_LDCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_gbr_compact) },
5446 { SH64_COMPACT_INSN_LDCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,ldcl_vbr_compact) },
5447 { SH64_COMPACT_INSN_LDS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpscr_compact) },
5448 { SH64_COMPACT_INSN_LDSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpscr_compact) },
5449 { SH64_COMPACT_INSN_LDS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,lds_fpul_compact) },
5450 { SH64_COMPACT_INSN_LDSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_fpul_compact) },
5451 { SH64_COMPACT_INSN_LDS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,lds_mach_compact) },
5452 { SH64_COMPACT_INSN_LDSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_mach_compact) },
5453 { SH64_COMPACT_INSN_LDS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,lds_macl_compact) },
5454 { SH64_COMPACT_INSN_LDSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_macl_compact) },
5455 { SH64_COMPACT_INSN_LDS_PR_COMPACT, SEM_FN_NAME (sh64_compact,lds_pr_compact) },
5456 { SH64_COMPACT_INSN_LDSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,ldsl_pr_compact) },
5457 { SH64_COMPACT_INSN_MACL_COMPACT, SEM_FN_NAME (sh64_compact,macl_compact) },
5458 { SH64_COMPACT_INSN_MACW_COMPACT, SEM_FN_NAME (sh64_compact,macw_compact) },
5459 { SH64_COMPACT_INSN_MOV_COMPACT, SEM_FN_NAME (sh64_compact,mov_compact) },
5460 { SH64_COMPACT_INSN_MOVI_COMPACT, SEM_FN_NAME (sh64_compact,movi_compact) },
5461 { SH64_COMPACT_INSN_MOVI20_COMPACT, SEM_FN_NAME (sh64_compact,movi20_compact) },
5462 { SH64_COMPACT_INSN_MOVB1_COMPACT, SEM_FN_NAME (sh64_compact,movb1_compact) },
5463 { SH64_COMPACT_INSN_MOVB2_COMPACT, SEM_FN_NAME (sh64_compact,movb2_compact) },
5464 { SH64_COMPACT_INSN_MOVB3_COMPACT, SEM_FN_NAME (sh64_compact,movb3_compact) },
5465 { SH64_COMPACT_INSN_MOVB4_COMPACT, SEM_FN_NAME (sh64_compact,movb4_compact) },
5466 { SH64_COMPACT_INSN_MOVB5_COMPACT, SEM_FN_NAME (sh64_compact,movb5_compact) },
5467 { SH64_COMPACT_INSN_MOVB6_COMPACT, SEM_FN_NAME (sh64_compact,movb6_compact) },
5468 { SH64_COMPACT_INSN_MOVB7_COMPACT, SEM_FN_NAME (sh64_compact,movb7_compact) },
5469 { SH64_COMPACT_INSN_MOVB8_COMPACT, SEM_FN_NAME (sh64_compact,movb8_compact) },
5470 { SH64_COMPACT_INSN_MOVB9_COMPACT, SEM_FN_NAME (sh64_compact,movb9_compact) },
5471 { SH64_COMPACT_INSN_MOVB10_COMPACT, SEM_FN_NAME (sh64_compact,movb10_compact) },
5472 { SH64_COMPACT_INSN_MOVL1_COMPACT, SEM_FN_NAME (sh64_compact,movl1_compact) },
5473 { SH64_COMPACT_INSN_MOVL2_COMPACT, SEM_FN_NAME (sh64_compact,movl2_compact) },
5474 { SH64_COMPACT_INSN_MOVL3_COMPACT, SEM_FN_NAME (sh64_compact,movl3_compact) },
5475 { SH64_COMPACT_INSN_MOVL4_COMPACT, SEM_FN_NAME (sh64_compact,movl4_compact) },
5476 { SH64_COMPACT_INSN_MOVL5_COMPACT, SEM_FN_NAME (sh64_compact,movl5_compact) },
5477 { SH64_COMPACT_INSN_MOVL6_COMPACT, SEM_FN_NAME (sh64_compact,movl6_compact) },
5478 { SH64_COMPACT_INSN_MOVL7_COMPACT, SEM_FN_NAME (sh64_compact,movl7_compact) },
5479 { SH64_COMPACT_INSN_MOVL8_COMPACT, SEM_FN_NAME (sh64_compact,movl8_compact) },
5480 { SH64_COMPACT_INSN_MOVL9_COMPACT, SEM_FN_NAME (sh64_compact,movl9_compact) },
5481 { SH64_COMPACT_INSN_MOVL10_COMPACT, SEM_FN_NAME (sh64_compact,movl10_compact) },
5482 { SH64_COMPACT_INSN_MOVL11_COMPACT, SEM_FN_NAME (sh64_compact,movl11_compact) },
5483 { SH64_COMPACT_INSN_MOVL12_COMPACT, SEM_FN_NAME (sh64_compact,movl12_compact) },
5484 { SH64_COMPACT_INSN_MOVL13_COMPACT, SEM_FN_NAME (sh64_compact,movl13_compact) },
5485 { SH64_COMPACT_INSN_MOVW1_COMPACT, SEM_FN_NAME (sh64_compact,movw1_compact) },
5486 { SH64_COMPACT_INSN_MOVW2_COMPACT, SEM_FN_NAME (sh64_compact,movw2_compact) },
5487 { SH64_COMPACT_INSN_MOVW3_COMPACT, SEM_FN_NAME (sh64_compact,movw3_compact) },
5488 { SH64_COMPACT_INSN_MOVW4_COMPACT, SEM_FN_NAME (sh64_compact,movw4_compact) },
5489 { SH64_COMPACT_INSN_MOVW5_COMPACT, SEM_FN_NAME (sh64_compact,movw5_compact) },
5490 { SH64_COMPACT_INSN_MOVW6_COMPACT, SEM_FN_NAME (sh64_compact,movw6_compact) },
5491 { SH64_COMPACT_INSN_MOVW7_COMPACT, SEM_FN_NAME (sh64_compact,movw7_compact) },
5492 { SH64_COMPACT_INSN_MOVW8_COMPACT, SEM_FN_NAME (sh64_compact,movw8_compact) },
5493 { SH64_COMPACT_INSN_MOVW9_COMPACT, SEM_FN_NAME (sh64_compact,movw9_compact) },
5494 { SH64_COMPACT_INSN_MOVW10_COMPACT, SEM_FN_NAME (sh64_compact,movw10_compact) },
5495 { SH64_COMPACT_INSN_MOVW11_COMPACT, SEM_FN_NAME (sh64_compact,movw11_compact) },
5496 { SH64_COMPACT_INSN_MOVA_COMPACT, SEM_FN_NAME (sh64_compact,mova_compact) },
5497 { SH64_COMPACT_INSN_MOVCAL_COMPACT, SEM_FN_NAME (sh64_compact,movcal_compact) },
5498 { SH64_COMPACT_INSN_MOVCOL_COMPACT, SEM_FN_NAME (sh64_compact,movcol_compact) },
5499 { SH64_COMPACT_INSN_MOVT_COMPACT, SEM_FN_NAME (sh64_compact,movt_compact) },
5500 { SH64_COMPACT_INSN_MOVUAL_COMPACT, SEM_FN_NAME (sh64_compact,movual_compact) },
5501 { SH64_COMPACT_INSN_MOVUAL2_COMPACT, SEM_FN_NAME (sh64_compact,movual2_compact) },
5502 { SH64_COMPACT_INSN_MULL_COMPACT, SEM_FN_NAME (sh64_compact,mull_compact) },
5503 { SH64_COMPACT_INSN_MULSW_COMPACT, SEM_FN_NAME (sh64_compact,mulsw_compact) },
5504 { SH64_COMPACT_INSN_MULUW_COMPACT, SEM_FN_NAME (sh64_compact,muluw_compact) },
5505 { SH64_COMPACT_INSN_NEG_COMPACT, SEM_FN_NAME (sh64_compact,neg_compact) },
5506 { SH64_COMPACT_INSN_NEGC_COMPACT, SEM_FN_NAME (sh64_compact,negc_compact) },
5507 { SH64_COMPACT_INSN_NOP_COMPACT, SEM_FN_NAME (sh64_compact,nop_compact) },
5508 { SH64_COMPACT_INSN_NOT_COMPACT, SEM_FN_NAME (sh64_compact,not_compact) },
5509 { SH64_COMPACT_INSN_OCBI_COMPACT, SEM_FN_NAME (sh64_compact,ocbi_compact) },
5510 { SH64_COMPACT_INSN_OCBP_COMPACT, SEM_FN_NAME (sh64_compact,ocbp_compact) },
5511 { SH64_COMPACT_INSN_OCBWB_COMPACT, SEM_FN_NAME (sh64_compact,ocbwb_compact) },
5512 { SH64_COMPACT_INSN_OR_COMPACT, SEM_FN_NAME (sh64_compact,or_compact) },
5513 { SH64_COMPACT_INSN_ORI_COMPACT, SEM_FN_NAME (sh64_compact,ori_compact) },
5514 { SH64_COMPACT_INSN_ORB_COMPACT, SEM_FN_NAME (sh64_compact,orb_compact) },
5515 { SH64_COMPACT_INSN_PREF_COMPACT, SEM_FN_NAME (sh64_compact,pref_compact) },
5516 { SH64_COMPACT_INSN_ROTCL_COMPACT, SEM_FN_NAME (sh64_compact,rotcl_compact) },
5517 { SH64_COMPACT_INSN_ROTCR_COMPACT, SEM_FN_NAME (sh64_compact,rotcr_compact) },
5518 { SH64_COMPACT_INSN_ROTL_COMPACT, SEM_FN_NAME (sh64_compact,rotl_compact) },
5519 { SH64_COMPACT_INSN_ROTR_COMPACT, SEM_FN_NAME (sh64_compact,rotr_compact) },
5520 { SH64_COMPACT_INSN_RTS_COMPACT, SEM_FN_NAME (sh64_compact,rts_compact) },
5521 { SH64_COMPACT_INSN_SETS_COMPACT, SEM_FN_NAME (sh64_compact,sets_compact) },
5522 { SH64_COMPACT_INSN_SETT_COMPACT, SEM_FN_NAME (sh64_compact,sett_compact) },
5523 { SH64_COMPACT_INSN_SHAD_COMPACT, SEM_FN_NAME (sh64_compact,shad_compact) },
5524 { SH64_COMPACT_INSN_SHAL_COMPACT, SEM_FN_NAME (sh64_compact,shal_compact) },
5525 { SH64_COMPACT_INSN_SHAR_COMPACT, SEM_FN_NAME (sh64_compact,shar_compact) },
5526 { SH64_COMPACT_INSN_SHLD_COMPACT, SEM_FN_NAME (sh64_compact,shld_compact) },
5527 { SH64_COMPACT_INSN_SHLL_COMPACT, SEM_FN_NAME (sh64_compact,shll_compact) },
5528 { SH64_COMPACT_INSN_SHLL2_COMPACT, SEM_FN_NAME (sh64_compact,shll2_compact) },
5529 { SH64_COMPACT_INSN_SHLL8_COMPACT, SEM_FN_NAME (sh64_compact,shll8_compact) },
5530 { SH64_COMPACT_INSN_SHLL16_COMPACT, SEM_FN_NAME (sh64_compact,shll16_compact) },
5531 { SH64_COMPACT_INSN_SHLR_COMPACT, SEM_FN_NAME (sh64_compact,shlr_compact) },
5532 { SH64_COMPACT_INSN_SHLR2_COMPACT, SEM_FN_NAME (sh64_compact,shlr2_compact) },
5533 { SH64_COMPACT_INSN_SHLR8_COMPACT, SEM_FN_NAME (sh64_compact,shlr8_compact) },
5534 { SH64_COMPACT_INSN_SHLR16_COMPACT, SEM_FN_NAME (sh64_compact,shlr16_compact) },
5535 { SH64_COMPACT_INSN_STC_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_gbr_compact) },
5536 { SH64_COMPACT_INSN_STC_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stc_vbr_compact) },
5537 { SH64_COMPACT_INSN_STCL_GBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_gbr_compact) },
5538 { SH64_COMPACT_INSN_STCL_VBR_COMPACT, SEM_FN_NAME (sh64_compact,stcl_vbr_compact) },
5539 { SH64_COMPACT_INSN_STS_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpscr_compact) },
5540 { SH64_COMPACT_INSN_STSL_FPSCR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpscr_compact) },
5541 { SH64_COMPACT_INSN_STS_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,sts_fpul_compact) },
5542 { SH64_COMPACT_INSN_STSL_FPUL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_fpul_compact) },
5543 { SH64_COMPACT_INSN_STS_MACH_COMPACT, SEM_FN_NAME (sh64_compact,sts_mach_compact) },
5544 { SH64_COMPACT_INSN_STSL_MACH_COMPACT, SEM_FN_NAME (sh64_compact,stsl_mach_compact) },
5545 { SH64_COMPACT_INSN_STS_MACL_COMPACT, SEM_FN_NAME (sh64_compact,sts_macl_compact) },
5546 { SH64_COMPACT_INSN_STSL_MACL_COMPACT, SEM_FN_NAME (sh64_compact,stsl_macl_compact) },
5547 { SH64_COMPACT_INSN_STS_PR_COMPACT, SEM_FN_NAME (sh64_compact,sts_pr_compact) },
5548 { SH64_COMPACT_INSN_STSL_PR_COMPACT, SEM_FN_NAME (sh64_compact,stsl_pr_compact) },
5549 { SH64_COMPACT_INSN_SUB_COMPACT, SEM_FN_NAME (sh64_compact,sub_compact) },
5550 { SH64_COMPACT_INSN_SUBC_COMPACT, SEM_FN_NAME (sh64_compact,subc_compact) },
5551 { SH64_COMPACT_INSN_SUBV_COMPACT, SEM_FN_NAME (sh64_compact,subv_compact) },
5552 { SH64_COMPACT_INSN_SWAPB_COMPACT, SEM_FN_NAME (sh64_compact,swapb_compact) },
5553 { SH64_COMPACT_INSN_SWAPW_COMPACT, SEM_FN_NAME (sh64_compact,swapw_compact) },
5554 { SH64_COMPACT_INSN_TASB_COMPACT, SEM_FN_NAME (sh64_compact,tasb_compact) },
5555 { SH64_COMPACT_INSN_TRAPA_COMPACT, SEM_FN_NAME (sh64_compact,trapa_compact) },
5556 { SH64_COMPACT_INSN_TST_COMPACT, SEM_FN_NAME (sh64_compact,tst_compact) },
5557 { SH64_COMPACT_INSN_TSTI_COMPACT, SEM_FN_NAME (sh64_compact,tsti_compact) },
5558 { SH64_COMPACT_INSN_TSTB_COMPACT, SEM_FN_NAME (sh64_compact,tstb_compact) },
5559 { SH64_COMPACT_INSN_XOR_COMPACT, SEM_FN_NAME (sh64_compact,xor_compact) },
5560 { SH64_COMPACT_INSN_XORI_COMPACT, SEM_FN_NAME (sh64_compact,xori_compact) },
5561 { SH64_COMPACT_INSN_XORB_COMPACT, SEM_FN_NAME (sh64_compact,xorb_compact) },
5562 { SH64_COMPACT_INSN_XTRCT_COMPACT, SEM_FN_NAME (sh64_compact,xtrct_compact) },
5563 { 0, 0 }
5566 /* Add the semantic fns to IDESC_TABLE. */
5568 void
5569 SEM_FN_NAME (sh64_compact,init_idesc_table) (SIM_CPU *current_cpu)
5571 IDESC *idesc_table = CPU_IDESC (current_cpu);
5572 const struct sem_fn_desc *sf;
5573 int mach_num = MACH_NUM (CPU_MACH (current_cpu));
5575 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
5577 const CGEN_INSN *insn = idesc_table[sf->index].idata;
5578 int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
5579 || CGEN_INSN_MACH_HAS_P (insn, mach_num));
5580 #if FAST_P
5581 if (valid_p)
5582 idesc_table[sf->index].sem_fast = sf->fn;
5583 else
5584 idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_compact,x_invalid);
5585 #else
5586 if (valid_p)
5587 idesc_table[sf->index].sem_full = sf->fn;
5588 else
5589 idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_compact,x_invalid);
5590 #endif