1 /* Simulator instruction semantics for m32rbf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
7 This file is part of the GNU Simulators.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #define WANT_CPU m32rbf
26 #define WANT_CPU_M32RBF
33 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
35 /* This is used so that we can compile two copies of the semantic code,
36 one with full feature support and one without that runs fast(er).
37 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
39 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
41 #define TRACE_RESULT(cpu, abuf, name, type, val)
43 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
46 /* x-invalid: --invalid-- */
49 SEM_FN_NAME (m32rbf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
51 #define FLD(f) abuf->fields.fmt_empty.f
52 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
53 int UNUSED written = 0;
54 IADDR UNUSED pc = abuf->addr;
55 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
59 /* Update the recorded pc in the cpu state struct. */
62 sim_engine_invalid_insn (current_cpu, pc);
63 sim_io_error (CPU_STATE (current_cpu), "invalid insn not handled\n");
71 /* x-after: --after-- */
74 SEM_FN_NAME (m32rbf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
76 #define FLD(f) abuf->fields.fmt_empty.f
77 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
78 int UNUSED written = 0;
79 IADDR UNUSED pc = abuf->addr;
80 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
83 #if WITH_SCACHE_PBB_M32RBF
84 m32rbf_pbb_after (current_cpu, sem_arg);
92 /* x-before: --before-- */
95 SEM_FN_NAME (m32rbf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
97 #define FLD(f) abuf->fields.fmt_empty.f
98 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
99 int UNUSED written = 0;
100 IADDR UNUSED pc = abuf->addr;
101 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
104 #if WITH_SCACHE_PBB_M32RBF
105 m32rbf_pbb_before (current_cpu, sem_arg);
113 /* x-cti-chain: --cti-chain-- */
116 SEM_FN_NAME (m32rbf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
118 #define FLD(f) abuf->fields.fmt_empty.f
119 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
120 int UNUSED written = 0;
121 IADDR UNUSED pc = abuf->addr;
122 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
125 #if WITH_SCACHE_PBB_M32RBF
127 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
128 pbb_br_type, pbb_br_npc);
131 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
132 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
133 CPU_PBB_BR_TYPE (current_cpu),
134 CPU_PBB_BR_NPC (current_cpu));
143 /* x-chain: --chain-- */
146 SEM_FN_NAME (m32rbf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
148 #define FLD(f) abuf->fields.fmt_empty.f
149 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
150 int UNUSED written = 0;
151 IADDR UNUSED pc = abuf->addr;
152 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
155 #if WITH_SCACHE_PBB_M32RBF
156 vpc = m32rbf_pbb_chain (current_cpu, sem_arg);
167 /* x-begin: --begin-- */
170 SEM_FN_NAME (m32rbf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
172 #define FLD(f) abuf->fields.fmt_empty.f
173 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
174 int UNUSED written = 0;
175 IADDR UNUSED pc = abuf->addr;
176 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
179 #if WITH_SCACHE_PBB_M32RBF
181 /* In the switch case FAST_P is a constant, allowing several optimizations
182 in any called inline functions. */
183 vpc = m32rbf_pbb_begin (current_cpu, FAST_P);
185 vpc = m32rbf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
194 /* add: add $dr,$sr */
197 SEM_FN_NAME (m32rbf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
199 #define FLD(f) abuf->fields.sfmt_add.f
200 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
201 int UNUSED written = 0;
202 IADDR UNUSED pc = abuf->addr;
203 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
206 SI opval = ADDSI (* FLD (i_dr), * FLD (i_sr));
207 * FLD (i_dr) = opval;
208 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
215 /* add3: add3 $dr,$sr,$hash$slo16 */
218 SEM_FN_NAME (m32rbf,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
220 #define FLD(f) abuf->fields.sfmt_add3.f
221 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
222 int UNUSED written = 0;
223 IADDR UNUSED pc = abuf->addr;
224 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
227 SI opval = ADDSI (* FLD (i_sr), FLD (f_simm16));
228 * FLD (i_dr) = opval;
229 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
236 /* and: and $dr,$sr */
239 SEM_FN_NAME (m32rbf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
241 #define FLD(f) abuf->fields.sfmt_add.f
242 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
243 int UNUSED written = 0;
244 IADDR UNUSED pc = abuf->addr;
245 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
248 SI opval = ANDSI (* FLD (i_dr), * FLD (i_sr));
249 * FLD (i_dr) = opval;
250 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
257 /* and3: and3 $dr,$sr,$uimm16 */
260 SEM_FN_NAME (m32rbf,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
262 #define FLD(f) abuf->fields.sfmt_and3.f
263 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
264 int UNUSED written = 0;
265 IADDR UNUSED pc = abuf->addr;
266 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
269 SI opval = ANDSI (* FLD (i_sr), FLD (f_uimm16));
270 * FLD (i_dr) = opval;
271 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
281 SEM_FN_NAME (m32rbf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
283 #define FLD(f) abuf->fields.sfmt_add.f
284 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
285 int UNUSED written = 0;
286 IADDR UNUSED pc = abuf->addr;
287 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
290 SI opval = ORSI (* FLD (i_dr), * FLD (i_sr));
291 * FLD (i_dr) = opval;
292 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
299 /* or3: or3 $dr,$sr,$hash$ulo16 */
302 SEM_FN_NAME (m32rbf,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
304 #define FLD(f) abuf->fields.sfmt_and3.f
305 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
306 int UNUSED written = 0;
307 IADDR UNUSED pc = abuf->addr;
308 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
311 SI opval = ORSI (* FLD (i_sr), FLD (f_uimm16));
312 * FLD (i_dr) = opval;
313 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
320 /* xor: xor $dr,$sr */
323 SEM_FN_NAME (m32rbf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
325 #define FLD(f) abuf->fields.sfmt_add.f
326 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
327 int UNUSED written = 0;
328 IADDR UNUSED pc = abuf->addr;
329 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
332 SI opval = XORSI (* FLD (i_dr), * FLD (i_sr));
333 * FLD (i_dr) = opval;
334 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
341 /* xor3: xor3 $dr,$sr,$uimm16 */
344 SEM_FN_NAME (m32rbf,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
346 #define FLD(f) abuf->fields.sfmt_and3.f
347 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
348 int UNUSED written = 0;
349 IADDR UNUSED pc = abuf->addr;
350 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
353 SI opval = XORSI (* FLD (i_sr), FLD (f_uimm16));
354 * FLD (i_dr) = opval;
355 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
362 /* addi: addi $dr,$simm8 */
365 SEM_FN_NAME (m32rbf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
367 #define FLD(f) abuf->fields.sfmt_addi.f
368 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
369 int UNUSED written = 0;
370 IADDR UNUSED pc = abuf->addr;
371 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
374 SI opval = ADDSI (* FLD (i_dr), FLD (f_simm8));
375 * FLD (i_dr) = opval;
376 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
383 /* addv: addv $dr,$sr */
386 SEM_FN_NAME (m32rbf,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
388 #define FLD(f) abuf->fields.sfmt_add.f
389 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
390 int UNUSED written = 0;
391 IADDR UNUSED pc = abuf->addr;
392 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
396 temp0 = ADDSI (* FLD (i_dr), * FLD (i_sr));
397 temp1 = ADDOFSI (* FLD (i_dr), * FLD (i_sr), 0);
400 * FLD (i_dr) = opval;
401 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
405 CPU (h_cond) = opval;
406 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
414 /* addv3: addv3 $dr,$sr,$simm16 */
417 SEM_FN_NAME (m32rbf,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
419 #define FLD(f) abuf->fields.sfmt_add3.f
420 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
421 int UNUSED written = 0;
422 IADDR UNUSED pc = abuf->addr;
423 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
427 temp0 = ADDSI (* FLD (i_sr), FLD (f_simm16));
428 temp1 = ADDOFSI (* FLD (i_sr), FLD (f_simm16), 0);
431 * FLD (i_dr) = opval;
432 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
436 CPU (h_cond) = opval;
437 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
445 /* addx: addx $dr,$sr */
448 SEM_FN_NAME (m32rbf,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
450 #define FLD(f) abuf->fields.sfmt_add.f
451 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
452 int UNUSED written = 0;
453 IADDR UNUSED pc = abuf->addr;
454 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
458 temp0 = ADDCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
459 temp1 = ADDCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
462 * FLD (i_dr) = opval;
463 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
467 CPU (h_cond) = opval;
468 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
476 /* bc8: bc.s $disp8 */
479 SEM_FN_NAME (m32rbf,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
481 #define FLD(f) abuf->fields.sfmt_bl8.f
482 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
483 int UNUSED written = 0;
484 IADDR UNUSED pc = abuf->addr;
486 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
490 USI opval = FLD (i_disp8);
491 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
493 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
497 abuf->written = written;
498 SEM_BRANCH_FINI (vpc);
503 /* bc24: bc.l $disp24 */
506 SEM_FN_NAME (m32rbf,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
508 #define FLD(f) abuf->fields.sfmt_bl24.f
509 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
510 int UNUSED written = 0;
511 IADDR UNUSED pc = abuf->addr;
513 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
517 USI opval = FLD (i_disp24);
518 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
520 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
524 abuf->written = written;
525 SEM_BRANCH_FINI (vpc);
530 /* beq: beq $src1,$src2,$disp16 */
533 SEM_FN_NAME (m32rbf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
535 #define FLD(f) abuf->fields.sfmt_beq.f
536 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
537 int UNUSED written = 0;
538 IADDR UNUSED pc = abuf->addr;
540 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
542 if (EQSI (* FLD (i_src1), * FLD (i_src2))) {
544 USI opval = FLD (i_disp16);
545 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
547 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
551 abuf->written = written;
552 SEM_BRANCH_FINI (vpc);
557 /* beqz: beqz $src2,$disp16 */
560 SEM_FN_NAME (m32rbf,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
562 #define FLD(f) abuf->fields.sfmt_beq.f
563 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
564 int UNUSED written = 0;
565 IADDR UNUSED pc = abuf->addr;
567 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
569 if (EQSI (* FLD (i_src2), 0)) {
571 USI opval = FLD (i_disp16);
572 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
574 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
578 abuf->written = written;
579 SEM_BRANCH_FINI (vpc);
584 /* bgez: bgez $src2,$disp16 */
587 SEM_FN_NAME (m32rbf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
589 #define FLD(f) abuf->fields.sfmt_beq.f
590 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
591 int UNUSED written = 0;
592 IADDR UNUSED pc = abuf->addr;
594 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
596 if (GESI (* FLD (i_src2), 0)) {
598 USI opval = FLD (i_disp16);
599 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
601 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
605 abuf->written = written;
606 SEM_BRANCH_FINI (vpc);
611 /* bgtz: bgtz $src2,$disp16 */
614 SEM_FN_NAME (m32rbf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
616 #define FLD(f) abuf->fields.sfmt_beq.f
617 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
618 int UNUSED written = 0;
619 IADDR UNUSED pc = abuf->addr;
621 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
623 if (GTSI (* FLD (i_src2), 0)) {
625 USI opval = FLD (i_disp16);
626 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
628 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
632 abuf->written = written;
633 SEM_BRANCH_FINI (vpc);
638 /* blez: blez $src2,$disp16 */
641 SEM_FN_NAME (m32rbf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
643 #define FLD(f) abuf->fields.sfmt_beq.f
644 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
645 int UNUSED written = 0;
646 IADDR UNUSED pc = abuf->addr;
648 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
650 if (LESI (* FLD (i_src2), 0)) {
652 USI opval = FLD (i_disp16);
653 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
655 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
659 abuf->written = written;
660 SEM_BRANCH_FINI (vpc);
665 /* bltz: bltz $src2,$disp16 */
668 SEM_FN_NAME (m32rbf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
670 #define FLD(f) abuf->fields.sfmt_beq.f
671 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
672 int UNUSED written = 0;
673 IADDR UNUSED pc = abuf->addr;
675 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
677 if (LTSI (* FLD (i_src2), 0)) {
679 USI opval = FLD (i_disp16);
680 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
682 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
686 abuf->written = written;
687 SEM_BRANCH_FINI (vpc);
692 /* bnez: bnez $src2,$disp16 */
695 SEM_FN_NAME (m32rbf,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
697 #define FLD(f) abuf->fields.sfmt_beq.f
698 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
699 int UNUSED written = 0;
700 IADDR UNUSED pc = abuf->addr;
702 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
704 if (NESI (* FLD (i_src2), 0)) {
706 USI opval = FLD (i_disp16);
707 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
709 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
713 abuf->written = written;
714 SEM_BRANCH_FINI (vpc);
719 /* bl8: bl.s $disp8 */
722 SEM_FN_NAME (m32rbf,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
724 #define FLD(f) abuf->fields.sfmt_bl8.f
725 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
726 int UNUSED written = 0;
727 IADDR UNUSED pc = abuf->addr;
729 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
733 SI opval = ADDSI (ANDSI (pc, -4), 4);
734 CPU (h_gr[((UINT) 14)]) = opval;
735 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
738 USI opval = FLD (i_disp8);
739 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
740 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
744 SEM_BRANCH_FINI (vpc);
749 /* bl24: bl.l $disp24 */
752 SEM_FN_NAME (m32rbf,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
754 #define FLD(f) abuf->fields.sfmt_bl24.f
755 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
756 int UNUSED written = 0;
757 IADDR UNUSED pc = abuf->addr;
759 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
763 SI opval = ADDSI (pc, 4);
764 CPU (h_gr[((UINT) 14)]) = opval;
765 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
768 USI opval = FLD (i_disp24);
769 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
770 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
774 SEM_BRANCH_FINI (vpc);
779 /* bnc8: bnc.s $disp8 */
782 SEM_FN_NAME (m32rbf,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
784 #define FLD(f) abuf->fields.sfmt_bl8.f
785 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
786 int UNUSED written = 0;
787 IADDR UNUSED pc = abuf->addr;
789 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
791 if (NOTBI (CPU (h_cond))) {
793 USI opval = FLD (i_disp8);
794 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
796 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
800 abuf->written = written;
801 SEM_BRANCH_FINI (vpc);
806 /* bnc24: bnc.l $disp24 */
809 SEM_FN_NAME (m32rbf,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
811 #define FLD(f) abuf->fields.sfmt_bl24.f
812 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
813 int UNUSED written = 0;
814 IADDR UNUSED pc = abuf->addr;
816 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
818 if (NOTBI (CPU (h_cond))) {
820 USI opval = FLD (i_disp24);
821 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
823 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
827 abuf->written = written;
828 SEM_BRANCH_FINI (vpc);
833 /* bne: bne $src1,$src2,$disp16 */
836 SEM_FN_NAME (m32rbf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
838 #define FLD(f) abuf->fields.sfmt_beq.f
839 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
840 int UNUSED written = 0;
841 IADDR UNUSED pc = abuf->addr;
843 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
845 if (NESI (* FLD (i_src1), * FLD (i_src2))) {
847 USI opval = FLD (i_disp16);
848 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
850 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
854 abuf->written = written;
855 SEM_BRANCH_FINI (vpc);
860 /* bra8: bra.s $disp8 */
863 SEM_FN_NAME (m32rbf,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
865 #define FLD(f) abuf->fields.sfmt_bl8.f
866 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
867 int UNUSED written = 0;
868 IADDR UNUSED pc = abuf->addr;
870 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
873 USI opval = FLD (i_disp8);
874 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
875 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
878 SEM_BRANCH_FINI (vpc);
883 /* bra24: bra.l $disp24 */
886 SEM_FN_NAME (m32rbf,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
888 #define FLD(f) abuf->fields.sfmt_bl24.f
889 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
890 int UNUSED written = 0;
891 IADDR UNUSED pc = abuf->addr;
893 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
896 USI opval = FLD (i_disp24);
897 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
898 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
901 SEM_BRANCH_FINI (vpc);
906 /* cmp: cmp $src1,$src2 */
909 SEM_FN_NAME (m32rbf,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
911 #define FLD(f) abuf->fields.sfmt_st_plus.f
912 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
913 int UNUSED written = 0;
914 IADDR UNUSED pc = abuf->addr;
915 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
918 BI opval = LTSI (* FLD (i_src1), * FLD (i_src2));
919 CPU (h_cond) = opval;
920 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
927 /* cmpi: cmpi $src2,$simm16 */
930 SEM_FN_NAME (m32rbf,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
932 #define FLD(f) abuf->fields.sfmt_st_d.f
933 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
934 int UNUSED written = 0;
935 IADDR UNUSED pc = abuf->addr;
936 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
939 BI opval = LTSI (* FLD (i_src2), FLD (f_simm16));
940 CPU (h_cond) = opval;
941 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
948 /* cmpu: cmpu $src1,$src2 */
951 SEM_FN_NAME (m32rbf,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
953 #define FLD(f) abuf->fields.sfmt_st_plus.f
954 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
955 int UNUSED written = 0;
956 IADDR UNUSED pc = abuf->addr;
957 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
960 BI opval = LTUSI (* FLD (i_src1), * FLD (i_src2));
961 CPU (h_cond) = opval;
962 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
969 /* cmpui: cmpui $src2,$simm16 */
972 SEM_FN_NAME (m32rbf,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
974 #define FLD(f) abuf->fields.sfmt_st_d.f
975 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
976 int UNUSED written = 0;
977 IADDR UNUSED pc = abuf->addr;
978 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
981 BI opval = LTUSI (* FLD (i_src2), FLD (f_simm16));
982 CPU (h_cond) = opval;
983 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
990 /* div: div $dr,$sr */
993 SEM_FN_NAME (m32rbf,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
995 #define FLD(f) abuf->fields.sfmt_add.f
996 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
997 int UNUSED written = 0;
998 IADDR UNUSED pc = abuf->addr;
999 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1001 if (NESI (* FLD (i_sr), 0)) {
1003 SI opval = DIVSI (* FLD (i_dr), * FLD (i_sr));
1004 * FLD (i_dr) = opval;
1005 written |= (1 << 2);
1006 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1010 abuf->written = written;
1015 /* divu: divu $dr,$sr */
1018 SEM_FN_NAME (m32rbf,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1020 #define FLD(f) abuf->fields.sfmt_add.f
1021 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1022 int UNUSED written = 0;
1023 IADDR UNUSED pc = abuf->addr;
1024 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1026 if (NESI (* FLD (i_sr), 0)) {
1028 SI opval = UDIVSI (* FLD (i_dr), * FLD (i_sr));
1029 * FLD (i_dr) = opval;
1030 written |= (1 << 2);
1031 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1035 abuf->written = written;
1040 /* rem: rem $dr,$sr */
1043 SEM_FN_NAME (m32rbf,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1045 #define FLD(f) abuf->fields.sfmt_add.f
1046 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1047 int UNUSED written = 0;
1048 IADDR UNUSED pc = abuf->addr;
1049 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1051 if (NESI (* FLD (i_sr), 0)) {
1053 SI opval = MODSI (* FLD (i_dr), * FLD (i_sr));
1054 * FLD (i_dr) = opval;
1055 written |= (1 << 2);
1056 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1060 abuf->written = written;
1065 /* remu: remu $dr,$sr */
1068 SEM_FN_NAME (m32rbf,remu) (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);
1076 if (NESI (* FLD (i_sr), 0)) {
1078 SI opval = UMODSI (* FLD (i_dr), * FLD (i_sr));
1079 * FLD (i_dr) = opval;
1080 written |= (1 << 2);
1081 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1085 abuf->written = written;
1093 SEM_FN_NAME (m32rbf,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1095 #define FLD(f) abuf->fields.sfmt_jl.f
1096 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1097 int UNUSED written = 0;
1098 IADDR UNUSED pc = abuf->addr;
1100 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1104 temp0 = ADDSI (ANDSI (pc, -4), 4);
1105 temp1 = ANDSI (* FLD (i_sr), -4);
1108 CPU (h_gr[((UINT) 14)]) = opval;
1109 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
1113 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1114 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1118 SEM_BRANCH_FINI (vpc);
1126 SEM_FN_NAME (m32rbf,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1128 #define FLD(f) abuf->fields.sfmt_mvtc.f
1129 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1130 int UNUSED written = 0;
1131 IADDR UNUSED pc = abuf->addr;
1133 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1136 USI opval = ANDSI (* FLD (i_sr), -4);
1137 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1138 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1141 SEM_BRANCH_FINI (vpc);
1146 /* ld: ld $dr,@$sr */
1149 SEM_FN_NAME (m32rbf,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1151 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1152 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1153 int UNUSED written = 0;
1154 IADDR UNUSED pc = abuf->addr;
1155 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1158 SI opval = GETMEMSI (current_cpu, pc, * FLD (i_sr));
1159 * FLD (i_dr) = opval;
1160 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1167 /* ld-d: ld $dr,@($slo16,$sr) */
1170 SEM_FN_NAME (m32rbf,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1172 #define FLD(f) abuf->fields.sfmt_add3.f
1173 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1174 int UNUSED written = 0;
1175 IADDR UNUSED pc = abuf->addr;
1176 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1179 SI opval = GETMEMSI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)));
1180 * FLD (i_dr) = opval;
1181 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1188 /* ldb: ldb $dr,@$sr */
1191 SEM_FN_NAME (m32rbf,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1193 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1194 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1195 int UNUSED written = 0;
1196 IADDR UNUSED pc = abuf->addr;
1197 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1200 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, * FLD (i_sr)));
1201 * FLD (i_dr) = opval;
1202 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1209 /* ldb-d: ldb $dr,@($slo16,$sr) */
1212 SEM_FN_NAME (m32rbf,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1214 #define FLD(f) abuf->fields.sfmt_add3.f
1215 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1216 int UNUSED written = 0;
1217 IADDR UNUSED pc = abuf->addr;
1218 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1221 SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1222 * FLD (i_dr) = opval;
1223 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1230 /* ldh: ldh $dr,@$sr */
1233 SEM_FN_NAME (m32rbf,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1235 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1236 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1237 int UNUSED written = 0;
1238 IADDR UNUSED pc = abuf->addr;
1239 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1242 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, * FLD (i_sr)));
1243 * FLD (i_dr) = opval;
1244 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1251 /* ldh-d: ldh $dr,@($slo16,$sr) */
1254 SEM_FN_NAME (m32rbf,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1256 #define FLD(f) abuf->fields.sfmt_add3.f
1257 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1258 int UNUSED written = 0;
1259 IADDR UNUSED pc = abuf->addr;
1260 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1263 SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1264 * FLD (i_dr) = opval;
1265 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1272 /* ldub: ldub $dr,@$sr */
1275 SEM_FN_NAME (m32rbf,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1277 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1278 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1279 int UNUSED written = 0;
1280 IADDR UNUSED pc = abuf->addr;
1281 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1284 SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, * FLD (i_sr)));
1285 * FLD (i_dr) = opval;
1286 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1293 /* ldub-d: ldub $dr,@($slo16,$sr) */
1296 SEM_FN_NAME (m32rbf,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1298 #define FLD(f) abuf->fields.sfmt_add3.f
1299 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1300 int UNUSED written = 0;
1301 IADDR UNUSED pc = abuf->addr;
1302 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1305 SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1306 * FLD (i_dr) = opval;
1307 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1314 /* lduh: lduh $dr,@$sr */
1317 SEM_FN_NAME (m32rbf,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1319 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1320 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1321 int UNUSED written = 0;
1322 IADDR UNUSED pc = abuf->addr;
1323 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1326 SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, * FLD (i_sr)));
1327 * FLD (i_dr) = opval;
1328 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1335 /* lduh-d: lduh $dr,@($slo16,$sr) */
1338 SEM_FN_NAME (m32rbf,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1340 #define FLD(f) abuf->fields.sfmt_add3.f
1341 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1342 int UNUSED written = 0;
1343 IADDR UNUSED pc = abuf->addr;
1344 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1347 SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1348 * FLD (i_dr) = opval;
1349 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1356 /* ld-plus: ld $dr,@$sr+ */
1359 SEM_FN_NAME (m32rbf,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1361 #define FLD(f) abuf->fields.sfmt_ld_plus.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, 2);
1369 temp0 = GETMEMSI (current_cpu, pc, * FLD (i_sr));
1370 temp1 = ADDSI (* FLD (i_sr), 4);
1373 * FLD (i_dr) = opval;
1374 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1378 * FLD (i_sr) = opval;
1379 TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval);
1387 /* ld24: ld24 $dr,$uimm24 */
1390 SEM_FN_NAME (m32rbf,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1392 #define FLD(f) abuf->fields.sfmt_ld24.f
1393 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1394 int UNUSED written = 0;
1395 IADDR UNUSED pc = abuf->addr;
1396 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1399 SI opval = FLD (i_uimm24);
1400 * FLD (i_dr) = opval;
1401 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1408 /* ldi8: ldi8 $dr,$simm8 */
1411 SEM_FN_NAME (m32rbf,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1413 #define FLD(f) abuf->fields.sfmt_addi.f
1414 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1415 int UNUSED written = 0;
1416 IADDR UNUSED pc = abuf->addr;
1417 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1420 SI opval = FLD (f_simm8);
1421 * FLD (i_dr) = opval;
1422 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1429 /* ldi16: ldi16 $dr,$hash$slo16 */
1432 SEM_FN_NAME (m32rbf,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1434 #define FLD(f) abuf->fields.sfmt_add3.f
1435 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1436 int UNUSED written = 0;
1437 IADDR UNUSED pc = abuf->addr;
1438 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1441 SI opval = FLD (f_simm16);
1442 * FLD (i_dr) = opval;
1443 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1450 /* lock: lock $dr,@$sr */
1453 SEM_FN_NAME (m32rbf,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1455 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1456 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1457 int UNUSED written = 0;
1458 IADDR UNUSED pc = abuf->addr;
1459 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1464 CPU (h_lock) = opval;
1465 TRACE_RESULT (current_cpu, abuf, "lock", 'x', opval);
1468 SI opval = GETMEMSI (current_cpu, pc, * FLD (i_sr));
1469 * FLD (i_dr) = opval;
1470 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1478 /* machi: machi $src1,$src2 */
1481 SEM_FN_NAME (m32rbf,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1483 #define FLD(f) abuf->fields.sfmt_st_plus.f
1484 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1485 int UNUSED written = 0;
1486 IADDR UNUSED pc = abuf->addr;
1487 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1490 DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
1491 SET_H_ACCUM (opval);
1492 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1499 /* maclo: maclo $src1,$src2 */
1502 SEM_FN_NAME (m32rbf,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1504 #define FLD(f) abuf->fields.sfmt_st_plus.f
1505 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1506 int UNUSED written = 0;
1507 IADDR UNUSED pc = abuf->addr;
1508 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1511 DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
1512 SET_H_ACCUM (opval);
1513 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1520 /* macwhi: macwhi $src1,$src2 */
1523 SEM_FN_NAME (m32rbf,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1525 #define FLD(f) abuf->fields.sfmt_st_plus.f
1526 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1527 int UNUSED written = 0;
1528 IADDR UNUSED pc = abuf->addr;
1529 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1532 DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
1533 SET_H_ACCUM (opval);
1534 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1541 /* macwlo: macwlo $src1,$src2 */
1544 SEM_FN_NAME (m32rbf,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1546 #define FLD(f) abuf->fields.sfmt_st_plus.f
1547 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1548 int UNUSED written = 0;
1549 IADDR UNUSED pc = abuf->addr;
1550 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1553 DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
1554 SET_H_ACCUM (opval);
1555 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1562 /* mul: mul $dr,$sr */
1565 SEM_FN_NAME (m32rbf,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1567 #define FLD(f) abuf->fields.sfmt_add.f
1568 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1569 int UNUSED written = 0;
1570 IADDR UNUSED pc = abuf->addr;
1571 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1574 SI opval = MULSI (* FLD (i_dr), * FLD (i_sr));
1575 * FLD (i_dr) = opval;
1576 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1583 /* mulhi: mulhi $src1,$src2 */
1586 SEM_FN_NAME (m32rbf,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1588 #define FLD(f) abuf->fields.sfmt_st_plus.f
1589 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1590 int UNUSED written = 0;
1591 IADDR UNUSED pc = abuf->addr;
1592 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1595 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 16), 16);
1596 SET_H_ACCUM (opval);
1597 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1604 /* mullo: mullo $src1,$src2 */
1607 SEM_FN_NAME (m32rbf,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1609 #define FLD(f) abuf->fields.sfmt_st_plus.f
1610 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1611 int UNUSED written = 0;
1612 IADDR UNUSED pc = abuf->addr;
1613 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1616 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 16), 16);
1617 SET_H_ACCUM (opval);
1618 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1625 /* mulwhi: mulwhi $src1,$src2 */
1628 SEM_FN_NAME (m32rbf,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1630 #define FLD(f) abuf->fields.sfmt_st_plus.f
1631 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1632 int UNUSED written = 0;
1633 IADDR UNUSED pc = abuf->addr;
1634 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1637 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 8), 8);
1638 SET_H_ACCUM (opval);
1639 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1646 /* mulwlo: mulwlo $src1,$src2 */
1649 SEM_FN_NAME (m32rbf,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1651 #define FLD(f) abuf->fields.sfmt_st_plus.f
1652 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1653 int UNUSED written = 0;
1654 IADDR UNUSED pc = abuf->addr;
1655 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1658 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 8), 8);
1659 SET_H_ACCUM (opval);
1660 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1667 /* mv: mv $dr,$sr */
1670 SEM_FN_NAME (m32rbf,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1672 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1673 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1674 int UNUSED written = 0;
1675 IADDR UNUSED pc = abuf->addr;
1676 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1679 SI opval = * FLD (i_sr);
1680 * FLD (i_dr) = opval;
1681 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1688 /* mvfachi: mvfachi $dr */
1691 SEM_FN_NAME (m32rbf,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1693 #define FLD(f) abuf->fields.sfmt_seth.f
1694 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1695 int UNUSED written = 0;
1696 IADDR UNUSED pc = abuf->addr;
1697 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1700 SI opval = TRUNCDISI (SRADI (GET_H_ACCUM (), 32));
1701 * FLD (i_dr) = opval;
1702 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1709 /* mvfaclo: mvfaclo $dr */
1712 SEM_FN_NAME (m32rbf,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1714 #define FLD(f) abuf->fields.sfmt_seth.f
1715 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1716 int UNUSED written = 0;
1717 IADDR UNUSED pc = abuf->addr;
1718 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1721 SI opval = TRUNCDISI (GET_H_ACCUM ());
1722 * FLD (i_dr) = opval;
1723 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1730 /* mvfacmi: mvfacmi $dr */
1733 SEM_FN_NAME (m32rbf,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1735 #define FLD(f) abuf->fields.sfmt_seth.f
1736 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1737 int UNUSED written = 0;
1738 IADDR UNUSED pc = abuf->addr;
1739 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1742 SI opval = TRUNCDISI (SRADI (GET_H_ACCUM (), 16));
1743 * FLD (i_dr) = opval;
1744 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1751 /* mvfc: mvfc $dr,$scr */
1754 SEM_FN_NAME (m32rbf,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1756 #define FLD(f) abuf->fields.sfmt_mvfc.f
1757 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1758 int UNUSED written = 0;
1759 IADDR UNUSED pc = abuf->addr;
1760 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1763 SI opval = GET_H_CR (FLD (f_r2));
1764 * FLD (i_dr) = opval;
1765 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1772 /* mvtachi: mvtachi $src1 */
1775 SEM_FN_NAME (m32rbf,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1777 #define FLD(f) abuf->fields.sfmt_st_plus.f
1778 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1779 int UNUSED written = 0;
1780 IADDR UNUSED pc = abuf->addr;
1781 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1784 DI opval = ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1)), 32));
1785 SET_H_ACCUM (opval);
1786 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1793 /* mvtaclo: mvtaclo $src1 */
1796 SEM_FN_NAME (m32rbf,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1798 #define FLD(f) abuf->fields.sfmt_st_plus.f
1799 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1800 int UNUSED written = 0;
1801 IADDR UNUSED pc = abuf->addr;
1802 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1805 DI opval = ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1)));
1806 SET_H_ACCUM (opval);
1807 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1814 /* mvtc: mvtc $sr,$dcr */
1817 SEM_FN_NAME (m32rbf,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1819 #define FLD(f) abuf->fields.sfmt_mvtc.f
1820 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1821 int UNUSED written = 0;
1822 IADDR UNUSED pc = abuf->addr;
1823 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1826 USI opval = * FLD (i_sr);
1827 SET_H_CR (FLD (f_r1), opval);
1828 TRACE_RESULT (current_cpu, abuf, "dcr", 'x', opval);
1835 /* neg: neg $dr,$sr */
1838 SEM_FN_NAME (m32rbf,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1840 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1841 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1842 int UNUSED written = 0;
1843 IADDR UNUSED pc = abuf->addr;
1844 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1847 SI opval = NEGSI (* FLD (i_sr));
1848 * FLD (i_dr) = opval;
1849 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1859 SEM_FN_NAME (m32rbf,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1861 #define FLD(f) abuf->fields.fmt_empty.f
1862 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1863 int UNUSED written = 0;
1864 IADDR UNUSED pc = abuf->addr;
1865 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1867 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
1873 /* not: not $dr,$sr */
1876 SEM_FN_NAME (m32rbf,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1878 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1879 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1880 int UNUSED written = 0;
1881 IADDR UNUSED pc = abuf->addr;
1882 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1885 SI opval = INVSI (* FLD (i_sr));
1886 * FLD (i_dr) = opval;
1887 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1897 SEM_FN_NAME (m32rbf,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1899 #define FLD(f) abuf->fields.fmt_empty.f
1900 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1901 int UNUSED written = 0;
1902 IADDR UNUSED pc = abuf->addr;
1903 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1907 tmp_tmp1 = SLLDI (GET_H_ACCUM (), 1);
1908 tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768));
1910 DI opval = (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000)));
1911 SET_H_ACCUM (opval);
1912 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1923 SEM_FN_NAME (m32rbf,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1925 #define FLD(f) abuf->fields.fmt_empty.f
1926 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1927 int UNUSED written = 0;
1928 IADDR UNUSED pc = abuf->addr;
1929 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1933 tmp_tmp1 = ANDDI (GET_H_ACCUM (), MAKEDI (16777215, 0xffffffff));
1934 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
1935 tmp_tmp1 = MAKEDI (16383, 0x80000000);
1937 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
1938 tmp_tmp1 = MAKEDI (16760832, 0);
1940 tmp_tmp1 = ANDDI (ADDDI (GET_H_ACCUM (), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1943 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
1945 DI opval = SRADI (SLLDI (tmp_tmp1, 7), 7);
1946 SET_H_ACCUM (opval);
1947 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1958 SEM_FN_NAME (m32rbf,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1960 #define FLD(f) abuf->fields.fmt_empty.f
1961 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1962 int UNUSED written = 0;
1963 IADDR UNUSED pc = abuf->addr;
1965 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1969 USI opval = ANDSI (GET_H_CR (((UINT) 6)), -4);
1970 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1971 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1974 USI opval = GET_H_CR (((UINT) 14));
1975 SET_H_CR (((UINT) 6), opval);
1976 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
1979 UQI opval = CPU (h_bpsw);
1981 TRACE_RESULT (current_cpu, abuf, "psw", 'x', opval);
1984 UQI opval = CPU (h_bbpsw);
1985 CPU (h_bpsw) = opval;
1986 TRACE_RESULT (current_cpu, abuf, "bpsw", 'x', opval);
1990 SEM_BRANCH_FINI (vpc);
1995 /* seth: seth $dr,$hash$hi16 */
1998 SEM_FN_NAME (m32rbf,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2000 #define FLD(f) abuf->fields.sfmt_seth.f
2001 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2002 int UNUSED written = 0;
2003 IADDR UNUSED pc = abuf->addr;
2004 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2007 SI opval = SLLSI (FLD (f_hi16), 16);
2008 * FLD (i_dr) = opval;
2009 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2016 /* sll: sll $dr,$sr */
2019 SEM_FN_NAME (m32rbf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2021 #define FLD(f) abuf->fields.sfmt_add.f
2022 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2023 int UNUSED written = 0;
2024 IADDR UNUSED pc = abuf->addr;
2025 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2028 SI opval = SLLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2029 * FLD (i_dr) = opval;
2030 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2037 /* sll3: sll3 $dr,$sr,$simm16 */
2040 SEM_FN_NAME (m32rbf,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2042 #define FLD(f) abuf->fields.sfmt_add3.f
2043 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2044 int UNUSED written = 0;
2045 IADDR UNUSED pc = abuf->addr;
2046 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2049 SI opval = SLLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2050 * FLD (i_dr) = opval;
2051 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2058 /* slli: slli $dr,$uimm5 */
2061 SEM_FN_NAME (m32rbf,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2063 #define FLD(f) abuf->fields.sfmt_slli.f
2064 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2065 int UNUSED written = 0;
2066 IADDR UNUSED pc = abuf->addr;
2067 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2070 SI opval = SLLSI (* FLD (i_dr), FLD (f_uimm5));
2071 * FLD (i_dr) = opval;
2072 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2079 /* sra: sra $dr,$sr */
2082 SEM_FN_NAME (m32rbf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2084 #define FLD(f) abuf->fields.sfmt_add.f
2085 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2086 int UNUSED written = 0;
2087 IADDR UNUSED pc = abuf->addr;
2088 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2091 SI opval = SRASI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2092 * FLD (i_dr) = opval;
2093 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2100 /* sra3: sra3 $dr,$sr,$simm16 */
2103 SEM_FN_NAME (m32rbf,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2105 #define FLD(f) abuf->fields.sfmt_add3.f
2106 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2107 int UNUSED written = 0;
2108 IADDR UNUSED pc = abuf->addr;
2109 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2112 SI opval = SRASI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2113 * FLD (i_dr) = opval;
2114 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2121 /* srai: srai $dr,$uimm5 */
2124 SEM_FN_NAME (m32rbf,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2126 #define FLD(f) abuf->fields.sfmt_slli.f
2127 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2128 int UNUSED written = 0;
2129 IADDR UNUSED pc = abuf->addr;
2130 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2133 SI opval = SRASI (* FLD (i_dr), FLD (f_uimm5));
2134 * FLD (i_dr) = opval;
2135 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2142 /* srl: srl $dr,$sr */
2145 SEM_FN_NAME (m32rbf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2147 #define FLD(f) abuf->fields.sfmt_add.f
2148 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2149 int UNUSED written = 0;
2150 IADDR UNUSED pc = abuf->addr;
2151 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2154 SI opval = SRLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2155 * FLD (i_dr) = opval;
2156 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2163 /* srl3: srl3 $dr,$sr,$simm16 */
2166 SEM_FN_NAME (m32rbf,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2168 #define FLD(f) abuf->fields.sfmt_add3.f
2169 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2170 int UNUSED written = 0;
2171 IADDR UNUSED pc = abuf->addr;
2172 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2175 SI opval = SRLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2176 * FLD (i_dr) = opval;
2177 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2184 /* srli: srli $dr,$uimm5 */
2187 SEM_FN_NAME (m32rbf,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2189 #define FLD(f) abuf->fields.sfmt_slli.f
2190 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2191 int UNUSED written = 0;
2192 IADDR UNUSED pc = abuf->addr;
2193 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2196 SI opval = SRLSI (* FLD (i_dr), FLD (f_uimm5));
2197 * FLD (i_dr) = opval;
2198 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2205 /* st: st $src1,@$src2 */
2208 SEM_FN_NAME (m32rbf,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2210 #define FLD(f) abuf->fields.sfmt_st_plus.f
2211 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2212 int UNUSED written = 0;
2213 IADDR UNUSED pc = abuf->addr;
2214 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2217 SI opval = * FLD (i_src1);
2218 SETMEMSI (current_cpu, pc, * FLD (i_src2), opval);
2219 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2226 /* st-d: st $src1,@($slo16,$src2) */
2229 SEM_FN_NAME (m32rbf,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2231 #define FLD(f) abuf->fields.sfmt_st_d.f
2232 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2233 int UNUSED written = 0;
2234 IADDR UNUSED pc = abuf->addr;
2235 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2238 SI opval = * FLD (i_src1);
2239 SETMEMSI (current_cpu, pc, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2240 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2247 /* stb: stb $src1,@$src2 */
2250 SEM_FN_NAME (m32rbf,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2252 #define FLD(f) abuf->fields.sfmt_st_plus.f
2253 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2254 int UNUSED written = 0;
2255 IADDR UNUSED pc = abuf->addr;
2256 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2259 QI opval = * FLD (i_src1);
2260 SETMEMQI (current_cpu, pc, * FLD (i_src2), opval);
2261 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2268 /* stb-d: stb $src1,@($slo16,$src2) */
2271 SEM_FN_NAME (m32rbf,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2273 #define FLD(f) abuf->fields.sfmt_st_d.f
2274 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2275 int UNUSED written = 0;
2276 IADDR UNUSED pc = abuf->addr;
2277 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2280 QI opval = * FLD (i_src1);
2281 SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2282 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2289 /* sth: sth $src1,@$src2 */
2292 SEM_FN_NAME (m32rbf,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2294 #define FLD(f) abuf->fields.sfmt_st_plus.f
2295 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2296 int UNUSED written = 0;
2297 IADDR UNUSED pc = abuf->addr;
2298 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2301 HI opval = * FLD (i_src1);
2302 SETMEMHI (current_cpu, pc, * FLD (i_src2), opval);
2303 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2310 /* sth-d: sth $src1,@($slo16,$src2) */
2313 SEM_FN_NAME (m32rbf,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2315 #define FLD(f) abuf->fields.sfmt_st_d.f
2316 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2317 int UNUSED written = 0;
2318 IADDR UNUSED pc = abuf->addr;
2319 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2322 HI opval = * FLD (i_src1);
2323 SETMEMHI (current_cpu, pc, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2324 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2331 /* st-plus: st $src1,@+$src2 */
2334 SEM_FN_NAME (m32rbf,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2336 #define FLD(f) abuf->fields.sfmt_st_plus.f
2337 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2338 int UNUSED written = 0;
2339 IADDR UNUSED pc = abuf->addr;
2340 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2344 tmp_new_src2 = ADDSI (* FLD (i_src2), 4);
2346 SI opval = * FLD (i_src1);
2347 SETMEMSI (current_cpu, pc, tmp_new_src2, opval);
2348 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2351 SI opval = tmp_new_src2;
2352 * FLD (i_src2) = opval;
2353 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
2361 /* st-minus: st $src1,@-$src2 */
2364 SEM_FN_NAME (m32rbf,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2366 #define FLD(f) abuf->fields.sfmt_st_plus.f
2367 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2368 int UNUSED written = 0;
2369 IADDR UNUSED pc = abuf->addr;
2370 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2374 tmp_new_src2 = SUBSI (* FLD (i_src2), 4);
2376 SI opval = * FLD (i_src1);
2377 SETMEMSI (current_cpu, pc, tmp_new_src2, opval);
2378 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2381 SI opval = tmp_new_src2;
2382 * FLD (i_src2) = opval;
2383 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
2391 /* sub: sub $dr,$sr */
2394 SEM_FN_NAME (m32rbf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2396 #define FLD(f) abuf->fields.sfmt_add.f
2397 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2398 int UNUSED written = 0;
2399 IADDR UNUSED pc = abuf->addr;
2400 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2403 SI opval = SUBSI (* FLD (i_dr), * FLD (i_sr));
2404 * FLD (i_dr) = opval;
2405 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2412 /* subv: subv $dr,$sr */
2415 SEM_FN_NAME (m32rbf,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2417 #define FLD(f) abuf->fields.sfmt_add.f
2418 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2419 int UNUSED written = 0;
2420 IADDR UNUSED pc = abuf->addr;
2421 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2425 temp0 = SUBSI (* FLD (i_dr), * FLD (i_sr));
2426 temp1 = SUBOFSI (* FLD (i_dr), * FLD (i_sr), 0);
2429 * FLD (i_dr) = opval;
2430 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2434 CPU (h_cond) = opval;
2435 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
2443 /* subx: subx $dr,$sr */
2446 SEM_FN_NAME (m32rbf,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2448 #define FLD(f) abuf->fields.sfmt_add.f
2449 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2450 int UNUSED written = 0;
2451 IADDR UNUSED pc = abuf->addr;
2452 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2456 temp0 = SUBCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
2457 temp1 = SUBCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
2460 * FLD (i_dr) = opval;
2461 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2465 CPU (h_cond) = opval;
2466 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
2474 /* trap: trap $uimm4 */
2477 SEM_FN_NAME (m32rbf,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2479 #define FLD(f) abuf->fields.sfmt_trap.f
2480 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2481 int UNUSED written = 0;
2482 IADDR UNUSED pc = abuf->addr;
2484 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2488 USI opval = GET_H_CR (((UINT) 6));
2489 SET_H_CR (((UINT) 14), opval);
2490 TRACE_RESULT (current_cpu, abuf, "cr-14", 'x', opval);
2493 USI opval = ADDSI (pc, 4);
2494 SET_H_CR (((UINT) 6), opval);
2495 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
2498 UQI opval = CPU (h_bpsw);
2499 CPU (h_bbpsw) = opval;
2500 TRACE_RESULT (current_cpu, abuf, "bbpsw", 'x', opval);
2503 UQI opval = GET_H_PSW ();
2504 CPU (h_bpsw) = opval;
2505 TRACE_RESULT (current_cpu, abuf, "bpsw", 'x', opval);
2508 UQI opval = ANDQI (GET_H_PSW (), 128);
2510 TRACE_RESULT (current_cpu, abuf, "psw", 'x', opval);
2513 SI opval = m32r_trap (current_cpu, pc, FLD (f_uimm4));
2514 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2515 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
2519 SEM_BRANCH_FINI (vpc);
2524 /* unlock: unlock $src1,@$src2 */
2527 SEM_FN_NAME (m32rbf,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2529 #define FLD(f) abuf->fields.sfmt_st_plus.f
2530 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2531 int UNUSED written = 0;
2532 IADDR UNUSED pc = abuf->addr;
2533 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2538 SI opval = * FLD (i_src1);
2539 SETMEMSI (current_cpu, pc, * FLD (i_src2), opval);
2540 written |= (1 << 4);
2541 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2546 CPU (h_lock) = opval;
2547 TRACE_RESULT (current_cpu, abuf, "lock", 'x', opval);
2551 abuf->written = written;
2556 /* Table of all semantic fns. */
2558 static const struct sem_fn_desc sem_fns[] = {
2559 { M32RBF_INSN_X_INVALID, SEM_FN_NAME (m32rbf,x_invalid) },
2560 { M32RBF_INSN_X_AFTER, SEM_FN_NAME (m32rbf,x_after) },
2561 { M32RBF_INSN_X_BEFORE, SEM_FN_NAME (m32rbf,x_before) },
2562 { M32RBF_INSN_X_CTI_CHAIN, SEM_FN_NAME (m32rbf,x_cti_chain) },
2563 { M32RBF_INSN_X_CHAIN, SEM_FN_NAME (m32rbf,x_chain) },
2564 { M32RBF_INSN_X_BEGIN, SEM_FN_NAME (m32rbf,x_begin) },
2565 { M32RBF_INSN_ADD, SEM_FN_NAME (m32rbf,add) },
2566 { M32RBF_INSN_ADD3, SEM_FN_NAME (m32rbf,add3) },
2567 { M32RBF_INSN_AND, SEM_FN_NAME (m32rbf,and) },
2568 { M32RBF_INSN_AND3, SEM_FN_NAME (m32rbf,and3) },
2569 { M32RBF_INSN_OR, SEM_FN_NAME (m32rbf,or) },
2570 { M32RBF_INSN_OR3, SEM_FN_NAME (m32rbf,or3) },
2571 { M32RBF_INSN_XOR, SEM_FN_NAME (m32rbf,xor) },
2572 { M32RBF_INSN_XOR3, SEM_FN_NAME (m32rbf,xor3) },
2573 { M32RBF_INSN_ADDI, SEM_FN_NAME (m32rbf,addi) },
2574 { M32RBF_INSN_ADDV, SEM_FN_NAME (m32rbf,addv) },
2575 { M32RBF_INSN_ADDV3, SEM_FN_NAME (m32rbf,addv3) },
2576 { M32RBF_INSN_ADDX, SEM_FN_NAME (m32rbf,addx) },
2577 { M32RBF_INSN_BC8, SEM_FN_NAME (m32rbf,bc8) },
2578 { M32RBF_INSN_BC24, SEM_FN_NAME (m32rbf,bc24) },
2579 { M32RBF_INSN_BEQ, SEM_FN_NAME (m32rbf,beq) },
2580 { M32RBF_INSN_BEQZ, SEM_FN_NAME (m32rbf,beqz) },
2581 { M32RBF_INSN_BGEZ, SEM_FN_NAME (m32rbf,bgez) },
2582 { M32RBF_INSN_BGTZ, SEM_FN_NAME (m32rbf,bgtz) },
2583 { M32RBF_INSN_BLEZ, SEM_FN_NAME (m32rbf,blez) },
2584 { M32RBF_INSN_BLTZ, SEM_FN_NAME (m32rbf,bltz) },
2585 { M32RBF_INSN_BNEZ, SEM_FN_NAME (m32rbf,bnez) },
2586 { M32RBF_INSN_BL8, SEM_FN_NAME (m32rbf,bl8) },
2587 { M32RBF_INSN_BL24, SEM_FN_NAME (m32rbf,bl24) },
2588 { M32RBF_INSN_BNC8, SEM_FN_NAME (m32rbf,bnc8) },
2589 { M32RBF_INSN_BNC24, SEM_FN_NAME (m32rbf,bnc24) },
2590 { M32RBF_INSN_BNE, SEM_FN_NAME (m32rbf,bne) },
2591 { M32RBF_INSN_BRA8, SEM_FN_NAME (m32rbf,bra8) },
2592 { M32RBF_INSN_BRA24, SEM_FN_NAME (m32rbf,bra24) },
2593 { M32RBF_INSN_CMP, SEM_FN_NAME (m32rbf,cmp) },
2594 { M32RBF_INSN_CMPI, SEM_FN_NAME (m32rbf,cmpi) },
2595 { M32RBF_INSN_CMPU, SEM_FN_NAME (m32rbf,cmpu) },
2596 { M32RBF_INSN_CMPUI, SEM_FN_NAME (m32rbf,cmpui) },
2597 { M32RBF_INSN_DIV, SEM_FN_NAME (m32rbf,div) },
2598 { M32RBF_INSN_DIVU, SEM_FN_NAME (m32rbf,divu) },
2599 { M32RBF_INSN_REM, SEM_FN_NAME (m32rbf,rem) },
2600 { M32RBF_INSN_REMU, SEM_FN_NAME (m32rbf,remu) },
2601 { M32RBF_INSN_JL, SEM_FN_NAME (m32rbf,jl) },
2602 { M32RBF_INSN_JMP, SEM_FN_NAME (m32rbf,jmp) },
2603 { M32RBF_INSN_LD, SEM_FN_NAME (m32rbf,ld) },
2604 { M32RBF_INSN_LD_D, SEM_FN_NAME (m32rbf,ld_d) },
2605 { M32RBF_INSN_LDB, SEM_FN_NAME (m32rbf,ldb) },
2606 { M32RBF_INSN_LDB_D, SEM_FN_NAME (m32rbf,ldb_d) },
2607 { M32RBF_INSN_LDH, SEM_FN_NAME (m32rbf,ldh) },
2608 { M32RBF_INSN_LDH_D, SEM_FN_NAME (m32rbf,ldh_d) },
2609 { M32RBF_INSN_LDUB, SEM_FN_NAME (m32rbf,ldub) },
2610 { M32RBF_INSN_LDUB_D, SEM_FN_NAME (m32rbf,ldub_d) },
2611 { M32RBF_INSN_LDUH, SEM_FN_NAME (m32rbf,lduh) },
2612 { M32RBF_INSN_LDUH_D, SEM_FN_NAME (m32rbf,lduh_d) },
2613 { M32RBF_INSN_LD_PLUS, SEM_FN_NAME (m32rbf,ld_plus) },
2614 { M32RBF_INSN_LD24, SEM_FN_NAME (m32rbf,ld24) },
2615 { M32RBF_INSN_LDI8, SEM_FN_NAME (m32rbf,ldi8) },
2616 { M32RBF_INSN_LDI16, SEM_FN_NAME (m32rbf,ldi16) },
2617 { M32RBF_INSN_LOCK, SEM_FN_NAME (m32rbf,lock) },
2618 { M32RBF_INSN_MACHI, SEM_FN_NAME (m32rbf,machi) },
2619 { M32RBF_INSN_MACLO, SEM_FN_NAME (m32rbf,maclo) },
2620 { M32RBF_INSN_MACWHI, SEM_FN_NAME (m32rbf,macwhi) },
2621 { M32RBF_INSN_MACWLO, SEM_FN_NAME (m32rbf,macwlo) },
2622 { M32RBF_INSN_MUL, SEM_FN_NAME (m32rbf,mul) },
2623 { M32RBF_INSN_MULHI, SEM_FN_NAME (m32rbf,mulhi) },
2624 { M32RBF_INSN_MULLO, SEM_FN_NAME (m32rbf,mullo) },
2625 { M32RBF_INSN_MULWHI, SEM_FN_NAME (m32rbf,mulwhi) },
2626 { M32RBF_INSN_MULWLO, SEM_FN_NAME (m32rbf,mulwlo) },
2627 { M32RBF_INSN_MV, SEM_FN_NAME (m32rbf,mv) },
2628 { M32RBF_INSN_MVFACHI, SEM_FN_NAME (m32rbf,mvfachi) },
2629 { M32RBF_INSN_MVFACLO, SEM_FN_NAME (m32rbf,mvfaclo) },
2630 { M32RBF_INSN_MVFACMI, SEM_FN_NAME (m32rbf,mvfacmi) },
2631 { M32RBF_INSN_MVFC, SEM_FN_NAME (m32rbf,mvfc) },
2632 { M32RBF_INSN_MVTACHI, SEM_FN_NAME (m32rbf,mvtachi) },
2633 { M32RBF_INSN_MVTACLO, SEM_FN_NAME (m32rbf,mvtaclo) },
2634 { M32RBF_INSN_MVTC, SEM_FN_NAME (m32rbf,mvtc) },
2635 { M32RBF_INSN_NEG, SEM_FN_NAME (m32rbf,neg) },
2636 { M32RBF_INSN_NOP, SEM_FN_NAME (m32rbf,nop) },
2637 { M32RBF_INSN_NOT, SEM_FN_NAME (m32rbf,not) },
2638 { M32RBF_INSN_RAC, SEM_FN_NAME (m32rbf,rac) },
2639 { M32RBF_INSN_RACH, SEM_FN_NAME (m32rbf,rach) },
2640 { M32RBF_INSN_RTE, SEM_FN_NAME (m32rbf,rte) },
2641 { M32RBF_INSN_SETH, SEM_FN_NAME (m32rbf,seth) },
2642 { M32RBF_INSN_SLL, SEM_FN_NAME (m32rbf,sll) },
2643 { M32RBF_INSN_SLL3, SEM_FN_NAME (m32rbf,sll3) },
2644 { M32RBF_INSN_SLLI, SEM_FN_NAME (m32rbf,slli) },
2645 { M32RBF_INSN_SRA, SEM_FN_NAME (m32rbf,sra) },
2646 { M32RBF_INSN_SRA3, SEM_FN_NAME (m32rbf,sra3) },
2647 { M32RBF_INSN_SRAI, SEM_FN_NAME (m32rbf,srai) },
2648 { M32RBF_INSN_SRL, SEM_FN_NAME (m32rbf,srl) },
2649 { M32RBF_INSN_SRL3, SEM_FN_NAME (m32rbf,srl3) },
2650 { M32RBF_INSN_SRLI, SEM_FN_NAME (m32rbf,srli) },
2651 { M32RBF_INSN_ST, SEM_FN_NAME (m32rbf,st) },
2652 { M32RBF_INSN_ST_D, SEM_FN_NAME (m32rbf,st_d) },
2653 { M32RBF_INSN_STB, SEM_FN_NAME (m32rbf,stb) },
2654 { M32RBF_INSN_STB_D, SEM_FN_NAME (m32rbf,stb_d) },
2655 { M32RBF_INSN_STH, SEM_FN_NAME (m32rbf,sth) },
2656 { M32RBF_INSN_STH_D, SEM_FN_NAME (m32rbf,sth_d) },
2657 { M32RBF_INSN_ST_PLUS, SEM_FN_NAME (m32rbf,st_plus) },
2658 { M32RBF_INSN_ST_MINUS, SEM_FN_NAME (m32rbf,st_minus) },
2659 { M32RBF_INSN_SUB, SEM_FN_NAME (m32rbf,sub) },
2660 { M32RBF_INSN_SUBV, SEM_FN_NAME (m32rbf,subv) },
2661 { M32RBF_INSN_SUBX, SEM_FN_NAME (m32rbf,subx) },
2662 { M32RBF_INSN_TRAP, SEM_FN_NAME (m32rbf,trap) },
2663 { M32RBF_INSN_UNLOCK, SEM_FN_NAME (m32rbf,unlock) },
2667 /* Add the semantic fns to IDESC_TABLE. */
2670 SEM_FN_NAME (m32rbf,init_idesc_table) (SIM_CPU *current_cpu)
2672 IDESC *idesc_table = CPU_IDESC (current_cpu);
2673 const struct sem_fn_desc *sf;
2675 for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
2678 idesc_table[sf->index].sem_fast = sf->fn;
2680 idesc_table[sf->index].sem_full = sf->fn;