1 /* Simulator instruction semantics for m32rbf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 1996, 1997, 1998 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.
26 #define WANT_CPU_M32RBF
33 #define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->idesc->opcode, CGEN_INSN_##attr)
35 /* x-invalid: --invalid-- */
38 SEM_FN_NAME (m32rbf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
40 #define FLD(f) abuf->fields.fmt_empty.f
41 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
42 int UNUSED written = 0;
43 PCADDR UNUSED pc = abuf->addr;
44 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
48 /* Update the recorded pc in the cpu state struct. */
51 sim_engine_invalid_insn (current_cpu, pc);
52 sim_io_error (CPU_STATE (current_cpu), "invalid insn not handled\n");
60 /* x-after: --after-- */
63 SEM_FN_NAME (m32rbf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
65 #define FLD(f) abuf->fields.fmt_empty.f
66 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
67 int UNUSED written = 0;
68 PCADDR UNUSED pc = abuf->addr;
69 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
73 m32rbf_pbb_after (current_cpu, sem_arg);
81 /* x-before: --before-- */
84 SEM_FN_NAME (m32rbf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
86 #define FLD(f) abuf->fields.fmt_empty.f
87 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
88 int UNUSED written = 0;
89 PCADDR UNUSED pc = abuf->addr;
90 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
94 m32rbf_pbb_before (current_cpu, sem_arg);
102 /* x-cti-chain: --cti-chain-- */
105 SEM_FN_NAME (m32rbf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
107 #define FLD(f) abuf->fields.fmt_empty.f
108 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
109 int UNUSED written = 0;
110 PCADDR UNUSED pc = abuf->addr;
111 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
116 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
117 pbb_br_npc_ptr, pbb_br_npc);
120 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
121 vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
122 CPU_PBB_BR_NPC_PTR (current_cpu),
123 CPU_PBB_BR_NPC (current_cpu));
132 /* x-chain: --chain-- */
135 SEM_FN_NAME (m32rbf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
137 #define FLD(f) abuf->fields.fmt_empty.f
138 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
139 int UNUSED written = 0;
140 PCADDR UNUSED pc = abuf->addr;
141 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
145 vpc = m32rbf_pbb_chain (current_cpu, sem_arg);
156 /* x-begin: --begin-- */
159 SEM_FN_NAME (m32rbf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
161 #define FLD(f) abuf->fields.fmt_empty.f
162 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
163 int UNUSED written = 0;
164 PCADDR UNUSED pc = abuf->addr;
165 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
170 /* In the switch case FAST_P is a constant, allowing several optimizations
171 in any called inline functions. */
172 vpc = m32rbf_pbb_begin (current_cpu, FAST_P);
174 vpc = m32rbf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
183 /* add: add $dr,$sr */
186 SEM_FN_NAME (m32rbf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
188 #define FLD(f) abuf->fields.fmt_add.f
189 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
190 int UNUSED written = 0;
191 PCADDR UNUSED pc = abuf->addr;
192 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
195 SI opval = ADDSI (* FLD (i_dr), * FLD (i_sr));
196 * FLD (i_dr) = opval;
197 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
204 /* add3: add3 $dr,$sr,$hash$slo16 */
207 SEM_FN_NAME (m32rbf,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
209 #define FLD(f) abuf->fields.fmt_add3.f
210 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
211 int UNUSED written = 0;
212 PCADDR UNUSED pc = abuf->addr;
213 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
216 SI opval = ADDSI (* FLD (i_sr), FLD (f_simm16));
217 * FLD (i_dr) = opval;
218 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
225 /* and: and $dr,$sr */
228 SEM_FN_NAME (m32rbf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
230 #define FLD(f) abuf->fields.fmt_add.f
231 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
232 int UNUSED written = 0;
233 PCADDR UNUSED pc = abuf->addr;
234 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
237 SI opval = ANDSI (* FLD (i_dr), * FLD (i_sr));
238 * FLD (i_dr) = opval;
239 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
246 /* and3: and3 $dr,$sr,$uimm16 */
249 SEM_FN_NAME (m32rbf,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
251 #define FLD(f) abuf->fields.fmt_and3.f
252 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
253 int UNUSED written = 0;
254 PCADDR UNUSED pc = abuf->addr;
255 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
258 SI opval = ANDSI (* FLD (i_sr), FLD (f_uimm16));
259 * FLD (i_dr) = opval;
260 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
270 SEM_FN_NAME (m32rbf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
272 #define FLD(f) abuf->fields.fmt_add.f
273 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
274 int UNUSED written = 0;
275 PCADDR UNUSED pc = abuf->addr;
276 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
279 SI opval = ORSI (* FLD (i_dr), * FLD (i_sr));
280 * FLD (i_dr) = opval;
281 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
288 /* or3: or3 $dr,$sr,$hash$ulo16 */
291 SEM_FN_NAME (m32rbf,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
293 #define FLD(f) abuf->fields.fmt_or3.f
294 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
295 int UNUSED written = 0;
296 PCADDR UNUSED pc = abuf->addr;
297 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
300 SI opval = ORSI (* FLD (i_sr), FLD (f_uimm16));
301 * FLD (i_dr) = opval;
302 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
309 /* xor: xor $dr,$sr */
312 SEM_FN_NAME (m32rbf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
314 #define FLD(f) abuf->fields.fmt_add.f
315 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
316 int UNUSED written = 0;
317 PCADDR UNUSED pc = abuf->addr;
318 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
321 SI opval = XORSI (* FLD (i_dr), * FLD (i_sr));
322 * FLD (i_dr) = opval;
323 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
330 /* xor3: xor3 $dr,$sr,$uimm16 */
333 SEM_FN_NAME (m32rbf,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
335 #define FLD(f) abuf->fields.fmt_and3.f
336 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
337 int UNUSED written = 0;
338 PCADDR UNUSED pc = abuf->addr;
339 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
342 SI opval = XORSI (* FLD (i_sr), FLD (f_uimm16));
343 * FLD (i_dr) = opval;
344 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
351 /* addi: addi $dr,$simm8 */
354 SEM_FN_NAME (m32rbf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
356 #define FLD(f) abuf->fields.fmt_addi.f
357 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
358 int UNUSED written = 0;
359 PCADDR UNUSED pc = abuf->addr;
360 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
363 SI opval = ADDSI (* FLD (i_dr), FLD (f_simm8));
364 * FLD (i_dr) = opval;
365 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
372 /* addv: addv $dr,$sr */
375 SEM_FN_NAME (m32rbf,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
377 #define FLD(f) abuf->fields.fmt_addv.f
378 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
379 int UNUSED written = 0;
380 PCADDR UNUSED pc = abuf->addr;
381 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
385 temp0 = ADDSI (* FLD (i_dr), * FLD (i_sr));
386 temp1 = ADDOFSI (* FLD (i_dr), * FLD (i_sr), 0);
389 * FLD (i_dr) = opval;
390 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
394 CPU (h_cond) = opval;
395 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
403 /* addv3: addv3 $dr,$sr,$simm16 */
406 SEM_FN_NAME (m32rbf,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
408 #define FLD(f) abuf->fields.fmt_addv3.f
409 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
410 int UNUSED written = 0;
411 PCADDR UNUSED pc = abuf->addr;
412 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
416 temp0 = ADDSI (* FLD (i_sr), FLD (f_simm16));
417 temp1 = ADDOFSI (* FLD (i_sr), FLD (f_simm16), 0);
420 * FLD (i_dr) = opval;
421 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
425 CPU (h_cond) = opval;
426 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
434 /* addx: addx $dr,$sr */
437 SEM_FN_NAME (m32rbf,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
439 #define FLD(f) abuf->fields.fmt_addx.f
440 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
441 int UNUSED written = 0;
442 PCADDR UNUSED pc = abuf->addr;
443 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
447 temp0 = ADDCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
448 temp1 = ADDCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
451 * FLD (i_dr) = opval;
452 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
456 CPU (h_cond) = opval;
457 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
465 /* bc8: bc.s $disp8 */
468 SEM_FN_NAME (m32rbf,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
470 #define FLD(f) abuf->fields.cti.fields.fmt_bc8.f
471 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
472 int UNUSED written = 0;
473 PCADDR UNUSED pc = abuf->addr;
475 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
479 USI opval = FLD (i_disp8);
480 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
482 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
486 abuf->written = written;
492 /* bc24: bc.l $disp24 */
495 SEM_FN_NAME (m32rbf,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
497 #define FLD(f) abuf->fields.cti.fields.fmt_bc24.f
498 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
499 int UNUSED written = 0;
500 PCADDR UNUSED pc = abuf->addr;
502 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
506 USI opval = FLD (i_disp24);
507 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
509 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
513 abuf->written = written;
519 /* beq: beq $src1,$src2,$disp16 */
522 SEM_FN_NAME (m32rbf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
524 #define FLD(f) abuf->fields.cti.fields.fmt_beq.f
525 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
526 int UNUSED written = 0;
527 PCADDR UNUSED pc = abuf->addr;
529 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
531 if (EQSI (* FLD (i_src1), * FLD (i_src2))) {
533 USI opval = FLD (i_disp16);
534 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
536 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
540 abuf->written = written;
546 /* beqz: beqz $src2,$disp16 */
549 SEM_FN_NAME (m32rbf,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
551 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
552 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
553 int UNUSED written = 0;
554 PCADDR UNUSED pc = abuf->addr;
556 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
558 if (EQSI (* FLD (i_src2), 0)) {
560 USI opval = FLD (i_disp16);
561 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
563 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
567 abuf->written = written;
573 /* bgez: bgez $src2,$disp16 */
576 SEM_FN_NAME (m32rbf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
578 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
579 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
580 int UNUSED written = 0;
581 PCADDR UNUSED pc = abuf->addr;
583 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
585 if (GESI (* FLD (i_src2), 0)) {
587 USI opval = FLD (i_disp16);
588 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
590 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
594 abuf->written = written;
600 /* bgtz: bgtz $src2,$disp16 */
603 SEM_FN_NAME (m32rbf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
605 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
606 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
607 int UNUSED written = 0;
608 PCADDR UNUSED pc = abuf->addr;
610 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
612 if (GTSI (* FLD (i_src2), 0)) {
614 USI opval = FLD (i_disp16);
615 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
617 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
621 abuf->written = written;
627 /* blez: blez $src2,$disp16 */
630 SEM_FN_NAME (m32rbf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
632 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
633 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
634 int UNUSED written = 0;
635 PCADDR UNUSED pc = abuf->addr;
637 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
639 if (LESI (* FLD (i_src2), 0)) {
641 USI opval = FLD (i_disp16);
642 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
644 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
648 abuf->written = written;
654 /* bltz: bltz $src2,$disp16 */
657 SEM_FN_NAME (m32rbf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
659 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
660 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
661 int UNUSED written = 0;
662 PCADDR UNUSED pc = abuf->addr;
664 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
666 if (LTSI (* FLD (i_src2), 0)) {
668 USI opval = FLD (i_disp16);
669 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
671 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
675 abuf->written = written;
681 /* bnez: bnez $src2,$disp16 */
684 SEM_FN_NAME (m32rbf,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
686 #define FLD(f) abuf->fields.cti.fields.fmt_beqz.f
687 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
688 int UNUSED written = 0;
689 PCADDR UNUSED pc = abuf->addr;
691 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
693 if (NESI (* FLD (i_src2), 0)) {
695 USI opval = FLD (i_disp16);
696 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
698 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
702 abuf->written = written;
708 /* bl8: bl.s $disp8 */
711 SEM_FN_NAME (m32rbf,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
713 #define FLD(f) abuf->fields.cti.fields.fmt_bl8.f
714 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
715 int UNUSED written = 0;
716 PCADDR UNUSED pc = abuf->addr;
718 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
722 SI opval = ADDSI (ANDSI (pc, -4), 4);
723 CPU (h_gr[((UINT) 14)]) = opval;
724 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
727 USI opval = FLD (i_disp8);
728 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
729 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
738 /* bl24: bl.l $disp24 */
741 SEM_FN_NAME (m32rbf,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
743 #define FLD(f) abuf->fields.cti.fields.fmt_bl24.f
744 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
745 int UNUSED written = 0;
746 PCADDR UNUSED pc = abuf->addr;
748 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
752 SI opval = ADDSI (pc, 4);
753 CPU (h_gr[((UINT) 14)]) = opval;
754 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
757 USI opval = FLD (i_disp24);
758 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
759 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
768 /* bnc8: bnc.s $disp8 */
771 SEM_FN_NAME (m32rbf,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
773 #define FLD(f) abuf->fields.cti.fields.fmt_bc8.f
774 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
775 int UNUSED written = 0;
776 PCADDR UNUSED pc = abuf->addr;
778 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
780 if (NOTBI (CPU (h_cond))) {
782 USI opval = FLD (i_disp8);
783 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
785 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
789 abuf->written = written;
795 /* bnc24: bnc.l $disp24 */
798 SEM_FN_NAME (m32rbf,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
800 #define FLD(f) abuf->fields.cti.fields.fmt_bc24.f
801 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
802 int UNUSED written = 0;
803 PCADDR UNUSED pc = abuf->addr;
805 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
807 if (NOTBI (CPU (h_cond))) {
809 USI opval = FLD (i_disp24);
810 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
812 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
816 abuf->written = written;
822 /* bne: bne $src1,$src2,$disp16 */
825 SEM_FN_NAME (m32rbf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
827 #define FLD(f) abuf->fields.cti.fields.fmt_beq.f
828 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
829 int UNUSED written = 0;
830 PCADDR UNUSED pc = abuf->addr;
832 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
834 if (NESI (* FLD (i_src1), * FLD (i_src2))) {
836 USI opval = FLD (i_disp16);
837 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
839 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
843 abuf->written = written;
849 /* bra8: bra.s $disp8 */
852 SEM_FN_NAME (m32rbf,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
854 #define FLD(f) abuf->fields.cti.fields.fmt_bra8.f
855 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
856 int UNUSED written = 0;
857 PCADDR UNUSED pc = abuf->addr;
859 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
862 USI opval = FLD (i_disp8);
863 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
864 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
872 /* bra24: bra.l $disp24 */
875 SEM_FN_NAME (m32rbf,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
877 #define FLD(f) abuf->fields.cti.fields.fmt_bra24.f
878 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
879 int UNUSED written = 0;
880 PCADDR UNUSED pc = abuf->addr;
882 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
885 USI opval = FLD (i_disp24);
886 SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc, SEM_BRANCH_ADDR_CACHE (sem_arg));
887 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
895 /* cmp: cmp $src1,$src2 */
898 SEM_FN_NAME (m32rbf,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
900 #define FLD(f) abuf->fields.fmt_cmp.f
901 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
902 int UNUSED written = 0;
903 PCADDR UNUSED pc = abuf->addr;
904 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
907 BI opval = LTSI (* FLD (i_src1), * FLD (i_src2));
908 CPU (h_cond) = opval;
909 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
916 /* cmpi: cmpi $src2,$simm16 */
919 SEM_FN_NAME (m32rbf,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
921 #define FLD(f) abuf->fields.fmt_cmpi.f
922 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
923 int UNUSED written = 0;
924 PCADDR UNUSED pc = abuf->addr;
925 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
928 BI opval = LTSI (* FLD (i_src2), FLD (f_simm16));
929 CPU (h_cond) = opval;
930 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
937 /* cmpu: cmpu $src1,$src2 */
940 SEM_FN_NAME (m32rbf,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
942 #define FLD(f) abuf->fields.fmt_cmp.f
943 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
944 int UNUSED written = 0;
945 PCADDR UNUSED pc = abuf->addr;
946 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
949 BI opval = LTUSI (* FLD (i_src1), * FLD (i_src2));
950 CPU (h_cond) = opval;
951 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
958 /* cmpui: cmpui $src2,$simm16 */
961 SEM_FN_NAME (m32rbf,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
963 #define FLD(f) abuf->fields.fmt_cmpi.f
964 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
965 int UNUSED written = 0;
966 PCADDR UNUSED pc = abuf->addr;
967 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
970 BI opval = LTUSI (* FLD (i_src2), FLD (f_simm16));
971 CPU (h_cond) = opval;
972 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
979 /* div: div $dr,$sr */
982 SEM_FN_NAME (m32rbf,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
984 #define FLD(f) abuf->fields.fmt_div.f
985 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
986 int UNUSED written = 0;
987 PCADDR UNUSED pc = abuf->addr;
988 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
990 if (NESI (* FLD (i_sr), 0)) {
992 SI opval = DIVSI (* FLD (i_dr), * FLD (i_sr));
993 * FLD (i_dr) = opval;
995 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
999 abuf->written = written;
1004 /* divu: divu $dr,$sr */
1007 SEM_FN_NAME (m32rbf,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1009 #define FLD(f) abuf->fields.fmt_div.f
1010 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1011 int UNUSED written = 0;
1012 PCADDR UNUSED pc = abuf->addr;
1013 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1015 if (NESI (* FLD (i_sr), 0)) {
1017 SI opval = UDIVSI (* FLD (i_dr), * FLD (i_sr));
1018 * FLD (i_dr) = opval;
1019 written |= (1 << 2);
1020 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1024 abuf->written = written;
1029 /* rem: rem $dr,$sr */
1032 SEM_FN_NAME (m32rbf,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1034 #define FLD(f) abuf->fields.fmt_div.f
1035 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1036 int UNUSED written = 0;
1037 PCADDR UNUSED pc = abuf->addr;
1038 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1040 if (NESI (* FLD (i_sr), 0)) {
1042 SI opval = MODSI (* FLD (i_dr), * FLD (i_sr));
1043 * FLD (i_dr) = opval;
1044 written |= (1 << 2);
1045 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1049 abuf->written = written;
1054 /* remu: remu $dr,$sr */
1057 SEM_FN_NAME (m32rbf,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1059 #define FLD(f) abuf->fields.fmt_div.f
1060 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1061 int UNUSED written = 0;
1062 PCADDR UNUSED pc = abuf->addr;
1063 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1065 if (NESI (* FLD (i_sr), 0)) {
1067 SI opval = UMODSI (* FLD (i_dr), * FLD (i_sr));
1068 * FLD (i_dr) = opval;
1069 written |= (1 << 2);
1070 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1074 abuf->written = written;
1082 SEM_FN_NAME (m32rbf,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1084 #define FLD(f) abuf->fields.cti.fields.fmt_jl.f
1085 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1086 int UNUSED written = 0;
1087 PCADDR UNUSED pc = abuf->addr;
1089 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1093 temp0 = ADDSI (ANDSI (pc, -4), 4);
1094 temp1 = ANDSI (* FLD (i_sr), -4);
1097 CPU (h_gr[((UINT) 14)]) = opval;
1098 TRACE_RESULT (current_cpu, abuf, "gr-14", 'x', opval);
1102 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1103 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1115 SEM_FN_NAME (m32rbf,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1117 #define FLD(f) abuf->fields.cti.fields.fmt_jmp.f
1118 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1119 int UNUSED written = 0;
1120 PCADDR UNUSED pc = abuf->addr;
1122 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1125 USI opval = ANDSI (* FLD (i_sr), -4);
1126 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1127 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1135 /* ld: ld $dr,@$sr */
1138 SEM_FN_NAME (m32rbf,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1140 #define FLD(f) abuf->fields.fmt_ld.f
1141 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1142 int UNUSED written = 0;
1143 PCADDR UNUSED pc = abuf->addr;
1144 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1147 SI opval = GETMEMSI (current_cpu, * FLD (i_sr));
1148 * FLD (i_dr) = opval;
1149 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1156 /* ld-d: ld $dr,@($slo16,$sr) */
1159 SEM_FN_NAME (m32rbf,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1161 #define FLD(f) abuf->fields.fmt_ld_d.f
1162 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1163 int UNUSED written = 0;
1164 PCADDR UNUSED pc = abuf->addr;
1165 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1168 SI opval = GETMEMSI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16)));
1169 * FLD (i_dr) = opval;
1170 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1177 /* ldb: ldb $dr,@$sr */
1180 SEM_FN_NAME (m32rbf,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1182 #define FLD(f) abuf->fields.fmt_ldb.f
1183 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1184 int UNUSED written = 0;
1185 PCADDR UNUSED pc = abuf->addr;
1186 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1189 SI opval = EXTQISI (GETMEMQI (current_cpu, * FLD (i_sr)));
1190 * FLD (i_dr) = opval;
1191 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1198 /* ldb-d: ldb $dr,@($slo16,$sr) */
1201 SEM_FN_NAME (m32rbf,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1203 #define FLD(f) abuf->fields.fmt_ldb_d.f
1204 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1205 int UNUSED written = 0;
1206 PCADDR UNUSED pc = abuf->addr;
1207 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1210 SI opval = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1211 * FLD (i_dr) = opval;
1212 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1219 /* ldh: ldh $dr,@$sr */
1222 SEM_FN_NAME (m32rbf,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1224 #define FLD(f) abuf->fields.fmt_ldh.f
1225 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1226 int UNUSED written = 0;
1227 PCADDR UNUSED pc = abuf->addr;
1228 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1231 SI opval = EXTHISI (GETMEMHI (current_cpu, * FLD (i_sr)));
1232 * FLD (i_dr) = opval;
1233 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1240 /* ldh-d: ldh $dr,@($slo16,$sr) */
1243 SEM_FN_NAME (m32rbf,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1245 #define FLD(f) abuf->fields.fmt_ldh_d.f
1246 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1247 int UNUSED written = 0;
1248 PCADDR UNUSED pc = abuf->addr;
1249 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1252 SI opval = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1253 * FLD (i_dr) = opval;
1254 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1261 /* ldub: ldub $dr,@$sr */
1264 SEM_FN_NAME (m32rbf,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1266 #define FLD(f) abuf->fields.fmt_ldb.f
1267 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1268 int UNUSED written = 0;
1269 PCADDR UNUSED pc = abuf->addr;
1270 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1273 SI opval = ZEXTQISI (GETMEMQI (current_cpu, * FLD (i_sr)));
1274 * FLD (i_dr) = opval;
1275 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1282 /* ldub-d: ldub $dr,@($slo16,$sr) */
1285 SEM_FN_NAME (m32rbf,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1287 #define FLD(f) abuf->fields.fmt_ldb_d.f
1288 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1289 int UNUSED written = 0;
1290 PCADDR UNUSED pc = abuf->addr;
1291 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1294 SI opval = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1295 * FLD (i_dr) = opval;
1296 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1303 /* lduh: lduh $dr,@$sr */
1306 SEM_FN_NAME (m32rbf,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1308 #define FLD(f) abuf->fields.fmt_ldh.f
1309 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1310 int UNUSED written = 0;
1311 PCADDR UNUSED pc = abuf->addr;
1312 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1315 SI opval = ZEXTHISI (GETMEMHI (current_cpu, * FLD (i_sr)));
1316 * FLD (i_dr) = opval;
1317 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1324 /* lduh-d: lduh $dr,@($slo16,$sr) */
1327 SEM_FN_NAME (m32rbf,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1329 #define FLD(f) abuf->fields.fmt_ldh_d.f
1330 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1331 int UNUSED written = 0;
1332 PCADDR UNUSED pc = abuf->addr;
1333 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1336 SI opval = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (i_sr), FLD (f_simm16))));
1337 * FLD (i_dr) = opval;
1338 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1345 /* ld-plus: ld $dr,@$sr+ */
1348 SEM_FN_NAME (m32rbf,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1350 #define FLD(f) abuf->fields.fmt_ld_plus.f
1351 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1352 int UNUSED written = 0;
1353 PCADDR UNUSED pc = abuf->addr;
1354 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1358 temp0 = GETMEMSI (current_cpu, * FLD (i_sr));
1359 temp1 = ADDSI (* FLD (i_sr), 4);
1362 * FLD (i_dr) = opval;
1363 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1367 * FLD (i_sr) = opval;
1368 TRACE_RESULT (current_cpu, abuf, "sr", 'x', opval);
1376 /* ld24: ld24 $dr,$uimm24 */
1379 SEM_FN_NAME (m32rbf,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1381 #define FLD(f) abuf->fields.fmt_ld24.f
1382 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1383 int UNUSED written = 0;
1384 PCADDR UNUSED pc = abuf->addr;
1385 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1388 SI opval = FLD (i_uimm24);
1389 * FLD (i_dr) = opval;
1390 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1397 /* ldi8: ldi8 $dr,$simm8 */
1400 SEM_FN_NAME (m32rbf,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1402 #define FLD(f) abuf->fields.fmt_ldi8.f
1403 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1404 int UNUSED written = 0;
1405 PCADDR UNUSED pc = abuf->addr;
1406 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1409 SI opval = FLD (f_simm8);
1410 * FLD (i_dr) = opval;
1411 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1418 /* ldi16: ldi16 $dr,$hash$slo16 */
1421 SEM_FN_NAME (m32rbf,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1423 #define FLD(f) abuf->fields.fmt_ldi16.f
1424 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1425 int UNUSED written = 0;
1426 PCADDR UNUSED pc = abuf->addr;
1427 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1430 SI opval = FLD (f_simm16);
1431 * FLD (i_dr) = opval;
1432 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1439 /* lock: lock $dr,@$sr */
1442 SEM_FN_NAME (m32rbf,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1444 #define FLD(f) abuf->fields.fmt_lock.f
1445 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1446 int UNUSED written = 0;
1447 PCADDR UNUSED pc = abuf->addr;
1448 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1453 CPU (h_lock) = opval;
1454 TRACE_RESULT (current_cpu, abuf, "lock-0", 'x', opval);
1457 SI opval = GETMEMSI (current_cpu, * FLD (i_sr));
1458 * FLD (i_dr) = opval;
1459 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1467 /* machi: machi $src1,$src2 */
1470 SEM_FN_NAME (m32rbf,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1472 #define FLD(f) abuf->fields.fmt_machi.f
1473 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1474 int UNUSED written = 0;
1475 PCADDR UNUSED pc = abuf->addr;
1476 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1479 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
1480 m32rbf_h_accum_set (current_cpu, opval);
1481 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1488 /* maclo: maclo $src1,$src2 */
1491 SEM_FN_NAME (m32rbf,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1493 #define FLD(f) abuf->fields.fmt_machi.f
1494 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1495 int UNUSED written = 0;
1496 PCADDR UNUSED pc = abuf->addr;
1497 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1500 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
1501 m32rbf_h_accum_set (current_cpu, opval);
1502 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1509 /* macwhi: macwhi $src1,$src2 */
1512 SEM_FN_NAME (m32rbf,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1514 #define FLD(f) abuf->fields.fmt_machi.f
1515 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1516 int UNUSED written = 0;
1517 PCADDR UNUSED pc = abuf->addr;
1518 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1521 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
1522 m32rbf_h_accum_set (current_cpu, opval);
1523 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1530 /* macwlo: macwlo $src1,$src2 */
1533 SEM_FN_NAME (m32rbf,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1535 #define FLD(f) abuf->fields.fmt_machi.f
1536 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1537 int UNUSED written = 0;
1538 PCADDR UNUSED pc = abuf->addr;
1539 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1542 DI opval = SRADI (SLLDI (ADDDI (m32rbf_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
1543 m32rbf_h_accum_set (current_cpu, opval);
1544 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1551 /* mul: mul $dr,$sr */
1554 SEM_FN_NAME (m32rbf,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1556 #define FLD(f) abuf->fields.fmt_add.f
1557 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1558 int UNUSED written = 0;
1559 PCADDR UNUSED pc = abuf->addr;
1560 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1563 SI opval = MULSI (* FLD (i_dr), * FLD (i_sr));
1564 * FLD (i_dr) = opval;
1565 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1572 /* mulhi: mulhi $src1,$src2 */
1575 SEM_FN_NAME (m32rbf,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1577 #define FLD(f) abuf->fields.fmt_mulhi.f
1578 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1579 int UNUSED written = 0;
1580 PCADDR UNUSED pc = abuf->addr;
1581 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1584 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 16), 16);
1585 m32rbf_h_accum_set (current_cpu, opval);
1586 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1593 /* mullo: mullo $src1,$src2 */
1596 SEM_FN_NAME (m32rbf,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1598 #define FLD(f) abuf->fields.fmt_mulhi.f
1599 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1600 int UNUSED written = 0;
1601 PCADDR UNUSED pc = abuf->addr;
1602 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1605 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 16), 16);
1606 m32rbf_h_accum_set (current_cpu, opval);
1607 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1614 /* mulwhi: mulwhi $src1,$src2 */
1617 SEM_FN_NAME (m32rbf,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1619 #define FLD(f) abuf->fields.fmt_mulhi.f
1620 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1621 int UNUSED written = 0;
1622 PCADDR UNUSED pc = abuf->addr;
1623 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1626 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 8), 8);
1627 m32rbf_h_accum_set (current_cpu, opval);
1628 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1635 /* mulwlo: mulwlo $src1,$src2 */
1638 SEM_FN_NAME (m32rbf,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1640 #define FLD(f) abuf->fields.fmt_mulhi.f
1641 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1642 int UNUSED written = 0;
1643 PCADDR UNUSED pc = abuf->addr;
1644 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1647 DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 8), 8);
1648 m32rbf_h_accum_set (current_cpu, opval);
1649 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1656 /* mv: mv $dr,$sr */
1659 SEM_FN_NAME (m32rbf,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1661 #define FLD(f) abuf->fields.fmt_mv.f
1662 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1663 int UNUSED written = 0;
1664 PCADDR UNUSED pc = abuf->addr;
1665 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1668 SI opval = * FLD (i_sr);
1669 * FLD (i_dr) = opval;
1670 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1677 /* mvfachi: mvfachi $dr */
1680 SEM_FN_NAME (m32rbf,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1682 #define FLD(f) abuf->fields.fmt_mvfachi.f
1683 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1684 int UNUSED written = 0;
1685 PCADDR UNUSED pc = abuf->addr;
1686 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1689 SI opval = TRUNCDISI (SRADI (m32rbf_h_accum_get (current_cpu), 32));
1690 * FLD (i_dr) = opval;
1691 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1698 /* mvfaclo: mvfaclo $dr */
1701 SEM_FN_NAME (m32rbf,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1703 #define FLD(f) abuf->fields.fmt_mvfachi.f
1704 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1705 int UNUSED written = 0;
1706 PCADDR UNUSED pc = abuf->addr;
1707 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1710 SI opval = TRUNCDISI (m32rbf_h_accum_get (current_cpu));
1711 * FLD (i_dr) = opval;
1712 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1719 /* mvfacmi: mvfacmi $dr */
1722 SEM_FN_NAME (m32rbf,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1724 #define FLD(f) abuf->fields.fmt_mvfachi.f
1725 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1726 int UNUSED written = 0;
1727 PCADDR UNUSED pc = abuf->addr;
1728 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1731 SI opval = TRUNCDISI (SRADI (m32rbf_h_accum_get (current_cpu), 16));
1732 * FLD (i_dr) = opval;
1733 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1740 /* mvfc: mvfc $dr,$scr */
1743 SEM_FN_NAME (m32rbf,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1745 #define FLD(f) abuf->fields.fmt_mvfc.f
1746 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1747 int UNUSED written = 0;
1748 PCADDR UNUSED pc = abuf->addr;
1749 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1752 SI opval = m32rbf_h_cr_get (current_cpu, FLD (f_r2));
1753 * FLD (i_dr) = opval;
1754 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1761 /* mvtachi: mvtachi $src1 */
1764 SEM_FN_NAME (m32rbf,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1766 #define FLD(f) abuf->fields.fmt_mvtachi.f
1767 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1768 int UNUSED written = 0;
1769 PCADDR UNUSED pc = abuf->addr;
1770 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1773 DI opval = ORDI (ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1)), 32));
1774 m32rbf_h_accum_set (current_cpu, opval);
1775 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1782 /* mvtaclo: mvtaclo $src1 */
1785 SEM_FN_NAME (m32rbf,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1787 #define FLD(f) abuf->fields.fmt_mvtachi.f
1788 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1789 int UNUSED written = 0;
1790 PCADDR UNUSED pc = abuf->addr;
1791 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1794 DI opval = ORDI (ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1)));
1795 m32rbf_h_accum_set (current_cpu, opval);
1796 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1803 /* mvtc: mvtc $sr,$dcr */
1806 SEM_FN_NAME (m32rbf,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1808 #define FLD(f) abuf->fields.fmt_mvtc.f
1809 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1810 int UNUSED written = 0;
1811 PCADDR UNUSED pc = abuf->addr;
1812 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1815 USI opval = * FLD (i_sr);
1816 m32rbf_h_cr_set (current_cpu, FLD (f_r1), opval);
1817 TRACE_RESULT (current_cpu, abuf, "dcr", 'x', opval);
1824 /* neg: neg $dr,$sr */
1827 SEM_FN_NAME (m32rbf,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1829 #define FLD(f) abuf->fields.fmt_mv.f
1830 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1831 int UNUSED written = 0;
1832 PCADDR UNUSED pc = abuf->addr;
1833 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1836 SI opval = NEGSI (* FLD (i_sr));
1837 * FLD (i_dr) = opval;
1838 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1848 SEM_FN_NAME (m32rbf,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1850 #define FLD(f) abuf->fields.fmt_nop.f
1851 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1852 int UNUSED written = 0;
1853 PCADDR UNUSED pc = abuf->addr;
1854 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1856 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
1862 /* not: not $dr,$sr */
1865 SEM_FN_NAME (m32rbf,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1867 #define FLD(f) abuf->fields.fmt_mv.f
1868 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1869 int UNUSED written = 0;
1870 PCADDR UNUSED pc = abuf->addr;
1871 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1874 SI opval = INVSI (* FLD (i_sr));
1875 * FLD (i_dr) = opval;
1876 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
1886 SEM_FN_NAME (m32rbf,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1888 #define FLD(f) abuf->fields.fmt_rac.f
1889 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1890 int UNUSED written = 0;
1891 PCADDR UNUSED pc = abuf->addr;
1892 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1896 tmp_tmp1 = SLLDI (m32rbf_h_accum_get (current_cpu), 1);
1897 tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768));
1899 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)));
1900 m32rbf_h_accum_set (current_cpu, opval);
1901 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1912 SEM_FN_NAME (m32rbf,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1914 #define FLD(f) abuf->fields.fmt_rac.f
1915 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1916 int UNUSED written = 0;
1917 PCADDR UNUSED pc = abuf->addr;
1918 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1922 tmp_tmp1 = ANDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (16777215, 0xffffffff));
1923 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
1924 tmp_tmp1 = MAKEDI (16383, 0x80000000);
1926 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
1927 tmp_tmp1 = MAKEDI (16760832, 0);
1929 tmp_tmp1 = ANDDI (ADDDI (m32rbf_h_accum_get (current_cpu), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1932 tmp_tmp1 = SLLDI (tmp_tmp1, 1);
1934 DI opval = SRADI (SLLDI (tmp_tmp1, 7), 7);
1935 m32rbf_h_accum_set (current_cpu, opval);
1936 TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
1947 SEM_FN_NAME (m32rbf,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1949 #define FLD(f) abuf->fields.cti.fields.fmt_rte.f
1950 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1951 int UNUSED written = 0;
1952 PCADDR UNUSED pc = abuf->addr;
1954 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
1958 USI opval = ANDSI (m32rbf_h_cr_get (current_cpu, ((UINT) 6)), -4);
1959 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
1960 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
1963 USI opval = m32rbf_h_cr_get (current_cpu, ((UINT) 14));
1964 m32rbf_h_cr_set (current_cpu, ((UINT) 6), opval);
1965 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
1968 UQI opval = CPU (h_bpsw);
1969 m32rbf_h_psw_set (current_cpu, opval);
1970 TRACE_RESULT (current_cpu, abuf, "psw-0", 'x', opval);
1973 UQI opval = CPU (h_bbpsw);
1974 CPU (h_bpsw) = opval;
1975 TRACE_RESULT (current_cpu, abuf, "bpsw-0", 'x', opval);
1984 /* seth: seth $dr,$hash$hi16 */
1987 SEM_FN_NAME (m32rbf,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
1989 #define FLD(f) abuf->fields.fmt_seth.f
1990 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
1991 int UNUSED written = 0;
1992 PCADDR UNUSED pc = abuf->addr;
1993 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
1996 SI opval = SLLSI (FLD (f_hi16), 16);
1997 * FLD (i_dr) = opval;
1998 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2005 /* sll: sll $dr,$sr */
2008 SEM_FN_NAME (m32rbf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2010 #define FLD(f) abuf->fields.fmt_add.f
2011 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2012 int UNUSED written = 0;
2013 PCADDR UNUSED pc = abuf->addr;
2014 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2017 SI opval = SLLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2018 * FLD (i_dr) = opval;
2019 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2026 /* sll3: sll3 $dr,$sr,$simm16 */
2029 SEM_FN_NAME (m32rbf,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2031 #define FLD(f) abuf->fields.fmt_sll3.f
2032 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2033 int UNUSED written = 0;
2034 PCADDR UNUSED pc = abuf->addr;
2035 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2038 SI opval = SLLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2039 * FLD (i_dr) = opval;
2040 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2047 /* slli: slli $dr,$uimm5 */
2050 SEM_FN_NAME (m32rbf,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2052 #define FLD(f) abuf->fields.fmt_slli.f
2053 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2054 int UNUSED written = 0;
2055 PCADDR UNUSED pc = abuf->addr;
2056 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2059 SI opval = SLLSI (* FLD (i_dr), FLD (f_uimm5));
2060 * FLD (i_dr) = opval;
2061 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2068 /* sra: sra $dr,$sr */
2071 SEM_FN_NAME (m32rbf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2073 #define FLD(f) abuf->fields.fmt_add.f
2074 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2075 int UNUSED written = 0;
2076 PCADDR UNUSED pc = abuf->addr;
2077 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2080 SI opval = SRASI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2081 * FLD (i_dr) = opval;
2082 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2089 /* sra3: sra3 $dr,$sr,$simm16 */
2092 SEM_FN_NAME (m32rbf,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2094 #define FLD(f) abuf->fields.fmt_sll3.f
2095 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2096 int UNUSED written = 0;
2097 PCADDR UNUSED pc = abuf->addr;
2098 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2101 SI opval = SRASI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2102 * FLD (i_dr) = opval;
2103 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2110 /* srai: srai $dr,$uimm5 */
2113 SEM_FN_NAME (m32rbf,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2115 #define FLD(f) abuf->fields.fmt_slli.f
2116 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2117 int UNUSED written = 0;
2118 PCADDR UNUSED pc = abuf->addr;
2119 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2122 SI opval = SRASI (* FLD (i_dr), FLD (f_uimm5));
2123 * FLD (i_dr) = opval;
2124 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2131 /* srl: srl $dr,$sr */
2134 SEM_FN_NAME (m32rbf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2136 #define FLD(f) abuf->fields.fmt_add.f
2137 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2138 int UNUSED written = 0;
2139 PCADDR UNUSED pc = abuf->addr;
2140 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2143 SI opval = SRLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
2144 * FLD (i_dr) = opval;
2145 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2152 /* srl3: srl3 $dr,$sr,$simm16 */
2155 SEM_FN_NAME (m32rbf,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2157 #define FLD(f) abuf->fields.fmt_sll3.f
2158 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2159 int UNUSED written = 0;
2160 PCADDR UNUSED pc = abuf->addr;
2161 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2164 SI opval = SRLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
2165 * FLD (i_dr) = opval;
2166 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2173 /* srli: srli $dr,$uimm5 */
2176 SEM_FN_NAME (m32rbf,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2178 #define FLD(f) abuf->fields.fmt_slli.f
2179 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2180 int UNUSED written = 0;
2181 PCADDR UNUSED pc = abuf->addr;
2182 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2185 SI opval = SRLSI (* FLD (i_dr), FLD (f_uimm5));
2186 * FLD (i_dr) = opval;
2187 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2194 /* st: st $src1,@$src2 */
2197 SEM_FN_NAME (m32rbf,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2199 #define FLD(f) abuf->fields.fmt_st.f
2200 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2201 int UNUSED written = 0;
2202 PCADDR UNUSED pc = abuf->addr;
2203 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2206 SI opval = * FLD (i_src1);
2207 SETMEMSI (current_cpu, * FLD (i_src2), opval);
2208 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2215 /* st-d: st $src1,@($slo16,$src2) */
2218 SEM_FN_NAME (m32rbf,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2220 #define FLD(f) abuf->fields.fmt_st_d.f
2221 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2222 int UNUSED written = 0;
2223 PCADDR UNUSED pc = abuf->addr;
2224 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2227 SI opval = * FLD (i_src1);
2228 SETMEMSI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2229 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2236 /* stb: stb $src1,@$src2 */
2239 SEM_FN_NAME (m32rbf,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2241 #define FLD(f) abuf->fields.fmt_stb.f
2242 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2243 int UNUSED written = 0;
2244 PCADDR UNUSED pc = abuf->addr;
2245 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2248 QI opval = * FLD (i_src1);
2249 SETMEMQI (current_cpu, * FLD (i_src2), opval);
2250 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2257 /* stb-d: stb $src1,@($slo16,$src2) */
2260 SEM_FN_NAME (m32rbf,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2262 #define FLD(f) abuf->fields.fmt_stb_d.f
2263 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2264 int UNUSED written = 0;
2265 PCADDR UNUSED pc = abuf->addr;
2266 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2269 QI opval = * FLD (i_src1);
2270 SETMEMQI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2271 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2278 /* sth: sth $src1,@$src2 */
2281 SEM_FN_NAME (m32rbf,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2283 #define FLD(f) abuf->fields.fmt_sth.f
2284 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2285 int UNUSED written = 0;
2286 PCADDR UNUSED pc = abuf->addr;
2287 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2290 HI opval = * FLD (i_src1);
2291 SETMEMHI (current_cpu, * FLD (i_src2), opval);
2292 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2299 /* sth-d: sth $src1,@($slo16,$src2) */
2302 SEM_FN_NAME (m32rbf,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2304 #define FLD(f) abuf->fields.fmt_sth_d.f
2305 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2306 int UNUSED written = 0;
2307 PCADDR UNUSED pc = abuf->addr;
2308 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
2311 HI opval = * FLD (i_src1);
2312 SETMEMHI (current_cpu, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
2313 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2320 /* st-plus: st $src1,@+$src2 */
2323 SEM_FN_NAME (m32rbf,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2325 #define FLD(f) abuf->fields.fmt_st_plus.f
2326 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2327 int UNUSED written = 0;
2328 PCADDR UNUSED pc = abuf->addr;
2329 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2333 tmp_new_src2 = ADDSI (* FLD (i_src2), 4);
2335 SI opval = * FLD (i_src1);
2336 SETMEMSI (current_cpu, tmp_new_src2, opval);
2337 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2340 SI opval = tmp_new_src2;
2341 * FLD (i_src2) = opval;
2342 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
2350 /* st-minus: st $src1,@-$src2 */
2353 SEM_FN_NAME (m32rbf,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2355 #define FLD(f) abuf->fields.fmt_st_plus.f
2356 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2357 int UNUSED written = 0;
2358 PCADDR UNUSED pc = abuf->addr;
2359 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2363 tmp_new_src2 = SUBSI (* FLD (i_src2), 4);
2365 SI opval = * FLD (i_src1);
2366 SETMEMSI (current_cpu, tmp_new_src2, opval);
2367 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2370 SI opval = tmp_new_src2;
2371 * FLD (i_src2) = opval;
2372 TRACE_RESULT (current_cpu, abuf, "src2", 'x', opval);
2380 /* sub: sub $dr,$sr */
2383 SEM_FN_NAME (m32rbf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2385 #define FLD(f) abuf->fields.fmt_add.f
2386 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2387 int UNUSED written = 0;
2388 PCADDR UNUSED pc = abuf->addr;
2389 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2392 SI opval = SUBSI (* FLD (i_dr), * FLD (i_sr));
2393 * FLD (i_dr) = opval;
2394 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2401 /* subv: subv $dr,$sr */
2404 SEM_FN_NAME (m32rbf,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2406 #define FLD(f) abuf->fields.fmt_addv.f
2407 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2408 int UNUSED written = 0;
2409 PCADDR UNUSED pc = abuf->addr;
2410 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2414 temp0 = SUBSI (* FLD (i_dr), * FLD (i_sr));
2415 temp1 = SUBOFSI (* FLD (i_dr), * FLD (i_sr), 0);
2418 * FLD (i_dr) = opval;
2419 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2423 CPU (h_cond) = opval;
2424 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
2432 /* subx: subx $dr,$sr */
2435 SEM_FN_NAME (m32rbf,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2437 #define FLD(f) abuf->fields.fmt_addx.f
2438 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2439 int UNUSED written = 0;
2440 PCADDR UNUSED pc = abuf->addr;
2441 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2445 temp0 = SUBCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
2446 temp1 = SUBCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
2449 * FLD (i_dr) = opval;
2450 TRACE_RESULT (current_cpu, abuf, "dr", 'x', opval);
2454 CPU (h_cond) = opval;
2455 TRACE_RESULT (current_cpu, abuf, "condbit", 'x', opval);
2463 /* trap: trap $uimm4 */
2466 SEM_FN_NAME (m32rbf,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2468 #define FLD(f) abuf->fields.cti.fields.fmt_trap.f
2469 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2470 int UNUSED written = 0;
2471 PCADDR UNUSED pc = abuf->addr;
2473 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2477 USI opval = m32rbf_h_cr_get (current_cpu, ((UINT) 6));
2478 m32rbf_h_cr_set (current_cpu, ((UINT) 14), opval);
2479 TRACE_RESULT (current_cpu, abuf, "cr-14", 'x', opval);
2482 USI opval = ADDSI (pc, 4);
2483 m32rbf_h_cr_set (current_cpu, ((UINT) 6), opval);
2484 TRACE_RESULT (current_cpu, abuf, "cr-6", 'x', opval);
2487 UQI opval = CPU (h_bpsw);
2488 CPU (h_bbpsw) = opval;
2489 TRACE_RESULT (current_cpu, abuf, "bbpsw-0", 'x', opval);
2492 UQI opval = m32rbf_h_psw_get (current_cpu);
2493 CPU (h_bpsw) = opval;
2494 TRACE_RESULT (current_cpu, abuf, "bpsw-0", 'x', opval);
2497 UQI opval = ANDQI (m32rbf_h_psw_get (current_cpu), 128);
2498 m32rbf_h_psw_set (current_cpu, opval);
2499 TRACE_RESULT (current_cpu, abuf, "psw-0", 'x', opval);
2502 SI opval = m32r_trap (current_cpu, pc, FLD (f_uimm4));
2503 SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
2504 TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
2513 /* unlock: unlock $src1,@$src2 */
2516 SEM_FN_NAME (m32rbf,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
2518 #define FLD(f) abuf->fields.fmt_unlock.f
2519 ARGBUF *abuf = SEM_ARGBUF (sem_arg);
2520 int UNUSED written = 0;
2521 PCADDR UNUSED pc = abuf->addr;
2522 SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
2527 SI opval = * FLD (i_src1);
2528 SETMEMSI (current_cpu, * FLD (i_src2), opval);
2529 written |= (1 << 3);
2530 TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
2535 CPU (h_lock) = opval;
2536 TRACE_RESULT (current_cpu, abuf, "lock-0", 'x', opval);
2540 abuf->written = written;