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