Update copyright year in gdbarch.sh doc/gdb.texinfo and doc/refcard.tex
[binutils-gdb.git] / sim / sh64 / sem-media.c
blobfa56f6bcb969508ab67c8fb40c6182a03b23fbfd
1 /* Simulator instruction semantics for sh64.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2020 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
9 This file is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, see <http://www.gnu.org/licenses/>.
24 #define WANT_CPU sh64
25 #define WANT_CPU_SH64
27 #include "sim-main.h"
28 #include "cgen-mem.h"
29 #include "cgen-ops.h"
31 #undef GET_ATTR
32 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34 /* This is used so that we can compile two copies of the semantic code,
35 one with full feature support and one without that runs fast(er).
36 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
37 #if FAST_P
38 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
39 #undef CGEN_TRACE_RESULT
40 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
41 #else
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
43 #endif
45 /* x-invalid: --invalid-- */
47 static SEM_PC
48 SEM_FN_NAME (sh64_media,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
50 #define FLD(f) abuf->fields.sfmt_empty.f
51 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
52 int UNUSED written = 0;
53 IADDR UNUSED pc = abuf->addr;
54 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
57 /* Update the recorded pc in the cpu state struct.
58 Only necessary for WITH_SCACHE case, but to avoid the
59 conditional compilation .... */
60 SET_H_PC (pc);
61 /* Virtual insns have zero size. Overwrite vpc with address of next insn
62 using the default-insn-bitsize spec. When executing insns in parallel
63 we may want to queue the fault and continue execution. */
64 vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
65 vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
68 return vpc;
69 #undef FLD
72 /* x-after: --after-- */
74 static SEM_PC
75 SEM_FN_NAME (sh64_media,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
77 #define FLD(f) abuf->fields.sfmt_empty.f
78 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
79 int UNUSED written = 0;
80 IADDR UNUSED pc = abuf->addr;
81 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
84 #if WITH_SCACHE_PBB_SH64_MEDIA
85 sh64_media_pbb_after (current_cpu, sem_arg);
86 #endif
89 return vpc;
90 #undef FLD
93 /* x-before: --before-- */
95 static SEM_PC
96 SEM_FN_NAME (sh64_media,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
98 #define FLD(f) abuf->fields.sfmt_empty.f
99 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
100 int UNUSED written = 0;
101 IADDR UNUSED pc = abuf->addr;
102 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
105 #if WITH_SCACHE_PBB_SH64_MEDIA
106 sh64_media_pbb_before (current_cpu, sem_arg);
107 #endif
110 return vpc;
111 #undef FLD
114 /* x-cti-chain: --cti-chain-- */
116 static SEM_PC
117 SEM_FN_NAME (sh64_media,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
119 #define FLD(f) abuf->fields.sfmt_empty.f
120 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
121 int UNUSED written = 0;
122 IADDR UNUSED pc = abuf->addr;
123 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
126 #if WITH_SCACHE_PBB_SH64_MEDIA
127 #ifdef DEFINE_SWITCH
128 vpc = sh64_media_pbb_cti_chain (current_cpu, sem_arg,
129 pbb_br_type, pbb_br_npc);
130 BREAK (sem);
131 #else
132 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
133 vpc = sh64_media_pbb_cti_chain (current_cpu, sem_arg,
134 CPU_PBB_BR_TYPE (current_cpu),
135 CPU_PBB_BR_NPC (current_cpu));
136 #endif
137 #endif
140 return vpc;
141 #undef FLD
144 /* x-chain: --chain-- */
146 static SEM_PC
147 SEM_FN_NAME (sh64_media,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
149 #define FLD(f) abuf->fields.sfmt_empty.f
150 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
151 int UNUSED written = 0;
152 IADDR UNUSED pc = abuf->addr;
153 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
156 #if WITH_SCACHE_PBB_SH64_MEDIA
157 vpc = sh64_media_pbb_chain (current_cpu, sem_arg);
158 #ifdef DEFINE_SWITCH
159 BREAK (sem);
160 #endif
161 #endif
164 return vpc;
165 #undef FLD
168 /* x-begin: --begin-- */
170 static SEM_PC
171 SEM_FN_NAME (sh64_media,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
173 #define FLD(f) abuf->fields.sfmt_empty.f
174 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
175 int UNUSED written = 0;
176 IADDR UNUSED pc = abuf->addr;
177 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
180 #if WITH_SCACHE_PBB_SH64_MEDIA
181 #if defined DEFINE_SWITCH || defined FAST_P
182 /* In the switch case FAST_P is a constant, allowing several optimizations
183 in any called inline functions. */
184 vpc = sh64_media_pbb_begin (current_cpu, FAST_P);
185 #else
186 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
187 vpc = sh64_media_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
188 #else
189 vpc = sh64_media_pbb_begin (current_cpu, 0);
190 #endif
191 #endif
192 #endif
195 return vpc;
196 #undef FLD
199 /* add: add $rm, $rn, $rd */
201 static SEM_PC
202 SEM_FN_NAME (sh64_media,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
204 #define FLD(f) abuf->fields.sfmt_add.f
205 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
206 int UNUSED written = 0;
207 IADDR UNUSED pc = abuf->addr;
208 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
211 DI opval = ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
212 SET_H_GR (FLD (f_dest), opval);
213 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
216 return vpc;
217 #undef FLD
220 /* addl: add.l $rm, $rn, $rd */
222 static SEM_PC
223 SEM_FN_NAME (sh64_media,addl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
225 #define FLD(f) abuf->fields.sfmt_add.f
226 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
227 int UNUSED written = 0;
228 IADDR UNUSED pc = abuf->addr;
229 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
232 DI opval = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
233 SET_H_GR (FLD (f_dest), opval);
234 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
237 return vpc;
238 #undef FLD
241 /* addi: addi $rm, $disp10, $rd */
243 static SEM_PC
244 SEM_FN_NAME (sh64_media,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
246 #define FLD(f) abuf->fields.sfmt_addi.f
247 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
248 int UNUSED written = 0;
249 IADDR UNUSED pc = abuf->addr;
250 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
253 DI opval = ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)));
254 SET_H_GR (FLD (f_dest), opval);
255 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
258 return vpc;
259 #undef FLD
262 /* addil: addi.l $rm, $disp10, $rd */
264 static SEM_PC
265 SEM_FN_NAME (sh64_media,addil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
267 #define FLD(f) abuf->fields.sfmt_addi.f
268 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
269 int UNUSED written = 0;
270 IADDR UNUSED pc = abuf->addr;
271 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
274 DI opval = EXTSIDI (ADDSI (EXTSISI (FLD (f_disp10)), SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)));
275 SET_H_GR (FLD (f_dest), opval);
276 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
279 return vpc;
280 #undef FLD
283 /* addzl: addz.l $rm, $rn, $rd */
285 static SEM_PC
286 SEM_FN_NAME (sh64_media,addzl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
288 #define FLD(f) abuf->fields.sfmt_add.f
289 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
290 int UNUSED written = 0;
291 IADDR UNUSED pc = abuf->addr;
292 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
295 DI opval = ZEXTSIDI (ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
296 SET_H_GR (FLD (f_dest), opval);
297 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
300 return vpc;
301 #undef FLD
304 /* alloco: alloco $rm, $disp6x32 */
306 static SEM_PC
307 SEM_FN_NAME (sh64_media,alloco) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
309 #define FLD(f) abuf->fields.sfmt_xori.f
310 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
311 int UNUSED written = 0;
312 IADDR UNUSED pc = abuf->addr;
313 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
317 DI opval = GET_H_GR (FLD (f_left));
318 SET_H_GR (FLD (f_left), opval);
319 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
321 ((void) 0); /*nop*/
324 return vpc;
325 #undef FLD
328 /* and: and $rm, $rn, $rd */
330 static SEM_PC
331 SEM_FN_NAME (sh64_media,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
333 #define FLD(f) abuf->fields.sfmt_add.f
334 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
335 int UNUSED written = 0;
336 IADDR UNUSED pc = abuf->addr;
337 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
340 DI opval = ANDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
341 SET_H_GR (FLD (f_dest), opval);
342 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
345 return vpc;
346 #undef FLD
349 /* andc: andc $rm, $rn, $rd */
351 static SEM_PC
352 SEM_FN_NAME (sh64_media,andc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
354 #define FLD(f) abuf->fields.sfmt_add.f
355 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
356 int UNUSED written = 0;
357 IADDR UNUSED pc = abuf->addr;
358 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
361 DI opval = ANDDI (GET_H_GR (FLD (f_left)), INVDI (GET_H_GR (FLD (f_right))));
362 SET_H_GR (FLD (f_dest), opval);
363 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
366 return vpc;
367 #undef FLD
370 /* andi: andi $rm, $disp10, $rd */
372 static SEM_PC
373 SEM_FN_NAME (sh64_media,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
375 #define FLD(f) abuf->fields.sfmt_addi.f
376 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
377 int UNUSED written = 0;
378 IADDR UNUSED pc = abuf->addr;
379 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
382 DI opval = ANDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)));
383 SET_H_GR (FLD (f_dest), opval);
384 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
387 return vpc;
388 #undef FLD
391 /* beq: beq$likely $rm, $rn, $tra */
393 static SEM_PC
394 SEM_FN_NAME (sh64_media,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
396 #define FLD(f) abuf->fields.sfmt_beq.f
397 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
398 int UNUSED written = 0;
399 IADDR UNUSED pc = abuf->addr;
400 SEM_BRANCH_INIT
401 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
404 ((void) 0); /*nop*/
405 if (EQDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
407 UDI opval = CPU (h_tr[FLD (f_tra)]);
408 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
409 written |= (1 << 3);
410 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
415 abuf->written = written;
416 SEM_BRANCH_FINI (vpc);
417 return vpc;
418 #undef FLD
421 /* beqi: beqi$likely $rm, $imm6, $tra */
423 static SEM_PC
424 SEM_FN_NAME (sh64_media,beqi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
426 #define FLD(f) abuf->fields.sfmt_beqi.f
427 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
428 int UNUSED written = 0;
429 IADDR UNUSED pc = abuf->addr;
430 SEM_BRANCH_INIT
431 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
434 ((void) 0); /*nop*/
435 if (EQDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) {
437 UDI opval = CPU (h_tr[FLD (f_tra)]);
438 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
439 written |= (1 << 3);
440 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
445 abuf->written = written;
446 SEM_BRANCH_FINI (vpc);
447 return vpc;
448 #undef FLD
451 /* bge: bge$likely $rm, $rn, $tra */
453 static SEM_PC
454 SEM_FN_NAME (sh64_media,bge) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
456 #define FLD(f) abuf->fields.sfmt_beq.f
457 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
458 int UNUSED written = 0;
459 IADDR UNUSED pc = abuf->addr;
460 SEM_BRANCH_INIT
461 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
464 ((void) 0); /*nop*/
465 if (GEDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
467 UDI opval = CPU (h_tr[FLD (f_tra)]);
468 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
469 written |= (1 << 3);
470 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
475 abuf->written = written;
476 SEM_BRANCH_FINI (vpc);
477 return vpc;
478 #undef FLD
481 /* bgeu: bgeu$likely $rm, $rn, $tra */
483 static SEM_PC
484 SEM_FN_NAME (sh64_media,bgeu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
486 #define FLD(f) abuf->fields.sfmt_beq.f
487 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
488 int UNUSED written = 0;
489 IADDR UNUSED pc = abuf->addr;
490 SEM_BRANCH_INIT
491 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
494 ((void) 0); /*nop*/
495 if (GEUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
497 UDI opval = CPU (h_tr[FLD (f_tra)]);
498 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
499 written |= (1 << 3);
500 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
505 abuf->written = written;
506 SEM_BRANCH_FINI (vpc);
507 return vpc;
508 #undef FLD
511 /* bgt: bgt$likely $rm, $rn, $tra */
513 static SEM_PC
514 SEM_FN_NAME (sh64_media,bgt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
516 #define FLD(f) abuf->fields.sfmt_beq.f
517 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
518 int UNUSED written = 0;
519 IADDR UNUSED pc = abuf->addr;
520 SEM_BRANCH_INIT
521 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
524 ((void) 0); /*nop*/
525 if (GTDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
527 UDI opval = CPU (h_tr[FLD (f_tra)]);
528 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
529 written |= (1 << 3);
530 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
535 abuf->written = written;
536 SEM_BRANCH_FINI (vpc);
537 return vpc;
538 #undef FLD
541 /* bgtu: bgtu$likely $rm, $rn, $tra */
543 static SEM_PC
544 SEM_FN_NAME (sh64_media,bgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
546 #define FLD(f) abuf->fields.sfmt_beq.f
547 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
548 int UNUSED written = 0;
549 IADDR UNUSED pc = abuf->addr;
550 SEM_BRANCH_INIT
551 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
554 ((void) 0); /*nop*/
555 if (GTUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
557 UDI opval = CPU (h_tr[FLD (f_tra)]);
558 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
559 written |= (1 << 3);
560 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
565 abuf->written = written;
566 SEM_BRANCH_FINI (vpc);
567 return vpc;
568 #undef FLD
571 /* blink: blink $trb, $rd */
573 static SEM_PC
574 SEM_FN_NAME (sh64_media,blink) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
576 #define FLD(f) abuf->fields.sfmt_blink.f
577 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
578 int UNUSED written = 0;
579 IADDR UNUSED pc = abuf->addr;
580 SEM_BRANCH_INIT
581 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
585 DI opval = ORDI (ADDDI (pc, 4), 1);
586 SET_H_GR (FLD (f_dest), opval);
587 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
590 UDI opval = CPU (h_tr[FLD (f_trb)]);
591 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
592 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
594 if (EQSI (FLD (f_dest), 63)) {
595 ((void) 0); /*nop*/
596 } else {
597 ((void) 0); /*nop*/
601 SEM_BRANCH_FINI (vpc);
602 return vpc;
603 #undef FLD
606 /* bne: bne$likely $rm, $rn, $tra */
608 static SEM_PC
609 SEM_FN_NAME (sh64_media,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
611 #define FLD(f) abuf->fields.sfmt_beq.f
612 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
613 int UNUSED written = 0;
614 IADDR UNUSED pc = abuf->addr;
615 SEM_BRANCH_INIT
616 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
619 ((void) 0); /*nop*/
620 if (NEDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) {
622 UDI opval = CPU (h_tr[FLD (f_tra)]);
623 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
624 written |= (1 << 3);
625 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
630 abuf->written = written;
631 SEM_BRANCH_FINI (vpc);
632 return vpc;
633 #undef FLD
636 /* bnei: bnei$likely $rm, $imm6, $tra */
638 static SEM_PC
639 SEM_FN_NAME (sh64_media,bnei) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
641 #define FLD(f) abuf->fields.sfmt_beqi.f
642 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
643 int UNUSED written = 0;
644 IADDR UNUSED pc = abuf->addr;
645 SEM_BRANCH_INIT
646 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
649 ((void) 0); /*nop*/
650 if (NEDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)))) {
652 UDI opval = CPU (h_tr[FLD (f_tra)]);
653 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
654 written |= (1 << 3);
655 CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'D', opval);
660 abuf->written = written;
661 SEM_BRANCH_FINI (vpc);
662 return vpc;
663 #undef FLD
666 /* brk: brk */
668 static SEM_PC
669 SEM_FN_NAME (sh64_media,brk) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
671 #define FLD(f) abuf->fields.sfmt_empty.f
672 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
673 int UNUSED written = 0;
674 IADDR UNUSED pc = abuf->addr;
675 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
677 sh64_break (current_cpu, pc);
679 return vpc;
680 #undef FLD
683 /* byterev: byterev $rm, $rd */
685 static SEM_PC
686 SEM_FN_NAME (sh64_media,byterev) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
688 #define FLD(f) abuf->fields.sfmt_xori.f
689 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
690 int UNUSED written = 0;
691 IADDR UNUSED pc = abuf->addr;
692 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
695 DI tmp_source;
696 DI tmp_result;
697 tmp_source = GET_H_GR (FLD (f_left));
698 tmp_result = 0;
700 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
701 tmp_source = SRLDI (tmp_source, 8);
704 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
705 tmp_source = SRLDI (tmp_source, 8);
708 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
709 tmp_source = SRLDI (tmp_source, 8);
712 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
713 tmp_source = SRLDI (tmp_source, 8);
716 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
717 tmp_source = SRLDI (tmp_source, 8);
720 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
721 tmp_source = SRLDI (tmp_source, 8);
724 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
725 tmp_source = SRLDI (tmp_source, 8);
728 tmp_result = ORDI (SLLDI (tmp_result, 8), ANDDI (tmp_source, 255));
729 tmp_source = SRLDI (tmp_source, 8);
732 DI opval = tmp_result;
733 SET_H_GR (FLD (f_dest), opval);
734 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
738 return vpc;
739 #undef FLD
742 /* cmpeq: cmpeq $rm, $rn, $rd */
744 static SEM_PC
745 SEM_FN_NAME (sh64_media,cmpeq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
747 #define FLD(f) abuf->fields.sfmt_add.f
748 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
749 int UNUSED written = 0;
750 IADDR UNUSED pc = abuf->addr;
751 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
754 DI opval = ((EQDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0));
755 SET_H_GR (FLD (f_dest), opval);
756 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
759 return vpc;
760 #undef FLD
763 /* cmpgt: cmpgt $rm, $rn, $rd */
765 static SEM_PC
766 SEM_FN_NAME (sh64_media,cmpgt) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
768 #define FLD(f) abuf->fields.sfmt_add.f
769 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
770 int UNUSED written = 0;
771 IADDR UNUSED pc = abuf->addr;
772 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
775 DI opval = ((GTDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0));
776 SET_H_GR (FLD (f_dest), opval);
777 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
780 return vpc;
781 #undef FLD
784 /* cmpgtu: cmpgtu $rm,$rn, $rd */
786 static SEM_PC
787 SEM_FN_NAME (sh64_media,cmpgtu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
789 #define FLD(f) abuf->fields.sfmt_add.f
790 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
791 int UNUSED written = 0;
792 IADDR UNUSED pc = abuf->addr;
793 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
796 DI opval = ((GTUDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))) ? (1) : (0));
797 SET_H_GR (FLD (f_dest), opval);
798 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
801 return vpc;
802 #undef FLD
805 /* cmveq: cmveq $rm, $rn, $rd */
807 static SEM_PC
808 SEM_FN_NAME (sh64_media,cmveq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
810 #define FLD(f) abuf->fields.sfmt_add.f
811 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
812 int UNUSED written = 0;
813 IADDR UNUSED pc = abuf->addr;
814 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
816 if (EQDI (GET_H_GR (FLD (f_left)), 0)) {
818 DI opval = GET_H_GR (FLD (f_right));
819 SET_H_GR (FLD (f_dest), opval);
820 written |= (1 << 2);
821 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
825 abuf->written = written;
826 return vpc;
827 #undef FLD
830 /* cmvne: cmvne $rm, $rn, $rd */
832 static SEM_PC
833 SEM_FN_NAME (sh64_media,cmvne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
835 #define FLD(f) abuf->fields.sfmt_add.f
836 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
837 int UNUSED written = 0;
838 IADDR UNUSED pc = abuf->addr;
839 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
841 if (NEDI (GET_H_GR (FLD (f_left)), 0)) {
843 DI opval = GET_H_GR (FLD (f_right));
844 SET_H_GR (FLD (f_dest), opval);
845 written |= (1 << 2);
846 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
850 abuf->written = written;
851 return vpc;
852 #undef FLD
855 /* fabsd: fabs.d $drgh, $drf */
857 static SEM_PC
858 SEM_FN_NAME (sh64_media,fabsd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
860 #define FLD(f) abuf->fields.sfmt_fabsd.f
861 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
862 int UNUSED written = 0;
863 IADDR UNUSED pc = abuf->addr;
864 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
867 DF opval = sh64_fabsd (current_cpu, GET_H_DR (FLD (f_left_right)));
868 SET_H_DR (FLD (f_dest), opval);
869 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
872 return vpc;
873 #undef FLD
876 /* fabss: fabs.s $frgh, $frf */
878 static SEM_PC
879 SEM_FN_NAME (sh64_media,fabss) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
881 #define FLD(f) abuf->fields.sfmt_fabsd.f
882 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
883 int UNUSED written = 0;
884 IADDR UNUSED pc = abuf->addr;
885 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
888 SF opval = sh64_fabss (current_cpu, CPU (h_fr[FLD (f_left_right)]));
889 CPU (h_fr[FLD (f_dest)]) = opval;
890 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
893 return vpc;
894 #undef FLD
897 /* faddd: fadd.d $drg, $drh, $drf */
899 static SEM_PC
900 SEM_FN_NAME (sh64_media,faddd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
902 #define FLD(f) abuf->fields.sfmt_add.f
903 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
904 int UNUSED written = 0;
905 IADDR UNUSED pc = abuf->addr;
906 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
909 DF opval = sh64_faddd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
910 SET_H_DR (FLD (f_dest), opval);
911 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
914 return vpc;
915 #undef FLD
918 /* fadds: fadd.s $frg, $frh, $frf */
920 static SEM_PC
921 SEM_FN_NAME (sh64_media,fadds) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
923 #define FLD(f) abuf->fields.sfmt_add.f
924 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
925 int UNUSED written = 0;
926 IADDR UNUSED pc = abuf->addr;
927 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
930 SF opval = sh64_fadds (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
931 CPU (h_fr[FLD (f_dest)]) = opval;
932 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
935 return vpc;
936 #undef FLD
939 /* fcmpeqd: fcmpeq.d $drg, $drh, $rd */
941 static SEM_PC
942 SEM_FN_NAME (sh64_media,fcmpeqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
944 #define FLD(f) abuf->fields.sfmt_add.f
945 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
946 int UNUSED written = 0;
947 IADDR UNUSED pc = abuf->addr;
948 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
951 DI opval = ZEXTBIDI (sh64_fcmpeqd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
952 SET_H_GR (FLD (f_dest), opval);
953 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
956 return vpc;
957 #undef FLD
960 /* fcmpeqs: fcmpeq.s $frg, $frh, $rd */
962 static SEM_PC
963 SEM_FN_NAME (sh64_media,fcmpeqs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
965 #define FLD(f) abuf->fields.sfmt_add.f
966 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
967 int UNUSED written = 0;
968 IADDR UNUSED pc = abuf->addr;
969 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
972 DI opval = ZEXTBIDI (sh64_fcmpeqs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
973 SET_H_GR (FLD (f_dest), opval);
974 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
977 return vpc;
978 #undef FLD
981 /* fcmpged: fcmpge.d $drg, $drh, $rd */
983 static SEM_PC
984 SEM_FN_NAME (sh64_media,fcmpged) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
986 #define FLD(f) abuf->fields.sfmt_add.f
987 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
988 int UNUSED written = 0;
989 IADDR UNUSED pc = abuf->addr;
990 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
993 DI opval = ZEXTBIDI (sh64_fcmpged (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
994 SET_H_GR (FLD (f_dest), opval);
995 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
998 return vpc;
999 #undef FLD
1002 /* fcmpges: fcmpge.s $frg, $frh, $rd */
1004 static SEM_PC
1005 SEM_FN_NAME (sh64_media,fcmpges) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1007 #define FLD(f) abuf->fields.sfmt_add.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, 4);
1014 DI opval = ZEXTBIDI (sh64_fcmpges (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1015 SET_H_GR (FLD (f_dest), opval);
1016 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1019 return vpc;
1020 #undef FLD
1023 /* fcmpgtd: fcmpgt.d $drg, $drh, $rd */
1025 static SEM_PC
1026 SEM_FN_NAME (sh64_media,fcmpgtd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1028 #define FLD(f) abuf->fields.sfmt_add.f
1029 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1030 int UNUSED written = 0;
1031 IADDR UNUSED pc = abuf->addr;
1032 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1035 DI opval = ZEXTBIDI (sh64_fcmpgtd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
1036 SET_H_GR (FLD (f_dest), opval);
1037 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1040 return vpc;
1041 #undef FLD
1044 /* fcmpgts: fcmpgt.s $frg, $frh, $rd */
1046 static SEM_PC
1047 SEM_FN_NAME (sh64_media,fcmpgts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1049 #define FLD(f) abuf->fields.sfmt_add.f
1050 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1051 int UNUSED written = 0;
1052 IADDR UNUSED pc = abuf->addr;
1053 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1056 DI opval = ZEXTBIDI (sh64_fcmpgts (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1057 SET_H_GR (FLD (f_dest), opval);
1058 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1061 return vpc;
1062 #undef FLD
1065 /* fcmpund: fcmpun.d $drg, $drh, $rd */
1067 static SEM_PC
1068 SEM_FN_NAME (sh64_media,fcmpund) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1070 #define FLD(f) abuf->fields.sfmt_add.f
1071 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1072 int UNUSED written = 0;
1073 IADDR UNUSED pc = abuf->addr;
1074 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1077 DI opval = ZEXTBIDI (sh64_fcmpund (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right))));
1078 SET_H_GR (FLD (f_dest), opval);
1079 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1082 return vpc;
1083 #undef FLD
1086 /* fcmpuns: fcmpun.s $frg, $frh, $rd */
1088 static SEM_PC
1089 SEM_FN_NAME (sh64_media,fcmpuns) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1091 #define FLD(f) abuf->fields.sfmt_add.f
1092 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1093 int UNUSED written = 0;
1094 IADDR UNUSED pc = abuf->addr;
1095 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1098 DI opval = ZEXTBIDI (sh64_fcmpuns (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1099 SET_H_GR (FLD (f_dest), opval);
1100 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1103 return vpc;
1104 #undef FLD
1107 /* fcnvds: fcnv.ds $drgh, $frf */
1109 static SEM_PC
1110 SEM_FN_NAME (sh64_media,fcnvds) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1112 #define FLD(f) abuf->fields.sfmt_fabsd.f
1113 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1114 int UNUSED written = 0;
1115 IADDR UNUSED pc = abuf->addr;
1116 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1119 SF opval = sh64_fcnvds (current_cpu, GET_H_DR (FLD (f_left_right)));
1120 CPU (h_fr[FLD (f_dest)]) = opval;
1121 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1124 return vpc;
1125 #undef FLD
1128 /* fcnvsd: fcnv.sd $frgh, $drf */
1130 static SEM_PC
1131 SEM_FN_NAME (sh64_media,fcnvsd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1133 #define FLD(f) abuf->fields.sfmt_fabsd.f
1134 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1135 int UNUSED written = 0;
1136 IADDR UNUSED pc = abuf->addr;
1137 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1140 DF opval = sh64_fcnvsd (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1141 SET_H_DR (FLD (f_dest), opval);
1142 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1145 return vpc;
1146 #undef FLD
1149 /* fdivd: fdiv.d $drg, $drh, $drf */
1151 static SEM_PC
1152 SEM_FN_NAME (sh64_media,fdivd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1154 #define FLD(f) abuf->fields.sfmt_add.f
1155 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1156 int UNUSED written = 0;
1157 IADDR UNUSED pc = abuf->addr;
1158 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1161 DF opval = sh64_fdivd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
1162 SET_H_DR (FLD (f_dest), opval);
1163 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1166 return vpc;
1167 #undef FLD
1170 /* fdivs: fdiv.s $frg, $frh, $frf */
1172 static SEM_PC
1173 SEM_FN_NAME (sh64_media,fdivs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1175 #define FLD(f) abuf->fields.sfmt_add.f
1176 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1177 int UNUSED written = 0;
1178 IADDR UNUSED pc = abuf->addr;
1179 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1182 SF opval = sh64_fdivs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
1183 CPU (h_fr[FLD (f_dest)]) = opval;
1184 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1187 return vpc;
1188 #undef FLD
1191 /* fgetscr: fgetscr $frf */
1193 static SEM_PC
1194 SEM_FN_NAME (sh64_media,fgetscr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1196 #define FLD(f) abuf->fields.sfmt_shori.f
1197 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1198 int UNUSED written = 0;
1199 IADDR UNUSED pc = abuf->addr;
1200 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1203 SF opval = SUBWORDSISF (CPU (h_fpscr));
1204 CPU (h_fr[FLD (f_dest)]) = opval;
1205 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1208 return vpc;
1209 #undef FLD
1212 /* fiprs: fipr.s $fvg, $fvh, $frf */
1214 static SEM_PC
1215 SEM_FN_NAME (sh64_media,fiprs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1217 #define FLD(f) abuf->fields.sfmt_add.f
1218 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1219 int UNUSED written = 0;
1220 IADDR UNUSED pc = abuf->addr;
1221 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1225 SF opval = GET_H_FV (FLD (f_left));
1226 SET_H_FV (FLD (f_left), opval);
1227 CGEN_TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
1230 SF opval = GET_H_FV (FLD (f_right));
1231 SET_H_FV (FLD (f_right), opval);
1232 CGEN_TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
1235 SF opval = sh64_fiprs (current_cpu, FLD (f_left), FLD (f_right));
1236 CPU (h_fr[FLD (f_dest)]) = opval;
1237 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1241 return vpc;
1242 #undef FLD
1245 /* fldd: fld.d $rm, $disp10x8, $drf */
1247 static SEM_PC
1248 SEM_FN_NAME (sh64_media,fldd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1250 #define FLD(f) abuf->fields.sfmt_fldd.f
1251 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1252 int UNUSED written = 0;
1253 IADDR UNUSED pc = abuf->addr;
1254 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1257 DF opval = GETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x8)));
1258 SET_H_DR (FLD (f_dest), opval);
1259 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1262 return vpc;
1263 #undef FLD
1266 /* fldp: fld.p $rm, $disp10x8, $fpf */
1268 static SEM_PC
1269 SEM_FN_NAME (sh64_media,fldp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1271 #define FLD(f) abuf->fields.sfmt_fldd.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, 4);
1279 SF opval = GET_H_FP (FLD (f_dest));
1280 SET_H_FP (FLD (f_dest), opval);
1281 CGEN_TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1283 sh64_fldp (current_cpu, pc, GET_H_GR (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest));
1286 return vpc;
1287 #undef FLD
1290 /* flds: fld.s $rm, $disp10x4, $frf */
1292 static SEM_PC
1293 SEM_FN_NAME (sh64_media,flds) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1295 #define FLD(f) abuf->fields.sfmt_flds.f
1296 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1297 int UNUSED written = 0;
1298 IADDR UNUSED pc = abuf->addr;
1299 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1302 SF opval = GETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x4)));
1303 CPU (h_fr[FLD (f_dest)]) = opval;
1304 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1307 return vpc;
1308 #undef FLD
1311 /* fldxd: fldx.d $rm, $rn, $drf */
1313 static SEM_PC
1314 SEM_FN_NAME (sh64_media,fldxd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1316 #define FLD(f) abuf->fields.sfmt_add.f
1317 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1318 int UNUSED written = 0;
1319 IADDR UNUSED pc = abuf->addr;
1320 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1323 DF opval = GETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))));
1324 SET_H_DR (FLD (f_dest), opval);
1325 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1328 return vpc;
1329 #undef FLD
1332 /* fldxp: fldx.p $rm, $rn, $fpf */
1334 static SEM_PC
1335 SEM_FN_NAME (sh64_media,fldxp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1337 #define FLD(f) abuf->fields.sfmt_add.f
1338 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1339 int UNUSED written = 0;
1340 IADDR UNUSED pc = abuf->addr;
1341 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1345 SF opval = GET_H_FP (FLD (f_dest));
1346 SET_H_FP (FLD (f_dest), opval);
1347 CGEN_TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1349 sh64_fldp (current_cpu, pc, GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)), FLD (f_dest));
1352 return vpc;
1353 #undef FLD
1356 /* fldxs: fldx.s $rm, $rn, $frf */
1358 static SEM_PC
1359 SEM_FN_NAME (sh64_media,fldxs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1361 #define FLD(f) abuf->fields.sfmt_add.f
1362 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1363 int UNUSED written = 0;
1364 IADDR UNUSED pc = abuf->addr;
1365 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1368 SF opval = GETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))));
1369 CPU (h_fr[FLD (f_dest)]) = opval;
1370 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1373 return vpc;
1374 #undef FLD
1377 /* floatld: float.ld $frgh, $drf */
1379 static SEM_PC
1380 SEM_FN_NAME (sh64_media,floatld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1382 #define FLD(f) abuf->fields.sfmt_fabsd.f
1383 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1384 int UNUSED written = 0;
1385 IADDR UNUSED pc = abuf->addr;
1386 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1389 DF opval = sh64_floatld (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1390 SET_H_DR (FLD (f_dest), opval);
1391 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1394 return vpc;
1395 #undef FLD
1398 /* floatls: float.ls $frgh, $frf */
1400 static SEM_PC
1401 SEM_FN_NAME (sh64_media,floatls) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1403 #define FLD(f) abuf->fields.sfmt_fabsd.f
1404 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1405 int UNUSED written = 0;
1406 IADDR UNUSED pc = abuf->addr;
1407 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1410 SF opval = sh64_floatls (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1411 CPU (h_fr[FLD (f_dest)]) = opval;
1412 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1415 return vpc;
1416 #undef FLD
1419 /* floatqd: float.qd $drgh, $drf */
1421 static SEM_PC
1422 SEM_FN_NAME (sh64_media,floatqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1424 #define FLD(f) abuf->fields.sfmt_fabsd.f
1425 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1426 int UNUSED written = 0;
1427 IADDR UNUSED pc = abuf->addr;
1428 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1431 DF opval = sh64_floatqd (current_cpu, GET_H_DR (FLD (f_left_right)));
1432 SET_H_DR (FLD (f_dest), opval);
1433 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1436 return vpc;
1437 #undef FLD
1440 /* floatqs: float.qs $drgh, $frf */
1442 static SEM_PC
1443 SEM_FN_NAME (sh64_media,floatqs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1445 #define FLD(f) abuf->fields.sfmt_fabsd.f
1446 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1447 int UNUSED written = 0;
1448 IADDR UNUSED pc = abuf->addr;
1449 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1452 SF opval = sh64_floatqs (current_cpu, GET_H_DR (FLD (f_left_right)));
1453 CPU (h_fr[FLD (f_dest)]) = opval;
1454 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1457 return vpc;
1458 #undef FLD
1461 /* fmacs: fmac.s $frg, $frh, $frf */
1463 static SEM_PC
1464 SEM_FN_NAME (sh64_media,fmacs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1466 #define FLD(f) abuf->fields.sfmt_add.f
1467 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1468 int UNUSED written = 0;
1469 IADDR UNUSED pc = abuf->addr;
1470 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1473 SF opval = sh64_fadds (current_cpu, CPU (h_fr[FLD (f_dest)]), sh64_fmuls (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)])));
1474 CPU (h_fr[FLD (f_dest)]) = opval;
1475 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1478 return vpc;
1479 #undef FLD
1482 /* fmovd: fmov.d $drgh, $drf */
1484 static SEM_PC
1485 SEM_FN_NAME (sh64_media,fmovd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1487 #define FLD(f) abuf->fields.sfmt_fabsd.f
1488 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1489 int UNUSED written = 0;
1490 IADDR UNUSED pc = abuf->addr;
1491 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1494 DF opval = GET_H_DR (FLD (f_left_right));
1495 SET_H_DR (FLD (f_dest), opval);
1496 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1499 return vpc;
1500 #undef FLD
1503 /* fmovdq: fmov.dq $drgh, $rd */
1505 static SEM_PC
1506 SEM_FN_NAME (sh64_media,fmovdq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1508 #define FLD(f) abuf->fields.sfmt_fabsd.f
1509 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1510 int UNUSED written = 0;
1511 IADDR UNUSED pc = abuf->addr;
1512 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1515 DI opval = SUBWORDDFDI (GET_H_DR (FLD (f_left_right)));
1516 SET_H_GR (FLD (f_dest), opval);
1517 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1520 return vpc;
1521 #undef FLD
1524 /* fmovls: fmov.ls $rm, $frf */
1526 static SEM_PC
1527 SEM_FN_NAME (sh64_media,fmovls) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1529 #define FLD(f) abuf->fields.sfmt_xori.f
1530 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1531 int UNUSED written = 0;
1532 IADDR UNUSED pc = abuf->addr;
1533 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1536 SF opval = SUBWORDSISF (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1));
1537 CPU (h_fr[FLD (f_dest)]) = opval;
1538 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1541 return vpc;
1542 #undef FLD
1545 /* fmovqd: fmov.qd $rm, $drf */
1547 static SEM_PC
1548 SEM_FN_NAME (sh64_media,fmovqd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1550 #define FLD(f) abuf->fields.sfmt_xori.f
1551 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1552 int UNUSED written = 0;
1553 IADDR UNUSED pc = abuf->addr;
1554 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1557 DF opval = SUBWORDDIDF (GET_H_GR (FLD (f_left)));
1558 SET_H_DR (FLD (f_dest), opval);
1559 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1562 return vpc;
1563 #undef FLD
1566 /* fmovs: fmov.s $frgh, $frf */
1568 static SEM_PC
1569 SEM_FN_NAME (sh64_media,fmovs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1571 #define FLD(f) abuf->fields.sfmt_fabsd.f
1572 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1573 int UNUSED written = 0;
1574 IADDR UNUSED pc = abuf->addr;
1575 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1578 SF opval = CPU (h_fr[FLD (f_left_right)]);
1579 CPU (h_fr[FLD (f_dest)]) = opval;
1580 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1583 return vpc;
1584 #undef FLD
1587 /* fmovsl: fmov.sl $frgh, $rd */
1589 static SEM_PC
1590 SEM_FN_NAME (sh64_media,fmovsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1592 #define FLD(f) abuf->fields.sfmt_fabsd.f
1593 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1594 int UNUSED written = 0;
1595 IADDR UNUSED pc = abuf->addr;
1596 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1599 DI opval = EXTSIDI (SUBWORDSFSI (CPU (h_fr[FLD (f_left_right)])));
1600 SET_H_GR (FLD (f_dest), opval);
1601 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
1604 return vpc;
1605 #undef FLD
1608 /* fmuld: fmul.d $drg, $drh, $drf */
1610 static SEM_PC
1611 SEM_FN_NAME (sh64_media,fmuld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1613 #define FLD(f) abuf->fields.sfmt_add.f
1614 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1615 int UNUSED written = 0;
1616 IADDR UNUSED pc = abuf->addr;
1617 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1620 DF opval = sh64_fmuld (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
1621 SET_H_DR (FLD (f_dest), opval);
1622 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1625 return vpc;
1626 #undef FLD
1629 /* fmuls: fmul.s $frg, $frh, $frf */
1631 static SEM_PC
1632 SEM_FN_NAME (sh64_media,fmuls) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1634 #define FLD(f) abuf->fields.sfmt_add.f
1635 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1636 int UNUSED written = 0;
1637 IADDR UNUSED pc = abuf->addr;
1638 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1641 SF opval = sh64_fmuls (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
1642 CPU (h_fr[FLD (f_dest)]) = opval;
1643 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1646 return vpc;
1647 #undef FLD
1650 /* fnegd: fneg.d $drgh, $drf */
1652 static SEM_PC
1653 SEM_FN_NAME (sh64_media,fnegd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1655 #define FLD(f) abuf->fields.sfmt_fabsd.f
1656 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1657 int UNUSED written = 0;
1658 IADDR UNUSED pc = abuf->addr;
1659 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1662 DF opval = sh64_fnegd (current_cpu, GET_H_DR (FLD (f_left_right)));
1663 SET_H_DR (FLD (f_dest), opval);
1664 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1667 return vpc;
1668 #undef FLD
1671 /* fnegs: fneg.s $frgh, $frf */
1673 static SEM_PC
1674 SEM_FN_NAME (sh64_media,fnegs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1676 #define FLD(f) abuf->fields.sfmt_fabsd.f
1677 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1678 int UNUSED written = 0;
1679 IADDR UNUSED pc = abuf->addr;
1680 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1683 SF opval = sh64_fnegs (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1684 CPU (h_fr[FLD (f_dest)]) = opval;
1685 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1688 return vpc;
1689 #undef FLD
1692 /* fputscr: fputscr $frgh */
1694 static SEM_PC
1695 SEM_FN_NAME (sh64_media,fputscr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1697 #define FLD(f) abuf->fields.sfmt_fabsd.f
1698 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1699 int UNUSED written = 0;
1700 IADDR UNUSED pc = abuf->addr;
1701 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1704 SI opval = SUBWORDSFSI (CPU (h_fr[FLD (f_left_right)]));
1705 CPU (h_fpscr) = opval;
1706 CGEN_TRACE_RESULT (current_cpu, abuf, "fpscr", 'x', opval);
1709 return vpc;
1710 #undef FLD
1713 /* fsqrtd: fsqrt.d $drgh, $drf */
1715 static SEM_PC
1716 SEM_FN_NAME (sh64_media,fsqrtd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1718 #define FLD(f) abuf->fields.sfmt_fabsd.f
1719 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1720 int UNUSED written = 0;
1721 IADDR UNUSED pc = abuf->addr;
1722 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1725 DF opval = sh64_fsqrtd (current_cpu, GET_H_DR (FLD (f_left_right)));
1726 SET_H_DR (FLD (f_dest), opval);
1727 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1730 return vpc;
1731 #undef FLD
1734 /* fsqrts: fsqrt.s $frgh, $frf */
1736 static SEM_PC
1737 SEM_FN_NAME (sh64_media,fsqrts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1739 #define FLD(f) abuf->fields.sfmt_fabsd.f
1740 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1741 int UNUSED written = 0;
1742 IADDR UNUSED pc = abuf->addr;
1743 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1746 SF opval = sh64_fsqrts (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1747 CPU (h_fr[FLD (f_dest)]) = opval;
1748 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1751 return vpc;
1752 #undef FLD
1755 /* fstd: fst.d $rm, $disp10x8, $drf */
1757 static SEM_PC
1758 SEM_FN_NAME (sh64_media,fstd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1760 #define FLD(f) abuf->fields.sfmt_fldd.f
1761 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1762 int UNUSED written = 0;
1763 IADDR UNUSED pc = abuf->addr;
1764 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1767 DF opval = GET_H_DR (FLD (f_dest));
1768 SETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x8)), opval);
1769 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1772 return vpc;
1773 #undef FLD
1776 /* fstp: fst.p $rm, $disp10x8, $fpf */
1778 static SEM_PC
1779 SEM_FN_NAME (sh64_media,fstp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1781 #define FLD(f) abuf->fields.sfmt_fldd.f
1782 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1783 int UNUSED written = 0;
1784 IADDR UNUSED pc = abuf->addr;
1785 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1789 SF opval = GET_H_FP (FLD (f_dest));
1790 SET_H_FP (FLD (f_dest), opval);
1791 CGEN_TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1793 sh64_fstp (current_cpu, pc, GET_H_GR (FLD (f_left)), FLD (f_disp10x8), FLD (f_dest));
1796 return vpc;
1797 #undef FLD
1800 /* fsts: fst.s $rm, $disp10x4, $frf */
1802 static SEM_PC
1803 SEM_FN_NAME (sh64_media,fsts) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1805 #define FLD(f) abuf->fields.sfmt_flds.f
1806 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1807 int UNUSED written = 0;
1808 IADDR UNUSED pc = abuf->addr;
1809 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1812 SF opval = CPU (h_fr[FLD (f_dest)]);
1813 SETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp10x4)), opval);
1814 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1817 return vpc;
1818 #undef FLD
1821 /* fstxd: fstx.d $rm, $rn, $drf */
1823 static SEM_PC
1824 SEM_FN_NAME (sh64_media,fstxd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1826 #define FLD(f) abuf->fields.sfmt_add.f
1827 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1828 int UNUSED written = 0;
1829 IADDR UNUSED pc = abuf->addr;
1830 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1833 DF opval = GET_H_DR (FLD (f_dest));
1834 SETMEMDF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
1835 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1838 return vpc;
1839 #undef FLD
1842 /* fstxp: fstx.p $rm, $rn, $fpf */
1844 static SEM_PC
1845 SEM_FN_NAME (sh64_media,fstxp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1847 #define FLD(f) abuf->fields.sfmt_add.f
1848 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1849 int UNUSED written = 0;
1850 IADDR UNUSED pc = abuf->addr;
1851 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1855 SF opval = GET_H_FP (FLD (f_dest));
1856 SET_H_FP (FLD (f_dest), opval);
1857 CGEN_TRACE_RESULT (current_cpu, abuf, "fp", 'f', opval);
1859 sh64_fstp (current_cpu, pc, GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)), FLD (f_dest));
1862 return vpc;
1863 #undef FLD
1866 /* fstxs: fstx.s $rm, $rn, $frf */
1868 static SEM_PC
1869 SEM_FN_NAME (sh64_media,fstxs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1871 #define FLD(f) abuf->fields.sfmt_add.f
1872 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1873 int UNUSED written = 0;
1874 IADDR UNUSED pc = abuf->addr;
1875 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1878 SF opval = CPU (h_fr[FLD (f_dest)]);
1879 SETMEMSF (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
1880 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'f', opval);
1883 return vpc;
1884 #undef FLD
1887 /* fsubd: fsub.d $drg, $drh, $drf */
1889 static SEM_PC
1890 SEM_FN_NAME (sh64_media,fsubd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1892 #define FLD(f) abuf->fields.sfmt_add.f
1893 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1894 int UNUSED written = 0;
1895 IADDR UNUSED pc = abuf->addr;
1896 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1899 DF opval = sh64_fsubd (current_cpu, GET_H_DR (FLD (f_left)), GET_H_DR (FLD (f_right)));
1900 SET_H_DR (FLD (f_dest), opval);
1901 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1904 return vpc;
1905 #undef FLD
1908 /* fsubs: fsub.s $frg, $frh, $frf */
1910 static SEM_PC
1911 SEM_FN_NAME (sh64_media,fsubs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1913 #define FLD(f) abuf->fields.sfmt_add.f
1914 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1915 int UNUSED written = 0;
1916 IADDR UNUSED pc = abuf->addr;
1917 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1920 SF opval = sh64_fsubs (current_cpu, CPU (h_fr[FLD (f_left)]), CPU (h_fr[FLD (f_right)]));
1921 CPU (h_fr[FLD (f_dest)]) = opval;
1922 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1925 return vpc;
1926 #undef FLD
1929 /* ftrcdl: ftrc.dl $drgh, $frf */
1931 static SEM_PC
1932 SEM_FN_NAME (sh64_media,ftrcdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1934 #define FLD(f) abuf->fields.sfmt_fabsd.f
1935 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1936 int UNUSED written = 0;
1937 IADDR UNUSED pc = abuf->addr;
1938 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1941 SF opval = sh64_ftrcdl (current_cpu, GET_H_DR (FLD (f_left_right)));
1942 CPU (h_fr[FLD (f_dest)]) = opval;
1943 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1946 return vpc;
1947 #undef FLD
1950 /* ftrcsl: ftrc.sl $frgh, $frf */
1952 static SEM_PC
1953 SEM_FN_NAME (sh64_media,ftrcsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1955 #define FLD(f) abuf->fields.sfmt_fabsd.f
1956 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1957 int UNUSED written = 0;
1958 IADDR UNUSED pc = abuf->addr;
1959 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1962 SF opval = sh64_ftrcsl (current_cpu, CPU (h_fr[FLD (f_left_right)]));
1963 CPU (h_fr[FLD (f_dest)]) = opval;
1964 CGEN_TRACE_RESULT (current_cpu, abuf, "fr", 'f', opval);
1967 return vpc;
1968 #undef FLD
1971 /* ftrcdq: ftrc.dq $drgh, $drf */
1973 static SEM_PC
1974 SEM_FN_NAME (sh64_media,ftrcdq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1976 #define FLD(f) abuf->fields.sfmt_fabsd.f
1977 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1978 int UNUSED written = 0;
1979 IADDR UNUSED pc = abuf->addr;
1980 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1983 DF opval = sh64_ftrcdq (current_cpu, GET_H_DR (FLD (f_left_right)));
1984 SET_H_DR (FLD (f_dest), opval);
1985 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
1988 return vpc;
1989 #undef FLD
1992 /* ftrcsq: ftrc.sq $frgh, $drf */
1994 static SEM_PC
1995 SEM_FN_NAME (sh64_media,ftrcsq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1997 #define FLD(f) abuf->fields.sfmt_fabsd.f
1998 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1999 int UNUSED written = 0;
2000 IADDR UNUSED pc = abuf->addr;
2001 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2004 DF opval = sh64_ftrcsq (current_cpu, CPU (h_fr[FLD (f_left_right)]));
2005 SET_H_DR (FLD (f_dest), opval);
2006 CGEN_TRACE_RESULT (current_cpu, abuf, "dr", 'f', opval);
2009 return vpc;
2010 #undef FLD
2013 /* ftrvs: ftrv.s $mtrxg, $fvh, $fvf */
2015 static SEM_PC
2016 SEM_FN_NAME (sh64_media,ftrvs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2018 #define FLD(f) abuf->fields.sfmt_add.f
2019 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2020 int UNUSED written = 0;
2021 IADDR UNUSED pc = abuf->addr;
2022 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2026 SF opval = GET_H_FMTX (FLD (f_left));
2027 SET_H_FMTX (FLD (f_left), opval);
2028 CGEN_TRACE_RESULT (current_cpu, abuf, "fmtx", 'f', opval);
2031 SF opval = GET_H_FV (FLD (f_right));
2032 SET_H_FV (FLD (f_right), opval);
2033 CGEN_TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
2036 SF opval = GET_H_FV (FLD (f_dest));
2037 SET_H_FV (FLD (f_dest), opval);
2038 CGEN_TRACE_RESULT (current_cpu, abuf, "fv", 'f', opval);
2040 sh64_ftrvs (current_cpu, FLD (f_left), FLD (f_right), FLD (f_dest));
2043 return vpc;
2044 #undef FLD
2047 /* getcfg: getcfg $rm, $disp6, $rd */
2049 static SEM_PC
2050 SEM_FN_NAME (sh64_media,getcfg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2052 #define FLD(f) abuf->fields.sfmt_getcfg.f
2053 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2054 int UNUSED written = 0;
2055 IADDR UNUSED pc = abuf->addr;
2056 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2059 SI tmp_address;
2060 tmp_address = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2061 ((void) 0); /*nop*/
2063 DI opval = GETMEMSI (current_cpu, pc, tmp_address);
2064 SET_H_GR (FLD (f_dest), opval);
2065 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2069 return vpc;
2070 #undef FLD
2073 /* getcon: getcon $crk, $rd */
2075 static SEM_PC
2076 SEM_FN_NAME (sh64_media,getcon) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2078 #define FLD(f) abuf->fields.sfmt_xori.f
2079 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2080 int UNUSED written = 0;
2081 IADDR UNUSED pc = abuf->addr;
2082 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2085 DI opval = GET_H_CR (FLD (f_left));
2086 SET_H_GR (FLD (f_dest), opval);
2087 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2090 return vpc;
2091 #undef FLD
2094 /* gettr: gettr $trb, $rd */
2096 static SEM_PC
2097 SEM_FN_NAME (sh64_media,gettr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2099 #define FLD(f) abuf->fields.sfmt_blink.f
2100 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2101 int UNUSED written = 0;
2102 IADDR UNUSED pc = abuf->addr;
2103 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2106 DI opval = CPU (h_tr[FLD (f_trb)]);
2107 SET_H_GR (FLD (f_dest), opval);
2108 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2111 return vpc;
2112 #undef FLD
2115 /* icbi: icbi $rm, $disp6x32 */
2117 static SEM_PC
2118 SEM_FN_NAME (sh64_media,icbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2120 #define FLD(f) abuf->fields.sfmt_xori.f
2121 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2122 int UNUSED written = 0;
2123 IADDR UNUSED pc = abuf->addr;
2124 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2128 DI opval = GET_H_GR (FLD (f_left));
2129 SET_H_GR (FLD (f_left), opval);
2130 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2132 ((void) 0); /*nop*/
2135 return vpc;
2136 #undef FLD
2139 /* ldb: ld.b $rm, $disp10, $rd */
2141 static SEM_PC
2142 SEM_FN_NAME (sh64_media,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2144 #define FLD(f) abuf->fields.sfmt_addi.f
2145 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2146 int UNUSED written = 0;
2147 IADDR UNUSED pc = abuf->addr;
2148 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2151 DI opval = EXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)))));
2152 SET_H_GR (FLD (f_dest), opval);
2153 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2156 return vpc;
2157 #undef FLD
2160 /* ldl: ld.l $rm, $disp10x4, $rd */
2162 static SEM_PC
2163 SEM_FN_NAME (sh64_media,ldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2165 #define FLD(f) abuf->fields.sfmt_flds.f
2166 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2167 int UNUSED written = 0;
2168 IADDR UNUSED pc = abuf->addr;
2169 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2172 DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x4)))));
2173 SET_H_GR (FLD (f_dest), opval);
2174 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2177 return vpc;
2178 #undef FLD
2181 /* ldq: ld.q $rm, $disp10x8, $rd */
2183 static SEM_PC
2184 SEM_FN_NAME (sh64_media,ldq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2186 #define FLD(f) abuf->fields.sfmt_fldd.f
2187 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2188 int UNUSED written = 0;
2189 IADDR UNUSED pc = abuf->addr;
2190 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2193 DI opval = GETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))));
2194 SET_H_GR (FLD (f_dest), opval);
2195 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2198 return vpc;
2199 #undef FLD
2202 /* ldub: ld.ub $rm, $disp10, $rd */
2204 static SEM_PC
2205 SEM_FN_NAME (sh64_media,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2207 #define FLD(f) abuf->fields.sfmt_addi.f
2208 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2209 int UNUSED written = 0;
2210 IADDR UNUSED pc = abuf->addr;
2211 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2214 DI opval = ZEXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10)))));
2215 SET_H_GR (FLD (f_dest), opval);
2216 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2219 return vpc;
2220 #undef FLD
2223 /* lduw: ld.uw $rm, $disp10x2, $rd */
2225 static SEM_PC
2226 SEM_FN_NAME (sh64_media,lduw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2228 #define FLD(f) abuf->fields.sfmt_lduw.f
2229 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2230 int UNUSED written = 0;
2231 IADDR UNUSED pc = abuf->addr;
2232 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2235 DI opval = ZEXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2)))));
2236 SET_H_GR (FLD (f_dest), opval);
2237 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2240 return vpc;
2241 #undef FLD
2244 /* ldw: ld.w $rm, $disp10x2, $rd */
2246 static SEM_PC
2247 SEM_FN_NAME (sh64_media,ldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2249 #define FLD(f) abuf->fields.sfmt_lduw.f
2250 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2251 int UNUSED written = 0;
2252 IADDR UNUSED pc = abuf->addr;
2253 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2256 DI opval = EXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2)))));
2257 SET_H_GR (FLD (f_dest), opval);
2258 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2261 return vpc;
2262 #undef FLD
2265 /* ldhil: ldhi.l $rm, $disp6, $rd */
2267 static SEM_PC
2268 SEM_FN_NAME (sh64_media,ldhil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2270 #define FLD(f) abuf->fields.sfmt_getcfg.f
2271 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2272 int UNUSED written = 0;
2273 IADDR UNUSED pc = abuf->addr;
2274 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2277 DI tmp_addr;
2278 QI tmp_bytecount;
2279 SI tmp_val;
2280 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2281 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1);
2282 tmp_val = 0;
2283 if (ANDQI (tmp_bytecount, 4)) {
2285 DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -4)));
2286 SET_H_GR (FLD (f_dest), opval);
2287 written |= (1 << 6);
2288 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2290 } else {
2291 if (GET_H_ENDIAN ()) {
2293 if (ANDQI (tmp_bytecount, 2)) {
2294 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2296 if (ANDQI (tmp_bytecount, 1)) {
2297 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2300 DI opval = EXTSIDI (tmp_val);
2301 SET_H_GR (FLD (f_dest), opval);
2302 written |= (1 << 6);
2303 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2306 } else {
2308 if (ANDQI (tmp_bytecount, 1)) {
2309 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2311 if (ANDQI (tmp_bytecount, 2)) {
2312 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2315 DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount))));
2316 SET_H_GR (FLD (f_dest), opval);
2317 written |= (1 << 6);
2318 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2325 abuf->written = written;
2326 return vpc;
2327 #undef FLD
2330 /* ldhiq: ldhi.q $rm, $disp6, $rd */
2332 static SEM_PC
2333 SEM_FN_NAME (sh64_media,ldhiq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2335 #define FLD(f) abuf->fields.sfmt_getcfg.f
2336 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2337 int UNUSED written = 0;
2338 IADDR UNUSED pc = abuf->addr;
2339 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2342 DI tmp_addr;
2343 QI tmp_bytecount;
2344 DI tmp_val;
2345 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2346 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1);
2347 tmp_val = 0;
2348 if (ANDQI (tmp_bytecount, 8)) {
2350 DI opval = GETMEMDI (current_cpu, pc, ANDDI (tmp_addr, -8));
2351 SET_H_GR (FLD (f_dest), opval);
2352 written |= (1 << 7);
2353 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2355 } else {
2356 if (GET_H_ENDIAN ()) {
2358 if (ANDQI (tmp_bytecount, 4)) {
2359 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8))));
2361 if (ANDQI (tmp_bytecount, 2)) {
2362 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2364 if (ANDQI (tmp_bytecount, 1)) {
2365 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2368 DI opval = tmp_val;
2369 SET_H_GR (FLD (f_dest), opval);
2370 written |= (1 << 7);
2371 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2374 } else {
2376 if (ANDQI (tmp_bytecount, 1)) {
2377 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2379 if (ANDQI (tmp_bytecount, 2)) {
2380 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4))));
2382 if (ANDQI (tmp_bytecount, 4)) {
2383 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8))));
2386 DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount)));
2387 SET_H_GR (FLD (f_dest), opval);
2388 written |= (1 << 7);
2389 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2396 abuf->written = written;
2397 return vpc;
2398 #undef FLD
2401 /* ldlol: ldlo.l $rm, $disp6, $rd */
2403 static SEM_PC
2404 SEM_FN_NAME (sh64_media,ldlol) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2406 #define FLD(f) abuf->fields.sfmt_getcfg.f
2407 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2408 int UNUSED written = 0;
2409 IADDR UNUSED pc = abuf->addr;
2410 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2413 DI tmp_addr;
2414 QI tmp_bytecount;
2415 SI tmp_val;
2416 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2417 tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3));
2418 tmp_val = 0;
2419 if (ANDQI (tmp_bytecount, 4)) {
2421 DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, tmp_addr));
2422 SET_H_GR (FLD (f_dest), opval);
2423 written |= (1 << 6);
2424 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2426 } else {
2427 if (GET_H_ENDIAN ()) {
2429 if (ANDQI (tmp_bytecount, 1)) {
2430 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2432 if (ANDQI (tmp_bytecount, 2)) {
2433 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2436 DI opval = EXTSIDI (SLLSI (tmp_val, SUBSI (32, MULSI (8, tmp_bytecount))));
2437 SET_H_GR (FLD (f_dest), opval);
2438 written |= (1 << 6);
2439 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2442 } else {
2444 if (ANDQI (tmp_bytecount, 2)) {
2445 tmp_val = ADDSI (SLLSI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2447 if (ANDQI (tmp_bytecount, 1)) {
2448 tmp_val = ADDSI (SLLSI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2451 DI opval = EXTSIDI (tmp_val);
2452 SET_H_GR (FLD (f_dest), opval);
2453 written |= (1 << 6);
2454 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2461 abuf->written = written;
2462 return vpc;
2463 #undef FLD
2466 /* ldloq: ldlo.q $rm, $disp6, $rd */
2468 static SEM_PC
2469 SEM_FN_NAME (sh64_media,ldloq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2471 #define FLD(f) abuf->fields.sfmt_getcfg.f
2472 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2473 int UNUSED written = 0;
2474 IADDR UNUSED pc = abuf->addr;
2475 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2478 DI tmp_addr;
2479 QI tmp_bytecount;
2480 DI tmp_val;
2481 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
2482 tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7));
2483 tmp_val = 0;
2484 if (ANDQI (tmp_bytecount, 8)) {
2486 DI opval = GETMEMDI (current_cpu, pc, tmp_addr);
2487 SET_H_GR (FLD (f_dest), opval);
2488 written |= (1 << 7);
2489 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2491 } else {
2492 if (GET_H_ENDIAN ()) {
2494 if (ANDQI (tmp_bytecount, 1)) {
2495 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2497 if (ANDQI (tmp_bytecount, 2)) {
2498 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2500 if (ANDQI (tmp_bytecount, 4)) {
2501 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4))));
2504 DI opval = SLLDI (tmp_val, SUBSI (64, MULSI (8, tmp_bytecount)));
2505 SET_H_GR (FLD (f_dest), opval);
2506 written |= (1 << 7);
2507 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2510 } else {
2512 if (ANDQI (tmp_bytecount, 4)) {
2513 tmp_val = ADDDI (SLLDI (tmp_val, 32), ZEXTSIDI (GETMEMSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4))));
2515 if (ANDQI (tmp_bytecount, 2)) {
2516 tmp_val = ADDDI (SLLDI (tmp_val, 16), ZEXTHIDI (GETMEMHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2))));
2518 if (ANDQI (tmp_bytecount, 1)) {
2519 tmp_val = ADDDI (SLLDI (tmp_val, 8), ZEXTQIDI (GETMEMQI (current_cpu, pc, tmp_addr)));
2522 DI opval = tmp_val;
2523 SET_H_GR (FLD (f_dest), opval);
2524 written |= (1 << 7);
2525 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2532 abuf->written = written;
2533 return vpc;
2534 #undef FLD
2537 /* ldxb: ldx.b $rm, $rn, $rd */
2539 static SEM_PC
2540 SEM_FN_NAME (sh64_media,ldxb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2542 #define FLD(f) abuf->fields.sfmt_add.f
2543 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2544 int UNUSED written = 0;
2545 IADDR UNUSED pc = abuf->addr;
2546 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2549 DI opval = EXTQIDI (GETMEMQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2550 SET_H_GR (FLD (f_dest), opval);
2551 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2554 return vpc;
2555 #undef FLD
2558 /* ldxl: ldx.l $rm, $rn, $rd */
2560 static SEM_PC
2561 SEM_FN_NAME (sh64_media,ldxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2563 #define FLD(f) abuf->fields.sfmt_add.f
2564 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2565 int UNUSED written = 0;
2566 IADDR UNUSED pc = abuf->addr;
2567 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2570 DI opval = EXTSIDI (GETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2571 SET_H_GR (FLD (f_dest), opval);
2572 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2575 return vpc;
2576 #undef FLD
2579 /* ldxq: ldx.q $rm, $rn, $rd */
2581 static SEM_PC
2582 SEM_FN_NAME (sh64_media,ldxq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2584 #define FLD(f) abuf->fields.sfmt_add.f
2585 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2586 int UNUSED written = 0;
2587 IADDR UNUSED pc = abuf->addr;
2588 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2591 DI opval = GETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))));
2592 SET_H_GR (FLD (f_dest), opval);
2593 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2596 return vpc;
2597 #undef FLD
2600 /* ldxub: ldx.ub $rm, $rn, $rd */
2602 static SEM_PC
2603 SEM_FN_NAME (sh64_media,ldxub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2605 #define FLD(f) abuf->fields.sfmt_add.f
2606 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2607 int UNUSED written = 0;
2608 IADDR UNUSED pc = abuf->addr;
2609 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2612 DI opval = ZEXTQIDI (GETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2613 SET_H_GR (FLD (f_dest), opval);
2614 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2617 return vpc;
2618 #undef FLD
2621 /* ldxuw: ldx.uw $rm, $rn, $rd */
2623 static SEM_PC
2624 SEM_FN_NAME (sh64_media,ldxuw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2626 #define FLD(f) abuf->fields.sfmt_add.f
2627 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2628 int UNUSED written = 0;
2629 IADDR UNUSED pc = abuf->addr;
2630 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2633 DI opval = ZEXTHIDI (GETMEMUHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2634 SET_H_GR (FLD (f_dest), opval);
2635 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2638 return vpc;
2639 #undef FLD
2642 /* ldxw: ldx.w $rm, $rn, $rd */
2644 static SEM_PC
2645 SEM_FN_NAME (sh64_media,ldxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2647 #define FLD(f) abuf->fields.sfmt_add.f
2648 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2649 int UNUSED written = 0;
2650 IADDR UNUSED pc = abuf->addr;
2651 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2654 DI opval = EXTHIDI (GETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)))));
2655 SET_H_GR (FLD (f_dest), opval);
2656 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2659 return vpc;
2660 #undef FLD
2663 /* mabsl: mabs.l $rm, $rd */
2665 static SEM_PC
2666 SEM_FN_NAME (sh64_media,mabsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2668 #define FLD(f) abuf->fields.sfmt_xori.f
2669 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2670 int UNUSED written = 0;
2671 IADDR UNUSED pc = abuf->addr;
2672 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2675 SI tmp_result1;
2676 SI tmp_result0;
2677 tmp_result0 = ABSSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1));
2678 tmp_result1 = ABSSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0));
2680 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2681 SET_H_GR (FLD (f_dest), opval);
2682 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2686 return vpc;
2687 #undef FLD
2690 /* mabsw: mabs.w $rm, $rd */
2692 static SEM_PC
2693 SEM_FN_NAME (sh64_media,mabsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2695 #define FLD(f) abuf->fields.sfmt_xori.f
2696 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2697 int UNUSED written = 0;
2698 IADDR UNUSED pc = abuf->addr;
2699 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2702 HI tmp_result3;
2703 HI tmp_result2;
2704 HI tmp_result1;
2705 HI tmp_result0;
2706 tmp_result0 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3));
2707 tmp_result1 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2));
2708 tmp_result2 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1));
2709 tmp_result3 = ABSHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0));
2711 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2712 SET_H_GR (FLD (f_dest), opval);
2713 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2717 return vpc;
2718 #undef FLD
2721 /* maddl: madd.l $rm, $rn, $rd */
2723 static SEM_PC
2724 SEM_FN_NAME (sh64_media,maddl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2726 #define FLD(f) abuf->fields.sfmt_add.f
2727 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2728 int UNUSED written = 0;
2729 IADDR UNUSED pc = abuf->addr;
2730 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2733 SI tmp_result1;
2734 SI tmp_result0;
2735 tmp_result0 = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
2736 tmp_result1 = ADDSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0));
2738 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2739 SET_H_GR (FLD (f_dest), opval);
2740 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2744 return vpc;
2745 #undef FLD
2748 /* maddw: madd.w $rm, $rn, $rd */
2750 static SEM_PC
2751 SEM_FN_NAME (sh64_media,maddw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2753 #define FLD(f) abuf->fields.sfmt_add.f
2754 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2755 int UNUSED written = 0;
2756 IADDR UNUSED pc = abuf->addr;
2757 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2760 HI tmp_result3;
2761 HI tmp_result2;
2762 HI tmp_result1;
2763 HI tmp_result0;
2764 tmp_result0 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3));
2765 tmp_result1 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2));
2766 tmp_result2 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1));
2767 tmp_result3 = ADDHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0));
2769 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2770 SET_H_GR (FLD (f_dest), opval);
2771 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2775 return vpc;
2776 #undef FLD
2779 /* maddsl: madds.l $rm, $rn, $rd */
2781 static SEM_PC
2782 SEM_FN_NAME (sh64_media,maddsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2784 #define FLD(f) abuf->fields.sfmt_add.f
2785 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2786 int UNUSED written = 0;
2787 IADDR UNUSED pc = abuf->addr;
2788 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2791 SI tmp_result1;
2792 SI tmp_result0;
2793 tmp_result0 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
2794 tmp_result1 = ((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
2796 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2797 SET_H_GR (FLD (f_dest), opval);
2798 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2802 return vpc;
2803 #undef FLD
2806 /* maddsub: madds.ub $rm, $rn, $rd */
2808 static SEM_PC
2809 SEM_FN_NAME (sh64_media,maddsub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2811 #define FLD(f) abuf->fields.sfmt_add.f
2812 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2813 int UNUSED written = 0;
2814 IADDR UNUSED pc = abuf->addr;
2815 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2818 QI tmp_result7;
2819 QI tmp_result6;
2820 QI tmp_result5;
2821 QI tmp_result4;
2822 QI tmp_result3;
2823 QI tmp_result2;
2824 QI tmp_result1;
2825 QI tmp_result0;
2826 tmp_result0 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1)))));
2827 tmp_result1 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1)))));
2828 tmp_result2 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1)))));
2829 tmp_result3 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1)))));
2830 tmp_result4 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1)))));
2831 tmp_result5 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1)))));
2832 tmp_result6 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1)))));
2833 tmp_result7 = ((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, 8))) ? (ADDDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1)))));
2835 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
2836 SET_H_GR (FLD (f_dest), opval);
2837 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2841 return vpc;
2842 #undef FLD
2845 /* maddsw: madds.w $rm, $rn, $rd */
2847 static SEM_PC
2848 SEM_FN_NAME (sh64_media,maddsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2850 #define FLD(f) abuf->fields.sfmt_add.f
2851 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2852 int UNUSED written = 0;
2853 IADDR UNUSED pc = abuf->addr;
2854 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2857 HI tmp_result3;
2858 HI tmp_result2;
2859 HI tmp_result1;
2860 HI tmp_result0;
2861 tmp_result0 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2862 tmp_result1 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2863 tmp_result2 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2864 tmp_result3 = ((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (ADDDI (EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), EXTHIDI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
2866 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2867 SET_H_GR (FLD (f_dest), opval);
2868 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2872 return vpc;
2873 #undef FLD
2876 /* mcmpeqb: mcmpeq.b $rm, $rn, $rd */
2878 static SEM_PC
2879 SEM_FN_NAME (sh64_media,mcmpeqb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2881 #define FLD(f) abuf->fields.sfmt_add.f
2882 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2883 int UNUSED written = 0;
2884 IADDR UNUSED pc = abuf->addr;
2885 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2888 QI tmp_result7;
2889 QI tmp_result6;
2890 QI tmp_result5;
2891 QI tmp_result4;
2892 QI tmp_result3;
2893 QI tmp_result2;
2894 QI tmp_result1;
2895 QI tmp_result0;
2896 tmp_result0 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))) ? (INVQI (0)) : (0));
2897 tmp_result1 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))) ? (INVQI (0)) : (0));
2898 tmp_result2 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))) ? (INVQI (0)) : (0));
2899 tmp_result3 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))) ? (INVQI (0)) : (0));
2900 tmp_result4 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))) ? (INVQI (0)) : (0));
2901 tmp_result5 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))) ? (INVQI (0)) : (0));
2902 tmp_result6 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))) ? (INVQI (0)) : (0));
2903 tmp_result7 = ((EQQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))) ? (INVQI (0)) : (0));
2905 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
2906 SET_H_GR (FLD (f_dest), opval);
2907 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2911 return vpc;
2912 #undef FLD
2915 /* mcmpeql: mcmpeq.l $rm, $rn, $rd */
2917 static SEM_PC
2918 SEM_FN_NAME (sh64_media,mcmpeql) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2920 #define FLD(f) abuf->fields.sfmt_add.f
2921 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2922 int UNUSED written = 0;
2923 IADDR UNUSED pc = abuf->addr;
2924 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2927 SI tmp_result1;
2928 SI tmp_result0;
2929 tmp_result0 = ((EQSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))) ? (INVSI (0)) : (0));
2930 tmp_result1 = ((EQSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))) ? (INVSI (0)) : (0));
2932 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2933 SET_H_GR (FLD (f_dest), opval);
2934 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2938 return vpc;
2939 #undef FLD
2942 /* mcmpeqw: mcmpeq.w $rm, $rn, $rd */
2944 static SEM_PC
2945 SEM_FN_NAME (sh64_media,mcmpeqw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2947 #define FLD(f) abuf->fields.sfmt_add.f
2948 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2949 int UNUSED written = 0;
2950 IADDR UNUSED pc = abuf->addr;
2951 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2954 HI tmp_result3;
2955 HI tmp_result2;
2956 HI tmp_result1;
2957 HI tmp_result0;
2958 tmp_result0 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))) ? (INVHI (0)) : (0));
2959 tmp_result1 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))) ? (INVHI (0)) : (0));
2960 tmp_result2 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))) ? (INVHI (0)) : (0));
2961 tmp_result3 = ((EQHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))) ? (INVHI (0)) : (0));
2963 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
2964 SET_H_GR (FLD (f_dest), opval);
2965 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2969 return vpc;
2970 #undef FLD
2973 /* mcmpgtl: mcmpgt.l $rm, $rn, $rd */
2975 static SEM_PC
2976 SEM_FN_NAME (sh64_media,mcmpgtl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2978 #define FLD(f) abuf->fields.sfmt_add.f
2979 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2980 int UNUSED written = 0;
2981 IADDR UNUSED pc = abuf->addr;
2982 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2985 SI tmp_result1;
2986 SI tmp_result0;
2987 tmp_result0 = ((GTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))) ? (INVSI (0)) : (0));
2988 tmp_result1 = ((GTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))) ? (INVSI (0)) : (0));
2990 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
2991 SET_H_GR (FLD (f_dest), opval);
2992 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
2996 return vpc;
2997 #undef FLD
3000 /* mcmpgtub: mcmpgt.ub $rm, $rn, $rd */
3002 static SEM_PC
3003 SEM_FN_NAME (sh64_media,mcmpgtub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3005 #define FLD(f) abuf->fields.sfmt_add.f
3006 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3007 int UNUSED written = 0;
3008 IADDR UNUSED pc = abuf->addr;
3009 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3012 QI tmp_result7;
3013 QI tmp_result6;
3014 QI tmp_result5;
3015 QI tmp_result4;
3016 QI tmp_result3;
3017 QI tmp_result2;
3018 QI tmp_result1;
3019 QI tmp_result0;
3020 tmp_result0 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))) ? (INVQI (0)) : (0));
3021 tmp_result1 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))) ? (INVQI (0)) : (0));
3022 tmp_result2 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))) ? (INVQI (0)) : (0));
3023 tmp_result3 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))) ? (INVQI (0)) : (0));
3024 tmp_result4 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))) ? (INVQI (0)) : (0));
3025 tmp_result5 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))) ? (INVQI (0)) : (0));
3026 tmp_result6 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))) ? (INVQI (0)) : (0));
3027 tmp_result7 = ((GTUQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))) ? (INVQI (0)) : (0));
3029 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3030 SET_H_GR (FLD (f_dest), opval);
3031 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3035 return vpc;
3036 #undef FLD
3039 /* mcmpgtw: mcmpgt.w $rm, $rn, $rd */
3041 static SEM_PC
3042 SEM_FN_NAME (sh64_media,mcmpgtw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3044 #define FLD(f) abuf->fields.sfmt_add.f
3045 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3046 int UNUSED written = 0;
3047 IADDR UNUSED pc = abuf->addr;
3048 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3051 HI tmp_result3;
3052 HI tmp_result2;
3053 HI tmp_result1;
3054 HI tmp_result0;
3055 tmp_result0 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))) ? (INVHI (0)) : (0));
3056 tmp_result1 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))) ? (INVHI (0)) : (0));
3057 tmp_result2 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))) ? (INVHI (0)) : (0));
3058 tmp_result3 = ((GTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0))) ? (INVHI (0)) : (0));
3060 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3061 SET_H_GR (FLD (f_dest), opval);
3062 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3066 return vpc;
3067 #undef FLD
3070 /* mcmv: mcmv $rm, $rn, $rd */
3072 static SEM_PC
3073 SEM_FN_NAME (sh64_media,mcmv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3075 #define FLD(f) abuf->fields.sfmt_add.f
3076 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3077 int UNUSED written = 0;
3078 IADDR UNUSED pc = abuf->addr;
3079 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3082 DI opval = ORDI (ANDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), ANDDI (GET_H_GR (FLD (f_dest)), INVDI (GET_H_GR (FLD (f_right)))));
3083 SET_H_GR (FLD (f_dest), opval);
3084 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3087 return vpc;
3088 #undef FLD
3091 /* mcnvslw: mcnvs.lw $rm, $rn, $rd */
3093 static SEM_PC
3094 SEM_FN_NAME (sh64_media,mcnvslw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3096 #define FLD(f) abuf->fields.sfmt_add.f
3097 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3098 int UNUSED written = 0;
3099 IADDR UNUSED pc = abuf->addr;
3100 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3103 HI tmp_result3;
3104 HI tmp_result2;
3105 HI tmp_result1;
3106 HI tmp_result0;
3107 tmp_result0 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3108 tmp_result1 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3109 tmp_result2 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3110 tmp_result3 = ((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, SUBSI (16, 1)))) ? (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3112 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3113 SET_H_GR (FLD (f_dest), opval);
3114 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3118 return vpc;
3119 #undef FLD
3122 /* mcnvswb: mcnvs.wb $rm, $rn, $rd */
3124 static SEM_PC
3125 SEM_FN_NAME (sh64_media,mcnvswb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3127 #define FLD(f) abuf->fields.sfmt_add.f
3128 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3129 int UNUSED written = 0;
3130 IADDR UNUSED pc = abuf->addr;
3131 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3134 QI tmp_result7;
3135 QI tmp_result6;
3136 QI tmp_result5;
3137 QI tmp_result4;
3138 QI tmp_result3;
3139 QI tmp_result2;
3140 QI tmp_result1;
3141 QI tmp_result0;
3142 tmp_result0 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3143 tmp_result1 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3144 tmp_result2 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3145 tmp_result3 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3146 tmp_result4 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3147 tmp_result5 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3148 tmp_result6 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3149 tmp_result7 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), NEGDI (SLLDI (1, SUBSI (8, 1))))) ? (NEGQI (SLLQI (1, SUBSI (8, 1)))) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, SUBSI (8, 1)))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, SUBSI (8, 1)), 1)))));
3151 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3152 SET_H_GR (FLD (f_dest), opval);
3153 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3157 return vpc;
3158 #undef FLD
3161 /* mcnvswub: mcnvs.wub $rm, $rn, $rd */
3163 static SEM_PC
3164 SEM_FN_NAME (sh64_media,mcnvswub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3166 #define FLD(f) abuf->fields.sfmt_add.f
3167 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3168 int UNUSED written = 0;
3169 IADDR UNUSED pc = abuf->addr;
3170 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3173 QI tmp_result7;
3174 QI tmp_result6;
3175 QI tmp_result5;
3176 QI tmp_result4;
3177 QI tmp_result3;
3178 QI tmp_result2;
3179 QI tmp_result1;
3180 QI tmp_result0;
3181 tmp_result0 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)) : (SUBQI (SLLQI (1, 8), 1)))));
3182 tmp_result1 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)) : (SUBQI (SLLQI (1, 8), 1)))));
3183 tmp_result2 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)) : (SUBQI (SLLQI (1, 8), 1)))));
3184 tmp_result3 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)) : (SUBQI (SLLQI (1, 8), 1)))));
3185 tmp_result4 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)) : (SUBQI (SLLQI (1, 8), 1)))));
3186 tmp_result5 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)) : (SUBQI (SLLQI (1, 8), 1)))));
3187 tmp_result6 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)) : (SUBQI (SLLQI (1, 8), 1)))));
3188 tmp_result7 = ((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), MAKEDI (0, 0))) ? (0) : (((LTHI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0), SLLDI (1, 8))) ? (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)) : (SUBQI (SLLQI (1, 8), 1)))));
3190 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3191 SET_H_GR (FLD (f_dest), opval);
3192 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3196 return vpc;
3197 #undef FLD
3200 /* mextr1: mextr1 $rm, $rn, $rd */
3202 static SEM_PC
3203 SEM_FN_NAME (sh64_media,mextr1) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3205 #define FLD(f) abuf->fields.sfmt_add.f
3206 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3207 int UNUSED written = 0;
3208 IADDR UNUSED pc = abuf->addr;
3209 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3212 QI tmp_count;
3213 DI tmp_mask;
3214 DI tmp_rhs;
3215 tmp_count = MULQI (8, 1);
3216 tmp_mask = SLLDI (INVSI (0), tmp_count);
3217 tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3218 tmp_count = MULQI (8, SUBQI (8, 1));
3219 tmp_mask = SRLDI (INVSI (0), tmp_count);
3221 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3222 SET_H_GR (FLD (f_dest), opval);
3223 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3227 return vpc;
3228 #undef FLD
3231 /* mextr2: mextr2 $rm, $rn, $rd */
3233 static SEM_PC
3234 SEM_FN_NAME (sh64_media,mextr2) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3236 #define FLD(f) abuf->fields.sfmt_add.f
3237 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3238 int UNUSED written = 0;
3239 IADDR UNUSED pc = abuf->addr;
3240 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3243 QI tmp_count;
3244 DI tmp_mask;
3245 DI tmp_rhs;
3246 tmp_count = MULQI (8, 2);
3247 tmp_mask = SLLDI (INVSI (0), tmp_count);
3248 tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3249 tmp_count = MULQI (8, SUBQI (8, 2));
3250 tmp_mask = SRLDI (INVSI (0), tmp_count);
3252 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3253 SET_H_GR (FLD (f_dest), opval);
3254 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3258 return vpc;
3259 #undef FLD
3262 /* mextr3: mextr3 $rm, $rn, $rd */
3264 static SEM_PC
3265 SEM_FN_NAME (sh64_media,mextr3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3267 #define FLD(f) abuf->fields.sfmt_add.f
3268 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3269 int UNUSED written = 0;
3270 IADDR UNUSED pc = abuf->addr;
3271 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3274 QI tmp_count;
3275 DI tmp_mask;
3276 DI tmp_rhs;
3277 tmp_count = MULQI (8, 3);
3278 tmp_mask = SLLDI (INVSI (0), tmp_count);
3279 tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3280 tmp_count = MULQI (8, SUBQI (8, 3));
3281 tmp_mask = SRLDI (INVSI (0), tmp_count);
3283 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3284 SET_H_GR (FLD (f_dest), opval);
3285 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3289 return vpc;
3290 #undef FLD
3293 /* mextr4: mextr4 $rm, $rn, $rd */
3295 static SEM_PC
3296 SEM_FN_NAME (sh64_media,mextr4) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3298 #define FLD(f) abuf->fields.sfmt_add.f
3299 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3300 int UNUSED written = 0;
3301 IADDR UNUSED pc = abuf->addr;
3302 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3305 QI tmp_count;
3306 DI tmp_mask;
3307 DI tmp_rhs;
3308 tmp_count = MULQI (8, 4);
3309 tmp_mask = SLLDI (INVSI (0), tmp_count);
3310 tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3311 tmp_count = MULQI (8, SUBQI (8, 4));
3312 tmp_mask = SRLDI (INVSI (0), tmp_count);
3314 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3315 SET_H_GR (FLD (f_dest), opval);
3316 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3320 return vpc;
3321 #undef FLD
3324 /* mextr5: mextr5 $rm, $rn, $rd */
3326 static SEM_PC
3327 SEM_FN_NAME (sh64_media,mextr5) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3329 #define FLD(f) abuf->fields.sfmt_add.f
3330 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3331 int UNUSED written = 0;
3332 IADDR UNUSED pc = abuf->addr;
3333 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3336 QI tmp_count;
3337 DI tmp_mask;
3338 DI tmp_rhs;
3339 tmp_count = MULQI (8, 5);
3340 tmp_mask = SLLDI (INVSI (0), tmp_count);
3341 tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3342 tmp_count = MULQI (8, SUBQI (8, 5));
3343 tmp_mask = SRLDI (INVSI (0), tmp_count);
3345 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3346 SET_H_GR (FLD (f_dest), opval);
3347 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3351 return vpc;
3352 #undef FLD
3355 /* mextr6: mextr6 $rm, $rn, $rd */
3357 static SEM_PC
3358 SEM_FN_NAME (sh64_media,mextr6) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3360 #define FLD(f) abuf->fields.sfmt_add.f
3361 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3362 int UNUSED written = 0;
3363 IADDR UNUSED pc = abuf->addr;
3364 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3367 QI tmp_count;
3368 DI tmp_mask;
3369 DI tmp_rhs;
3370 tmp_count = MULQI (8, 6);
3371 tmp_mask = SLLDI (INVSI (0), tmp_count);
3372 tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3373 tmp_count = MULQI (8, SUBQI (8, 6));
3374 tmp_mask = SRLDI (INVSI (0), tmp_count);
3376 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3377 SET_H_GR (FLD (f_dest), opval);
3378 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3382 return vpc;
3383 #undef FLD
3386 /* mextr7: mextr7 $rm, $rn, $rd */
3388 static SEM_PC
3389 SEM_FN_NAME (sh64_media,mextr7) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3391 #define FLD(f) abuf->fields.sfmt_add.f
3392 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3393 int UNUSED written = 0;
3394 IADDR UNUSED pc = abuf->addr;
3395 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3398 QI tmp_count;
3399 DI tmp_mask;
3400 DI tmp_rhs;
3401 tmp_count = MULQI (8, 7);
3402 tmp_mask = SLLDI (INVSI (0), tmp_count);
3403 tmp_rhs = SRLDI (ANDDI (GET_H_GR (FLD (f_left)), tmp_mask), tmp_count);
3404 tmp_count = MULQI (8, SUBQI (8, 7));
3405 tmp_mask = SRLDI (INVSI (0), tmp_count);
3407 DI opval = ORDI (tmp_rhs, SLLDI (ANDDI (GET_H_GR (FLD (f_right)), tmp_mask), tmp_count));
3408 SET_H_GR (FLD (f_dest), opval);
3409 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3413 return vpc;
3414 #undef FLD
3417 /* mmacfxwl: mmacfx.wl $rm, $rn, $rd */
3419 static SEM_PC
3420 SEM_FN_NAME (sh64_media,mmacfxwl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3422 #define FLD(f) abuf->fields.sfmt_add.f
3423 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3424 int UNUSED written = 0;
3425 IADDR UNUSED pc = abuf->addr;
3426 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3429 SI tmp_temp;
3430 SI tmp_result1;
3431 SI tmp_result0;
3432 tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1);
3433 tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 0);
3434 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3435 tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3436 tmp_result0 = ((LTDI (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3437 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3438 tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3439 tmp_result1 = ((LTDI (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (ADDDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3441 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3442 SET_H_GR (FLD (f_dest), opval);
3443 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3447 return vpc;
3448 #undef FLD
3451 /* mmacnfx.wl: mmacnfx.wl $rm, $rn, $rd */
3453 static SEM_PC
3454 SEM_FN_NAME (sh64_media,mmacnfx_wl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3456 #define FLD(f) abuf->fields.sfmt_add.f
3457 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3458 int UNUSED written = 0;
3459 IADDR UNUSED pc = abuf->addr;
3460 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3463 SI tmp_temp;
3464 SI tmp_result1;
3465 SI tmp_result0;
3466 tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1);
3467 tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 0);
3468 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3469 tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3470 tmp_result0 = ((LTDI (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (tmp_result0), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3471 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3472 tmp_temp = ((LTDI (SLLDI (tmp_temp, 1), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (tmp_temp, 1), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (tmp_temp, 1)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3473 tmp_result1 = ((LTDI (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp)), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (tmp_result1), EXTSIDI (tmp_temp))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3475 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3476 SET_H_GR (FLD (f_dest), opval);
3477 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3481 return vpc;
3482 #undef FLD
3485 /* mmull: mmul.l $rm, $rn, $rd */
3487 static SEM_PC
3488 SEM_FN_NAME (sh64_media,mmull) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3490 #define FLD(f) abuf->fields.sfmt_add.f
3491 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3492 int UNUSED written = 0;
3493 IADDR UNUSED pc = abuf->addr;
3494 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3497 SI tmp_result1;
3498 SI tmp_result0;
3499 tmp_result0 = MULSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
3500 tmp_result1 = MULSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0));
3502 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3503 SET_H_GR (FLD (f_dest), opval);
3504 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3508 return vpc;
3509 #undef FLD
3512 /* mmulw: mmul.w $rm, $rn, $rd */
3514 static SEM_PC
3515 SEM_FN_NAME (sh64_media,mmulw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3517 #define FLD(f) abuf->fields.sfmt_add.f
3518 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3519 int UNUSED written = 0;
3520 IADDR UNUSED pc = abuf->addr;
3521 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3524 HI tmp_result3;
3525 HI tmp_result2;
3526 HI tmp_result1;
3527 HI tmp_result0;
3528 tmp_result0 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3));
3529 tmp_result1 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2));
3530 tmp_result2 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1));
3531 tmp_result3 = MULHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0));
3533 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3534 SET_H_GR (FLD (f_dest), opval);
3535 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3539 return vpc;
3540 #undef FLD
3543 /* mmulfxl: mmulfx.l $rm, $rn, $rd */
3545 static SEM_PC
3546 SEM_FN_NAME (sh64_media,mmulfxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3548 #define FLD(f) abuf->fields.sfmt_add.f
3549 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3550 int UNUSED written = 0;
3551 IADDR UNUSED pc = abuf->addr;
3552 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3555 DI tmp_temp;
3556 SI tmp_result0;
3557 SI tmp_result1;
3558 tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
3559 tmp_result0 = ((LTDI (SRADI (tmp_temp, 31), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SRADI (tmp_temp, 31), SLLDI (1, SUBSI (32, 1)))) ? (SRADI (tmp_temp, 31)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3560 tmp_temp = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)));
3561 tmp_result1 = ((LTDI (SRADI (tmp_temp, 31), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SRADI (tmp_temp, 31), SLLDI (1, SUBSI (32, 1)))) ? (SRADI (tmp_temp, 31)) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3563 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3564 SET_H_GR (FLD (f_dest), opval);
3565 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3569 return vpc;
3570 #undef FLD
3573 /* mmulfxw: mmulfx.w $rm, $rn, $rd */
3575 static SEM_PC
3576 SEM_FN_NAME (sh64_media,mmulfxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3578 #define FLD(f) abuf->fields.sfmt_add.f
3579 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3580 int UNUSED written = 0;
3581 IADDR UNUSED pc = abuf->addr;
3582 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3585 SI tmp_temp;
3586 HI tmp_result0;
3587 HI tmp_result1;
3588 HI tmp_result2;
3589 HI tmp_result3;
3590 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3591 tmp_result0 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3592 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3593 tmp_result1 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3594 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)));
3595 tmp_result2 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3596 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3597 tmp_result3 = ((LTSI (SRASI (tmp_temp, 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (tmp_temp, 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (tmp_temp, 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3599 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3600 SET_H_GR (FLD (f_dest), opval);
3601 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3605 return vpc;
3606 #undef FLD
3609 /* mmulfxrpw: mmulfxrp.w $rm, $rn, $rd */
3611 static SEM_PC
3612 SEM_FN_NAME (sh64_media,mmulfxrpw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3614 #define FLD(f) abuf->fields.sfmt_add.f
3615 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3616 int UNUSED written = 0;
3617 IADDR UNUSED pc = abuf->addr;
3618 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3621 SI tmp_temp;
3622 HI tmp_result0;
3623 HI tmp_result1;
3624 HI tmp_result2;
3625 HI tmp_result3;
3626 HI tmp_c;
3627 tmp_c = SLLSI (1, 14);
3628 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3629 tmp_result0 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3630 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3631 tmp_result1 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3632 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)));
3633 tmp_result2 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3634 tmp_temp = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3635 tmp_result3 = ((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTSI (SRASI (ADDSI (tmp_temp, tmp_c), 15), SLLDI (1, SUBSI (16, 1)))) ? (SRASI (ADDSI (tmp_temp, tmp_c), 15)) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3637 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3638 SET_H_GR (FLD (f_dest), opval);
3639 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3643 return vpc;
3644 #undef FLD
3647 /* mmulhiwl: mmulhi.wl $rm, $rn, $rd */
3649 static SEM_PC
3650 SEM_FN_NAME (sh64_media,mmulhiwl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3652 #define FLD(f) abuf->fields.sfmt_add.f
3653 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3654 int UNUSED written = 0;
3655 IADDR UNUSED pc = abuf->addr;
3656 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3659 SI tmp_result1;
3660 SI tmp_result0;
3661 tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1)));
3662 tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3664 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3665 SET_H_GR (FLD (f_dest), opval);
3666 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3670 return vpc;
3671 #undef FLD
3674 /* mmullowl: mmullo.wl $rm, $rn, $rd */
3676 static SEM_PC
3677 SEM_FN_NAME (sh64_media,mmullowl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3679 #define FLD(f) abuf->fields.sfmt_add.f
3680 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3681 int UNUSED written = 0;
3682 IADDR UNUSED pc = abuf->addr;
3683 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3686 SI tmp_result1;
3687 SI tmp_result0;
3688 tmp_result0 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3)));
3689 tmp_result1 = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2)));
3691 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3692 SET_H_GR (FLD (f_dest), opval);
3693 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3697 return vpc;
3698 #undef FLD
3701 /* mmulsumwq: mmulsum.wq $rm, $rn, $rd */
3703 static SEM_PC
3704 SEM_FN_NAME (sh64_media,mmulsumwq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3706 #define FLD(f) abuf->fields.sfmt_add.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, 4);
3713 DI tmp_acc;
3714 tmp_acc = MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0)));
3715 tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1))));
3716 tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2))));
3717 tmp_acc = ADDDI (tmp_acc, MULSI (ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3)), ZEXTHISI (SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3))));
3719 DI opval = ADDDI (GET_H_GR (FLD (f_dest)), tmp_acc);
3720 SET_H_GR (FLD (f_dest), opval);
3721 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3725 return vpc;
3726 #undef FLD
3729 /* movi: movi $imm16, $rd */
3731 static SEM_PC
3732 SEM_FN_NAME (sh64_media,movi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3734 #define FLD(f) abuf->fields.sfmt_movi.f
3735 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3736 int UNUSED written = 0;
3737 IADDR UNUSED pc = abuf->addr;
3738 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3741 DI opval = EXTSIDI (FLD (f_imm16));
3742 SET_H_GR (FLD (f_dest), opval);
3743 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3746 return vpc;
3747 #undef FLD
3750 /* mpermw: mperm.w $rm, $rn, $rd */
3752 static SEM_PC
3753 SEM_FN_NAME (sh64_media,mpermw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3755 #define FLD(f) abuf->fields.sfmt_add.f
3756 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3757 int UNUSED written = 0;
3758 IADDR UNUSED pc = abuf->addr;
3759 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3762 QI tmp_control;
3763 HI tmp_result3;
3764 HI tmp_result2;
3765 HI tmp_result1;
3766 HI tmp_result0;
3767 tmp_control = ANDQI (GET_H_GR (FLD (f_right)), 255);
3768 tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (tmp_control, 3)));
3769 tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 2), 3)));
3770 tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 4), 3)));
3771 tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), SUBSI (3, ANDQI (SRLQI (tmp_control, 6), 3)));
3773 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3774 SET_H_GR (FLD (f_dest), opval);
3775 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3779 return vpc;
3780 #undef FLD
3783 /* msadubq: msad.ubq $rm, $rn, $rd */
3785 static SEM_PC
3786 SEM_FN_NAME (sh64_media,msadubq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3788 #define FLD(f) abuf->fields.sfmt_add.f
3789 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3790 int UNUSED written = 0;
3791 IADDR UNUSED pc = abuf->addr;
3792 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3795 DI tmp_acc;
3796 tmp_acc = ABSDI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)));
3797 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))));
3798 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))));
3799 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))));
3800 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))));
3801 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))));
3802 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))));
3803 tmp_acc = ADDDI (tmp_acc, ABSQI (SUBQI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7), SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))));
3805 DI opval = ADDDI (GET_H_GR (FLD (f_dest)), tmp_acc);
3806 SET_H_GR (FLD (f_dest), opval);
3807 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3811 return vpc;
3812 #undef FLD
3815 /* mshaldsl: mshalds.l $rm, $rn, $rd */
3817 static SEM_PC
3818 SEM_FN_NAME (sh64_media,mshaldsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3820 #define FLD(f) abuf->fields.sfmt_add.f
3821 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3822 int UNUSED written = 0;
3823 IADDR UNUSED pc = abuf->addr;
3824 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3827 SI tmp_result1;
3828 SI tmp_result0;
3829 tmp_result0 = ((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3830 tmp_result1 = ((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31)), SLLDI (1, SUBSI (32, 1)))) ? (SLLDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
3832 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3833 SET_H_GR (FLD (f_dest), opval);
3834 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3838 return vpc;
3839 #undef FLD
3842 /* mshaldsw: mshalds.w $rm, $rn, $rd */
3844 static SEM_PC
3845 SEM_FN_NAME (sh64_media,mshaldsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3847 #define FLD(f) abuf->fields.sfmt_add.f
3848 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3849 int UNUSED written = 0;
3850 IADDR UNUSED pc = abuf->addr;
3851 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3854 HI tmp_result3;
3855 HI tmp_result2;
3856 HI tmp_result1;
3857 HI tmp_result0;
3858 tmp_result0 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3859 tmp_result1 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3860 tmp_result2 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3861 tmp_result3 = ((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15)), SLLDI (1, SUBSI (16, 1)))) ? (SLLDI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
3863 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3864 SET_H_GR (FLD (f_dest), opval);
3865 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3869 return vpc;
3870 #undef FLD
3873 /* mshardl: mshard.l $rm, $rn, $rd */
3875 static SEM_PC
3876 SEM_FN_NAME (sh64_media,mshardl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3878 #define FLD(f) abuf->fields.sfmt_add.f
3879 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3880 int UNUSED written = 0;
3881 IADDR UNUSED pc = abuf->addr;
3882 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3885 SI tmp_result1;
3886 SI tmp_result0;
3887 tmp_result0 = SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31));
3888 tmp_result1 = SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31));
3890 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
3891 SET_H_GR (FLD (f_dest), opval);
3892 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3896 return vpc;
3897 #undef FLD
3900 /* mshardw: mshard.w $rm, $rn, $rd */
3902 static SEM_PC
3903 SEM_FN_NAME (sh64_media,mshardw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3905 #define FLD(f) abuf->fields.sfmt_add.f
3906 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3907 int UNUSED written = 0;
3908 IADDR UNUSED pc = abuf->addr;
3909 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3912 HI tmp_result3;
3913 HI tmp_result2;
3914 HI tmp_result1;
3915 HI tmp_result0;
3916 tmp_result0 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15));
3917 tmp_result1 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15));
3918 tmp_result2 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15));
3919 tmp_result3 = SRAHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15));
3921 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
3922 SET_H_GR (FLD (f_dest), opval);
3923 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3927 return vpc;
3928 #undef FLD
3931 /* mshardsq: mshards.q $rm, $rn, $rd */
3933 static SEM_PC
3934 SEM_FN_NAME (sh64_media,mshardsq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3936 #define FLD(f) abuf->fields.sfmt_add.f
3937 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3938 int UNUSED written = 0;
3939 IADDR UNUSED pc = abuf->addr;
3940 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3943 DI opval = ((LTDI (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGDI (SLLDI (1, SUBSI (16, 1)))) : (((LTDI (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63)), SLLDI (1, SUBSI (16, 1)))) ? (SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63))) : (SUBDI (SLLDI (1, SUBSI (16, 1)), 1)))));
3944 SET_H_GR (FLD (f_dest), opval);
3945 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3948 return vpc;
3949 #undef FLD
3952 /* mshfhib: mshfhi.b $rm, $rn, $rd */
3954 static SEM_PC
3955 SEM_FN_NAME (sh64_media,mshfhib) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3957 #define FLD(f) abuf->fields.sfmt_add.f
3958 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3959 int UNUSED written = 0;
3960 IADDR UNUSED pc = abuf->addr;
3961 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
3964 QI tmp_result7;
3965 QI tmp_result6;
3966 QI tmp_result5;
3967 QI tmp_result4;
3968 QI tmp_result3;
3969 QI tmp_result2;
3970 QI tmp_result1;
3971 QI tmp_result0;
3972 tmp_result0 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3);
3973 tmp_result1 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3);
3974 tmp_result2 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2);
3975 tmp_result3 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2);
3976 tmp_result4 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1);
3977 tmp_result5 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1);
3978 tmp_result6 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0);
3979 tmp_result7 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0);
3981 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
3982 SET_H_GR (FLD (f_dest), opval);
3983 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
3987 return vpc;
3988 #undef FLD
3991 /* mshfhil: mshfhi.l $rm, $rn, $rd */
3993 static SEM_PC
3994 SEM_FN_NAME (sh64_media,mshfhil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
3996 #define FLD(f) abuf->fields.sfmt_add.f
3997 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
3998 int UNUSED written = 0;
3999 IADDR UNUSED pc = abuf->addr;
4000 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4003 SI tmp_result1;
4004 SI tmp_result0;
4005 tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_left)), 0);
4006 tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_right)), 0);
4008 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4009 SET_H_GR (FLD (f_dest), opval);
4010 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4014 return vpc;
4015 #undef FLD
4018 /* mshfhiw: mshfhi.w $rm, $rn, $rd */
4020 static SEM_PC
4021 SEM_FN_NAME (sh64_media,mshfhiw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4023 #define FLD(f) abuf->fields.sfmt_add.f
4024 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4025 int UNUSED written = 0;
4026 IADDR UNUSED pc = abuf->addr;
4027 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4030 HI tmp_result3;
4031 HI tmp_result2;
4032 HI tmp_result1;
4033 HI tmp_result0;
4034 tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1);
4035 tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1);
4036 tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0);
4037 tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0);
4039 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4040 SET_H_GR (FLD (f_dest), opval);
4041 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4045 return vpc;
4046 #undef FLD
4049 /* mshflob: mshflo.b $rm, $rn, $rd */
4051 static SEM_PC
4052 SEM_FN_NAME (sh64_media,mshflob) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4054 #define FLD(f) abuf->fields.sfmt_add.f
4055 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4056 int UNUSED written = 0;
4057 IADDR UNUSED pc = abuf->addr;
4058 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4061 QI tmp_result7;
4062 QI tmp_result6;
4063 QI tmp_result5;
4064 QI tmp_result4;
4065 QI tmp_result3;
4066 QI tmp_result2;
4067 QI tmp_result1;
4068 QI tmp_result0;
4069 tmp_result0 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7);
4070 tmp_result1 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7);
4071 tmp_result2 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6);
4072 tmp_result3 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6);
4073 tmp_result4 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5);
4074 tmp_result5 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5);
4075 tmp_result6 = SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4);
4076 tmp_result7 = SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4);
4078 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
4079 SET_H_GR (FLD (f_dest), opval);
4080 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4084 return vpc;
4085 #undef FLD
4088 /* mshflol: mshflo.l $rm, $rn, $rd */
4090 static SEM_PC
4091 SEM_FN_NAME (sh64_media,mshflol) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4093 #define FLD(f) abuf->fields.sfmt_add.f
4094 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4095 int UNUSED written = 0;
4096 IADDR UNUSED pc = abuf->addr;
4097 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4100 SI tmp_result1;
4101 SI tmp_result0;
4102 tmp_result0 = SUBWORDDISI (GET_H_GR (FLD (f_left)), 1);
4103 tmp_result1 = SUBWORDDISI (GET_H_GR (FLD (f_right)), 1);
4105 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4106 SET_H_GR (FLD (f_dest), opval);
4107 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4111 return vpc;
4112 #undef FLD
4115 /* mshflow: mshflo.w $rm, $rn, $rd */
4117 static SEM_PC
4118 SEM_FN_NAME (sh64_media,mshflow) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4120 #define FLD(f) abuf->fields.sfmt_add.f
4121 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4122 int UNUSED written = 0;
4123 IADDR UNUSED pc = abuf->addr;
4124 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4127 HI tmp_result3;
4128 HI tmp_result2;
4129 HI tmp_result1;
4130 HI tmp_result0;
4131 tmp_result0 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3);
4132 tmp_result1 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3);
4133 tmp_result2 = SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2);
4134 tmp_result3 = SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2);
4136 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4137 SET_H_GR (FLD (f_dest), opval);
4138 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4142 return vpc;
4143 #undef FLD
4146 /* mshlldl: mshlld.l $rm, $rn, $rd */
4148 static SEM_PC
4149 SEM_FN_NAME (sh64_media,mshlldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4151 #define FLD(f) abuf->fields.sfmt_add.f
4152 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4153 int UNUSED written = 0;
4154 IADDR UNUSED pc = abuf->addr;
4155 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4158 SI tmp_result1;
4159 SI tmp_result0;
4160 tmp_result0 = SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31));
4161 tmp_result1 = SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31));
4163 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4164 SET_H_GR (FLD (f_dest), opval);
4165 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4169 return vpc;
4170 #undef FLD
4173 /* mshlldw: mshlld.w $rm, $rn, $rd */
4175 static SEM_PC
4176 SEM_FN_NAME (sh64_media,mshlldw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4178 #define FLD(f) abuf->fields.sfmt_add.f
4179 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4180 int UNUSED written = 0;
4181 IADDR UNUSED pc = abuf->addr;
4182 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4185 HI tmp_result3;
4186 HI tmp_result2;
4187 HI tmp_result1;
4188 HI tmp_result0;
4189 tmp_result0 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15));
4190 tmp_result1 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15));
4191 tmp_result2 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15));
4192 tmp_result3 = SLLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15));
4194 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4195 SET_H_GR (FLD (f_dest), opval);
4196 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4200 return vpc;
4201 #undef FLD
4204 /* mshlrdl: mshlrd.l $rm, $rn, $rd */
4206 static SEM_PC
4207 SEM_FN_NAME (sh64_media,mshlrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4209 #define FLD(f) abuf->fields.sfmt_add.f
4210 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4211 int UNUSED written = 0;
4212 IADDR UNUSED pc = abuf->addr;
4213 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4216 SI tmp_result1;
4217 SI tmp_result0;
4218 tmp_result0 = SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 31));
4219 tmp_result1 = SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 31));
4221 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4222 SET_H_GR (FLD (f_dest), opval);
4223 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4227 return vpc;
4228 #undef FLD
4231 /* mshlrdw: mshlrd.w $rm, $rn, $rd */
4233 static SEM_PC
4234 SEM_FN_NAME (sh64_media,mshlrdw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4236 #define FLD(f) abuf->fields.sfmt_add.f
4237 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4238 int UNUSED written = 0;
4239 IADDR UNUSED pc = abuf->addr;
4240 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4243 HI tmp_result3;
4244 HI tmp_result2;
4245 HI tmp_result1;
4246 HI tmp_result0;
4247 tmp_result0 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), ANDDI (GET_H_GR (FLD (f_right)), 15));
4248 tmp_result1 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), ANDDI (GET_H_GR (FLD (f_right)), 15));
4249 tmp_result2 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 15));
4250 tmp_result3 = SRLHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), ANDDI (GET_H_GR (FLD (f_right)), 15));
4252 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4253 SET_H_GR (FLD (f_dest), opval);
4254 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4258 return vpc;
4259 #undef FLD
4262 /* msubl: msub.l $rm, $rn, $rd */
4264 static SEM_PC
4265 SEM_FN_NAME (sh64_media,msubl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4267 #define FLD(f) abuf->fields.sfmt_add.f
4268 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4269 int UNUSED written = 0;
4270 IADDR UNUSED pc = abuf->addr;
4271 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4274 SI tmp_result1;
4275 SI tmp_result0;
4276 tmp_result0 = SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1));
4277 tmp_result1 = SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0), SUBWORDDISI (GET_H_GR (FLD (f_right)), 0));
4279 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4280 SET_H_GR (FLD (f_dest), opval);
4281 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4285 return vpc;
4286 #undef FLD
4289 /* msubw: msub.w $rm, $rn, $rd */
4291 static SEM_PC
4292 SEM_FN_NAME (sh64_media,msubw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4294 #define FLD(f) abuf->fields.sfmt_add.f
4295 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4296 int UNUSED written = 0;
4297 IADDR UNUSED pc = abuf->addr;
4298 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4301 HI tmp_result3;
4302 HI tmp_result2;
4303 HI tmp_result1;
4304 HI tmp_result0;
4305 tmp_result0 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 3), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 3));
4306 tmp_result1 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 2), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 2));
4307 tmp_result2 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 1), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 1));
4308 tmp_result3 = SUBHI (SUBWORDDIHI (GET_H_GR (FLD (f_left)), 0), SUBWORDDIHI (GET_H_GR (FLD (f_right)), 0));
4310 DI opval = ORDI (SLLDI (ZEXTHIDI (tmp_result3), 48), ORDI (SLLDI (ZEXTHIDI (tmp_result2), 32), ORDI (SLLDI (ZEXTHIDI (tmp_result1), 16), ZEXTHIDI (tmp_result0))));
4311 SET_H_GR (FLD (f_dest), opval);
4312 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4316 return vpc;
4317 #undef FLD
4320 /* msubsl: msubs.l $rm, $rn, $rd */
4322 static SEM_PC
4323 SEM_FN_NAME (sh64_media,msubsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4325 #define FLD(f) abuf->fields.sfmt_add.f
4326 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4327 int UNUSED written = 0;
4328 IADDR UNUSED pc = abuf->addr;
4329 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4332 SI tmp_result1;
4333 SI tmp_result0;
4334 tmp_result0 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4335 tmp_result1 = ((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (32, 1))))) ? (NEGSI (SLLSI (1, SUBSI (32, 1)))) : (((LTDI (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (32, 1)))) ? (SUBDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 0)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 0)))) : (SUBSI (SLLSI (1, SUBSI (32, 1)), 1)))));
4337 DI opval = ORDI (SLLDI (ZEXTSIDI (tmp_result1), 32), ZEXTSIDI (tmp_result0));
4338 SET_H_GR (FLD (f_dest), opval);
4339 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4343 return vpc;
4344 #undef FLD
4347 /* msubsub: msubs.ub $rm, $rn, $rd */
4349 static SEM_PC
4350 SEM_FN_NAME (sh64_media,msubsub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4352 #define FLD(f) abuf->fields.sfmt_add.f
4353 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4354 int UNUSED written = 0;
4355 IADDR UNUSED pc = abuf->addr;
4356 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4359 QI tmp_result7;
4360 QI tmp_result6;
4361 QI tmp_result5;
4362 QI tmp_result4;
4363 QI tmp_result3;
4364 QI tmp_result2;
4365 QI tmp_result1;
4366 QI tmp_result0;
4367 tmp_result0 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBQI (SLLQI (1, 8), 1)))));
4368 tmp_result1 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBQI (SLLQI (1, 8), 1)))));
4369 tmp_result2 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBQI (SLLQI (1, 8), 1)))));
4370 tmp_result3 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBQI (SLLQI (1, 8), 1)))));
4371 tmp_result4 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBQI (SLLQI (1, 8), 1)))));
4372 tmp_result5 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBQI (SLLQI (1, 8), 1)))));
4373 tmp_result6 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBQI (SLLQI (1, 8), 1)))));
4374 tmp_result7 = ((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), MAKEDI (0, 0))) ? (0) : (((LTDI (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, 8))) ? (SUBDI (ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), ZEXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBQI (SLLQI (1, 8), 1)))));
4376 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
4377 SET_H_GR (FLD (f_dest), opval);
4378 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4382 return vpc;
4383 #undef FLD
4386 /* msubsw: msubs.w $rm, $rn, $rd */
4388 static SEM_PC
4389 SEM_FN_NAME (sh64_media,msubsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4391 #define FLD(f) abuf->fields.sfmt_add.f
4392 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4393 int UNUSED written = 0;
4394 IADDR UNUSED pc = abuf->addr;
4395 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4398 QI tmp_result7;
4399 QI tmp_result6;
4400 QI tmp_result5;
4401 QI tmp_result4;
4402 QI tmp_result3;
4403 QI tmp_result2;
4404 QI tmp_result1;
4405 QI tmp_result0;
4406 tmp_result0 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 7)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 7)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4407 tmp_result1 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 6)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 6)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4408 tmp_result2 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 5)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 5)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4409 tmp_result3 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 4)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 4)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4410 tmp_result4 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 3)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 3)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4411 tmp_result5 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 2)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 2)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4412 tmp_result6 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 1)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 1)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4413 tmp_result7 = ((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), NEGDI (SLLDI (1, SUBSI (16, 1))))) ? (NEGHI (SLLHI (1, SUBSI (16, 1)))) : (((LTDI (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0))), SLLDI (1, SUBSI (16, 1)))) ? (SUBDI (EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_left)), 0)), EXTQIDI (SUBWORDDIQI (GET_H_GR (FLD (f_right)), 0)))) : (SUBHI (SLLHI (1, SUBSI (16, 1)), 1)))));
4415 DI opval = ORDI (SLLDI (ZEXTQIDI (tmp_result7), 56), ORDI (SLLDI (ZEXTQIDI (tmp_result6), 48), ORDI (SLLDI (ZEXTQIDI (tmp_result5), 40), ORDI (SLLDI (ZEXTQIDI (tmp_result4), 32), ORDI (SLLDI (ZEXTQIDI (tmp_result3), 24), ORDI (SLLDI (ZEXTQIDI (tmp_result2), 16), ORDI (SLLDI (ZEXTQIDI (tmp_result1), 8), ZEXTQIDI (tmp_result0))))))));
4416 SET_H_GR (FLD (f_dest), opval);
4417 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4421 return vpc;
4422 #undef FLD
4425 /* mulsl: muls.l $rm, $rn, $rd */
4427 static SEM_PC
4428 SEM_FN_NAME (sh64_media,mulsl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4430 #define FLD(f) abuf->fields.sfmt_add.f
4431 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4432 int UNUSED written = 0;
4433 IADDR UNUSED pc = abuf->addr;
4434 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4437 DI opval = MULDI (EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), EXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
4438 SET_H_GR (FLD (f_dest), opval);
4439 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4442 return vpc;
4443 #undef FLD
4446 /* mulul: mulu.l $rm, $rn, $rd */
4448 static SEM_PC
4449 SEM_FN_NAME (sh64_media,mulul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4451 #define FLD(f) abuf->fields.sfmt_add.f
4452 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4453 int UNUSED written = 0;
4454 IADDR UNUSED pc = abuf->addr;
4455 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4458 DI opval = MULDI (ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1)), ZEXTSIDI (SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
4459 SET_H_GR (FLD (f_dest), opval);
4460 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4463 return vpc;
4464 #undef FLD
4467 /* nop: nop */
4469 static SEM_PC
4470 SEM_FN_NAME (sh64_media,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4472 #define FLD(f) abuf->fields.sfmt_empty.f
4473 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4474 int UNUSED written = 0;
4475 IADDR UNUSED pc = abuf->addr;
4476 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4478 ((void) 0); /*nop*/
4480 return vpc;
4481 #undef FLD
4484 /* nsb: nsb $rm, $rd */
4486 static SEM_PC
4487 SEM_FN_NAME (sh64_media,nsb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4489 #define FLD(f) abuf->fields.sfmt_xori.f
4490 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4491 int UNUSED written = 0;
4492 IADDR UNUSED pc = abuf->addr;
4493 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4496 DI opval = sh64_nsb (current_cpu, GET_H_GR (FLD (f_left)));
4497 SET_H_GR (FLD (f_dest), opval);
4498 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4501 return vpc;
4502 #undef FLD
4505 /* ocbi: ocbi $rm, $disp6x32 */
4507 static SEM_PC
4508 SEM_FN_NAME (sh64_media,ocbi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4510 #define FLD(f) abuf->fields.sfmt_xori.f
4511 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4512 int UNUSED written = 0;
4513 IADDR UNUSED pc = abuf->addr;
4514 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4518 DI opval = GET_H_GR (FLD (f_left));
4519 SET_H_GR (FLD (f_left), opval);
4520 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4522 ((void) 0); /*nop*/
4525 return vpc;
4526 #undef FLD
4529 /* ocbp: ocbp $rm, $disp6x32 */
4531 static SEM_PC
4532 SEM_FN_NAME (sh64_media,ocbp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4534 #define FLD(f) abuf->fields.sfmt_xori.f
4535 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4536 int UNUSED written = 0;
4537 IADDR UNUSED pc = abuf->addr;
4538 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4542 DI opval = GET_H_GR (FLD (f_left));
4543 SET_H_GR (FLD (f_left), opval);
4544 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4546 ((void) 0); /*nop*/
4549 return vpc;
4550 #undef FLD
4553 /* ocbwb: ocbwb $rm, $disp6x32 */
4555 static SEM_PC
4556 SEM_FN_NAME (sh64_media,ocbwb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4558 #define FLD(f) abuf->fields.sfmt_xori.f
4559 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4560 int UNUSED written = 0;
4561 IADDR UNUSED pc = abuf->addr;
4562 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4566 DI opval = GET_H_GR (FLD (f_left));
4567 SET_H_GR (FLD (f_left), opval);
4568 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4570 ((void) 0); /*nop*/
4573 return vpc;
4574 #undef FLD
4577 /* or: or $rm, $rn, $rd */
4579 static SEM_PC
4580 SEM_FN_NAME (sh64_media,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4582 #define FLD(f) abuf->fields.sfmt_add.f
4583 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4584 int UNUSED written = 0;
4585 IADDR UNUSED pc = abuf->addr;
4586 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4589 DI opval = ORDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
4590 SET_H_GR (FLD (f_dest), opval);
4591 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4594 return vpc;
4595 #undef FLD
4598 /* ori: ori $rm, $imm10, $rd */
4600 static SEM_PC
4601 SEM_FN_NAME (sh64_media,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4603 #define FLD(f) abuf->fields.sfmt_ori.f
4604 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4605 int UNUSED written = 0;
4606 IADDR UNUSED pc = abuf->addr;
4607 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4610 DI opval = ORDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm10)));
4611 SET_H_GR (FLD (f_dest), opval);
4612 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4615 return vpc;
4616 #undef FLD
4619 /* prefi: prefi $rm, $disp6x32 */
4621 static SEM_PC
4622 SEM_FN_NAME (sh64_media,prefi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4624 #define FLD(f) abuf->fields.sfmt_xori.f
4625 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4626 int UNUSED written = 0;
4627 IADDR UNUSED pc = abuf->addr;
4628 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4632 DI opval = GET_H_GR (FLD (f_left));
4633 SET_H_GR (FLD (f_left), opval);
4634 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4636 ((void) 0); /*nop*/
4639 return vpc;
4640 #undef FLD
4643 /* pta: pta$likely $disp16, $tra */
4645 static SEM_PC
4646 SEM_FN_NAME (sh64_media,pta) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4648 #define FLD(f) abuf->fields.sfmt_pta.f
4649 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4650 int UNUSED written = 0;
4651 IADDR UNUSED pc = abuf->addr;
4652 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4655 ((void) 0); /*nop*/
4657 DI opval = ADDSI (FLD (f_disp16), 1);
4658 CPU (h_tr[FLD (f_tra)]) = opval;
4659 CGEN_TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4663 return vpc;
4664 #undef FLD
4667 /* ptabs: ptabs$likely $rn, $tra */
4669 static SEM_PC
4670 SEM_FN_NAME (sh64_media,ptabs) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4672 #define FLD(f) abuf->fields.sfmt_beq.f
4673 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4674 int UNUSED written = 0;
4675 IADDR UNUSED pc = abuf->addr;
4676 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4679 ((void) 0); /*nop*/
4681 DI opval = GET_H_GR (FLD (f_right));
4682 CPU (h_tr[FLD (f_tra)]) = opval;
4683 CGEN_TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4687 return vpc;
4688 #undef FLD
4691 /* ptb: ptb$likely $disp16, $tra */
4693 static SEM_PC
4694 SEM_FN_NAME (sh64_media,ptb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4696 #define FLD(f) abuf->fields.sfmt_pta.f
4697 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4698 int UNUSED written = 0;
4699 IADDR UNUSED pc = abuf->addr;
4700 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4703 ((void) 0); /*nop*/
4705 DI opval = FLD (f_disp16);
4706 CPU (h_tr[FLD (f_tra)]) = opval;
4707 CGEN_TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4711 return vpc;
4712 #undef FLD
4715 /* ptrel: ptrel$likely $rn, $tra */
4717 static SEM_PC
4718 SEM_FN_NAME (sh64_media,ptrel) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4720 #define FLD(f) abuf->fields.sfmt_beq.f
4721 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4722 int UNUSED written = 0;
4723 IADDR UNUSED pc = abuf->addr;
4724 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4727 ((void) 0); /*nop*/
4729 DI opval = ADDDI (pc, GET_H_GR (FLD (f_right)));
4730 CPU (h_tr[FLD (f_tra)]) = opval;
4731 CGEN_TRACE_RESULT (current_cpu, abuf, "tr", 'D', opval);
4735 return vpc;
4736 #undef FLD
4739 /* putcfg: putcfg $rm, $disp6, $rd */
4741 static SEM_PC
4742 SEM_FN_NAME (sh64_media,putcfg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4744 #define FLD(f) abuf->fields.sfmt_getcfg.f
4745 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4746 int UNUSED written = 0;
4747 IADDR UNUSED pc = abuf->addr;
4748 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4751 SI tmp_address;
4752 tmp_address = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
4753 ((void) 0); /*nop*/
4755 SI opval = GET_H_GR (FLD (f_dest));
4756 SETMEMSI (current_cpu, pc, tmp_address, opval);
4757 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
4761 return vpc;
4762 #undef FLD
4765 /* putcon: putcon $rm, $crj */
4767 static SEM_PC
4768 SEM_FN_NAME (sh64_media,putcon) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4770 #define FLD(f) abuf->fields.sfmt_xori.f
4771 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4772 int UNUSED written = 0;
4773 IADDR UNUSED pc = abuf->addr;
4774 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4777 DI opval = GET_H_GR (FLD (f_left));
4778 SET_H_CR (FLD (f_dest), opval);
4779 CGEN_TRACE_RESULT (current_cpu, abuf, "cr", 'D', opval);
4782 return vpc;
4783 #undef FLD
4786 /* rte: rte */
4788 static SEM_PC
4789 SEM_FN_NAME (sh64_media,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4791 #define FLD(f) abuf->fields.sfmt_empty.f
4792 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4793 int UNUSED written = 0;
4794 IADDR UNUSED pc = abuf->addr;
4795 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4797 ((void) 0); /*nop*/
4799 return vpc;
4800 #undef FLD
4803 /* shard: shard $rm, $rn, $rd */
4805 static SEM_PC
4806 SEM_FN_NAME (sh64_media,shard) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4808 #define FLD(f) abuf->fields.sfmt_add.f
4809 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4810 int UNUSED written = 0;
4811 IADDR UNUSED pc = abuf->addr;
4812 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4815 DI opval = SRADI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63));
4816 SET_H_GR (FLD (f_dest), opval);
4817 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4820 return vpc;
4821 #undef FLD
4824 /* shardl: shard.l $rm, $rn, $rd */
4826 static SEM_PC
4827 SEM_FN_NAME (sh64_media,shardl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4829 #define FLD(f) abuf->fields.sfmt_add.f
4830 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4831 int UNUSED written = 0;
4832 IADDR UNUSED pc = abuf->addr;
4833 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4836 DI opval = EXTSIDI (SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63)));
4837 SET_H_GR (FLD (f_dest), opval);
4838 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4841 return vpc;
4842 #undef FLD
4845 /* shari: shari $rm, $uimm6, $rd */
4847 static SEM_PC
4848 SEM_FN_NAME (sh64_media,shari) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4850 #define FLD(f) abuf->fields.sfmt_shari.f
4851 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4852 int UNUSED written = 0;
4853 IADDR UNUSED pc = abuf->addr;
4854 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4857 DI opval = SRADI (GET_H_GR (FLD (f_left)), FLD (f_uimm6));
4858 SET_H_GR (FLD (f_dest), opval);
4859 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4862 return vpc;
4863 #undef FLD
4866 /* sharil: shari.l $rm, $uimm6, $rd */
4868 static SEM_PC
4869 SEM_FN_NAME (sh64_media,sharil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4871 #define FLD(f) abuf->fields.sfmt_shari.f
4872 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4873 int UNUSED written = 0;
4874 IADDR UNUSED pc = abuf->addr;
4875 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4878 DI opval = EXTSIDI (SRASI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
4879 SET_H_GR (FLD (f_dest), opval);
4880 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4883 return vpc;
4884 #undef FLD
4887 /* shlld: shlld $rm, $rn, $rd */
4889 static SEM_PC
4890 SEM_FN_NAME (sh64_media,shlld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4892 #define FLD(f) abuf->fields.sfmt_add.f
4893 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4894 int UNUSED written = 0;
4895 IADDR UNUSED pc = abuf->addr;
4896 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4899 DI opval = SLLDI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63));
4900 SET_H_GR (FLD (f_dest), opval);
4901 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4904 return vpc;
4905 #undef FLD
4908 /* shlldl: shlld.l $rm, $rn, $rd */
4910 static SEM_PC
4911 SEM_FN_NAME (sh64_media,shlldl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4913 #define FLD(f) abuf->fields.sfmt_add.f
4914 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4915 int UNUSED written = 0;
4916 IADDR UNUSED pc = abuf->addr;
4917 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4920 DI opval = EXTSIDI (SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63)));
4921 SET_H_GR (FLD (f_dest), opval);
4922 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4925 return vpc;
4926 #undef FLD
4929 /* shlli: shlli $rm, $uimm6, $rd */
4931 static SEM_PC
4932 SEM_FN_NAME (sh64_media,shlli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4934 #define FLD(f) abuf->fields.sfmt_shari.f
4935 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4936 int UNUSED written = 0;
4937 IADDR UNUSED pc = abuf->addr;
4938 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4941 DI opval = SLLDI (GET_H_GR (FLD (f_left)), FLD (f_uimm6));
4942 SET_H_GR (FLD (f_dest), opval);
4943 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4946 return vpc;
4947 #undef FLD
4950 /* shllil: shlli.l $rm, $uimm6, $rd */
4952 static SEM_PC
4953 SEM_FN_NAME (sh64_media,shllil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4955 #define FLD(f) abuf->fields.sfmt_shari.f
4956 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4957 int UNUSED written = 0;
4958 IADDR UNUSED pc = abuf->addr;
4959 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4962 DI opval = EXTSIDI (SLLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
4963 SET_H_GR (FLD (f_dest), opval);
4964 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4967 return vpc;
4968 #undef FLD
4971 /* shlrd: shlrd $rm, $rn, $rd */
4973 static SEM_PC
4974 SEM_FN_NAME (sh64_media,shlrd) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4976 #define FLD(f) abuf->fields.sfmt_add.f
4977 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4978 int UNUSED written = 0;
4979 IADDR UNUSED pc = abuf->addr;
4980 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
4983 DI opval = SRLDI (GET_H_GR (FLD (f_left)), ANDDI (GET_H_GR (FLD (f_right)), 63));
4984 SET_H_GR (FLD (f_dest), opval);
4985 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
4988 return vpc;
4989 #undef FLD
4992 /* shlrdl: shlrd.l $rm, $rn, $rd */
4994 static SEM_PC
4995 SEM_FN_NAME (sh64_media,shlrdl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
4997 #define FLD(f) abuf->fields.sfmt_add.f
4998 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
4999 int UNUSED written = 0;
5000 IADDR UNUSED pc = abuf->addr;
5001 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5004 DI opval = EXTSIDI (SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDDI (GET_H_GR (FLD (f_right)), 63)));
5005 SET_H_GR (FLD (f_dest), opval);
5006 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5009 return vpc;
5010 #undef FLD
5013 /* shlri: shlri $rm, $uimm6, $rd */
5015 static SEM_PC
5016 SEM_FN_NAME (sh64_media,shlri) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5018 #define FLD(f) abuf->fields.sfmt_shari.f
5019 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5020 int UNUSED written = 0;
5021 IADDR UNUSED pc = abuf->addr;
5022 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5025 DI opval = SRLDI (GET_H_GR (FLD (f_left)), FLD (f_uimm6));
5026 SET_H_GR (FLD (f_dest), opval);
5027 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5030 return vpc;
5031 #undef FLD
5034 /* shlril: shlri.l $rm, $uimm6, $rd */
5036 static SEM_PC
5037 SEM_FN_NAME (sh64_media,shlril) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5039 #define FLD(f) abuf->fields.sfmt_shari.f
5040 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5041 int UNUSED written = 0;
5042 IADDR UNUSED pc = abuf->addr;
5043 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5046 DI opval = EXTSIDI (SRLSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), ANDSI (FLD (f_uimm6), 63)));
5047 SET_H_GR (FLD (f_dest), opval);
5048 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5051 return vpc;
5052 #undef FLD
5055 /* shori: shori $uimm16, $rd */
5057 static SEM_PC
5058 SEM_FN_NAME (sh64_media,shori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5060 #define FLD(f) abuf->fields.sfmt_shori.f
5061 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5062 int UNUSED written = 0;
5063 IADDR UNUSED pc = abuf->addr;
5064 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5067 DI opval = ORDI (SLLDI (GET_H_GR (FLD (f_dest)), 16), ZEXTSIDI (FLD (f_uimm16)));
5068 SET_H_GR (FLD (f_dest), opval);
5069 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5072 return vpc;
5073 #undef FLD
5076 /* sleep: sleep */
5078 static SEM_PC
5079 SEM_FN_NAME (sh64_media,sleep) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5081 #define FLD(f) abuf->fields.sfmt_empty.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, 4);
5087 ((void) 0); /*nop*/
5089 return vpc;
5090 #undef FLD
5093 /* stb: st.b $rm, $disp10, $rd */
5095 static SEM_PC
5096 SEM_FN_NAME (sh64_media,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5098 #define FLD(f) abuf->fields.sfmt_addi.f
5099 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5100 int UNUSED written = 0;
5101 IADDR UNUSED pc = abuf->addr;
5102 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5105 UQI opval = ANDQI (GET_H_GR (FLD (f_dest)), 255);
5106 SETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10))), opval);
5107 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5110 return vpc;
5111 #undef FLD
5114 /* stl: st.l $rm, $disp10x4, $rd */
5116 static SEM_PC
5117 SEM_FN_NAME (sh64_media,stl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5119 #define FLD(f) abuf->fields.sfmt_flds.f
5120 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5121 int UNUSED written = 0;
5122 IADDR UNUSED pc = abuf->addr;
5123 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5126 SI opval = ANDSI (GET_H_GR (FLD (f_dest)), 0xffffffff);
5127 SETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x4))), opval);
5128 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5131 return vpc;
5132 #undef FLD
5135 /* stq: st.q $rm, $disp10x8, $rd */
5137 static SEM_PC
5138 SEM_FN_NAME (sh64_media,stq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5140 #define FLD(f) abuf->fields.sfmt_fldd.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, 4);
5147 DI opval = GET_H_GR (FLD (f_dest));
5148 SETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x8))), opval);
5149 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5152 return vpc;
5153 #undef FLD
5156 /* stw: st.w $rm, $disp10x2, $rd */
5158 static SEM_PC
5159 SEM_FN_NAME (sh64_media,stw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5161 #define FLD(f) abuf->fields.sfmt_lduw.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, 4);
5168 HI opval = ANDHI (GET_H_GR (FLD (f_dest)), 65535);
5169 SETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_disp10x2))), opval);
5170 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5173 return vpc;
5174 #undef FLD
5177 /* sthil: sthi.l $rm, $disp6, $rd */
5179 static SEM_PC
5180 SEM_FN_NAME (sh64_media,sthil) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5182 #define FLD(f) abuf->fields.sfmt_getcfg.f
5183 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5184 int UNUSED written = 0;
5185 IADDR UNUSED pc = abuf->addr;
5186 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5189 DI tmp_addr;
5190 QI tmp_bytecount;
5191 DI tmp_val;
5192 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5193 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 3), 1);
5194 if (ANDQI (tmp_bytecount, 4)) {
5196 SI opval = GET_H_GR (FLD (f_dest));
5197 SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5198 written |= (1 << 5);
5199 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5201 } else {
5202 if (GET_H_ENDIAN ()) {
5204 tmp_val = GET_H_GR (FLD (f_dest));
5205 if (ANDQI (tmp_bytecount, 1)) {
5208 UQI opval = ANDQI (tmp_val, 255);
5209 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5210 written |= (1 << 6);
5211 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5213 tmp_val = SRLDI (tmp_val, 8);
5216 if (ANDQI (tmp_bytecount, 2)) {
5219 HI opval = ANDHI (tmp_val, 65535);
5220 SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5221 written |= (1 << 4);
5222 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5224 tmp_val = SRLDI (tmp_val, 16);
5228 } else {
5230 tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount)));
5231 if (ANDQI (tmp_bytecount, 2)) {
5234 HI opval = ANDHI (tmp_val, 65535);
5235 SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5236 written |= (1 << 4);
5237 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5239 tmp_val = SRLDI (tmp_val, 16);
5242 if (ANDQI (tmp_bytecount, 1)) {
5245 UQI opval = ANDQI (tmp_val, 255);
5246 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5247 written |= (1 << 6);
5248 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5250 tmp_val = SRLDI (tmp_val, 8);
5258 abuf->written = written;
5259 return vpc;
5260 #undef FLD
5263 /* sthiq: sthi.q $rm, $disp6, $rd */
5265 static SEM_PC
5266 SEM_FN_NAME (sh64_media,sthiq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5268 #define FLD(f) abuf->fields.sfmt_getcfg.f
5269 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5270 int UNUSED written = 0;
5271 IADDR UNUSED pc = abuf->addr;
5272 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5275 DI tmp_addr;
5276 QI tmp_bytecount;
5277 DI tmp_val;
5278 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5279 tmp_bytecount = ADDDI (ANDDI (tmp_addr, 7), 1);
5280 if (ANDQI (tmp_bytecount, 8)) {
5282 DI opval = GET_H_GR (FLD (f_dest));
5283 SETMEMDI (current_cpu, pc, ANDDI (tmp_addr, -8), opval);
5284 written |= (1 << 4);
5285 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5287 } else {
5288 if (GET_H_ENDIAN ()) {
5290 tmp_val = GET_H_GR (FLD (f_dest));
5291 if (ANDQI (tmp_bytecount, 1)) {
5294 UQI opval = ANDQI (tmp_val, 255);
5295 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5296 written |= (1 << 7);
5297 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5299 tmp_val = SRLDI (tmp_val, 8);
5302 if (ANDQI (tmp_bytecount, 2)) {
5305 HI opval = ANDHI (tmp_val, 65535);
5306 SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5307 written |= (1 << 5);
5308 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5310 tmp_val = SRLDI (tmp_val, 16);
5313 if (ANDQI (tmp_bytecount, 4)) {
5316 SI opval = ANDSI (tmp_val, 0xffffffff);
5317 SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8), opval);
5318 written |= (1 << 6);
5319 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5321 tmp_val = SRLDI (tmp_val, 32);
5325 } else {
5327 tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount)));
5328 if (ANDQI (tmp_bytecount, 4)) {
5331 SI opval = ANDSI (tmp_val, 0xffffffff);
5332 SETMEMSI (current_cpu, pc, ANDDI (tmp_addr, -8), opval);
5333 written |= (1 << 6);
5334 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5336 tmp_val = SRLDI (tmp_val, 32);
5339 if (ANDQI (tmp_bytecount, 2)) {
5342 HI opval = ANDHI (tmp_val, 65535);
5343 SETMEMHI (current_cpu, pc, ANDDI (tmp_addr, -4), opval);
5344 written |= (1 << 5);
5345 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5347 tmp_val = SRLDI (tmp_val, 16);
5350 if (ANDQI (tmp_bytecount, 1)) {
5353 UQI opval = ANDQI (tmp_val, 255);
5354 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5355 written |= (1 << 7);
5356 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5358 tmp_val = SRLDI (tmp_val, 8);
5366 abuf->written = written;
5367 return vpc;
5368 #undef FLD
5371 /* stlol: stlo.l $rm, $disp6, $rd */
5373 static SEM_PC
5374 SEM_FN_NAME (sh64_media,stlol) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5376 #define FLD(f) abuf->fields.sfmt_getcfg.f
5377 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5378 int UNUSED written = 0;
5379 IADDR UNUSED pc = abuf->addr;
5380 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5383 DI tmp_addr;
5384 QI tmp_bytecount;
5385 DI tmp_val;
5386 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5387 tmp_bytecount = SUBSI (4, ANDDI (tmp_addr, 3));
5388 if (ANDQI (tmp_bytecount, 4)) {
5390 USI opval = GET_H_GR (FLD (f_dest));
5391 SETMEMUSI (current_cpu, pc, tmp_addr, opval);
5392 written |= (1 << 6);
5393 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5395 } else {
5396 if (GET_H_ENDIAN ()) {
5398 tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (32, MULSI (8, tmp_bytecount)));
5399 if (ANDQI (tmp_bytecount, 2)) {
5402 UHI opval = ANDHI (tmp_val, 65535);
5403 SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5404 written |= (1 << 4);
5405 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5407 tmp_val = SRLDI (tmp_val, 16);
5410 if (ANDQI (tmp_bytecount, 1)) {
5413 UQI opval = ANDQI (tmp_val, 255);
5414 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5415 written |= (1 << 5);
5416 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5418 tmp_val = SRLDI (tmp_val, 8);
5422 } else {
5424 tmp_val = GET_H_GR (FLD (f_dest));
5425 if (ANDQI (tmp_bytecount, 1)) {
5428 UQI opval = ANDQI (tmp_val, 255);
5429 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5430 written |= (1 << 5);
5431 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5433 tmp_val = SRLDI (tmp_val, 8);
5436 if (ANDQI (tmp_bytecount, 2)) {
5439 UHI opval = ANDHI (tmp_val, 65535);
5440 SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5441 written |= (1 << 4);
5442 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5444 tmp_val = SRLDI (tmp_val, 16);
5452 abuf->written = written;
5453 return vpc;
5454 #undef FLD
5457 /* stloq: stlo.q $rm, $disp6, $rd */
5459 static SEM_PC
5460 SEM_FN_NAME (sh64_media,stloq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5462 #define FLD(f) abuf->fields.sfmt_getcfg.f
5463 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5464 int UNUSED written = 0;
5465 IADDR UNUSED pc = abuf->addr;
5466 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5469 DI tmp_addr;
5470 QI tmp_bytecount;
5471 DI tmp_val;
5472 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), FLD (f_disp6));
5473 tmp_bytecount = SUBSI (8, ANDDI (tmp_addr, 7));
5474 if (ANDQI (tmp_bytecount, 8)) {
5476 UDI opval = GET_H_GR (FLD (f_dest));
5477 SETMEMUDI (current_cpu, pc, tmp_addr, opval);
5478 written |= (1 << 4);
5479 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5481 } else {
5482 if (GET_H_ENDIAN ()) {
5484 tmp_val = SRLDI (GET_H_GR (FLD (f_dest)), SUBSI (64, MULSI (8, tmp_bytecount)));
5485 if (ANDQI (tmp_bytecount, 4)) {
5488 USI opval = ANDSI (tmp_val, 0xffffffff);
5489 SETMEMUSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval);
5490 written |= (1 << 7);
5491 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5493 tmp_val = SRLDI (tmp_val, 32);
5496 if (ANDQI (tmp_bytecount, 2)) {
5499 UHI opval = ANDHI (tmp_val, 65535);
5500 SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5501 written |= (1 << 5);
5502 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5504 tmp_val = SRLDI (tmp_val, 16);
5507 if (ANDQI (tmp_bytecount, 1)) {
5510 UQI opval = ANDQI (tmp_val, 255);
5511 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5512 written |= (1 << 6);
5513 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5515 tmp_val = SRLDI (tmp_val, 8);
5519 } else {
5521 tmp_val = GET_H_GR (FLD (f_dest));
5522 if (ANDQI (tmp_bytecount, 1)) {
5525 UQI opval = ANDQI (tmp_val, 255);
5526 SETMEMUQI (current_cpu, pc, tmp_addr, opval);
5527 written |= (1 << 6);
5528 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5530 tmp_val = SRLDI (tmp_val, 8);
5533 if (ANDQI (tmp_bytecount, 2)) {
5536 UHI opval = ANDHI (tmp_val, 65535);
5537 SETMEMUHI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 1), -2), opval);
5538 written |= (1 << 5);
5539 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5541 tmp_val = SRLDI (tmp_val, 16);
5544 if (ANDQI (tmp_bytecount, 4)) {
5547 USI opval = ANDSI (tmp_val, 0xffffffff);
5548 SETMEMUSI (current_cpu, pc, ANDDI (ADDDI (tmp_addr, 3), -4), opval);
5549 written |= (1 << 7);
5550 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5552 tmp_val = SRLDI (tmp_val, 32);
5560 abuf->written = written;
5561 return vpc;
5562 #undef FLD
5565 /* stxb: stx.b $rm, $rn, $rd */
5567 static SEM_PC
5568 SEM_FN_NAME (sh64_media,stxb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5570 #define FLD(f) abuf->fields.sfmt_add.f
5571 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5572 int UNUSED written = 0;
5573 IADDR UNUSED pc = abuf->addr;
5574 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5577 UQI opval = SUBWORDDIQI (GET_H_GR (FLD (f_dest)), 7);
5578 SETMEMUQI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5579 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5582 return vpc;
5583 #undef FLD
5586 /* stxl: stx.l $rm, $rn, $rd */
5588 static SEM_PC
5589 SEM_FN_NAME (sh64_media,stxl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5591 #define FLD(f) abuf->fields.sfmt_add.f
5592 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5593 int UNUSED written = 0;
5594 IADDR UNUSED pc = abuf->addr;
5595 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5598 SI opval = SUBWORDDISI (GET_H_GR (FLD (f_dest)), 1);
5599 SETMEMSI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5600 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5603 return vpc;
5604 #undef FLD
5607 /* stxq: stx.q $rm, $rn, $rd */
5609 static SEM_PC
5610 SEM_FN_NAME (sh64_media,stxq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5612 #define FLD(f) abuf->fields.sfmt_add.f
5613 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5614 int UNUSED written = 0;
5615 IADDR UNUSED pc = abuf->addr;
5616 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5619 DI opval = GET_H_GR (FLD (f_dest));
5620 SETMEMDI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5621 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5624 return vpc;
5625 #undef FLD
5628 /* stxw: stx.w $rm, $rn, $rd */
5630 static SEM_PC
5631 SEM_FN_NAME (sh64_media,stxw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5633 #define FLD(f) abuf->fields.sfmt_add.f
5634 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5635 int UNUSED written = 0;
5636 IADDR UNUSED pc = abuf->addr;
5637 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5640 HI opval = SUBWORDDIHI (GET_H_GR (FLD (f_dest)), 3);
5641 SETMEMHI (current_cpu, pc, ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right))), opval);
5642 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
5645 return vpc;
5646 #undef FLD
5649 /* sub: sub $rm, $rn, $rd */
5651 static SEM_PC
5652 SEM_FN_NAME (sh64_media,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5654 #define FLD(f) abuf->fields.sfmt_add.f
5655 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5656 int UNUSED written = 0;
5657 IADDR UNUSED pc = abuf->addr;
5658 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5661 DI opval = SUBDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
5662 SET_H_GR (FLD (f_dest), opval);
5663 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5666 return vpc;
5667 #undef FLD
5670 /* subl: sub.l $rm, $rn, $rd */
5672 static SEM_PC
5673 SEM_FN_NAME (sh64_media,subl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5675 #define FLD(f) abuf->fields.sfmt_add.f
5676 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5677 int UNUSED written = 0;
5678 IADDR UNUSED pc = abuf->addr;
5679 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5682 DI opval = EXTSIDI (SUBSI (SUBWORDDISI (GET_H_GR (FLD (f_left)), 1), SUBWORDDISI (GET_H_GR (FLD (f_right)), 1)));
5683 SET_H_GR (FLD (f_dest), opval);
5684 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5687 return vpc;
5688 #undef FLD
5691 /* swapq: swap.q $rm, $rn, $rd */
5693 static SEM_PC
5694 SEM_FN_NAME (sh64_media,swapq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5696 #define FLD(f) abuf->fields.sfmt_add.f
5697 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5698 int UNUSED written = 0;
5699 IADDR UNUSED pc = abuf->addr;
5700 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5703 DI tmp_addr;
5704 DI tmp_temp;
5705 tmp_addr = ADDDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
5706 tmp_temp = GETMEMDI (current_cpu, pc, tmp_addr);
5708 DI opval = GET_H_GR (FLD (f_dest));
5709 SETMEMDI (current_cpu, pc, tmp_addr, opval);
5710 CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'D', opval);
5713 DI opval = tmp_temp;
5714 SET_H_GR (FLD (f_dest), opval);
5715 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5719 return vpc;
5720 #undef FLD
5723 /* synci: synci */
5725 static SEM_PC
5726 SEM_FN_NAME (sh64_media,synci) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5728 #define FLD(f) abuf->fields.sfmt_empty.f
5729 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5730 int UNUSED written = 0;
5731 IADDR UNUSED pc = abuf->addr;
5732 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5734 ((void) 0); /*nop*/
5736 return vpc;
5737 #undef FLD
5740 /* synco: synco */
5742 static SEM_PC
5743 SEM_FN_NAME (sh64_media,synco) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5745 #define FLD(f) abuf->fields.sfmt_empty.f
5746 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5747 int UNUSED written = 0;
5748 IADDR UNUSED pc = abuf->addr;
5749 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5751 ((void) 0); /*nop*/
5753 return vpc;
5754 #undef FLD
5757 /* trapa: trapa $rm */
5759 static SEM_PC
5760 SEM_FN_NAME (sh64_media,trapa) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5762 #define FLD(f) abuf->fields.sfmt_xori.f
5763 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5764 int UNUSED written = 0;
5765 IADDR UNUSED pc = abuf->addr;
5766 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5768 sh64_trapa (current_cpu, GET_H_GR (FLD (f_left)), pc);
5770 return vpc;
5771 #undef FLD
5774 /* xor: xor $rm, $rn, $rd */
5776 static SEM_PC
5777 SEM_FN_NAME (sh64_media,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5779 #define FLD(f) abuf->fields.sfmt_add.f
5780 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5781 int UNUSED written = 0;
5782 IADDR UNUSED pc = abuf->addr;
5783 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5786 DI opval = XORDI (GET_H_GR (FLD (f_left)), GET_H_GR (FLD (f_right)));
5787 SET_H_GR (FLD (f_dest), opval);
5788 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5791 return vpc;
5792 #undef FLD
5795 /* xori: xori $rm, $imm6, $rd */
5797 static SEM_PC
5798 SEM_FN_NAME (sh64_media,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
5800 #define FLD(f) abuf->fields.sfmt_xori.f
5801 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
5802 int UNUSED written = 0;
5803 IADDR UNUSED pc = abuf->addr;
5804 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
5807 DI opval = XORDI (GET_H_GR (FLD (f_left)), EXTSIDI (FLD (f_imm6)));
5808 SET_H_GR (FLD (f_dest), opval);
5809 CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'D', opval);
5812 return vpc;
5813 #undef FLD
5816 /* Table of all semantic fns. */
5818 static const struct sem_fn_desc sem_fns[] = {
5819 { SH64_MEDIA_INSN_X_INVALID, SEM_FN_NAME (sh64_media,x_invalid) },
5820 { SH64_MEDIA_INSN_X_AFTER, SEM_FN_NAME (sh64_media,x_after) },
5821 { SH64_MEDIA_INSN_X_BEFORE, SEM_FN_NAME (sh64_media,x_before) },
5822 { SH64_MEDIA_INSN_X_CTI_CHAIN, SEM_FN_NAME (sh64_media,x_cti_chain) },
5823 { SH64_MEDIA_INSN_X_CHAIN, SEM_FN_NAME (sh64_media,x_chain) },
5824 { SH64_MEDIA_INSN_X_BEGIN, SEM_FN_NAME (sh64_media,x_begin) },
5825 { SH64_MEDIA_INSN_ADD, SEM_FN_NAME (sh64_media,add) },
5826 { SH64_MEDIA_INSN_ADDL, SEM_FN_NAME (sh64_media,addl) },
5827 { SH64_MEDIA_INSN_ADDI, SEM_FN_NAME (sh64_media,addi) },
5828 { SH64_MEDIA_INSN_ADDIL, SEM_FN_NAME (sh64_media,addil) },
5829 { SH64_MEDIA_INSN_ADDZL, SEM_FN_NAME (sh64_media,addzl) },
5830 { SH64_MEDIA_INSN_ALLOCO, SEM_FN_NAME (sh64_media,alloco) },
5831 { SH64_MEDIA_INSN_AND, SEM_FN_NAME (sh64_media,and) },
5832 { SH64_MEDIA_INSN_ANDC, SEM_FN_NAME (sh64_media,andc) },
5833 { SH64_MEDIA_INSN_ANDI, SEM_FN_NAME (sh64_media,andi) },
5834 { SH64_MEDIA_INSN_BEQ, SEM_FN_NAME (sh64_media,beq) },
5835 { SH64_MEDIA_INSN_BEQI, SEM_FN_NAME (sh64_media,beqi) },
5836 { SH64_MEDIA_INSN_BGE, SEM_FN_NAME (sh64_media,bge) },
5837 { SH64_MEDIA_INSN_BGEU, SEM_FN_NAME (sh64_media,bgeu) },
5838 { SH64_MEDIA_INSN_BGT, SEM_FN_NAME (sh64_media,bgt) },
5839 { SH64_MEDIA_INSN_BGTU, SEM_FN_NAME (sh64_media,bgtu) },
5840 { SH64_MEDIA_INSN_BLINK, SEM_FN_NAME (sh64_media,blink) },
5841 { SH64_MEDIA_INSN_BNE, SEM_FN_NAME (sh64_media,bne) },
5842 { SH64_MEDIA_INSN_BNEI, SEM_FN_NAME (sh64_media,bnei) },
5843 { SH64_MEDIA_INSN_BRK, SEM_FN_NAME (sh64_media,brk) },
5844 { SH64_MEDIA_INSN_BYTEREV, SEM_FN_NAME (sh64_media,byterev) },
5845 { SH64_MEDIA_INSN_CMPEQ, SEM_FN_NAME (sh64_media,cmpeq) },
5846 { SH64_MEDIA_INSN_CMPGT, SEM_FN_NAME (sh64_media,cmpgt) },
5847 { SH64_MEDIA_INSN_CMPGTU, SEM_FN_NAME (sh64_media,cmpgtu) },
5848 { SH64_MEDIA_INSN_CMVEQ, SEM_FN_NAME (sh64_media,cmveq) },
5849 { SH64_MEDIA_INSN_CMVNE, SEM_FN_NAME (sh64_media,cmvne) },
5850 { SH64_MEDIA_INSN_FABSD, SEM_FN_NAME (sh64_media,fabsd) },
5851 { SH64_MEDIA_INSN_FABSS, SEM_FN_NAME (sh64_media,fabss) },
5852 { SH64_MEDIA_INSN_FADDD, SEM_FN_NAME (sh64_media,faddd) },
5853 { SH64_MEDIA_INSN_FADDS, SEM_FN_NAME (sh64_media,fadds) },
5854 { SH64_MEDIA_INSN_FCMPEQD, SEM_FN_NAME (sh64_media,fcmpeqd) },
5855 { SH64_MEDIA_INSN_FCMPEQS, SEM_FN_NAME (sh64_media,fcmpeqs) },
5856 { SH64_MEDIA_INSN_FCMPGED, SEM_FN_NAME (sh64_media,fcmpged) },
5857 { SH64_MEDIA_INSN_FCMPGES, SEM_FN_NAME (sh64_media,fcmpges) },
5858 { SH64_MEDIA_INSN_FCMPGTD, SEM_FN_NAME (sh64_media,fcmpgtd) },
5859 { SH64_MEDIA_INSN_FCMPGTS, SEM_FN_NAME (sh64_media,fcmpgts) },
5860 { SH64_MEDIA_INSN_FCMPUND, SEM_FN_NAME (sh64_media,fcmpund) },
5861 { SH64_MEDIA_INSN_FCMPUNS, SEM_FN_NAME (sh64_media,fcmpuns) },
5862 { SH64_MEDIA_INSN_FCNVDS, SEM_FN_NAME (sh64_media,fcnvds) },
5863 { SH64_MEDIA_INSN_FCNVSD, SEM_FN_NAME (sh64_media,fcnvsd) },
5864 { SH64_MEDIA_INSN_FDIVD, SEM_FN_NAME (sh64_media,fdivd) },
5865 { SH64_MEDIA_INSN_FDIVS, SEM_FN_NAME (sh64_media,fdivs) },
5866 { SH64_MEDIA_INSN_FGETSCR, SEM_FN_NAME (sh64_media,fgetscr) },
5867 { SH64_MEDIA_INSN_FIPRS, SEM_FN_NAME (sh64_media,fiprs) },
5868 { SH64_MEDIA_INSN_FLDD, SEM_FN_NAME (sh64_media,fldd) },
5869 { SH64_MEDIA_INSN_FLDP, SEM_FN_NAME (sh64_media,fldp) },
5870 { SH64_MEDIA_INSN_FLDS, SEM_FN_NAME (sh64_media,flds) },
5871 { SH64_MEDIA_INSN_FLDXD, SEM_FN_NAME (sh64_media,fldxd) },
5872 { SH64_MEDIA_INSN_FLDXP, SEM_FN_NAME (sh64_media,fldxp) },
5873 { SH64_MEDIA_INSN_FLDXS, SEM_FN_NAME (sh64_media,fldxs) },
5874 { SH64_MEDIA_INSN_FLOATLD, SEM_FN_NAME (sh64_media,floatld) },
5875 { SH64_MEDIA_INSN_FLOATLS, SEM_FN_NAME (sh64_media,floatls) },
5876 { SH64_MEDIA_INSN_FLOATQD, SEM_FN_NAME (sh64_media,floatqd) },
5877 { SH64_MEDIA_INSN_FLOATQS, SEM_FN_NAME (sh64_media,floatqs) },
5878 { SH64_MEDIA_INSN_FMACS, SEM_FN_NAME (sh64_media,fmacs) },
5879 { SH64_MEDIA_INSN_FMOVD, SEM_FN_NAME (sh64_media,fmovd) },
5880 { SH64_MEDIA_INSN_FMOVDQ, SEM_FN_NAME (sh64_media,fmovdq) },
5881 { SH64_MEDIA_INSN_FMOVLS, SEM_FN_NAME (sh64_media,fmovls) },
5882 { SH64_MEDIA_INSN_FMOVQD, SEM_FN_NAME (sh64_media,fmovqd) },
5883 { SH64_MEDIA_INSN_FMOVS, SEM_FN_NAME (sh64_media,fmovs) },
5884 { SH64_MEDIA_INSN_FMOVSL, SEM_FN_NAME (sh64_media,fmovsl) },
5885 { SH64_MEDIA_INSN_FMULD, SEM_FN_NAME (sh64_media,fmuld) },
5886 { SH64_MEDIA_INSN_FMULS, SEM_FN_NAME (sh64_media,fmuls) },
5887 { SH64_MEDIA_INSN_FNEGD, SEM_FN_NAME (sh64_media,fnegd) },
5888 { SH64_MEDIA_INSN_FNEGS, SEM_FN_NAME (sh64_media,fnegs) },
5889 { SH64_MEDIA_INSN_FPUTSCR, SEM_FN_NAME (sh64_media,fputscr) },
5890 { SH64_MEDIA_INSN_FSQRTD, SEM_FN_NAME (sh64_media,fsqrtd) },
5891 { SH64_MEDIA_INSN_FSQRTS, SEM_FN_NAME (sh64_media,fsqrts) },
5892 { SH64_MEDIA_INSN_FSTD, SEM_FN_NAME (sh64_media,fstd) },
5893 { SH64_MEDIA_INSN_FSTP, SEM_FN_NAME (sh64_media,fstp) },
5894 { SH64_MEDIA_INSN_FSTS, SEM_FN_NAME (sh64_media,fsts) },
5895 { SH64_MEDIA_INSN_FSTXD, SEM_FN_NAME (sh64_media,fstxd) },
5896 { SH64_MEDIA_INSN_FSTXP, SEM_FN_NAME (sh64_media,fstxp) },
5897 { SH64_MEDIA_INSN_FSTXS, SEM_FN_NAME (sh64_media,fstxs) },
5898 { SH64_MEDIA_INSN_FSUBD, SEM_FN_NAME (sh64_media,fsubd) },
5899 { SH64_MEDIA_INSN_FSUBS, SEM_FN_NAME (sh64_media,fsubs) },
5900 { SH64_MEDIA_INSN_FTRCDL, SEM_FN_NAME (sh64_media,ftrcdl) },
5901 { SH64_MEDIA_INSN_FTRCSL, SEM_FN_NAME (sh64_media,ftrcsl) },
5902 { SH64_MEDIA_INSN_FTRCDQ, SEM_FN_NAME (sh64_media,ftrcdq) },
5903 { SH64_MEDIA_INSN_FTRCSQ, SEM_FN_NAME (sh64_media,ftrcsq) },
5904 { SH64_MEDIA_INSN_FTRVS, SEM_FN_NAME (sh64_media,ftrvs) },
5905 { SH64_MEDIA_INSN_GETCFG, SEM_FN_NAME (sh64_media,getcfg) },
5906 { SH64_MEDIA_INSN_GETCON, SEM_FN_NAME (sh64_media,getcon) },
5907 { SH64_MEDIA_INSN_GETTR, SEM_FN_NAME (sh64_media,gettr) },
5908 { SH64_MEDIA_INSN_ICBI, SEM_FN_NAME (sh64_media,icbi) },
5909 { SH64_MEDIA_INSN_LDB, SEM_FN_NAME (sh64_media,ldb) },
5910 { SH64_MEDIA_INSN_LDL, SEM_FN_NAME (sh64_media,ldl) },
5911 { SH64_MEDIA_INSN_LDQ, SEM_FN_NAME (sh64_media,ldq) },
5912 { SH64_MEDIA_INSN_LDUB, SEM_FN_NAME (sh64_media,ldub) },
5913 { SH64_MEDIA_INSN_LDUW, SEM_FN_NAME (sh64_media,lduw) },
5914 { SH64_MEDIA_INSN_LDW, SEM_FN_NAME (sh64_media,ldw) },
5915 { SH64_MEDIA_INSN_LDHIL, SEM_FN_NAME (sh64_media,ldhil) },
5916 { SH64_MEDIA_INSN_LDHIQ, SEM_FN_NAME (sh64_media,ldhiq) },
5917 { SH64_MEDIA_INSN_LDLOL, SEM_FN_NAME (sh64_media,ldlol) },
5918 { SH64_MEDIA_INSN_LDLOQ, SEM_FN_NAME (sh64_media,ldloq) },
5919 { SH64_MEDIA_INSN_LDXB, SEM_FN_NAME (sh64_media,ldxb) },
5920 { SH64_MEDIA_INSN_LDXL, SEM_FN_NAME (sh64_media,ldxl) },
5921 { SH64_MEDIA_INSN_LDXQ, SEM_FN_NAME (sh64_media,ldxq) },
5922 { SH64_MEDIA_INSN_LDXUB, SEM_FN_NAME (sh64_media,ldxub) },
5923 { SH64_MEDIA_INSN_LDXUW, SEM_FN_NAME (sh64_media,ldxuw) },
5924 { SH64_MEDIA_INSN_LDXW, SEM_FN_NAME (sh64_media,ldxw) },
5925 { SH64_MEDIA_INSN_MABSL, SEM_FN_NAME (sh64_media,mabsl) },
5926 { SH64_MEDIA_INSN_MABSW, SEM_FN_NAME (sh64_media,mabsw) },
5927 { SH64_MEDIA_INSN_MADDL, SEM_FN_NAME (sh64_media,maddl) },
5928 { SH64_MEDIA_INSN_MADDW, SEM_FN_NAME (sh64_media,maddw) },
5929 { SH64_MEDIA_INSN_MADDSL, SEM_FN_NAME (sh64_media,maddsl) },
5930 { SH64_MEDIA_INSN_MADDSUB, SEM_FN_NAME (sh64_media,maddsub) },
5931 { SH64_MEDIA_INSN_MADDSW, SEM_FN_NAME (sh64_media,maddsw) },
5932 { SH64_MEDIA_INSN_MCMPEQB, SEM_FN_NAME (sh64_media,mcmpeqb) },
5933 { SH64_MEDIA_INSN_MCMPEQL, SEM_FN_NAME (sh64_media,mcmpeql) },
5934 { SH64_MEDIA_INSN_MCMPEQW, SEM_FN_NAME (sh64_media,mcmpeqw) },
5935 { SH64_MEDIA_INSN_MCMPGTL, SEM_FN_NAME (sh64_media,mcmpgtl) },
5936 { SH64_MEDIA_INSN_MCMPGTUB, SEM_FN_NAME (sh64_media,mcmpgtub) },
5937 { SH64_MEDIA_INSN_MCMPGTW, SEM_FN_NAME (sh64_media,mcmpgtw) },
5938 { SH64_MEDIA_INSN_MCMV, SEM_FN_NAME (sh64_media,mcmv) },
5939 { SH64_MEDIA_INSN_MCNVSLW, SEM_FN_NAME (sh64_media,mcnvslw) },
5940 { SH64_MEDIA_INSN_MCNVSWB, SEM_FN_NAME (sh64_media,mcnvswb) },
5941 { SH64_MEDIA_INSN_MCNVSWUB, SEM_FN_NAME (sh64_media,mcnvswub) },
5942 { SH64_MEDIA_INSN_MEXTR1, SEM_FN_NAME (sh64_media,mextr1) },
5943 { SH64_MEDIA_INSN_MEXTR2, SEM_FN_NAME (sh64_media,mextr2) },
5944 { SH64_MEDIA_INSN_MEXTR3, SEM_FN_NAME (sh64_media,mextr3) },
5945 { SH64_MEDIA_INSN_MEXTR4, SEM_FN_NAME (sh64_media,mextr4) },
5946 { SH64_MEDIA_INSN_MEXTR5, SEM_FN_NAME (sh64_media,mextr5) },
5947 { SH64_MEDIA_INSN_MEXTR6, SEM_FN_NAME (sh64_media,mextr6) },
5948 { SH64_MEDIA_INSN_MEXTR7, SEM_FN_NAME (sh64_media,mextr7) },
5949 { SH64_MEDIA_INSN_MMACFXWL, SEM_FN_NAME (sh64_media,mmacfxwl) },
5950 { SH64_MEDIA_INSN_MMACNFX_WL, SEM_FN_NAME (sh64_media,mmacnfx_wl) },
5951 { SH64_MEDIA_INSN_MMULL, SEM_FN_NAME (sh64_media,mmull) },
5952 { SH64_MEDIA_INSN_MMULW, SEM_FN_NAME (sh64_media,mmulw) },
5953 { SH64_MEDIA_INSN_MMULFXL, SEM_FN_NAME (sh64_media,mmulfxl) },
5954 { SH64_MEDIA_INSN_MMULFXW, SEM_FN_NAME (sh64_media,mmulfxw) },
5955 { SH64_MEDIA_INSN_MMULFXRPW, SEM_FN_NAME (sh64_media,mmulfxrpw) },
5956 { SH64_MEDIA_INSN_MMULHIWL, SEM_FN_NAME (sh64_media,mmulhiwl) },
5957 { SH64_MEDIA_INSN_MMULLOWL, SEM_FN_NAME (sh64_media,mmullowl) },
5958 { SH64_MEDIA_INSN_MMULSUMWQ, SEM_FN_NAME (sh64_media,mmulsumwq) },
5959 { SH64_MEDIA_INSN_MOVI, SEM_FN_NAME (sh64_media,movi) },
5960 { SH64_MEDIA_INSN_MPERMW, SEM_FN_NAME (sh64_media,mpermw) },
5961 { SH64_MEDIA_INSN_MSADUBQ, SEM_FN_NAME (sh64_media,msadubq) },
5962 { SH64_MEDIA_INSN_MSHALDSL, SEM_FN_NAME (sh64_media,mshaldsl) },
5963 { SH64_MEDIA_INSN_MSHALDSW, SEM_FN_NAME (sh64_media,mshaldsw) },
5964 { SH64_MEDIA_INSN_MSHARDL, SEM_FN_NAME (sh64_media,mshardl) },
5965 { SH64_MEDIA_INSN_MSHARDW, SEM_FN_NAME (sh64_media,mshardw) },
5966 { SH64_MEDIA_INSN_MSHARDSQ, SEM_FN_NAME (sh64_media,mshardsq) },
5967 { SH64_MEDIA_INSN_MSHFHIB, SEM_FN_NAME (sh64_media,mshfhib) },
5968 { SH64_MEDIA_INSN_MSHFHIL, SEM_FN_NAME (sh64_media,mshfhil) },
5969 { SH64_MEDIA_INSN_MSHFHIW, SEM_FN_NAME (sh64_media,mshfhiw) },
5970 { SH64_MEDIA_INSN_MSHFLOB, SEM_FN_NAME (sh64_media,mshflob) },
5971 { SH64_MEDIA_INSN_MSHFLOL, SEM_FN_NAME (sh64_media,mshflol) },
5972 { SH64_MEDIA_INSN_MSHFLOW, SEM_FN_NAME (sh64_media,mshflow) },
5973 { SH64_MEDIA_INSN_MSHLLDL, SEM_FN_NAME (sh64_media,mshlldl) },
5974 { SH64_MEDIA_INSN_MSHLLDW, SEM_FN_NAME (sh64_media,mshlldw) },
5975 { SH64_MEDIA_INSN_MSHLRDL, SEM_FN_NAME (sh64_media,mshlrdl) },
5976 { SH64_MEDIA_INSN_MSHLRDW, SEM_FN_NAME (sh64_media,mshlrdw) },
5977 { SH64_MEDIA_INSN_MSUBL, SEM_FN_NAME (sh64_media,msubl) },
5978 { SH64_MEDIA_INSN_MSUBW, SEM_FN_NAME (sh64_media,msubw) },
5979 { SH64_MEDIA_INSN_MSUBSL, SEM_FN_NAME (sh64_media,msubsl) },
5980 { SH64_MEDIA_INSN_MSUBSUB, SEM_FN_NAME (sh64_media,msubsub) },
5981 { SH64_MEDIA_INSN_MSUBSW, SEM_FN_NAME (sh64_media,msubsw) },
5982 { SH64_MEDIA_INSN_MULSL, SEM_FN_NAME (sh64_media,mulsl) },
5983 { SH64_MEDIA_INSN_MULUL, SEM_FN_NAME (sh64_media,mulul) },
5984 { SH64_MEDIA_INSN_NOP, SEM_FN_NAME (sh64_media,nop) },
5985 { SH64_MEDIA_INSN_NSB, SEM_FN_NAME (sh64_media,nsb) },
5986 { SH64_MEDIA_INSN_OCBI, SEM_FN_NAME (sh64_media,ocbi) },
5987 { SH64_MEDIA_INSN_OCBP, SEM_FN_NAME (sh64_media,ocbp) },
5988 { SH64_MEDIA_INSN_OCBWB, SEM_FN_NAME (sh64_media,ocbwb) },
5989 { SH64_MEDIA_INSN_OR, SEM_FN_NAME (sh64_media,or) },
5990 { SH64_MEDIA_INSN_ORI, SEM_FN_NAME (sh64_media,ori) },
5991 { SH64_MEDIA_INSN_PREFI, SEM_FN_NAME (sh64_media,prefi) },
5992 { SH64_MEDIA_INSN_PTA, SEM_FN_NAME (sh64_media,pta) },
5993 { SH64_MEDIA_INSN_PTABS, SEM_FN_NAME (sh64_media,ptabs) },
5994 { SH64_MEDIA_INSN_PTB, SEM_FN_NAME (sh64_media,ptb) },
5995 { SH64_MEDIA_INSN_PTREL, SEM_FN_NAME (sh64_media,ptrel) },
5996 { SH64_MEDIA_INSN_PUTCFG, SEM_FN_NAME (sh64_media,putcfg) },
5997 { SH64_MEDIA_INSN_PUTCON, SEM_FN_NAME (sh64_media,putcon) },
5998 { SH64_MEDIA_INSN_RTE, SEM_FN_NAME (sh64_media,rte) },
5999 { SH64_MEDIA_INSN_SHARD, SEM_FN_NAME (sh64_media,shard) },
6000 { SH64_MEDIA_INSN_SHARDL, SEM_FN_NAME (sh64_media,shardl) },
6001 { SH64_MEDIA_INSN_SHARI, SEM_FN_NAME (sh64_media,shari) },
6002 { SH64_MEDIA_INSN_SHARIL, SEM_FN_NAME (sh64_media,sharil) },
6003 { SH64_MEDIA_INSN_SHLLD, SEM_FN_NAME (sh64_media,shlld) },
6004 { SH64_MEDIA_INSN_SHLLDL, SEM_FN_NAME (sh64_media,shlldl) },
6005 { SH64_MEDIA_INSN_SHLLI, SEM_FN_NAME (sh64_media,shlli) },
6006 { SH64_MEDIA_INSN_SHLLIL, SEM_FN_NAME (sh64_media,shllil) },
6007 { SH64_MEDIA_INSN_SHLRD, SEM_FN_NAME (sh64_media,shlrd) },
6008 { SH64_MEDIA_INSN_SHLRDL, SEM_FN_NAME (sh64_media,shlrdl) },
6009 { SH64_MEDIA_INSN_SHLRI, SEM_FN_NAME (sh64_media,shlri) },
6010 { SH64_MEDIA_INSN_SHLRIL, SEM_FN_NAME (sh64_media,shlril) },
6011 { SH64_MEDIA_INSN_SHORI, SEM_FN_NAME (sh64_media,shori) },
6012 { SH64_MEDIA_INSN_SLEEP, SEM_FN_NAME (sh64_media,sleep) },
6013 { SH64_MEDIA_INSN_STB, SEM_FN_NAME (sh64_media,stb) },
6014 { SH64_MEDIA_INSN_STL, SEM_FN_NAME (sh64_media,stl) },
6015 { SH64_MEDIA_INSN_STQ, SEM_FN_NAME (sh64_media,stq) },
6016 { SH64_MEDIA_INSN_STW, SEM_FN_NAME (sh64_media,stw) },
6017 { SH64_MEDIA_INSN_STHIL, SEM_FN_NAME (sh64_media,sthil) },
6018 { SH64_MEDIA_INSN_STHIQ, SEM_FN_NAME (sh64_media,sthiq) },
6019 { SH64_MEDIA_INSN_STLOL, SEM_FN_NAME (sh64_media,stlol) },
6020 { SH64_MEDIA_INSN_STLOQ, SEM_FN_NAME (sh64_media,stloq) },
6021 { SH64_MEDIA_INSN_STXB, SEM_FN_NAME (sh64_media,stxb) },
6022 { SH64_MEDIA_INSN_STXL, SEM_FN_NAME (sh64_media,stxl) },
6023 { SH64_MEDIA_INSN_STXQ, SEM_FN_NAME (sh64_media,stxq) },
6024 { SH64_MEDIA_INSN_STXW, SEM_FN_NAME (sh64_media,stxw) },
6025 { SH64_MEDIA_INSN_SUB, SEM_FN_NAME (sh64_media,sub) },
6026 { SH64_MEDIA_INSN_SUBL, SEM_FN_NAME (sh64_media,subl) },
6027 { SH64_MEDIA_INSN_SWAPQ, SEM_FN_NAME (sh64_media,swapq) },
6028 { SH64_MEDIA_INSN_SYNCI, SEM_FN_NAME (sh64_media,synci) },
6029 { SH64_MEDIA_INSN_SYNCO, SEM_FN_NAME (sh64_media,synco) },
6030 { SH64_MEDIA_INSN_TRAPA, SEM_FN_NAME (sh64_media,trapa) },
6031 { SH64_MEDIA_INSN_XOR, SEM_FN_NAME (sh64_media,xor) },
6032 { SH64_MEDIA_INSN_XORI, SEM_FN_NAME (sh64_media,xori) },
6033 { 0, 0 }
6036 /* Add the semantic fns to IDESC_TABLE. */
6038 void
6039 SEM_FN_NAME (sh64_media,init_idesc_table) (SIM_CPU *current_cpu)
6041 IDESC *idesc_table = CPU_IDESC (current_cpu);
6042 const struct sem_fn_desc *sf;
6043 int mach_num = MACH_NUM (CPU_MACH (current_cpu));
6045 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
6047 const CGEN_INSN *insn = idesc_table[sf->index].idata;
6048 int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
6049 || CGEN_INSN_MACH_HAS_P (insn, mach_num));
6050 #if FAST_P
6051 if (valid_p)
6052 idesc_table[sf->index].sem_fast = sf->fn;
6053 else
6054 idesc_table[sf->index].sem_fast = SEM_FN_NAME (sh64_media,x_invalid);
6055 #else
6056 if (valid_p)
6057 idesc_table[sf->index].sem_full = sf->fn;
6058 else
6059 idesc_table[sf->index].sem_full = SEM_FN_NAME (sh64_media,x_invalid);
6060 #endif