1 /* Simulator instruction semantics for m32rbf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2019 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, see <http://www.gnu.org/licenses/>.
24 #define WANT_CPU m32rbf
25 #define WANT_CPU_M32RBF
32 #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
34 /* This is used so that we can compile two copies of the semantic code,
35 one with full feature support and one without that runs fast(er).
36 FAST_P, when desired, is defined on the command line, -DFAST_P=1. */
38 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
39 #undef CGEN_TRACE_RESULT
40 #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
42 #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
45 /* x-invalid: --invalid-- */
48 SEM_FN_NAME (m32rbf
,x_invalid
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
50 #define FLD(f) abuf->fields.sfmt_empty.f
51 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
52 int UNUSED written
= 0;
53 IADDR UNUSED pc
= abuf
->addr
;
54 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
57 /* Update the recorded pc in the cpu state struct.
58 Only necessary for WITH_SCACHE case, but to avoid the
59 conditional compilation .... */
61 /* Virtual insns have zero size. Overwrite vpc with address of next insn
62 using the default-insn-bitsize spec. When executing insns in parallel
63 we may want to queue the fault and continue execution. */
64 vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
65 vpc
= sim_engine_invalid_insn (current_cpu
, pc
, vpc
);
72 /* x-after: --after-- */
75 SEM_FN_NAME (m32rbf
,x_after
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
77 #define FLD(f) abuf->fields.sfmt_empty.f
78 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
79 int UNUSED written
= 0;
80 IADDR UNUSED pc
= abuf
->addr
;
81 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
84 #if WITH_SCACHE_PBB_M32RBF
85 m32rbf_pbb_after (current_cpu
, sem_arg
);
93 /* x-before: --before-- */
96 SEM_FN_NAME (m32rbf
,x_before
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
98 #define FLD(f) abuf->fields.sfmt_empty.f
99 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
100 int UNUSED written
= 0;
101 IADDR UNUSED pc
= abuf
->addr
;
102 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
105 #if WITH_SCACHE_PBB_M32RBF
106 m32rbf_pbb_before (current_cpu
, sem_arg
);
114 /* x-cti-chain: --cti-chain-- */
117 SEM_FN_NAME (m32rbf
,x_cti_chain
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
119 #define FLD(f) abuf->fields.sfmt_empty.f
120 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
121 int UNUSED written
= 0;
122 IADDR UNUSED pc
= abuf
->addr
;
123 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
126 #if WITH_SCACHE_PBB_M32RBF
128 vpc
= m32rbf_pbb_cti_chain (current_cpu
, sem_arg
,
129 pbb_br_type
, pbb_br_npc
);
132 /* FIXME: Allow provision of explicit ifmt spec in insn spec. */
133 vpc
= m32rbf_pbb_cti_chain (current_cpu
, sem_arg
,
134 CPU_PBB_BR_TYPE (current_cpu
),
135 CPU_PBB_BR_NPC (current_cpu
));
144 /* x-chain: --chain-- */
147 SEM_FN_NAME (m32rbf
,x_chain
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
149 #define FLD(f) abuf->fields.sfmt_empty.f
150 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
151 int UNUSED written
= 0;
152 IADDR UNUSED pc
= abuf
->addr
;
153 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
156 #if WITH_SCACHE_PBB_M32RBF
157 vpc
= m32rbf_pbb_chain (current_cpu
, sem_arg
);
168 /* x-begin: --begin-- */
171 SEM_FN_NAME (m32rbf
,x_begin
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
173 #define FLD(f) abuf->fields.sfmt_empty.f
174 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
175 int UNUSED written
= 0;
176 IADDR UNUSED pc
= abuf
->addr
;
177 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 0);
180 #if WITH_SCACHE_PBB_M32RBF
181 #if defined DEFINE_SWITCH || defined FAST_P
182 /* In the switch case FAST_P is a constant, allowing several optimizations
183 in any called inline functions. */
184 vpc
= m32rbf_pbb_begin (current_cpu
, FAST_P
);
186 #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */
187 vpc
= m32rbf_pbb_begin (current_cpu
, STATE_RUN_FAST_P (CPU_STATE (current_cpu
)));
189 vpc
= m32rbf_pbb_begin (current_cpu
, 0);
199 /* add: add $dr,$sr */
202 SEM_FN_NAME (m32rbf
,add
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
204 #define FLD(f) abuf->fields.sfmt_add.f
205 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
206 int UNUSED written
= 0;
207 IADDR UNUSED pc
= abuf
->addr
;
208 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
211 SI opval
= ADDSI (* FLD (i_dr
), * FLD (i_sr
));
212 * FLD (i_dr
) = opval
;
213 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
220 /* add3: add3 $dr,$sr,$hash$slo16 */
223 SEM_FN_NAME (m32rbf
,add3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
225 #define FLD(f) abuf->fields.sfmt_add3.f
226 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
227 int UNUSED written
= 0;
228 IADDR UNUSED pc
= abuf
->addr
;
229 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
232 SI opval
= ADDSI (* FLD (i_sr
), FLD (f_simm16
));
233 * FLD (i_dr
) = opval
;
234 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
241 /* and: and $dr,$sr */
244 SEM_FN_NAME (m32rbf
,and) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
246 #define FLD(f) abuf->fields.sfmt_add.f
247 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
248 int UNUSED written
= 0;
249 IADDR UNUSED pc
= abuf
->addr
;
250 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
253 SI opval
= ANDSI (* FLD (i_dr
), * FLD (i_sr
));
254 * FLD (i_dr
) = opval
;
255 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
262 /* and3: and3 $dr,$sr,$uimm16 */
265 SEM_FN_NAME (m32rbf
,and3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
267 #define FLD(f) abuf->fields.sfmt_and3.f
268 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
269 int UNUSED written
= 0;
270 IADDR UNUSED pc
= abuf
->addr
;
271 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
274 SI opval
= ANDSI (* FLD (i_sr
), FLD (f_uimm16
));
275 * FLD (i_dr
) = opval
;
276 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
286 SEM_FN_NAME (m32rbf
,or) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
288 #define FLD(f) abuf->fields.sfmt_add.f
289 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
290 int UNUSED written
= 0;
291 IADDR UNUSED pc
= abuf
->addr
;
292 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
295 SI opval
= ORSI (* FLD (i_dr
), * FLD (i_sr
));
296 * FLD (i_dr
) = opval
;
297 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
304 /* or3: or3 $dr,$sr,$hash$ulo16 */
307 SEM_FN_NAME (m32rbf
,or3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
309 #define FLD(f) abuf->fields.sfmt_and3.f
310 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
311 int UNUSED written
= 0;
312 IADDR UNUSED pc
= abuf
->addr
;
313 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
316 SI opval
= ORSI (* FLD (i_sr
), FLD (f_uimm16
));
317 * FLD (i_dr
) = opval
;
318 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
325 /* xor: xor $dr,$sr */
328 SEM_FN_NAME (m32rbf
,xor) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
330 #define FLD(f) abuf->fields.sfmt_add.f
331 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
332 int UNUSED written
= 0;
333 IADDR UNUSED pc
= abuf
->addr
;
334 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
337 SI opval
= XORSI (* FLD (i_dr
), * FLD (i_sr
));
338 * FLD (i_dr
) = opval
;
339 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
346 /* xor3: xor3 $dr,$sr,$uimm16 */
349 SEM_FN_NAME (m32rbf
,xor3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
351 #define FLD(f) abuf->fields.sfmt_and3.f
352 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
353 int UNUSED written
= 0;
354 IADDR UNUSED pc
= abuf
->addr
;
355 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
358 SI opval
= XORSI (* FLD (i_sr
), FLD (f_uimm16
));
359 * FLD (i_dr
) = opval
;
360 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
367 /* addi: addi $dr,$simm8 */
370 SEM_FN_NAME (m32rbf
,addi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
372 #define FLD(f) abuf->fields.sfmt_addi.f
373 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
374 int UNUSED written
= 0;
375 IADDR UNUSED pc
= abuf
->addr
;
376 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
379 SI opval
= ADDSI (* FLD (i_dr
), FLD (f_simm8
));
380 * FLD (i_dr
) = opval
;
381 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
388 /* addv: addv $dr,$sr */
391 SEM_FN_NAME (m32rbf
,addv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
393 #define FLD(f) abuf->fields.sfmt_add.f
394 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
395 int UNUSED written
= 0;
396 IADDR UNUSED pc
= abuf
->addr
;
397 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
401 temp0
= ADDSI (* FLD (i_dr
), * FLD (i_sr
));
402 temp1
= ADDOFSI (* FLD (i_dr
), * FLD (i_sr
), 0);
405 * FLD (i_dr
) = opval
;
406 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
410 CPU (h_cond
) = opval
;
411 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
419 /* addv3: addv3 $dr,$sr,$simm16 */
422 SEM_FN_NAME (m32rbf
,addv3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
424 #define FLD(f) abuf->fields.sfmt_add3.f
425 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
426 int UNUSED written
= 0;
427 IADDR UNUSED pc
= abuf
->addr
;
428 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
432 temp0
= ADDSI (* FLD (i_sr
), FLD (f_simm16
));
433 temp1
= ADDOFSI (* FLD (i_sr
), FLD (f_simm16
), 0);
436 * FLD (i_dr
) = opval
;
437 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
441 CPU (h_cond
) = opval
;
442 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
450 /* addx: addx $dr,$sr */
453 SEM_FN_NAME (m32rbf
,addx
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
455 #define FLD(f) abuf->fields.sfmt_add.f
456 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
457 int UNUSED written
= 0;
458 IADDR UNUSED pc
= abuf
->addr
;
459 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
463 temp0
= ADDCSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
464 temp1
= ADDCFSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
467 * FLD (i_dr
) = opval
;
468 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
472 CPU (h_cond
) = opval
;
473 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
481 /* bc8: bc.s $disp8 */
484 SEM_FN_NAME (m32rbf
,bc8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
486 #define FLD(f) abuf->fields.sfmt_bl8.f
487 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
488 int UNUSED written
= 0;
489 IADDR UNUSED pc
= abuf
->addr
;
491 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
495 USI opval
= FLD (i_disp8
);
496 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
498 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
502 abuf
->written
= written
;
503 SEM_BRANCH_FINI (vpc
);
508 /* bc24: bc.l $disp24 */
511 SEM_FN_NAME (m32rbf
,bc24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
513 #define FLD(f) abuf->fields.sfmt_bl24.f
514 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
515 int UNUSED written
= 0;
516 IADDR UNUSED pc
= abuf
->addr
;
518 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
522 USI opval
= FLD (i_disp24
);
523 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
525 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
529 abuf
->written
= written
;
530 SEM_BRANCH_FINI (vpc
);
535 /* beq: beq $src1,$src2,$disp16 */
538 SEM_FN_NAME (m32rbf
,beq
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
540 #define FLD(f) abuf->fields.sfmt_beq.f
541 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
542 int UNUSED written
= 0;
543 IADDR UNUSED pc
= abuf
->addr
;
545 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
547 if (EQSI (* FLD (i_src1
), * FLD (i_src2
))) {
549 USI opval
= FLD (i_disp16
);
550 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
552 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
556 abuf
->written
= written
;
557 SEM_BRANCH_FINI (vpc
);
562 /* beqz: beqz $src2,$disp16 */
565 SEM_FN_NAME (m32rbf
,beqz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
567 #define FLD(f) abuf->fields.sfmt_beq.f
568 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
569 int UNUSED written
= 0;
570 IADDR UNUSED pc
= abuf
->addr
;
572 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
574 if (EQSI (* FLD (i_src2
), 0)) {
576 USI opval
= FLD (i_disp16
);
577 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
579 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
583 abuf
->written
= written
;
584 SEM_BRANCH_FINI (vpc
);
589 /* bgez: bgez $src2,$disp16 */
592 SEM_FN_NAME (m32rbf
,bgez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
594 #define FLD(f) abuf->fields.sfmt_beq.f
595 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
596 int UNUSED written
= 0;
597 IADDR UNUSED pc
= abuf
->addr
;
599 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
601 if (GESI (* FLD (i_src2
), 0)) {
603 USI opval
= FLD (i_disp16
);
604 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
606 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
610 abuf
->written
= written
;
611 SEM_BRANCH_FINI (vpc
);
616 /* bgtz: bgtz $src2,$disp16 */
619 SEM_FN_NAME (m32rbf
,bgtz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
621 #define FLD(f) abuf->fields.sfmt_beq.f
622 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
623 int UNUSED written
= 0;
624 IADDR UNUSED pc
= abuf
->addr
;
626 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
628 if (GTSI (* FLD (i_src2
), 0)) {
630 USI opval
= FLD (i_disp16
);
631 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
633 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
637 abuf
->written
= written
;
638 SEM_BRANCH_FINI (vpc
);
643 /* blez: blez $src2,$disp16 */
646 SEM_FN_NAME (m32rbf
,blez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
648 #define FLD(f) abuf->fields.sfmt_beq.f
649 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
650 int UNUSED written
= 0;
651 IADDR UNUSED pc
= abuf
->addr
;
653 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
655 if (LESI (* FLD (i_src2
), 0)) {
657 USI opval
= FLD (i_disp16
);
658 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
660 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
664 abuf
->written
= written
;
665 SEM_BRANCH_FINI (vpc
);
670 /* bltz: bltz $src2,$disp16 */
673 SEM_FN_NAME (m32rbf
,bltz
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
675 #define FLD(f) abuf->fields.sfmt_beq.f
676 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
677 int UNUSED written
= 0;
678 IADDR UNUSED pc
= abuf
->addr
;
680 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
682 if (LTSI (* FLD (i_src2
), 0)) {
684 USI opval
= FLD (i_disp16
);
685 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
687 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
691 abuf
->written
= written
;
692 SEM_BRANCH_FINI (vpc
);
697 /* bnez: bnez $src2,$disp16 */
700 SEM_FN_NAME (m32rbf
,bnez
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
702 #define FLD(f) abuf->fields.sfmt_beq.f
703 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
704 int UNUSED written
= 0;
705 IADDR UNUSED pc
= abuf
->addr
;
707 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
709 if (NESI (* FLD (i_src2
), 0)) {
711 USI opval
= FLD (i_disp16
);
712 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
714 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
718 abuf
->written
= written
;
719 SEM_BRANCH_FINI (vpc
);
724 /* bl8: bl.s $disp8 */
727 SEM_FN_NAME (m32rbf
,bl8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
729 #define FLD(f) abuf->fields.sfmt_bl8.f
730 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
731 int UNUSED written
= 0;
732 IADDR UNUSED pc
= abuf
->addr
;
734 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
738 SI opval
= ADDSI (ANDSI (pc
, -4), 4);
739 CPU (h_gr
[((UINT
) 14)]) = opval
;
740 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
743 USI opval
= FLD (i_disp8
);
744 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
745 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
749 SEM_BRANCH_FINI (vpc
);
754 /* bl24: bl.l $disp24 */
757 SEM_FN_NAME (m32rbf
,bl24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
759 #define FLD(f) abuf->fields.sfmt_bl24.f
760 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
761 int UNUSED written
= 0;
762 IADDR UNUSED pc
= abuf
->addr
;
764 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
768 SI opval
= ADDSI (pc
, 4);
769 CPU (h_gr
[((UINT
) 14)]) = opval
;
770 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
773 USI opval
= FLD (i_disp24
);
774 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
775 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
779 SEM_BRANCH_FINI (vpc
);
784 /* bnc8: bnc.s $disp8 */
787 SEM_FN_NAME (m32rbf
,bnc8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
789 #define FLD(f) abuf->fields.sfmt_bl8.f
790 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
791 int UNUSED written
= 0;
792 IADDR UNUSED pc
= abuf
->addr
;
794 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
796 if (NOTBI (CPU (h_cond
))) {
798 USI opval
= FLD (i_disp8
);
799 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
801 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
805 abuf
->written
= written
;
806 SEM_BRANCH_FINI (vpc
);
811 /* bnc24: bnc.l $disp24 */
814 SEM_FN_NAME (m32rbf
,bnc24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
816 #define FLD(f) abuf->fields.sfmt_bl24.f
817 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
818 int UNUSED written
= 0;
819 IADDR UNUSED pc
= abuf
->addr
;
821 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
823 if (NOTBI (CPU (h_cond
))) {
825 USI opval
= FLD (i_disp24
);
826 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
828 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
832 abuf
->written
= written
;
833 SEM_BRANCH_FINI (vpc
);
838 /* bne: bne $src1,$src2,$disp16 */
841 SEM_FN_NAME (m32rbf
,bne
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
843 #define FLD(f) abuf->fields.sfmt_beq.f
844 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
845 int UNUSED written
= 0;
846 IADDR UNUSED pc
= abuf
->addr
;
848 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
850 if (NESI (* FLD (i_src1
), * FLD (i_src2
))) {
852 USI opval
= FLD (i_disp16
);
853 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
855 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
859 abuf
->written
= written
;
860 SEM_BRANCH_FINI (vpc
);
865 /* bra8: bra.s $disp8 */
868 SEM_FN_NAME (m32rbf
,bra8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
870 #define FLD(f) abuf->fields.sfmt_bl8.f
871 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
872 int UNUSED written
= 0;
873 IADDR UNUSED pc
= abuf
->addr
;
875 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
878 USI opval
= FLD (i_disp8
);
879 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
880 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
883 SEM_BRANCH_FINI (vpc
);
888 /* bra24: bra.l $disp24 */
891 SEM_FN_NAME (m32rbf
,bra24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
893 #define FLD(f) abuf->fields.sfmt_bl24.f
894 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
895 int UNUSED written
= 0;
896 IADDR UNUSED pc
= abuf
->addr
;
898 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
901 USI opval
= FLD (i_disp24
);
902 SEM_BRANCH_VIA_CACHE (current_cpu
, sem_arg
, opval
, vpc
);
903 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
906 SEM_BRANCH_FINI (vpc
);
911 /* cmp: cmp $src1,$src2 */
914 SEM_FN_NAME (m32rbf
,cmp
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
916 #define FLD(f) abuf->fields.sfmt_st_plus.f
917 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
918 int UNUSED written
= 0;
919 IADDR UNUSED pc
= abuf
->addr
;
920 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
923 BI opval
= LTSI (* FLD (i_src1
), * FLD (i_src2
));
924 CPU (h_cond
) = opval
;
925 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
932 /* cmpi: cmpi $src2,$simm16 */
935 SEM_FN_NAME (m32rbf
,cmpi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
937 #define FLD(f) abuf->fields.sfmt_st_d.f
938 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
939 int UNUSED written
= 0;
940 IADDR UNUSED pc
= abuf
->addr
;
941 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
944 BI opval
= LTSI (* FLD (i_src2
), FLD (f_simm16
));
945 CPU (h_cond
) = opval
;
946 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
953 /* cmpu: cmpu $src1,$src2 */
956 SEM_FN_NAME (m32rbf
,cmpu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
958 #define FLD(f) abuf->fields.sfmt_st_plus.f
959 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
960 int UNUSED written
= 0;
961 IADDR UNUSED pc
= abuf
->addr
;
962 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
965 BI opval
= LTUSI (* FLD (i_src1
), * FLD (i_src2
));
966 CPU (h_cond
) = opval
;
967 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
974 /* cmpui: cmpui $src2,$simm16 */
977 SEM_FN_NAME (m32rbf
,cmpui
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
979 #define FLD(f) abuf->fields.sfmt_st_d.f
980 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
981 int UNUSED written
= 0;
982 IADDR UNUSED pc
= abuf
->addr
;
983 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
986 BI opval
= LTUSI (* FLD (i_src2
), FLD (f_simm16
));
987 CPU (h_cond
) = opval
;
988 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
995 /* div: div $dr,$sr */
998 SEM_FN_NAME (m32rbf
,div
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1000 #define FLD(f) abuf->fields.sfmt_add.f
1001 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1002 int UNUSED written
= 0;
1003 IADDR UNUSED pc
= abuf
->addr
;
1004 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1006 if (NESI (* FLD (i_sr
), 0)) {
1008 SI opval
= DIVSI (* FLD (i_dr
), * FLD (i_sr
));
1009 * FLD (i_dr
) = opval
;
1010 written
|= (1 << 2);
1011 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1015 abuf
->written
= written
;
1020 /* divu: divu $dr,$sr */
1023 SEM_FN_NAME (m32rbf
,divu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1025 #define FLD(f) abuf->fields.sfmt_add.f
1026 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1027 int UNUSED written
= 0;
1028 IADDR UNUSED pc
= abuf
->addr
;
1029 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1031 if (NESI (* FLD (i_sr
), 0)) {
1033 SI opval
= UDIVSI (* FLD (i_dr
), * FLD (i_sr
));
1034 * FLD (i_dr
) = opval
;
1035 written
|= (1 << 2);
1036 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1040 abuf
->written
= written
;
1045 /* rem: rem $dr,$sr */
1048 SEM_FN_NAME (m32rbf
,rem
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1050 #define FLD(f) abuf->fields.sfmt_add.f
1051 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1052 int UNUSED written
= 0;
1053 IADDR UNUSED pc
= abuf
->addr
;
1054 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1056 if (NESI (* FLD (i_sr
), 0)) {
1058 SI opval
= MODSI (* FLD (i_dr
), * FLD (i_sr
));
1059 * FLD (i_dr
) = opval
;
1060 written
|= (1 << 2);
1061 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1065 abuf
->written
= written
;
1070 /* remu: remu $dr,$sr */
1073 SEM_FN_NAME (m32rbf
,remu
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1075 #define FLD(f) abuf->fields.sfmt_add.f
1076 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1077 int UNUSED written
= 0;
1078 IADDR UNUSED pc
= abuf
->addr
;
1079 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1081 if (NESI (* FLD (i_sr
), 0)) {
1083 SI opval
= UMODSI (* FLD (i_dr
), * FLD (i_sr
));
1084 * FLD (i_dr
) = opval
;
1085 written
|= (1 << 2);
1086 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1090 abuf
->written
= written
;
1098 SEM_FN_NAME (m32rbf
,jl
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1100 #define FLD(f) abuf->fields.sfmt_jl.f
1101 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1102 int UNUSED written
= 0;
1103 IADDR UNUSED pc
= abuf
->addr
;
1105 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1109 temp0
= ADDSI (ANDSI (pc
, -4), 4);
1110 temp1
= ANDSI (* FLD (i_sr
), -4);
1113 CPU (h_gr
[((UINT
) 14)]) = opval
;
1114 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1118 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1119 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1123 SEM_BRANCH_FINI (vpc
);
1131 SEM_FN_NAME (m32rbf
,jmp
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1133 #define FLD(f) abuf->fields.sfmt_jl.f
1134 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1135 int UNUSED written
= 0;
1136 IADDR UNUSED pc
= abuf
->addr
;
1138 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1141 USI opval
= ANDSI (* FLD (i_sr
), -4);
1142 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1143 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1146 SEM_BRANCH_FINI (vpc
);
1151 /* ld: ld $dr,@$sr */
1154 SEM_FN_NAME (m32rbf
,ld
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1156 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1157 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1158 int UNUSED written
= 0;
1159 IADDR UNUSED pc
= abuf
->addr
;
1160 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1163 SI opval
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1164 * FLD (i_dr
) = opval
;
1165 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1172 /* ld-d: ld $dr,@($slo16,$sr) */
1175 SEM_FN_NAME (m32rbf
,ld_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1177 #define FLD(f) abuf->fields.sfmt_add3.f
1178 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1179 int UNUSED written
= 0;
1180 IADDR UNUSED pc
= abuf
->addr
;
1181 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1184 SI opval
= GETMEMSI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)));
1185 * FLD (i_dr
) = opval
;
1186 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1193 /* ldb: ldb $dr,@$sr */
1196 SEM_FN_NAME (m32rbf
,ldb
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1198 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1199 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1200 int UNUSED written
= 0;
1201 IADDR UNUSED pc
= abuf
->addr
;
1202 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1205 SI opval
= EXTQISI (GETMEMQI (current_cpu
, pc
, * FLD (i_sr
)));
1206 * FLD (i_dr
) = opval
;
1207 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1214 /* ldb-d: ldb $dr,@($slo16,$sr) */
1217 SEM_FN_NAME (m32rbf
,ldb_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1219 #define FLD(f) abuf->fields.sfmt_add3.f
1220 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1221 int UNUSED written
= 0;
1222 IADDR UNUSED pc
= abuf
->addr
;
1223 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1226 SI opval
= EXTQISI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1227 * FLD (i_dr
) = opval
;
1228 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1235 /* ldh: ldh $dr,@$sr */
1238 SEM_FN_NAME (m32rbf
,ldh
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1240 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1241 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1242 int UNUSED written
= 0;
1243 IADDR UNUSED pc
= abuf
->addr
;
1244 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1247 SI opval
= EXTHISI (GETMEMHI (current_cpu
, pc
, * FLD (i_sr
)));
1248 * FLD (i_dr
) = opval
;
1249 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1256 /* ldh-d: ldh $dr,@($slo16,$sr) */
1259 SEM_FN_NAME (m32rbf
,ldh_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1261 #define FLD(f) abuf->fields.sfmt_add3.f
1262 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1263 int UNUSED written
= 0;
1264 IADDR UNUSED pc
= abuf
->addr
;
1265 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1268 SI opval
= EXTHISI (GETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1269 * FLD (i_dr
) = opval
;
1270 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1277 /* ldub: ldub $dr,@$sr */
1280 SEM_FN_NAME (m32rbf
,ldub
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1282 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1283 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1284 int UNUSED written
= 0;
1285 IADDR UNUSED pc
= abuf
->addr
;
1286 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1289 SI opval
= ZEXTQISI (GETMEMQI (current_cpu
, pc
, * FLD (i_sr
)));
1290 * FLD (i_dr
) = opval
;
1291 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1298 /* ldub-d: ldub $dr,@($slo16,$sr) */
1301 SEM_FN_NAME (m32rbf
,ldub_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1303 #define FLD(f) abuf->fields.sfmt_add3.f
1304 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1305 int UNUSED written
= 0;
1306 IADDR UNUSED pc
= abuf
->addr
;
1307 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1310 SI opval
= ZEXTQISI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1311 * FLD (i_dr
) = opval
;
1312 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1319 /* lduh: lduh $dr,@$sr */
1322 SEM_FN_NAME (m32rbf
,lduh
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1324 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1325 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1326 int UNUSED written
= 0;
1327 IADDR UNUSED pc
= abuf
->addr
;
1328 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1331 SI opval
= ZEXTHISI (GETMEMHI (current_cpu
, pc
, * FLD (i_sr
)));
1332 * FLD (i_dr
) = opval
;
1333 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1340 /* lduh-d: lduh $dr,@($slo16,$sr) */
1343 SEM_FN_NAME (m32rbf
,lduh_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1345 #define FLD(f) abuf->fields.sfmt_add3.f
1346 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1347 int UNUSED written
= 0;
1348 IADDR UNUSED pc
= abuf
->addr
;
1349 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1352 SI opval
= ZEXTHISI (GETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))));
1353 * FLD (i_dr
) = opval
;
1354 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1361 /* ld-plus: ld $dr,@$sr+ */
1364 SEM_FN_NAME (m32rbf
,ld_plus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1366 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1367 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1368 int UNUSED written
= 0;
1369 IADDR UNUSED pc
= abuf
->addr
;
1370 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1374 temp0
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1375 temp1
= ADDSI (* FLD (i_sr
), 4);
1378 * FLD (i_dr
) = opval
;
1379 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1383 * FLD (i_sr
) = opval
;
1384 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1392 /* ld24: ld24 $dr,$uimm24 */
1395 SEM_FN_NAME (m32rbf
,ld24
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1397 #define FLD(f) abuf->fields.sfmt_ld24.f
1398 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1399 int UNUSED written
= 0;
1400 IADDR UNUSED pc
= abuf
->addr
;
1401 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1404 SI opval
= FLD (i_uimm24
);
1405 * FLD (i_dr
) = opval
;
1406 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1413 /* ldi8: ldi8 $dr,$simm8 */
1416 SEM_FN_NAME (m32rbf
,ldi8
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1418 #define FLD(f) abuf->fields.sfmt_addi.f
1419 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1420 int UNUSED written
= 0;
1421 IADDR UNUSED pc
= abuf
->addr
;
1422 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1425 SI opval
= FLD (f_simm8
);
1426 * FLD (i_dr
) = opval
;
1427 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1434 /* ldi16: ldi16 $dr,$hash$slo16 */
1437 SEM_FN_NAME (m32rbf
,ldi16
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1439 #define FLD(f) abuf->fields.sfmt_add3.f
1440 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1441 int UNUSED written
= 0;
1442 IADDR UNUSED pc
= abuf
->addr
;
1443 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
1446 SI opval
= FLD (f_simm16
);
1447 * FLD (i_dr
) = opval
;
1448 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1455 /* lock: lock $dr,@$sr */
1458 SEM_FN_NAME (m32rbf
,lock
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1460 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1461 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1462 int UNUSED written
= 0;
1463 IADDR UNUSED pc
= abuf
->addr
;
1464 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1469 CPU (h_lock
) = opval
;
1470 CGEN_TRACE_RESULT (current_cpu
, abuf
, "lock", 'x', opval
);
1473 SI opval
= GETMEMSI (current_cpu
, pc
, * FLD (i_sr
));
1474 * FLD (i_dr
) = opval
;
1475 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1483 /* machi: machi $src1,$src2 */
1486 SEM_FN_NAME (m32rbf
,machi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1488 #define FLD(f) abuf->fields.sfmt_st_plus.f
1489 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1490 int UNUSED written
= 0;
1491 IADDR UNUSED pc
= abuf
->addr
;
1492 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1495 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (ANDSI (* FLD (i_src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16))))), 8), 8);
1496 SET_H_ACCUM (opval
);
1497 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1504 /* maclo: maclo $src1,$src2 */
1507 SEM_FN_NAME (m32rbf
,maclo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1509 #define FLD(f) abuf->fields.sfmt_st_plus.f
1510 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1511 int UNUSED written
= 0;
1512 IADDR UNUSED pc
= abuf
->addr
;
1513 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1516 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (SLLSI (* FLD (i_src1
), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
))))), 8), 8);
1517 SET_H_ACCUM (opval
);
1518 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1525 /* macwhi: macwhi $src1,$src2 */
1528 SEM_FN_NAME (m32rbf
,macwhi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1530 #define FLD(f) abuf->fields.sfmt_st_plus.f
1531 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1532 int UNUSED written
= 0;
1533 IADDR UNUSED pc
= abuf
->addr
;
1534 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1537 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16))))), 8), 8);
1538 SET_H_ACCUM (opval
);
1539 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1546 /* macwlo: macwlo $src1,$src2 */
1549 SEM_FN_NAME (m32rbf
,macwlo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1551 #define FLD(f) abuf->fields.sfmt_st_plus.f
1552 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1553 int UNUSED written
= 0;
1554 IADDR UNUSED pc
= abuf
->addr
;
1555 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1558 DI opval
= SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
))))), 8), 8);
1559 SET_H_ACCUM (opval
);
1560 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1567 /* mul: mul $dr,$sr */
1570 SEM_FN_NAME (m32rbf
,mul
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1572 #define FLD(f) abuf->fields.sfmt_add.f
1573 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1574 int UNUSED written
= 0;
1575 IADDR UNUSED pc
= abuf
->addr
;
1576 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1579 SI opval
= MULSI (* FLD (i_dr
), * FLD (i_sr
));
1580 * FLD (i_dr
) = opval
;
1581 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1588 /* mulhi: mulhi $src1,$src2 */
1591 SEM_FN_NAME (m32rbf
,mulhi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1593 #define FLD(f) abuf->fields.sfmt_st_plus.f
1594 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1595 int UNUSED written
= 0;
1596 IADDR UNUSED pc
= abuf
->addr
;
1597 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1600 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1
), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16)))), 16), 16);
1601 SET_H_ACCUM (opval
);
1602 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1609 /* mullo: mullo $src1,$src2 */
1612 SEM_FN_NAME (m32rbf
,mullo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1614 #define FLD(f) abuf->fields.sfmt_st_plus.f
1615 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1616 int UNUSED written
= 0;
1617 IADDR UNUSED pc
= abuf
->addr
;
1618 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1621 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1
), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
)))), 16), 16);
1622 SET_H_ACCUM (opval
);
1623 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1630 /* mulwhi: mulwhi $src1,$src2 */
1633 SEM_FN_NAME (m32rbf
,mulwhi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1635 #define FLD(f) abuf->fields.sfmt_st_plus.f
1636 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1637 int UNUSED written
= 0;
1638 IADDR UNUSED pc
= abuf
->addr
;
1639 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1642 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2
), 16)))), 8), 8);
1643 SET_H_ACCUM (opval
);
1644 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1651 /* mulwlo: mulwlo $src1,$src2 */
1654 SEM_FN_NAME (m32rbf
,mulwlo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1656 #define FLD(f) abuf->fields.sfmt_st_plus.f
1657 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1658 int UNUSED written
= 0;
1659 IADDR UNUSED pc
= abuf
->addr
;
1660 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1663 DI opval
= SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1
)), EXTHIDI (TRUNCSIHI (* FLD (i_src2
)))), 8), 8);
1664 SET_H_ACCUM (opval
);
1665 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1672 /* mv: mv $dr,$sr */
1675 SEM_FN_NAME (m32rbf
,mv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1677 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1678 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1679 int UNUSED written
= 0;
1680 IADDR UNUSED pc
= abuf
->addr
;
1681 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1684 SI opval
= * FLD (i_sr
);
1685 * FLD (i_dr
) = opval
;
1686 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1693 /* mvfachi: mvfachi $dr */
1696 SEM_FN_NAME (m32rbf
,mvfachi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1698 #define FLD(f) abuf->fields.sfmt_seth.f
1699 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1700 int UNUSED written
= 0;
1701 IADDR UNUSED pc
= abuf
->addr
;
1702 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1705 SI opval
= TRUNCDISI (SRADI (GET_H_ACCUM (), 32));
1706 * FLD (i_dr
) = opval
;
1707 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1714 /* mvfaclo: mvfaclo $dr */
1717 SEM_FN_NAME (m32rbf
,mvfaclo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1719 #define FLD(f) abuf->fields.sfmt_seth.f
1720 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1721 int UNUSED written
= 0;
1722 IADDR UNUSED pc
= abuf
->addr
;
1723 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1726 SI opval
= TRUNCDISI (GET_H_ACCUM ());
1727 * FLD (i_dr
) = opval
;
1728 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1735 /* mvfacmi: mvfacmi $dr */
1738 SEM_FN_NAME (m32rbf
,mvfacmi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1740 #define FLD(f) abuf->fields.sfmt_seth.f
1741 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1742 int UNUSED written
= 0;
1743 IADDR UNUSED pc
= abuf
->addr
;
1744 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1747 SI opval
= TRUNCDISI (SRADI (GET_H_ACCUM (), 16));
1748 * FLD (i_dr
) = opval
;
1749 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1756 /* mvfc: mvfc $dr,$scr */
1759 SEM_FN_NAME (m32rbf
,mvfc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1761 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1762 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1763 int UNUSED written
= 0;
1764 IADDR UNUSED pc
= abuf
->addr
;
1765 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1768 SI opval
= GET_H_CR (FLD (f_r2
));
1769 * FLD (i_dr
) = opval
;
1770 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1777 /* mvtachi: mvtachi $src1 */
1780 SEM_FN_NAME (m32rbf
,mvtachi
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1782 #define FLD(f) abuf->fields.sfmt_st_plus.f
1783 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1784 int UNUSED written
= 0;
1785 IADDR UNUSED pc
= abuf
->addr
;
1786 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1789 DI opval
= ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1
)), 32));
1790 SET_H_ACCUM (opval
);
1791 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1798 /* mvtaclo: mvtaclo $src1 */
1801 SEM_FN_NAME (m32rbf
,mvtaclo
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1803 #define FLD(f) abuf->fields.sfmt_st_plus.f
1804 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1805 int UNUSED written
= 0;
1806 IADDR UNUSED pc
= abuf
->addr
;
1807 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1810 DI opval
= ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1
)));
1811 SET_H_ACCUM (opval
);
1812 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1819 /* mvtc: mvtc $sr,$dcr */
1822 SEM_FN_NAME (m32rbf
,mvtc
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1824 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1825 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1826 int UNUSED written
= 0;
1827 IADDR UNUSED pc
= abuf
->addr
;
1828 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1831 USI opval
= * FLD (i_sr
);
1832 SET_H_CR (FLD (f_r1
), opval
);
1833 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
1840 /* neg: neg $dr,$sr */
1843 SEM_FN_NAME (m32rbf
,neg
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1845 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1846 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1847 int UNUSED written
= 0;
1848 IADDR UNUSED pc
= abuf
->addr
;
1849 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1852 SI opval
= NEGSI (* FLD (i_sr
));
1853 * FLD (i_dr
) = opval
;
1854 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1864 SEM_FN_NAME (m32rbf
,nop
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1866 #define FLD(f) abuf->fields.sfmt_empty.f
1867 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1868 int UNUSED written
= 0;
1869 IADDR UNUSED pc
= abuf
->addr
;
1870 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1872 PROFILE_COUNT_FILLNOPS (current_cpu
, abuf
->addr
);
1878 /* not: not $dr,$sr */
1881 SEM_FN_NAME (m32rbf
,not) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1883 #define FLD(f) abuf->fields.sfmt_ld_plus.f
1884 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1885 int UNUSED written
= 0;
1886 IADDR UNUSED pc
= abuf
->addr
;
1887 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1890 SI opval
= INVSI (* FLD (i_sr
));
1891 * FLD (i_dr
) = opval
;
1892 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
1902 SEM_FN_NAME (m32rbf
,rac
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1904 #define FLD(f) abuf->fields.sfmt_empty.f
1905 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1906 int UNUSED written
= 0;
1907 IADDR UNUSED pc
= abuf
->addr
;
1908 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1912 tmp_tmp1
= SLLDI (GET_H_ACCUM (), 1);
1913 tmp_tmp1
= ADDDI (tmp_tmp1
, MAKEDI (0, 32768));
1915 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)));
1916 SET_H_ACCUM (opval
);
1917 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1928 SEM_FN_NAME (m32rbf
,rach
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1930 #define FLD(f) abuf->fields.sfmt_empty.f
1931 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1932 int UNUSED written
= 0;
1933 IADDR UNUSED pc
= abuf
->addr
;
1934 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1938 tmp_tmp1
= ANDDI (GET_H_ACCUM (), MAKEDI (16777215, 0xffffffff));
1939 if (ANDIF (GEDI (tmp_tmp1
, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1
, MAKEDI (8388607, 0xffffffff)))) {
1940 tmp_tmp1
= MAKEDI (16383, 0x80000000);
1942 if (ANDIF (GEDI (tmp_tmp1
, MAKEDI (8388608, 0)), LEDI (tmp_tmp1
, MAKEDI (16760832, 0)))) {
1943 tmp_tmp1
= MAKEDI (16760832, 0);
1945 tmp_tmp1
= ANDDI (ADDDI (GET_H_ACCUM (), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
1948 tmp_tmp1
= SLLDI (tmp_tmp1
, 1);
1950 DI opval
= SRADI (SLLDI (tmp_tmp1
, 7), 7);
1951 SET_H_ACCUM (opval
);
1952 CGEN_TRACE_RESULT (current_cpu
, abuf
, "accum", 'D', opval
);
1963 SEM_FN_NAME (m32rbf
,rte
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
1965 #define FLD(f) abuf->fields.sfmt_empty.f
1966 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
1967 int UNUSED written
= 0;
1968 IADDR UNUSED pc
= abuf
->addr
;
1970 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
1974 USI opval
= ANDSI (GET_H_CR (((UINT
) 6)), -4);
1975 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
1976 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
1979 USI opval
= GET_H_CR (((UINT
) 14));
1980 SET_H_CR (((UINT
) 6), opval
);
1981 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
1984 UQI opval
= CPU (h_bpsw
);
1986 CGEN_TRACE_RESULT (current_cpu
, abuf
, "psw", 'x', opval
);
1989 UQI opval
= CPU (h_bbpsw
);
1990 CPU (h_bpsw
) = opval
;
1991 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bpsw", 'x', opval
);
1995 SEM_BRANCH_FINI (vpc
);
2000 /* seth: seth $dr,$hash$hi16 */
2003 SEM_FN_NAME (m32rbf
,seth
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2005 #define FLD(f) abuf->fields.sfmt_seth.f
2006 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2007 int UNUSED written
= 0;
2008 IADDR UNUSED pc
= abuf
->addr
;
2009 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2012 SI opval
= SLLSI (FLD (f_hi16
), 16);
2013 * FLD (i_dr
) = opval
;
2014 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2021 /* sll: sll $dr,$sr */
2024 SEM_FN_NAME (m32rbf
,sll
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2026 #define FLD(f) abuf->fields.sfmt_add.f
2027 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2028 int UNUSED written
= 0;
2029 IADDR UNUSED pc
= abuf
->addr
;
2030 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2033 SI opval
= SLLSI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2034 * FLD (i_dr
) = opval
;
2035 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2042 /* sll3: sll3 $dr,$sr,$simm16 */
2045 SEM_FN_NAME (m32rbf
,sll3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2047 #define FLD(f) abuf->fields.sfmt_add3.f
2048 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2049 int UNUSED written
= 0;
2050 IADDR UNUSED pc
= abuf
->addr
;
2051 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2054 SI opval
= SLLSI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2055 * FLD (i_dr
) = opval
;
2056 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2063 /* slli: slli $dr,$uimm5 */
2066 SEM_FN_NAME (m32rbf
,slli
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2068 #define FLD(f) abuf->fields.sfmt_slli.f
2069 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2070 int UNUSED written
= 0;
2071 IADDR UNUSED pc
= abuf
->addr
;
2072 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2075 SI opval
= SLLSI (* FLD (i_dr
), FLD (f_uimm5
));
2076 * FLD (i_dr
) = opval
;
2077 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2084 /* sra: sra $dr,$sr */
2087 SEM_FN_NAME (m32rbf
,sra
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2089 #define FLD(f) abuf->fields.sfmt_add.f
2090 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2091 int UNUSED written
= 0;
2092 IADDR UNUSED pc
= abuf
->addr
;
2093 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2096 SI opval
= SRASI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2097 * FLD (i_dr
) = opval
;
2098 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2105 /* sra3: sra3 $dr,$sr,$simm16 */
2108 SEM_FN_NAME (m32rbf
,sra3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2110 #define FLD(f) abuf->fields.sfmt_add3.f
2111 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2112 int UNUSED written
= 0;
2113 IADDR UNUSED pc
= abuf
->addr
;
2114 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2117 SI opval
= SRASI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2118 * FLD (i_dr
) = opval
;
2119 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2126 /* srai: srai $dr,$uimm5 */
2129 SEM_FN_NAME (m32rbf
,srai
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2131 #define FLD(f) abuf->fields.sfmt_slli.f
2132 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2133 int UNUSED written
= 0;
2134 IADDR UNUSED pc
= abuf
->addr
;
2135 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2138 SI opval
= SRASI (* FLD (i_dr
), FLD (f_uimm5
));
2139 * FLD (i_dr
) = opval
;
2140 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2147 /* srl: srl $dr,$sr */
2150 SEM_FN_NAME (m32rbf
,srl
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2152 #define FLD(f) abuf->fields.sfmt_add.f
2153 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2154 int UNUSED written
= 0;
2155 IADDR UNUSED pc
= abuf
->addr
;
2156 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2159 SI opval
= SRLSI (* FLD (i_dr
), ANDSI (* FLD (i_sr
), 31));
2160 * FLD (i_dr
) = opval
;
2161 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2168 /* srl3: srl3 $dr,$sr,$simm16 */
2171 SEM_FN_NAME (m32rbf
,srl3
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2173 #define FLD(f) abuf->fields.sfmt_add3.f
2174 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2175 int UNUSED written
= 0;
2176 IADDR UNUSED pc
= abuf
->addr
;
2177 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2180 SI opval
= SRLSI (* FLD (i_sr
), ANDSI (FLD (f_simm16
), 31));
2181 * FLD (i_dr
) = opval
;
2182 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2189 /* srli: srli $dr,$uimm5 */
2192 SEM_FN_NAME (m32rbf
,srli
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2194 #define FLD(f) abuf->fields.sfmt_slli.f
2195 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2196 int UNUSED written
= 0;
2197 IADDR UNUSED pc
= abuf
->addr
;
2198 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2201 SI opval
= SRLSI (* FLD (i_dr
), FLD (f_uimm5
));
2202 * FLD (i_dr
) = opval
;
2203 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2210 /* st: st $src1,@$src2 */
2213 SEM_FN_NAME (m32rbf
,st
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2215 #define FLD(f) abuf->fields.sfmt_st_plus.f
2216 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2217 int UNUSED written
= 0;
2218 IADDR UNUSED pc
= abuf
->addr
;
2219 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2222 SI opval
= * FLD (i_src1
);
2223 SETMEMSI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2224 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2231 /* st-d: st $src1,@($slo16,$src2) */
2234 SEM_FN_NAME (m32rbf
,st_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2236 #define FLD(f) abuf->fields.sfmt_st_d.f
2237 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2238 int UNUSED written
= 0;
2239 IADDR UNUSED pc
= abuf
->addr
;
2240 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2243 SI opval
= * FLD (i_src1
);
2244 SETMEMSI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2245 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2252 /* stb: stb $src1,@$src2 */
2255 SEM_FN_NAME (m32rbf
,stb
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2257 #define FLD(f) abuf->fields.sfmt_st_plus.f
2258 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2259 int UNUSED written
= 0;
2260 IADDR UNUSED pc
= abuf
->addr
;
2261 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2264 QI opval
= * FLD (i_src1
);
2265 SETMEMQI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2266 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2273 /* stb-d: stb $src1,@($slo16,$src2) */
2276 SEM_FN_NAME (m32rbf
,stb_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2278 #define FLD(f) abuf->fields.sfmt_st_d.f
2279 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2280 int UNUSED written
= 0;
2281 IADDR UNUSED pc
= abuf
->addr
;
2282 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2285 QI opval
= * FLD (i_src1
);
2286 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2287 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2294 /* sth: sth $src1,@$src2 */
2297 SEM_FN_NAME (m32rbf
,sth
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2299 #define FLD(f) abuf->fields.sfmt_st_plus.f
2300 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2301 int UNUSED written
= 0;
2302 IADDR UNUSED pc
= abuf
->addr
;
2303 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2306 HI opval
= * FLD (i_src1
);
2307 SETMEMHI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2308 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2315 /* sth-d: sth $src1,@($slo16,$src2) */
2318 SEM_FN_NAME (m32rbf
,sth_d
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2320 #define FLD(f) abuf->fields.sfmt_st_d.f
2321 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2322 int UNUSED written
= 0;
2323 IADDR UNUSED pc
= abuf
->addr
;
2324 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2327 HI opval
= * FLD (i_src1
);
2328 SETMEMHI (current_cpu
, pc
, ADDSI (* FLD (i_src2
), FLD (f_simm16
)), opval
);
2329 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2336 /* st-plus: st $src1,@+$src2 */
2339 SEM_FN_NAME (m32rbf
,st_plus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2341 #define FLD(f) abuf->fields.sfmt_st_plus.f
2342 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2343 int UNUSED written
= 0;
2344 IADDR UNUSED pc
= abuf
->addr
;
2345 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2349 tmp_new_src2
= ADDSI (* FLD (i_src2
), 4);
2351 SI opval
= * FLD (i_src1
);
2352 SETMEMSI (current_cpu
, pc
, tmp_new_src2
, opval
);
2353 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2356 SI opval
= tmp_new_src2
;
2357 * FLD (i_src2
) = opval
;
2358 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2366 /* st-minus: st $src1,@-$src2 */
2369 SEM_FN_NAME (m32rbf
,st_minus
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2371 #define FLD(f) abuf->fields.sfmt_st_plus.f
2372 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2373 int UNUSED written
= 0;
2374 IADDR UNUSED pc
= abuf
->addr
;
2375 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2379 tmp_new_src2
= SUBSI (* FLD (i_src2
), 4);
2381 SI opval
= * FLD (i_src1
);
2382 SETMEMSI (current_cpu
, pc
, tmp_new_src2
, opval
);
2383 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2386 SI opval
= tmp_new_src2
;
2387 * FLD (i_src2
) = opval
;
2388 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2396 /* sub: sub $dr,$sr */
2399 SEM_FN_NAME (m32rbf
,sub
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2401 #define FLD(f) abuf->fields.sfmt_add.f
2402 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2403 int UNUSED written
= 0;
2404 IADDR UNUSED pc
= abuf
->addr
;
2405 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2408 SI opval
= SUBSI (* FLD (i_dr
), * FLD (i_sr
));
2409 * FLD (i_dr
) = opval
;
2410 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2417 /* subv: subv $dr,$sr */
2420 SEM_FN_NAME (m32rbf
,subv
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2422 #define FLD(f) abuf->fields.sfmt_add.f
2423 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2424 int UNUSED written
= 0;
2425 IADDR UNUSED pc
= abuf
->addr
;
2426 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2430 temp0
= SUBSI (* FLD (i_dr
), * FLD (i_sr
));
2431 temp1
= SUBOFSI (* FLD (i_dr
), * FLD (i_sr
), 0);
2434 * FLD (i_dr
) = opval
;
2435 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2439 CPU (h_cond
) = opval
;
2440 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2448 /* subx: subx $dr,$sr */
2451 SEM_FN_NAME (m32rbf
,subx
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2453 #define FLD(f) abuf->fields.sfmt_add.f
2454 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2455 int UNUSED written
= 0;
2456 IADDR UNUSED pc
= abuf
->addr
;
2457 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2461 temp0
= SUBCSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
2462 temp1
= SUBCFSI (* FLD (i_dr
), * FLD (i_sr
), CPU (h_cond
));
2465 * FLD (i_dr
) = opval
;
2466 CGEN_TRACE_RESULT (current_cpu
, abuf
, "gr", 'x', opval
);
2470 CPU (h_cond
) = opval
;
2471 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2479 /* trap: trap $uimm4 */
2482 SEM_FN_NAME (m32rbf
,trap
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2484 #define FLD(f) abuf->fields.sfmt_trap.f
2485 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2486 int UNUSED written
= 0;
2487 IADDR UNUSED pc
= abuf
->addr
;
2489 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2493 USI opval
= GET_H_CR (((UINT
) 6));
2494 SET_H_CR (((UINT
) 14), opval
);
2495 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2498 USI opval
= ADDSI (pc
, 4);
2499 SET_H_CR (((UINT
) 6), opval
);
2500 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2503 UQI opval
= CPU (h_bpsw
);
2504 CPU (h_bbpsw
) = opval
;
2505 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bbpsw", 'x', opval
);
2508 UQI opval
= GET_H_PSW ();
2509 CPU (h_bpsw
) = opval
;
2510 CGEN_TRACE_RESULT (current_cpu
, abuf
, "bpsw", 'x', opval
);
2513 UQI opval
= ANDQI (GET_H_PSW (), 128);
2515 CGEN_TRACE_RESULT (current_cpu
, abuf
, "psw", 'x', opval
);
2518 SI opval
= m32r_trap (current_cpu
, pc
, FLD (f_uimm4
));
2519 SEM_BRANCH_VIA_ADDR (current_cpu
, sem_arg
, opval
, vpc
);
2520 CGEN_TRACE_RESULT (current_cpu
, abuf
, "pc", 'x', opval
);
2524 SEM_BRANCH_FINI (vpc
);
2529 /* unlock: unlock $src1,@$src2 */
2532 SEM_FN_NAME (m32rbf
,unlock
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2534 #define FLD(f) abuf->fields.sfmt_st_plus.f
2535 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2536 int UNUSED written
= 0;
2537 IADDR UNUSED pc
= abuf
->addr
;
2538 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2543 SI opval
= * FLD (i_src1
);
2544 SETMEMSI (current_cpu
, pc
, * FLD (i_src2
), opval
);
2545 written
|= (1 << 4);
2546 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2551 CPU (h_lock
) = opval
;
2552 CGEN_TRACE_RESULT (current_cpu
, abuf
, "lock", 'x', opval
);
2556 abuf
->written
= written
;
2561 /* clrpsw: clrpsw $uimm8 */
2564 SEM_FN_NAME (m32rbf
,clrpsw
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2566 #define FLD(f) abuf->fields.sfmt_clrpsw.f
2567 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2568 int UNUSED written
= 0;
2569 IADDR UNUSED pc
= abuf
->addr
;
2570 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2573 USI opval
= ANDSI (GET_H_CR (((UINT
) 0)), ORSI (ZEXTQISI (INVQI (FLD (f_uimm8
))), 65280));
2574 SET_H_CR (((UINT
) 0), opval
);
2575 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2582 /* setpsw: setpsw $uimm8 */
2585 SEM_FN_NAME (m32rbf
,setpsw
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2587 #define FLD(f) abuf->fields.sfmt_clrpsw.f
2588 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2589 int UNUSED written
= 0;
2590 IADDR UNUSED pc
= abuf
->addr
;
2591 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2594 USI opval
= FLD (f_uimm8
);
2595 SET_H_CR (((UINT
) 0), opval
);
2596 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cr", 'x', opval
);
2603 /* bset: bset $uimm3,@($slo16,$sr) */
2606 SEM_FN_NAME (m32rbf
,bset
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2608 #define FLD(f) abuf->fields.sfmt_bset.f
2609 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2610 int UNUSED written
= 0;
2611 IADDR UNUSED pc
= abuf
->addr
;
2612 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2615 QI opval
= ORQI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))), SLLQI (1, SUBSI (7, FLD (f_uimm3
))));
2616 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)), opval
);
2617 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2624 /* bclr: bclr $uimm3,@($slo16,$sr) */
2627 SEM_FN_NAME (m32rbf
,bclr
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2629 #define FLD(f) abuf->fields.sfmt_bset.f
2630 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2631 int UNUSED written
= 0;
2632 IADDR UNUSED pc
= abuf
->addr
;
2633 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 4);
2636 QI opval
= ANDQI (GETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
))), INVQI (SLLQI (1, SUBSI (7, FLD (f_uimm3
)))));
2637 SETMEMQI (current_cpu
, pc
, ADDSI (* FLD (i_sr
), FLD (f_simm16
)), opval
);
2638 CGEN_TRACE_RESULT (current_cpu
, abuf
, "memory", 'x', opval
);
2645 /* btst: btst $uimm3,$sr */
2648 SEM_FN_NAME (m32rbf
,btst
) (SIM_CPU
*current_cpu
, SEM_ARG sem_arg
)
2650 #define FLD(f) abuf->fields.sfmt_bset.f
2651 ARGBUF
*abuf
= SEM_ARGBUF (sem_arg
);
2652 int UNUSED written
= 0;
2653 IADDR UNUSED pc
= abuf
->addr
;
2654 SEM_PC vpc
= SEM_NEXT_VPC (sem_arg
, pc
, 2);
2657 BI opval
= ANDQI (SRLQI (* FLD (i_sr
), SUBSI (7, FLD (f_uimm3
))), 1);
2658 CPU (h_cond
) = opval
;
2659 CGEN_TRACE_RESULT (current_cpu
, abuf
, "cond", 'x', opval
);
2666 /* Table of all semantic fns. */
2668 static const struct sem_fn_desc sem_fns
[] = {
2669 { M32RBF_INSN_X_INVALID
, SEM_FN_NAME (m32rbf
,x_invalid
) },
2670 { M32RBF_INSN_X_AFTER
, SEM_FN_NAME (m32rbf
,x_after
) },
2671 { M32RBF_INSN_X_BEFORE
, SEM_FN_NAME (m32rbf
,x_before
) },
2672 { M32RBF_INSN_X_CTI_CHAIN
, SEM_FN_NAME (m32rbf
,x_cti_chain
) },
2673 { M32RBF_INSN_X_CHAIN
, SEM_FN_NAME (m32rbf
,x_chain
) },
2674 { M32RBF_INSN_X_BEGIN
, SEM_FN_NAME (m32rbf
,x_begin
) },
2675 { M32RBF_INSN_ADD
, SEM_FN_NAME (m32rbf
,add
) },
2676 { M32RBF_INSN_ADD3
, SEM_FN_NAME (m32rbf
,add3
) },
2677 { M32RBF_INSN_AND
, SEM_FN_NAME (m32rbf
,and) },
2678 { M32RBF_INSN_AND3
, SEM_FN_NAME (m32rbf
,and3
) },
2679 { M32RBF_INSN_OR
, SEM_FN_NAME (m32rbf
,or) },
2680 { M32RBF_INSN_OR3
, SEM_FN_NAME (m32rbf
,or3
) },
2681 { M32RBF_INSN_XOR
, SEM_FN_NAME (m32rbf
,xor) },
2682 { M32RBF_INSN_XOR3
, SEM_FN_NAME (m32rbf
,xor3
) },
2683 { M32RBF_INSN_ADDI
, SEM_FN_NAME (m32rbf
,addi
) },
2684 { M32RBF_INSN_ADDV
, SEM_FN_NAME (m32rbf
,addv
) },
2685 { M32RBF_INSN_ADDV3
, SEM_FN_NAME (m32rbf
,addv3
) },
2686 { M32RBF_INSN_ADDX
, SEM_FN_NAME (m32rbf
,addx
) },
2687 { M32RBF_INSN_BC8
, SEM_FN_NAME (m32rbf
,bc8
) },
2688 { M32RBF_INSN_BC24
, SEM_FN_NAME (m32rbf
,bc24
) },
2689 { M32RBF_INSN_BEQ
, SEM_FN_NAME (m32rbf
,beq
) },
2690 { M32RBF_INSN_BEQZ
, SEM_FN_NAME (m32rbf
,beqz
) },
2691 { M32RBF_INSN_BGEZ
, SEM_FN_NAME (m32rbf
,bgez
) },
2692 { M32RBF_INSN_BGTZ
, SEM_FN_NAME (m32rbf
,bgtz
) },
2693 { M32RBF_INSN_BLEZ
, SEM_FN_NAME (m32rbf
,blez
) },
2694 { M32RBF_INSN_BLTZ
, SEM_FN_NAME (m32rbf
,bltz
) },
2695 { M32RBF_INSN_BNEZ
, SEM_FN_NAME (m32rbf
,bnez
) },
2696 { M32RBF_INSN_BL8
, SEM_FN_NAME (m32rbf
,bl8
) },
2697 { M32RBF_INSN_BL24
, SEM_FN_NAME (m32rbf
,bl24
) },
2698 { M32RBF_INSN_BNC8
, SEM_FN_NAME (m32rbf
,bnc8
) },
2699 { M32RBF_INSN_BNC24
, SEM_FN_NAME (m32rbf
,bnc24
) },
2700 { M32RBF_INSN_BNE
, SEM_FN_NAME (m32rbf
,bne
) },
2701 { M32RBF_INSN_BRA8
, SEM_FN_NAME (m32rbf
,bra8
) },
2702 { M32RBF_INSN_BRA24
, SEM_FN_NAME (m32rbf
,bra24
) },
2703 { M32RBF_INSN_CMP
, SEM_FN_NAME (m32rbf
,cmp
) },
2704 { M32RBF_INSN_CMPI
, SEM_FN_NAME (m32rbf
,cmpi
) },
2705 { M32RBF_INSN_CMPU
, SEM_FN_NAME (m32rbf
,cmpu
) },
2706 { M32RBF_INSN_CMPUI
, SEM_FN_NAME (m32rbf
,cmpui
) },
2707 { M32RBF_INSN_DIV
, SEM_FN_NAME (m32rbf
,div
) },
2708 { M32RBF_INSN_DIVU
, SEM_FN_NAME (m32rbf
,divu
) },
2709 { M32RBF_INSN_REM
, SEM_FN_NAME (m32rbf
,rem
) },
2710 { M32RBF_INSN_REMU
, SEM_FN_NAME (m32rbf
,remu
) },
2711 { M32RBF_INSN_JL
, SEM_FN_NAME (m32rbf
,jl
) },
2712 { M32RBF_INSN_JMP
, SEM_FN_NAME (m32rbf
,jmp
) },
2713 { M32RBF_INSN_LD
, SEM_FN_NAME (m32rbf
,ld
) },
2714 { M32RBF_INSN_LD_D
, SEM_FN_NAME (m32rbf
,ld_d
) },
2715 { M32RBF_INSN_LDB
, SEM_FN_NAME (m32rbf
,ldb
) },
2716 { M32RBF_INSN_LDB_D
, SEM_FN_NAME (m32rbf
,ldb_d
) },
2717 { M32RBF_INSN_LDH
, SEM_FN_NAME (m32rbf
,ldh
) },
2718 { M32RBF_INSN_LDH_D
, SEM_FN_NAME (m32rbf
,ldh_d
) },
2719 { M32RBF_INSN_LDUB
, SEM_FN_NAME (m32rbf
,ldub
) },
2720 { M32RBF_INSN_LDUB_D
, SEM_FN_NAME (m32rbf
,ldub_d
) },
2721 { M32RBF_INSN_LDUH
, SEM_FN_NAME (m32rbf
,lduh
) },
2722 { M32RBF_INSN_LDUH_D
, SEM_FN_NAME (m32rbf
,lduh_d
) },
2723 { M32RBF_INSN_LD_PLUS
, SEM_FN_NAME (m32rbf
,ld_plus
) },
2724 { M32RBF_INSN_LD24
, SEM_FN_NAME (m32rbf
,ld24
) },
2725 { M32RBF_INSN_LDI8
, SEM_FN_NAME (m32rbf
,ldi8
) },
2726 { M32RBF_INSN_LDI16
, SEM_FN_NAME (m32rbf
,ldi16
) },
2727 { M32RBF_INSN_LOCK
, SEM_FN_NAME (m32rbf
,lock
) },
2728 { M32RBF_INSN_MACHI
, SEM_FN_NAME (m32rbf
,machi
) },
2729 { M32RBF_INSN_MACLO
, SEM_FN_NAME (m32rbf
,maclo
) },
2730 { M32RBF_INSN_MACWHI
, SEM_FN_NAME (m32rbf
,macwhi
) },
2731 { M32RBF_INSN_MACWLO
, SEM_FN_NAME (m32rbf
,macwlo
) },
2732 { M32RBF_INSN_MUL
, SEM_FN_NAME (m32rbf
,mul
) },
2733 { M32RBF_INSN_MULHI
, SEM_FN_NAME (m32rbf
,mulhi
) },
2734 { M32RBF_INSN_MULLO
, SEM_FN_NAME (m32rbf
,mullo
) },
2735 { M32RBF_INSN_MULWHI
, SEM_FN_NAME (m32rbf
,mulwhi
) },
2736 { M32RBF_INSN_MULWLO
, SEM_FN_NAME (m32rbf
,mulwlo
) },
2737 { M32RBF_INSN_MV
, SEM_FN_NAME (m32rbf
,mv
) },
2738 { M32RBF_INSN_MVFACHI
, SEM_FN_NAME (m32rbf
,mvfachi
) },
2739 { M32RBF_INSN_MVFACLO
, SEM_FN_NAME (m32rbf
,mvfaclo
) },
2740 { M32RBF_INSN_MVFACMI
, SEM_FN_NAME (m32rbf
,mvfacmi
) },
2741 { M32RBF_INSN_MVFC
, SEM_FN_NAME (m32rbf
,mvfc
) },
2742 { M32RBF_INSN_MVTACHI
, SEM_FN_NAME (m32rbf
,mvtachi
) },
2743 { M32RBF_INSN_MVTACLO
, SEM_FN_NAME (m32rbf
,mvtaclo
) },
2744 { M32RBF_INSN_MVTC
, SEM_FN_NAME (m32rbf
,mvtc
) },
2745 { M32RBF_INSN_NEG
, SEM_FN_NAME (m32rbf
,neg
) },
2746 { M32RBF_INSN_NOP
, SEM_FN_NAME (m32rbf
,nop
) },
2747 { M32RBF_INSN_NOT
, SEM_FN_NAME (m32rbf
,not) },
2748 { M32RBF_INSN_RAC
, SEM_FN_NAME (m32rbf
,rac
) },
2749 { M32RBF_INSN_RACH
, SEM_FN_NAME (m32rbf
,rach
) },
2750 { M32RBF_INSN_RTE
, SEM_FN_NAME (m32rbf
,rte
) },
2751 { M32RBF_INSN_SETH
, SEM_FN_NAME (m32rbf
,seth
) },
2752 { M32RBF_INSN_SLL
, SEM_FN_NAME (m32rbf
,sll
) },
2753 { M32RBF_INSN_SLL3
, SEM_FN_NAME (m32rbf
,sll3
) },
2754 { M32RBF_INSN_SLLI
, SEM_FN_NAME (m32rbf
,slli
) },
2755 { M32RBF_INSN_SRA
, SEM_FN_NAME (m32rbf
,sra
) },
2756 { M32RBF_INSN_SRA3
, SEM_FN_NAME (m32rbf
,sra3
) },
2757 { M32RBF_INSN_SRAI
, SEM_FN_NAME (m32rbf
,srai
) },
2758 { M32RBF_INSN_SRL
, SEM_FN_NAME (m32rbf
,srl
) },
2759 { M32RBF_INSN_SRL3
, SEM_FN_NAME (m32rbf
,srl3
) },
2760 { M32RBF_INSN_SRLI
, SEM_FN_NAME (m32rbf
,srli
) },
2761 { M32RBF_INSN_ST
, SEM_FN_NAME (m32rbf
,st
) },
2762 { M32RBF_INSN_ST_D
, SEM_FN_NAME (m32rbf
,st_d
) },
2763 { M32RBF_INSN_STB
, SEM_FN_NAME (m32rbf
,stb
) },
2764 { M32RBF_INSN_STB_D
, SEM_FN_NAME (m32rbf
,stb_d
) },
2765 { M32RBF_INSN_STH
, SEM_FN_NAME (m32rbf
,sth
) },
2766 { M32RBF_INSN_STH_D
, SEM_FN_NAME (m32rbf
,sth_d
) },
2767 { M32RBF_INSN_ST_PLUS
, SEM_FN_NAME (m32rbf
,st_plus
) },
2768 { M32RBF_INSN_ST_MINUS
, SEM_FN_NAME (m32rbf
,st_minus
) },
2769 { M32RBF_INSN_SUB
, SEM_FN_NAME (m32rbf
,sub
) },
2770 { M32RBF_INSN_SUBV
, SEM_FN_NAME (m32rbf
,subv
) },
2771 { M32RBF_INSN_SUBX
, SEM_FN_NAME (m32rbf
,subx
) },
2772 { M32RBF_INSN_TRAP
, SEM_FN_NAME (m32rbf
,trap
) },
2773 { M32RBF_INSN_UNLOCK
, SEM_FN_NAME (m32rbf
,unlock
) },
2774 { M32RBF_INSN_CLRPSW
, SEM_FN_NAME (m32rbf
,clrpsw
) },
2775 { M32RBF_INSN_SETPSW
, SEM_FN_NAME (m32rbf
,setpsw
) },
2776 { M32RBF_INSN_BSET
, SEM_FN_NAME (m32rbf
,bset
) },
2777 { M32RBF_INSN_BCLR
, SEM_FN_NAME (m32rbf
,bclr
) },
2778 { M32RBF_INSN_BTST
, SEM_FN_NAME (m32rbf
,btst
) },
2782 /* Add the semantic fns to IDESC_TABLE. */
2785 SEM_FN_NAME (m32rbf
,init_idesc_table
) (SIM_CPU
*current_cpu
)
2787 IDESC
*idesc_table
= CPU_IDESC (current_cpu
);
2788 const struct sem_fn_desc
*sf
;
2789 int mach_num
= MACH_NUM (CPU_MACH (current_cpu
));
2791 for (sf
= &sem_fns
[0]; sf
->fn
!= 0; ++sf
)
2793 const CGEN_INSN
*insn
= idesc_table
[sf
->index
].idata
;
2794 int valid_p
= (CGEN_INSN_VIRTUAL_P (insn
)
2795 || CGEN_INSN_MACH_HAS_P (insn
, mach_num
));
2798 idesc_table
[sf
->index
].sem_fast
= sf
->fn
;
2800 idesc_table
[sf
->index
].sem_fast
= SEM_FN_NAME (m32rbf
,x_invalid
);
2803 idesc_table
[sf
->index
].sem_full
= sf
->fn
;
2805 idesc_table
[sf
->index
].sem_full
= SEM_FN_NAME (m32rbf
,x_invalid
);
This page took 0.087244 seconds and 4 git commands to generate.