1 /* Simulator instruction semantics for m32rbf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 1996-2024 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
9 This file is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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)
40 #undef CGEN_TRACE_RESULT
41 #define CGEN_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.sfmt_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);
58 /* Update the recorded pc in the cpu state struct.
59 Only necessary for WITH_SCACHE case, but to avoid the
60 conditional compilation .... */
62 /* Virtual insns have zero size. Overwrite vpc with address of next insn
63 using the default-insn-bitsize spec. When executing insns in parallel
64 we may want to queue the fault and continue execution. */
65 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
66 vpc
= sim_engine_invalid_insn (current_cpu
, pc
, vpc
);
73 /* x-after: --after-- */
76 SEM_FN_NAME (m32rbf
,x_after
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
78 #define FLD(f) abuf->fields.sfmt_empty.f
79 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
80 int UNUSED written
= 0;
81 IADDR UNUSED pc
= abuf
->addr
;
82 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
85 #if WITH_SCACHE_PBB_M32RBF
86 m32rbf_pbb_after (current_cpu
, sem_arg
);
94 /* x-before: --before-- */
97 SEM_FN_NAME (m32rbf
,x_before
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
99 #define FLD(f) abuf->fields.sfmt_empty.f
100 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
101 int UNUSED written
= 0;
102 IADDR UNUSED pc
= abuf
->addr
;
103 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
106 #if WITH_SCACHE_PBB_M32RBF
107 m32rbf_pbb_before (current_cpu
, sem_arg
);
115 /* x-cti-chain: --cti-chain-- */
118 SEM_FN_NAME (m32rbf
,x_cti_chain
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
120 #define FLD(f) abuf->fields.sfmt_empty.f
121 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
122 int UNUSED written
= 0;
123 IADDR UNUSED pc
= abuf
->addr
;
124 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
127 #if WITH_SCACHE_PBB_M32RBF
129 vpc
= m32rbf_pbb_cti_chain (current_cpu
, sem_arg
,
130 pbb_br_type
, pbb_br_npc
);
133 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
134 vpc
= m32rbf_pbb_cti_chain (current_cpu
, sem_arg
,
135 CPU_PBB_BR_TYPE (current_cpu
),
136 CPU_PBB_BR_NPC (current_cpu
));
145 /* x-chain: --chain-- */
148 SEM_FN_NAME (m32rbf
,x_chain
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
150 #define FLD(f) abuf->fields.sfmt_empty.f
151 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
152 int UNUSED written
= 0;
153 IADDR UNUSED pc
= abuf
->addr
;
154 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
157 #if WITH_SCACHE_PBB_M32RBF
158 vpc
= m32rbf_pbb_chain (current_cpu
, sem_arg
);
169 /* x-begin: --begin-- */
172 SEM_FN_NAME (m32rbf
,x_begin
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
174 #define FLD(f) abuf->fields.sfmt_empty.f
175 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
176 int UNUSED written
= 0;
177 IADDR UNUSED pc
= abuf
->addr
;
178 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
181 #if WITH_SCACHE_PBB_M32RBF
182 #if defined DEFINE_SWITCH || defined FAST_P
183 /* In the switch case FAST_P is a constant, allowing several optimizations
184 in any called inline functions. */
185 vpc
= m32rbf_pbb_begin (current_cpu
, FAST_P
);
187 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
188 vpc
= m32rbf_pbb_begin (current_cpu
, STATE_RUN_FAST_P (CPU_STATE (current_cpu
)));
190 vpc
= m32rbf_pbb_begin (current_cpu
, 0);
200 /* add: add $dr,$sr */
203 SEM_FN_NAME (m32rbf
,add
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
205 #define FLD(f) abuf->fields.sfmt_add.f
206 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
207 int UNUSED written
= 0;
208 IADDR UNUSED pc
= abuf
->addr
;
209 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
212 SI opval
= ADDSI (* FLD (i_dr
), * FLD (i_sr
));
213 * FLD (i_dr
) = opval
;
214 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
221 /* add3: add3 $dr,$sr,$hash$slo16 */
224 SEM_FN_NAME (m32rbf
,add3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
226 #define FLD(f) abuf->fields.sfmt_add3.f
227 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
228 int UNUSED written
= 0;
229 IADDR UNUSED pc
= abuf
->addr
;
230 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
233 SI opval
= ADDSI (* FLD (i_sr
), FLD (f_simm16
));
234 * FLD (i_dr
) = opval
;
235 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
242 /* and: and $dr,$sr */
245 SEM_FN_NAME (m32rbf
,and) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
247 #define FLD(f) abuf->fields.sfmt_add.f
248 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
249 int UNUSED written
= 0;
250 IADDR UNUSED pc
= abuf
->addr
;
251 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
254 SI opval
= ANDSI (* FLD (i_dr
), * FLD (i_sr
));
255 * FLD (i_dr
) = opval
;
256 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
263 /* and3: and3 $dr,$sr,$uimm16 */
266 SEM_FN_NAME (m32rbf
,and3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
268 #define FLD(f) abuf->fields.sfmt_and3.f
269 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
270 int UNUSED written
= 0;
271 IADDR UNUSED pc
= abuf
->addr
;
272 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
275 SI opval
= ANDSI (* FLD (i_sr
), FLD (f_uimm16
));
276 * FLD (i_dr
) = opval
;
277 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
287 SEM_FN_NAME (m32rbf
,or) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
289 #define FLD(f) abuf->fields.sfmt_add.f
290 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
291 int UNUSED written
= 0;
292 IADDR UNUSED pc
= abuf
->addr
;
293 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
296 SI opval
= ORSI (* FLD (i_dr
), * FLD (i_sr
));
297 * FLD (i_dr
) = opval
;
298 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
305 /* or3: or3 $dr,$sr,$hash$ulo16 */
308 SEM_FN_NAME (m32rbf
,or3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
310 #define FLD(f) abuf->fields.sfmt_and3.f
311 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
312 int UNUSED written
= 0;
313 IADDR UNUSED pc
= abuf
->addr
;
314 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
317 SI opval
= ORSI (* FLD (i_sr
), FLD (f_uimm16
));
318 * FLD (i_dr
) = opval
;
319 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
326 /* xor: xor $dr,$sr */
329 SEM_FN_NAME (m32rbf
,xor) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
331 #define FLD(f) abuf->fields.sfmt_add.f
332 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
333 int UNUSED written
= 0;
334 IADDR UNUSED pc
= abuf
->addr
;
335 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
338 SI opval
= XORSI (* FLD (i_dr
), * FLD (i_sr
));
339 * FLD (i_dr
) = opval
;
340 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
347 /* xor3: xor3 $dr,$sr,$uimm16 */
350 SEM_FN_NAME (m32rbf
,xor3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
352 #define FLD(f) abuf->fields.sfmt_and3.f
353 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
354 int UNUSED written
= 0;
355 IADDR UNUSED pc
= abuf
->addr
;
356 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
359 SI opval
= XORSI (* FLD (i_sr
), FLD (f_uimm16
));
360 * FLD (i_dr
) = opval
;
361 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
368 /* addi: addi $dr,$simm8 */
371 SEM_FN_NAME (m32rbf
,addi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
373 #define FLD(f) abuf->fields.sfmt_addi.f
374 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
375 int UNUSED written
= 0;
376 IADDR UNUSED pc
= abuf
->addr
;
377 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
380 SI opval
= ADDSI (* FLD (i_dr
), FLD (f_simm8
));
381 * FLD (i_dr
) = opval
;
382 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
389 /* addv: addv $dr,$sr */
392 SEM_FN_NAME (m32rbf
,addv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
394 #define FLD(f) abuf->fields.sfmt_add.f
395 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
396 int UNUSED written
= 0;
397 IADDR UNUSED pc
= abuf
->addr
;
398 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
402 temp0
= ADDSI (* FLD (i_dr
), * FLD (i_sr
));
403 temp1
= ADDOFSI (* FLD (i_dr
), * FLD (i_sr
), 0);
406 * FLD (i_dr
) = opval
;
407 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
411 CPU (h_cond
) = opval
;
412 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
420 /* addv3: addv3 $dr,$sr,$simm16 */
423 SEM_FN_NAME (m32rbf
,addv3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
425 #define FLD(f) abuf->fields.sfmt_add3.f
426 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
427 int UNUSED written
= 0;
428 IADDR UNUSED pc
= abuf
->addr
;
429 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
433 temp0
= ADDSI (* FLD (i_sr
), FLD (f_simm16
));
434 temp1
= ADDOFSI (* FLD (i_sr
), FLD (f_simm16
), 0);
437 * FLD (i_dr
) = opval
;
438 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
442 CPU (h_cond
) = opval
;
443 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
451 /* addx: addx $dr,$sr */
454 SEM_FN_NAME (m32rbf
,addx
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
456 #define FLD(f) abuf->fields.sfmt_add.f
457 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
458 int UNUSED written
= 0;
459 IADDR UNUSED pc
= abuf
->addr
;
460 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
464 temp0
= ADDCSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
465 temp1
= ADDCFSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
468 * FLD (i_dr
) = opval
;
469 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
473 CPU (h_cond
) = opval
;
474 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
482 /* bc8: bc.s $disp8 */
485 SEM_FN_NAME (m32rbf
,bc8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
487 #define FLD(f) abuf->fields.sfmt_bl8.f
488 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
489 int UNUSED written
= 0;
490 IADDR UNUSED pc
= abuf
->addr
;
492 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
496 USI opval
= FLD (i_disp8
);
497 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
499 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
503 abuf
->written
= written
;
504 SEM_BRANCH_FINI (vpc
);
509 /* bc24: bc.l $disp24 */
512 SEM_FN_NAME (m32rbf
,bc24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
514 #define FLD(f) abuf->fields.sfmt_bl24.f
515 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
516 int UNUSED written
= 0;
517 IADDR UNUSED pc
= abuf
->addr
;
519 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
523 USI opval
= FLD (i_disp24
);
524 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
526 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
530 abuf
->written
= written
;
531 SEM_BRANCH_FINI (vpc
);
536 /* beq: beq $src1,$src2,$disp16 */
539 SEM_FN_NAME (m32rbf
,beq
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
541 #define FLD(f) abuf->fields.sfmt_beq.f
542 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
543 int UNUSED written
= 0;
544 IADDR UNUSED pc
= abuf
->addr
;
546 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
548 if (EQSI (* FLD (i_src1
), * FLD (i_src2
))) {
550 USI opval
= FLD (i_disp16
);
551 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
553 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
557 abuf
->written
= written
;
558 SEM_BRANCH_FINI (vpc
);
563 /* beqz: beqz $src2,$disp16 */
566 SEM_FN_NAME (m32rbf
,beqz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
568 #define FLD(f) abuf->fields.sfmt_beq.f
569 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
570 int UNUSED written
= 0;
571 IADDR UNUSED pc
= abuf
->addr
;
573 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
575 if (EQSI (* FLD (i_src2
), 0)) {
577 USI opval
= FLD (i_disp16
);
578 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
580 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
584 abuf
->written
= written
;
585 SEM_BRANCH_FINI (vpc
);
590 /* bgez: bgez $src2,$disp16 */
593 SEM_FN_NAME (m32rbf
,bgez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
595 #define FLD(f) abuf->fields.sfmt_beq.f
596 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
597 int UNUSED written
= 0;
598 IADDR UNUSED pc
= abuf
->addr
;
600 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
602 if (GESI (* FLD (i_src2
), 0)) {
604 USI opval
= FLD (i_disp16
);
605 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
607 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
611 abuf
->written
= written
;
612 SEM_BRANCH_FINI (vpc
);
617 /* bgtz: bgtz $src2,$disp16 */
620 SEM_FN_NAME (m32rbf
,bgtz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
622 #define FLD(f) abuf->fields.sfmt_beq.f
623 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
624 int UNUSED written
= 0;
625 IADDR UNUSED pc
= abuf
->addr
;
627 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
629 if (GTSI (* FLD (i_src2
), 0)) {
631 USI opval
= FLD (i_disp16
);
632 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
634 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
638 abuf
->written
= written
;
639 SEM_BRANCH_FINI (vpc
);
644 /* blez: blez $src2,$disp16 */
647 SEM_FN_NAME (m32rbf
,blez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
649 #define FLD(f) abuf->fields.sfmt_beq.f
650 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
651 int UNUSED written
= 0;
652 IADDR UNUSED pc
= abuf
->addr
;
654 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
656 if (LESI (* FLD (i_src2
), 0)) {
658 USI opval
= FLD (i_disp16
);
659 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
661 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
665 abuf
->written
= written
;
666 SEM_BRANCH_FINI (vpc
);
671 /* bltz: bltz $src2,$disp16 */
674 SEM_FN_NAME (m32rbf
,bltz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
676 #define FLD(f) abuf->fields.sfmt_beq.f
677 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
678 int UNUSED written
= 0;
679 IADDR UNUSED pc
= abuf
->addr
;
681 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
683 if (LTSI (* FLD (i_src2
), 0)) {
685 USI opval
= FLD (i_disp16
);
686 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
688 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
692 abuf
->written
= written
;
693 SEM_BRANCH_FINI (vpc
);
698 /* bnez: bnez $src2,$disp16 */
701 SEM_FN_NAME (m32rbf
,bnez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
703 #define FLD(f) abuf->fields.sfmt_beq.f
704 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
705 int UNUSED written
= 0;
706 IADDR UNUSED pc
= abuf
->addr
;
708 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
710 if (NESI (* FLD (i_src2
), 0)) {
712 USI opval
= FLD (i_disp16
);
713 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
715 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
719 abuf
->written
= written
;
720 SEM_BRANCH_FINI (vpc
);
725 /* bl8: bl.s $disp8 */
728 SEM_FN_NAME (m32rbf
,bl8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
730 #define FLD(f) abuf->fields.sfmt_bl8.f
731 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
732 int UNUSED written
= 0;
733 IADDR UNUSED pc
= abuf
->addr
;
735 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
739 SI opval
= ADDSI (ANDSI (pc
, -4), 4);
740 CPU (h_gr
[((UINT
) 14)]) = opval
;
741 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
744 USI opval
= FLD (i_disp8
);
745 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
746 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
750 SEM_BRANCH_FINI (vpc
);
755 /* bl24: bl.l $disp24 */
758 SEM_FN_NAME (m32rbf
,bl24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
760 #define FLD(f) abuf->fields.sfmt_bl24.f
761 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
762 int UNUSED written
= 0;
763 IADDR UNUSED pc
= abuf
->addr
;
765 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
769 SI opval
= ADDSI (pc
, 4);
770 CPU (h_gr
[((UINT
) 14)]) = opval
;
771 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
774 USI opval
= FLD (i_disp24
);
775 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
776 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
780 SEM_BRANCH_FINI (vpc
);
785 /* bnc8: bnc.s $disp8 */
788 SEM_FN_NAME (m32rbf
,bnc8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
790 #define FLD(f) abuf->fields.sfmt_bl8.f
791 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
792 int UNUSED written
= 0;
793 IADDR UNUSED pc
= abuf
->addr
;
795 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
797 if (NOTBI (CPU (h_cond
))) {
799 USI opval
= FLD (i_disp8
);
800 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
802 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
806 abuf
->written
= written
;
807 SEM_BRANCH_FINI (vpc
);
812 /* bnc24: bnc.l $disp24 */
815 SEM_FN_NAME (m32rbf
,bnc24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
817 #define FLD(f) abuf->fields.sfmt_bl24.f
818 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
819 int UNUSED written
= 0;
820 IADDR UNUSED pc
= abuf
->addr
;
822 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
824 if (NOTBI (CPU (h_cond
))) {
826 USI opval
= FLD (i_disp24
);
827 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
829 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
833 abuf
->written
= written
;
834 SEM_BRANCH_FINI (vpc
);
839 /* bne: bne $src1,$src2,$disp16 */
842 SEM_FN_NAME (m32rbf
,bne
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
844 #define FLD(f) abuf->fields.sfmt_beq.f
845 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
846 int UNUSED written
= 0;
847 IADDR UNUSED pc
= abuf
->addr
;
849 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
851 if (NESI (* FLD (i_src1
), * FLD (i_src2
))) {
853 USI opval
= FLD (i_disp16
);
854 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
856 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
860 abuf
->written
= written
;
861 SEM_BRANCH_FINI (vpc
);
866 /* bra8: bra.s $disp8 */
869 SEM_FN_NAME (m32rbf
,bra8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
871 #define FLD(f) abuf->fields.sfmt_bl8.f
872 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
873 int UNUSED written
= 0;
874 IADDR UNUSED pc
= abuf
->addr
;
876 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
879 USI opval
= FLD (i_disp8
);
880 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
881 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
884 SEM_BRANCH_FINI (vpc
);
889 /* bra24: bra.l $disp24 */
892 SEM_FN_NAME (m32rbf
,bra24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
894 #define FLD(f) abuf->fields.sfmt_bl24.f
895 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
896 int UNUSED written
= 0;
897 IADDR UNUSED pc
= abuf
->addr
;
899 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
902 USI opval
= FLD (i_disp24
);
903 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
904 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
907 SEM_BRANCH_FINI (vpc
);
912 /* cmp: cmp $src1,$src2 */
915 SEM_FN_NAME (m32rbf
,cmp
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
917 #define FLD(f) abuf->fields.sfmt_st_plus.f
918 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
919 int UNUSED written
= 0;
920 IADDR UNUSED pc
= abuf
->addr
;
921 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
924 BI opval
= LTSI (* FLD (i_src1
), * FLD (i_src2
));
925 CPU (h_cond
) = opval
;
926 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
933 /* cmpi: cmpi $src2,$simm16 */
936 SEM_FN_NAME (m32rbf
,cmpi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
938 #define FLD(f) abuf->fields.sfmt_st_d.f
939 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
940 int UNUSED written
= 0;
941 IADDR UNUSED pc
= abuf
->addr
;
942 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
945 BI opval
= LTSI (* FLD (i_src2
), FLD (f_simm16
));
946 CPU (h_cond
) = opval
;
947 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
954 /* cmpu: cmpu $src1,$src2 */
957 SEM_FN_NAME (m32rbf
,cmpu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
959 #define FLD(f) abuf->fields.sfmt_st_plus.f
960 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
961 int UNUSED written
= 0;
962 IADDR UNUSED pc
= abuf
->addr
;
963 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
966 BI opval
= LTUSI (* FLD (i_src1
), * FLD (i_src2
));
967 CPU (h_cond
) = opval
;
968 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
975 /* cmpui: cmpui $src2,$simm16 */
978 SEM_FN_NAME (m32rbf
,cmpui
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
980 #define FLD(f) abuf->fields.sfmt_st_d.f
981 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
982 int UNUSED written
= 0;
983 IADDR UNUSED pc
= abuf
->addr
;
984 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
987 BI opval
= LTUSI (* FLD (i_src2
), FLD (f_simm16
));
988 CPU (h_cond
) = opval
;
989 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
996 /* div: div $dr,$sr */
999 SEM_FN_NAME (m32rbf
,div
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1001 #define FLD(f) abuf->fields.sfmt_add.f
1002 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1003 int UNUSED written
= 0;
1004 IADDR UNUSED pc
= abuf
->addr
;
1005 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1007 if (NESI (* FLD (i_sr
), 0)) {
1009 SI opval
= DIVSI (* FLD (i_dr
), * FLD (i_sr
));
1010 * FLD (i_dr
) = opval
;
1011 written
|= (1 << 2);
1012 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1016 abuf
->written
= written
;
1021 /* divu: divu $dr,$sr */
1024 SEM_FN_NAME (m32rbf
,divu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1026 #define FLD(f) abuf->fields.sfmt_add.f
1027 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1028 int UNUSED written
= 0;
1029 IADDR UNUSED pc
= abuf
->addr
;
1030 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1032 if (NESI (* FLD (i_sr
), 0)) {
1034 SI opval
= UDIVSI (* FLD (i_dr
), * FLD (i_sr
));
1035 * FLD (i_dr
) = opval
;
1036 written
|= (1 << 2);
1037 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1041 abuf
->written
= written
;
1046 /* rem: rem $dr,$sr */
1049 SEM_FN_NAME (m32rbf
,rem
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1051 #define FLD(f) abuf->fields.sfmt_add.f
1052 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1053 int UNUSED written
= 0;
1054 IADDR UNUSED pc
= abuf
->addr
;
1055 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1057 if (NESI (* FLD (i_sr
), 0)) {
1059 SI opval
= MODSI (* FLD (i_dr
), * FLD (i_sr
));
1060 * FLD (i_dr
) = opval
;
1061 written
|= (1 << 2);
1062 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1066 abuf
->written
= written
;
1071 /* remu: remu $dr,$sr */
1074 SEM_FN_NAME (m32rbf
,remu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1076 #define FLD(f) abuf->fields.sfmt_add.f
1077 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1078 int UNUSED written
= 0;
1079 IADDR UNUSED pc
= abuf
->addr
;
1080 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1082 if (NESI (* FLD (i_sr
), 0)) {
1084 SI opval
= UMODSI (* FLD (i_dr
), * FLD (i_sr
));
1085 * FLD (i_dr
) = opval
;
1086 written
|= (1 << 2);
1087 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1091 abuf
->written
= written
;
1099 SEM_FN_NAME (m32rbf
,jl
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1101 #define FLD(f) abuf->fields.sfmt_jl.f
1102 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1103 int UNUSED written
= 0;
1104 IADDR UNUSED pc
= abuf
->addr
;
1106 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1110 temp0
= ADDSI (ANDSI (pc
, -4), 4);
1111 temp1
= ANDSI (* FLD (i_sr
), -4);
1114 CPU (h_gr
[((UINT
) 14)]) = opval
;
1115 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1119 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1120 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1124 SEM_BRANCH_FINI (vpc
);
1132 SEM_FN_NAME (m32rbf
,jmp
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1134 #define FLD(f) abuf->fields.sfmt_jl.f
1135 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1136 int UNUSED written
= 0;
1137 IADDR UNUSED pc
= abuf
->addr
;
1139 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1142 USI opval
= ANDSI (* FLD (i_sr
), -4);
1143 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1144 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1147 SEM_BRANCH_FINI (vpc
);
1152 /* ld: ld $dr,@$sr */
1155 SEM_FN_NAME (m32rbf
,ld
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1157 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1158 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1159 int UNUSED written
= 0;
1160 IADDR UNUSED pc
= abuf
->addr
;
1161 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1164 SI opval
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1165 * FLD (i_dr
) = opval
;
1166 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1173 /* ld-d: ld $dr,@($slo16,$sr) */
1176 SEM_FN_NAME (m32rbf
,ld_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1178 #define FLD(f) abuf->fields.sfmt_add3.f
1179 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1180 int UNUSED written
= 0;
1181 IADDR UNUSED pc
= abuf
->addr
;
1182 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1185 SI opval
= GETMEMSI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)));
1186 * FLD (i_dr
) = opval
;
1187 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1194 /* ldb: ldb $dr,@$sr */
1197 SEM_FN_NAME (m32rbf
,ldb
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1199 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1200 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1201 int UNUSED written
= 0;
1202 IADDR UNUSED pc
= abuf
->addr
;
1203 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1206 SI opval
= EXTQISI (GETMEMQI (current_cpu
, pc
, * FLD (i_sr
)));
1207 * FLD (i_dr
) = opval
;
1208 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1215 /* ldb-d: ldb $dr,@($slo16,$sr) */
1218 SEM_FN_NAME (m32rbf
,ldb_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1220 #define FLD(f) abuf->fields.sfmt_add3.f
1221 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1222 int UNUSED written
= 0;
1223 IADDR UNUSED pc
= abuf
->addr
;
1224 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1227 SI opval
= EXTQISI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1228 * FLD (i_dr
) = opval
;
1229 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1236 /* ldh: ldh $dr,@$sr */
1239 SEM_FN_NAME (m32rbf
,ldh
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1241 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1242 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1243 int UNUSED written
= 0;
1244 IADDR UNUSED pc
= abuf
->addr
;
1245 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1248 SI opval
= EXTHISI (GETMEMHI (current_cpu
, pc
, * FLD (i_sr
)));
1249 * FLD (i_dr
) = opval
;
1250 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1257 /* ldh-d: ldh $dr,@($slo16,$sr) */
1260 SEM_FN_NAME (m32rbf
,ldh_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1262 #define FLD(f) abuf->fields.sfmt_add3.f
1263 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1264 int UNUSED written
= 0;
1265 IADDR UNUSED pc
= abuf
->addr
;
1266 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1269 SI opval
= EXTHISI (GETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1270 * FLD (i_dr
) = opval
;
1271 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1278 /* ldub: ldub $dr,@$sr */
1281 SEM_FN_NAME (m32rbf
,ldub
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1283 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1284 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1285 int UNUSED written
= 0;
1286 IADDR UNUSED pc
= abuf
->addr
;
1287 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1290 SI opval
= ZEXTQISI (GETMEMQI (current_cpu
, pc
, * FLD (i_sr
)));
1291 * FLD (i_dr
) = opval
;
1292 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1299 /* ldub-d: ldub $dr,@($slo16,$sr) */
1302 SEM_FN_NAME (m32rbf
,ldub_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1304 #define FLD(f) abuf->fields.sfmt_add3.f
1305 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1306 int UNUSED written
= 0;
1307 IADDR UNUSED pc
= abuf
->addr
;
1308 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1311 SI opval
= ZEXTQISI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1312 * FLD (i_dr
) = opval
;
1313 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1320 /* lduh: lduh $dr,@$sr */
1323 SEM_FN_NAME (m32rbf
,lduh
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1325 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1326 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1327 int UNUSED written
= 0;
1328 IADDR UNUSED pc
= abuf
->addr
;
1329 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1332 SI opval
= ZEXTHISI (GETMEMHI (current_cpu
, pc
, * FLD (i_sr
)));
1333 * FLD (i_dr
) = opval
;
1334 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1341 /* lduh-d: lduh $dr,@($slo16,$sr) */
1344 SEM_FN_NAME (m32rbf
,lduh_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1346 #define FLD(f) abuf->fields.sfmt_add3.f
1347 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1348 int UNUSED written
= 0;
1349 IADDR UNUSED pc
= abuf
->addr
;
1350 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1353 SI opval
= ZEXTHISI (GETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1354 * FLD (i_dr
) = opval
;
1355 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1362 /* ld-plus: ld $dr,@$sr+ */
1365 SEM_FN_NAME (m32rbf
,ld_plus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1367 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1368 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1369 int UNUSED written
= 0;
1370 IADDR UNUSED pc
= abuf
->addr
;
1371 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1375 temp0
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1376 temp1
= ADDSI (* FLD (i_sr
), 4);
1379 * FLD (i_dr
) = opval
;
1380 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1384 * FLD (i_sr
) = opval
;
1385 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1393 /* ld24: ld24 $dr,$uimm24 */
1396 SEM_FN_NAME (m32rbf
,ld24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1398 #define FLD(f) abuf->fields.sfmt_ld24.f
1399 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1400 int UNUSED written
= 0;
1401 IADDR UNUSED pc
= abuf
->addr
;
1402 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1405 SI opval
= FLD (i_uimm24
);
1406 * FLD (i_dr
) = opval
;
1407 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1414 /* ldi8: ldi8 $dr,$simm8 */
1417 SEM_FN_NAME (m32rbf
,ldi8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1419 #define FLD(f) abuf->fields.sfmt_addi.f
1420 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1421 int UNUSED written
= 0;
1422 IADDR UNUSED pc
= abuf
->addr
;
1423 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1426 SI opval
= FLD (f_simm8
);
1427 * FLD (i_dr
) = opval
;
1428 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1435 /* ldi16: ldi16 $dr,$hash$slo16 */
1438 SEM_FN_NAME (m32rbf
,ldi16
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1440 #define FLD(f) abuf->fields.sfmt_add3.f
1441 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1442 int UNUSED written
= 0;
1443 IADDR UNUSED pc
= abuf
->addr
;
1444 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1447 SI opval
= FLD (f_simm16
);
1448 * FLD (i_dr
) = opval
;
1449 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1456 /* lock: lock $dr,@$sr */
1459 SEM_FN_NAME (m32rbf
,lock
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1461 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1462 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1463 int UNUSED written
= 0;
1464 IADDR UNUSED pc
= abuf
->addr
;
1465 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1470 CPU (h_lock
) = opval
;
1471 CGEN_TRACE_RESULT (current_cpu
, abuf
, "lock", 'x', opval
);
1474 SI opval
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1475 * FLD (i_dr
) = opval
;
1476 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1484 /* machi: machi $src1,$src2 */
1487 SEM_FN_NAME (m32rbf
,machi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1489 #define FLD(f) abuf->fields.sfmt_st_plus.f
1490 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1491 int UNUSED written
= 0;
1492 IADDR UNUSED pc
= abuf
->addr
;
1493 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1496 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (ANDSI (* FLD (i_src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16))))), 8), 8);
1497 SET_H_ACCUM (opval
);
1498 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1505 /* maclo: maclo $src1,$src2 */
1508 SEM_FN_NAME (m32rbf
,maclo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1510 #define FLD(f) abuf->fields.sfmt_st_plus.f
1511 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1512 int UNUSED written
= 0;
1513 IADDR UNUSED pc
= abuf
->addr
;
1514 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1517 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (SLLSI (* FLD (i_src1
), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
))))), 8), 8);
1518 SET_H_ACCUM (opval
);
1519 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1526 /* macwhi: macwhi $src1,$src2 */
1529 SEM_FN_NAME (m32rbf
,macwhi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1531 #define FLD(f) abuf->fields.sfmt_st_plus.f
1532 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1533 int UNUSED written
= 0;
1534 IADDR UNUSED pc
= abuf
->addr
;
1535 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1538 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16))))), 8), 8);
1539 SET_H_ACCUM (opval
);
1540 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1547 /* macwlo: macwlo $src1,$src2 */
1550 SEM_FN_NAME (m32rbf
,macwlo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1552 #define FLD(f) abuf->fields.sfmt_st_plus.f
1553 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1554 int UNUSED written
= 0;
1555 IADDR UNUSED pc
= abuf
->addr
;
1556 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1559 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
))))), 8), 8);
1560 SET_H_ACCUM (opval
);
1561 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1568 /* mul: mul $dr,$sr */
1571 SEM_FN_NAME (m32rbf
,mul
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1573 #define FLD(f) abuf->fields.sfmt_add.f
1574 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1575 int UNUSED written
= 0;
1576 IADDR UNUSED pc
= abuf
->addr
;
1577 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1580 SI opval
= MULSI (* FLD (i_dr
), * FLD (i_sr
));
1581 * FLD (i_dr
) = opval
;
1582 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1589 /* mulhi: mulhi $src1,$src2 */
1592 SEM_FN_NAME (m32rbf
,mulhi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1594 #define FLD(f) abuf->fields.sfmt_st_plus.f
1595 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1596 int UNUSED written
= 0;
1597 IADDR UNUSED pc
= abuf
->addr
;
1598 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1601 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16)))), 16), 16);
1602 SET_H_ACCUM (opval
);
1603 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1610 /* mullo: mullo $src1,$src2 */
1613 SEM_FN_NAME (m32rbf
,mullo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1615 #define FLD(f) abuf->fields.sfmt_st_plus.f
1616 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1617 int UNUSED written
= 0;
1618 IADDR UNUSED pc
= abuf
->addr
;
1619 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1622 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1
), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
)))), 16), 16);
1623 SET_H_ACCUM (opval
);
1624 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1631 /* mulwhi: mulwhi $src1,$src2 */
1634 SEM_FN_NAME (m32rbf
,mulwhi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1636 #define FLD(f) abuf->fields.sfmt_st_plus.f
1637 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1638 int UNUSED written
= 0;
1639 IADDR UNUSED pc
= abuf
->addr
;
1640 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1643 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16)))), 8), 8);
1644 SET_H_ACCUM (opval
);
1645 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1652 /* mulwlo: mulwlo $src1,$src2 */
1655 SEM_FN_NAME (m32rbf
,mulwlo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1657 #define FLD(f) abuf->fields.sfmt_st_plus.f
1658 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1659 int UNUSED written
= 0;
1660 IADDR UNUSED pc
= abuf
->addr
;
1661 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1664 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
)))), 8), 8);
1665 SET_H_ACCUM (opval
);
1666 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1673 /* mv: mv $dr,$sr */
1676 SEM_FN_NAME (m32rbf
,mv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1678 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1679 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1680 int UNUSED written
= 0;
1681 IADDR UNUSED pc
= abuf
->addr
;
1682 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1685 SI opval
= * FLD (i_sr
);
1686 * FLD (i_dr
) = opval
;
1687 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1694 /* mvfachi: mvfachi $dr */
1697 SEM_FN_NAME (m32rbf
,mvfachi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1699 #define FLD(f) abuf->fields.sfmt_seth.f
1700 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1701 int UNUSED written
= 0;
1702 IADDR UNUSED pc
= abuf
->addr
;
1703 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1706 SI opval
= TRUNCDISI (SRADI (GET_H_ACCUM (), 32));
1707 * FLD (i_dr
) = opval
;
1708 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1715 /* mvfaclo: mvfaclo $dr */
1718 SEM_FN_NAME (m32rbf
,mvfaclo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1720 #define FLD(f) abuf->fields.sfmt_seth.f
1721 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1722 int UNUSED written
= 0;
1723 IADDR UNUSED pc
= abuf
->addr
;
1724 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1727 SI opval
= TRUNCDISI (GET_H_ACCUM ());
1728 * FLD (i_dr
) = opval
;
1729 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1736 /* mvfacmi: mvfacmi $dr */
1739 SEM_FN_NAME (m32rbf
,mvfacmi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1741 #define FLD(f) abuf->fields.sfmt_seth.f
1742 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1743 int UNUSED written
= 0;
1744 IADDR UNUSED pc
= abuf
->addr
;
1745 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1748 SI opval
= TRUNCDISI (SRADI (GET_H_ACCUM (), 16));
1749 * FLD (i_dr
) = opval
;
1750 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1757 /* mvfc: mvfc $dr,$scr */
1760 SEM_FN_NAME (m32rbf
,mvfc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1762 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1763 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1764 int UNUSED written
= 0;
1765 IADDR UNUSED pc
= abuf
->addr
;
1766 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1769 SI opval
= GET_H_CR (FLD (f_r2
));
1770 * FLD (i_dr
) = opval
;
1771 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1778 /* mvtachi: mvtachi $src1 */
1781 SEM_FN_NAME (m32rbf
,mvtachi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1783 #define FLD(f) abuf->fields.sfmt_st_plus.f
1784 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1785 int UNUSED written
= 0;
1786 IADDR UNUSED pc
= abuf
->addr
;
1787 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1790 DI opval
= ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1
)), 32));
1791 SET_H_ACCUM (opval
);
1792 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1799 /* mvtaclo: mvtaclo $src1 */
1802 SEM_FN_NAME (m32rbf
,mvtaclo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1804 #define FLD(f) abuf->fields.sfmt_st_plus.f
1805 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1806 int UNUSED written
= 0;
1807 IADDR UNUSED pc
= abuf
->addr
;
1808 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1811 DI opval
= ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1
)));
1812 SET_H_ACCUM (opval
);
1813 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1820 /* mvtc: mvtc $sr,$dcr */
1823 SEM_FN_NAME (m32rbf
,mvtc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1825 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1826 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1827 int UNUSED written
= 0;
1828 IADDR UNUSED pc
= abuf
->addr
;
1829 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1832 USI opval
= * FLD (i_sr
);
1833 SET_H_CR (FLD (f_r1
), opval
);
1834 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
1841 /* neg: neg $dr,$sr */
1844 SEM_FN_NAME (m32rbf
,neg
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1846 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1847 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1848 int UNUSED written
= 0;
1849 IADDR UNUSED pc
= abuf
->addr
;
1850 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1853 SI opval
= NEGSI (* FLD (i_sr
));
1854 * FLD (i_dr
) = opval
;
1855 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1865 SEM_FN_NAME (m32rbf
,nop
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1867 #define FLD(f) abuf->fields.sfmt_empty.f
1868 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1869 int UNUSED written
= 0;
1870 IADDR UNUSED pc
= abuf
->addr
;
1871 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1873 PROFILE_COUNT_FILLNOPS (current_cpu
, abuf
->addr
);
1879 /* not: not $dr,$sr */
1882 SEM_FN_NAME (m32rbf
,not) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1884 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1885 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1886 int UNUSED written
= 0;
1887 IADDR UNUSED pc
= abuf
->addr
;
1888 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1891 SI opval
= INVSI (* FLD (i_sr
));
1892 * FLD (i_dr
) = opval
;
1893 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1903 SEM_FN_NAME (m32rbf
,rac
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1905 #define FLD(f) abuf->fields.sfmt_empty.f
1906 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1907 int UNUSED written
= 0;
1908 IADDR UNUSED pc
= abuf
->addr
;
1909 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1913 tmp_tmp1
= SLLDI (GET_H_ACCUM (), 1);
1914 tmp_tmp1
= ADDDI (tmp_tmp1
, MAKEDI (0, 32768));
1916 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)));
1917 SET_H_ACCUM (opval
);
1918 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1929 SEM_FN_NAME (m32rbf
,rach
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1931 #define FLD(f) abuf->fields.sfmt_empty.f
1932 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1933 int UNUSED written
= 0;
1934 IADDR UNUSED pc
= abuf
->addr
;
1935 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1939 tmp_tmp1
= ANDDI (GET_H_ACCUM (), MAKEDI (16777215, 0xffffffff));
1940 if (ANDIF (GEDI (tmp_tmp1
, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1
, MAKEDI (8388607, 0xffffffff)))) {
1941 tmp_tmp1
= MAKEDI (16383, 0x80000000);
1943 if (ANDIF (GEDI (tmp_tmp1
, MAKEDI (8388608, 0)), LEDI (tmp_tmp1
, MAKEDI (16760832, 0)))) {
1944 tmp_tmp1
= MAKEDI (16760832, 0);
1946 tmp_tmp1
= ANDDI (ADDDI (GET_H_ACCUM (), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1949 tmp_tmp1
= SLLDI (tmp_tmp1
, 1);
1951 DI opval
= SRADI (SLLDI (tmp_tmp1
, 7), 7);
1952 SET_H_ACCUM (opval
);
1953 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1964 SEM_FN_NAME (m32rbf
,rte
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1966 #define FLD(f) abuf->fields.sfmt_empty.f
1967 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1968 int UNUSED written
= 0;
1969 IADDR UNUSED pc
= abuf
->addr
;
1971 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1975 USI opval
= ANDSI (GET_H_CR (((UINT
) 6)), -4);
1976 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1977 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1980 USI opval
= GET_H_CR (((UINT
) 14));
1981 SET_H_CR (((UINT
) 6), opval
);
1982 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
1985 UQI opval
= CPU (h_bpsw
);
1987 CGEN_TRACE_RESULT (current_cpu
, abuf
, "psw", 'x', opval
);
1990 UQI opval
= CPU (h_bbpsw
);
1991 CPU (h_bpsw
) = opval
;
1992 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bpsw", 'x', opval
);
1996 SEM_BRANCH_FINI (vpc
);
2001 /* seth: seth $dr,$hash$hi16 */
2004 SEM_FN_NAME (m32rbf
,seth
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2006 #define FLD(f) abuf->fields.sfmt_seth.f
2007 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2008 int UNUSED written
= 0;
2009 IADDR UNUSED pc
= abuf
->addr
;
2010 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2013 SI opval
= SLLSI (FLD (f_hi16
), 16);
2014 * FLD (i_dr
) = opval
;
2015 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2022 /* sll: sll $dr,$sr */
2025 SEM_FN_NAME (m32rbf
,sll
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2027 #define FLD(f) abuf->fields.sfmt_add.f
2028 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2029 int UNUSED written
= 0;
2030 IADDR UNUSED pc
= abuf
->addr
;
2031 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2034 SI opval
= SLLSI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2035 * FLD (i_dr
) = opval
;
2036 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2043 /* sll3: sll3 $dr,$sr,$simm16 */
2046 SEM_FN_NAME (m32rbf
,sll3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2048 #define FLD(f) abuf->fields.sfmt_add3.f
2049 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2050 int UNUSED written
= 0;
2051 IADDR UNUSED pc
= abuf
->addr
;
2052 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2055 SI opval
= SLLSI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2056 * FLD (i_dr
) = opval
;
2057 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2064 /* slli: slli $dr,$uimm5 */
2067 SEM_FN_NAME (m32rbf
,slli
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2069 #define FLD(f) abuf->fields.sfmt_slli.f
2070 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2071 int UNUSED written
= 0;
2072 IADDR UNUSED pc
= abuf
->addr
;
2073 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2076 SI opval
= SLLSI (* FLD (i_dr
), FLD (f_uimm5
));
2077 * FLD (i_dr
) = opval
;
2078 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2085 /* sra: sra $dr,$sr */
2088 SEM_FN_NAME (m32rbf
,sra
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2090 #define FLD(f) abuf->fields.sfmt_add.f
2091 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2092 int UNUSED written
= 0;
2093 IADDR UNUSED pc
= abuf
->addr
;
2094 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2097 SI opval
= SRASI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2098 * FLD (i_dr
) = opval
;
2099 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2106 /* sra3: sra3 $dr,$sr,$simm16 */
2109 SEM_FN_NAME (m32rbf
,sra3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2111 #define FLD(f) abuf->fields.sfmt_add3.f
2112 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2113 int UNUSED written
= 0;
2114 IADDR UNUSED pc
= abuf
->addr
;
2115 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2118 SI opval
= SRASI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2119 * FLD (i_dr
) = opval
;
2120 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2127 /* srai: srai $dr,$uimm5 */
2130 SEM_FN_NAME (m32rbf
,srai
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2132 #define FLD(f) abuf->fields.sfmt_slli.f
2133 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2134 int UNUSED written
= 0;
2135 IADDR UNUSED pc
= abuf
->addr
;
2136 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2139 SI opval
= SRASI (* FLD (i_dr
), FLD (f_uimm5
));
2140 * FLD (i_dr
) = opval
;
2141 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2148 /* srl: srl $dr,$sr */
2151 SEM_FN_NAME (m32rbf
,srl
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2153 #define FLD(f) abuf->fields.sfmt_add.f
2154 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2155 int UNUSED written
= 0;
2156 IADDR UNUSED pc
= abuf
->addr
;
2157 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2160 SI opval
= SRLSI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2161 * FLD (i_dr
) = opval
;
2162 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2169 /* srl3: srl3 $dr,$sr,$simm16 */
2172 SEM_FN_NAME (m32rbf
,srl3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2174 #define FLD(f) abuf->fields.sfmt_add3.f
2175 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2176 int UNUSED written
= 0;
2177 IADDR UNUSED pc
= abuf
->addr
;
2178 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2181 SI opval
= SRLSI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2182 * FLD (i_dr
) = opval
;
2183 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2190 /* srli: srli $dr,$uimm5 */
2193 SEM_FN_NAME (m32rbf
,srli
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2195 #define FLD(f) abuf->fields.sfmt_slli.f
2196 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2197 int UNUSED written
= 0;
2198 IADDR UNUSED pc
= abuf
->addr
;
2199 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2202 SI opval
= SRLSI (* FLD (i_dr
), FLD (f_uimm5
));
2203 * FLD (i_dr
) = opval
;
2204 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2211 /* st: st $src1,@$src2 */
2214 SEM_FN_NAME (m32rbf
,st
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2216 #define FLD(f) abuf->fields.sfmt_st_plus.f
2217 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2218 int UNUSED written
= 0;
2219 IADDR UNUSED pc
= abuf
->addr
;
2220 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2223 SI opval
= * FLD (i_src1
);
2224 SETMEMSI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2225 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2232 /* st-d: st $src1,@($slo16,$src2) */
2235 SEM_FN_NAME (m32rbf
,st_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2237 #define FLD(f) abuf->fields.sfmt_st_d.f
2238 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2239 int UNUSED written
= 0;
2240 IADDR UNUSED pc
= abuf
->addr
;
2241 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2244 SI opval
= * FLD (i_src1
);
2245 SETMEMSI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2246 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2253 /* stb: stb $src1,@$src2 */
2256 SEM_FN_NAME (m32rbf
,stb
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2258 #define FLD(f) abuf->fields.sfmt_st_plus.f
2259 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2260 int UNUSED written
= 0;
2261 IADDR UNUSED pc
= abuf
->addr
;
2262 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2265 QI opval
= * FLD (i_src1
);
2266 SETMEMQI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2267 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2274 /* stb-d: stb $src1,@($slo16,$src2) */
2277 SEM_FN_NAME (m32rbf
,stb_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2279 #define FLD(f) abuf->fields.sfmt_st_d.f
2280 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2281 int UNUSED written
= 0;
2282 IADDR UNUSED pc
= abuf
->addr
;
2283 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2286 QI opval
= * FLD (i_src1
);
2287 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2288 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2295 /* sth: sth $src1,@$src2 */
2298 SEM_FN_NAME (m32rbf
,sth
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2300 #define FLD(f) abuf->fields.sfmt_st_plus.f
2301 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2302 int UNUSED written
= 0;
2303 IADDR UNUSED pc
= abuf
->addr
;
2304 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2307 HI opval
= * FLD (i_src1
);
2308 SETMEMHI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2309 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2316 /* sth-d: sth $src1,@($slo16,$src2) */
2319 SEM_FN_NAME (m32rbf
,sth_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2321 #define FLD(f) abuf->fields.sfmt_st_d.f
2322 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2323 int UNUSED written
= 0;
2324 IADDR UNUSED pc
= abuf
->addr
;
2325 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2328 HI opval
= * FLD (i_src1
);
2329 SETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2330 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2337 /* st-plus: st $src1,@+$src2 */
2340 SEM_FN_NAME (m32rbf
,st_plus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2342 #define FLD(f) abuf->fields.sfmt_st_plus.f
2343 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2344 int UNUSED written
= 0;
2345 IADDR UNUSED pc
= abuf
->addr
;
2346 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2350 tmp_new_src2
= ADDSI (* FLD (i_src2
), 4);
2352 SI opval
= * FLD (i_src1
);
2353 SETMEMSI (current_cpu
, pc
, tmp_new_src2
, opval
);
2354 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2357 SI opval
= tmp_new_src2
;
2358 * FLD (i_src2
) = opval
;
2359 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2367 /* st-minus: st $src1,@-$src2 */
2370 SEM_FN_NAME (m32rbf
,st_minus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2372 #define FLD(f) abuf->fields.sfmt_st_plus.f
2373 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2374 int UNUSED written
= 0;
2375 IADDR UNUSED pc
= abuf
->addr
;
2376 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2380 tmp_new_src2
= SUBSI (* FLD (i_src2
), 4);
2382 SI opval
= * FLD (i_src1
);
2383 SETMEMSI (current_cpu
, pc
, tmp_new_src2
, opval
);
2384 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2387 SI opval
= tmp_new_src2
;
2388 * FLD (i_src2
) = opval
;
2389 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2397 /* sub: sub $dr,$sr */
2400 SEM_FN_NAME (m32rbf
,sub
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2402 #define FLD(f) abuf->fields.sfmt_add.f
2403 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2404 int UNUSED written
= 0;
2405 IADDR UNUSED pc
= abuf
->addr
;
2406 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2409 SI opval
= SUBSI (* FLD (i_dr
), * FLD (i_sr
));
2410 * FLD (i_dr
) = opval
;
2411 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2418 /* subv: subv $dr,$sr */
2421 SEM_FN_NAME (m32rbf
,subv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2423 #define FLD(f) abuf->fields.sfmt_add.f
2424 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2425 int UNUSED written
= 0;
2426 IADDR UNUSED pc
= abuf
->addr
;
2427 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2431 temp0
= SUBSI (* FLD (i_dr
), * FLD (i_sr
));
2432 temp1
= SUBOFSI (* FLD (i_dr
), * FLD (i_sr
), 0);
2435 * FLD (i_dr
) = opval
;
2436 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2440 CPU (h_cond
) = opval
;
2441 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2449 /* subx: subx $dr,$sr */
2452 SEM_FN_NAME (m32rbf
,subx
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2454 #define FLD(f) abuf->fields.sfmt_add.f
2455 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2456 int UNUSED written
= 0;
2457 IADDR UNUSED pc
= abuf
->addr
;
2458 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2462 temp0
= SUBCSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
2463 temp1
= SUBCFSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
2466 * FLD (i_dr
) = opval
;
2467 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2471 CPU (h_cond
) = opval
;
2472 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2480 /* trap: trap $uimm4 */
2483 SEM_FN_NAME (m32rbf
,trap
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2485 #define FLD(f) abuf->fields.sfmt_trap.f
2486 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2487 int UNUSED written
= 0;
2488 IADDR UNUSED pc
= abuf
->addr
;
2490 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2494 USI opval
= GET_H_CR (((UINT
) 6));
2495 SET_H_CR (((UINT
) 14), opval
);
2496 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2499 USI opval
= ADDSI (pc
, 4);
2500 SET_H_CR (((UINT
) 6), opval
);
2501 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2504 UQI opval
= CPU (h_bpsw
);
2505 CPU (h_bbpsw
) = opval
;
2506 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bbpsw", 'x', opval
);
2509 UQI opval
= GET_H_PSW ();
2510 CPU (h_bpsw
) = opval
;
2511 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bpsw", 'x', opval
);
2514 UQI opval
= ANDQI (GET_H_PSW (), 128);
2516 CGEN_TRACE_RESULT (current_cpu
, abuf
, "psw", 'x', opval
);
2519 SI opval
= m32r_trap (current_cpu
, pc
, FLD (f_uimm4
));
2520 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
2521 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
2525 SEM_BRANCH_FINI (vpc
);
2530 /* unlock: unlock $src1,@$src2 */
2533 SEM_FN_NAME (m32rbf
,unlock
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2535 #define FLD(f) abuf->fields.sfmt_st_plus.f
2536 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2537 int UNUSED written
= 0;
2538 IADDR UNUSED pc
= abuf
->addr
;
2539 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2544 SI opval
= * FLD (i_src1
);
2545 SETMEMSI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2546 written
|= (1 << 4);
2547 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2552 CPU (h_lock
) = opval
;
2553 CGEN_TRACE_RESULT (current_cpu
, abuf
, "lock", 'x', opval
);
2557 abuf
->written
= written
;
2562 /* clrpsw: clrpsw $uimm8 */
2565 SEM_FN_NAME (m32rbf
,clrpsw
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2567 #define FLD(f) abuf->fields.sfmt_clrpsw.f
2568 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2569 int UNUSED written
= 0;
2570 IADDR UNUSED pc
= abuf
->addr
;
2571 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2574 USI opval
= ANDSI (GET_H_CR (((UINT
) 0)), ORSI (ZEXTQISI (INVQI (FLD (f_uimm8
))), 65280));
2575 SET_H_CR (((UINT
) 0), opval
);
2576 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2583 /* setpsw: setpsw $uimm8 */
2586 SEM_FN_NAME (m32rbf
,setpsw
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2588 #define FLD(f) abuf->fields.sfmt_clrpsw.f
2589 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2590 int UNUSED written
= 0;
2591 IADDR UNUSED pc
= abuf
->addr
;
2592 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2595 USI opval
= FLD (f_uimm8
);
2596 SET_H_CR (((UINT
) 0), opval
);
2597 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2604 /* bset: bset $uimm3,@($slo16,$sr) */
2607 SEM_FN_NAME (m32rbf
,bset
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2609 #define FLD(f) abuf->fields.sfmt_bset.f
2610 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2611 int UNUSED written
= 0;
2612 IADDR UNUSED pc
= abuf
->addr
;
2613 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2616 QI opval
= ORQI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))), SLLQI (1, SUBSI (7, FLD (f_uimm3
))));
2617 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)), opval
);
2618 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2625 /* bclr: bclr $uimm3,@($slo16,$sr) */
2628 SEM_FN_NAME (m32rbf
,bclr
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2630 #define FLD(f) abuf->fields.sfmt_bset.f
2631 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2632 int UNUSED written
= 0;
2633 IADDR UNUSED pc
= abuf
->addr
;
2634 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2637 QI opval
= ANDQI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))), INVQI (SLLQI (1, SUBSI (7, FLD (f_uimm3
)))));
2638 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)), opval
);
2639 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2646 /* btst: btst $uimm3,$sr */
2649 SEM_FN_NAME (m32rbf
,btst
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2651 #define FLD(f) abuf->fields.sfmt_bset.f
2652 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2653 int UNUSED written
= 0;
2654 IADDR UNUSED pc
= abuf
->addr
;
2655 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2658 BI opval
= ANDQI (SRLQI (* FLD (i_sr
), SUBSI (7, FLD (f_uimm3
))), 1);
2659 CPU (h_cond
) = opval
;
2660 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2667 /* Table of all semantic fns. */
2669 static const struct sem_fn_desc sem_fns
[] = {
2670 { M32RBF_INSN_X_INVALID
, SEM_FN_NAME (m32rbf
,x_invalid
) },
2671 { M32RBF_INSN_X_AFTER
, SEM_FN_NAME (m32rbf
,x_after
) },
2672 { M32RBF_INSN_X_BEFORE
, SEM_FN_NAME (m32rbf
,x_before
) },
2673 { M32RBF_INSN_X_CTI_CHAIN
, SEM_FN_NAME (m32rbf
,x_cti_chain
) },
2674 { M32RBF_INSN_X_CHAIN
, SEM_FN_NAME (m32rbf
,x_chain
) },
2675 { M32RBF_INSN_X_BEGIN
, SEM_FN_NAME (m32rbf
,x_begin
) },
2676 { M32RBF_INSN_ADD
, SEM_FN_NAME (m32rbf
,add
) },
2677 { M32RBF_INSN_ADD3
, SEM_FN_NAME (m32rbf
,add3
) },
2678 { M32RBF_INSN_AND
, SEM_FN_NAME (m32rbf
,and) },
2679 { M32RBF_INSN_AND3
, SEM_FN_NAME (m32rbf
,and3
) },
2680 { M32RBF_INSN_OR
, SEM_FN_NAME (m32rbf
,or) },
2681 { M32RBF_INSN_OR3
, SEM_FN_NAME (m32rbf
,or3
) },
2682 { M32RBF_INSN_XOR
, SEM_FN_NAME (m32rbf
,xor) },
2683 { M32RBF_INSN_XOR3
, SEM_FN_NAME (m32rbf
,xor3
) },
2684 { M32RBF_INSN_ADDI
, SEM_FN_NAME (m32rbf
,addi
) },
2685 { M32RBF_INSN_ADDV
, SEM_FN_NAME (m32rbf
,addv
) },
2686 { M32RBF_INSN_ADDV3
, SEM_FN_NAME (m32rbf
,addv3
) },
2687 { M32RBF_INSN_ADDX
, SEM_FN_NAME (m32rbf
,addx
) },
2688 { M32RBF_INSN_BC8
, SEM_FN_NAME (m32rbf
,bc8
) },
2689 { M32RBF_INSN_BC24
, SEM_FN_NAME (m32rbf
,bc24
) },
2690 { M32RBF_INSN_BEQ
, SEM_FN_NAME (m32rbf
,beq
) },
2691 { M32RBF_INSN_BEQZ
, SEM_FN_NAME (m32rbf
,beqz
) },
2692 { M32RBF_INSN_BGEZ
, SEM_FN_NAME (m32rbf
,bgez
) },
2693 { M32RBF_INSN_BGTZ
, SEM_FN_NAME (m32rbf
,bgtz
) },
2694 { M32RBF_INSN_BLEZ
, SEM_FN_NAME (m32rbf
,blez
) },
2695 { M32RBF_INSN_BLTZ
, SEM_FN_NAME (m32rbf
,bltz
) },
2696 { M32RBF_INSN_BNEZ
, SEM_FN_NAME (m32rbf
,bnez
) },
2697 { M32RBF_INSN_BL8
, SEM_FN_NAME (m32rbf
,bl8
) },
2698 { M32RBF_INSN_BL24
, SEM_FN_NAME (m32rbf
,bl24
) },
2699 { M32RBF_INSN_BNC8
, SEM_FN_NAME (m32rbf
,bnc8
) },
2700 { M32RBF_INSN_BNC24
, SEM_FN_NAME (m32rbf
,bnc24
) },
2701 { M32RBF_INSN_BNE
, SEM_FN_NAME (m32rbf
,bne
) },
2702 { M32RBF_INSN_BRA8
, SEM_FN_NAME (m32rbf
,bra8
) },
2703 { M32RBF_INSN_BRA24
, SEM_FN_NAME (m32rbf
,bra24
) },
2704 { M32RBF_INSN_CMP
, SEM_FN_NAME (m32rbf
,cmp
) },
2705 { M32RBF_INSN_CMPI
, SEM_FN_NAME (m32rbf
,cmpi
) },
2706 { M32RBF_INSN_CMPU
, SEM_FN_NAME (m32rbf
,cmpu
) },
2707 { M32RBF_INSN_CMPUI
, SEM_FN_NAME (m32rbf
,cmpui
) },
2708 { M32RBF_INSN_DIV
, SEM_FN_NAME (m32rbf
,div
) },
2709 { M32RBF_INSN_DIVU
, SEM_FN_NAME (m32rbf
,divu
) },
2710 { M32RBF_INSN_REM
, SEM_FN_NAME (m32rbf
,rem
) },
2711 { M32RBF_INSN_REMU
, SEM_FN_NAME (m32rbf
,remu
) },
2712 { M32RBF_INSN_JL
, SEM_FN_NAME (m32rbf
,jl
) },
2713 { M32RBF_INSN_JMP
, SEM_FN_NAME (m32rbf
,jmp
) },
2714 { M32RBF_INSN_LD
, SEM_FN_NAME (m32rbf
,ld
) },
2715 { M32RBF_INSN_LD_D
, SEM_FN_NAME (m32rbf
,ld_d
) },
2716 { M32RBF_INSN_LDB
, SEM_FN_NAME (m32rbf
,ldb
) },
2717 { M32RBF_INSN_LDB_D
, SEM_FN_NAME (m32rbf
,ldb_d
) },
2718 { M32RBF_INSN_LDH
, SEM_FN_NAME (m32rbf
,ldh
) },
2719 { M32RBF_INSN_LDH_D
, SEM_FN_NAME (m32rbf
,ldh_d
) },
2720 { M32RBF_INSN_LDUB
, SEM_FN_NAME (m32rbf
,ldub
) },
2721 { M32RBF_INSN_LDUB_D
, SEM_FN_NAME (m32rbf
,ldub_d
) },
2722 { M32RBF_INSN_LDUH
, SEM_FN_NAME (m32rbf
,lduh
) },
2723 { M32RBF_INSN_LDUH_D
, SEM_FN_NAME (m32rbf
,lduh_d
) },
2724 { M32RBF_INSN_LD_PLUS
, SEM_FN_NAME (m32rbf
,ld_plus
) },
2725 { M32RBF_INSN_LD24
, SEM_FN_NAME (m32rbf
,ld24
) },
2726 { M32RBF_INSN_LDI8
, SEM_FN_NAME (m32rbf
,ldi8
) },
2727 { M32RBF_INSN_LDI16
, SEM_FN_NAME (m32rbf
,ldi16
) },
2728 { M32RBF_INSN_LOCK
, SEM_FN_NAME (m32rbf
,lock
) },
2729 { M32RBF_INSN_MACHI
, SEM_FN_NAME (m32rbf
,machi
) },
2730 { M32RBF_INSN_MACLO
, SEM_FN_NAME (m32rbf
,maclo
) },
2731 { M32RBF_INSN_MACWHI
, SEM_FN_NAME (m32rbf
,macwhi
) },
2732 { M32RBF_INSN_MACWLO
, SEM_FN_NAME (m32rbf
,macwlo
) },
2733 { M32RBF_INSN_MUL
, SEM_FN_NAME (m32rbf
,mul
) },
2734 { M32RBF_INSN_MULHI
, SEM_FN_NAME (m32rbf
,mulhi
) },
2735 { M32RBF_INSN_MULLO
, SEM_FN_NAME (m32rbf
,mullo
) },
2736 { M32RBF_INSN_MULWHI
, SEM_FN_NAME (m32rbf
,mulwhi
) },
2737 { M32RBF_INSN_MULWLO
, SEM_FN_NAME (m32rbf
,mulwlo
) },
2738 { M32RBF_INSN_MV
, SEM_FN_NAME (m32rbf
,mv
) },
2739 { M32RBF_INSN_MVFACHI
, SEM_FN_NAME (m32rbf
,mvfachi
) },
2740 { M32RBF_INSN_MVFACLO
, SEM_FN_NAME (m32rbf
,mvfaclo
) },
2741 { M32RBF_INSN_MVFACMI
, SEM_FN_NAME (m32rbf
,mvfacmi
) },
2742 { M32RBF_INSN_MVFC
, SEM_FN_NAME (m32rbf
,mvfc
) },
2743 { M32RBF_INSN_MVTACHI
, SEM_FN_NAME (m32rbf
,mvtachi
) },
2744 { M32RBF_INSN_MVTACLO
, SEM_FN_NAME (m32rbf
,mvtaclo
) },
2745 { M32RBF_INSN_MVTC
, SEM_FN_NAME (m32rbf
,mvtc
) },
2746 { M32RBF_INSN_NEG
, SEM_FN_NAME (m32rbf
,neg
) },
2747 { M32RBF_INSN_NOP
, SEM_FN_NAME (m32rbf
,nop
) },
2748 { M32RBF_INSN_NOT
, SEM_FN_NAME (m32rbf
,not) },
2749 { M32RBF_INSN_RAC
, SEM_FN_NAME (m32rbf
,rac
) },
2750 { M32RBF_INSN_RACH
, SEM_FN_NAME (m32rbf
,rach
) },
2751 { M32RBF_INSN_RTE
, SEM_FN_NAME (m32rbf
,rte
) },
2752 { M32RBF_INSN_SETH
, SEM_FN_NAME (m32rbf
,seth
) },
2753 { M32RBF_INSN_SLL
, SEM_FN_NAME (m32rbf
,sll
) },
2754 { M32RBF_INSN_SLL3
, SEM_FN_NAME (m32rbf
,sll3
) },
2755 { M32RBF_INSN_SLLI
, SEM_FN_NAME (m32rbf
,slli
) },
2756 { M32RBF_INSN_SRA
, SEM_FN_NAME (m32rbf
,sra
) },
2757 { M32RBF_INSN_SRA3
, SEM_FN_NAME (m32rbf
,sra3
) },
2758 { M32RBF_INSN_SRAI
, SEM_FN_NAME (m32rbf
,srai
) },
2759 { M32RBF_INSN_SRL
, SEM_FN_NAME (m32rbf
,srl
) },
2760 { M32RBF_INSN_SRL3
, SEM_FN_NAME (m32rbf
,srl3
) },
2761 { M32RBF_INSN_SRLI
, SEM_FN_NAME (m32rbf
,srli
) },
2762 { M32RBF_INSN_ST
, SEM_FN_NAME (m32rbf
,st
) },
2763 { M32RBF_INSN_ST_D
, SEM_FN_NAME (m32rbf
,st_d
) },
2764 { M32RBF_INSN_STB
, SEM_FN_NAME (m32rbf
,stb
) },
2765 { M32RBF_INSN_STB_D
, SEM_FN_NAME (m32rbf
,stb_d
) },
2766 { M32RBF_INSN_STH
, SEM_FN_NAME (m32rbf
,sth
) },
2767 { M32RBF_INSN_STH_D
, SEM_FN_NAME (m32rbf
,sth_d
) },
2768 { M32RBF_INSN_ST_PLUS
, SEM_FN_NAME (m32rbf
,st_plus
) },
2769 { M32RBF_INSN_ST_MINUS
, SEM_FN_NAME (m32rbf
,st_minus
) },
2770 { M32RBF_INSN_SUB
, SEM_FN_NAME (m32rbf
,sub
) },
2771 { M32RBF_INSN_SUBV
, SEM_FN_NAME (m32rbf
,subv
) },
2772 { M32RBF_INSN_SUBX
, SEM_FN_NAME (m32rbf
,subx
) },
2773 { M32RBF_INSN_TRAP
, SEM_FN_NAME (m32rbf
,trap
) },
2774 { M32RBF_INSN_UNLOCK
, SEM_FN_NAME (m32rbf
,unlock
) },
2775 { M32RBF_INSN_CLRPSW
, SEM_FN_NAME (m32rbf
,clrpsw
) },
2776 { M32RBF_INSN_SETPSW
, SEM_FN_NAME (m32rbf
,setpsw
) },
2777 { M32RBF_INSN_BSET
, SEM_FN_NAME (m32rbf
,bset
) },
2778 { M32RBF_INSN_BCLR
, SEM_FN_NAME (m32rbf
,bclr
) },
2779 { M32RBF_INSN_BTST
, SEM_FN_NAME (m32rbf
,btst
) },
2783 /* Add the semantic fns to IDESC_TABLE. */
2786 SEM_FN_NAME (m32rbf
,init_idesc_table
) (SIM_CPU
*current_cpu
)
2788 IDESC
*idesc_table
= CPU_IDESC (current_cpu
);
2789 const struct sem_fn_desc
*sf
;
2790 int mach_num
= MACH_NUM (CPU_MACH (current_cpu
));
2792 for (sf
= &sem_fns
[0]; sf
->fn
!= 0; ++sf
)
2794 const CGEN_INSN
*insn
= idesc_table
[sf
->index
].idata
;
2795 int valid_p
= (CGEN_INSN_VIRTUAL_P (insn
)
2796 || CGEN_INSN_MACH_HAS_P (insn
, mach_num
));
2799 idesc_table
[sf
->index
].sem_fast
= sf
->fn
;
2801 idesc_table
[sf
->index
].sem_fast
= SEM_FN_NAME (m32rbf
,x_invalid
);
2804 idesc_table
[sf
->index
].sem_full
= sf
->fn
;
2806 idesc_table
[sf
->index
].sem_full
= SEM_FN_NAME (m32rbf
,x_invalid
);